March 2012 Archives

Sun Mar 25 19:29:26 EST 2012

Lateral Thinking: A Textbook of Creativity

Another book I've recently finished: Edward De Bono's Lateral Thinking: A Textbook of Creativity. This is the book that defined the term "lateral thinking" and defines it as orthogonal to traditional thinking, which De Bono calls "vertical thinking". De Bono warns the reader that he may repeat himself to drive his points home, and he certainly does repeat himself a lot. His central point is that lateral thinking involves a deliberate suspension of judgement in order to enable people to hold onto arrangements of ideas that would usually be dismissed out of hand.

In order to achieve this, De Bono sets out a few techniques. One is to reverse aspects of a situation in order to generate a new idea. Imagine a policeman directing traffic at an intersection. Now turn it on its head and imagine the policeman summoning traffic, then the traffic controlling the policeman. Another technique he describes is the brainstorming session. Since that's become commonplace, I won't spend time describing it. A third technique involves pulling random words from somewhere in order to spark new lines of thought.

The most interesting technique in the book is the use of a made-up word called "po". "Po" can fit just about anywhere in a sentence and is used to hold ideas without making any judgement about them. It can be used to connect two unrelated concepts to search for a new link between them ("computers po omelettes").

The book could've presented its core ideas in about half the size, but the ideas are reasonably interesting. The techniques remind me a little of the heuristics in Polya's How to Solve It. Polya's heuristics are intended to help get from a problem to a solution, but De Bono's techniques are designed to generate new lines of thought and possibly restructure the problem itself.

Posted by Jack Kelly | Permanent link | File under: readings

Sun Mar 25 18:52:03 EST 2012

Another Voyage in March

I'm back from another five days at sea. The weather didn't give us exactly what we wanted, but we motored down to Recherche bay, where I saw one of the best sunrises I've seen so far. Naturally, the camera did a poor job of capturing it, but here goes:

Sunrise at Recherche

A couple of days later, we headed out the southern end of the channel to meet up with the HMB Endeavour replica.

Endeavour at a Distance

The first mate was ready for this, and had his signal flags ready. This one said "welcome". Endeavour responded with something like "our weapons are not impeding your vessel" and a couple of salutes on their cannon.

Signal Flags

We sailed side-by-side for a while, before going our separate ways.

Endeavour from the Side

When we came back, we had a look at her inside. She's moored just behind the Sea Shepherd vessel, Bob Barker.

Endeavour (Stern View) Bob Barker

For this voyage, I was one of the watch leaders, which means I didn't have much time to sleep or read. I made it through one book, though, which I will write about shortly.

Posted by Jack Kelly | Permanent link | File under: windeward_bound

Sun Mar 18 21:31:07 EST 2012

On Automation and API Documentation

On the first day of a voyage, we pull down a whole bunch of weather charts from a number of sources. One of those is the wind charts from MetVUW. On the Port Davey voyage I had to download the MetVUW charts, and I was disappointed to see that it was done entirely by hand. This will not do! The result: metscrape.

One of the things I have to deal with when writing these things is that they have to be pretty much fire-and-forget. That means compiled, preferably statically linked, and with limited user interaction. This time I used C, libcurl to fetch the weather images and libxml2 to parse html.

Both packages are thoroughly documented, but I found the documentation to be of vastly differing usefulness. libcurl's documentation is fantastic: it's written as a series of man pages (the html versions of which are hyperlinked), but their structure is some of the best I've seen. Once you get to the documentation for the C API, you immediately learn that the API has two flavours: the "easy" interface for doing simple transfers and the "multi" interface if you need to get fancy. The tutorial points out all the important bits, including the sequence of calls you need for normal usage. This also shows that thought has gone into the API design: simple things should be easy, complex things should be possible.

libxml's documentation is generated with gtk-doc, one of those whizz-bang documentation tools that pull the documentation out of the source code. Unfortunately, there's no section that describes the patterns or the library's style. There are a decent number of examples but puzzling out what to call when isn't obvious. htmlCtxtReadFile() (and similar functions) take an "options" parameter when they're called, so what's htmlCtxtUseOptions() for? Are the options set here merged with the htmlCtxtReadFile() options? Who can say? The documentation for htmlCtxtUseOptions() just says "Applies the options to the parser context". There are also irritating inconsistencies in naming: "Context" is sometimes spelled fully, sometimes abbreviated to "Ctx" and sometimes to "Ctxt".

