Friday, October 23, 2009

The last days before winter

View Autumn Holiday - Thursday 22 Oct in a larger map
View Autumn Holiday 23 Oct 09 in a larger map

A quick cycle break in Constable country.

After torrential rain on Wednesday, everything was dripping on Thursday morning; and my first fording was immediately after turning out of the hotel drive. The route to Nayland was on single track roads, deep cut, so not terribly pleasant, but the leg to the west was open, and by this time the sun had burned off the early haze. I avoided the bridlepath return, diverting through Wormingford, and then took the main road to Stoke-by. The next leg started off again narrow and steep -- not pleasant cycling; and the land south of the main road towards the A12 is drear and desolate, so it was pleasant to come to Dedham, a pretty little village, for lunchtime.

The footpath to Flatford Mill was surprisingly free of any sign of the previous downpour, and the walk was nice, in the warm sunshine -- T-shirt conditions. Ate packed lunch on the riverbank, then returned to find my bike swarning with ladybirds.

Long loop to the north into more open country away from the river valleys, crossing the ford at Kersey dry-shod -- then just after Boxford getting one foot wet when suddenly encountering another. And so back, in the rapidly cooling evening sun -- at the hotel just after 5pm.

Friday, a shorter tour of the same sort of area -- sometimes avoiding narrow lanes where the vans and landrover+trailer traffic meant I had to squeeze to the sides, especially on the Stokt to Higham stretch. Despite the delivery van stuck behind me, the Green Lane north from Higham was the most pleasant such -- mainly because it was not cut 4+ feet into the terrain, and there were no high hedges blotting out the light.

Hot roast lamb with mint sauce baguette at the Cock Inn in Polstead, then the final stretch, reversing some of the previous day's, and, forewarned, getting dry across the ford this time. Again, a glorious day, again with none of the threatened showers -- just gorgeous late late Indian Summer weather; a third time lucky for this year's cycling holidays.

Tuesday, October 20, 2009

F# under the covers VI

First results from the October CTP, as ever, using Debug build

turns up FxCop warnings

warning : CA2208 : Microsoft.Usage : Method '...' passes 'source' as the 'paramName' argument to a 'ArgumentException' constructor. Replace this argument with one of the method's parameter names. Note that the provided parameter name should have the exact casing as declared on the method.

because the operation is in-lined, with code that maps back to C# as

and then immediately follows this with a similar in-lined ArgumentException.

With the new CTP we now get, on a method that used to check clean

On method 'Patterns.As<Target>(object)', prefix generic type parameter name 'Target' with 'T'.

but that's just a minor and easily fixed issue; and also

now gives

warning : CA1810 : Microsoft.Performance : Initialize all static fields in '...' when those fields are declared and remove the explicit static constructor.

A simple test with reproduces the first two, but not the last. The object is now a static member of the synthetic <StartupCode$[assembly name]>.[FileName] static class, and exposed as a property of the module.

F# October CTP first impressions

It's nice to be able to get rid of all those OverloadID attributes; and to see that attributes now do need to have the AttributeTargets.Constructor usage to be applied to constructors.

