Sunday, January 31, 2016

January Cycling

Up to 13,266.5 plus a 1.7 mile drop-out one morning, meaning 327.3 + 1.7 = 329 miles in generally dry, often very mild, but occasionally windy weather. Well up on last year's 255.1, and not just because there's an extra mile or so on the commute, at least on the more pleasant morning route. And last Monday, I even did the long route via Dry Drayton (which was flooded) and Oakington.

Just like last year, the mud and grime (especially that picked up when I'd hoped that the bridleway would be frozen solid, but it wasn't -- at least the forging through the flood washed a lot of it away) have chewed through the chain I put on at the start of December, so that will need replacing next weekend.

Tuesday, January 19, 2016

Jemima

Basking in October sunshine

At her annual check-up in October, our old cat Jemima had lost weight over the year; not too surprising for a cat in her teens -- so when she pestered for more food, I was happy to indulge her, and let her scavenge our left-overs as well. Having never been a particularly sociable cat, she would at last come and purr aggressively at me for treats when I was busy in the kitchen -- and at the start of last month, when I was feeling unwell, and had made baked potato with butter and cheese as an emollient meal for a dodgy tummy, she even climbed on the bed and tried to steal my dinner from the plate.

Then on Boxing Day, I found her collapsed by the living room radiator, and wasn't sure if she'd make it through the night. But in the morning she had recovered enough to wobble out to the pond for a drink, and eat a little, so when a stop-over at the vets for rehydration had seemed to restore her equilibrium, and they couldn't find anything obvious like kidney or thyroid, so we were given steroids for her to take, and a bag of kibble for delicate stomachs, which she appreciated greatly.

Ten days of that later, she was perking up, and gaining weight, and the vet was pleased with her progress. Then she started to get absent-minded in the middle of her meals and on Sunday morning, after the normal morning care call for my wife, I went downstairs to get everyone breakfast -- and she was nowhere to be found. At that point I thought she had decided it was her time, and had gone out to find somewhere to curl up in, out of the way.

Then Monday morning, she was there in the living room, standing by the radiator, before going to curl up in her basket. By the end of the evening, she was in an uncomfortable looking twisted pose, trying to groom herself, and not making a good job of it. So this morning I called the vets, and took her in. I'm not sure how much ahead of nature the intervention came, but it would have eased her passage.


A few years ago

She outlasted her brother by a decade, but was never the people cat he was. The only times I ever could touch her were on the vet's examination table, or if, in later years, she was seriously fast asleep, and then would merely tolerate being stroked or brushed. Still, she was a mighty hunter, taking squirrels in her youth and pigeons until just a few years ago.

Friday, January 01, 2016

December/Year-End cycling

With the continuing wet and, more often, very windy weather, not a great month -- little inclination to go out and make miles during the holiday week. The year ended with only the winter bike getting used (despite a catastrophic rear-wheel failure at the start of the month), so the numbers were 12939.2, 2689.7 and 6.1 giving 230.5 for the month.

Comparing the start-of-year numbers 11040.7, 890.7 and N/A, that gives 3703.6 miles metered on my bikes, plus 374.1 off-meter for a total of 4077.7 miles, about 150 miles down on last year; hit partly by worse weather over the summer, and so no long rides for the fun of it in July or August because the good weather meant catching up in the garden instead, and less cycle-commuting in the last few weeks of the year due to stormy weather.

And if I did about 100 miles more on the winter/shopping bike, that probably has to do with the shopping being year-round.

Saturday, December 12, 2015

A little app for monitoring connectivity

One of the things that Windows Vista did better than the later releases was to recover network connectivity immediately when coming out of hibernation -- really, as if nothing had happened. Later releases seem to go back to square one to restart a WiFi connection -- and what is worse, there's no visual feedback from the systray icon after the initial handshake to tell when the link is actually useful.

As this can take tens of seconds, it is the biggest pain point I have with Windows X. So, finally I got around to writing a monitoring app.

I started with a simple systray application, and some sample code for using the Network Link Manager API as guidance for an F# application. I also needed to use the CoClass for instantiating an INetworkListManager in line 27 as noted here.

