Raspberry Pi Tabletop Development

Spent a most excellent afternoon round at Peter’s working on the Raspberry Pi arcade table. I’ve found a cheap coffee table from Argos that should be able to house the monitor and the electronics. Today we were making a hole for the monitor and the joystick buttons.

DSC_0062.jpg

Peter makes the first cut. Note use of a spacer piece of wood to make sure it isn't the deepest...

DSC_0064.jpg

Fitting the monitor in place. Note the little tape tags at the top and bottom. We added those after we discovered that once we'd put the monitor in place we couldn't get it out again without a lot of faffing about.

DSC_0073.jpg

This is the first plan of the joystick and button arrangement. Current idea is to be able to use it from either the side or the ends of the table.  If it doesn’t work, well, I’ve got a spare table….

DSC_0078.jpg

Buttons in place. Note strange ritualistic markings above the buttons that are either where the joystick is going, or something much more sinister….

DSC_0081.jpg

The unfinished finished product.

Hello Mr White

image

Bought a new laptop today. Not for me I hasten to add, but for Number One Wife, who has some writing to do. Her old laptop, still proudly bearing its “Made for Windows XP” sticker, has taken to forgetting the date and time and whether or not it has a hard disk attached. Replacing the battery that causes these memory lapses involves taking the machine to bits and unsoldering and replacing a component with a very very long part number, and to tell the truth I can’t really be bothered.

So, it was off to up town to see what could be acquired at the, ahem, lower end of the market. And we happened across the beast above. It’s made by Asus, has a processor which will do the job (word processing, surfing the net, maybe a bit of Skypeing), 4G of RAM, a reasonable sized hard disk and even a USB 3 port on the side. It doesn’t have an optical disk drive, but I can live without that. And you can get it for less than 300 quid. Even managed to buy it from one of our students, who works in Currys Digital up town.

I took it home, and once we had got over the 36 updates it wanted to install, cleared off all the rubbish littering the disk and installed Microsoft Security Essentials it works a treat. The battery life is not stellar, but it has this really nice multi-touch mouse pad that lets you scroll and zoom really easily. A properly useful device for rather less than the price of an iPad.

When Number One Wife goes out I might even pop Visual Studio on it and see what it would be like for developing Windows Phone applications.

Debugging Conditions

IMG_5091_2_3.jpg

We had our first programming lab proper today. Conditions and statements. Great fun. The aim of the exercise is to decide whether or not a given customer can see a movie at your multiplex. The inputs to the program are the age of the customer in years (age), and the number of the movie that the customer wants to see (filmNo). Movie number 1 is Looper (which is apparently quite a good film). In the UK you have to be at least 15 years old to see the film. Quite a few students wrote code like this, which makes very good sense:

if (filmchoice == 1 && age >=15)
            Console.WriteLine("Enjoy the film");

The condition will fire when the customer has chosen film 1 (Looper) and their age is greater than or equal to 15, which is just fine. However some folks then decided to improve the program to add the message that says “You are too young”. And they used the else keyword to achieve this:

if (filmchoice == 1 && age >=15)
      Console.WriteLine("Enjoy the film");
 else 
       Console.WriteLine("Access denied - you are too young");

This seems to make sense, but we now have a problem when we finish off the program. People start being denied access to films when they shouldn’t be. In fact they see lots of denied messages, which is very confusing.

The problem occurs because the program can enter the above statement in one of four states:

  • Film is Looper and age is greater than or equal to 15
  • Film is Looper and age is less than 15
  • Film is not Looper and age is greater than or equal to 15
  • Film is not Looper and age is less than 15

The if condition above will fire if the program is in the very first state (which is what we want if the customer can see Looper) but the else part will fire in all the other three states, leading to “Access denied” messages when we really don’t want them. One way to solve this is to split the program into two tests, so that the age test only takes place once the program has decided that the customer is seeing the Looper film.

