Categories
Uncategorized Weeknotes

Weeknotes 2022-29

Like a lot of people, I spent the beginning of the week hiding indoors with the curtains closed trying to avoid the ridiculous heat (and it was only mid-30s here, so we had it easy). The cats seemed to enjoy being out in it though.

Another race-free week, and despite the weather I managed to get a reasonable mileage in again. A few social runs – running round Paul’s field in lieu of Tuesday’s club session before relaxing in the finally tolerable evening temperature with beer and chilli, a Run for Beer in Felixstowe on Wednesday evening, a Run for Coffee on Friday morning, and another of Justin’s “trolley dash” five mile informal races today – plus a couple of slow solo trail outings (13 miles on Thursday and 17 yesterday, with the latter including parkrun in the middle). My, that was a long sentence.

FRR Social
Run for Beer
Run for Coffee
Trolley Dash

Jane’s just got a retired greyhound, and I offered to dog-sit next week when she (Jane) has to go into the office for a day, in case she (the dog) doesn’t like being left alone. I went round to see them yesterday, to check she (the dog again) didn’t take a dislike to me, but when I arrived she greeted me excitedly like a long-lost friend, and was quite happy just lying around when Jane popped out for a while as an experiment.

Sky
Lying down but pretending to be standing up

I’ve now made my way through all seven series of Buffy. I almost timed it perfectly for the Buffering podcast, which I’ve been listening to in parallel, but having experienced that as a fast-forwarded journey through all the travails of 2016 to the present day, I need to wait for the last five episodes to be released. I guess it’s time for Angel/Angel on Top in the mean time!

I got home today to discover that a large branch on my apple tree had apparently decided to take on a more ground-based role. The number of living branches is slowly reducing – I don’t know how long the tree’s been alive (or how long apple trees generally live) but it looks pretty old.

????
Categories
Uncategorized

Weeknotes 2022-19

I started to get a sore throat at the beginning of the week, followed by a cough, and wondered whether I’d finally ended my run of escaping the novel coronavirus. It seems it was probably just the boring old fashioned kind of coronavirus though, which has now progressed through streaming nose to more coughing (and if we’re back to traditional colds, will probably result in a lingering cough until I catch the next one). At least thanks to JP, I had a new word for it.

On Thursday a few of us went to help finish the leftover beer from the weekend’s party, and sat in the garden with a takeaway curry. Nice that the weather’s starting to make outdoor gathering pleasant again – despite a couple of negative LFTs I’m not sure I’d have been popular turning up for an indoor do with a cough.

We’re supposed to start going into the office for a day or two a week again now (and I was due to go in on Thursday to help someone out with an interview), but I excused myself on the basis of germs. Should probably make an effort and go in soon, but it was very noticeable that when I got up at “going into the office” time then decided not to, I was able to start work a good hour or so early.

More racing at the weekend, with the confusingly-named Twilight 5k taking place on the waterfront on Saturday afternoon. This race was the scene of my PB in 2019, with a time that should have put me in the sub-20 wave, but as I appear to have slowed down a bit while waiting for it to finally take place again I estimated my time at 21 minutes which put me in the middle wave again. As it turned out I managed 21:28, which I’m happy enough with given I was still full of cold (and the weather was very much not cold). The local venue also lent itself to hitting the pub afterwards and walking home at closing time. Because we’re all proper athletes and stuff.

The number of half a beast

Today Jane came round to take some photos of her Mini 40, which has been sitting in my carport since she moved out in 2015 (and for several years prior to that), and which she’s finally thinking of selling. The plan was to shuffle the other cars around a bit and push it out, but it turned out that after pumping all the tyres up my 1275GT was the only one whose brakes were free enough to actually move anywhere. I did take the opportunity to wash off most of the moss that had been taking it over, so it looks properly yellow again. Also discovered a whole stash of mysteriously missing CDs in Jane’s mini, that must have been there for 13 years or so. I think one of them is still in the stereo though – hopefully the security code to switch it on is written down somewhere!

Categories
Uncategorized Weeknotes

Weeknotes 2022-12

Well I still haven’t caught Covid, as far as I know. Despite spending time sitting next to someone in a pub last week who tested positive the next day, then spending ten minutes talking to someone before the Stowmarket Half on Sunday, who was moaning about his cold that “definitely wasn’t Covid”, which it turned out was just an opinion, which the test he belatedly took when he went home disagreed with.