Then it was just a matter of adding some icons, for which I used stock images for blocked, warning and OK from the Visual Studio image library to indicate no connection, not yet usable connection and internet available. Finally StackOverflow reminded me about how to add an application icon, to make a shortcut look nicer.

So, without further ado


Later: having slept on it, there's this simplification can be made to the OnLoad method


Later still: when I've hibernated a laptop with this program running, both times now it has come back with the WiFi connection still live, just like it used to under Vista. Even better.

Monday, November 30, 2015

November Cycling

Usual cycling round-up, with the end of the month numbers 12708.7 and 2689.7, for 160.4 + 74.4, + 2.9 off-meter or 234.8 miles total for the month, and 3867 year to date -- as a result of several patches of patches of wet, or more importantly, windy, weather where I wimped out and drove to work. The one frosty morning was actually great cycling.

That leaves 333 miles to hit the 4200 mark, which is now looking touch and go.



Saturday, October 31, 2015

October cycling

Usual cycling round-up, with the end of the month numbers 12548.3, 2615.3 and 6.1 (odo newly fitted to my folding bike), plus 136.2 on another CycleBreaks holiday, for 94.7 + 207.5 + 6.1 + 136.2 off-meter or 444.5 miles total for the month, and 3629 year to date -- so even more than last month despite patches of wet weather where I wimped out and drove to work.

With the weather set to be El Niño mild for the next month, managing the 4200 goal for the year is looking even more achievable (a few bright mornings where I feel inspired to take the long way around to work are all that I need). Have to see whether 4250 or 4300 ought to be the stretch goal.



Wednesday, September 30, 2015

September Cycling

Despite a few wet days, and stubbing a toe badly (fortunately coinciding), it wasn't so bad a month for cycling -- 12453.6 and 2407.8, for 142.8 + 282.8 or 425.6 miles total for the month (way more than August), and 3185 year to date, so on target for 4200 in the year. A number of fine early mornings that were too good not to take the long way around to work helped, compensating for weekends where I didn't manage to get many miles in (and a summer in general without much in the way of long leisure rides).

The long way around to work also has the advantage that there are next to no other cyclists going the same way, except for on the busway from Oakington down, so I don't have to negotiate past people going along at barely more than walking pace on bikes with wheelbarrows for the kids attached, or who come to a stop blocking paths while waiting for pelican crossings; and there's no need for guessing whether the guy in front has tried to indicate or is just a limp-wristed wossname flouncing along.

Tuesday, September 01, 2015

August cycling

Usual cycling round-up, with the end of the month numbers 12310.8 and 2125.0, for 49.3 + 192.4 + 60 off-meter or 301.7 miles total for the month, and 2760 year to date -- so down even more on last month due to generally miserable weather (culminating in typical Bank Holiday weather), and holidays including forced non-cycling days like driving to and from Southport, plus keeping the garden in check in the gaps.

Toshiba Satellite Pro error C1900101-4000D (Windows 10 upgrade fails)

Note: In the months since this post, an official update has now been issued through Windows Update, and would have reached any device with this card in the Anniversary Update, if not before.

After upgrading my wife's older Dell laptop from Win7 to WinX with no problems, I was rather taken aback that my Toshiba Satellite Pro L770 (bought just before Win8 released, to tide me over until the next version after) failed some time around the 80% mark, and rolled back. And more so when the Toshiba site indicated that my laptop was not supported for upgrade, even if the Microsoft scan gave the all OK.

Cutting a long story short, it turns out that it's the WiFi card (Qualcomm Atheros AR9002wb-1ng) which doesn't have a suitably modern driver. Disabling this from the device manager before trying again let the upgrade go through, and a generic WiFi-n low-profile dongle from Maplin which I had to hand "just worked" when I plugged it into a USB socket.

Don't re-enable the Atheros card, as that gets you into a blue-screen/re-boot loop until you can get into safe mode without networking to disable it again.


Later (12-Sep): Uninstalling the Realtek PCIe GBE Family Controller device, then scanning for hardware changes and re-installing it with the latest driver already on the machine (version 9.1.401.2015 dated 4/1/2015) also deleted and reinstalled the Atheros card, leaving it enabled and not crashing the machine (while still using the dongle for WiFi).

