Wednesday, February 11, 2009

Smooth moves

The first morning this week without Code Orange weather warnings about ice, I leave home after 9am, in the bright sunshine, to take the direct route to work.

There was the expected slush from churned up puddles at the top of the Eversdens, and in the corners at Kingston where the run-off always crosses the road. Two short sections, and no real surprise.

That came in Bourn, which was a total ice-rink. Very cautious on the turn with run-off just before the descent to the valley, a slightly premature sigh of relief at the bottom, to be greeted with very light steering and the automated traction system light flashing past the turn immediately following. Very slow, and lots of slush on the ascent past, around the bus parked with hazard lights in the Caxton turn-off, to meet another reversing slowly away from attempting the descent. Lots more slush from puddles over the road, only getting to a mostly clear state past the village where the sun had been able to fall on the road.

Still, no more than 30 all the way to the old Bedford road. By the time I'm into work, I really feel like something stronger than coffee!

Monday, February 09, 2009

Milestones

Driving to visit Karen in hospital this evening, went over the 30,000 mile mark just as I was about to turn down the Backs, and parked with 30003 on the clock in Addenbrooke's car park.

On the homeward leg, in the driving sleet, slowing gracefully to a 30 limit, concentration suddenly distracted by flashing in the rear view mirror, as some speeding jerk pulls past -- alas, not managing to auto-Darwinate as would have richly been deserved.

Links for 9-Feb

WPF Application Quality Guide -- advice and how-to.

The basic syntax of F# -- keywords and constructs.

Recreating the button.

Interop between Java and Scala.

Friday, February 06, 2009

Book — The Tyranny of the Night & Lord of the Silent Kingdom by Glen Cook

Normally, I don't get on with fantasy as a genre; but Glen Cook is an exception. His Black Company series was so good that when I picked up the first volume, and started reading it one lunchtime, I quickly stopped and went to pick up the next two (and went on to pick the rest of that sequence up as they came out).

Towards the end of last year, after a nigh-complete drought of fiction, and too many programming books, I happened to spot the second of the above titles on the shelf at Borders, bought it like a shot, and was annoyed to find it was the second in the sequence. So, the first went on the wish-list, and when it didn't arrive in my Yuletide presents, I just had to order it myself.

So, the story. It's clear from early on that this is a rebadged version of Europe in the high Middle Ages, with Cathars, Albigensians, a rather more enduring Avignon Papacy, Constantinople, and all the turmoils of Outremer, plus a layer of generally malign magic and magical entities on top. In the hands of almost any other author in the field, this would be a sign that I'd throw the damn thing across the room before page 76; but Cook's style and delivery delivered an absorbing read.

And now I'm waiting impatiently for the next volume, and rejoicing that his Dread Empire series is coming back into print...

Book — Programming in Scala by Odersky et al.

The Scala language first crossed my consciousness over a year ago, at a stage where I was just starting to get into functional languages. But even with the various quick tour documents on the language web site, it was clear there were a lot more subtleties to this one that were not being explained.

With the stairway book, that gap has been bridged.

The book is aimed at the experienced programmer in 'C' derived imperative languages, with at least some familiarity with the Java™ language, and ideally some notion about functional programming techniques -- it is not by any stretch of the imagination a "my first programming book". For the intended audience, it is an extremely effective step-by-step guide to the features, and the syntax, of the language (this is a great contrast with e.g. Foundations of F#, which expends very little effort towards separating the accidents of the particular example from the generic syntax). While I am by no means yet fluent in the language, I feel that when I'm using it for hobby coding that I'm not just groping in the dark, but instead have a solid guide and reference to lead me.

Snow

So, it's being another proper winter. Monday, Thursday and Friday, snow lying -- today even falling -- first thing; but roads essentially beaten clear by late morning, though still wet. Still, it's easier to stay at home and remote into the office when I'm working on stuff that just requires getting into coding haze.

We coped a lot better in the winters 20+ years ago -- like 1986, where I first became aware of the village I now live in, by walking through it in a blizzard and hard sub-zero temperatures, on the 1st of March, as part of the local Oxfam walk that year. Then we drove up from Stevenage for the day, without any trauma to stick in the memory.

This year it's been barely freezing, if at all, with the snow quickly becoming slush -- and yet the roads snarl up.

Friday, January 16, 2009

A forward pipe (“ |> ”) operator in Scala

One of the addictive things from F# is the |> operator defined by

but I've not yet found an equivalent in Scala, even though there are a ton of useful things given by the built-in APIs -- for example, I've not had to implement the usual abstraction to manage an (array, offset, length) combination, when there's Array.slice() there already.

So, just for fun...

with unit test

Refrigerator logic — I later realise that without actually adding any variance annotations the piped-to function can be one that takes any super-class of the value type. A little more thought suggests to me that type-inference does that automagically because it is able to reconcile all inputs into the types in that single expression, and will force the value to the supertype in order to make everything match up.

Thursday, January 08, 2009

Old-fashioned winter

After a dull near-freezing weekend, there was snow lying on Monday morning, in a day of sunshine and showers.

Tuesday, bright, sunny and sub-zero; so when we went on the weekly lunchtime walk, rather than staying on paved ways, we came to the bridlepath that has been too muddy all last year, and it was white with firm trodden-down snow. So we made an unexpected off-piste diversion.

Wednesday was back to about freezing, and dull, leaving lots of slush in shaded places; today, the same.

Links for 8-Jan

PoSh -- an effective foreach idiom.

PoSh -- Boots for WPF GUIs (inspired by Ruby Shoes).

C#3 and currying (series).

Ultimate List of Free Windows Software from Microsoft!