I went to see New Model Army in Bury St Edmunds (an incongruous combination perhaps) on Tuesday, and wore a mask while I was there, partly just in case the LFT I took that day was a false negative, and partly because statistically there must have been a fair few infected people there. This seemed an unpopular point of view though, as I only saw a couple of other mask wearers there. It kind of feels like everyone’s decided to just give up and catch it anyway, but I’d rather avoid it as long as I can on the basis that even if it’s mild most people I know haven’t enjoyed it, and it would almost certainly mess up my running for a while (especially if I ended up with “long Covid”, which is my main worry).

Anyway, NMA were good, even if the crowd was slightly sparse and a bit less boisterous than usual (I started listening to them in the early 90s, but tales of insane mosh pits had put me off seeing them live until a few years ago, when it turned out to be fine, although possibly because we’ve all got old in the meantime).

On Wednesday morning one of the cats proudly came in through the cat flap with a mouse dangling from his mouth by its tail. He released it, and it immediately ran behind the fridge, where as far as I could tell it stayed until Thursday night, when I was woken up by the sounds of it being chased round the lounge. This time I managed to grab it and put it out of the front door, hoping they wouldn’t figure out where it had gone in time to track it down. I got woken again on Saturday night by one of the other cats growling in the bedroom, with either another mouse or the same very unlucky one. Either way, I caught it and put it outside again, and hopefully it’s either learned its lesson or been quietly finished off outside.

At work, the monitoring system I’ve built and supported pretty much solo over the past three years is apparently on the point of being considered one of EE’s core network management tools. I can’t help thinking they’re getting it pretty cheap for my salary compared to some of the other big ol’ enterprisey systems it’s sitting alongside. We went to the pub on Friday to celebrate yet another person leaving the company for a sizeable pay rise and a mostly-remote job, and amongst the people there from our long-standing Friday Pub crew, those of us still with BT were in the minority. Who knows, after 30 years maybe it’s not too late for me to look elsewhere! Or at least threaten to, and see if they offer me anything to stay.

I decided that the reason I still haven’t managed to ride my unicycle is that I stupidly bought one with a 24″ wheel, not realising that they’re harder to ride. Obviously the solution to that was to buy a cheap 20″ one too, and it arrived on Saturday.

So now I can’t ride two unicycles. Although it feels like I’m a bit closer to getting somewhere with this one.

I’ve got Monday and Tuesday off, so hopefully I’ll escape any of those annoying biannual failing tests after the clock change. Fingers crossed for a similar lack of production issues.

Categories
Uncategorized Weeknotes

Weeknotes 2022-11

With a slight sense of trepidation I went to fill up my car with petrol for the first time this year. It turned out it wasn’t actually much more expensive, but that might have been partly due to going to Sainsbury’s instead of my local BP. Anyway, on balance I’m all for higher fuel prices if they give the human race a few extra years before the seemingly inevitable climate apocalypse.

Another plumbing success story this week. Having tried seemingly everything to sort out the blocked drain from the kitchen sink, I finally twigged that the gunked-up bit of pipe was the short section between the plughole and the U-bend. Obviously having realised that, it was pretty trivial to clean it out, and now the water runs away at a more traditional speed. There’s a lesson in there about stopping to properly diagnose a problem before diving in headfirst to solve it.

The monthly Run for Beer came round again on Wednesday, and once again the weather was far nicer than everyone else’s dire predictions. We only stopped in the pub long enough for a bit of food and one pint, although I managed to fit in two (pints, not meals) after only realising after having one bought for me that they had a Burger-and-beer meal deal going. Well it would have been a shame not to take advantage to save money by … er … spending slightly more money.

It was also the Stowmarket Half on Sunday, which went OK-ish but not spectacularly. The weather was great – a bit warm if anything, but less wind than of late, but the last few miles were a struggle. Last time the event was held we were in that weird couple of weeks in 2020 where everything was still just about happening as normal but we all new it was about to come to a grinding halt for what we assumed would be a few weeks. It’s nice to feel like things are relatively normal again, albeit with infection levels some 5,000 times higher than they were two years ago. It was also nice to get a negative LFT result this morning, after the person I’d been sitting next to in the pub came down with Covid the following day.

The correct connectors for the weather sensors finally arrived, and although I haven’t made any actual progress as such I did at least confirm that the code I’d already written to interface with the anemometer works as expected. Just need to sort out the wind vane and rain sensor now, then come the no doubt long-running tasks of moving the electronics from a breadboard to a more permanent form, getting it all mounted outside (fortunately I have a handy bracket where the TV aerial used to be) and adding a web UI or whatever other kind of display I can come up with.

Somewhat against character, I actually washed the outside of the downstairs windows (well it’s a start) at the weekend. Partly triggered by the Sahara desert sand that was raining down recently, although to be honest it’s so long since I cleaned them that the sand didn’t make that much difference. A even gave the car a quick going over too, after I’d left it out overnight and one of the cats had left muddy paw prints all over it.

