Good Bye Wordpress, Hello Nanoc

I just finished migrating my blog from wordpress to nanoc using a customized version of nanoc3_blog and it feels nice.
I grew tired of keeping up with Wordpress’ updates and this migration also means that I can finally get rid of php on my vps.

However, do let me know if there is anything weird around here. The whole customization done on nanoc3_blog was related to the wordpress migration.

I wanted to make sure all url’s stayed the same so as to avoid broken links into the blog. Feel free to browse the repository and see if the changes can be helpful to you.
It also includes a modified version of a wordpress import script that was responsible for keeping the links correct, among other things.

I’ll try and document the changes I made so people can easily cherry pick what they want.

One Year of ThoughtWorks: A Retrospective

It seems like it was yesterday that I wrote about my next big challenge: Moving to Australia to join ThoughtWorks. Since then a year has passed and I thought I’d share a little bit about what it’s been like so far.

The first thing you notice when joining ThoughtWorks is that you’re surrounded by smart, opinionated people. It was once common for me to be the one fighting for automated testing, TDD, Ruby and overall finding new and better ways of doing what we do - but imagine how different it is to join a team that takes that for granted. This gives you a very high standard within the team that frees your mind to try and achieve bigger things. It’s a great feeling.

ThoughtWorks‘ culture is inspiring. We’re a small and very active community - there’s always something going on in our offices after hours: Tech nights, local groups’ meetups, training, people randomly hacking on stuff and even band rehearsals! The point is that you can get involved in several ways and the best part is that ThoughtWorks supports all that: be it providing pizzas and beers, flying us to international conferences, buying books and whatnot in order to help us do our best! I could go on but you get the point.

In return, we get to work on hard stuff. Not only technically challenging but personally challenging as well. As consultants we can be thought of as agents of change: When we go to a client, we’re not only concerned with building the coolest projects with the best tools out there - of course that’s a big part of what we do - but we’re expected to change the way they think, work and do business.

Since I joined I worked with 2 clients - and 2 different projects - that varied wildly between them. That is in part what makes working at ThoughtWorks so interesting to me. You get to change domains, technologies and teams more often than not, which nurtures a stimulating environment.

The first project for instance was a standard Java web app where we had the usual players such as Spring, Hibernate, Freemarker, etc…

My current project, on the other hand, is very much like a start-up: We have a EC2 box that plays our CI role, all code is hosted on Github, we’re using Ruby on Rails and deploying the whole thing to Heroku + RDS.

To top it off I also had the chance to make a real difference in the Queensland Flood Relief Appeal in 2010, when we built a donation app to help the flood victims - that was definitely the highlight of the year, and something I’m particularly proud of.

What next? I’m eager to find out what my second year here has to offer. Bring it on!

Look Ma, No Hands: Tweeting With Your Voice

This is just another one of those boring weekends where I felt the need to hack on something.

If you follow Google Chrome’s blog you’re probably aware of this little nifty feature they started to implement in their latest builds: HTML5 voice recognition.

And that’s when it struck me: “Hey, what if I use that and tweet with my voice instead of typing?”

The result of this hacking session is LoudParrot, a sample Rails app that shows how to do just that. You will need a fairly recent build of Google Chrome -beta - which you can download here.

You can get the source on GitHub.

Simple Jquery-daterange-picker

As in many web apps out there, this week I needed a date range picker. I shopped around and while I did find a couple of good options they were (a) too clunky and (b) didn’t prevent you from selecting invalid ranges. The latter being the one I was really interested in.

So I coded up something simple that worked and looked nice and decided to share around. It’s the jquery-daterange-picker. Its only dependencies are jQuery and jQueryUI’s datepicker.

Got get it, fork it, contribute to it or check out some examples.

RottingNames for iPhone Available for Free

Following the staggering success of the online version of RottingNames - where by success I mean the handful of metal heads constantly using the app :) - I released the iPhone version for free . You can now generate crazy and fun names anywhere! Go get it!

I’ve been meaning to post this for  a while but I was waiting to have some free time and add a few new features to the app, which I just realised won’t happen any time soon given the priorities I have at the moment. But by all means feel free to drop a line if you’re dying about a missing feature.

Now go have fun ;)

IDE Review: RubyMine

