Archive for April, 2007

A splash of orange

April 27, 2007 - 7:04 pm 1 Comment

Sitting in a hotel lounge in Delft (The Netherlands), Chris and I discovered, after a few gin and lemonades, that his digital camera (Canon Digital IXUS 750) has an awesome function called “Color Accent”. Turning this on allows the camera to focus on one color and filter out all others, making all other colors in the rest of the shot black and white.

Below is a photo I later took in our hotel room bathroom using this function. As you can see, I focused the shot on the orange of the shower curtain. Quite a nice effect.

Color Accent
Photo taken with a Canon Digital IXUS 750 using the Color Accent function

It’s all about… Me.

April 27, 2007 - 5:49 pm No Comments

Hehe, I love these article titles.

Anyway, a bit of an update – although not much has really happened since my last update (how boring).

Lets see, since last June, I have…


  1. Been a software developer at Trade Me for almost a year (woohoo!) – AND – I haven’t even broken anything yet… heheh… phew

  2. Worked on several big projects at Trade Me – namely helping develop the new look and feel of our DVD section (for which I wrote a cool google-suggest style AJAX enabled search but unfortunately you have to be a member of Trade Me to see this), adding support for rural and commercial properties in Trade Me Property (for which I was project lead! Oohh yeah!), and lots of other cool stuff…

  3. Re-designed and totally over-hauled Travelblog – now it does cool stuff like geocode cities that you visit on the fly and allows comments to be posted! :)

  4. Been on an awesome 5-week holiday to Europe, San Francisco and Tokyo with Chris – check it out at the “Travelblog”:http://travelblog.mindtrip.co.nz…

  5. Been to Noosa for a bit of fun in the warm ocean…

  6. Done a bit of web development contracting work on the side…

  7. Found out that two or more jobs at once doesn’t leave much time for watching TV…

  8. Tested out my interviewing skills by performing 6 technical tests on some developers wanting to work at Trade Me… it’s weird being on this end of the interview…

  9. OH and how can I forget… I interviewed for a Software Engineer in Test position at Google AGAIN, but this time in person and in Zurich. Oh, and I didn’t get the job. Again. But you can read all about that here if you’re interested, of course… :)


... and I think that’s about it really.

Next in the to-do list is…


  1. Studying for and hopefully doing some form of Microsoft Certification – I think it’s called Microsoft Certified Professional Developer (MCPD)

  2. Doing a bit more work on Travelblog so that I can maybe even make it public

  3. Working on Chris’ and my new little project… (which is top-secret at the moment so will post about it when a bit closer to it’s go-live date)

  4. Plan another looooooooong holiday somewhere, perhaps Asia this time :)


Yeah. That’s about it.

An example Prolog program

April 9, 2007 - 3:27 pm No Comments

Way back at university (like, 3 years ago), I did a couple of papers that covered Prolog. Unlike most procedural top-down programming languages that us software developers are used to using, Prolog is a logic programming language. A typical Prolog program consists of facts, rules and queries. Although I don’t have a Prolog interpreter on my machine at the moment, we used SICStus Prolog on NetBSD at university.

Speaking of SICStus Prolog – apparently it now has integrated support for developing web based applications using a new module called PrologBeans. Using this module, SICStus Prolog can be called from a Java-based application server. Awesome!!

Anyway, for those interested in what Prolog looks like, below is an old assignment that I submitted for a course on Artificial Intelligence. If I remember correctly, the assignment was for us to simulate a robot cleaning dishes. We were asked to implement all the facts and rules, in Prolog, for such a robot. When the robot encounters dirty dishes, it is supposed to clean them. If it encounters wet dishes, it is meant to dry them.

When the program is run with an initial state, the output is a list of steps that the robot would take according to the prolog rules written in the program.

Below is the code for this program.



%-*-prolog-*-
% operator(-Op, -Pre, -Del, -Add)
% operator definitions
% Pre is a list of state preconditions
% After Op is applied
% Del gets deleted from state
% Add gets added to state


operator(putDirtyDishFromBench(X), pre: [dirty(X), at(X,bench)], del: [at(X,bench)], add: [at(X,sink)]).


operator(putDirtyDishFromDrainer(X), pre: [dirty(X), at(X,drainer)], del: [at(X,drainer)], add: [at(X,sink)]).


operator(putDryDishInSink(X), pre: [dry(X), at(X,drainer)], del: [dry(X), at(X,drainer)], add: [cleanButWet(X), at(X,sink)]).


