Feed items

URL shortener for Basecamp

Basecamp’s UI has one failing that keeps causing me problems – it can’t layout messages that contain long unwrappable URLs. I decided to fix it, and wrote a link shortening user script for Fluid and Basecamp.

Here’s an example:

Benchmarking Ruby exception handling

Which is better, handling an exception or explicitly checking to see whether or not your code is going to break? The answer is “it depends”. On the one hand exception handling allows us to write more legible code (often summed up by the saying “it’s easier to ask forgiveness than permission”). On the other, handling an exception is often a costly operation; it can be faster to “look before you leap”.

Fixing the Xcode Project Templates

I recently upgraded my copy of Xcode and installed the iPhone SDK. A short while later, while following an example in the Pragmatic Programmer’s Cocoa Programming book, I found that my copy of Xcode wasn’t creating some key files.

Ruby Manor

Ruby Manor is one of those alternative conferences. It’s not run for a profit, and costs just £8 for a ticket (you pay just enough to cover the cost of the room and equipment). You even get a free beer afterwards in the local boozer (and it’s at least £3 a pint in London these days). Due to the unique way that Ruby Manor is funded (actually, that’s nothing to do with it) you can even check the bar bill.

3 Unix commands for finding performance problems

A user recently reported a performance problem on one of our Rails apps. I pulled up New Relic’s performance graphs and checked what was happening around the time that we received the email. Sure enough there was a massive spike in the time taken to serve a request.

Tools of the trade

Peter Cooper of Ruby Inside recently asked if people wanted to write about the things that they use in their development work. So I jumped squarely onto that band wagon…

Installing Nokogiri on Leopard

Nokogiri is a popular (and fast) XML parsing library for Ruby. One of the reasons that it’s so fast is that it’s written in C, and makes use of the excellent libxml2 and libxslt C libraries.

I just installed the Nokogiri Ruby gem on my Mac, which runs OS X 10.5.8 (i.e. Leopard). Imagine my surprise (given that I’m supposed to be running one of the most advanced operating systems in the world!) when Nokogiri printed this message in my terminal:

Merging Nesta's categories and articles

When I first started writing Nesta I wanted a CMS that would allow me to:

Testing Rails with Rack::Test

The biggest news in Rails 2.3 is its support for Rack, the WSGI inspired Ruby web server interface.

Installing the pg PostgreSQL gem on Mac

I’ve recently switched from using MySQL to PostgreSQL for my Ruby projects. You can connect to a PostgreSQL database from Ruby using the pg gem, but if the pg_config program isn’t in your path you’ll run into problems during installation.