With this huge move and all the unexpected problems we’ve had, I’ve had very little time these last couple of months to do much programming… or blogging! I can’t wait, I’m posting this from my phone.
Friday 27th August 2010
Sunday 28th March 2010
![]()
I’ve decided to put my code snippets blog idea on hold because I don’t have time to be maintaining a separate blog right now. Had I started it, this would have gone there.
Thursday 17th December 2009

Yesterday I wrote a longwinded post about choosing Ruby/Tk or Java Swing to create a silly Monopoly clone for the family. Alex reminded me of Qt which is still just as easy as ever to install on Mac, but I still haven’t got the Qt4-QtRuby bindings working because of a problem with Smoke.
Wednesday 16th December 2009

UPDATE: Alex has suggested I try Ruby with Qt. Genius!
My family has always had an obsession with the Monopoly board game, and since my mum died the remaining Schade clan has clung onto it even more as a family tradition. Because I have some spare time over the holidays I thought I’d create a computer version of Monopoly but with the place names and chance cards to do with places and experiences we’ve been to and had. Trouble is, I’m not sure what graphical toolkit and language to use!
Monday 14th December 2009

I had some trouble finding how to prevent Tk windows from being resized by users at runtime, so now that I’ve found out how I’m putting it here and passing it off as a legitimate post. Clever, right? :). Entirely pointless introductory paragraphs aside, simply set the resizable attribute of the TkRoot to (0, 0). Looks like a guy with a crooked nose.
Sunday 13th December 2009

Having studied Java almost exclusively at uni for a while, I decided while I had a holiday break I’d mess around with some Ruby goodness. Today was all about messing with YAML for a potential project thingy, to use technical terms.
Saturday 12th December 2009

Perhaps my internet connection has been a bit spotty, but building the latest version of Ruby 1.9 from MacPorts has been failing on me with a checksum error all afternoon.
Friday 21st August 2009

As if I needed one, but another reason why I love Twitter is the spontaneous memes with a half life shorter than the time it takes for the fizz in soft drink to dissipate when the bottle is opened. I prefer Solo. Well this paragraph rapidly degenerated into nonsense more quickly than most.
Today’s fun was coming up with expressing famous songs as code with the surprisingly descriptive #SongsInCode hashtag. @NickHodge by far had the best ones, but I tried my hand at a few too. I spaced them out to make them easier to read, but all these fitted into the 140 character Twitter limit when written on the one line!
if (destination == "San Francisco") {
hair.wear(flowers);
}
4.times do puts "My" end puts "Sharona"
if ( headlight >= 1 ) {
[driveTo : home];
}
%signs = ( "Wild", "Can't Take Home to Mum", "Kinky" );
if ( exists $signs{$girl} ) {
print "That girl's a super freak!\n"
}
int Mambo = 5;
if ( yourself.takenLookAt() ) {
me.accuse(allow);
}
for ( my $i = 1; $i < 13; $i++ ) {
if ($i % 4 == 0) {
print "$i o'clock rock!";
} else {
print "$i o'clock";
}
}
try {
makeMeGo("rehab");
} catch(WinehouseRefusalException e) {
System.out.println("no no no!");
}
Word thing = "Bird";
System.out.println ("The " + thing + " is the "
+ thing.getClass().getName() );
While all those were fun, I think the last was my crowning achievement :).
Monday 27th July 2009

Here’s an interesting thought for those of you interested in interesting thoughts. Well okay it would only be interesting for those doing object oriented programming if you want to be pedantic. Pedantic sounds like a cheap brand of paracetamol.
We’re often told the advantage of using pseudocode and diagrams like ORDs is beneficial because they’re programming language agnostic, but that’s not entirely true. Take the above example of a grilled cheese sandwich class; it’s all fair and good if we were using Java because only the String here is an object not a primitive data type. But what about something like Ruby in which everything is an object? Huh? Would it be something like this?

That’s a lot of duplicated boxes. Clearly the ORD was envisioned when what I call "hyper dynamic" programming/scripting languages didn’t exist! I can’t think they’d be terribly practical to draw all the time as a Ruby developer unless you wanted to bend the rules a bit for it.
The diagram looks like my bedroom in Singapore, if my bedroom in Singapore contained boxes with attributes regarding instances of grilled cheese sandwich objects. I’d go for a nice Colby or Extra Tasty Cheddar. Makes sense to me.
I need a stiff cup of coffee.
Wednesday 24th December 2008

Directly referencing your interpreter? Crazy…
I haven’t written any geeky programming technical posts for a long time. Christmas Eve seems like just as good a time as any. Funny how Perl programming specifically always reminds me of Christmas because I got my first proper job after high school in 2004 writing Perl/MySQL code around Christmas time so I could buy people presents. Happiest time of my life then because I had purpose, direction and optimism.
This morning I’m talking about using env in the shebang line of scripting language source files (FreeBSD man reference). Quite frankly I’m surprised that as of 2008 the majoraty of files I download and look through still reference hard links to the interpreters such as the examples below:
#!/usr/bin/perl -w
#!/usr/local/bin/ruby
The problem with hard/specific referencing is that you can’t assume your system will have a filesystem configured in the same way as another. While us users of Unix-like systems are fortunate that our said systems have so much in common, there are still enough subtle differences between Unix-like OSs and even distributions of the same OS to cause problems.
For example, most GNU/Linux systems place all non system critical files in the /usr/bin directory. As a FreeBSD user I shivver in terror at the mere thought of this; on the BSDs we’re even more specific and seperate non system critical files that come as part of the core system in /usr/bin, and files we later install ourselves in /usr/local/bin or /usr/local/pkg depending on our package manager. Much stricter, cleaner and easier to maintain… but that’s for another post.
The solution to this is to call our scripting language using env which checks your system for the desired interpreter and executes. This means Linux users can share with BSD users can share with Mac OS X users etc without worrying about how said systems are configured. You can even pass regular options, very nice.
#!/usr/bin/env ruby -w
Using env to reference basic sh shell scripts would be overkill, but for languages such as bash, Ruby, Python, Perl etc it just makes sense. Sure you could just assume all your clients and servers will be GNU/Linux folk, and perhaps you’d be right… for now. I’m all for future proofing.