The experience I've had with libxml2's documentation has clarified an opinion I've been forming for a while. Documentation generators encourage the writing of pointless pieces of fluff just for the sake of completeness, and such magic comments have no place in the source code. Here's a prime example from libxml2's source:

 * The default version of XML used: 1.0
#define XML_DEFAULT_VERSION     "1.0"

To ensure that XML_DEFAULT_VERSION turns up in the generated documentation, five additional lines have been wasted. That sounds trivial, but when each and every #define, function definition, typedef, struct declaration and so on all add a number of lines the code blows out significantly. The less code that fits on a screen, the more code must be kept in the programmer's head.

In a language like C, having the low-level documentation (documentation for individual functions, types, &c.) extracted into a manual damages the readability of the source, which should be the primary concern when writing code. (Languages with proper docstrings, like some lisp dialects and Python, are somewhat forgiven because the documentation string is exposed at runtime, so it needs to be part of the source.) I found that when writing headers for MudCore, I would write out the interface first, with related functions grouped together. In a second pass, I added documentation comments. Inserting the magic comments pushed apart definitions that belonged together, making the code less clear and wasting valuable screen space.

Banishing documentation generators means that the source code belongs only to the developers and the program that parses it; it is no longer beholden to the documentation tool. The API documentation must still be written and maintained, of course, but now the developer can lay out the code to be readable on its own merits (except for occasional hairy details).

Posted by Jack Kelly | Permanent link | File under: windeward_bound, coding

Sun Mar 18 18:47:45 EST 2012

Dead Men's Silver

The other book I finished on the previous voyage was Hugh Edwards' Dead Men's Silver: The Story of Australia's Greatest Shipwreck Hunter.

My first impressions upon starting the book was that Edwards has a very high opinion of himself. He quotes himself on the back cover, calls himself "Australia's Greatest Shipwreck Hunter" on the front cover lays on the literary references in the first chapter and frequently reminds you that he's written other books. For someone who spent a lot of time in the newspaper industry, the book has quite a few spelling and grammar errors.

That's a shame, because the stuff that Edwards has done doesn't need to be puffed up. He's credited as one of the principal discoverer on several Dutch shipwrecks, campaigned for proper legal protection for pre-colonial wrecks, salvaged all manner of interesting things from the sea floor, survived a run-in with Pol Pot and built his first set of dive gear at age 13. (It was a surplus WWII gas mask with aaround Wes laundry hose.)

It's interesting. People talk about the power that modern corporations have, but it's not entirely a recent phenomenon. The Dutch East India Company had the legal ability to wage war and was allowed to maintain armies. The company's 4,785 ships traded over 2.5 million tons of goods around the world, making it a pretty mean megacorporation, and that was between 1602 and 1796.

Every ship Edwards has found has an interesting story associated with its demise, and when he's not tooting his own horn, he goes into a good level of detail.

If you can put up with the self-promotion, it's a really good read about a guy who has led a really interesting life.

Posted by Jack Kelly | Permanent link | File under: readings

Sun Mar 18 17:19:27 EST 2012


I didn't get through as much reading as usual on my most recent voyage. There were too many opportunities for useful study that reading came a distant second. That said, I did finish a few books, and John Toohey's Quiros is the first of them.

The story centres on the voyage of Pedro Fernandes de Queiros, that set out from Peru to find a "Great South Land" and found a New Jerusalem as Knights of the Holy Ghost. Naturally, things go wrong, but the real problems are conflicts within the crew, morale and mutiny instead of towering seas and fierce storms. The story itself is pretty unremarkable: the crew eventually reach a south land, attempt to establish a colony, get driven back by the natives, mutiny and go home. Despite this, the book presents several interesting ideas, but doesn't explore any of them in detail.

Quiros, the captain, necessarily has a different perspective to his crew. As a result, he is physically and mentally isolated from his men, and his decisions often seem unfathomable to the deckhands. Even today this doesn't seem to have changed: a ship cannot run with two heads. Conversely, if the person calling the shots is trying to work the deck at the same time, the will almost certainly have an inferior grasp of the situation as it develops. Faith plays a big role in the narrative: the captian needs faith in his crew, the crew have to have faith in the captain and the crew's faith in god is challenged by Quiros' differing theological ideas. Toohey also briefly looks at the lines between discipline and brutality, kindness and weakness, and respect and fear.

