Back in Harness

One of the things I really miss about working at the university is standing up in front of people and telling them stuff. I’ve tried it on busses and trains and it just doesn’t work in the same way, what with the shushing and the telling me to sit down and shut up.

But in a week or so I’ll be back at the university for a short run, talking about digital electronics. I’m doing a bit of teaching for the Mechatronics course and I’ll be regaling an enthralled audience with tales of boolean algebra, De Morgan’s Theorem and Karnaugh (first name Maurice) Maps.

I’m going to enjoy it, I’m not sure what the audience will think…..

Buying train tickets is harder than it should be

I hate it when things make me feel stupid. Buying train tickets online seems to be one of these situations. I wanted to buy some tickets to go from from Hull to London on Saturday. My normal approach (use the phone) was thwarted by the error message “Ooops. Something went wrong” when I tried to complete the purchase.

So I headed off to the web. And was met with the above. This is the page for Hull Trains, but lots of companies use the same UI, so I’m not happy with them either.

Questions abound. Why are the prices not shown? What do the buttons on the top actually mean? Why is the page called a Mixing Deck? And what on earth happens when you press the “Lowest fare finder”? Ugh.

After a bunch of experimental clicking and tweaking I finally managed to select the same trains that the phone wouldn’t let me buy. And I was told that there were no tickets available at that price. So “Ooops. Something went wrong” actually means “I’ve told you about some tickets that aren’t actually available".

So, train people, just a word here. When I go to a site to buy some tickets I want a list of journey options with a price next to each one. And I don’t want you to show me journeys that, for marketing reasons, you’ve decided not to sell me any more.

Refactoring Monitair

Fun fact. Users don’t care how their code is factored. They just want their programs to do what they want. All the time. Programmers have a different perspective. They want code that looks nice and is easy to maintain. This means that you often have to revisit decisions made at the start of the project, and change things to make them better.

Real world architects don’t have this luxury. If half way through the construction of a building they find a better structure there is no-way they can reconstruct it. But programmers can. But it is not without its risks. Ages ago I found a Haiku that I rather liked. I think it went something like this:

Your code was ugly
I refactored it for you
It no longer works

Having said that, I’ve just spent a day re-factoring the Monitair software. Because it was ugly. And it seems to still work. Which is nice.

Negotiator Rob

Sometimes I manage to surprise myself. Like today, when I was buying some new tyres for the car:

BMW Sales Person: Names Price
Rob: Names Lower Price
BMW Sales Person: “I’m afraid that would mean we’d have to sell you the tyres at cost price.”
Rob: “Hmm. I can’t see a problem with that”.
BMW Sales Person: “Yes, but that would mean that we would not make any profit on the sale.”
Rob: “Still searching for a problem for me, still not finding one”.
BMW Sales Person: “OK then”.

Now, I realise that “cost price”, is an interesting phrase, and that somehow the garage will be making money on the deal. But at least I didn’t take the first price that was offered. And for me that is a great step forward.

Snaps now on GitHub

A couple of days ago I got an email from James. He’s been working through my “Begin to Code with C#” book and having fun learning C#, which is great to know. He’s even reached the point where he has spotted an improvement to my code. It occurred to me that what he really wants to do is to put the changes into the GitHub repository where the code was stored, so that everyone could benefit from it.

But, rather stupidly, I’ve never put Snaps on GitHub. Well, that’s easy to fix, and so you can now get the latest version of Snaps for download from here:

https://github.com/CrazyRobMiles/snaps

If you don’t know what GitHub is, then you’re missing out. GitHub is a way that you can manage data, whether its a bunch of code or that book you’re writing. GitHub holds the source and also allows you to make incremental changes, all the while keeping track of the differences so that at any point you can go back to a previous version. It also has fantastic facilities for group working, so that several people can work on a single large project and manage the changes that their different work items produce. Until recently you could only use GitHub for free if you were happy to make your creation public. To have a private GitHub repository cost you a monthly subscription. That’s changed now, users can create private GitHub repositories for free, which is awesome. Three words of advice: Get. Into. GitHub.

As for Snaps, that’s a set of language extensions that make it very easy to create Windows Universal Applications. I created it so that people can learn to program without being hit by a lot of extra stuff that you need to know to create modern applications. It has lots and lots of features, including a sprite engine for game creation. It also has all the sample code from the programming book built into it, so you can play with and modify the sample code very easily.

I’m going to message James and suggest that he propose his modifications and we can put them into place as part of the Snaps release. That will also give him something nice to put on his CV.

The Virtues of Virtual Machines

I spent a chunk of today building a brand, shiny, new, Virtual Machine on my PC. Each time I do this I’m impressed by how easy it is.

I want to record some installation videos and I want a clean machine to do that with. Also, it’s wonderful to be able to wind back the machine to pre-install state so that you can have another go.

I had to work quite hard to get the machine to let me create a local user, and not link up to an online account, but it is still possible to do this.

Achievement Unlocked: Sofa Mended

What with today being the start of a new month, I thought I’d do just one of the things I thought I’d get done last month.

I’ve mended the sofa.

This just required a bit of patience, a sharp screwdriver, a big bag of stuffing, and a staple gun.