Categories
Uncategorized Weeknotes

Weeknotes 2022-10

Well, apparently I’ve made it to the tenth instalment of my weeknotes experiment. Today also marks two years since my last day working in the office, before everything went a bit weird. I’ve been back briefly a couple of times since, but – at least in theory – I should be starting to go in for three days a week soon. I was always a big fan of colocated teams, but if I’m honest I think now I’d prefer to stay here like a hermit, only going in when there’s a specific reason for it to make sense. On the plus side, at least it would start pushing my cycling mileage back up a bit: that’s dropped from around 2,600 miles a year down to about 600.

I’ve started playing around with building a weather station using a Raspberry Pi Zero W and Nerves (the Elixir embedded platform), after the sensors I ordered from AliExpress arrived (postage from China almost doubled the price, but was still cheaper than buying them from a UK supplier). I put together a first stab at reading the anemometer, but was thwarted by the so-called RJ11 sockets I ordered from Amazon turning out not to actually be RJ11, but actually some other standard that’s even narrower. I also ordered a humidity/pressure/temperature sensor, which I now have wired in and working.

Please excuse the horribly bodged double header on the Pi, which I did in a rush to prototype a previous project when I only had male–male jumper cables

PragProg do actually have a book specifically about building a weather station using Nerves, but I thought it would be more fun not to buy that (it sometimes feels like that’s one of the few books in their catalogue I don’t have) and muddle through on my own. Maybe when (if) I finish it I’ll get the book and compare our approaches.

My ankle/tendon still seems to be on the mend, fortunately. Sunday was the final event in the Suffolk Winter League cross country series, which was actually in Norfolk. A long way to go for a fairly unexceptional course round some fields (although there were some cool rare breed pigs on the farm). I managed to keep up with Robin, who’s generally much faster than me, and finished right behind him, but that was pretty much entirely down to him having a slow day rather than anything exceptional on my part. That also took me over the 400 mile mark for the year (much more than on the bike!), so I’m still on track to repeat my “run the number of miles in the year” challenge from two years ago. I might not be quite so pedantic about it this time as I was then, when I finished on New Year’s Eve with a total of exactly 2020.0 miles.

My fridge has decided to repay the effort I put into defrosting it last week by suddenly refusing to dispense chilled water (or any water – I suppose for a fridge, chilled is the easy part), which I realise is the very definition of a first world problem, especially with everything going on at the moment. It’s weird how much nicer fridge water tastes than it does from the tap, even unfiltered. In other domestic news I actually looked at my gas & electricity bill this month, which was a bit of a shock and prompted me to reduce the times the heating’s on (one disadvantage of working at home). It’s probably also a hint to think about replacing my boiler and improving the house insulation. Annoyingly, it doesn’t feel like there’s a feasible alternative to gas yet, but at the same time I suspect a new gas boiler now would become obsolete before serving out its natural life. I suppose once WW3 kicks off properly it won’t really matter either way.

Categories
Uncategorized

Weeknotes 2022-09

You know what would be nice? To have a year or two when it’s possible to visit a news site without a solid screenful or two at the top of the front page being devoted to the same depressing and/or terrifying story. Although I suppose that would probably just mean we’d gone back to ignoring the climate crisis and marching, eyes wide open, toward the likely near-extinction of our species.

Anyway.

Another minor DIY success this week, after realising that the lack of isolating valves in the pipes to the utility room sink wasn’t an issue as I could just turn the hot water off at the boiler outlet. Once I’d done that, it was the work of minutes to replace and reseat the washer in the hot tap that had been dripping for years (despite being turned off so hard that it was effectively put out of use). I now have working hot taps everywhere but the kitchen, where I still have to turn it on under the sink every time I want to wash up.

I also got round to the annualish mammoth freezer defrosting session. Annoyingly for an expensive and supposedly frost-free fridge-freezer, it’s always slowly filled itself with ice. Not in the food compartments, but starting with the elements behind the inner back panel, and slowly expanding until the drawers are frozen in place and the panel starts to bulge out. Clearing it basically requires a couple of hours blasting it with a steam jet from a wallpaper stripper, which is tedious to say the least. This time I also poked a pipe cleaner down the drain hole to make sure it was clear – if that fixes it permanently, I’ll be simultaneously pleased and livid (and very surprised, to be honest). It’s over ten years old now, so I suppose it wouldn’t be unreasonable to replace it, but it seems a shame when in other respects it still works perfectly well (the milk is cold, the food stays fresh, and even the light works when you open the door).

