Linux Australia SysAdmin Day Gift

I would like to send out a big thank you to the Linux Australia Council. As I’m sure you all know yesterday was System Administrator Appreciation Day. The Council decided to send me a ThinkGeek gift certificate in appreciation for my work as an LA Admin.

After hours of searching I finally decided on the USB SATA Drive Dock :).

Again a big thank you to the LA council and to Steve Walsh for organising the gift certificate.

Changing the type on a legacy table in ActiveRecord

I’m doing some work for a client which involves extracting some data from a legacy database and displaying it in a web interface. One of the fields in the table is the number of megabytes included in the quota. For some crazy reason this is defined as follows:

  bandwidth_in_included DECIMAL(8,2)

This means that in the web interface I get 10,000.0 MB instead of 10,000 MB. Notice the decimal point. Also I wanted bytes rather than MB since the legacy app was a bit all over the place in this regard.

My first solution was to simple create a virtual attribute in the model to override the type.

class Quota < ActiveRecord::Base

  # We need it as an int and in bytes
  def bandwidth_in_included
    attributes['bandwidth_in_included].to_i * 1000


This worked great except that I’m actually rendering the data to XML to be accessed over a REST service so this was generating XML elements like


Eventually I discovered that you can tell ActiveRecord to override the type, so I ended up with

class Quota < ActiveRecord::Base

  # We want to treat the bandwidth_included a an integer
  class << columns_hash['bandwidth_in_included']
    def type

  # We need it as an int and in bytes
  def bandwidth_in_included
    attributes['bandwidth_in_included].to_i * 1000


CruiseControl.rb and Bazaar

Today I was investigating Continuous Integration solutions for rails projects. In the end I ended up settling on CruiseControl.rb mainly because it’s a rails app and most of the others where Java based.

The only problem is that CruiseControl.rb doesn’t currently support Bazaar, in fact the released version only supports SVN while the development version supports Git and Mercurual.

Anyway after a couple of hours of hacking I came up with the following patch which I’ve filed as a bug.

Bzr keeps easing my pain

There has been a trend in the Annodex community lately to move towards using git rather than SVN for source code management. Now while I applaud the move to a DVCS, I hate having to use git. It is just extremely painful IMHO.

I just shouldn’t have to look up a man page or tutorial every time I want to use a tool. Something I don’t have to do with any of CSV, SVN, bzr or mecurial. Git may have some benefits under the hood but I think its user interface still has a long way to go. I can totally understand how git is the perfect tool for the kernel community but I just don’t think it makes a lot of sense for some other communities who have jumped on the badwagon.

The nice folks over in the bazaar community have found a way to ease my pain. Some of you may be familiar with the bzr-svn plugin written by Jelmer Vernooij. Well he has recently expanded on the work started by Rob Collins and now we have a working bzr-git.

johnf@zoot:~$ bzr branch git://
Branched 734 revision(s).
johnf@zoot:~$ cd liboggz.git/
johnf@zoot:~/liboggz.git$ bzr log -r -1
revno: 734
git commit: ef3b0ebc1fdc299a09119df01fbd1c8867f90d8b
committer: Conrad Parker
timestamp: Wed 2009-04-01 00:59:36 +0000
  Update the link to the theora spec
  Patch by Ralph Giles

Joy!!! Many thanks to the wonderful guys in the bazzar community for making my life so much easier. All we need now is bzr-hg and I’ll never have to leave my comfort zone đŸ™‚