Trying to disable or uninstall the Atheros card at this point caused me blue-screens with the same thread exception as before; but at least not immediately on start-up, so I was able to shift-Restart into safe mode, and uninstall it there. On restarting, the "new" hardware was detected, and the old 9.x.x.x driver dated some time in 2010 which previously had been claimed to be the most recent version was replaced by version 10.0.0.270, dated 10/17/2013. This was not such an improvement -- it blue-screened in familiar style when trying to disable the device.

So, once more into safe mode to disable it again, until such a time as a real WinX driver appears, if ever. Yes there is a 10.0.0.308 mentioned on the unofficial Czech site, but the summary list doesn't show any WinX support, so I'm skeptical about it (especially as the device manager update function claims that I already have the latest version).

Sunday, August 16, 2015

"Getting" Functional Programming

We all know there's something to "get" -- but is it one massive "Eureka!" moment, or is it a series of smaller "Aha!" steps? I think that it's the latter, but that most functional languages drop them in your lap in one undigested lump, because I had an odd introduction to the style.

Back around the turn of the century, I encountered the famous Why Functional Programming Matters paper; and while I’m a mathematician by background, that was always in Applied -- crunching differential equations or re-casting multiple integrals as Fourier transforms -- and I simply didn't get it. How could you do anything in your programs if your variables didn't vary? Then after some years, I encountered an article -- no longer on the web, alas -- suggesting that Erlang was well placed to be the "next Java", and my curiosity was piqued.

Some while later, I spotted Joe Armstrong's Programming Erlang on the shelves of the local Borders, so picked it up; and though the syntax and conventions of the language were bizarre and alien -- very "spiky" looking -- the mystery of how you did things with immutables was dispelled in the first couple of chapters. And it was revealed to be quite mundane -- you keep your scopes small (general good practise, anyway) to avoid running out of sensible write-once names, and you recurse or use callbacks rather than iterate.

So, despite its unrelentingly immutable nature (process dictionary aside), it turned out that Erlang had a very low barrier to the program after “Hello world!” Writing non-trivial programs (a few hundred lines of networking code) that accomplished and outperformed what had taken me thousands of lines in ‘C’ was easy. Yes, there were compilation errors along the way, but those were mostly simple syntax (putting the correct punctuation marks at the ends of lines), and I debugged at run-time as usual.

Really, despite the alien syntax and strict immutability, this felt like OO in the abstract -- you send an object process a message, and it responds in a Smalltalk-esque (or even Win32 message loop-alike) fashion. First class functions were just familiar callbacks with a different name, even in cases like a transformative map over a list. Indeed so OO is the paradigm that people talked about implementing Ruby in an "object → process" style on the Erlang VM, and then actually implemented such a near-Ruby.

Then I found out that this F# language was not Fortran.net, but a functional language on the CLR and gave it a whirl. And I felt like an utter dunce who “didn’t get it” for months; not helped by the lack of good introductory material -- like the original Foundations of F# book, which for the newcomer was frankly terrible on account of the volume of assumed knowledge it brought along.

In hindsight, the big shift was between Erlang's dynamic type model, and the static, inferred, typing of F#; the feature that means that a program that compiles will probably also work as well. Unfortunately, that also means that you have in a sense to debug your program at this stage, which is the massively unfamiliar bit. And it's not helped when your program fails to compile with a message that's about as comprehensible as a C++ template failure -- it wasn't until F# for Scientists that I found my Wittgenstein's Ladder, a book that actually explained enough of the the types and type notations, and suddenly made sense of the bizarre arrow-filled compile failures (and API definitions).

Then, and only then, did the list-processing nature of LISP, and Haskell's mysterious monads, all suddenly become things that fall naturally out of the new style of thought. The extra constraint of type exactness is indeed what makes operations like bind to transform types a meaningful and necessary concept rather than being approached ad hoc.

The other shift, related to the debugging at compile time is that, like template metaprograming in C++, suddenly computation can happen as compilation -- a pure function with fixed compile time inputs can in principle be evaluated at that point. And where your program does take inputs, the way of looking at it approaches being an aggregation of functions where input comes in and results come out through a transformative process built of little stateless sub-transformations; rather than as a collection of stateful objects talking to each other about the input.

