Every. Demo. Failed.

All the geeks

A big audience to fail in front of….

What do you do when you present a session and every demonstration fails? I didn’t know this until today. The answer is that you reach the end and then you go and find out why.

I was doing a Kinect session for Geek Night today. This was kind of ambitious, what with carrying the sensor around all over the place. So I’d tested everything before I set off, and I was confident that it would all work on the night.

It didn’t.

I was very happy when the first demo worked, but I can’t take too much credit for that because it was the demonstration application that ships with the SDK. As soon as I moved onto my code that problems began. Programs that just worked suddenly locked up before my eyes. All of them.

It took me a while to figure out what had happened. As in the case of most big failures, it was a collection of little things that added up to make a catastrophe. First thing was that I was using my lovely little Alienware netbook rather than the “Big Ole Dell” that I usually use. The main reason I took the Alien was that it made room in the case for the Kinect sensor. That and the way the keyboard lights up. It is just powerful enough to run the demos, but just powerful enough is fine. Except today it wasn’t.

Something has mysteriously turned all my overclocking settings back down to normal. I turned them on ages ago when I got the device and forgot all about them. Today, after a lot of head scratching, I checked in the BIOS and there they all were. Back where they shouldn’t be.

A bit of tweakage and all is well. I’ve even tried flipping to the built in high performance graphics, which also helps (but also breaks the Windows Phone emulator – so I don’t usually use it).

I’m kicking myself for not testing the demos on site this afternoon when I had a bit of free time, but I assumed that since they worked before they’d work again.

Oh well. Everybody at the session seemed to have a good time. Except me.

Mega Student Sessions at TechDays

Full house

I like a big audience, but, blimey.

Did a couple of Student to Business sessions in TechDays today. Great fun. Above are the folks who turned up to the first one. Click to through to the larger Flickr image and try to find yourself on the picture (Note – only do this if you were actually at the session)

room 10 audience

This is the slightly smaller audience at the second session. I think word must have got out by this point….

KlangFilm

Tech Days is being held in a massive cinema complex near Brussels. They have some old projectors in the foyer, this is a close up of one of them.

Now on to the Netherlands and Geek Night.

Tech Days Belgium

Audience

Another country, another audience…

Today it was up bright and early to fly to the Netherlands and take a train to Belgium for my sessions at TechDays. I’m giving sessions on Windows Phone and Kinect. I always wonder just why I do this kind of thing, particularly when I’m sat on a train watching unfamiliar countryside whizz past in the rain. Then the session starts and I remember why. Great fun. Great audience and a good response from all. I promised I’d put the slides and content on the interwebs and so here it is. Remember, if you make a fortune from anything based on it I’m in for 10%. It’s only fair…

Techdays Setup

This was my setup for the talk.

The only snag was that when I got back to the hotel I found that they’d run out of numbers for access to the hotel WIFI. Apparently a new system is being installed tomorrow and at the moment they have no network access. So this post is being made from the future.

PlayStation Vita

image

Apparently it is called a PlayStation Vita because of the associations with speed and life. I must admit the name makes me thing of crisp-bread. And I wasn’t going to get one. Oh  no. With a phone and a Nintendo DS 3D I couldn’t see a reason to own the device. Until I saw it running.

The graphics are very impressive. Like very, very impressive. It really is a PS3 you can carry around with you. I had a go at Ridge Racer (I think I’ve bought that game more times that I’ve bought different copies of Star Wars) and the presentation and graphics were excellent. And I got a cool pair of (surprisingly good) blue headphones as well.

For casual games phones and iPads are great. For something a bit different and the 3D effect the Nintendo DS 3D has a lot to offer. But for hard core gamers I reckon the PS Vita has an awful lot going for it.

Open Day at Hull

P1030311.jpg

Open Days are here again. This is some of the audience who sat through my talk this afternoon. Hope you all had a good time and thanks for braving the elements to come and see what we do at Hull. We are holding more Open days in the next few weeks.

P1030312.jpg

This is Warren handing out a copy of a great book (Oh Yes) to the winner of the prize draw at the end. Those that came along also took home a printed copy of the C# Yellow Book. If you want to find out more about that, and perhaps download other coloured books, you can find them at www.csharpcourse.com

Kinect Fun Labs at Imagine Cup

IMG_7043.jpg

There is a rather interesting new addition to the ranks of the Imagine Cup competitions this year. The Kinect Fun Labs Challenge is out to get you exploring new ways to use the Kinect sensor. The nice thing about it is that at the moment all you need is the idea. The implementation can come later. They are actually giving out 100 Kinect for Windows sensors (these are the special ones that have higher resolution close up and other interesting tweaks) to the ideas they like the best, so that you can realise them and enter the next phase of the competition. Next week there is a Live Meeting all about how it works. If I was still a student, I’d be there.