Actually, there are lots of ways of addressing this issue. For me the interesting thing is that you need to be careful when you take a tiny piece of code that works fine (the original test) and then add a bit extra to it. Your program must handle all the input possibilities, not just the ones that constitute the “Happy Path”.

The Pi has Landed

DSCF8836.jpg

Raspberry Pi and Raspberry Yoghurt. And a Red Rocket, that looks like it has been Photoshopped on, but did actually fly past as I was taking the picture.

I’ve now got a Raspberry Pi! I got it from Cameron, who also very kindly supplied me with an HDMI to DVI adapter so that I can plug the Pi into a monitor in my office. It fired up a treat after I had built an SD card with a copy of the operating system. Looks very nice and works well. I’m trying very hard to remember all the Unix commands I used to know so that I can drive the thing.  In case you were wondering why I’ve bought a Pi (as if being me wasn’t enough reason), this will be the beating heart of my video game coffee table, which is now taking shape. I even went down to Argos and bought a couple of coffee tables which will be used to hold the monitor and the other gubbins. Tomorrow we are going to have a go at connecting the joysticks to the Pi and try to run a Mame game or too. Should be a fun way to spend a lunch break….

First Rather Useful Seminar

image

We had our first Rather Useful Seminar today. Loads of people turned up. I would have taken your picture folks, but in the excitement of the moment I forgot. I did remember to give away a prize though, the fabled “white rocket of happiness”.

Next week, same time (1:15) and place (Lecture Theatre D) I’ll be giving away another prize. A free copy of my Kinect book. This is actually quite appropriate, as the session is all about Kinect development. I’ll even sign it if you like.

You can find the entire programme of events for the run of Rather Useful Seminars, along with the slide deck for this week’s presentation,  over at www.ratherusefulseminars.com.

Rob at the Round Table

DSCF8830-Edit.jpg 

You can’t say I’m not versatile. A couple of weeks ago it was Cottingham Women’s Institute, tonight it was the local Round Table who had invited me to speak. So, in my smart suit (but not quite as smart as the folks above) I turned up at the Hallmark Hotel to try my hand at after dinner speaking. Or in my case, after apple crumble speaking as I didn’t get there in time to eat the whole meal….

I’ve not done this kind of thing before (I hope this didn’t show too much). I’d carefully prepared some notes that I thought might go down OK, but thanks to SkyDrive not synchronising them properly (can you see a pattern forming here?) I’d not had as much time to work on them as I was planning too.

Anyhoo, thanks to a great audience, who even managed to laugh at quite a few of the the jokes, I made it through around 20 minutes of “not quite as well prepared as it might have been” mayhem. Thanks for inviting me folks. And the apple crumble, to say nothing of the entertainment that followed my talk, was splendid.

Postgrad Welcome Party

DSCF8820.jpg

These folks won the quiz.

Tonight it was time for the Postgraduate welcome party. We did pretty much the same thing, with Rock Band, Wii Sports and of course the massive car racing track. We also nearly had exactly the same quiz questions, thanks to SkyDrive not updating the files correctly. Anyhoo, fun was had; once I’d shot back to my office and emailed the Powerpoint deck through to myself….

DSCF8821.jpg

These folks came second. In spite of because of Simon being on the team.

DSCF8824.jpg

These were in third. An still look pretty pleased.

DSCF8822.jpg

I'm not convinced that these folks actually did the questions. Perhaps we need bigger prizes…

Rather Useful Seminars

DSC_0048.jpg

I'm organising a sequence of "Rather Useful Seminars" for this Semester. These will be for any students in the department who want to come along and learn stuff that might be rather useful. You can find more about the seminars here:

 /rather-useful-seminars

The first one is this Wednesday at 1:15 pm in Lecture Theatre D (LTD) in the Robert Blackburn Building. It is about participation in the Microsoft Imagine Cup. This is a student competition in which Hull has had a lot of success, and I'd like to have some more.