First step was to take the sofa to pieces and then unstaple the cover from the frame. It turns out that a sofa that looks like it has three separate cushions is nothing of the sort. Once you’ve undone the cover you can just peel it back and take a look at the cushions. In my case it was simply a matter of putting some more stuffing on top of the cushion that was getting a bit tired and then stapling the cover back into position. Although I did also have to replace some of the webbing straps as well, cue for more staples.

If you’ve got a sofa that is going soft, it does seem to work as an approach. And I’ve got a lot of stuffing left over which I’m not sure what to do with. And I don’t want any suggestions….

Fit Family

I’ve started taking keeping fit a bit more seriously. I’m using my Apple watch to track my efforts and I’m trying very hard to make sure that I “close all my rings” each day.

Let me explain. The Apple fitness system (to which I am now a slave) measures three parameters each day: how many times you stand up, how much you move and how much you exercise. You get targets for each of these and during the day a growing arc is displayed that represents your efforts. When the arc closes on itself you’ve “completed a ring” and can go back into couch potato mode.

The stand goal (of 12 stands a day - one per hour) can be a peculiarly tricky one to hit. Too much lazing around early in the day can result in you having to stay up to 11:00 pm at night just so that you can get the final stand in. The watch goes ping at 10 minutes to the hour to tell you to stand up at least once (it’s scarily surprising how often I have to reminded to do this) but if you’re deep in a piece of code you can easily miss that.

Recently other members of the family have linked their Apple fitness regime to mine, so that we can compare our progress. This is going quite well, if only as an instructive lesson on how devious people are at “gaming” a system. One member of the family has adjusted his “move” target to a level where simply getting out of bed and raising one eyebrow will count as a days’ worth of activity. Another has discovered that you can start a workout (and thereby gain exercise credit) at any time, which allows time spent watching athletics on telly can be made to count as keeping fit. And I have perfected a sequence of arm waving that works beautifully in convincing my watch that I’ve stood up and taken a walk.

I guess this means that we are all now “lab rats” dancing to the tune of a faceless corporation.

But at least we’ll be slightly fitter lab rats.

Voice Dictation in Microsoft Word

My lovely Surface Go is running Office 365 on the back of my Office 365 subscription (which I reckon is amazing value by the way). The copy of Word on that machine has recently sprouted a microphone button which allows you dictate directly into a document. I had a play with it, and it works really well.

Well enough to make me want the feature on my main desktop. Getting this to happen was not the easy thing that I expected it to be. I thought that just upgrading Office 2016 on my machine would just work.

But it doesn’t.

You have to use the Install option on your Office 365 subscription page. This might be because the dictation feature uses the cloud to perform the conversion, and only Office 365 users can do that.

Anyhoo, it works well on both of my machines. Even if you try using silly accents….

Sticky Scroll Wheel

If you don’t think that the little wheel on your mouse that lets you scroll up and down is important, just try working on a program without it.

It turns out to be rather difficult

My mouse scroll wheel failed today. So I changed the batteries in the mouse, then I moved the radio receiver closer to the mouse. Neither of these worked.

So I just blew hard on the wheel. Result. I’m reminded of the fun I’ve spent debugging over the last couple of days. And I’m also reminded of a saying that seems to work when programming, mending mice or even (and this is a reference to fun had years ago) fixing water leaks.

The fault is never where you think it is.

Dealing with the impossible

I’ve got a new saying that I quite like. It’s probably not original, but that’s true of a lot of stuff that I do.

If what you are observing is impossible it is either not happening, or not impossible.

I’ve found and fixed my impossible bug. Of course it wasn’t where I thought it was, because if it was, I’d have looked there and mended it. The fault wasn’t even in the code doing the job, it was in the code telling me what the system was doing.

I’d missed a break out of a C switch statement (a frighteningly easy thing to do in that language) so that my reporting code was printing out the wrong messages. Which led me to concoct all kinds of fanciful theories about memory corruption and race conditions - rather than simply checking that what I was being told was happening was actually happening.

The important thing about situations like these is that you change the way that you work to reduce the chances of them happening again. So, in future I’ll make sure that I test all the possible outputs of my diagnostic system.

Peter Principle Programming

There’s a famous management concept called “The Peter Principle” which I’ve always liked. It says that people will get promoted to the level of their incompetence. In other words, if a person is good at their job they get promoted. However, they will eventually reach a point where they are no longer good at their job, promotion will cease, and they will be stuck at that level being incompetent for the rest of their career.

I’m sure it didn’t happen to me.

Anyhoo.. I think that I may be turning into a “Peter Principle Programmer” of late. I’ve managed to create some software that has behaviours that I just don’t understand. I’ve got a bug in my latest version of the Air Quality sensor which is exhibiting behaviour that is just not possible.

Actually, having thought about it properly though, I reckon that lots of people start out in this position. One of the nasty things about learning to code is making something and having no idea what it is doing. The trick when writing code is, for me, always about trying to make it as simple as possible to understand, so that when it goes wrong you have a chance of getting your head around what is happening.

Barclays AI Frenzy Event

I’m doing a tiny session in the Barclays AI Frenzy event in February. I’m going to be showing just how easy it is to make a C# AI enabled app, starting with training data and ending up with a working program. I’m not sure how much frenzy I’m going to bring along, but I’ll do my best.

There are going to be lots of other speakers too, along with a chance to talk to a bunch of like-minded folks.

The event is on the 21st of February starting at 17:30 in the afternoon. You can sign up here.