Not so good -- output from a post-build step no longer appears in the Visual Studio output tab (at least it didn't for me); and when running unit tests from such a post-build step, an F# method being called from a C# test with an final expression of unit caused nUnit to fail with no diagnostic message (would have needed a post-mortem debug). Workround was to replace () by ignore aValue where ignore _ = (); but I'm still not sure what was going on there.

The code generation (debug builds at least) has changed significantly, as I'm now getting a number of FxCop warnings from code that ran clean with the May CTP. More on that, later.

This funny behaviour -- from code that maps to C#

remains in the February 2010 CTP, but is resolved by code that looks like

Go figure!

Monday, October 19, 2009

Review catch-up — Anime and Manga

Manga : Bokurano

There was a long pause in the scanlation of the manga, broken around the airing of the anime, leading to a somewhat fractured impression when following it as it became available.

It's Mohiro Kitoh, so of course, bad things happen to children. In Narutaru, he took on Pokémon; here, he subverts the super-robot genre in a way to make Neon Genesis Evangelion seem like a happy WAFFy tale. Every time you think he's done everything, he finds a way of twisting the knife again.

The real weakness is the ending -- the epilog chapter really didn't add anything that could not be inferred (and partly relies on your ability to remember the subtle distinctions between one and another of his character designs).

Anime : Sengoku BASARA

16th century Japan as it was in the movies, or at least ought to have been — on about the level of Henry VIII vs Oliver Cromwell with Maxim guns. Superpowered ninja, high-level fighters with awesome feats, forsoothly Japanese mixed with heavy-duty Engrish. Plus Norio Wakamoto as the arch-villain Oda Nobunaga.

Switch your brain off, put ya guns on, and enjoy!

Asura Cryin' first season

A series that bundles together so many standard elements — supernatural, high-school drama, miko, ghost-girl, yakuza, demons, childhood friend potential love interest, super-robots, school councils (three of them!), apocalyptic threats — that there is no room left for anything like a coherent plot.

Alas, the only other real mindless action series this year after Sengoku BASARA.


It's about school-girl mah-jongg tournaments, with the same character designer as last year's Strike Witches.

Akagi this is not : there is little of the psychological elements, the winning hands so casually made are even more improbable, and the metaphorical struggles get elevated to full-on mahou shoujo at times. But being about an all-girls competition, it redresses the gender balance.

Indeed, rather than taking many episodes over one hand, the actual games get rattled through rather briskly, with the focus being on the girls, and their individual back-stories and improbable playing styles, like "Stealth" Momo, who is so socially invisible, that nobody notices what tiles she discards or when she declares Riichi -- except for Nodoka, who has to pretend she's playing on-line (and thus ignore any of the people at the table in any case) or the real hax players who just have too many levels of talent to be slowed down by such things.

The real shame is, that, having developed so many interesting characters, most of them will fall by the wayside as and when a second season gets made, since they have been eliminated from the current tournament level. And there has at least to be the potential for a second series, as the driving motivation for the title character is to play against her estranged sister, and that can only happen in the next rounds of the tournament.

Chi's New Address

Continues last year's Chi's Sweet Home; as the family move from their old apartment to a new pet friendly one and settle in.

Old characters return, and new ones are met -- but, alas, it stops being quite the acute observation of what a kitten is about, and becomes rather more tales of anthropomorphised animals; still cute, but not quite the same.

Review catch-up — Films seen recently

Gilliam's The Imaginarium of Doctor Parnassus

The state of the art of SFX is such now that he can do in CGI/live action what he was doing with paper back in the Python days; and it managed to carry off the multiple actors filling in the gaps in Heath Ledger's role in a smooth and unobtrusive fashion (were it not for the fact that Ledger's Australian accent stood out from the understudies).

But (and you were waiting for the 'but') I found the supporting characters grating and unsympathetic, and the inclusion of "socially relevant" elements made the story lurch back and forth too much. Inclusion of the sordid nature of contemporary London for contrast with the pure world of the imagination, yes; but the mood swings were a bit too violent and "am I relevant yet?" in nature.

His Munchhausen was better, IMHO.

Once upon a time in the West

Reissued, remastered, very much of its time, a fairly archetypal "Man with No Name" western, where, with Charles Bronson as the revenge driven guy in the white hat, there are really only shades of grey.

District 9

This savage black comedy is the best new movie I've seen in a long while, with hints of Python and early Peter Jackson in a mix that savages so many stereotypes.

Saturday, October 03, 2009

SyntaxHighlighter 2.0 Brushes for F# and Erlang

Updating the Erlang brush

This also required the following in the CSS theme

And for F#

which is as incomplete as it always was; but doesn't use any extra CSS.

Later -- another brush for F# that was published at about the same time can be found at Pense-Moi.

Migration to SyntaxHighlighter 2.0

This will be coming soon. For the moment a little note to myself, expanding from my first how-to for version 1.5:


To get the legacy mode to work, I had to put the initialization into the onload function.

I'm not rolling this out until I can get the rewritten F# and Erlang brushes to work and not throw _a2.regex is undefined messages.

Later: There are a lot of initial-letter capitalization changes (in both directions) required in this port : the "_a2.regex is undefined" messages came from more of them than at first met the eye. I still can't find the equivalent mechanism to injecting CSS styles, though.

Later yet: There doesn't seem to be a programmatic injection of CSS values any more, so I hacked the values from the 1.5 brushed into the default CSS file.

Even later: To allow legacy and non-legacy highlight styles, the legacy part of the operation must be in the onload, the 2.0 initialization must not.

Yet more: A possible bug in the CSS as supplied -- I needed to add the following

to shCore.css to get the copy-to-clipboard icon to show in the toolbar.

Friday, October 02, 2009

C# under the covers

In an earlier exploration of debug build code patterns I unearthed bits of debug assistance built into simple field-backed getter properties in C#.

That same pattern -- evaluate to a temporary, and then unconditionally branch to a return -- also shows up in non-property methods that return a constant literal or a field. With purely empty methods, there is no such intermediate value to expose to the debugger, so the method just looks like

i.e. a block with a Nop and a Return (with no expression).

The canonical stub left by Visual Studio implementing an interface looks like

which resolves to

i.e. a block with a Nop and a Throw (with a Construct expression).

Nop and a Throw alone will catch any method that simply throws as its one and only operation (even if the exception is passed in from somewhere else); if you want to determine what is being thrown, then dissecting the expression would be required.

In writing a simple static analysis tool, identifying anything that just throws -- and has no decision making logic -- is sufficient for my purposes; for anyone tempted to put massive lambdas in the throw expression, testing for the Construct may be worthwhile.