Captain Scarlet at the Movie Buff’s Fair

DSC_0037.jpg

After the Open Day yesterday I went into town (which was an adventure in itself) and dropped in at the Movie Buff’s Collectors Fair that they were having in the Prospect Centre. Lots of people dressed as Storm Troopers and other Star Wars characters were in attendance. I wonder if they ever have a situation where two Darth Vaders show up at the same time. Surely that would cause great disturbance in the force, among other things…

Anyhoo, they also had lots of stalls selling “collectables”. Including this pair, in very good condition, although they were minus their guns (which I plan to have a go at printing). Just as a pop quiz, which of the two do you think is the baddie? And no, they are not holding hands.

Saturday Open Day

Today we had our first University Saturday Open Day of the Semester. We had it on a Saturday, what are the chances eh? Anyhoo, we had good turnout, and I did two talks which seemed to go OK (at least from my point of view). Thanks for being a good audience folks.

IMG_5051.jpg 

IMG_5099.jpg

I took the pictures at the very start, apologies to those who arrived after the snaps. There was an hour gap between the two talks, so I went out with the big camera and took some pictures that I could play around with later. I’m very into the “Painterly 2” tone map from Photomatix at the moment…

IMG_5056_7_8.jpg

This the library looking cool.

IMG_5074_5_6.jpg

Marketing in the flowerbeds..

IMG_5052_3_4.jpg

This is “The Great White Way” that runs down the campus.

Thanks to everyone who came along, hope you found the experience worth the journey. For those of you that fancy coming to see us in the future, we’ll be doing exactly the same thing (even down to the jokes) on Saturday the 13th of October. Drop me a line if you fancy coming along and I’ll ensure you get a “Red Carpet Welcome” which might even involve a small piece of red carpet.

Sneaky First Year Programming Lab Fun

IMG_4899_900_901.jpg

We had all the First Year students in for their first lab today. As part of the fun we ask the students to find the bug in this piece of C# code, which is supposed to add two numbers together.

   1:  static void Main()
   2:  {
   3:      Console.WriteLine("This program adds two numbers together");
   4:      Console.Write("First Number : ");
   5:      string number1Text = Console.ReadLine();
   6:      int number1 = int.Parse(number1Text);
   7:      Console.Write("Second Number : ");
   8:      string number2Text = Console.ReadLine();
   9:      int number2 = int.Parse(number2Text);
  10:      int result = number1 * number2;
  11:      Console.WriteLine("Sum is : " + result );
  12:  }

Lots of people found the error straight away. But some people (usually the more advanced programmers) didn’t. I had reports describing problems with number parsing, the range of the input values, crashes caused by entering text instead of numbers, and all sorts of things like that. But the real problem is much, much simpler.

The program says it adds two numbers. But the statement at line 10 which works out the result actually does a multiplication rather than an addition. Which means that the program is completely correct, runs fine, but does the wrong thing. This is a surprisingly common problem with programs. You can write a program that is perfect, works a treat, but doesn’t do what the customer wants. And you will not get paid/get fired as a result.

The nice thing about this “sneaky” lab for me is that it worked on two levels. Those learning how to program can see how the computer follows a sequence of statements, executing each in turn. If the statement is wrong, the output is wrong. Those who can program a bit have hopefully learnt that it is a good idea to read the specification when you start writing code…..

Undergraduate Welcome Party

IMG_4987.jpg

It’s amazing what people do when you say “Act happy”.

Today we had the Welcome Party for the new undergraduate students. Great fun. I took the big camera and grab some snaps. As an experiment I’m taking the tiny camera to the one next week, to see what difference it makes to the pictures.

IMG_5021.jpg

We had a new toy this time. a six car digital Scalectrix. We had a computer timing laps and running quick races to find the fastest drivers. Went rather well, although the cars took a bit of a pasting. By the end all but one were still running though. We had some blankets around the corner bits to hopefully reduce the damage.

IMG_5016.jpg

