Archive for groovy

Git on OS X Quickstart

I’ve actually been doing a little coding lately, thanks to an upcoming language shoot-out at Lambda Lounge in May.  I’ve almost got my first (only quasi-groovy) implementation complete and before I start on any refactoring, I figured it was a good time to get my version control on.

Since git is the new scm hotness, I figured I should give it a whack.  What follows is my extremely basic “just-get-me-going” instructions for OS X.

Step 1: Get git for OS X.  This is a binary release for OS X Leopard.  As of this writing, the latest version is 1.6.1.3

Step 2: Do your normal OS X install action on the downloaded binary.

Step 3 (Optional): Download GitX if you want an OS X native git GUI.

At this stage in the game you should be good to go.  Now it’s just a matter of creating your local git repo for your project. To do that, just cd to your project’s directory and type:

git init

Next, you’ll want to add everything in that directory into your local repo by typing:

git add .

Lastly, just commit it all…

git commit -m 'This is my first commit...blah, blah'

That should have you rockin’ for initial commits. The next thing I did (and which is completely optional) was to push my local repo up to my free (and therefore open source) account on github.

Once you create an account (and share your SSH public key) on github, you can then start creating projects. I created my “Vending Machine” project, then followed their directions to push up my local repo. I just entered the following commands:

git remote add origin git@github.com:danker/vendingmachine.git
git push origin master

A nice cheat-sheet on basic git commands can be found here.

2009 Technical Resolutions

I began putting my personal 2009 Resolutions/Goals to paper today and by the time I was done found out that a good chunk (> 50%) were technology related.  I figure that I should make them public so that if nothing else, I feel just a little more pressure to not sluff them off.

The main focus for 2009 is learning new languages.  It’s all the action that I’ve seen develop over the past 2-3 years, but haven’t made a priority to learn given that at work I’ve moved out of being a developer and now manage developers (boo…hiss…).  So here they are, in order (with completion* dates for each):

* – I’m defining “complete” in that I should be able to do all of the following:

  • Give a 15-30 minute presentation on it
  • Write a small-ish app
  • Be comfortable enough with the language that if I needed to start a project, I would be able to hit the ground running in the language
  • Be able to intelligently decide where/if a certain technology/language could fit in our current exclusively Java environment.

If anyone has good book, site, newsgroup, etc recommendation, please let me know.

Getting Started with Textmate (and Groovy)

After attending last week’s inaugural Lambda Lounge meeting, I’ve had a renewed determination to get my Groovy/Grails learning on.

I had previously bought Scott Davis’ Groovy Recipes, and while that book is pretty awesome, I often felt like I didn’t have a good enough base in the Groovy language to realize the full potential of the material presented.

So this weekend, I went back to the Pragmatic Programmers website and picked up (in PDF form) Venkat Subramaniam’s Programming Groovy.  I’m not too terribly far into it, but so far it feels like I’m getting eased into the language quite well.  The table of contents also gives me comfort that a solid treatment of the language is to be had.

One of the first topics covered after installation of the Groovy binaries is choice of text editor or IDE.  For OS X users, TextMate is mentioned, along with the optional TextMate Groovy Bundle, created by Graeme Rocher (Grails Lead).  I also happen to be fairly new to OS X and therefore TextMate…but it seems like everybody who’s anybody uses it, so it must be good.

I was told very early in my career to pick a editor and stick with it.  The amount of mental energy that must be expended to keep all the different keybindings/macros/shortcuts in your head will detract you from the job at hand.  So I try to pick a side and just stick with it (sorry emacs).  This is most likely the reason I won’t move off of Eclipse anytime soon.  Back in the day, I could cruise around Eclipse pretty well…not as good as this guy, but pretty well.

Now that I’m exclusively Mac at Danker HQ, I feel pretty confident immersing myself in TextMate.  So with my new direction charted, I set out to put my Groovy learnin’ on the back burner for the afternoon and get my feet wet with TextMate.

After downloading the Groovy Bundle, I was a bit confused by the directions on the site, so I took a look at a blog posting by Jason Rudolph (check out his excellent tutorial on beginning Grails development).  His take was pretty much the same…so I ended up just double-clicking the 2 bundle files and TextMate automagically installed them into the proper directory.

Next up was a small tweak that Venkat mentioned on his blog.  This allows the output of your program to be shown as a tooltip instead of a pop-up.  Nothing big…but a nice tweak nonetheless.

