Robots at Future Decoded

Click through for the full 360 degree experiences....

Like they used to say in "The A-Team", I love it when a plan comes together. In this case the plan was to get on a train, travel to London, do a session at the TechDays Online part of Future Decoded and then get the train back in time for tea. 

The plan worked. The journey there was smooth and on-time. All the demos that I did worked perfectly, in spite (or perhaps because of) the fact that I was using my phone as an internet hotspot for the robots. And we finished in time, which is very important. 

Thanks to Martin for MC'ing the session and providing a voice of reason. And thanks to Claire for inviting me. The videos will eventually be online here. If you want more details you can find the presentation slide deck here

mDNS Manager for Windows 10 IoT Universal Apps

You know how it is. You have built a robot army that you're going to use to take over the world, but first you have to get them all under your control. And if you are using tcp/ip (the world domination network of choice) then you have to give them all an ip address and then put those addresses into your world domination program.

mDNS makes this much easier. It's how Apple's Bonjour network discovery works. A device running mDNS is discoverable on a local network. You can find all the hosts and their ip addresses, along with the services they are providing and the ports. Windows 10 provides a Watcher service that you can use to discover all the machines on a local network, but it is a bit of a pain to use.

So I've written a tiny mDNSManager class that you can use to create and manage a watcher object which will start a search for devices, tell you when it finds one and also present a list of all the devices it has found so far. It's very easy to use. 

You can find the source code for both the manager and a simple demonstration application on GitHub here

If you want to just use the manager in your programs you can install it from NuGet:

Install-Package RobMiles.mDNSManager 

It works on any Windows 10 device, including the Raspberry Pi, and it makes it much easier to connect to a large number of devices. There are mDNS samples available in the example applications for the ESP8266 devices in the Arduino IDE.

I'm using this to allow me to create a Universal Application that will control a bunch of HullPixelbot devices without needing to know their ip addresses in advance. 

Broken Wire Bonding

Thanks to number one son for the picture

Nothing like a bit of father/son bonding over a soldering iron (in my case not  a very good iron). 

Number one son drove up to see us this weekend and on the journey discovered that the remote lock for his car tailgate didn't work any more. A quick search of the interwebs suggested that the cause might be a broken wire. Indeed. And it turns out that the rear wiper on our car had broken for what was probably the same reason. 

So, what with it being a nice day and all, we went outside and peeled back a couple of rubber boots. As it were. Turns out we were both right. In my case doubly so as two wires had snapped. So we passed the soldering iron back and forth rather like a pipe of peace as we made good the damage. 

I find it really surprising that the wire can fail like this, and that car manufacturers are happy for it to happen. After all, we haven't actually spent days on end opening and closing the tailgates of our cars, these have broken after fairly light use. Oh well, as long as they last through the warranty, I guess that is what counts here....

C# Yellow Book 2016 "Cheese Edition" Now Available

The latest release (or is that escape) of the C# Yellow Book is now available for download. No massive changes to the text, but a few tweaks and corrections here and there. And cheese. 

You can download it (along with sample code and whatnot) from here.

The Kindle version will be updated soon. I'm just grappling with adding an index. (why does making Kindle books have to be so hard?)

 

And, while we are on the subject of books what I wrote, you can now buy printed (or Kindle) copies of my lovely new "Begin to Code with C#", which was published a few weeks ago.

It's a great introduction to programming (said the author) and gets you creating useful and fun applications and games using my magical Snaps framework. 

Superhero Science at Salford - Day 2

Click through the image for the full panorama

Day 2 was when we had to deliver all our words. I managed to get up to exactly 5,000 (including my name though). Just about everyone else hit their targets too, so we really have written a book in a weekend. Now the hard work begins, with the editing and whatnot. 

But I'm not going to be doing that bit. 

Thanks to Mark for organising the event and the Royal Society of Chemistry for providing such sterling support. And thanks to all my fellow authors for being such splendid company. 