Something bad in the process of happening…

IMG_5019.jpg

This is photographic evidence of the first sub-three second lap…

IMG_5026.jpg

These guys won the quiz.IMG_5028.jpg

These folks came secondIMG_5030.jpg

And the Malteasers go to these folksIMG_4995.jpg

Thanks to Freeside for bringing their multi-player game along. Worked really well.

We are actually going to use the Scalectrix in the teaching this semester. We will be interfacing Gadgeteer devices to the data stream that it produces and trying to make some embedded code that reads the controllers and drives the cars. Should be fun.

Thanks to everyone for coming along, sorry about some of the questions in the quiz….

There are some more pictures on Flickr. Click through any image to find the Photostream.

Project Deliverables

IMG_0558-Edit.jpg

I really like having the students back on campus. I was talking to Cameron about Seed projects. He is on the fourth year of our MEng course and he will be developing a project for a proper customer as part of his course this year. He was asking for any tips about project management. I told him that the best way to regard a project like this is to consider that the outcome of the work should not be a product, it should be a happy customer. If you think you are making a Stock Control System then you will focus on the technical deliverables and probably get them working, but you might not provide what the customer wants. If you think about the problem in terms of making “Wonder Widgets” happy about the way they are now able to manage their stock that puts a different perspective on the job.

This doesn’t mean that you have to do everything the customer wants, including washing their car. What it means is that you should engage with the customer as much as you can (or they will let you) when you are building the solution. We have found that the best Seed projects are the ones where the customer really gets involved with the team making their solution. The best way to do this is to make it easy for the customer to work with you. Bring things to meetings to talk about and leave with lists of things to do. And keep the cycle as short as the customer will let you. Thinking “We’re OK, we saw the customer last month” is kind of dangerous, in that this is the way you end up with a half working solution to the wrong problem.

Welcome To Hull 2012

IMG_4917_8_9.jpg

That reminds me, must get down there and stock up before my first lecture…

Welcome to Hull for new students. And welcome back to everyone else. Firstly I must apologise for the horrible weather. My fault entirely. I washed both cars yesterday. Fool.

Anyhoo, each year I put up a bunch of tips for new students, so here goes for 2012:

  1. Make sure that you have all your updates installed on your system. It doesn’t matter whether it is a Windows PC, a Mac or a Linux netbook. Find out how to check for updates and get everything up to date. At some point you will want to connect your machine up to a campus network of some kind, and if you don’t have all the latest security patches you may be vulnerable to infection.

  2. Do something about viruses. At the very least make sure that your Windows PC has Microsoft Security Essentials installed and running, that the databases are up to date and that you run scans at regular intervals. If you really want to install an anti-virus program don’t feel obliged to spend a lot of money, the AVG free anti-virus program is good and will cost you nothing. Get it from http://free.avg.com/. Please don’t spend huge amounts on some of the more expensive ones. The benefits are dubious and they also have annual renewal charges too.

  3. Take a backup of your machine and leave it somewhere safe (perhaps even at home). Find out how to use the backup software on your machine and take a copy of everything. Use one of these cheap external hard disks that you can pick up for around 35 pounds or so from places like http://www.ebuyer.com/ or Staples, or even Tesco. That way if it all goes horribly wrong when you get to university you can recover your precious music, videos and other stuff. Once you have the backup habit, take a full one one every month or so.

  4. Don’t spend huge amounts on software just yet. Most universities (including ours at Hull) have deals that get you some programs that you need cheaply. Take a look at https://www.dreamspark.com/ for free Microsoft stuff and http://students.autodesk.com/ for free Autodesk stuff (great for 3D design).

  5. The same goes for books. In the computing field they are rather expensive, and you don’t want to pay a lot for a book and then find out that it is only used for a small part of the course. You can check the books out in the library, and you might also find that there is a second hand book sale on your campus where you can pick up the required volumes from other students quite quickly. You might also want to form a little cartel with fellow students to share books between each other and spread the expense (this is also neat because it can also give you a ready made study group). Hull students will get a printed copy of my C# Yellow Book (daffodil edition). Anyone else can get it free from http://www.csharpcourse.com/

  6. Get a usb memory stick (actually, if you are a Hull Computer Science student we’ll be giving you one of these later this week) . Keep backups of all your work on it. You can also use it to take files into the university to work on. You will get some filespace on the university network, but it will not be an enormous amount, and having your files always with you is useful. Put a file on the drive with your contact details (just your name and phone number) so that if you lose the drive people can find out who to return it to.

  7. Get some free on line storage. I like Windows Live Skydrive: http://skydrive.live.com/. This gives you 7 GBytes of space which you can access from anywhere on the web via a browser. You’ll need a Windows Live account to use this. Skydrive will also sync files across multiple computers, although I’ve found that that DropBox has better multi-platform support and also keeps track of file generations. Take a look at DropBox at http://www.getdropbox.com/. Unfortunately you only get 2G of Dropbox space for free. You can also use Google Drive: https://drive.google.com

  8. Make sure you have insurance for all your nice toys. It would be terrible if they got stolen or damaged before they were insured. Take a look at cover from student specialists like Endsleigh:

    https://www.endsleigh.co.uk/student/student-insurance/

    (if anyone knows any cheaper deals feel free to let me know and I’ll update this post)

  9. Start blogging. Good writing skillz, like wot I have, are very valuable and make you a much more employable person. Sign up at Hull Computer Science Blogs: http://hullcompsciblogs.com/ and start putting your word out and building your brand.

  10. Don’t worry. Really. You’ll be fine. And it will stop raining. Probably in April.

