Wednesday, December 29, 2010

2010 in media


A very disappointing year, with a totally dismal Film Festival, and otherwise only the Chaumet/Tati L'Illusioniste really standing out enough to tempt me to the cinema. I would have gone to see The Story of Kells as part of the festival had it not been in a no-unaccompanied-adult showing; but wasn't motivated to see it when it came around later. And similarly, previous commitments and bad weather relieved me of having to decide whether to make the effort to fit in Rare Exports.


I actually read a few this year that weren't software related. Excluding the holiday reading potboilers (Lindsey Davis' latest Falco, some by the numbers sci-fi,...)

  • Miéville's Un Lun Dun was a young people's Neverwhere -- some nice ideas, but it didn't quite cohere in the end. And I'm sufficiently bourgeois that the mundane London in the book was a more alien world than Un Lun Dun itself.
  • Also by Miéville, The City and the City is the first Hugo winner I've read before the award since A Fire Upon The Deep. An interesting conceit of cities wrapped around a police procedural.
  • Reynold's Terminal World was a vast improvement over his previous House of Suns, being a fairly straightforward adventure yarn in a setting where Vingean Zones of Thought happen on a scale of miles rather than kiloparsecs.
  • I also finally got around to Nahoko Uehashi's Moribito: Guardian of the Spirit -- and was surprised quite how much the anime had expanded upon the rather short and sparse narrative.

And while I'm here, probably worth warning people about the two weakest of the computing texts I picked up this year, both in the Wrox Professional series:

  • Professional Iron Python was a very strange book, and it did cover some obscure points of .net/Windows programming; but for IronPython, not good. It read like a draft that had been put together while the language was still in its pre-beta stages and then hurriedly given a Visual Studio 2010/.net 4 gloss. In particular the author repeatedly makes the incorrect assertion that IronPython statements cannot span multiple lines -- which leaves me dubious as to the rest of the content I've not independently verified. Get IronPython in Action instead.
  • Professional F#2.0 just approaches being content free. It covers very little of the language (no computation expressions, let alone anything like quotations), giving more emphasis to the imperative rather than functional aspects where it does. Get the O'Reilly Programming F# instead.


2010 was the year where Crunchyroll reached a sufficient point that -- whatever the sordid history of the operation might be -- it was possible to watch a fair selection of series without resorting to fansubs. A few series that I might have watched, or at least sampled (House of Five Leaves, Tatami Galaxy) were streamed by Funimation -- but they don't seem to have cottoned on that the world is more than just Japan and the US.

Going by the metric that "/a/ doesn't talk about good anime" -- where it is obvious whether a title that is not talked about is good or bad -- House of Five Leaves, from a manga by the same author as Ristorante Paradiso is the only one that I feel any regrets about missing.

Apart from titles already blogged, I still have the last episode of Virgin Pomegranate Monster to watch, as well as the concluding cours for Letter Bee REVERSE and Super Robot Wars OG : The Inspector.

And of course no discussion of 2010 in anime would be complete without a mention of the new GAINAX series, Panty & Stocking with Garterbelt, a title that I watched just enough of to feel I could add it to my MAL dropped list (i.e. more than one episode).

A combination of all that is wrong with American cartoons multiplied by "LOL, Japan!", this was the disappointing result of giving a studio of talented animators full freedom to have fun and do what they wanted. Alas, what they wanted to do was act like retarded 12-year-olds -- so if you've grown out of finding messy bodily functions funny, or haven't seen any of the stuff that they're lampooning, and don't get your jollies from hearing cute Japanese girls swearing a blue streak, it ends up by being the saddest waste of talent I've seen in many a year. And another case where I ignored the implication "it's being talked about, ergo it isn't very good", because I couldn't believe it was really that bad.

Alas, it was. In fact, watching the audience reactions as they were trolled mightily at every turn with misleading hints about forthcoming episodes, and desperately tried to make it all make sense, all the way up to the sudden ending with "To be continued in next season" (when Gainax have never done a second season of any of their original anime) was far, far more entertaining than the series itself.

Tuesday, December 28, 2010

“Hello, OTP!” from F# revisited

That previous F# code was just too ugly to leave as it was; so after a little bit of work, I've factored out a general purpose wrapper to convert the Otp.Erlang types into values of a discriminated union on the F# side of the fence. Like this we can directly pattern match, without the descent into massive nesting that we had before, and keep the Otp.Erlang types encapsulated into wrappers for method calls on the Otp types.

With this addition the main program above can be revised to become

which looks a lot more like the language we're trying to write in. All the magic happens in this file

Of course, as OTP.Net is some revs behind the current Erlang distro's JInterface, this type mapping is incomplete (no BitStr or Fun types) compared with what we could be using. The main advantage is that it works right now.

“Hello, OTP!” from F#

Nothing earth-shattering here, just recording the results of a little bit of playing around with OTP.Net and F#. This is all building on the original work done elsewhere Integrating .NET and Erlang using OTP.NET and Integrating F# and Erlang Using OTP.NET, as a little bit of a five-finger exercise using the OTP framework as now explained in Erlang and OTP in Action.

So, simple gen_server to export the same sort of API as the mathserver example in the former:

Compile this using erlc and start werl -sname servernode -setcookie cookie. Meanwhile the matching F# program to build and run is

Matching the dynamic types possible with Erlang, and the F# way with type hierarchies, makes this code somewhat ugly (as in multiply nested decision points and the start of the arrow anti-pattern) when trying to unpick the return values, especially trying to decode the possible return values when requesting that the far end server start up.

