Monday, 29 March 2010


This isn't new, but I had to share it.

Someone (Halliburton apparently) has tried to patent the process of patent trolling.

If granted, this would allow you to sue everyone who ever sues (or licenses or alleges infringement or obtains out-of-court settlement or cross-licenses etc etc) anyone in relation to any patent, for infringing your patent on the process of suing (or licensing, settling etc) in relation to a patent.

Beautiful. Twisted, but beautiful.

Monday, 22 March 2010

Night Unicycling - Makara Peak, North Face

Having bought some Ay-Up LED lights (which are absolutely awesome) in December for an outing at Unicon (which I never actually went on), lately I've been getting into night unicycling - so far mostly on Mount Victoria.

Last night I finally got back up to Makara Peak - somehow I've not been since December - for what became a 3-hour ride, half of which was in darkness.

This was also the first Makara Peak outing for my new KH24 mountain unicycle, which is the only thing I've wanted to ride offroad since I got it in December. I've been riding it on Mount Victoria and having a great time on the steep tracks there.

The KH24 really likes Makara Peak. With its long 165mm cranks and huge 3-inch-wide tyre, it's much better suited to the steep rocky parts than the 29" uni, especially with the trails in their current eroded, rocky condition. At least, it's better suited now that my balance and skill is up to it and I don't have to rely on the big 29er wheel to smooth out the bumps.

KH24 at top of Sally Alley track

Eventually, in darkness, I reached the summit, after stopping to chat to two surprised evening mountain bikers. The climb was a bit of an ordeal - my leg muscles are apparently a bit out of condition since I haven't done any multi-hour rides lately, just shorter intense ones on Mt Vic. I had to walk much of Aratihi, though the lower tracks were ok.

The summit was in cloud and very windy, so I didn't linger but headed over to the new North Face downhill track, which is now open for careful riding, and has recently been conquered by mountain bike.

I'm not going to say too much about whether it's a good idea to ride a new, unfamiliar, unpolished, rough-edged track by unicycle, alone in the dark, when somewhat tired... suffice to say that I survived.

So, what's it like? What can I say? North Face is awesome! This is already my new favourite track in the park for unicycling (previously I would have said Sally Alley/Missing Link, then Aratihi downhill). Never boring, but still good for a bit of speed. The right mix of interesting steep bits, twistiness, sudden humps and grade reversals.

KH24 resting on North Face, lights of Karori in background

KH24 and a treacherous bump on North Face, cloudily illuminated by Ay-Up lights

Some of the many steep switchbacks defeated me, but I'm still fairly rubbish at unicycling even the easy ones (even those on Lazy Fern), so that says more about my riding than the track design. They will provide a good challenge for some time I think!

After North Face I was tired enough to take the easy option, so headed up then down the 4wd track, then down Lazy Fern. Unfortunately I then got an agonising cramp in a thigh muscle, leading to an abrupt dismount, and leaving me helplessly cursing on the ground for a while until it relaxed and I could bend my leg again. Ouch! Maybe I overdid it slightly. I had to walk down from there - it felt like it might cramp again, and the results could be spectacular if descending a switchback at the time!

Fun ride. A lot of muscles are going to hurt in a day or so, but I will definitely be keen to ride North Face again soon. Just for a laugh, I might try it in daylight.

Thursday, 18 March 2010

Quote of the day

Tim Bray, about Apple's app store ecosystem:
It’s a sterile Disney-fied walled garden surrounded by sharp-toothed lawyers.

Tuesday, 16 March 2010


Things that worry me about immortality, #485:
Do I get to keep my lifetime gym membership?

Monday, 1 March 2010

Spring: setting static fields

This is pretty obscure, but I just found this nice trick with Spring framework, for injection of values into static fields: I've been looking for a way to do this for AGES.

What that article doesn't mention, and the key benefit in my project, is that when you use @AutoWired, you can have the Spring-invoked initialization method marked as private, to avoid polluting your public API.

Spring config:
<beans xmlns:aop="" xmlns:context="" xmlns:util="" xmlns:xsi="" xmlns="" xsi:schemalocation="

    <!-- Scan for @Autowired annotations -->

    <!-- The instance to be injected into the static field on StaticHub -->
    <bean class="internal.stuff.MyInterfaceImpl" name="myPrecious">

    <!-- The class which will have its static field set via @Autowired -->
    <bean class="very.public.api.StaticHub" name="dummyInstanceOfStaticHub">

Java class with static field:
package very.public.api;

import org.springframework.beans.factory.annotation.Autowired;

public final class StaticHub {
    private static MyInterface theStaticInstance;

     * Note this initialization method is private! No nasty public setInstance method.
    @Autowired(required = true)
    private StaticHub(MyInterface instance) {
        theStaticInstance = instance;

     * My public API, making the Spring-created instance of MyInterface statically accessible
    public static MyInterface getInstance() {
        return theStaticInstance;

This is a big improvement over my previous unsatisfactory solution, which was to use org.springframework.beans.factory.config.MethodInvokingFactoryBean with a public method on StaticHub like this:
<bean name="staticHubInitializer" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="staticMethod" value="very.public.api.StaticHub.setInstance"/>
        <property name="arguments">
                <ref bean="myPrecious"/>

    public static void setInstance(MyInterface instance) {
        theStaticInstance = instance;
...which is not very pretty.

You can also use @Qualifier to disambiguate if you have multiple beans in your Spring container which implement MyInterface:
import org.springframework.beans.factory.annotation.Qualifier;
    private StaticHub(@Qualifier("myPrecious") MyInterface instance) {
        theStaticInstance = instance;

Before you use this, consider carefully whether static fields are actually a good idea - in general this kind of pattern is something Spring is designed to help you avoid!

In my project there are good reasons for it, but it needs thought - things get complicated quickly in environments with multiple classloaders, or with multiple Spring containers inside the same classloader; it also makes it harder to use newfangled clustering technologies which let you scale to multiple JVMs.