Saturday, May 30, 2009

Spring Holiday '09

Half term, a break in Karen's exercise classes, so I was free from being a taxi, so occasion to be out on the bicycle again; doing the other Norfolk itinerary from the Cycle Breaks people. The bank holiday weekend opened glorious summer, but by the Monday evening, at the base hotel, rain.


View Spring Holiday 2009 in a larger map

That meant an afternoon start, dripping trees, several places to ford, tedious portages on the one off-road bit, but at least there was one open pub, in Oxborough, at about the halfway point. Unlike in '06, I didn't even consider the Grimes Graves detour.

Wednesday was cold, very windy, and rainy, so I made a straight sprint to Gt. Bircham for the next hotel (the King's Head, the very foody place where I had lunched last time I was in the area), arriving at the same time as the luggage -- but was able to check in! Settling down to rest, alas, I found I had forgotten to return the previous room key. Aaargh!! So in a bout of ma(so)chismo, checked the map for a more direct route, and headed back, from brightening weather into renewed rain and strong headwind, having to walk a lot of the A1065 stretch, as uphill into the wind. At least it was easy coasting on the return leg.

So, 50 miles in, finally able to rest -- though a hot shower isn't quite the same as a soak in a hot bath.

Thursday, some sunshine, and a lot of sultry overcast, I did a bit of the Sandringham loop suggested for the previous day, and part of the Burnham Market/Nelson's country tour for the day. The 42 miles felt longer, after the previous day's exertions -- but finding the Gin Trap Inn at the half-way mark made it all worth while.

Friday, in brightening and hotter weather, if still often overcast, looping wide of the suggested route to keep away from the bits I'd done to death on Wednesday.

Sunday, May 24, 2009

IronRuby0.5 -- not yet running with NetBeans Ruby IDE

With IronPython done, the next step was obvious... Again, the only IronRuby/NetBeans material out there to date only concerns itself with the politics of Sun vis a vis MSFT (and red herrings like ASP.Net/MVC vs Rails). So, more rubber hitting the road to do here --

Unlike with RubyMine, NetBeans isn't satisfied with the indirection through a ruby.cmd like the one suggested in the linked article (it tells you it's not a valid Ruby interpreter); but it is clear from the file browser for ruby platforms that you need a file with name matching *ruby*.

So, copy ir.exe,ir.exe.config to ruby.exe,ruby.exe.config, and that takes as Ruby platform Ruby 1.8.6-p0 (my less than recent CRuby being Ruby 1.8.6-p111). So far so good.

Enter and run a trivial script:

puts "Hello"

get

unknown: The given path's format is not supported. (System::NotSupportedException)

even though running from the command line works just fine. Google doesn't show up any obvious correlates; and the message is one of those totally useless ones like "Could not find the path specified" which would be of some use if it actually said what the broken input actually was, rather than gaily presuming you'll know what it was.

So, anyone have any ideas?