Some of the repeated noise has been factored out into the Atom active pattern for dealing with {Reason, Payload}, but the underlying data model in OTP.Net is simply not very F# friendly.

Anime — Giant Killing

When this title was announced for the spring season, my reaction was "Oh, football..." and pass it by -- but towards the end of its airing, it had become one of those series that hardly ever got talked about, but always positively when it was mentioned. So, with a fairly thin line-up for autumn, I went back and gave the first episode a try...

And it has turned out to be my pick for the best series of the year, by being so much not what the bulk of anime has become in recent years : the characters are adults, there's no romance, or borderline smut, or cute girls doing things cutely. It also confirms the trend that series where the characters have perceptible noses are ones worth investigating.

The story opens when East Tokyo United, a team in a prolonged slump, bring back a former star player, Takeshi Tatsumi, from England, where he as been coaching amateur (or at least not full-time professional) sides to good effect -- like taking them to the 4th round of the FA Cup. This return as coach after having abandoned the team years before rankles amongst some of the players and many of the fans; the more so when he finally shows up at training, and chooses a starting side mainly from the reserves.

Slowly, with a mixture of shrewd insight, and complete irreverence to the way things are done on and off the pitch (like sloping out of a press conference for an informal chat with the manager of the national team), Tatsumi starts to bring the team together. At last ETU notches up a few wins, and then in the climax of the series, have to face the Osaka Gunners, who in their previous match steamrollered a stronger side than ETU 8-0, in a match that actually spreads over more than 90 minutes of air time.

The manga continues; we have only come half-way through the new season, and there isn't a plot-wrapped-up end. If there were to be a second season, I'd watch it.

Saturday, December 25, 2010

Links for 25-Dec Bumper catch-up edition

2010 having spanned the run from first integration point through to RTM and GA for XenDesktop 5, I was being increasingly preoccupied as the year went on; and blogging of any form was one of the main casualties. Which means I have a not-so-little list of backlog of things I want to keep track of from the last couple of months:


.net General

Build Process


F# GUI plumbing with reactive Events

My most recent "Aha!" moment with the language is to finally wrap my head around the standard Event module -- a sort of lightweight subset of the Reactive Extensions for .net -- while starting to do some more GUI programming in F#, which is making belated use of the GTK#/Glade spikes I made about a year ago.

It may not make much difference in the simplest cases where

naively went to

but which is equivalent to, using the Event module,

At this point the main difference is the change in the function signature -- first, it is a real F# function rather than being forced to use the implicit cast from a fun to a delegate, even if the function signatures look compatible on the surface; second the function passed to Event.add doesn't have the source argument (but, as shown, that can be brought in as a closure).

So that's a small win from the beginning -- but that just scratches the surface. Where it actually shines is where multiple sources of events have to be handled in much the same way. For example, given a menu containing recently accessed files, with selection meaning to re-open that file, as if they had been selected from a file open action

All the inhomogeneity of the event sources (button click, menu item activation) and their associated EventArgs types is smoothed away by appropriate calls and the use of closures; different validations are handled by appropriate Event.filter or Event.choose invocations; and then the whole ensemble is gathered together by an appropriate fold with Event.merge as the accumulator.

True, there is nothing here that could not be achieved by making old-style handler functions for AddHandler from equivalent appropriately composed function chains -- the path I was starting to take for this bit of plumbing before I was indirectly reminded of this feature, and dug up this series of posts from a couple of years back (so slightly dated in the details). The big difference that using the Event module makes is that it is more expressive of intent, and separates the concerns -- general event handling plumbing vs this application's business logic -- explicitly.

A white-ish Christmas

Last Saturday started dry but cold, though with some ice still on the road outside -- cycling into town in multiple layers, with only my nose exposed, that was very cold for the first couple of miles until I started to radiate enough heat through it. I got back home mid-afternoon, and took a nap, waking to find the world turned white.

So it was a work-from-home start of the week, while waiting for the ungritted roads in the village to be pounded clear; with a brisk yomp to Waitrose to get me out of the house. By Thursday, as the threatened midweek snow had come to nothing, I did go into the office (probably getting a lot less done than had I stayed at home).

Yesterday, I did the approximately biennial feat of cycling into work for the shortest working day -- although the fields were white, and the sky grey, the road was dry, and the weather, although still below zero on the way in, was milder than it had been (showing quite how accustomed we soon become to the cold). And in doing so that put me over the 1000 miles for this half year.

Today is brighter and sunny, but colder. Where I cleared the drive is dry, but the untouched snow is showing no signs of turning to slush like it had a few days ago. I shall have to make my way down the garden to check the greenhouse and the broccoli.

Tuesday, December 07, 2010

Winter Wonderland

The car thermometer showed -6 as I started out to work at about 08:45 this morning, dropping quickly to -8, and then slowly recovering to -7. Isn't it time we had an apology for predictions like this one from ten years ago?

Monday, November 22, 2010

Sometimes, a man's gotta do what a man's gotta do...

I encountered this outburst of testosterone fuelled experimentation a couple of weeks ago, and mentioned it to Karen -- who immediately said that this was something that had to be done. So, yesterday I actually made some of the

Manliest Bread EVARR!!!!!111elebenty!!!!!!1 *

Bacon. Jalapeno. Cheesy. Beer. Bread. The sheer awesomeness of the concept forced that punctuation, I swear.