operator(putDryDishInCupboardFromDrainer(X), pre: [dry(X), at(X,drainer)], del: [at(X,drainer)], add: [at(X,cupboard)]).


operator(putDryDishInCupboardFromBench(X), pre: [dry(X), at(X,bench)], del: [at(X,bench)], add: [at(X,cupboard)]).


operator(putCleanButWetDishFromSink(X), pre: [cleanButWet(X), at(X,sink)], del: [at(X,sink)], add: [at(X,drainer)]).


operator(putCleanButWetDishFromBench(X), pre: [cleanButWet(X), at(X,bench)], del: [at(X,bench)], add: [at(X,drainer)]).


operator(pickUpTool(X,Y), pre: [holding(X)], del: [holding(X)], add: [holding(Y)]).


operator(processInSink(X), pre: [dirty(X), at(X, sink), holding(dishbrush)], del: [dirty(X)], add: [cleanButWet(X)]).


operator(processInDrainer(X), pre: [cleanButWet(X), at(X, drainer), holding(teatowel)], del: [cleanButWet(X)], add: [dry(X)]).


% instantiate(?Operator)
% Makes Operator ground (including its pre, del and add lists)


instantiate(putDirtyDishFromBench(X)) :- dish(X).
instantiate(putDirtyDishFromDrainer(X)) :- dish(X).
instantiate(putDryDishInSink(X)) :- dish(X).
instantiate(putDryDishInCupboardFromDrainer(X)) :- dish(X).
instantiate(putDryDishInCupboardFromBench(X)) :- dish(X).
instantiate(putCleanButWetDishFromSink(X)) :- dish(X).
instantiate(putCleanButWetDishFromBench(X)) :- dish(X).
instantiate(pickUpTool(X,Y)) :- tool(X), tool(Y), X\==Y.
instantiate(processInSink(X)) :- dish(X).
instantiate(processInDrainer(X)) :- dish(X).


% dish(?Object)
% Object is a dish
dish(dish1).
dish(dish2).
dish(dish3).
dish(dish4).
dish(dish5).


% tool(?Object)
% Object is a tool
tool(dishbrush).
tool(teatowel).
tool(nothing).


% location(?Object)
% Object is a location
location(bench).
location(sink).
location(drainer).
location(cupboard).

An example of how to use this prolog program:


TESTDISHES1:


testdishes1 :- goal_stack_plan([at(dish1, bench), dirty(dish1), holding(nothing)], [at(dish1, cupboard), dry(dish1)], Plan, FinalState, []).

And the plan found by the program when TESTDISHES1 is run:


PLAN FOUND FOR TESTDISHES1:


====================================
Plan to achieve [at(dish1,cupboard),dry(dish1)]
Starting at [at(dish1,bench),dirty(dish1),holding(nothing)] putDirtyDishFromBench(dish1) pickUpTool(nothing,teatowel) pickUpTool(teatowel,dishbrush) processInSink(dish1) putCleanButWetDishFromSink(dish1) pickUpTool(dishbrush,teatowel) processInDrainer(dish1) putDryDishInCupboardFromDrainer(dish1)
Ending in state: [holding(teatowel),dry(dish1),at(dish1,cupboard)]
====================================
yes | ?-

If this looks like something you might wanna have a go with, try looking at this tutorial.

I’ve been quoted… about VB.NET

April 3, 2007 - 5:06 am 1 Comment

This morning one of my fellow developers sent me a link to this article on Rowan Simpson’s (formerly the Software Development team lead at Trade Me, now heading up the Trade Me Products team) blog.

How exciting!! I’m famous!! :)

But seriously, writing code in VB.NET just frustrates me and that email I sent our dev group was one of a few instances (perhaps one of the more curious ones) where VB.NET just doesn’t seem to rate next to C#. I mean, the recent introduction of the using statement… come on! C# has had this for aaaaaaaaaaaages. And the fact that operator overloading has only JUST been introduced to VB.NET – again, C# has has this for ages. And language support for unsigned types (UInteger, ULong, and UShort) has again, only just been introduced in .NET 2 for dear ol’ VB.NET. I’m sure I was using unsigned types about 8 years ago at university (ok, so that might have been in Java, but still?!!?).

However, what frustrates me the most about VB.NET is probably the fact that I feel like I’m writing an essay in English when coding… Brackets are good! Semi-colons are good! And sticking to the OOP terminology that many programmers out there have learnt to love over the years must be good!

Oh well, better get back to my screeds of VB.NET – we have an early deploy tomorrow morning wooohoooo!!!