Since I started working with Ruby about 4 years ago, I’ve used quite a few text editors and ide’s: RadRails, gedit + plugins, TextMate and Vim.

TextMate is the one I’ve used the most and it’s been ok for a long time. Until you realize you need half a dozen bundles to make it really useful for ruby development. Obviously the same goes for Vim and gedit.

Oh, and forget about refactoring. In these tools refactoring equals regex global replace. So if you need it, well, forget it.

That’s when I decided to give RubyMine a fair go. I’ve been using it heavily for a while now and I must say I love it!

What pissed me off about RadRails when I first tried it was the speed. It was too slow, something people take for granted when running java based IDE’s.

However this is not true for RubyMine. You DO take a hit on startup, nothing major, but once it’s done, it’s a breeze.

I’ve compiled a list of my favorite productivity shortcuts and features. Hope it’ll be useful to someone else.

Productivity Shortcuts


Ctrl + Tab - File Switcher

Cmd + Shift + T - Switching between implementation and test works perfectly. Even in a pure ruby project

Cmd + Shift + F12 - Expand/restore editor

Alt + Shift + N - Go to model/view/controller

Alt + F1 - Show current file in other views such as the project tree (scroll to file)

Cmd + Shift + N - Open file

Cmd + Alt + Shift + N - Open symbol - across files

Alt + F7 - Find usages - when on a method, variable, etc…


Ctrl + Shift + F10 - Run current [test] file. When inside a test method, run that single method.

Ctrl + Shift + F9 - Same as above, but in debug mode.

Shift + F10/Shift + F9 - Run/Debug last action executed

Alt + R - Run rake task


Cmd + Alt + N - Inline variable/ method

Cmd + Alt + M - Extract method

Shift + F6 - Rename

F5 - Copy current file as…


Cmd + Y - Delete line

Cmd + D - Duplicate Line/Selection

Alt + Mouse - Column selection

Cmd + Shift + (Up Arrow|Down Arrow) - Moves de line or selected block of code up or down


Code completion - It’s fairly accurate and pretty fast. They’ve done some good yak shaving around this area.

Debugger - The debugging interface is an absolute beauty. Saved me a lot of time where I’d have used puts statements or googled to re-learn how to use ruby-debug instead. Definitely worth checking out.

The bad stuff

It is not free - unless you are a committer to an open-source project. But it’s not expensive either.

It is a bit slower - but not that much. The performance hit is insignificant compared to the added value.

Regex file open, TextMate style - What can I say? I do miss this.

Wrap highlighted text - In TextMate, if you highlight a word and press “, [, {, ( or # it surrounds the word with the respective combination of quotes, brackets, etc… Another missed feature

Wrapping up
It’s probably soon to say it but so far RubyMine has been my missing Ruby IDE. And I’m very happy with it. :)

Clouds Against the Floods: Presentation Available

Last Tuesday I gave a short presentation on the whole Clouds Against the Floods thing at the Ruby on Rails Oceania User Group here in Sydney.

Those guys are awesome and they recorded the talk - thanks guys!

If you’d like to download the slides, they’re available on Slideshare.

Enjoy! ;)

Update to AppConstants: It Can Now Be Used as a Gem

This is just a quick post to let you know that AppConstants can now be used as gem!

Just add it to your Gemfile and ‘bundle install’ it:

#in your Gemfile
gem "app_constants"

#in the console
$ bundle install
$ rails generate app_constants
#then follow the instructions on-screen instructions

It can also be used without Rails. Check out full instructions on the GitHub repository.

Feedback welcome :)

Clouds Against the Floods

I think by now everyone’s heard of the hard time the guys up in Queensland, Australia are having because of the recent floods. People have lost their lives and many others have lost their homes and businesses, product of years of hard work.

As a result of this massive disaster the Queensland Government decided to run a telethon to encourage donations to help the flood victims. The Telethon aired last Sunday, 09/01/11, on Channel 9 and lasted for 2 hours.

The problem was the existing donations system that the Government had been using so far: it was just not thought out to handle the load we were expecting to have on Sunday.

That’s when my employer, ThoughtWorks, kindly offered a hand to Smart Services Queensland in the attempt to make sure they could receive all donations that were likely to come through the web.

