File Comparison in Visual Studio

Today I found out something that I didn't know that Visual Studio could do. It can perform file comparison. This is really useful if you've made a tiny change to a file for a very good reason at the time, but have completely forgotten where the change is, or why you made it. I never do this kind of thing myself you understand, but I've heard that some programmers make this mistake from time to time. 

There are lots of file comparison tools out there of course, along with quite a few plugins, but it's nice to see that Visual Studio can do it right out of the box. 

The only problem is that that finding the function is a bit tricky. You have to use the Command Window (which you open using CTRL+W, followed by A) or by selecting it from the View menu (take a look in the "Other Windows area if you can't find it). 

Once you've got the command window you can type in the command Tools.Difffiles followed by the names of the two files you want to compare. There is some rather neat auto-completion of filenames which makes it a bit easier to navigate to the files that you want, and I love the idea of being able to type three f's in a row in a meaningful context. 

Anyhoo, the comparison window that you get is rather nice, and it works well. 

The Ring Doorbell and WiFi problems

Some time back I got a Ring doorbell. It's an internet connected door chime that contains a camera and motion sensor. When someone rings your doorbell (or stands on your doorstep if you've turned on the motion sensor) your phone (or your Apple watch) goes ping to alert you. 

The doorbell also contains a speaker and a microphone, so you can have a conversation with the person at your door. And for a small sum you can have videos of all your visitors stored in the cloud for later review. 

It works really well. I knew I was onto a winner when number one wife used it to accept delivery of a rug while we were away in Leeds.

Then today, right in the middle of a conference call, I heard someone hammering on the door. I shot downstairs, retrieved the package and started to wonder why my lovely doorbell hadn't told me there was someone on the doorstep. Both it and the sounder in the house had fallen off the network. 

This illustrates a problem with these lovely, connected appliances. They're as good as their connectivity. Wah. So I started digging. And the solution is a bit disturbing. 

My WiFi router has been set to automatically select the quietest WiFi channel. When I reset it on Monday the router had gone and picked channel 13. 