Later:-- Using Debug, rather than Run will start the script (and by using ScottGu's IronRuby/WPF sample as the testbed script, I can be sure that it's IronRuby being launched. The process gets killed eventually, as the debugger can't attach to it, but it doesn't have the path exception.

The message given in the Run case is the same as you get from passing a mangled path-script to the ruby (née irb) executable; but there's no obvious reason for Debug to be doing anything different in this area. So I'm still baffled.

Using IronPython with NetBeans Python IDE

With the arrival of the IronPython 2.6 beta 1, with ctypes support, the IronPython 1.x only support in IronPython Studio really takes the IDE from a bit dated to seriously obsolescent.

Now, I had tried to get IronPython 2.0 to talk with NetBeans, but hadn't immediately achieved success, so, with less motivation, had put that to one side. Perhaps for similar reasons, a recipe for this wasn't out on Google already -- but now I really needed to crack the problem, I wasn't going to let that earlier abject failure put me off.

Also, since then, I'd seen someone else doing similar stuff to get IronRuby to play with an IDE, in this case, RubyMine, by tinkering with the file actually getting called by the IDE.

Well, checking my Python 2.6.1 command line with -?, and the same for IronPython 2.6 beta 1, they overlapped in almost every essential. So, I tried the experiment of copying ipy.exe,ipyw.exe to python.exe,pythonw.exe in the same C:\Program Files\IronPython 2.6 folder, and then adding the copied python.exe as a new NetBeans Python platform.

And it worked!

So, I created a new python project for platform Python 2.6.0 (as opposed to CPython 2.6.1's Python 2.6), and entered

and ran it, which yielded

24/05/2009 14:28:30
2.6.0 (IronPython 2.6 Beta 1 (2.6.0.10) on .NET 2.0.50727.3074)

which is of course what we wanted.

Friday, May 22, 2009

Monday, May 18, 2009

Drama

Sunshine in February

The rascal

Kamina, the male Tonkinese of our collection, has caused us a little bit of an upset these last few days. He was around the garden Thursday evening while I was weeding and watering the greenhouse, but I lost track of him as it started to go dark. Still, no worries -- he knows how to use the cat-flap...

Yoko was wailing in the morning, and was there all alone. Her brother hadn't come in (and Jemima is never going to let herself be shown how to use the flap).

No sign of pathetic little corpses on a quick scoot round the neighbourhood...

Still nothing this morning, which started to give hope that he hadn't been run over (the bodies usually get found sooner).

At lunchtime, take a little note to put up at the village shop -- to be told that someone has just come in having found a cat.

A quick phone call later -- and it is him; at the other end of the village, about half a mile away, found tangled up in a hedge (which he had had to be cut out of) -- I guess something must have chased him and he'd taken refuge that was too good.

So, a little bit scrawnier from the experience, he's on a rigorous regimen of eating (canned rather than kibble, as a treat) and sleeping (except when being fussed by the guys who came to service the hoists). And once more there's be a cat who will eat our scraps -- the others just ignored some ham rinds I put down for them as a treat.

Sunday, May 17, 2009

Retrospective — Maria-sama ga miteru Season 1

Maria-sama ga miteru is a series that was already being hailed as a classic when I first watched it, yet one that took years longer than the slighter (and later) Kasimasi, to get an official English language release; I guess perhaps because it doesn't have wacky hi-jinks, just low key slice-of-life drama.

Set in a somewhat exotic Catholic school for girls, the story centres about first-year high school student Fukuzawa Yumi, and her incorporation into the succession for the school council, the Yamayurikai, or mountain-lily council (headed by girls with the titles of White, Red and Yellow Rose as one might not expect). This is done by "adoption", under the system where each girl adopts a member of the lower years as an honorary younger sister (in a sort of den-mother arrangement). While the somewhat uncertain relationship between middle-class Yumi and Sachiko, her hopelessly aristocratic onee-sama (top left) forms the core of the season, the stories of the other Rose "families" are visited as Yumi gets to know them; including, in flashback, appearances of the previous class of Roses.

I had forgotten quite how widely the back-story spread -- including, in flashback to the previous year, appearances of the previous class of Roses (lower left). I'd also forgotten that even in the first season we got fan-service in the form of Yumi's zettai ryouiki (top right), as well as quite how boisterous Satou Sei, aka Rosa Gigantea, was.

It definitely bore the rewatching; the more so to contrast with the series just past, set one year later, with Yumi now in the position that Sachiko is here.

Anime — Astro Fighter Sunred

“This is the story of the conflict between good and evil that takes place in the city of Kawasaki.”

Q4 '08 was a strange season. I had expected to only watch Tytania; but that just lost my interest partway through. The good series were the ones that didn't actually appear so from the pre-season material. Mouryou no Hako was one; this was the other.

Sunred, a former sentai hero (but don't let on that you know about that!), lives the NEET lifestyle, sponging off his girlfriend Kayako. His opponents in the evil organization Florsheim (named after the shoe company, I believe), are a mix of monsters (usually in McJobs of their own), plushy animals, and a few actual employees, all of whom get the occasional necessary drubbing from Sunred in the local playground to keep them in line.

Meanwhile, they carry on with their domestic lives, with a strange sort of friendship between Kayako, and General Vamp, the local Florsheim leader, as they cook, clean and help each other move house. Indeed Vamp seems to be as much preoccupied with the culinary arts as he is with plotting Red's downfall and subsequent world domination.

An amusing and ironic deconstruction of the whole superhero genre in 26 half-length episodes (and the promise of another season to come).

Anime — The Daughter of Twenty Faces

I finally watched the adequate (in that they could be post-processed into English, and were terribly mistimed over the ED) subs for the last episode; which really added nothing to what had gone before.

The last episode seemed really like a filler, rather than a happily-ever-after; on an optimistic reading, it could set up a second season. Mr Forty Eyebrows makes no appearance, but we do get a "what they are doing now?" for everyone else; and a brief appearance of another character from the original material, Yoshio Kobayashi, who will eventually become Akechi's adopted son, and leader of the Detective Boys.

Oh, yes. And Engrish. Just to show that they are in England.

Monday, May 11, 2009

Spring weather

There are belated equinoctial gales around at the moment, which have made the weather rather less than conducive for cycling, even when it's not raining. I took advantage of the calm at the weekend to wobble home with a couple more grow-bags for the greenhouse on the back rack. Still, the tomatoes are deployed nicely. If only something wasn't digging up the raised bed with the lettuce and peppers...

I have to remember, though that April and May are usually disappointing for cycling; and take advantage of the evenings to potter in the garden instead.

Also, 10000π miles at work today.

Monday, May 04, 2009

Bank Holiday Weather

Saturday was a glorious day, just perfect for lunching out at the picnic table, and sipping wine, with friends. From then on, it has been rather downhill, so what we might more reasonably expect for the occasion -- cloudy, cool, and just wet enough to be a nuisance.

Still, it has meant time to get seeds planted in the greenhouse, after having given the raised bed a good soaking.

I also got around to one other chore, one that reminds me quite how bad the last couple of summers must have been in aggregate. I finally cleared the paved area by the shed of the pots, bags of sand and compost, and edging slabs put there in advance of the building works at the end of '05, as well as the ivy, brambles and nettles that had overgrown them all. This year I might even be able to get at the shed to creosote it again in the autumn.

Hey, my 1,111th post!

Retrospective — Kasimasi ~ Girl meets Girl

Blast from the past time...

The past season having been thin on the ground, I've turned to rewatching some of the series that I watched years ago. With this one, a yuri rom-com, I had wondered whether the original fond recollections were just due to an uncritical consumption of anything animé at the time; and was actually pleasantly surprised at quite how well it held up the second time around.

The set-up is sketched in efficiently -- the necessary unlikely accident with a UFO rebuilds the not very manly boy, Hazumu, as a girl, to be found by his childhood friend, the tom-boy Tomari (blonde), and the girl he had just confessed to, the very feminine Yasuna (black hair). Wacky hi-jinks ensue as Hazumu learns how to conduct himself as girl, watched over by the girls, the inevitable spinster teacher, the alien whose spaceship crashed into him, a father revealed as a dirty old man, and his long suffering best mate (who still cannot handle the fact the other boy now, well, has curves in all the right -- or wrong -- places).

And then the sudden change of gears as the triangle of Hazumu, Yasuna and Tomari takes over, and for the last few episodes, everything is suddenly played straight. The contrast was as sudden and as shocking as I remembered -- though knowing how the dilemma would eventually resolve took some of the tension away.

Still, it held up remarkably well, for something seemingly so flimsy.

Lost in translation — Mouryou no Hako

Late summer 1952. A chance encounter on a train. A stranger carrying a living severed head in a box. The strange friendship between a rich schoolgirl and the poor one. A detective still traumatized from the war. A girl falls under a train. A demanding exorcist. Fevered dreams in a strange hospital. An outbreak of dismemberment murders. An editor's conference. An experiment in clairvoyance.

Eight episodes in out of thirteen, no further translation in sight, official or otherwise; but according to those who have managed to follow the gist of the later episodes, undoubtedly the best series of last year.

Beautiful, haunting, enigmatic, intelligent, disturbing, based off a much adapted Japanese novel.

No wonder it didn't get any love.

Lost in translation — The Daughter of Twenty Faces

2008 was a fairly disappointing year for new anime compared with the previous two years, a lot of shows that were merely average, and the few titles that stood out as better than the usual run of moe-blobbery and wacky hi-jinks had some other things in common : slow and erratic subbing, and little if any likelihood of ever getting an official English language release.

At least Hakaba Kitarou actually got complete subtitling. The Daughter of Twenty Faces still languishes with the concluding episode -- thankfully only a post-script -- lacking decent subs.

The story, set in 1950s Japan, is pulp at its finest. The Mystery Man with Twenty Faces is a gentleman thief/pulp adventurer type from Japan's own pulp era, a hybrid of Doc Savage and Blackshirt or Raffles in the form we are introduced to him; Chiko, the titular character, is an orphan heiress, fostered by scheming relatives.

To nobody's surprise, she is rescued from her peril by Twenty Faces, and for a time becomes one of his gang, joining in his various capers -- until a trap is sprung that leaves everyone but Chiko for dead.

So, not only does Chiko now still have to contend with the scheming aunt who stands to inherit the fortune to which she is heir, but a long list of former adversaries of her mentor, who believe that she is the one remaining link to a wartime secret of Twenty Faces', culminating in the eventual showdown on top of the inevitable Tokyo Tower.

Anime — Windy Tales

A short slice of life series about the adventures of a school digital camera club. And cats. And the wind.

True to its title, the wind is everywhere, in swirling and rushing animation, often home to hordes of cats frolicking in the air, sometimes just blowing around.

The premise -- girl sees cat on school roof while taking pictures of clouds, tries to catch it when it leaps off (and flies away on the wind), and falls, her fall broken by one of the teachers who just happens to come from a small village where the art of wind-working is a tradition -- is there mostly to give the small group of students some shared secret, as well as to excuse many indulgent scenes of wind and weather. And cats.

Between the off-beat premise, which never falls over into outright magical-girl, and the idiosyncratic art style, this series charmed me in a way that typical school-girl slice of life (Hidamari, Sketchbook,...) never does. However, I suspect that those are exactly the reasons why this series is quite so obscure, and out of print.

Sunday, May 03, 2009

Anime — Zettai Karen Children

This is not a series I'd intended to watch. It looked from the premise like "Japan does the PowerPuff Girls -- again". The Absolutely Lovely Children are three top-level espers (teleport, telekino and telepath, reading across at top left) fostered by and working for BABEL, a Japanese government agency, where they work to avert disasters, and apprehend rogue espers.

Then the first episode came out, and it started to sound so bad, it might actually be good in a perverse kind of way -- Kaoru, the redhead turns out to have the mindset of a dirty old man, as shown centre-left (in a later episode she even calls for the spiritual assistance of all the dirty old men in the world); and the villain, Muscle Okama, is a totally camp Hard Gay impersonator with an unusual petrifying energy attack (lower left).

But soon, after a few episodes to establish the main cast, you realise that this is actually the X-Men, and not the PowerPuff Girls after all. There are groups of anti-esper normals who are targeting espers on both sides of the law, for whom The Children are prime targets; the red-headed telekino soon gets the first of several power-ups (lower middle, upper middle); and then a silver haired WWII veteran with a group of other disaffected espers, fighting for an esper-only world under the organization name PANDRA, make their appearance (right column -- the answer to the question being, "No, I'm Magneto."). And, finally, a prediction from the most powerful precognitive, that as young women, the (no longer) Children will side with PANDRA against the rest of the world (centre), led by the Dark PhoenixQueen of Catastrophe.

Thematically, the series is all over the place -- from guest appearances by characters from other series, including the Strike Witches, broad slapstick, off-colour humour about the 20-something guy who's handler and foster-parent to The Children and the strains his precocious charges inflict all the way to straight drama, with the prophecy, and the continuing themes of discrimination based on accident of birth, but without getting too full of itself.

All in all, a much better series than it had any right to be; and plus one point for making sensible use of a duress password in one episode.

Book — IronPython in Action by Foord & Muirhead

IronPython is an important language.

Back in 2000 at the Microsoft PDC, where the .net platform was unveiled after much hype, we were given a vision of the Common Language Runtime as a truly polyglot platform, with 15-20 languages having been fed into the design, tantalizing code snippets shown -- and even previews of ActiveState's real-soon-now Python.NET and Perl.NET implementations.

And then for five years, .net programming meant no more nor less than C# (or VB.Net if you swung that way), with the two languages adopted for the platform from the wider world being at best niche -- J# a known dead end, and C++ for .net never really recovering from the horrible extensions used in the first attempt at the job.

And then, in 2005, it was steam-engine time : the first inklings of an ML dialect, labelled F#, for .net from Microsoft Research, and IronPython, a project initially undertaken to show why Python on .net couldn't be done -- a meme whose genesis I strongly suspect lies in the failure of that early ActiveState effort. While, however, F# still remains a CTP release (even at a 1.9.x release number) to this day, the IronPython 1.0 production release (Python 2.4 compatibility) was the best birthday present I never realised I'd received in 2006. Yet, until very recently, whereas F# was supported by several books, all published even before the CTP announcement, even as a production release, IronPython languished in the English language press.

IronPython in Action now fills that surprising gap.

The task the authors set themselves is an heroic one -- to teach Python to .net programmers, and .net to Python programmers, and, just in case that was not enough, several of the more outré parts of .net, and good programming practices, for just about everybody as well. What makes this a great book is that, in the course of about 450 pages, with copious external citations, they actually succeed.

Part of the secret of the success is that this (like Programming in Scala) is not a beginner's book and assumes the reader has a degree of familiarity with basic programming concepts -- for example, the Python if, for and while statements are covered together in just over a page, with the link collection in Appendix C there in case a more at length treatment is required -- so freeing space for more advanced material to be covered.

The scope of the material covered came as a most pleasant surprise -- when I pre-ordered the book, it was as a gesture of support, because the language deserved a presence in print (after all, I'd been programming since whenever, using .net since it hit 1.0, and IronPython for a couple of years, so not much of it should be exactly new...); when it finally arrived and I could read it, I found there were significant things I could learn from it, new insights and just better ways to achieve some things already did.

In particular, the chapter on testing is pretty much worth the admission price all by itself, simply for the worked example of how to solve that perennial problem -- performing automated testing of a .net GUI application (as opposed to just testing the backing libraries).

You don't even need to use IronPython as your .net language of choice to benefit from much of the third section of the book, Advanced .NET. This not only covers parts of the framework too often neglected in C# texts (like the extremely useful, if unsexy, System.Management namespace), but also provides a more measured introduction to the sexier new technologies (WPF and Silverlight) than the books dedicated to those technologies that I have read. Where it is specific to IronPython, this section also serves to emphasise the importance of the language within the larger world of .net, with the ASP.Net extensions for dynamic languages, and the inclusion of the dynamic language extensions (the DLR) within Silverlight.

And if you don't yet use IronPython (or the less mature IronRuby), there's really only one thing that this book neglects to point out about the language -- but it's one that might finally change your mind. Although it's now distributed as an .msi installer, once unpacked, the required assemblies can still be simply XCOPY installed to run on any machine with the .net 2.0 or later framework already in place, giving you a .net-aware scripting language anywhere you have .net already.


Disclaimers: Yes, I do get a shout-out in the book for one of my earlier postings in this blog. And while I would have written a review anyway, for the same reason I bought the book sight unseen, I have since been suggested to the guys at Manning Publications as a potential reviewer by the authors. So, here is the review you were looking for.

This review is released under the WTFPL.

Saturday, May 02, 2009

Book — Clean Code by Robert C. Martin.

The review, after following the advice contained in the book: Read this book!


Ok, let's back off one step...

If you write code at all, then this book will be of use to you. If you write code as part of your day job, then it is essential reading.


Ok, let's back off a long way...

Every so often, a book comes along that codifies best practice in a way that manages to illuminate the path from where things are right now, to a better place that we'd rather be -- things like Fowler et al's Refactoring or the Gang of Four Design Patterns. This is one of those books. And if much of the material is the sort that seems obvious in hindsight -- well, that is the mark of a well written book, to make the concepts that clear.

Taking a series of real world examples -- open source projects with significant user bases, including FitNesse and JUnit -- a series of worked examples take us from good, or at least adequate, code, to a form which is better factored, and easier to read, with the steps along the way clearly marked. Yes, even some of Kent Beck's code is put under the microscope, and carefully polished that extra stage or two more.

The reader is cautioned that, without working long hours to follow these examples, this will be just another of those feel-good books. I don't quite agree -- spending just a little time to follow the transformations, and then reflecting on one's own outpourings should be enough to make this a feel-bad book. All the sins from obscurely named variables to sprawling functions that gaily mix abstraction levels, we've all done them (especially programming in FORTRAN on minicomputers with slow stacks and a rule of thumb that 1 call ~ 40 loc in terms of performance).

The maxim to take from the book is based on Baden-Powell's "Try and leave this world a little better than you found it", and owes to the same school of thought as "whenever you are in the garden, pull at least one weed". The meat of the book is in distinguishing what are the weeds from the intended crop.

So read it, understand the examples, and then refer to it often -- like the other titles mentioned, it is a reference work, and should become one of the most thumbed on your bookshelf.

FsCheck -- a quick hack for bytes

This exceptionally trivial piece of FsCheck:


surprised me by going Microsoft.FSharp.Core.FailureException : Geneflect: type not handled System.Byte. Especially so when the whole thing I was trying to write at the time was all about bytes, in arrays, in queues,...

So a little bit of diving into the FsCheck code later, a quick and dirty extension for handling bytes in Arbitrary.fs:

Later: now with fewer redundant parentheses and other clutter--

which now gives Ok, passed 100 tests. which is what I had been wanting in the first place.

Instrumenting the function under test as

shows a plausibly noisy set of inputs, so any remaining flaws will be subtle ones.

This example is believed to still be correct under the Feb 2010 CTP.