Imagine Cup

image

We had a meeting today about the Imagine Cup. A whole bunch of our students seem very keen to take part. No idea why. Unless it is the chance to make a name for themselves, win some prizes, have fun making something useful, pick up useful skills, maybe even get to go to Australia and win a chunk of cash….

You should take part too. The Imagine Cup could change your life. I’ve seen it happen. Form a team and sign up here.

Kinect Skeleton Viewer

image

The new Kinect for Windows SDK is now available. It works really well, but they have changed the API slightly (generally it is a lot tidier now). If you want a simple program to get you started using the skeleton data I’ve done a quick conversion of one of the demos in the Kinect book that I’m working on. You can download the project from here. Now all I have to do is update all the other fifty or so demos and the 12 chapters. Lovely.

Chris Wooding and the Ketty Jay

image

If you are looking for a bit of escapist Science Fiction/Fantasy stuff then take a look at Chris Wooding. I’ve just read the first of his Ketty Jay series and it is a rollicking good fun. If you enjoy Harry Harrison, Blake's Seven, Firefly kind of stuff then you’ll like this. A well written take on the “ship of misfits freebooting around falling into danger and adventure” kind of thing with plenty of action and a quite a few laughs.

Tutorials, Objects and References

Snowy Library.jpg

We are doing objects and references in the First Year tutorial today. Great fun. Well, at least I thought so. I asked the class whether big objects in memory have larger references than small ones. They don’t – the size of the tag is always the same – no matter what it is connected to. I went on to explain that a reference tag contains a bunch of information about the thing it is referring to, including the type that it has, for example string, BankAccount, AlienSprite or whatever class you have created.

Then someone asked a great question: “What happens if the type has a very long name? Does the reference tag get bigger?”. Aha! What a great question. The answer is no. This is because the type of a reference is managed in terms of a reference from the tag to the type object that describes that reference. In other words, a reference to a BankAccount will also contain a reference to an object that describes the BankAccount class.

I was very pleased with this question, because it let me start to explain how, by using objects, you can build up structures of data that are genuinely useful. I’ve been explaining structures and objects all week and several times I’ve had the sensible question “What’s the point of objects and references? They just seem to make life harder for us.”  This little allows me to show how easy it is to use references to allow the system running the program to track and mange the type of the objects it is using.

I reckon that a good tutorial is when the students learn something. A great tutorial is when the tutor learns something as well. I’ve now got a lovely new example to use next year…

When is a number not a number?

IMG_5863.jpg

Pop quiz. What would the following C# code do?

float x = 1;
float y = 0;
float result = x / y;
Console.WriteLine(result);
  1. Fail to compile.
  2. Throw an overflow exception.
  3. Print “Infinity”
  4. Cause the universe to explode.

Here’s the thing, the code prints the word “Infinity”. Dividing any floating point variable by zero gives a special result which is encoded into the floating point variable range as “Infinity”. Now what about this?

float y = 0;
float result = y / y;
Console.WriteLine(result);

This time we get the message “NaN”, which means “Not a Number”. Dividing zero by zero does not give a number as a result. There just isn’t a value for this quantity. The value is not as big as as infinity or as small as zero its just, well, not a number. You get the same non-result if you divide infinity by infinity.

The C# runtimes are based on .NET which uses an IEEE (Institute of Electrical Electronics Engineers) standard that contains representations for negative infinity, positive infinity and “not a number”. Calculations in a C# program will produce these results when given dodgy values to work on. This is very important. You might think if you do silly things with numbers in your program you are going to get an exception thrown. Like this would.

int i = 1;
int j = 0;
int Result = i / j;
Console.WriteLine(Result);

Run this code and it throws a “Divide by Zero” exception when it tries to, er, divide by zero. But this does not happen with floating point calculations. This is probably because the range of values for the int type does not include one to represent “infinity”.

The bottom line here is that if you do sums involving floating point values you can’t expect exceptions to be thrown if the calculations go wrong. The good news is that you can use methods provided by the float type to test results of calculations:

if (float.IsNaN(fresult))
    Console.WriteLine("Welcome to the Twilight Zone");

This prints the enigmatic message if the value in fresult is not a number.

Rob on the Road

image

I’m off on my travels again next month. I’m doing sessions about Windows Phone and Kinect at TechDays in Belgium and the Netherlands and then hopping over to SIGCSE in the USA to give some sessions there too.

The plan is to develop and maybe even publish a complete Windows Phone application during one session and then play some rather silly games during the Kinect one. Should be fun.