This was a rather stupid choice as far as the Ring doorbell is concerned, as it only supports channels up to number 11. The result was that the doorbell fell off the network. Unfortunately, because nobody had pressed my doorbell (or, at least nobody I'd heard had pressed my doorbell) I had no way of knowing things were broken.

The doorbell "phones home" once a day, and I guess after a while I'd get a message that something was broken, but until then I'd be missing callers.

The rather important moral to this story is that if you have a connected appliance like this, check, your router settings to make sure that it is using a fixed channel in the range 1-11. If you allow the router to pick a channel in the range 1-13 there is a chance that a bunch of your networked devices might suddenly stop working.

Of course once I'd picked a likely channel I then had to boil a jug of water in the microwave oven to make sure that it didn't interfere with WiFi reception in the kitchen. For me it turns out that channel 4 fails when I'm heating things up, but channel 11 works fine. 

HullDevs event next week

The next Hull Devs event is next week on the Wednesday 29th of November at 6:15 at c4di. They have a couple of interesting speakers; Dylan will be talking about Life, Liberty and the Pursuit of APIness: The Secret to Happy Code and Seb Lambla will be talking about ReST 3.0 - A Lap Around HTTP API's Next Generation

There are free goodies and we always finish up in the pub. I'd suggest that you sign up now. You do it here.

In search of "A Map of the Floating City"

I was very sorry when I heard that Microsoft were suspending their Groove music  service and migrating everyone to Spotify. The Groove player is a lovely piece of user interface design that makes everything else look a bit rubbish. And the Groove music catalogue seemed to include quite a few records that I really like. 

Take "A Map of the Floating City" from Thomas Dolby for example. Love it. Listened to it a lot on Groove. Not available on Apple Music. Or Spotify. I can't even find anywhere I can buy the digital download. Amazon have the CD. But it's 45 quid.....

It seems that there are a bunch of tracks and artists that I can't play any more because I'm just too far down "the long tail of musical taste". Perhaps I should get my record deck down from the loft......

Comicon 2017

Ever since happy times spent at the Collectormania events in Milton Keynes many years ago, I've had a hankering for a bit more comic book madness. So today we headed off down the motorway to Comicon 2017 at Birmingham. It was great.

There were lots of people in "cosplay", which I guess is a posh name for "dressing up", but some of the costumes had to be seen to be believed. There were even entire families heading out in character. The atmosphere was great, and I even ran into a bunch of ex- students. At a Comic Book conference? Who'd have thought?

It was great fun, and I'd love to go again next year. There were some really impressive "steam punk" outfits around and I fancy having a go at that.....

Hull Pixelbot 2.0: The future is clear....

I've spent today working on the 3d printed parts for the latest version of the Hull Pixelbot. I'm now using laser cut perspex for the larger parts, which makes the robot look great and should mean that I can start to make kits of parts available for anybody who wants a Hull Pixelbot of their own....

I was hoping that I could just use all the existing 3d printed parts for the rest of the robot, but it hasn't turned out quite like that. I've changed some sizes, and I've now added a speaker underneath the pixel so that the robots can make some noise. 

I've found some tiny speaker units which an Arduino can drive directly. It's not what you'd call HiFi, but it works.  They fit inside the pixel ring on top of the robot, which means that I've not had to increase the size of the robot to add sound. I've also got a mini-breadboard on the front of the robot to make it easier to add your own circuits. 

The design files for the laser cut parts, along with the customised 3d printed elements, will be going on GitHub soon. 

World's Smallest Arduino compatible board at c4di Hardware Group

Did you know that the worlds smallest Arduino compatible device is made in Hull? I didn't until Hayden turned up with one at the hardware group at c4di tonight. He's designed and built a lovely little device. I've played with tiny Arduinos before. They are usually a bit hard to connect to a computer because they lack a proper usb connection and are a bit under-powered when you get them going. 

The device that Hayden has made gives you serious computing power in a device you can hang off any micro-usb cable and program using the standard Arduino SDK. It puts a 48 Mhz  device with 256K of ROM and 32K of RAM onto your fingernail. You can find out more (and buy one for yourself) here. We had it flashing a led, which is probably not really the best use of its power, but it is a start....

It was a great meetup. We had some new folks turn up keen to learn, and some who had brought things to talk about. You can sign up for the next one on Thursday 7th December (and you should) here.

Python output in FreeCAD

This is one of those selfish blog posts I make to remind myself how to do something that I'm bound to forget. 

But, if you're using the FreeCAD designer to run Python programs to design robots (as I am) you might find it useful. If you want to be able to print messages from your program onto the report console in FreeCAD you can the following:

App.Console.PrintMessage('hello from the program\n')

For this to work you have to have the output window options in Preferences set to Redirect internal Python output to the report view, but if you do this works a treat. My design programs can now report on progress, which is nice. 

Incidentally, I've now got a lot of experience creating solid objects from Python code using FreeCAD. If anyone would like me to do a talk on this, let me know and we can sort this out.  

Single Channel Lora

I'm learning more about the Lora network. Lora links tiny, low powered, devices to an application. The devices talk to a Lora "gateway". The idea is that any device can talk to any gateway. Lora networks use different radio channels to pass data, and the node can select any data channel to send any particular message. Nodes usually cycle through the available channels.

A "proper" Lora gateway will listen on 8 channels at the same time. However, my tiny (and cheap) |Lora gateway from Dragino only listens on one channel.  This means that under normal circumstances I only receive one message in 8 on my gateway. Which is a bit of a limitation. 

Fortunately for me there is a way you can restrict a node to only using one channel. I found a forum post here which tells you how to do it. This is not something I'd advise anyone to do, because it is not in the spirit of the way that Lora works by spreading messages round different channels. However, I've made a script (called naughty) which does this, and it works fine. 

The really good news for us is that Hull centre is now served by a proper Lora gateway so if I use my Lora nodes in Hull they just work. 

Achievement Unlocked - got a mini SNES

Last year Nintendo released a miniature version of a game console with a bunch of built in games. And I failed to get one. This year they did the same thing, only this time the console was the awesome Super Nintendo or SNES. And I failed to get one. 

Until now. While I was in Leeds on Saturday I found one at a much smaller price than I was expecting to have to pay, and today I hooked it up to the TV.

It works a treat. There are 20 very solid games inside the tiny box, the picture quality is very good and it really takes me back. If you can get one, it's well worth tracking down. The only downside that I've noticed is that the device doesn't come with a mains power supply, just a micro usb cable that you have to plug into a supply you already have. I used one that is supposed to power a Raspberry Pi and it worked a treat. There are two controllers in the box, which means that you've got two player action right from the start. 

The SNES was based on a fairly low powered 8 bit processor, but it had a really fancy graphics chip (for the time) which had a magical "mode 7" that allowed it to take a flat texture and draw it with perspective. This was great for game playfields and was used  to good effect for the tracks in Super Mariokart. It's interesting to discover that the games are still very playable today. The handling in Mariokart is beautifully balanced and gives you a real feeling of control. 

If you manage to track one of these down I'd strongly advise you to go for it, whether you remember the games or not.

Star Trek Discovery is really, really good

I've liked Star Trek ever since I saw the very first episode on a cranky black and white telly when I was a kid way back in the sixties. For the last few years there's been a "Star Trek" shaped hole in my life that buying the boxed sets hasn't really satisfied. 

I was a bit worried when I heard about the latest incarnation of the franchise, as there were rumours of it being stuck in "development hell" and deadlines for release came and went. 

It turns out they were just working really hard to get things absolutely right. And they have. It is very, very good. A bit darker, with some real moral compromises at its heart, but brilliantly produced and acted, with some cracking story lines.  The first few episodes are mostly OK, with a bunch of Klingon subtitles I could well do without, but by episode 4 it really gets into its stride.

In the UK it's on Netflix, but in the 'states I you have to sign up to a particular CBS streaming service to get to see it. I'm not sure why I'm telling folks this, as if you're into Star Trek you've probably already watched a few episodes and drawn your own conclusions, but if you're late to the party then it's well worth seeking out and seeing. 

Students at c4di

On Wednesday this week we had a bunch of 30 Computer Science students from the University of Hull drop round to have a look at c4di. It was rather nice to see a few familiar faces and to chat about this and that. I was showing off my Pixelbots and one visitor made a rather interesting observation along the lines of "They've not come along much since last year". This is true, mainly because of Begin to Code with Python, which has sucked all the time out of my life for the last few months. 

But, I'm back playing with other things again now, and so expect the Pixelbot pace to pick up in the next few weeks. We've got another "Build a Robot in a Day" planned for December and the laser cut designs are coming along. There are also a few interesting options if we start putting Lora devices on robots. 

It was great see the level of interest that the students were showing. And I think they were rather impressed by the building and the surroundings. What I really want is some form of "Hull based" trajectory for graduates who love the city (who wouldn't) and want to stay in Hull to build a career. I reckon the c4di could play a big part in this.

Quite a few people wanted to find out more about the hardware group. If you fancy coming along you can find out more here

Writing DXF files from Python

I spent a bit of today creating design files for the latest version of the Hull Pixelbot. This version is going to be laser cut from perspex. This should make it much easier to produce large numbers of robots. Of course I'm not using a CAD package to produce the designs. It's a matter of personal pride that the Hull Pixelbot is entirely a software creation, and the designs are actually built by a Python program. 

The 3D printable version of the designs is created by a program running inside the FreeCad drawing program, but for the laser cut version I'm trying something different. I've discovered the ezdxf library that enables you to create dxf files (the ones that can be used to tell the laser cutter what to cut) directly from Python. 

So, after a bit of fiddling around I've got the start of the designs for the top and bottom of the robot.

Properly Broken Device

Last week I wrote about "The Broken Device Dilemma", when something you hardly use breaks. Do you try and fix it, or do you throw it away? Of course, if you're me you try and fix it. It's all about the journey. Right?

Anyhoo, my lovely little Sony audio player failed. The battery refused to accept any charge.  It was as if the cable was broken. Of course, being Sony, it's a special cable, not a standard usb one. The good news is that replacements are very cheap, so I got one. 

It didn't work. 

However, playing with the device left me thinking that the battery was broken. This happens with Lithium Ion batteries. So, it was onto eBay to source a battery. I managed to find one, ordered it and it arrived today. Fitting it was great fun. Number one son found the service manual and I had a happy half hour this evening undoing sticky fixers and soldering the replacement battery in. 

It worked. Yay!

The player woke up and played some music at me. Great stuff. But it did seem to get very warm. And then the WiFi stopped working. And then the battery failed. And now it behaves just like it did at the start of this story. Oh well. It looks like something in the player has failed and is taking so much power that that the charging circuit can't keep up. So I think it is properly broken. 

Oh well. Now I have to ask myself the question "If a device you hardly use breaks, to you replace it?....."

Frogman

Last wee we went to see "Frogman" by Curious Directive. It's an intriguing story told by a combination of theatre and virtual reality. We really wanted to see what the VR stuff looked like, and how it was slotted into the narrative. So off we went.

The answer is that the VR looks pretty good and adds a lot to the experience. The production cleverly avoids the audience having to spend great chunks of time wearing the headsets, and manages the transitions between scenes very well. The one actor in the show does an astonishing job. Tessa Parr plays the part of a scientist studying the Great Barrier Reef who's past comes back to haunt her. And she does it really well.   

I think that one measure of a good story is the amount of discussion it generates on "what was really going on". On that score I reckon that Frogman is a great story. If you get the chance you should go and see this. Absolutely. 

Things Network Frame Counter

I'm getting the hang of Lora networks. And by that I mean "Spending quite a lot of time figuring out why things don't work when they really should".

Today I found out about Frame Counter Checks. Each Lora packet contains a frame counter value. This is set by the node when the packet is sent into the network. The Things Network likes it if the frame counters in packets always get bigger. This makes it slightly more difficult for someone to spoof messages into the network. 

Trouble is, if you're using a very simple node you'll find that the frame counter is reset to zero by the software each time you start the device. Which means that The Things Network will reject packets from the device until it seems a frame counter bigger than the one it's seen so far. 

Unless you know this, you'll spend ages trying to figure out why something that worked yesterday has suddenly failed. 

There's an option for the device settings for your application in the Things Network which turns off Frame Counter checks, which you can see above.

In a proper application you'd either save the frame counter in eeprom each time you've used it, or do something clever with the date and time to generate a frame counter value which is always bigger than the last one. 

Fireworks

We don't usually have fireworks on November the fifth. But this year we did. In the old days we used to buy a box of "Standard" fireworks that contained one dud (which varied from year to year) and a taper thing to light the fireworks that you couldn't actually get lit yourself. The family would spend forty five minutes standing in the garden freezing to death while I tried to light the blue touch paper on a succession of cardboard tubes that I'd stuck in the lawn. Sometimes it would rain.

All the fireworks had different names like "Golden fountain", or "Emerald Shower" but when one eventually lit we'd just just get a shower of sparks followed by nothing. Things were slightly enlivened if the Catherine wheel set fire to fence. And we'd force the kids to hold sparklers which would also fail to light.

Anyhoo, today we didn't do any of that. Instead we bought three little boxes that each contained a bunch of fireworks that were wired together using some cunning fuse technology. We just lit one corner which fizzed merrily and then the box generated a ten second display of quite impressive proportions. I even managed to get some pictures. 

The whole thing was over in about ten minutes and we retired to the warm indoors and had hotdogs. 

Three Thing Game Fun

These are the winners of Three Thing Game November 2017. If you study the picture carefully you'll notice that not one of the people in the picture is me. Oh well.

But quite a few of these folks are First Year students from Hull, which bodes very well for the future of Three Thing Game (and game development in general). They made a lovely sequence of mini-games that chronicled important milestones in the development of Hull. It looked fun to play and had some splendid graphical touches. 

As always, I really enjoyed taking part. My team, as frequently happens,  was probably a bit more ambitious than we should have been, trying to create a networked multi-player game in around six hours. However, we got darned close.

The three things we were asked to base the game around were "Hull", "Culture" and "Change". Our game used the medium of Venn Diagrams (which were invented by John Venn, a mathematician from Hull) to explore Hull Culture. I'm most proud of the moment when the judges asked "Where's the change in your game?" and I replied "It costs fifteen pence to play". 

After that, the discovery that we hadn't won was a real surprise.....