Earned the Android Badge

Hey look – I earned the android badge on StackOverflow!

android badge: “Earned 100 upvotes for at least 20 answers in the android tag.”

What to put in your gitignore

A question that comes up frequently is what to put in your .gitignore files.  I recently stumbled across a nice GitHub project which has .gitignore templates for every language it seems.

Here’s a few which are useful in my daily workflow:

iOS and Mac projects in Objective-C, using Xcode – This seems to cover both Xcode 3 and 4.

Android projects in Java and Eclipse

OS X (mainly for .DS_Store)

There’s also a nice explanation of how (project-specific) .gitignore and global .gitignore files work.

By the way, if you accidentally checked in a bunch of files you didn’t want to, use “git rm” to remove them from the repository.

GitX – a great Mac OS X tool for visualizing your Git history

I’m a command-line kind of guy. I guess when your CS teachers in high school raised you on a Minicomputer with a dumb terminal and vi, you get used to that kind of thing.So I mostly use the git command line which is plenty fine for the usual git pull, git add, git commit, git push dance. (Hint: scripts are your friend) Creating branches and merging is decently good too on the command line.History is where it all falls down, though. Yes you can get the commit logs, but not the details so well. That is where a nice native Mac app like GitX comes into play. If you’ve used GitHub, it is similar to the history browser there. It also helps you visualize your branches and you can switch between them.You should definitely try out GitX if you’re using Git on Mac. Did I mention that it is free? Get it at http://gitx.frim.nl/

What to do before you do Ruby on Rails development on Mac OS X Leopard

Apple has a new series about Ruby on Rails development on Mac OS X Leopard. Its a nice article to help get you going. One thing I’d like to reiterate is that it is good to lock down your RubyGems paths. This way you will always that your RubyGems go in the right directories that Apple has set up.

So before you follow the steps in the initial Developing Rails Applications on Mac OS X Leopard article, you should take the following steps:

  1. Open up ~/.bash_profile in your favorite editor (create it if its not already there)
  2. Type in
    export GEM_HOME=/Library/Ruby/Gems/1.8
  3. Type in
    export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  4. Save ~/.bash_profile
  5. Execute
    source ~/.bash_profile

This makes it so that no matter what version of rubygems you have, you have access to the Apple-provided gems in $GEM_PATH and you’re able to install/update new gems in $GEM_HOME.

2007 Training in Review

Last year I took a lot of training. In the past, my employers would usually send me to one training event. Sometimes I would get to go to two if times were good. Other times, there was no training budget.

In 2007, I was self-employed as the sole member of Happy Apps LLC. So being in charge of the training budget (well actually the entire budget), I went to six training events:

  1. Rails Edge in Reston, VA
  2. Advanced Rails in Chicago, IL
  3. WWDC in San Francisco, CA
  4. RailsConf in Portland, OR
  5. Advanced Ruby in Reston, VA
  6. RubyConf in Charlotte, NC

So that’s 2 Ruby conferences, 3 Rails conferences, and one Cocoa conference. I actually was scheduled to go to another Cocoa conference, C4[1] over in Chicago, but had to cancel due to personal reasons.

So which ones were good and which ones were bad? I think they were all quite good. Obviously, if you want to make Mac applications like I do with WebnoteHappy, you’ll want to go WWDC.

In terms of being a good Ruby on Rails developer, I’d have to say that assuming that you already have a good background in object-oriented programming and web development, have worked through a beginning Rails book like Agile Web Development with Rails, then you really should take both the Advanced Ruby course by Pragmatic Studio, followed by the Advanced Rails course. Both taught me quite a lot of things that I hadn’t known before.

Once you’ve got that though, I think its important to keep up with the latest in techniques and also be involved in your programming community. I think The Rails Edge Conference is top notch in keeping up with what’s new in the Rails world. I hope that a date is announced soon though – I don’t see one for 2008 as of today.

RailsConf is also good for keeping up with Rails, but I think is maybe even better for just being involved in the Rails community. There were a lot of opportunities, scheduled and unscheduled, to get together with fellow RoR developers and you could sense that Rails is really changing the way that web development is being done.

RubyConf on the other hand reminded me that Ruby is not just about Rails. There’s certainly been a lot of growth of Ruby use because of Rails, but there is a deep and wide pool of talent that has fallen in love with Ruby. It was interesting to see all the different uses that people have made of Ruby. And it was definitely an honor and a pleasure to meet Matz in person. In the end, it does seem like most people who are doing Ruby full-time are making their money with Rails.

I’m trying to plan out my training in 2008 now. So I’m curious to hear what good conferences or classes other people went to in 2007. Also if there were any bad ones.

What tools do you use for Ruby on Rails?

I’m curious to see what people are using for Ruby on Rails development. I know there are a lot of products coming out nowadays – 3rd Rail from Borland, IntelliJ IDEA (my preferred IDE before Eclipse when I used to Java/Swing) does Ruby now, NetBeans is positioning itself as a Ruby IDE, Aptana, Eclipse/RDT, etc. But I don’t have enough time to try them all out.

