blog is moving

April 24, 2008

This blog is moving to I’m moving to blogger to have more control of pasting code snippets, etc. Follow me there!


I released a little gem this week that helps to deal with what can be an annoying issue in larger ruby projects: requires. Unfortunately, relative requires will always be relative to the file that launched the application, not to the file making the require itself. What a pain. This means that if you’re launching your application from rake, from a test suite or from the command line, you need to rely on some trick. These include unshifting your lib directory onto the load path or using the File.dirname(__FILE__) trick. Both are cumbersome and a bit annoying, but I think each has a far more detrimental side-effect: readability.

If I’ve unshifted lib onto the $PATH variable, I make all requires within my application (or gem, etc.) as though they are being made from the base of the lib directory. Ok, this gives us a convention, but it also gives us a lot of confusion. And, more importantly, we can not take any file, at any time, and run it! I want every ruby file I write to be self containing and explicitly define it’s dependencies. I want every ruby file I write to be able to be loaded into irb without consequences. Need is a gem that helps with these problems.

To use need, simply “need” a file using a relative path from the file that has the dependency. And that’s it. This will work no matter where you application is launched from. And your file can always be loaded directly into irb. And the dependencies are clear (as are their locations from the file itself) without knowing any extra application-level magic. To use need, just do:

require 'rubygems'; require 'need'

Need is implemented as an extension to Object and it uses the binding of the block (yes, those curly braces are needed in the call, no pun intended) to remember the scope of the file where need was called, and hence eval __FILE__ with that file’s location and not the location of the Object extension file itself.

What are you waiting for, install it now:

sudo gem install need

Drop me a line if you have any questions, and happy needing!

RMagick on Ubuntu

September 11, 2007

I had a hell of a time getting RMagick installed on my powerbook, but it was much less of a hassle on ubuntu. Here’s all I had to do:

sudo apt-get install imagemagick libmagick9-dev
sudo gem install rmagick

It worked on the first try! This was a nice surprise as it took me days of searching the web to get everything working on OSX. Let me know if you run across any problems with this.

Back in the US

September 11, 2007

Well, I’m back in the US after a great 2 1/2 weeks in Bangalore, and I’m awaiting my first assignment with ThoughtWorks. While on the beach, I’ve been toying around with an Open Source project we started with some colleagues while in India. Should be interesting to get some experience with distributed development first hand.

We’ve got Mingle up and running and hopefully we can get someone to throw cruisecontrol rb up on a box somewhere so we can learn how these tools help/don’t help our development efforts.

It looks like I won’t be able to stop myself from buying a new Macbook Pro either. I’ve run out of excuses as I’m able to use it for work now. Nothing much else exciting right now, but I’ll post if/when anything turns up.

Weekend trip and Jruby demo

September 5, 2007

This past weekend a large group of us in Bangalore took a trip to Mysore. It’s a city which is about 3 hours outside of Bangalore and was a great experience. We saw several palaces, a few temples and got to see more of the Indian country side outside of the city. The contrast between the overstretched infrastructure of Bangalore to the beautiful green and open country is quite shocking. All in all the trip was great and the sites were beautiful (photos on flickr).

I also had the opportunity to hear Ola Bini give a great intro to Jruby. I’ve toyed around with it a bit in the past few months but Ola’s talk was really enlightening. He was able to get right down to the “why should I care” about the project, and it made quite an impression on all who were in attendance. He was frank about the things he feels that Matz’ Ruby Implementation (MRI) isn’t doing so well (threads, concurrency, c extensions, etc) and made awesome points about how Jruby addresses many of these concerns. Wish I could attend RailsConf Europe to hear more about the things he’s doing with Jruby and Mingle.

I’m heading back home to the states this Friday and I’ve yet to hear where I’ll be staffed, so hopefully something should come up soon.


Lots of cool stuff going on here. Yesterday, we had an awesome presentation about how ThoughtWorks makes fixed-priced projects work. Not just work, but work in an agile manner and achieve great results. I’ve had relatively bad experiences on fixed price projects in the past, but this talk was really inspiring. It basically involved creating a client contingency plan by giving them a “bucket” of free stories. When the client decided that they wanted some new feature that was outside of scope, rather than bickering and fighting about price, scope, etc., the client could simply take a few story points out of their bucket. This made the relationship better and the project smoother. Cool stuff.

Also, yesterday Roy Singham, our founder, showed up in Bangalore and took our Immersion class out to dinner. The food was good, the iPhone ripping began approximately 5 minutes after sitting down, and Roy proposed a chili eating contest. Ola Bini destroyed the competition with 10 chili’s. I ate literally 1/10th of 1 and felt horrendous the rest of the night (pictures forth coming).

Today, we had a quick talk from some of the ThoughtWorks Studios guys. Studios is essentially our product arm. It inspired me to get both CruiseControl.rb and Mingle (two Studios products) installed on my Ubuntu box and I’m pretty happy with each. I feel like they’re neat examples of the power ruby (and jruby) can have on the enterprise level.

Halfway thought Immersion, I’m really happy with the way things are going. We’re doing a trip to Mysore tomorrow where there’s apparently a pretty cool temple.

India: the first week

August 29, 2007

Howdy from the garden city. The first week here has been a total blur, but I’ll try to summarize as best I can.

The flight was one by far the longest I’ve ever experienced. Two 9 hour flights back to back with an hour delay in Chicago (of course). My 5 US co-workers and I landed to the sight of a sign proclaiming “if your name appears on this list, please talk to an agent at the counter.” All our names were on the list. All our bags were in the Frankfurt airport. We were in the Bangalore aiprort. Oh well.

We quickly packed into a couple of cabs and rode over to our hotel. I called a few people and went to sleep.

The next day, I could see a bit more of our surroundings. We’re staying in an area called the Diamond District in Bangalore. The district is composed of a bunch of residential blocks and a corporate building, which is where ThoughtWorks office is. It’s a nice, short, 3 minute walk.

We quickly got into our training routine, which is basically classroom work from 9-6 each day. However, we’ve had tons of time to get involved in open source projects (we’ve started one here and will continue to work on it in a distributed manner after the trip), eat at a million restaurants and see a lot of the city. Here is a quick list of interesting things I’ve learned:

  • Indians become temporarily insane when getting behind the wheel of a car
  • Crossing the street is a scary. Scary as hell
  • Indian food is amazing. Fried daal, tika masala, masala dosa and veg hydrabad are some favorites so far
  • The head wobble is extremely confusing

That’s it for now, more updates coming soon. In the mean time, check out my photos.