You see the event as it was tweeted here

And Mark, if you ever want another quick fire text, I'll be there..

Superhero Science at Salford - Day 1

..this is where the trams were hiding...

What better way to spend a weekend than to try and write 5,000 words about superhero science?

At least, that's what I think. 

So it was up at 6:00 am to catch the early train to Manchester and the Salford Science Jam. I was slightly surprised to find that the trams had been switched off to celebrate my arrival, but thanks to the power of the replacement bus I was only a few minutes late arriving at the Salford campus at Media City Manchester. 

Media City is really nice. And the weather was really kind. The program that sold me my tickets sent me a nice email the night before departure advising me to take an umbrella. I'd already packed one (after all, it is Manchester) but all I saw was sunshine and nice skies.

Of course, once I got set up I spent most of my time staring at a word processor screen. Mark Lorch, the twisted genius (I don't think he'll mind me calling him that) behind the whole thing gave us our marching orders and turned us loose. 

There was a spread of expertise in the room, from people pondering on the science of invisibility, to superhero breakfasts, how to make shield like Captain America has, what happens when you turn into a Hulk and why his trousers don't fall off. Me, I was writing about rogue AI and world domination. As you do. You can keep up with our antics here

We wrote until we ran out of words for the day and then headed for tea. Then I went up to the hotel room and wrote some more. 

I don't know about everyone else, but I'm having a splendid time. 

Eleven: Table Tennis VR is Awesome

It's like having abasement with a table tennis table in it

I have few illusions about my sporting ability. I was always picked last, and unwillingly, for team games. And I tended to try to make up with enthusiasm what I lacked in technique. And as a result I spent a lot of my sporting time searching for the ball that I just hit. 

Except for table tennis. 

I allowed myself to think I was quite good at table tennis. I even bought a table to play on. It's in the garage. It turns out that having a table to play on is one thing, but having a room big enough to play in is something else. And it's surprising how even a little bit of wind can ruin an outdoor game. Not to mention rain.

Eleven: Table Tennis VR is a table tennis game for the HTC Vive. And it is very, very good. It only costs seven pounds or so, and at that price it is exceptional value. It takes a tiny bit of getting used to, but not much. The most important thing for me was the realisation that I had to hold the "bat" control side on, which felt rather strange. But with that tiny proviso it gives you a very authentic game of table tennis.

When I play table tennis properly I can usually tell if the shot I've just played is any good before it goes over the net. If I hook the shot, or apply so much spin that the ball is going to hit my side of the table first, I get a sinking filling and then have to watch the shot play out in front of me. I get the same feeling playing this game. 

It's really very simple. If you have an HTC Vive you should buy this. Practice a while.. And then call me up for a game. With a bit of luck I might even beat you.

Hardware fun at C4DI

I could tell you what this is, but then I'd have to kill you....

We had another great hardware meetup at c4di this week. Some new folks who turned up to see what all the fuss was about, quite a few HullPixelbot devices wandering around and some very enjoyable technical chats about this and that. 

The next meeting is at the start of November. You can find all the Hardware Group meetings, along with other c4di meetups, here:

http://www.meetup.com/Hull-Digital-Hull-Open-Coffee/

Programming and DIY

I'm not very good at DIY. But I'm the cheapest labour I know, and so I've had a fair bit of practice over the years. As I was laying down each of the strips of flooring yesterday I got to thinking about how the experience of my decorating efforts maps onto writing code. I think there are some parallels here. 

When I started doing DIY I'd measure everything and then cut to precisely the dimensions that I had measured. Then I'd find that none of the corners in the room were square and that lots of my carefully measured items were the wrong size. I'd also find that, because I'd sometimes misinterpreted the numbers from my careful measurements, I'd make things the wrong size anyway. Unhappy times. 

Nowadays I don't measure anything. I hold up the next piece of flooring against the hole that I'm filling at that time, mark it off and then cut it directly. If the size of the room changes as I move down it (and it does) then my process will automatically take this into consideration. And because I don't write things down there's no chance of any errors creeping in.

