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.

Rob on Brexit

I’ve been agonising about writing this post for ages. On one hand I don’t want people to think that I’m the kind of person for whom the most important thing is a silly satnav idea, but on the other hand I don’t want to say something and then instantly turn half my readers against me. However I really can’t keep silent on this one. I promise that there will just be this one post, and tomorrow I’ll be back onto the daft stuff. So, here goes.

The biggest thing about Brexit for me is that quite a few people I know, admire and respect think it is a good idea. I start a conversation with them about how horrible the whole thing is and half way through they say something like “I wish we could just leave and have done with it”. Which I think is a very bad idea. I’ve rationalised this in two ways. The first is that there are some things about the EU that are very open to criticism. The second is that the UK press, lazy politicians and civil servants have found the EU a very useful thing to blame when things aren’t as good as they should be. And a lot of this mud has stuck.

I end up just going quiet on the matter, because I don’t think that Brexit is something that you should lose friends over, and I’ve not found a way of talking folks round. And it doesn’t, shouldn’t, mustn’t, make me think any less of them, any more than they should think less of me for wanting to stay in the EU.

One solution would for me to be like the chap at the end of the novel “1984”, when he actually learns to love “Big Brother”, the leader of the tyrannical state in which he is unlucky enough to live. Perhaps if I became a true believer it would would all make sense to me and I’d be happy about it, rather than the despair that I find myself in at the moment.

The way I see it, Brexit is only good for three kinds of people:

  1. The rich. It doesn’t matter to them whether the UK is in the EU, out of the EU or a smoking crater in the ground. They’re rich. They can just take their money somewhere else. But if the price of everything in the UK drops, their millions can go that bit further. And with the UK out of the EU they can bend rules and relax standards to allow them to make even more money. Which brings me to speculators….

  2. Speculators. While it is not legal to bet on a horse and then shoot all the other horses in the race, it seems that is is perfectly OK to place bets on the financial markets and then do things that drive them in the direction you want them to go. And if you are cynical enough to build up your brand at the same time you can make it into the Brexit circus.

  3. Brexit circus. This includes nasty businessmen who drive down the economy whilst profiting from this and building their horrid little brands. It also includes TV pundits who do solemn pieces to camera about “the worst political crisis since the corn laws”, having completely forgotten that their lack of due diligence when all these matters first arose has led directly to the problem. And then there are the social networks which don’t just allow falsehoods to fester, but also provide tools to better target the lies, all the time making profits. Ugh.

Anyone else is going to have to suffer through this whole affair, while the good name of the British is dragged through the mire. I never thought I’d be ashamed to be from this part of the world. I thought that folks out there would always celebrate our honesty, openness and natural tendency to try to do the right thing.

I can’t seen an end to this in the short term. I know that eventually we will be back in the EU at some point because nothing else will be found to work. But there is going to be a lot more pointless pain and upset until then. Oh well. At least I feel a bit better for having written something about it.

I rather like "The Orville"

Every now and then I wish that they still made programs like “Star Trek the Next Generation”. Well, it turns out that they do. Or at least there is one. It’s called “The Orville” and I reckon that it is worth seeking out. I got the entire series one on Apple iTunes for a knock down price and I rate it as good value. The scenario and the hokey nature of the plots are straight from the Captain Jean Luke Picard stable, but they’ve been given a nice contemporary edge with some smart dialog and neat bits of whimsy. And the characters are all essentially nice people who you end up caring about.

If you like your Sci-Fi to include machines that can make a nice cup of tea, and where things are done with good intentions, then you should seek it out.

Music to arrive to

I’ve been thinking about satnav systems and music players and I’ve decided that what would be really wonderful is a system which linked your navigation and your car music system together so that the currently playing track ends just as you turn into your drive at home.

This might be a bit tricky to arrange, but in theory the satnav knows when you’re going to arrive and could tell the music player to pick appropriate length tracks as you approach your destination.

I’m suggesting this because on the rare occasions when it happens to me I think it’s awesome. I’ve even been known to speed up or slow down slightly to make sure that it happens.

Building the Monitair Configuration Interface

I’ve got the web based configuration for the Monitair working quite well now, but it is a bit of a faff to use. You have to connect to the WiFi access point served by the Monitair device and then navigate to the web page it is hosting.

If you have got the device connected to your PC, perhaps to download the software, it would be nice if you could configure the settings via the serial interface. Well, you can now. I’m using the same data source as is used to generate the web page, and I’ve added some useful commands as well. Now you can set any of the values in a device straight after programming it, which is rather nice.

Building the Monitair Configuration Page

The new configuration web page for the Monitair sensor is taking shape. Above you can see the “home page” that the sensor displays during setup. Rather than having one enormous page of settings we now have links to sub-pages which contain different setting categories. The page is generated from a data structure so that it is very easy to add new settings.

These are the simple settings for the device. You can leave everything else at the default values and the sensor will just work on the Connected Humber MQTT broker. The only things you really need are WiFi connection details and the MQTT password. If you happen to know your location details you can put them into the form so that the sensor readings can be displayed on the map. When you click Update the settings are written into EEPROM on the device. You can use the advanced configuration pages to select things like the hardware pins that various peripheral devices are connected to. I’m rather enjoying writing this…

Cottingham Parish Council

After an awesome hardware meetup at c4di tonight Robin and I went on to a meeting of Cottingham Parish Council. We were there to talk about Air Quality, something we are quite passionate about - what with us having done quite a lot of breathing over the years.

As it happened they were discussing an air quality issue just before we were introduced, which gave us a lovely context in which to describe the work of the Connected Humber Group on designing, making and deploying sensors around the area.

Everyone was very interested and I it looks like we’ll be working together in the future on this, which is lovely.