And at that point, I think what is being practised is functional programming.

Thursday, August 13, 2015

A cycling anniversary

Today concludes my first year logging my journeys on the Cambridgeshire Cycle Challenge website, over which span I've logged 601 journeys covering 4204 miles; supposedly 1372.0 kg CO2 saved (ignoring my increased respiration when burning the 155,532 calories it tells me I have spent doing so) and saving £989.69 on fuel (ignoring the costs of fueling me or running through consumables like chains).

The serious cases are probably all on Strava, because that performance puts me in the top few of those who use the site.

But then it's better to be a big fish in a small pond, than continuously broadcast one's recent whereabouts to the world.

Saturday, August 01, 2015

July cycling

Usual cycling round-up, with the end of the month numbers 12261.5 and 1932.6, for 162.5 + 252.2 or 414.7 miles total for the month, and 2458 year to date -- so down on last month due to generally miserable weather, and having to take advantage of what good weather there was at weekends to keep the garden under control.

Even so, all it took was a run of a few wet days for the caterpillars to devastate the new broccoli plants, some down to the stalks, while I wasn't watching.



Wednesday, July 01, 2015

June Cycling -- On the move II

Usual cycling round-up, with the end of the month numbers 12099.0 and 1680.4, for 148.5 + 310.4 or 458.9 miles total for the month, and 2044 year to date, only just short of a hoped for 2100. And that without doing any particular long excursions.

OTOH, work now having moved to the Science Park, the nicer -- as in less encounters with other road users -- routes to the office are between 1 and 5 miles longer than before, so there's been a systematic increase in my weekly mileage.



Sunday, May 31, 2015

Late May holiday cycling

We took the Bank Holiday week to go down to Netley Waterside again, after a couple of year gap, and for the first time, taking the folding bike I got last spring for holiday purposes, which meant that in just an initial quick ramble I could go further in either direction than the long walks I did back then.


The weather was fine, except for a wet Friday, and generally pleasant to be out in, even if at times through an uneasy balance of sultry heat and strong breezes, as for the expedition to the Sir Harold Hillier Gardens on the Bank Holiday Monday. In fact, the weather usually exceeded expectations set by the forecasts, such that I ended up acquiring more of a tan than I'd expected.

Having forgotten to pack a map, I ended up following the National Cycle Network 2 signs a lot, filling in the gaps by dead reckoning, especially in the places where the paved surface suddenly stopped, but being hemmed in between coast and motorway, that didn't leave too much scope for getting lost -- just scope for somewhat more ups-and-downs than I needed, grinding in bottom gear, as in the sub-optimal routes through the back doubles in Bursledon, and too much main A-road for crossing the Hamble. Next time, having discovered the foot ferry on the last way back, I might be able to cut out much of the main road and hills.

Hovercraft Museum, Lee-on-Solent

Hovercraft Museum, Lee-on-Solent

Also, lacking a map, I didn't realise quite how close I came to running out of road entirely, not realising that Portsmouth Harbour was that close.

D-Day plaque

D-Day plaque at the Rising Sun, Warsash

Many of the pubs I passed on my wanderings were rather sea-sidey, but the Rising Sun at Warsash was a more traditional rural pub, that overcame the handicap of being a Greene King house, and served most excellent sandwiches. Their take on chicken bacon mayo was not the vaguely unpleasant mush by the same name that were offered as packed lunches by the Revitalise team, but a coarsely sliced chicken breast, a couple of rashers, and a pot of mayo to add to taste on doorstops from a fresh soft bloomer loaf -- washed down with a pint of Rsing Sun bitter, an excellent lunch!

On the move I

Usual cycling round-up, with the end of the month numbers 11950.5 and 1370.4, with the belated arrival of the rains eating into my cycling days, for a disappointing 50.4 + 168.2 + 78 off-meter or 296.7 miles total for the month, and 1585 year to date, making 2000 for the half year a stretch.

Also, on Saturday 16th, I put my car past the 11,000 mark, so 1000 miles in 52 weeks, and under 2^10 in the year.