After that, on the Thursday afternoon before the event, Phillip Calçado, Ben Barnard and I set off on a mission against the clock: we had a little over 48 hours to develop, test and deploy an application that was expected to handle thousands of users. Not only that but an application that, should it fail, would prevent millions of dollars from reaching the people in need in Queensland. This was a great responsibility but we knew we could do it.

Given the time constraints it was a bit obvious that we would use Ruby on Rails for this app. Both because of the productivity it’s known for and because we had the knowledge right there. With that out of the way, we had to decide how and where we would deploy this thing. We thought a little about it and came down to to 2 options: Amazon EC2 or Heroku (which is powered by Amazon EC2 under the hood). I pushed hard for Heroku and that’s what we ended up going with.

Now it was time to get down and dirty and start coding the app. In principle it should be fairly simple. It needed a form where a potential donor would fill out his/her information, giving the option to receive the tax receipt by email or regular mail - more on that later. Upon clicking submit users would be taken to the secure payment gateway website where they could input their credit card number and finish the payment, after which they would be taken back to our app with a success - or an error - message and a transaction number.

Now this work flow has a couple of implications: First, all emails would have to be sent in the background so as to not interfere with the website performance. We were expecting to be sending thousands of them - workers anyone?

Second, the payment gateway integration would have to be developed and tested from scratch. Up until now the Queensland Government integrated with it in a different manner that could not be reused in this case.

And most important of all, although simple in concept, we had no idea of the load we should be preparing for. There was just no data from previous telethons. Thus we decided to prepare for the maximum we possibly could.

As we developed the application we deployed continuously to Heroku in order to test the payment gateway integration, benchmark the app using Apache AB, setup cache headers - Heroku uses Varnish - and find bottlenecks.

Email was one of these bottlenecks and that’s why we decided to handle that in the background using Delayed::Jobs.

Since the first deployment, we also tweaked a couple of things at Heroku, such as migrating from their free PostgreSQL offering to a dedicated instance that we believed would both take the load and have plenty of room for all the data - as I write this post, we are already well over the 5MB limit they offer for free.

Long story short, by Saturday evening  the website was up and running on 5 app instances, a 6th instance running background jobs - sending emails - and a dedicated PostgreSQL database server.

As Heroku is outside the Government network, their SMTP server was a no go on the short term so we also integrated the app with SendGrid, an email delivery service that fitted perfectly our needs - although the site got so much traction that we went over our monthly quota with them. But the nice guys from SendGrid increased our limit after I opened a ticket explaining the situation!

As for performance we used NewRelic to monitor the application, which Heroku also makes a breeze to integrate with.

We all went home to rest and get ready for Sunday, the day of the Telethon, when we would be monitoring the app throughout the day. We were all excited and when the show went live, we started seeing all those beautiful access charts moving like crazy, spiking over 720 requests per minute and being solid like a rock with flat and fast response times throughout the night.

In about two hours we had over AUD$2,000,000.00 (two million) donated through our website.

Since then the number of transactions dropped but has stayed constant and as of today we’ve received AUD$25,438,518.32 (over 25 millions of dollars) that will be donated to the flood victims in Queensland.

Oh, and the site is still up and going strong so move your fingers and go help: - there will be heaps of people grateful for your donation.

Help Stop the IE Money Drain

I’m a big heavy metal fan. And so are most of my friends. As a result I launched RottingNames, a band name generator that will generate the most hilarious, nastiest and nonsense names the metal world is yet to discover - ok, that’s probably a bit of an overstatement but the idea is good.

However, a friend pointed out the code had a bug when running under - gasp - Internet Explorer. That didn’t surprise me at all and I didn’t bother to fix it. It’s a small app, it’s for my own - a few other’s - amusement but it did give me the idea about my next micro app.

Ever wondered how much time people all around the world are wasting trying to fix nasty IE bugs? How about putting that in numbers and actually seeing how much money is going down the hole? We can’t just drop support - yet. But we can help those poor souls to upgrade to something better.

Enter The IE Money Drain. Whenever you waste time working on trying to make IE behave the way it should, go there and log your hours. Share it with your clients and managers. Show them how much time and money could be saved if we were proactively helping users make the move.

And don’t forget to tell colleagues, friends, even your grandma! Share the love ;)