Friday, 24 January 2014

Lake Waikaremoana

This week I did the Lake Waikaremoana "Great Walk" with my children. This is a three-to-four day walk in Te Urewera National Park on the east coast of the North Island --- a range of low but rugged mountains covered in cold rainforest. We did it in four days, staying at Department of Conservation huts on the three nights --- Waiharuru, Waiopaoa and Panekire. These huts are cheap and shared with 20 to 40 other trampers depending on the size of the hut and how busy the track is. Since it's the school holidays and the middle of the summer, it was quite busy but the huts don't get overcrowded since they must be booked in advance.

This is the first "Great Walk" I've done, and the first tramp I've done over more than one night. Everything went very well. Tuesday was wet and also the longest day (eight hours including a side trip to Korokoro Falls, well worth it!) but everyone coped fine. Needless to say the lake and surrounding scenery are very beautiful.

The walk is around the western arm of the lake. Most trampers do it from the southern end to the northern end of the lake but we did it in the other direction, in the hope our packs would be lighter for the climb over the Panekire bluff at the southern end. It probably didn't make much difference.

For some reason I find it very easy to talk to strangers staying at tramping huts. Maybe it's because we're cooking, eating, talking and sleeping at close quarters, maybe it's because of the isolation or the shared challenge of the walk, or maybe it's something else, but it's the easiest place --- other than church maybe --- to strike up a conversation with someone I don't know at all. I've met a lot of interesting people from different countries and backgrounds. I've learned a lot about tramping from them, since of course many of them are more experienced than me. It's a good environment to learn to be more outgoing.

Everything was great and I highly recommend the walk. Panekire Hut is outstanding, perched on the top of the bluff with an incredible view over the lake, yet somehow in a pocket sheltered from the strong gusty winds just a few paces away. As it turned out, we could have easily done the walk in three days by ascending and descending Panekire on the same day, skipping staying at the hut, but I'm glad we didn't. I do wish we'd brought togs so we could swim in the lake while at the lakeside huts --- many of the other trampers did.

Monday, 13 January 2014

Web Specifications And The Frame Problem

I've noticed a pattern of mistakes when some smart people think about Web specifications. They think that a general rule in some spec does not apply to some specific situation that they're focused on, because the spec does not mention their specific situation. One example: someone suggested that we could make typed arrays returned by Web Audio APIs not be neuterable, arguing that this did not alter already-specified behavior because "nothing currently specifies how typed arrays work with Web Audio". Another example: someone argued that CSS does not specify how to determine the size of CSS content, padding and border boxes when the 'overflow' property is not 'visible'.

I hope it's clear that these are mistakes because when a Web spec states a general rule, that rule applies in all situations unless there is specific text contradicting it elsewhere (in which case, some spec should clearly indicate which rule prevails ... and I recognize that's not always true). Any other approach leads to madness; modularity and extensibility would be destroyed if, any time a feature is added to the Web platform, we had to explicitly reaffirm the behavior of all other features.

I think this is a form of the "frame problem" in AI, or "default logic". A kind of intertia requires previously specified rules to remain true until explicitly changed by another spec.

In typical programming languages, we tackle these issues by making every modifiable rule an explicit extension point (which could be implemented in lots of ways --- a virtual function call, a function value, an enum value, etc). Modifications explicitly utilize the extension point. This is sometimes done in specs, but rarely. One reason is that it makes your specs verbose and hard to read. Another reason is that it's hard to know the set of extension points ahead of time, so when you discover later you need to make modifications, you have to go back and add those extension points. That's getting easier now that more specs are using the "living standard" model, but it used to be hard.

There are programming languages that support this kind of dynamic extensibility. Languages with externally defined multimethods have a taste of it. CSS itself, ironically, orders rules by specificity and allows more-specific rules to override less-specific rules.

One problem I've been interested in for a long time is encoding the semantics of board games. Board game rules are often designed like Web specs, with some rules overriding others in special cases. Board games have extensibility problems, when expansions come out which lead to ambiguities in the context of the original game. (Munchkin makes sport of the problem.)

Tiritiri Matangi Island

On Saturday our family took the ferry to Tiritiri Matangi Island for a day trip. Over the last 30 years farming stopped on this island and it was reforested, with intensive help from volunteers planting hundreds of thousands of trees and other plants. The island was also cleared of predators such as rats, never had many of the common New Zealand predators such as stoats and weasels, and is now an amazing habitat for native birds, many species of which are endangered on the mainland. Various rare species from other sanctuaries, such as takahes and little spotted kiwi, and even tuataras, have been introduced to Tiritiri Matangi. It is also an important nesting island for little blue penguins.

