Wednesday, 28 September 2011

Neutrino Racing


That is all.

Wednesday, 28 July 2010

Best unicycling video in ages

By Max Schulze. This guy is just incredible.

(Click through to watch in HD, and to see his other videos.)

NAUCC 2010 from Max Schulze.

Thursday, 15 July 2010

No software patents in NZ

Today the NZ government that they are not going to change the law to allow software patents in NZ [1], [2].

This is a GOOD THING, and rather a surprising development in this time of creeping increase in draconian IP laws.

That is all.

Thursday, 17 June 2010

Extended Warranty

3 metre extension cords with extended warranty. Guaranteed for up to 6 metres.

Thursday, 13 May 2010

The Gervais Principle

Here's an absolutely fascinating and insightful article about the psychology of company structures and lifecycles and the different roles people play within them, using the TV show The Office as an example:

The Gervais Principle, or The Office according to The Office

(This is from last year, but I didn't see it then, and it just got reposted on Hacker News. Long but worth reading all of it.)

It's quite dark and slightly cynical, but it's also pretty much spot on. Suddenly the business world makes sense.

Wednesday, 5 May 2010

ColorLogs log colorizing script - my version

Finally got round to publishing my log colorizing script 'ColorLogs'.

It's available here on GitHub: http://github.com/memorius/colorlogs

This is a perl script intended to have command output piped through it to a terminal, and allows easy creation of new highlighting configurations using simple text matches, globs or regular expressions. See the readme for instructions - very simple to use.

My version started as a fork of v1.1 from here, but I've made numerous improvements since then. It's become an essential tool for me when running ant, maven and various other programs in the terminal.

Please feel free to use it, modify it, etc. You can also send me your custom highlighting config files - I'll be happy to put them in my repository for others to use.

Tuesday, 4 May 2010

Color survey

Awesome and fascinating results of XKCD's color survey.

How nice to be able to spend your time on stuff like that...

I'm gonna print the poster, RGB monitor color spaces be damned!

Monday, 29 March 2010

Meta-patents

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

Immortality

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="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <!-- Scan for @Autowired annotations -->
    <context:annotation-config>

    <!-- 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">
</beans>

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">
            <list>
                <ref bean="myPrecious"/>
            </list>
       </property>
    </bean>

    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.