I’ve probably got the most mileage out of this article.  Does a nice job explaining what makes TextMate special.  For reference, I assume the TextMate manual will come in handy.

The one area I haven’t explored yet is the TextMate book on the Pragmatic Programmers website.  If anyone has bought this book and found that it offered value above what’s freely available, please let me know.

Now that I’ve got my head wrapped around this new editor and have expanded my text editing bag-of-tricks, hopefully I’ll be able to keep my mind focused on the new goal of grokking Groovy.

OSCON 2008 – Day 2

Morning Keynotes

Two of the presenters (Tim O’Reilly and some dude from Intel) talked alot about Linux on mobile devices and cloud computing.  A couple of terms that I think we’ll be hearing more soon are: MID’s = Mobile Internet Devices (think iPod Touch) and Netbooks = small-ish laptops like the Asus EEE PC.

Sessions

OpenJDK
Pretty much just talked about the timeline of pushing for an opensource version of Java and how it all started back with GNU Classpath and gjc.  The OpenJDK is still currently running a bit behind Sun’s commercial releases, but hopefully they can catch-up around Java 7.

One nice effect of OpenJDK is now Java is started to be included by default on many Linux distro’s (Debian, Fedora, etc).

Leveraging XMPP for Cloud Computing
Wish I could tell you more, but the talk was at capacity and they wouldn’t let anyone else in.  Reminded me of Thursday nights at Harpo’s in Columbia, MO during college and their “1 in, 1 out” policy.

Groovy -vs- JRuby…which one should you use?
I basically took away from the talk that it’s pretty much a wash as far as features go.  Groovy is going to be a bit easier for normal Java dudes.  Supposedly Sun has put a lot of nice features in Netbeans for JRuby support…so I might have to give it a spin.

JavaFX
There was a lot to like about this talk…especially since my group at work is heavily invested in JavaFX.  I’ll list out some of the new goodness in bullet form:

  • Java 6 update 10 is due out late summer, is a consumer-focused release focusing on improving the Java user-experience
  • Applets will now run out-of-process.  This means a couple of things: A hung applet will not crash the browser and now you can have “draggable” applets that you can pull onto the desktop.
  • Applets will now share a lot of the same features as Java WebStart apps.
  • crossdomain.xml files will be available to allow for “mashups”
  • Hardware graphics acceleration is now on by default.
  • Moving toward a more modular JRE (Java Kernel)
  • Working on video support.  Java will just wrap whatever video codecs are present on the local system.  Sun is also working on a native Java video codec.
  • Check out more about 6u10 here.

New JavaFX Stuff:

  • JavaFX Script meant to resemble Javascript (more comfortable for web designers)…but you can still call normal Java code.
  • New “javadocs” format for JavaFX
  • Netbeans plugin for JavaFX – syntax highlighting, code completion, preview
  • Photoshop and Illustrator plugins that can export to “FXD” files.  Also a tool that will convert SVG’s to FXD’s

XMPP for Cloud Services
Yet another cloud computing session that was completely jam-packed.  People seem to be bonkers about anything and everything “cloud”.

Talked mostly about how the REST polling method used in most web2.0 apps today scales horribly.  Using a PubSub methodolgy scales much better.  XMPP is built from the ground up for this type of scenario.  I’m still trying to figure out how in the Java world this would be better than just using a JMS provider like ActiveMQ.  Sounds like this might be problem that is being solved by these guys.

BONUS

Unbeknownst to me, I sat down for lunch at a table with Steve Souders.  He literally wrote the book on high performance web sites and is the creator of the YSlow! plugin for Firefox/Firebug.  He was an unbelievably nice guy and we had a good conversation about all things web, Yahoo! and Google (his current employer).

Groovy FriendFeed API

I’m starting to get my feet wet with Groovy these days, so I decided a small project would expedite the learning process.  The past few weeks, I’ve become more enamored with FriendFeed…so I decided a Groovy wrapper around their RESTful Webservice API would be a pretty good choice.

I’m hosting the work up on Google Code currently.  Any feedback (especially from Groovy veterans) is appreciated!

Groovy FriendFeed API

Syntax Highlighting Test Post

A post to test out syntax highlighting of Groovy and Java Code.

?View Code GROOVY
1
2
3
  class Hello {
      println "Hello Groovy Code!"
    }
1
2
3
4
5
6
7
package com.breomedia.labs;
 
public class HelloWorld {
    public static void main(String args[]) {
        System.out.println("Hello World!");
    }
}