You can have exactly the same experience when you write software. If you establish the specification at the start and then just build the thing you can be pretty much sure that it will be wrong. Much better to make something, play with it, and then build on top of that. By iterating and refining as you go you'll end up with a much better product. 

Oh, and one other thing I do is work "with" the job rather than against it. If I cut a piece of flooring a couple of millimetres too small there'll be a tiny gap that hardly anyone will see and nobody will care about. If I cut the flooring two millimetres too big it won't fit, which is much more of a problem.

In a programming situation you need to find out what things about the project are critical and make sure that you get those things right. It's also useful to know where you have some flexibility in the specification. Remember that there is no such thing as a perfect solution, just ones that make the user happy and ones that don't. 

At the moment (i.e. nothing has fallen off) the results of my job make me quite happy. 

A break in Bristol

I've got the painting finished and the next step is to sort out the laminate I'm fitting in place of carpet. I always new there'd be a floor in the plan....

Anyhoo, bad jokes aside, we've headed to Bristol for a few days of being in a house that doesn't smell strongly of paint. As you do, we went for a walk around town and managed to climb Cabot Tower. It has a tiny spiral staircase to the top which gets quite exciting when you meet someone coming the other way. 

However, the view from the top is worth the tricky climb.  You can click through the picture to see the whole panorama in its glory.

Mending a Pinball Machine with a Toothbrush

I fired up the pinball machine yesterday. First time in a while that I've used it. Everything was fine. Except one thing. The menu button was not working. This is kind of important; it's how you select all the various options to set the machine up. With that broken I'm kind of stuck with the default settings, and I can't set the date and time (which the clock has forgotten because the battery backup has gone flat). 

Oh well, nine times out of ten this means that either the switch is broken or a wire has come loose. Unfortunately, after a few minutes of investigation I discovered that the switch, and the wiring to the CPU board were fine. It got worse when I looked even more closely at the board itself. The batteries, which to be honest are rather stupidly located, had dumped their alkaline contents over the circuitry and left a trail of corrosion and damage. Not good. 

So today (after discovering that replacement bards are available but cost around 150 pounds) I popped the CPU board out and took a look. Step one was to get rid of all the alkaline deposit. I used a toothbrush and some diluted white vinegar to sort that out and then washed the board liberally with isopropyl alcohol to clean things up. 

Then I spent a very happy (and I actually mean this) hour or so tracing the faulty signal from the input pin through the circuit board on its way to the processor. Pro tip: Print out a picture of the pcb so that you can draw the trace on the top, like I did above.

Anyhoo, the signal went past all the dirty bits of the board, so I made ultra sure that they were all squeaky clean and there were no deposits bridging any of the connections. I also used my meter to ensure that all the signal paths were OK. After I'd popped the board back in I fired things up and I had my enter button back. Yay.

I'm going to keep an eye on the batteries from now on. I'm going to play more pinball. And I'm going to get another toothbrush.  

Visual Micro Still Rocks

I bought Visual Micro a while back. Not that I really needed to. The free version is actually plenty powerful enough for day-to-day use. It was just that I thought the product was so good that I really should support it.

For a registration you get a key that works on three machines. I've been through a few machines over the years (as you do) and last week I found that my key didn't work for my desktop. I emailed them, they cleared the key and I'm back in business again. Thanks folks. 

If you are in any way serious about embedded development you should get this tool. The free Arduino SDK is OK for a while, but you'll fairly quickly hit limitations that will grate, and with Visual Micro you get all the lovely intellisense support and general niceness that comes with developing code in Visual Studio.

Visual Micro now works with all the esp devices and pretty much anything Arduino shaped as well. It's got some very interesting debugging support too, but I tend to rely on code instrumentation (print statements) when I'm writing embedded code, so I don't use it very much. Go get it.