And it was a great success.

The recipe (for a bread making machine)

Bread chassis:

  • 1 tsp yeast
  • 1.25 tsp salt
  • 1.5 tsp sugar
  • 350g strong white flour
  • 150g strong wholemeal flour

And in the main mix

In the candied fruit hopper:

  • 4 rashers of thick-cut bacon, dry-fried (pouring off any oozing water as required) until stiff, rinds removed and chopped into ~1cm bits
  • As many jalapeno pepper slices as will fit.

Cook on standard raisin bread program. Cool for an hour, then enjoy!

It was wonderfully savoury warm with butter, and made a fine accompaniment to a chilli powered by the fruits of our greenhouse (to the extent of 2/3 of the loaf). Though I couldn't help feeling that there had to be some way to work some garlic into the mix without spoiling the awesome.

* OK, some pedants will point out that this recipe is just loaded with phytoestrogens. But it's the concept that counts.

Sunday, November 14, 2010

Anime — Strike Witches 2

As hinted by the ending of the previous series, further adventures of half-dressed alternate- WWII aces; despite not being quite popular enough to stop the original studio going under, the franchise was considered worth taking up.

Unfortunately, much of the charm of the first series -- the copious period references, and character driven episodes -- was lost in favour of even more bath scenes and tacky comedy. When, finally, an attempt at plot and drama wobbled into sight in the last couple of episodes, it didn't have any foundation to rest upon.

Overall, rather disappointing for being pretty much what the premise would lead you to expect, and no more. Will I watch the inevitable third season? Probably.

Monday, November 08, 2010

Links for 8-Nov

Asynchronous programming in .net

Also from the PDC -- what next for Silverlight?

Rx Design Guidelines.

SSL/TLS isn't computationally expensive.

NuGet -- gems for .net has a new name.

The Should Assertion Library.

Sandcastle MSBuild integration.

Friday, October 29, 2010

Anime — The Book of Bantorra : Armed Librarians

A belated review, by some months, belated enough that it's fallen off the Crunchryroll roster.

I tried the first episode late last year, and wasn't impressed, but went back after a lot of talk about how the series was getting awesome later on; and fortunately the awful CGI from the first episode seemed to be a one-off.

In a climate where cute girls doing cute things and high-school romance seemed to have driven almost everything else off the table, Bantorra was a welcome return to an adult cast (with well endowed women) and OTT violence. However shoehorning a series of ten light novels with more plot twists than you could shake a stick at into a 26 + 1 recap episode series didn't quite work out so well in the end.

