Second Anniversary

As of today it’s been exactly two years since I started this blog.

Thank you to all of my faithful readers. Without you this milestone would never have been reached. That means you, and you, and you, and… heh?

No, the washroom’s next door.

So is that it? Three? No? Two? Is there anyone else left out in the hall?

Hmm, I think I’ll have to send the invites earlier next year.

Boy we’re gonna have a lot of extra food.

That’s right. Hit the tree.

We’re getting our first snowfall for the year (nothing really significant around here, much worse if you’re north of the city). Anyway, it reminds me of a story.

I was tobogganing with a friend from school. It had been snowing hard and there was a rare (for Toronto) deep layer of white fluffy snow covering everything. The day had that "winter wonderland" quality to it.

The hill we were on was terraced and dipped into a small gully before the main stretch. At the bottom was a field planted with a few (carefully arranged) trees.

We’d taken our run and wiped out in the gully. From there we couldn’t see the bottom of the hill, only the top of some of the larger trees. As we were dusting ourselves off, another kid tore past us, easily making it over the little lip and headed at breakneck speed down the remainder of the hill.

After he’d passed, we heard his sister watching from the top of the hill say – "That’s right. Hit the tree." We turned, there was a short pause, a dull thud, and a FWUMP! as the crown of one of the larger trees shuddered and dropped it’s load of snow.

I think not seeing the actual impact made it that much funnier.

365 Tomorrows

Boing Boing turned me on to 365 Tomorrows early in September and I’ve been reading every day since. I’m really enjoying it. The team of 5 writers behind the site deliver a new speculative fiction short (sometimes micro-short) story every day. Some are better than others (obviously) but in general I think I’ve enjoyed them all.

Its just a refreshing little daily bite of SF to chew on. Yum.

Posted in sf

SuperDuper! 2.0

Keeping backups is essential. However, finding backup software that is easy to understand, easy to use, and (above all) inspires confidence is rare. Luckily for me there is SuperDuper!.

I’ve been using SD! for (almost exactly) one year now and it has saved my bacon several times. SD!’s Smart Update feature is so fast that it is painless to run before applying software updates. Being able to revert after discovering an incompatibility (which often happens with Xcode or WO updates) is a godsend.

Now, Shirt Pocket has rewarded my loyalty by updating SuperDuper! to version 2.0.

SuperDuper! 2.0 includes scheduling and other enhancements (the press release with all the gory details can be found here).

WebObjects 5.3.1 WORedirect Bug

I’m encountering a problem with WebObjects 5.3.1 and WORedirect. It looks like WORedirect is encoding the ampersand (&) url parameter separator, but WO is not respecting this when it extracts the values again.

You can see this behavior with this code:

In your WOComponent:

public WORedirect createDA(){
	NSMutableDictionary dict = new NSMutableDictionary();
	dict.takeValueForKey("Zero", "valueZero");
	dict.takeValueForKey(String.valueOf(1), "valueOne");
	dict.takeValueForKey("Two", "valueTwo");
	NSLog.out.appendln("Before: " + dict);
	String url = context().directActionURLForActionNamed( 
					"default", dict ); 
	WORedirect redirect = new WORedirect(context());
	NSLog.out.appendln("URL: " + url);
	redirect.setUrl(url);
	return redirect;
}

In your DirectAction Class:

public WOActionResults defaultAction() {
    NSLog.out.appendln("After: " + request().formValues());
    return pageWithName("Main");
}

You’ll see something like this in the Console:

Pre: {valueZero = "Zero"; valueTwo = "Two"; valueOne = "1"; }

URL: /cgi-bin/WebObjects/NewWOTest.woa/wa/default?valueZero=Zero&valueTwo=Two&valueOne=1

After: {valueZero = ("Zero"); amp;valueTwo = ("Two"); amp;valueOne = ("1");}

Because WO doesn’t respect the encoding when it extracts the URL values you end up with munged dictionary keys. This pretty much breaks using WORedirect to call a DirectAction. I can’t see an easy workaround.

I’m still trying to figure out if this is a problem with my setup or whether it is a bug. If it’s a bug, I’ll be very disappointed. I use WORedirect extensively in a number of apps and this’ll mean I’ll have to revert to WO 5.2.4 (again).

Update: I filed a bug on this.

Update: OK this is really ugly. But… I need this to work, so as a hack I’m adding a line to my WORedirects so they look like this:

public WORedirect createDA(){
	NSMutableDictionary dict = new NSMutableDictionary();
	dict.takeValueForKey("Zero", "valueZero");
	dict.takeValueForKey(String.valueOf(1), "valueOne");
	dict.takeValueForKey("Two", "valueTwo");
	NSLog.out.appendln("Pre: " + dict);
	String url = context().directActionURLForActionNamed( 
					"default", dict ); 
	url = url.replaceAll("&", "&");
	WORedirect redirect = new WORedirect(context());
	NSLog.out.appendln("URL: " + url);
	redirect.setUrl(url);
	return redirect;
}