Caius Theory

Now with even more cowbell…


The Domain Name

This blog used to be located at, but I ended up with a better use for that name, so this got sidelined over here. I bought after having someone mention it to me in parody of Chaos Theory, and decided it was fairly apt for my musings and technical waffling.

The Author

I'm a:

Find out more about me over on my profile site.

Installing Ubuntu on an iMac G3

I decided to install ubuntu onto my iMac G3450Mhz G3, 768mb ram, 20GB Hard Drive to play around with. Only problem was it would boot so far, then just stop at a black screen. In googling the fix, the blog post that contains the fix is slightly outdated and 100% 404.

Here is the fix, updated for Ubuntu 6.10 Desktop PPC:

  1. When the screen goes black, drop to the console

     Control - Option - F2

    (if you need to log in use the name ubuntu to log in.)

     $ sudo nano /etc/X11/xorg.conf
  2. Change the frequencies in monitor section as follows:

     Section “Monitor”
         Identifier “Generic Monitor”
         Option “DPMS”
         HorizSync 60-60
         VertRefresh 43-117
  3. After the changes then type control-o, return (to accept the filename), then control-x (save and exit nano)
  4. Restart X by running the following:

     sudo killall gdm && sudo /etc/init.d/gdm start

Quick Picture of Yourself

Theres a meme going round the blogosphere/twitterverse recently, so I figured I'd jump on it because there aren't any pictures of me on this blog yet. And there aren't that many in my flickr photostream either actually.

Picture of Caius

Fullsize Picture


  1. Take a picture of yourself right now.
  2. Don’t change your clothes, don’t fix your hair… just take a picture.
  3. Post that picture with NO editing.
  4. Post these instructions with your picture.

Fix crashing after 10.5.6 upgrade

When you upgrade to Mac OS 10.5.6, might start crashing a few seconds after starting due to the GPG Bundle.

The solution is to grab the updated version of the GPG bundleGPGMail_d55_Leopard.dmg

Think Visibility: An Online Marketing Conference

Now I'm not one for blogging about events usually—if I'm attending one then I'll just talk about it on twitter quite a bit beforehand. However, seeing as this one is being organised by my housemate and I like to keep him in a good mood so he doesn't do something daft like change the locks, I figured I'd blog about this one. (Also its really rather a good idea, I'll be paying to attend and think he's bloody mad to organise a conference!)

The conference is Think Visibility, which is a

one-day mini conference with a focus on the areas of web development and marketing which are usually left behind in the creation process: SEO, PPC, Monetisation, Blogging, Accessibility and Usability.

The speaker line-up has rather a lot of big names in it if you follow the SEO/Online marketing world, and its only £30 to turn up for the day and listen to them speak. Oh, and theres an afterparty with free drinks (Sponsor permitting) where you can get drunk with your hero's. (Or something.)

Me, I'm attending simply because up until a year or so ago I thought SEO was a complete heap of crap, but having known Dom for a while, and worked for an SEO agency, I'm starting to appreciate that there is an art to it, and it is a much needed skill to run a successful website.

Merry Testing

Just a few examples of the same test written in a few languages. Its testing setting the date on an object that is created in the tests' setup method already. These fall under the unit testing, rather than full-stack testing.

Testing in ObjC with OCUnit

// Add a date and time
- (void)testSettingDate
    NSDate *theDate = [NSDate date];        
    STAssertNoThrow([calc setDate:theDate], @"Shouldn't raise an exception");
    // And it should match when pulled out as well
    STAssertEqualObjects([calc date], theDate,
                         @"%@ should match %@",
                         [calc date], theDate);


Testing in Ruby using RSpec

it "should set the date successfully" do
  the_date = = the_date
  # And it should match when pulled out as well == the_date

Testing in Ruby using Test::Unit

def test_setting_date
  the_date = = the_date
  # And it should match when pulled out as well
  assert_equal(, the_date)

Testing in PHP using PHPUnit

function testSettingDate()
    $date = date();
    $calc->date = $date;
    # And it should match when pulled out as well
    $this->assertEquals($calc->date, $date);

Sending Array elements as individual arguments in Ruby

Lets imagine we've got an array of strings, and we want to print it out as a list of strings using printf. (If you're complaining about my logic here, hold fire for just a second good sir/madam.)

So we start off with the array of strings, and then pass it to printf with the right amount of %s's in the format string:

arr = ["one", "two", "three"]

printf "%s, %s, %s", arr
# ~> -:3:in `printf': too few arguments (ArgumentError)
# ~>     from -:3

Oh whoops, we've actually only passed "%s, %s, %s", ["one", "two", "three"] to printf. So of course it whinges about not getting enough arguments. Now how do we fix this, how do we pass an array with each element a seperate argument to a method?

We use the * of course! Just prefix the variable name with * and the method is passed each element as separate arguments, rather than the whole array as one arguement.

Going back to our printf example above, we simply insert one character (the lowly *) and end up with a string being outputted.

printf "%s, %s, %s", *arr
# >> one, two, three

Now I realise this is a partially stupid example, but it serves to explain the point I wanted to make. If you were complaining about my choice of printf earlier, here is the way I think most rubyists would solve this problem instead.

arr = ["one", "two", "three"]

print arr.join(" ")
# >> one two three

And if I wanted to be slightly cleverer with the printf version, and print out an array containing an unknown number of strings, but of a set width, then I could do the following. (NB: This is actually how I ran into this problem.)

arr = ["one", "two", "three"]

printf { "%6s" }.join, *arr
# >>    one   two three

And that is where the lowly * comes in.

The Shell Meme

I ran across The Shell Meme on Lincoln Stoll's blog, and figured I'd, uh, borrow it.

Run this command in a new shell:

history | awk '{ a[$2]++ } END { for(i in a){printf "%5d\t%s\n ",a[i],i} }' | \
  sort -rn | head

I get this as the output

379    git
221    cd
181    ssh
77    sudo
69    ruby
66    ls
34    rake
33    m
32    bb
31    m.

bb changes directory straight into my BrightBox source directory. m and m. are TextMate alias's to open files or directories in TextMate for editing.