I personally use TextMate. It’s simple but powerful. I do a fair amount of work on the command line too, using rake tasks and then shortening up my most used rake tasks or ruby scripts with bash aliases.

Is there something out there I should try that would work better? I’d preferably like something still lightweight, makes it easy to run tests and navigate files, but supported code completion, refactoring, and some sort of double-clicking to find the declaration of a method.

So… what tools do you use for Ruby on Rails?

Ruby bugs on Leopard

I installed Leopard about 2 weeks ago and been doing Ruby on Rails development on it since. I encountered some bugs initially, but I managed to conquer them. I think Leopard’s great for doing RoR development. It seems faster, it seems more polished, its just very pleasant to do work in.

Here’s what I learned though about Ruby in Leopard:

1. Don’t update rubygems. It’s already up-to-date (at least as of this writing.) If you do a “gem update –system” on Leopard, you will be sorry. Because you’ll suddenly break the careful packaging Apple has done with Ruby and reduce the 20 or so gems (not sure the exact count) available down to 0.

There’s a simple fix for this though – what happens is that the places where it looks for your gems gets mixed up. What you need to do is go into your ~/.bash_profile and enter in:

export GEM_HOME=/Library/Ruby/Gems/1.8
export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

Then do a

source ~/.bash_profile

The reason why this fixes it is that GEM_PATH now points to the place where Apple put all the system-provided gems. GEM_HOME points to where Apple originally set to where you install gems. Note that GEM_PATH is “read-only” whereas GEM_HOME Is “read-write” by rubygems. Oh and if you do this, you can safely update rubygems. :)

2. rcov is broken, but you can fix it.

For some reason, rcov out of the box will include some of its own classes in the reports when profiling functional tests on Leopard. This throws off the coverage statistics.

The fix for this is to include “#{ENV[‘GEM_HOME’]}” in the rcov exclusions parameter –exclude.

3. rcov reports don’t show up colorized in Safari 3.

Now once you’ve got rcov working, when you click on a class to see what lines are covered and which aren’t, you find out that you can’t on Leopard. Well that’s not exactly right. It turns out that its Safari 3. I also tested it out with the latest WebKit nightlies – its broken too. I looked into this and found that some old rcov 0.4 reports on the web render fine, but the newer rcov 0.8 ones don’t. It seems Safari 3 doesn’t like some of the internal anchor tags.

The workaround for this is to use any other browser for viewing your rcov reports on Leopard. If you’re using Firebug, you might as well use Firefox. Otherwise, Camino is good. Or if you’re the power user type, OmniWeb. Cutting edge – Shiira. I could go on and on – I’m a browser fanatic. Did I mention Flock?

Anyways… Ruby development on Leopard is actually quite good. These 3 bugs were not that big a deal. I think its great that Leopard ships with all sorts of Ruby goodness built right in. And I didn’t even mention RubyCocoa or anything like that.

Any other tips for Ruby development on Leopard? Let me know via a comment!

How to run Cisco VPN over EVDO when you’ve got VMWare Fusion installed

Well I finally got one of those EVDO cards, specifically a Novatel Wireless Merlin EX720 that fits nicely in the Express Card slot of my MacBook Pro. It works great pretty much everywhere I go, but there’s one thing that’s bugged me: the Cisco VPN would drop when I was on EVDO, just a few seconds after I connected.

At first, I fixed it by upgrading to a newer version of the Cisco VPN client. That fixed some issues with Parallels. All was good until I also installed VMWare Fusion. (Note that this is all on Mac OS X 10.4.10.) But today I figured out what you need to do (thanks to Michael Renner for the tip in the VMWare Community):

Cisco VPN logo
1. Download the latest Cisco VPN client. As of this writing, the best available is Fortunately, MacUpdate is hosting downloads of Cisco VPN

2. Go into Terminal and run:

sudo /Library/Application\\ Support/VMware\\ Fusion/boot.sh --stop

This has the side-effect of disabling VMWare Fusion. I think what’s happening is a conflict in the kernel extensions.

3. Start up Cisco VPN, connect and enjoy.

4. Either immediately after or later when you need VMWare Fusion, you can go back and run

sudo /Library/Application\\ Support/VMware\\ Fusion/boot.sh --start

to re-enable it.

(Updated 3/10/2008: Ensured that the backslashes in the shell commands are available to be copied from your browser – they were getting stripped out by the blog.)

CCMenu helps you monitor your builds

You’re using continuous integration, right? If not, you really should. And you should probably set it up to email you if the build breaks. But there’s a nice way to get notification right on your OS X desktop: it’s CCMenu.

CCMenu in action

CCMenu is a menu item for OS X that displays the status of your projects that are being built with CruiseControl. It works with CruiseControl.rb as well which you can use for your Ruby on Rails projects, which is where I mainly use it. When your projects are good, it shows a green rounded square and when your projects break, it shows a red one. It also uses Growl to notify you whenever there is a status update on any of your projecs. Its freeware and available thanks to Erik Doernenburg.

One tip: you can have it start up automatically by going to System Preferences > Accounts > Login Items and adding CCMenu and then checking the checkbox. Perhaps that will be a preference in the future, but for now that works for me.