The book is shorter than it looks (it's not a tiny volume but there's a fair amount of space between printed lines) and moves fairly quickly. It was a decent read between heavier works, but I feel like it could've been a lot more.

Posted by Jack Kelly | Permanent link | File under: readings

Sun Mar 18 16:33:16 EST 2012

Port Davey, March 2012

It's been a tough but rewarding eight days. We've just returned from the twice-yearly trip to Port Davey and Bathurst Harbour. The trip around was pretty interesting, as it involved the usual several hours of motoring into the wind (which tends to come in from the west). The ship got some pretty decent rolls going; 30 degrees on one side and 38 on the other. Check out the ship's clinometer:


We made it to Port Davey in one piece, though some brought their lunch and dinner up along the way. Once inside, the weather was really kind to us: very little wind or anything to trouble us at our various anchorages. With such forgiving conditions, the watches were split into two-hour shifts and most of us had a full night's sleep each night. There was plenty of time for the passengers to go on their adventures, like hiking and sea kayaking. There was plenty of time for the crew to study, tracing pipework in the engine room, examining the inside of an outboard engine, brushing up on the light and sound signals and revising colregs ((prevention of) collision regulations). This is the sort of weather we were dealing with:

Mirrored Water

Each crew member had a chance to go on some of the activities, so I grabbed a PFD, hopped into the Zodiac and we motored up to Melaleuca. The river here is extremely interesting: the water has two distinct layers. The top layer is tannin-rich fresh water and there's a clear layer of salt water underneath it. In addition, the water is very nutrient-poor. The combined result is that the marine life's much more like that of deep sea areas, despite the water being fairly shallow. You get weird creatures like the sea pens, and there are regulations that try to keep it that way. Some areas have a 5-knot speed limit, and pumping bilges or sullage tanks is prohibited in Bathurst Harbour. We took the Zodiac up the river, kept to the speed limits and tied off near the Melaleuca Airstrip:

Tied up Zodiac Melaleuca Airstrip

At this point, we went for a wander on the walking tracks that have been prepared. There's all sorts of interesting stuff out there, but I'll have to defer to Peter Grant's blog, because he's done a better write-up than I could. There are all sorts of interesting things built out here. This canoe is made entirely out of stringybark to a traditional Aboriginal design. It turns out that the captain of the Windeward Bound, Sarah Parry, helped rediscover how these canoes were made, so the builder was probably one of her students.

Bark Canoe

There are still a few of the rare, slow-growing Huon Pine trees around the area. The tree has the unfortunate combination of being incredibly slow-growing and providing highly useful timber.

Huon Pine

There's a few interesting constructions around the walking tracks. I have no idea when or how they were made:

Wood People Stick Hut Thatch Hut

On the way back to the ship, we stopped off at Clayton's Corner and had a little look around.

Clayton's Corner (Sign) Clayton's Corner (Jetty)

The house there is still sound, but is not for staying overnight. The sign by the bathtub tells visitors that the stick in the drain is to let the quolls get in and out.


The nearby sheds, however, are not at all sound:

Danger Sign

Too late.

Collapsed Shed

Eventually, it was time to go back to the ship.

Windeward Bound (at Anchor)

I don't have many photos from the other days, which were spent studying, reading and standing watch. A few days into the trip, the wind picked up and went back to full watches. The final hours at Port Davey were the most challenging: stand watch 2000-2200, sleep until 0200, watch 0200-0400, shaken at 0600 to weigh anchor at 0630, stand watch until 0800. At this point I was off watch, but nobody was allowed to sleep. The wind had picked up, and we had to be ready to adjust sail as we headed south-east to round Maatsuyker Island. When it was safe to stand down the non-watch crew, we all grabbed what sleep we could, while the watch on deck sailed along the bottom of Tasmania at a respectable 7-8 knots.

I don't remember exactly when we hit Sullivan's Cove, but we were all on deck to berth the ship and put her to bed. I remember being awake at 0345 on Saturday morning, just before going to sleep. We had an 0830 start that day. Everyone worked hard to rip through the post-voyage clean and pre-voyage checks, and we earned ourselves Sunday off before Monday's voyage.

Posted by Jack Kelly | Permanent link | File under: windeward_bound

Tue Mar 6 14:51:22 EST 2012

