Ruby, method_missing and 'no id given'

Note: if you just happen to be interested in knowing possible causes for the ‘no id given’ error message in Ruby, go to the last paragraph of this post.

I don’t have reason to do a lot of Ruby metaprogramming myself, although being a Rails user, I surely receive a lot of benefit from it. Metaprgramming is used extensively in Rails, the most visible example I can think of is the ActiveRecord Dynamic Finders.

Working on my current pet project, I had occasion to do a little metaprogramming in a similar vein to the ActiveRecord Dynamic Finders. I have a model with two sets of paperclip attachments. One is for when an attachment is first uploaded to my server and the other is for when the attachment is subsequently moved to Amazon S3 for permanent storage. The file stored on my server is deleted after successful transfer to Amazon S3. Read more...

Compiling Ruby 1.9.3 on Debian Squeeze

There’s not a huge amount of Debian specific Ruby/Rails tutorials on the web. I’ve written a few in the past and with the release of Debian Squeeze and the recent official release of Ruby 1.9.3 I thought it might be time to do another one. Read more...

How I've started to contribute to open source

A couple of weeks ago, I read a post by Brandon Hays called ‘“Why I still don’t contribute to open source":http://brandonhays.com/blog/2011/05/03/why-i-still-dont-contribute-to-open-source/’ wherein Brandon lays out his reasons for not yet having contributed to any OSS projects. To reiterate Brandon’s points:

  1. There’s no certification, ceremony, or merit badge that says, ’you’re ready to contribute to OSS’.
  2. It’s not obvious where to start.
  3. Guidelines often make a maintainer’s life easier, and mine harder.
  4. Open source is for people who are better at this than me.
  5. Trying to contribute and failing makes me feel stupid.
  6. There’s no time.
  7. It’s pretty lonely.

I found Brandon’s article interesting because I can definitely relate to a lot of what he says.

How do I know I’m ready to hack on an open source project? And if I’m not ready but jump in anyway, won’t I potentially just be broadcasting my stupidity across the Interwebs for all to see? How do I know where to start? The code base seems so intimidating and I know nothing about it. Are any hazing rituals involved? Those guys are so much better at hacking code than I’d be after ten lifetimes, how the fuck did they get so smart? Or am I just really retarded? I’ve got my own stuff I want to work on. All these sentiments I’ve felt at one time or another.

But recently, I’ve started contributing to open source projects anyway. Read more...

Policy is for when you don't trust your staff anymore

I watched the video of David Heinemeier Hansson’s keynote address from RubyCon 2010 the other day. It was unapologetically pro-Ruby, and delivered with the flair and showmanship that has made DHH and 37Signals the polarising force that they are. Being quite fond of Ruby, I found myself nodding along to most of what David had to say. But I don’t wish to add even a small amount of new fuel to the programming language wars that seem to go on endlessly around the place. The purpose of this post is not to join in on any Ruby circle-jerking.

One of the things that particularly stood out to me in DHH’s keynote was a quote from Larry Wall, creator of the Perl programming language:

The very fact that it’s possible to write messy programs in Perl is also what makes it possible to write programs that are cleaner in Perl than they could ever be in a language that attempts to enforce cleanliness. The potential for greater good goes right along with the potential for greater evil.

The potential for greater good goes right along with the potential for greater evil. This is a great quote and it rings very true for me. Along with some other parts of David’s address, it got me to thinking about how the uniformity that we enforce in other aspects of life in order to minimise the potential for evil may also be minimising the potential for good. Read more...

Is it time to chrome my web browsing?

I remember when I first heard of Google’s new browser, dubbed Chrome. I was sitting at my desk at work, reading the news and for a moment I thought I could almost hear the wailing and gnashing of teeth emanating from clear across the other side of the world at Redmond.

There were some obvious wins for Chrome right out of the gate. Independent processes for tabs meant that if a page crashed it wouldn’t take down the whole browser with it. Security was also enhanced with this model of tab isolation, if I remember correctly. There was the V8 JavaScript engine, tests by Google in September 2008 showed that JavaScript execution in Chrome was about three times faster than Firefox 3.0 and about ten times faster than Internet Explorer 7. There was some debate over the real world applicability of these results, but little doubt that Chrome was kicking ass at JavaScript. A modern browser made to support the quickly burgeoning age of JavaScript heavy web applications. Read more...

New gem: self-notifo

I’ve never created a Ruby gem before, although I use other people’s gems a lot. So I decided recently that I might have a go at making one myself. I needed to find something nice and small to start off with. Read more...

Configuring Nginx and Phusion Passenger on Debian Lenny

Continuing on from my previous post on compiling Nginx with Phusion Passenger, some configuration is now in order.

To give credit where due, I’d like to mention that I found much help on the Slicehost articles and tutorials site and adapted some of their instructions for parts of this post. Thanks Slicehost! Read more...

Compiling Nginx with Phusion Passenger on Debian Lenny

After compiling Ruby 1.9.2 on my Debian Lenny web server, the next thing I wanted to do was get an actual web server going for serving up Rails apps. I’ve been an Apache user for a long time but I’d been hearing about Nginx and how it’s kicking ass and taking names, so I thought I might give it a go. I also needed some way to hook Rails up with Nginx. Read more...

Compiling Ruby 1.9.2 on Debian Lenny

I’ve just recently been setting up my Debian Lenny web server to run Rails apps. So I thought I might document some of what I did for posterity and as a way to give back a little in return for all those blog posts and general instructional texts found on the Internet that have helped me over the years.

Ruby 1.9.0 is already available in the Debian Lenny repositories, so if you’re happy with this version you can of course just install the ruby1.9 package and be done with it. You could also check what backports are available and stuff. But I can’t leave well enough alone though so if you’re like me, read on. Read more...