The setting was interesting and unusual in many ways -- a sort of alternate 1940s, where magic also exists, and people have made up European-style names that look and sound more like keyboard mashing (Olivia Litlets, Parney Pealrmanta, Enrique Bis'hile...); in a world where at death, a memory snapshot fossilizes as a "book" that can be "read" by touching it.

So the big struggle starts off between the Armed Librarians under Acting Director Hamyuts Meseta of the Bantorra Library, and the Church of Drowning in God's Grace, whose noble thoughts about the value of humans is belied by their separating their flock into True Men (at the top), Mock Men (mid-range operatives) and Meats (the masses). And then things get more and more complicated, with -- except in the occasional digressive arc for a bit of back-story -- the villains of the piece changing again and again, and major characters being killed all over the show.

Perhaps had it been a 40-episode series it might not have seemed quite so erratic and all over the place; or maybe it would have still seemed like it was trying to fit in everything and the kitchen sink. Overall a decent enough piece of entertainment and one that at least did all it could to be different from the current pack.

Wednesday, October 27, 2010

Javascript Airport weather decoder

While weatherpixie remains on extended hiatus, I have finally put together a simple in-browser replacement. It uses James Padolsey's cross-domain Ajax plug-in for jQuery (indirecting via YQL), a simple parsing script from Manuel Heras, here separated into a stand-alone script, and an iframe-based page to do the work.

The final piece of heavy lifting is to get the appropriate METAR report for the local airfield, and that's just a few lines of javascript --

Here, EGSC is the ICAO code for Cambridge Airport. And that's a lot closer to home than the Met. Office who give out current conditions at Bedford on the Cambridge forecast!

Saturday, October 09, 2010

Road rage

Some weeks ago, I was working late, and so cycling home after the usually flurry of commuter traffic.

Coasting one of the downhill parts, doing in the 15-20mph range, I suddenly heard this strange whirring sound behind me -- and then, suddenly, a whole flotilla of sport cyclists.

Now, when they travel solo, going along in their spray-on advertising, nose on the tarmac, arse in conjunction with the planet Jupiter, they are just subjects of merry jest. When they travel in packs, it's different.

Six to eight pairs of them streamed past me, peddling like the clappers, leaving little to no clearance, doing only the absolute minimum to move out of their straight line and pass, nearly forcing me into the verge -- much more threatening and aggressive road use than any of the buses or farm vehicles I usually have to contend with.

Between their silly outfits and bad behaviour, the sort of thing that gives cyclists a bad name, and discourages cycling as a more relaxed form of transport.

Thursday, October 07, 2010

A season in the saddle

Three months ago, I finally got around to getting a cheap and cheerful trip computer for my bike. Three months later I have done 767.4 miles at an average of 11 mph, as well as measuring that the final part of my journey to work that I couldn't measure with the car odo, starting with an off-road part, comes to just over 1.6 miles each way.

This also measures up to my order of magnitude guesswork that I average closer to 2000 miles in the saddle each year than 1000.

Tuesday, October 05, 2010

Computing per-service SIDs without sc.exe

How it's done is well known:

When configured to have a per-service SID (i.e. type of SID either "Unrestricted" or "Restricted"), the service SID is computed as S-1-5-80-{SHA-1(service name in uppercase)}

Here's a quick script to do it, that can be the basis for including the computation programmatically into e.g. installer generation.

So running it we get:

>& 'C:\Program Files\FSharp-\bin\fsi.exe' .\ssid.fsx MyService

which compares nicely with:

>sc showsid MyService

NAME: MyService
SERVICE SID: S-1-5-80-517257762-1253276234-605902578-3995580692-1133959824

where each of the 5 trailing facets is just the decimal representation of 4 bytes of the SHA-1 hash taken as a little-endian unsigned integer.

Saturday, September 25, 2010

Film — True Legend (Su Qi-Er)

Woo-Ping Yuen's latest chop-socky film about Beggar Su, the master of Dunken Fist wu-shu had its UK première here this evening.

It was almost solid martial arts mayhem, with just a few pauses for breath; however the structure of the film was a bit of a mess -- the intrusive 'now put on your 3D glasses/OK take them off again' around the training arc and what looked like it was going to be the Boss Fight didn't help (nor did the 3D itself where the actors often seemed to be floating detached from the rather washed-out scene around them.

The story itself seems to be a fairly direct one about Su and his adopted brother Yuan who spurns the generosity of his adopted family, and cue two-way revenge tragedy -- then just when you think it's all over, a long coda culminating in the real Boss Fight out of nowhere.

Clearly it must be following the high points of a well known tale -- but it ends up feeling unresolved because of the broken narrative rhythm, whereas stopping at the tragedy of the 3/4 mark would have given closure (if you don't ask too deeply why a martial artist of Su's calibre would dig a box out of sandy ground with his bare hands, rather than using some one-inch-punch technique to break open the lid in situ).

In all, not entirely satisfying popcorn fare.

Wednesday, September 22, 2010

Film — Henri Quatre (Henry of Navarre)

Added to the Film Festival programme after the program went to print, a competently done edited-highlights costume drama (German production, dialogue in French with some Italian and Latin) of the life and turbulent times of the eponymous French King.

Not something I would have gone out of my way to see, had I not already earmarked this week for the festival, but equally not something where I felt I'd wasted the afternoon.

Sunday, September 19, 2010

Anime — Kemono no souja Erin

Where 2007's Seirei no Moribito adapted the first of a series of ten novels by Nahoko Uehashi over 26 episodes, this 2009 series adapted the first two of a separate quartet of hers over 50 episodes; and while they are, in broad, fantasy, there is none of even the limited magic from the Moribito series.

We follow Erin -- crabapple -- for a decade or so from her childhood, where her mother, Soyon, tends some of the ferocious war lizards -- touda -- that the Grand Duke of the land employs as the ultimate weapon against potential invaders, and Erin herself is a keen observer of her mother's craft and of the natural world around her. As an outsider, from a despised people, who had only married into the touda raising village, Soyon is the obvious scapegoat when the whole colony fall to some mysterious sickness.

Literally cast adrift after her mother's death, Erin is eventually fostered by a kindly bee-keeper, under whose care she discovers more about the natural world -- and encounters for the first time the ohju, the wolf/roc lord beasts with their iridescent plumage. Being fascinated by these creatures, and nature as a whole, she finally manages to be inducted into the prestigious school-cum-ohju care centre near the capital, in the peaceful lands of the True Queen, whom the Grand Duke protects.

And as Erin takes to her craft, and violates all manner of traditions of ohju-care in doing so, politics and dissension amongst the successors of both the throne and the dukedom brew up and engulf her, against all her desires, until a final resolution that changes the status quo forever.

Being spread over so many episodes, the pacing is glacial during the first arc, until Erin is cast into exile (part of the reason why this review is somewhat belated); but once that is past, and the story starts to move, albeit at a leisurely pace, it becomes gently compelling, in the same quiet way that Aria is.

It is clearly an anime aimed at younger children -- not only are there some comic relief characters whose function is purely that; but the last episode concluded with an announcement that there would be a 10 episode summary then broadcast on an education channel. As such, where there is violence involving touda or ohju, the art moves from realistic to an effective highly stylized mode; and the person-to-person combats are almost bloodless; this being Japan, though, there are several themes, including Erin's preference for suicide to being used as a tool by any of the competing factions, that are probably not sanitizable for sensitive Western tastes.

Overall, good, but not great. Being on Crunchyroll, it's viewable without fansub guilt -- but equally it's unlikely to make it to DVD.

Caught in the Act -- Again!

This evening, after I'd made sure that the cat-flap was set to inbound-only, I heard the door swinging, and thought to myself "but all the cats who know how to use it are in, unless this is a visitor" -- but there was no sound of challenge from the cats who had just a little while before been at their feeding station nearby.

So, I wander into the lobby, just in time to see the hindquarters of a cat exiting through the 'In' door, clearly having hooked it open by the rubber rim and stuck a nose under.

Some cats are too clever for their own good!

Saturday, September 18, 2010

Film — The Extraordinary Adventures of Adèle Blanc-Sec

For someone who announced his retirement a few years ago, Luc Besson remains remarkably active...

The 30th Cambridge Film Festival opened with his latest film, an adaptation of a 1970s bande dessinée about the eponymous Adèle, who is an Edwardian Lara Croft, with a touch of Tintin, in a turn of the century Paris, populated mainly by bumbling gentlemen with florid moustaches and ghastly haircuts. And, for reasons that become apparent as the film progresses, a rapacious pterodactyl which serves as the maguffin.

For a comedy adventure, the humour is uneven, sometimes leaden, some gags are over used (the rule of three is callously disregarded at times), sometimes a little too knowing (in the form of a certain quip about a change in the Parisian landscape that post-dates the original publication), but in the main, works.

Two strikes against the film -- an anachronistic attitude to tobacco (fixable by tweaking one line of dialog), and two uses of bullet time.

Oh -- and you do have to stay through the credits for this one.

Sunday, September 05, 2010

Film — L'Illusioniste

A new feature directed by Sylvain Chaumet (Triplettes de Belleville) to a 1956 screenplay by Jacques Tati. This 100+ minute animation is very clearly a Tati film -- it's almost done in mime, an absolute mimimum of dialogue -- with a strong air of melancholy under the veneer of humour (an example of the mood being the scene where the girl, who has attached herself to the middle-aged, slightly past-it stage magician of the title, serves up rabbit stew to him, and some of the other stage acts who share their digs, while he is surreptitiously looking for where the obnoxious creature which he pulls out of hats has gone). Although the CGI leaps out at you in a slightly obnoxious fashion in a couple of shots, for the most part it could be line and watercolour after the style of Oliver Postgate.

Its evocation of Britain (some London, a lot of Scotland) c1960 rings very true, both in the looks -- I'm sure there were photographic references underlying the scenery -- but also the cultural references, as the old music hall acts are elbowed out by the new rock'n'rollers exemplified by Billy Boy and the Britoons. And there are some more knowing, more contemporary, jokes embedded in some of the signage (it's very worth reading all the text, like the menu at the chippie, and the pawnbroker's hoardings).

And look out for the actual Tati to make a brief appearance, as well as the namesake central character.

Likely to be the best film I see all year.

Wednesday, September 01, 2010

Caught in the act!

For a while now, I've had my suspicions as to who was responsible for the level of food in an open tin going down. Now I have the suspect red-handed --

Call me Arthur

"Call me Arthur"

At least that's not as bad as bringing a pigeon in through the cat-flap, which is what I came home to today -- a flurry of feathers and a bemused looking half-plucked bird standing in the middle of the living room floor, and needing shooing out,

Tuesday, August 31, 2010

Cambridge Film Festival

An even more dreary and schlocky or right-on selection in the program (though the list on the printed program differs slightly from what are listed on the web-site) this year; down to only 2 that caught my eye

Let us hope that neither is a disappointment, since the generally tawdry, often cheap and nasty looking, selection of films definitely is. (Clearly no money or enthusiasm available for anything like Miyazaki's Arietty.)

Friday, August 27, 2010

Cycling Holiday

View August 2010 in a larger map

Equipped with the new car and, more importantly, a bike-rack, I strapped my trusty old mount on the back, programmed the satnav, and set off for a couple of mights' stay in one of the country inns that I've stayed in as part of a Cycle Breaks holiday -- this time going to the King's Head in Great Bircham, thereby cutting out a couple of days messing around near Swaffham (and, equally important, the drive home down the A11).

After an easy run through showery weather, I got to my destination in good time to unship the bike and head off to the Gin Trap Inn at Ringstead for lunch. Alas, the after lunch amble down the lanes was interrupted by unexpected rain, first a cautionary sprinkle, then, a mile or so from base, the heavens opened.

Tuesday I trusted the forecast when it said light showers, late afternoon, so set out on a long loop, expecting to pick up some provisions in Fakenham, then head up to the coast. Not finding any obvious place to buy big cartons of juice in Fakenham, I just loaded up with some Lucozade Sport, then started following the cycle route to the coast.

Evidence of previous rain was there in the need to get off and wheel the bike around some big puddles on a short stretch of green lane; but by the time I got to Gt Walsingham, the sun was shining, and I could shed the brushed cotton shirt that had been providing warmth. And then I noticed the wall of weather heading my way. With not enough time and land to avoid it, I skipped the off-road path through Holkham Hall grounds, did as best as possible to skirt Wells, and got to the main road as the sun shone through again, and revealed another squall line following.

I got to the Jockey in Burnham Market just ahead of the weather and then waited for it to pass, before heading back slightly damp and in strong cold wind to the hotel.

On the last day, I looped west, through good weather that started to develop a high haze, discovering a convenient superette in Heacham -- even though I didn't need anything; a useful stretch of cyclepath along the main road between Heacham and Hunstanton, and eventually back to the Gin Trap for lunch, before heading back through distinctly overcast weather. This time I beat the rain on the route to the hotel -- but it arrived earlier than forecast during the drive home.

Thursday, August 12, 2010

Shiny new toy

After six and a bit years, and 37,509 miles, I traded in the old Smart -- chosen as one they had in stock and wanted to shift -- for one customised as I would originally have wanted, only this time it's the 2.0 model, a Passion rather than a Pure.

Shiny new toy

This one came with 14 miles not reset on the clock, digital audio input as standard and a bike-rack as custom -- which I shall be putting to use as part of the first serious outing it will get.

Links for 12-Aug

Using the Reactive Extensions:

F# Silverlight template.

PartCover patched to avoid writing to HKLM (my first patch to someone else's FOSS project!)

Untangling expression trees.

Using Code coverage -- did the right tests get written?

How we approach unfamiliar code (study).

Cosmos (C# OS kit) reaches milestone 5 with Visual Studio integration.

Saturday, July 17, 2010

Building PartCover 4 on Vista

Updated again: PartCover Revision 35 includes a patch I provided that builds the same functionality in C#, transiently registering the COM component in HKCU during build, and also providing a --register command line option which is equivalent to the old nCover //r option.

Updated with new complete registry frobbing script, based on actually diffing the before and after states of HKCR when using regsvr32 on the PartCover dll.

Following on from earlier in the week, I pulled the current trunk from SourceForge, and set about building it then putting it to work on some F# code which had caused an earlier version (the most recent available at the end of last year) to balk.

Unzipping the tools (Boost, ATL server) into the appropriate libraries, guided by the include paths (and moving the Debug relative paths to match the Release ones) was trivial, and then it's just a case of firing up MSBuild. Or so I thought.

First hiccup -- it attempts to register the PartCover assembly during the build, and I don't run as administrator by default. So I replaced the

regsvr32 /s /c "$(TargetPath)"

by a manual registry frobbing trick (akin to what NCover 1.5.8 used for its //r option)

"$(ProgramFiles)\FSharp-\bin\fsi.exe" "$(ProjectDir)\partcover.fsx" "$(TargetPath)"

where partcover.fsx is

This updated per-user registration permits both building and running the PartCover utility without needing full administrator privilege.

So emitting

...\PartCover.exe --target "..\..\..\_Tools\Microsoft Fxcop 10.0\FxCopCmd.exe"  --target-work-dir . --target-args "/q /s /console /f:Tinesware.Recorder.dll /f:Tinesware.Instrumentation.exe /f:Tinesware.Infrastructure.dll /f:Tinesware.Rules.dll /f:Tinesware.InfrastructureTests.dll /f:BaseTests.dll /rule:Tinesware.Rules .dll /o:fxcop.xml /dictionary:..\..\..\CustomDictionary.xml" --include [Tinesware.*]* --include [CSharpTests]* --output PartCoverage.xml

to monitor code coverage when using an FxCop rule written in F#, this reported

open driver pipe
modify target environment variables
create target process
wait for driver connection
[00000] [05724] Options dump:
[00000] [05724]   VerboseLevel: -842150451
[00016] [05724]   Log file: ...\Infrastructure\_Binaries\Tinesware.InfrastructureTe
[00016] [05724]   Log pipe: yes
[00016] [05724]   Count Coverage - ON
[00016] [05724]   Count Call Tree - OFF
[00016] [05724]   Exclude [mscorlib]*
[00016] [05724]   Exclude [System*]*
[00016] [05724]   Include [Tinesware.*]*
[00016] [05724]   Include [CSharpTests]*
Project : warning : CA0060 : The indirectly-referenced assembly 'Microsoft.VisualStudio.CodeAnalysis, Version=,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be found. This assembly is not required for analysis, howeve
r, analysis results could be incomplete. This assembly was referenced by: ...\Infra
[04774] [05724] CorProfiler is turned off
Target PageFaultCount: 33536
Target PagefileUsage: 84246528
Target PeakPagefileUsage: 87359488
Target PeakWorkingSetSize: 92827648
Target QuotaNonPagedPoolUsage: 10920
Target QuotaPagedPoolUsage: 328336
Target QuotaPeakNonPagedPoolUsage: 43160
Target QuotaPeakPagedPoolUsage: 374344
Target WorkingSetSize: 89481216
Total 0 bytes ...\Infrastructure\_Binaries\Tinesware.InfrastructureTests4\Debug+AnyCPU

which completed cleanly, unlike before, and gave a sane looking output file. There is now obvious code in the system for doing the short branch instruction fix-up, which seems to have resolved the issue I had last time I tried this tool.

So, it really does look good to go for .net 4 code -- and I just have to add hooks to consume that format as well as the old NCover style.

Monday, July 12, 2010

dotCover 1.0 beta -- first impressions

The beta of the coverage tool from the same people who brought you Resharper came out late last week, and I took the chance to have a quick play with what it offers.

As expected, it integrates smoothly with the R# unit test running -- you can see exactly what code your test or set of tests cover; marked in green overlay in the source view for covered by the test(s) you just ran, red elsewhere, in a manner reminiscent of NCoverExplorer.

There is also a command-line option

Usage: JetBrains.dotCover.ConsoleRunner.exe /Executable='executable' [/Arguments='arguments'] [/WorkingDir='working dir'] /Output='output' 

Not having R# at home -- because I rarely use C# even if I'm writing for .net -- it's this which interested me more. So, I gave it a try on my current F# project

>& 'C:\Program Files\JetBrains\dotCover\v1.0\Bin\JetBrains.dotCover.ConsoleRunner.exe' /executable='..\..\..\_Tools\Microsoft FxCop 1.36\FxCopCmd.exe' /Arguments='/q /s /console /f:Tinesware.Recorder.dll /f:Tinesware.Instrumentation.exe /f: Tinesware.Infrastructure.dll /f:Tinesware.Rules.dll /f:Tinesware.InfrastructureTests.dll /f:BaseTests.dll  /rule:Tinesware.Rules.dll /o:fxcop.xml  /rule:.\Rules /dictionary:..\..\..\CustomDictionary.xml' /workingdir=. /output=dotcover.xml

which yields a bald total coverage number

JetBrains dotCover Console Runner v1.0.56.11 JetBrains s.r.o.
Coverage session started [12/07/2010 20:14:16]
Coverage session finished [12/07/2010 20:14:28]
Index files: ...AppData\Local\Temp\ssc06AE2.tmp
Log files: ...AppData\Local\Temp\lgc02A14.tmp
Opening snapshot...
Generating report...
Total coverage: 78%

and an XML report file that makes it clear that that percentage is based on all assemblies dragged into the AppDomain, counting those which have no pdb information as containing no statements to cover, which means if you're running unit tests with Rhino.Mocks that it includes things like

<Assembly Name="021925b1-cbe9-42d3-ad44-a39206195c2a" CoveredStatements="0" TotalStatements="0" CoveragePercent="0">
    <Type Name="IsolatorProxyb66a653c9a984566ac790c4fa654cab5" CoveredStatements="0" TotalStatements="0" CoveragePercent="0">
      <Type Name="InvocationShouldCallOriginal_1" CoveredStatements="0" TotalStatements="0" CoveragePercent="0">
        <Member Name="HandleEvent" CoveredStatements="0" TotalStatements="0" CoveragePercent="0" />

emanating from dynamic assemblies. And it seems from simple experiment that the filters that you can apply in Visual Studio don't seem to carry over to the command-line version.

The report is formatted as shown above, with hierarchy

Root -> Assembly -> Namespace -> Type -> Nested Type or Member (repeating Type as often as necessary)

There’s also no granularity below Member, so even for code with .pdb information available the reports only look like

<Type Name="Local" CoveredStatements="166" TotalStatements="173" CoveragePercent="95">
        <Member Name="get_Mutex" CoveredStatements="0" TotalStatements="0" CoveragePercent="0" />
        <Member Name="ExpandFile" CoveredStatements="2" TotalStatements="4" CoveragePercent="50" />
        <Member Name="LoadFile" CoveredStatements="4" TotalStatements="7" CoveragePercent="57" />
        <Member Name="op_GreaterQmarkGreater" CoveredStatements="4" TotalStatements="4" CoveragePercent="100" />
        <Member Name="op_GreaterPlusQmarkQmark" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="op_GreaterMultiplyGreater" CoveredStatements="4" TotalStatements="5" CoveragePercent="80" />
        <Member Name="op_GreaterPlusQmark" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="op_GreaterPlus" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="GetXmlData" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="DoWithLock" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="op_Append" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="GetByName" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="SetByName" CoveredStatements="1" TotalStatements="1" CoveragePercent="100" />
        <Member Name="GetStatementRange" CoveredStatements="2" TotalStatements="2" CoveragePercent="100" />
        <Member Name="FindSignatureForMethod" CoveredStatements="8" TotalStatements="8" CoveragePercent="100" />
        <Member Name="FindXmlForMethod" CoveredStatements="7" TotalStatements="7" CoveragePercent="100" />
        <Member Name="get_DeclaredExempt" CoveredStatements="0" TotalStatements="0" CoveragePercent="0" />
        <Member Name="get_AutomaticExempt" CoveredStatements="0" TotalStatements="0" CoveragePercent="0" />

So there can be no useful equivalent of NCoverExplorer for after the fact detail – to get detailed line un-coverage information you actually have to run every one of your unit tests in Visual Studio in one big bang.

Its metric of what counts as a statement is subtly different from what NCover (free) and the other tools I've been working on recently. It reports an F# property like

let AutomaticExempt = "-2"

or an equivalent C# automatic property, for that matter, as having 0 lines, rather than N/A and 1 respectively; but that aside it seems to be counting the self-same list of sequence points.

So, it seems that this is primarily a tool for interactive use and positive coverage testing -- "Does this set of tests cover this line, and if so, which one(s)?"; in a build process environment the lack of ability to focus down to only the assemblies of interest in the report (discarding tool and system code), and of per-statement reporting it is less interesting.

However it did take the F# code which PartCover had balked at in its stride.

Meanwhile in other news

There is a branch of PartCover that supports .net 4 originally on GitHub and which has now been merged into the main-line at SourceForge, removing one of the objections to using this tool. There also seems to be rather more life in this than there was six months ago when I tried it, so I shall have to revisit it and see if the IL issue is also resolved.

Sunday, June 06, 2010

Cycling Holiday

This time based at Seckford Hall Hotel, just across the A12 from Woodbridge. This meant that going anywhere by bike meant heading west into the country lanes first; and that routes were circumscribed by not wanting to cross the A12 or A14.

After a wet day on Tuesday, driving to the hotel and dining there, the rest of the week was glorious early summer -- bright, dry, and with cooling onshore breezes holding the temperature to sensible levels.

First day I decided to strike out a long route, starting with following a cycle route across the top of Ipswich, then clipping a corner -- with a little bit of dead reckoning -- and around, arriving at Pin Mill for lunch.

Pin Mill

Pin Mill

I did a loop round Alton Water to return, and then into Ipswich and through rather than retrace the loop. There had been enough cycle provision in the bit I had done before that it seemed resonable; though on the return leg there were a lot of cyclelanes interrupted by traffic calming islands. The bit through the centre I wheeled the bike, but otherwise it was no problem.

View 2-Jun-2010 in a larger map

Second day, out to the coast, into the strong breeze; cool enough by the time I was approaching Orford to want to put a long-sleeved shirt on. This time, crossing the A12 at a cycle crossing with lights, and cruising through Woodbridge.

Castle and chestnuts

Orford Castle

Return via Snape, and a familiar route -- indeed a lot of the suggested routes on this holiday were ones I'd taken when wanting to lengthen the ride on others.

View 3-Jun-2010 in a larger map

The last day started and finished the same, and I headed up to Framlingham, to check out whether Off the Square was functional again for lunch -- alas it seemed to be re-booting (adverts in the windows for head and sous-chef; no menu displayed). So looped back after a pub lunch at the Old Mill House at Saxtead Green.

Saxtead Mill

Saxtead Mill

View 4-Jun-2010 in a larger map

Wednesday, May 19, 2010

F# -- excessively lazy sequences and stateful visitors

Doing something a little bit complicated here: the functional equivalent of a visitor pattern, where I want to apply a few functions to a long and potentially expensive to traverse sequence of items (so ruling out a series of iterations over the visited nodes) --

BuildNodeSequence itself returns a nested sequence expression of the data to visit, and state is well, expected to be handled by mutable out-of-band means.

This works nicely, but is impure -- so let's try to fix that by having the visitor function update itself with the transient state we need to carry between (there will still be side-effects for output). The code becomes

where the Fix delegate type is a way of reifying an otherwise infinite type Node ->'a where 'a is also Node ->'a through

and have it build

Well, I run this and...

Nothing happens -- or at least apply gets called for every node to visit, but invoke never did; until I forced the evaluation of the visitors sequence by

So, what I finally ended up with is

where the inner iterable is evaluated eagerly, rather than being left to lazy IEnumerable expansion; and this then works.

Monday, May 17, 2010

An interesting bit of F# behaviour

In one assembly, define a public static class in C#:

In another do something similar in F#:

which Reflector tells us is equivalent to

inside namespace ClassLibrary1. Now create another F# library referencing the previous two containing

The first line compiles; the second doesn't, failing with compile error error FS0039: The type 'Module1' is not defined.

Clearly the CompilationMapping is being sniffed by the typeof operation, because that is the only difference between the two.

Friday, May 07, 2010

No real change here then

Conservative 47.4; Liberal Democrat 34.1; Labour 10.2; Constituency Swing 2.5% From CON to LD since last time (continuing small erosion).

At least the only fascist party standing locally came last -- and the local character and UKIP ejectee standing as an independent came in 4th, narrowly beating UKIP into 5th place out of six.

Whoever emerges from the rest of the shambles will probably be calling in the IMF in a few months, so it makes little difference.

Wednesday, April 28, 2010


The garden is in full flush at the moment. The forsythia, daffs, plum blossom, primroses and tulips are just fading, while the Morello, Bramley and grape hyacinths are at their peak, and the bluebells, the Charles Ross and the lilac are just starting to burst their buds.

Cut and come again salad I planted in the greenhouse is starting to germinate, and today a batch of plants arrived, so as soon as I was back from work it was time to pot up sweet-peas and squash, to add leaf beet half the salad bed and the rest in the sunny herb bed, and put the tomato plants into grow-bags in the greenhouse. Between that, mowing the lawn and cooking dinner, I hardly stopped before it was getting dark, taking advantage of the last of this good run of almost summer weather before we get typical Bank Holiday cold and wet.

More project type tricks

The trick to make an F# project launch in the Visual Studio web server is a further application of a little trick I picked up a while back for Vs2008.

There I wanted to retrofit a Windows Workflow into an existing plain C# library project; which I started by building the workflow in a scratch project and copying the source across -- but then in the copy I lost the designer. So I looked at the project file and immediately I saw


Copying that into the otherwise vanilla C# project not only gave me the workflow designer, but also the workflow and activity items on the Add> menu. There is also a

  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />

but not copying that didn't seem to have any noticeable effect.

And, while I've not yet had cause to look, projects that bring in their own specialist types and designers will presumably have their own GUID values.



to an F# project gives the extra additions to the menus -- but without templates, and, more importantly partial class support -- you won't get much benefit from them, unlike with the web app launching.

Links for 28-Apr

StyleCop now open-sourced.

Mono's C# compiler-as-service -- now works in .net too!

IronRuby+Rails+Rack+IIS7 -- between this stack and the same for JRuby in Tomcat. cross platform web-apps have become fun!

No Bugs (e-book).

Unit testing FxCop rules.

Axum (Concurrency focussed language on .net) for VS2010

Snap! -- Aspect-oriented support library for .net

Double-dispatch as a code smell.


Iron* console for VS2010.

Tuesday, April 27, 2010

Launching an F# web application inside VS2010 as if it were C#

This is a follow-up to my comments on VS launcher for F# web apps, where I can put an example of the changed markup to the F# class library project to make it act like a web project and launch a browser with your Default.aspx page when you hit F5.

First, add the highlighted element to the topmost <PropertyGroup> clause in the .fsproj file thus:

where the first GUID is for web app, and the second for F# (as you can see by looking for the project in the solution file).

At the bottom of a C# web application .csproj you will find a block of code like

which you just want to copy and paste into your F# project following the

or equivalent line.

Now adding a trivial Default.aspx file containing

Welcome to ASP.NET on F#!

and the default web.config from a C# web project to the F# library, and running the project launches me that trivial web page into Firefox.

Actually getting F# to play nice with ASP.Net, I leave to those more versed in the latter.