Reduced running mileage this week, in the aftermath of the Tarpley 20. I seem to have developed a minor case of tibialis anterior tendinopathy (a purely Google-based diagnosis, I should add), which I’m sure a bit of rest and some frozen peas will soon sort out. With nothing in the calendar for Sunday I did give parkrun a decent effort though, and despite a lot of mud I somehow managed a course PB and ninth place (my first ever single-digit finish token). That was mostly thanks to a lot of the usual speedy people not turning up of course, but I’ll take it.

Apparently Saturday was the 40th anniversary of John Belushi’s untimely death, so I took that as an excuse to rewatch The Blues Brothers. I think it’s probably the film I’ve seen the most times, starting with a late night showing at the Southampton Odeon in around 1988. The DVD I have came as a double bill with The Blues Brothers 2000, but I’ve never been able to bring myself to watch that. I guess I probably should, in case it turns out to be less terrible than I fear.

It’s finally starting to feel like Spring isn’t too far away, with the first flowers coming out on my Magnolia. I’m sure I’ll be complaining about the heat before we know it.

Categories
Software Uncategorized

The value of spiking: a cautionary tale

A while ago I built a little web app using the Strava API, that tells you how far you’ve run so far this year, and how many miles you’re projected to do my the end of the year if you keep up the same average.

As Strava lets you see your friends’ year-to-date mileage on their profile pages, I thought it would be a nice addition to generate a leaderboard to show where you stood against your running friends. The URI to query an athlete’s stats is https://www.strava.com/api/v3/athletes/:id/stats, which I’m already using to get the stats for the person using my app, so all I have to do is query that person’s friends list and map over all the IDs calling the same API with their IDs, right?

First things first, mock up the UI for the new page. After a bit of wrestling with Bootstrap I had some navigation elements I was happy with, so moved onto the core app. It turned out that the Strava library I’m using didn’t have a wrapper for the friends/followers API, but it was pretty easy to add one, so I made the required changes and submitted a pull request. Then a nice test-driven feature from the outside of the app, stubbing the boundary to the function that retrieved the stats for each friend, as that was already there for the current user and didn’t need to be changed. A data structure specifically to hold the friend’s name, profile URL and mileage to display in the table, and a public function to return a list of those structs, and the core was all done.

Finally I put it all together, wired the controller in the web app up to the core function to make the required query, and modified the view to display each friend’s details in a row in the leaderboard. Tests all green! Finally! Let’s try it out!

500 internal server error

Wait, that’s not supposed to happen. Lets look at the logs. Hmm, the call to the Strava API seems to be failing. Unauthorised. That’s odd.

Better take another look at the API documentation.

Totals and stats

Returns recent (last 4 weeks), year to date and all time stats for a given athlete. Only available for the authenticated athlete. This is the recommended endpoint when polling for athlete upload events.

Wait, what’s that bit in the middle again? “Only available for the authenticated athlete”. Oh. Realisation dawns. No leaderboard then, and a couple of days’ work wasted on a branch that’s never going to make it into master.

So what’s the moral of the story? If you’re building a feature that relies on something outside your control, don’t make assumptions about what works and what doesn’t. Build a spike first, to test your assumptions before ploughing your time into building the real thing.

Oh, and read the documentation.

Categories
Uncategorized

TDD example with Rails, Cucumber and RSpec

In the unlikely event that anyone wants to scroll through the whole history of the TDD demo Rails app I did the other day, I wrote a little script to munge it all into one page. And here it is.

Categories
Uncategorized

Commenting broken

Commenting seems to be broken on this blog since I upgraded WordPress. Not sure why yet, but I’m working on it.

[Update] It’s working again now.

Categories
Ruby Uncategorized

Comments aren’t always evil

I tend to agree that comments are, in most cases, evil (or at least mildly malevolent), but I did come across one of the exceptions to the rule today.

While doing a bit of drive-by refactoring while fixing a bug, I reflexively changed this line:

unless instance_response.nil?

to this:

if instance_response

Then reading the comment above the line, expecting to delete it, it all came flooding back:

# Use instance_response.nil? to check if the HTTParty
# response's inner hash is empty.
# If you use 'if instance_response', it is always true.

Now you could maybe argue that this unexpected behaviour is because httparty uses just a little too much of that old method missing proxy magic (which of course isn’t really magic at all), but that’s not the point of this post.

In the end I pulled it out into a private method to make it clearer what was going on, but decided to leave the comment in.

def self.instance_returned? instance_response
  # Use instance_response.nil? to check if the HTTParty
  # response's inner hash is empty.
  # If you use 'if instance_response', it is always true.
  !instance_response.nil?
end