Automating the Bunkplan

One of the things we have to do before we go to sea is have a bunkplan and watchbill: each person is assigned one and only one bunk (except when hotbunking) and are assigned jobs and watches (red, white and blue watch rotate through keeping watch so everyone gets to sleep).

Currently, the watchbill is an excel spreadsheet and each cabin has a word document detailing its occupants and their watches. The watchbill is the canonical source for bunk assignments and watches, and the cabin sheets can be derived from the watchbill. Preparing them also takes a lot of time, meaning they don't arrive until a day or so before we leave. What's a lazy and impatient programmer to do? Automate it, of course! I decided it was time to shake out the cobwebs from my OCaml knowledge and the result was The output isn't pretty: the machine that prints the bunkplans is still running IE 6, so I went straight to legacy HTML output (<font> and so on). The code's probably not that idiomatic, either. But it only took a few hours, and it works.

OCaml's an interesting language to write. The last time I played with it was before I'd completed COMP3610 and that experience made OCaml's syntax feel less repulsive. I found that I needed to think a lot more before I could write anything, but what I did was a lot more correct. The only major bug I found turned out to be an error in the sample input data: garbage in, garbage out.

I originally attempted this program in C, using Lua to describe the ship's bunk layout and wrote a Gtk+ GUI to enter the watchbill. I planned on using Cairo to generate PDF output for the watchbill and cabin sheets. This time, I avoided writing an interface by reading CSV (it helps that the watchbill was prepared in Excel, anyway) and I avoided writing a rendering engine by generating HTML and palming it off to a browser. It's not reading text on stdin and writing to stdout, but it's a lot closer to the Unix Philosophy. The result was faster and simpler to write, and easier to debug.

If you're one of my coding friends, you might want to take a minute to read It's only 305 lines long.

Posted by Jack Kelly | Permanent link | File under: windeward_bound, coding

Mon Mar 5 10:58:44 EST 2012

Zen: The Wisdom of the East: A New Way of Life

I can't find this book anywhere online, but I found it thought-provoking and will write a few words regardless. Zen is one of those things where I see its praises sung but the more I try to read about it, the less I understand.

One of the main themes seems to be the idea of releasing attachments. Not just material possessions, but ideas and paradigms of thought as well. I've been thinking along those lines since I listened to Walden, but mainly in terms of possessions. Being detached from things means there's no loss to be suffered when something is damaged or destroyed. Being detached from ideas prevents one from being stuck defending an untenable position. But being detached from everything means there's nothing to fight for, and that's a position I cannot accept.

It seems that this detachment is part of the preparation for enlightenment and although the preparation may be long and difficult, the enlightenment itself is instantaneous. A concrete description of the actual state and implications of enlightenment is missing (and probably considered to be indescribable), but the book spends a lot of time talking about "Cosmic Mind" and other poorly-defined concepts.

Another idea that has shown up in a few texts I have read is the need for mindfulness and paying attention to the present. I let my mind wander far too easily, and it is very satisfying when you notice something other people have missed because you've given your surrounds full attention. Again, I find the position of the book too extreme: if you only pay attention to the present, you are stuck reacting as things happen to you. When planning, give the plan full attention. When executing a plan or working in the present, give that your full attention. Joel Spolsky's remarks on Human Context Switching are particularly appropriate here, though he talks about task switches at a project or organisation level as opposed to an individual's thoughts.

I can't recommend something I haven't completely understood, but at least the book clarified some of my ideas and positions.

Posted by Jack Kelly | Permanent link | File under: readings

Mon Mar 5 10:18:08 EST 2012

Jennifer Government

Like I said in my previous post, I've made it through a couple of books. One is Jennifer Government, written by Australian author Max Barry. It's set about 20 minutes into the future, in a world where corporations run rampant. People take the last name of the company they work for, the police and the NRA are little more than guns for hire and Nike is testing a new marketing strategy that involves killing a few people who buy their products.

Jennifer, a government agent (i.e., "Jennifer Government"), manages to secure funding from the families of those killed by Nike and spends most of the novel trying to find justice. There are four or five narratives running concurrently, but it somehow works.

As the novel progresses, things get crazier. Kinds start wearing corporate tattoos, corporations arm themselves, Burger King and McDonald's have a shoot-out and somehow the madness is reined in just before the end. Most of the story is powered by personal vendettas than high-minded principles, which fits a world where everything is for sale.

