Saturday, March 31, 2012

3471.5

So In the first quarter, I managed 269 miles on my own bike -- a lot more cycle commutes in March than I had expected -- plus 75 on the hire bike for holiday -- putting me 1/3 the way to my target of 1000 for the half-year.


Early cycling holiday


Seckford Hall Hotel gardens

To use up some carry-over leave from last year, I booked the last possible use-by dates, and decided on the cyclebreaks Tudor Treat package, so that even if the weather was awful, I could at least be pampered. As it was, having been their last customer out last year, I was their first out this -- and doing so, I caught the last day of the glorious early summer, before a return to more normal conditions. So on the first morning in glorious sunshine I set off, and let the miles roll past:


View 29-Mar-2012 in a larger map

Setiing out about 09:30, I didn't decide on what route I'd take until getting to the Red Lion at Martlesham, where I turned right, and made the same sort of loop around Ipswich as I did last time I was there -- only this time, I paid more attention to the cycle-route signs when having to clip the corner of the built-up area (where motorists were queueing to full up cars and petrol cans), and then down the only really busy piece of road, the B1113 through Sproughton, which combined up-hill with constant traffic both ways.

I went through the old village at Copdock, rather than slogging up the old dual carriageway, then through the obvious route to the White Horse at Tattingstone, getting there just after midday; by which time it was warm enough to have taken off the brushed cotton shirt I'd started with. And after a pint -- too early yet for lunch (despite the tempting menu) after a huge breakfast -- warm enough to strip down to shorts as well. From there, the cycle-path around Alton Water began shortly after, then to the Suffolk Food Hall for a light lunch.

The return route was pretty much forced into backtracking some of the way in until turning north at Belstead; then having made mistakes in the in-bound route last time, I followed the more direct way to the city centre and then followed the cycle-route signs out East -- no long spells of pushing, only the first little bit around that multiple roundabout -- and out along the country lanes to the hotel.

Sum total, 45 miles; so I was a trifle creaky when having freshened up, I went down for a much needed pint at the hotel bar.



View 30-Mar-2012 in a larger map

Friday opened sunny, and was forecast warm, so I started on the loop down to Felixstowe, to look over at Harwich; but cloud soon bubbled up and socked in completely, with a raw northerly wind, so by the time I got onto the unpleasantly busy road south of Kirton, I thought this was no longer a day for going to the coast, and took the only way out that wasn't back, aiming for the Dog at Grundisburgh for a light lunch; and then took a rather indirect amble back to the hotel, for just over 30 miles in total, before setting off home to beat the evening rush.

Although the second day was more the weather I had been expecting, cold northerly aside, it was really nice to be out and enjoying the countryside in spring -- cowslips, daffodils and primroses running riot in the verges, and daffs in most patches of woodland.


Tuesday, March 27, 2012

C++ then and now

A long while ago (turn of the century) I wrote a little Win32 utility to drag and drop files to get their MD5 and SHA-1 hashes -- useful for verifying downloads. And when I composed the hex-string hashes into a std::string, it looked almost 'C' like, thus (repeated once per hash):

with <string> being the only bit of C++ in sight, in fact

After the recent Going Native C++11 bash I decided to dust it off and revise it using Boost and the TR1 features in VC++ 2010 (which has most of the C++11 goodness all by itself). So now that section looks like:

which gets called in another lambda that is for_eaching over a vector of tuples containing hash contexts.

The code size has gone up (down if you count discarding hand-written MD5 and SHA1 for the CryptoAPI -- which adds its own error-handling bloat); but the increase includes half a dozen little RAII classes, and code to discover a better monospace font than SYSTEM_FIXED_FONT, albeit from a hard-coded list of Inconsolata, Consolas, Lucida Console and finally Courier New.

My immediate reaction is that the provision of lambdas now makes the standard algorithms actually usable -- no more functor classes remote from the point of use -- and I can program it in the more functional style that I'm now used to.

Saturday, March 24, 2012

Summer's lease

Today, even before the clocks go forward for summer time, it was warm enough to sit out in the garden until the sun got too low, at about 3pm -- or 4pm in tomorrow's money.

Still, there's bound to be rain at Easter.

Monday, March 19, 2012

C# under the covers

More of what the compiler does without you realising it, only this time in a C# sample.

The absolutely simplest sort of method, which you can clearly completely cover by calling it once. Right?

That's what I thought until I tried running OpenCover over code rather like this, and it told me I had only covered one of two possible branches.

So naturally, I go "WTF?", and wonder whether it's the return or throw alternatives out of .First that it's alluding to and to be certain, crack open ILSpy, and see that first line expands to

which actually involves first caching the delegate corresponding to the lambda, if it hasn't been already; or using it on subsequent calls.

The release build is much the same; it lacks the initial nop, and the meaningless jump-to-next-instruction at offset 0x23.

Move the constant string out into the method, and make the lambda close over it

and the caching goes away : a new instance of ClassLibrary2.Class1/'<>c__DisplayClass1' gets created every time, debug or release. And with it goes the branch.

Sunday, March 18, 2012

Spring keeps springing

As usual at this time of year, high pressure usually means socked in 8/8 cloud, or fog after a clear night; and with sunset around 6pm, a prompt return from work and/or some remote working after dinner when cycling. Despite that, a clear night before the full moon meant good conditions for cycling to and from dinner; and since then I've managed three days (out of seven possible) cycling to work when it wasn't foggy and/or drizzling.

The garden continues to progress - primroses now all in flower, not just the ones in the sunny places that have been going a month or more; viburnum still, a solitary daffodil, can crocuses and snowdrops giving way to the early dwarf tulips. I've even had the mower out a couple of times now.

Still a lot of April chores ahead -- lawn work, clearing weeds from the various beds; but I've made a start on some of that already, mainly last Sunday when we had the first warm day where I didn't need a jacket going to the garden centre for supplies.


Friday, March 02, 2012

Spring has sprung

After a foggy start, yesterday was bright and mild; a perfect day for spring to open. Let us hope that the month does not exit in too leonine a fashion.

All winter, when the cats have complained about being kept on strictly measured rations, as the vet says they could do to shed a few ounces, I've told them to go and catch something if they want more to eat.

So yesterday, they celebrated spring by leaving a pile of entrails on the kitchen floor, as token that one at least had found a reasonably sized rodent to supplement the kibble.