Una makes some Rockets

IMG_4950-Edit.jpg

Una the Ultimaker is now really coming into her own. Especially now I’ve put the little blue locking device in the right way round on her print head so she doesn’t push our her Bowden tube half way through every print. I’ve found this super Rocket Retro on ThingUniverse and I’m working my way through the coloured fibres that I got from Faberdashery in their multi-coloured pack. They rather cunningly sent me some Jade Green translucent fibre along with my order, which looks amazing. It is a bit wasted on a rocket but I’ve printed a thin sided vase with it which looks really nice. So now of course I’m going to have to order some more.

Pi Powered Tabletop Gaming Machine

image

Firebox do this amazing “arcane arcade table”. It is basically a MAME (Multi-Arcade Machine Emulator) PC underneath a 26 inch TFT monitor and with a tricked out sliding joypad thing. It looks very nice. It also costs 4,000 pounds. Wah.

But a Raspberry Pi costs 30 quid and has MAME support. A monitor shouldn’t come in at much more than 100 quids (assuming I can’t find one lying around somewhere). IKEA do coffee tables at around a tenner, and so I reckon it should be possible to get something going for a lot less (how about a twentieth) than the cost of the “amazing” one.

Ever since I saw Jon Purdy’s tabletop Galaxian machine I’ve kind of fancied having a machine like this in the living room. Even number one wife kind of approves, as long as it is not too big and not in the middle of the room. The only tricky bit is making the bezel and inlaying the screen into the tabletop. That has to be done properly, but perhaps if a bunch of folks got together we could have some made.

Anyone fancy having a go?

Three Thing Game Autumn 2012

image

Followers wanted….

Three Thing Game is coming. With new Bank of Thingland money, improved auction action and all round added wonderfulness, including the MonoGame team who will be coming along for the weekend and giving some sessions on porting XNA games to Windows 8. Thanks so much to Lee Stott from Microsoft for sorting that out.

You can find out more by reading this wonderful blog, going to www.threethinggame.com (which in a strange kind of way links you back to this blog) or by following the all new, highly shiny, ThreeThingGame on Twitter.

And stay tuned for some riveting hardware developments for the competition which might (or might not) actually include riveting.