Kickstarting Hull's Smart City

Paul Foster taking networks. 

Well, that was fun. And exhausting. We did two Smart City events in one day. The morning event was all about getting people together to build a network, and the afternoon was all about the tech of LoRa. 

Both events had awesome attendance, lots of sensible discussion, and we even managed to fit in a bit of planning. As far as I'm concerned, the outcomes are:

  • We are going to get Lora gateways to cover the area as a first step towards building the Smart City infrastructure. There are already some commercial/proprietary LoRa gateways opening up in the region which would be a fantastic platform for industry strength applications, but from a community perspective an open one based on The Things Network would make a very good start. If you're not sure what LoRa is, read the attached slide deck....
  • We are going to start up a community effort building LoRa network devices. Lots of people seem quite keen on this. Once we've got the bits together we'll set up a happy afternoon where we'll build some network endpoints and get them going. Then we can start looking at using the devices to solve problems. 
  • We are going to set up a "Smart City Steering Group" to get all the interested parties together, share what we are all doing and try to put together a strategy that will start with LoRa and move on to consider other technologies including how to make some of the data gathered into open data. 

If you want to see my slides, which tell you all about LoRa, you can find them here.

I'm really excited about this. I think it could be the start of something not small. If you didn't make the events, but you want to get involved, feel free to contact me directly (put a comment on this post or message me via Twitter or email me or stand on a corner and shout loudly). 

"The Expanse" is rather good

The Expanse is a great big lump of space opera that must have cost a fortune to produce. (I tried to work in an "The Expense" gag here, but I couldn't make it work. Oh well.)

The spaceships are some of the best I've ever seen on TV and the narrative is rattling along at a furious pace. Set all around the solar system, a few hundred years into the future,  it has earthers, martians and belters (folks from the asteroid belt) at the brink  of interplanetary war.

There's political chicanery, space battles and some rather unsavoury extra-terrestrial stuff oozing around the place. Some bits of the plot seem to get a massive build-up and then disappear, but there's more than enough going on to keep you occupied now that Star Trek Discovery has finished its run.

c4di Hardware Group Monster Meetup

Actually we didn't have any monsters turn up. But we did have a lot of people. Hayden was running a soldering masterclass. I was talking about Hull Pixelbots to a whole bunch of students who turned up to find out what we're about. Brian showed off a work in progress which simulates Hull Pixelbot movements in a nifty Python program. And we did some work with one of our youngest attendees, who's trying to make a remote controlled missile launcher (but only a small one).

We were playing with these super-cheap wireless devices. Connect a transmitter to an output pin on an Arduino, wiggle the pin up and down, and the receiver will wiggle an output up and down at the same time. So you can send messages wirelessly from one Arduino to another.

In the past I've not had much success with these, but we tried the RadioHead library and it seems to work rather well, We're going to look into adding a carefully crafted antenna to try and improve the range. And have a look at other wireless options too. 

It was great fun. If you fancy coming along,  the next one is on the 1st of March starting at 6:00 in c4di. 

"The Culture" is really good

You've got to be pretty sure of yourself to allow someone to write a farce about what you're doing. Or brave. Or something. But the Hull City of Culture team did it. "The Culture" is a behind the scenes look at just what goes on in the offices behind those fancy slogans and artistic happenings. There are some lovely nods to the buzzwords and whatnot that come with organising something like Hull City of Culture, but all credit to the team for letting it all happen. And hats off to Martin Green, the head honcho of City of Culture, who actually turned up to take part in the performance that we saw. 

 "The Culture" is a proper farce. Double meanings, mistaken identity, hiding in cupboards, bawdy bits, the lot. It also has a genuine, beating heart at the centre. The cast do a great job of bringing the play to life. Their energy never flagged from start to end. And it wasn't until right at the end, when I wondered where some of the actors had got to for the curtain call, that I worked out just how many roles each cast member played. 

I'm not sure if you'll be able to get tickets to see it before it finishes its run, but if you can, I think you'll have a really good time.

Dear Visual Studio People....

...when I try to edit a program that is running (something which I do rather a lot these days - I think it's because I'm getting old) I get this "helpful" message.

It would be even more helpful if the dialog contained another button I could press to stop the application and return me to the code that I'm trying to edit. 

Update

It turns out that this has already been requested on UserVoice. If you go here you can upvote it. Please do. I'd love to see the feature.

Kickstart Hull's Smart City - free event Wed. 21st Feb

On 21st of February we'll be Kickstarting Hull's Smart City at the c4di. You're invited. You're especially invited if you're a developer wanting to get into city wide networking, a student looking for a new field to get your teeth into or someone who wants to do some good with technology. 

We'll be describing our plans for building a community to work with the latest low powered networking technology and use it to build solutions for local people. It's going to be great fun. 

The event is free, we'll have lots of expertise and maybe even biscuits. You can sign up here

An expert in PLINQ for a day

One of the nice things about writing a book is that you become an expert on a subject (albeit in my case, just for a very short time). At the moment I know exactly how to make different parts of a Parallel Language Integrated Query (PLINQ) expression sequential so that the order of the output set is the one that you want. 

Not many people can say this.  (Oh, and PLINQ is a very neat technology by the way). 

Arduino Retro Computer

Derek put me onto this. It's a retro computer made from two Arduino devices, one of which generates VGA output. Many years ago I discovered that people were using PIC devices to produce video output, this does something similar with an Arduino to generate VGA video. It uses a tiny interpreted basic that is not a million miles away from my HullOS software, although the Basic implementation uses a lot more gotos....

Using the StopWatch class properly

Most people don't really care about the speed that their programs run at. Unless they run too slow of course. 

However, if really do want to know timings, C# provides a rather useful StopWatch class in the System.Diagnostics namespace that you can use to measure the time it takes your program to do something. You use it like this:

Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
// Do something that takes a while
stopwatch.Stop();
Console.Error.WriteLine("It took: " + stopwatch.ElapsedMilliseconds);

It is especially useful if you're trying to re-write a program so that it uses parallel processing, and you want to find out how long things take to complete. Parallel programming is where your code makes use of all the processors in your computer, not just one of them. It should be faster. 

I'm writing some stuff about parallel features in C# at the moment. For a book that I might have mentioned. So I wrote two versions of the code and then discovered, to my dismay, that the one I'd carefully optimised actually seemed to run slower than the original. I know that for small data sets a parallel solution might not be worth the effort of setting up all the parallel gubbins, and I also know that if there are any shared variables that the parallel code ends up fighting over, this can impact on speed, but whatever I did, the parallel version always took at least as long as the original. Wah. Took me a little while to find the mistake. Here's my code:

Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
// Do single threaded version
stopwatch.Stop();
Console.Error.WriteLine("It took: " + stopwatch.ElapsedMilliseconds);
stopwatch.Start();
// Do parallel version
stopwatch.Stop();
Console.Error.WriteLine("It took: " + stopwatch.ElapsedMilliseconds);

The parallel version always, always takes longer than the serial version. Have you found the mistake yet?

Turns out that stopping and starting a stopwatch doesn't reset it. So the time for the parallel version is added onto the time for the original. And I'm an idiot. The method: 

stopwatch.Restart();

- resets the stopwatch and starts it, so that my second operation is timed correctly. I'm now getting sensible speedups, which is nice...

I'm writing a new book

Last year I wrote a book about Python. This year I'm doing another about C#. It's an exam text for the 70-483 Programming in C# Microsoft Certified Professional exam. 

The Amazon site says, rather optimistically, that the book will be in the shops at the end of April this year. I'm fairly sure that it will be a little bit later than that.

But it will be well worth waiting for.