It reminds me a bit of Cory Doctorow's Little Brother, in that it sounds a little far-fetched, but not much. Jennifer Government is a bit more a caricature than Little Brother, but it's still an entertaining read, and a warning.

Posted by Jack Kelly | Permanent link | File under: readings

Mon Mar 5 09:43:34 EST 2012

Deakin University Feb 2012

Well, I'm back from the ship's latest voyage: 10 days at sea helping to run Deakin University's Audacious Leadership course. These are some of my favourite voyages because the trainees are always very enthusiastic and don't complain when things get a bit tough. Anyway, we finished getting the ship ready, moved into our bunks and then we were off!

Being MBA students, they it was inevitable that they'd slip back into corporatespeak after a couple of days. One trainee wasn't doing so well on the helm, so it was suggested that a personalised performance management plan be put in place to monitor steering KPIs. I suggested that we implement a synergistic trainee-oriented win-win holistic steering process and three of them spewed. Not from seasickness, either.

Jack's Bunk

Despite the broken sleep and night watches, the voyage almost felt like a holiday after the last maintenance period. I even managed to polish off a couple of books. Keeping watch in the middle of the night with a gentle roll is really peaceful, especially under sail with the sound of the crickets chirping. Wait, crickets?


Yes, crickets. Although there are hardly any insects on board, a few of these guys must've snuck in during maintenance. A few went overboard from the wind and wash but the rest were caught in a cardboard box and sent ashore.

We had a great few days of sailing and motoring, from Recherche Bay to Great Oyster Bay, with most of the sails set:

Nock and Main Staysail Square Sails

At this point, things went a bit awry. I sat down to have a rest and saw this:

Breaking Steering Cable, Installed Breaking Steering Cable, Removed

That's one of the steering cables. If it had gone, we'd only be able to turn to port. We quickly readied the emergency steering in case it broke completely and set a course for a nearby anchorage.

We made it to Morey Bay, which is off the north coast of Schouten Island and dropped the pick. Once the ship was secure at anchor, we replaced the cables with a spare pair. It was at this point that I discovered that at least two of the crew believe in a concept of "ship's karma": that preventative maintenance earns brownie points with the ship itself, and she'll come through when things get really tough.

Anyway, it was dark by the time we were finished, so we spent the night at anchor. A ship at anchor is required to display a white light visible from all angles, so being anchored near other ships always looks a little eerie:

Some Other Ship at Anchor

Morning rolled around, and it was time to pick up the anchor and go. Raising the anchor is a big production. First, there needs to be two people in the cable locker. They flake out the chain as it comes in so that it doesn't form a giant tangle.

Cable Locker Entrance Inside the Cable Locker

Next, you need someone controlling the windlass that actually raises the anchor, someone on deck to hose the chain as it comes on board and someone over the side to hose the chain as it comes out of the water. You don't want the mud from the bottom of the anchorage coming onboard. Once the anchor comes out of the water, the person over the side has to climb onto it and connect the lifting derrick:

Jack on the Anchor

So we got moving again and headed back down towards Tasman Island. One of the lookouts called "dolphins off the port bow!":

Dolphins More Dolphins

I never tire of seeing dolphins. They're the showoffs of the sea, sure, but everyone loves watching them playing in the bow wave. They rock up for a little while, show off and then disappear. We passed the Totem Pole and the Candlestick:

Totem Pole and Candlestick

And continued on towards Tasman Island when the Captain called to "aim straight for the middle of the gap":

The Gap (Aft View)

(That's actually the view after we left.) The last time the ship attempted to pass through this gap was in 2004, when a 50kt squall forced her to turn back and go around the outside. The inside of Tasman Island is stunning:

Tasman Island Trees

There's a little seal colony, too:

Tasman Island Seal Colony

And some lucky sod has a little shack there:

Tasman Island Shack

Cape Pillars, on the other side, is also extremely impressive. One of the few times that my camera didn't let me down:

Cape Pillars

The peace and quiet of the sea (at least when it's not crazy), coupled with that image and memories of Anathem makes me want to set up or spend some time at a "monastery of code". A good and quiet place to work. Wouldn't that be nice?

The sun went down, the moon came up and we kept on sailing.

Sunset Moonrise

Posted by Jack Kelly | Permanent link | File under: windeward_bound