Our trip was excellent. We took a guided tour with one of the guides from the "Friends of Tiritiri Matangi" volunteers society. She was very knowledgeable and observant and the guided tour was well worth having. We saw a lot of rare birds, particularly saddlebacks, robins and whiteheads, and the birdsong was cacophonous. The bush is regenerating well. In open grass near the lighthouse, a highlight was seeing three takahe --- about 1% of the world's entire takahe population!

One of the best things about Tiritiri Matangi is that it is being used as a template for other Hauraki Gulf islands. In recent years, Rangitoto, Motutapu, Rotoroa and Motuhie have all been cleared of predators and reforestation of Motutapu, Rorotora and Motuhie (all formerly farmed) is in progress. Takahes have been released on Motutapu and kiwi on Motuhie. This will provide redundancy for the island sanctuaries and amazing places for people to visit when the forest grows up.

One interesting tidbit is that apparently rats can swim up to 3km and hence the 4km gap between Tiritiri Matangi is fortuitous. I wonder what would cause a rat to swim 3km towards an island ... desperation, insanity, or wanderlust and very good judgement of distance and tides?

Tiritiri Matangi is definitely a worthwhile day trip for anyone based in Auckland.


For my entire life I've had the privilege of boating on the Hauraki Gulf. My parents are part-owners of a classic wooden launch built over 80 years ago, and throughout my childhood we spent weeks every year cruising the Gulf in it. They still take our family out with them for several days every year, for which we are very grateful. A lot of people, even those who live in Auckland, don't know what this entails so I thought I'd write about it.

The experience is a bit hard to describe to those who haven't done anything like it. The perimeter of the Hauraki Gulf is roughly the east coast of Auckland, running south and east to the Firth of Thames, then north along the inside of the Coromandel Peninsula, then north and west through the Great and Little Barrier Islands and rejoining the mainland at Tawharanui Peninsula. Its area is about 4000 km2. Inside that perimeter are many islands of various sizes, and a great many harbours and bays on the islands and the mainland. Even relatively small craft can go anywhere in this area. Often pleasure boats travel from bay to bay on a near-daily basis, anchoring in bays that are sheltered from any wind that's blowing. Common activities are fishing, swimming, going ashore via dinghy for swimming or walking, and generally just about any activity you can imagine doing on a boat, on a beach, or in a park --- much of the coastal land reachable by boat is public land of some kind, and you can almost always use the beach.

These boats are often equipped with everything you need to live for weeks --- sleeping, cooking, hot water, washing, etc. They're all different shapes and sizes, with the biggest difference being between the yachts that sail and the launches that rely on an engine, although yachts typically have a small backup engine too. These boats would have electricity generated from the engine and hence electric lighting, a refrigerator, and charging for your mobile devices. Most of the Gulf has pretty good 3G coverage.

Those sorts of boats are definitely an upper-middle-class luxury, but smaller boats down to large dinghies with outboard motors are used for day trips, especially for fishing. I read an estimate that one in three Auckland households have some kind of boat. A lot of Aucklanders live close enough to the water to make sailing classes a common extra-curricular activity for children; children learn to sail dinghies from the age of around 11. This partly explains why New Zealand produces so many world-class sailors.

If you don't have a boat, or have friends or relatives with a boat, it's very difficult to even approximate the pleasure cruising experience. If you're into sea kayaking you can kayak and camp at many of the closer islands. Many of the Gulf islands are reachable by ferry, but ferries to many of the less popular ones only run on specific days during the summer. Regardless, they're all worth visiting:

  • Waiheke is basically a suburb at its western end, but a lovely island suburb with nice beaches and excellent walking tracks. Its eastern end is difficult to access, being largely private farmland, and you need a boat to really appreciate the bays of the "bottom end". People often visit Waiheke for the food and wine at its vineyards.
  • Rangitoto is the newest volcano of the Auckland volcanic field. No more than several hundred years old, it's a unique ecosystem of plants colonizing bare lava, and the view from its top is exceptional. You can take the ferry from downtown, walk up and down, and be back in Auckland for a late lunch. This is my top recommendation if you have a half-day in Auckland.
  • Motutapu is an older island next to Rangitoto, formerly used for farming. Has a campsite.
  • Motuhie is a small island used as a POW camp in World War One. It has a campsite and the north-facing Ocean Beach is excellent.
  • Kawau is at the northern end of the Hauraki Gulf. It has a lot of private land but the public area around Governer Grey's Mansion House is lovely.
  • Rotoroa was a treatment center for alcoholics run by the Salvation Army which has recently reverted to a public reserve. It's nice.
  • Tiritiri Matangi is a bird sanctuary. More about that in a future blog post.
  • Great Barrier is a large island, reachable by light plane as well as ferry. Visitors will probably want to rent a car and it also has a network of walking tracks. It's at the edge of the Gulf, faces the Pacific and is more remote than these other islands. Highly recommended.