Hull Digital Question Time

HDQT Pic

The view from the audience, from left to right Jon Moss in the chair, Imran Ali, Helen Philpot and Prof. Calie Pistorius, VC of Hull University.

I’ve just been to something really, really good. With free drinks at the end. Hull Digital Question Time was set up by Jon Moss and brought together a panel of experts to discuss the future of digital technology. I wasn’t sure what to expect, but the combination of interesting questions, a range of expertise from the panel and sensible debate from the audience made for a fascinating evening.  And then we all went to the bar..

I think the event has been filmed and it would make an absolutely great podcast, so with a bit of luck it will turn up in a downloadable form at some point in the future. In the meantime, if you get the chance to go to any events like this in the future (and I’ve already asked for another one) then you should jump at it.

One more thing, Jon told us that the date for the next Hull Digital Live event has been set. It is the 4th of November this year. Note it in your diary.

XNA Materials

Before I went to give my talk yesterday we dropped in at the Microsoft offices in Schipol. Very plush.

Microsoft Schipol Lampshades

They have these amazing lamp shades in the restaurant.

Microsoft Schipol Clocks

Time around the world, Microsoft style.

The presentation was great fun and the audience was lovely. I really like these trips out. Thanks to all the folks at Microsoft Netherlands for looking after me

You can find the presentation and all the XNA content that I used during the talk here.

A Hot Day for writing Custom XNA Content Importers

Humber View Wide

In between gardening and feeling very warm I wrote a custom content importer for XNA 4.0 today. This is the way that you can bring in your own content into an XNA game. I’m playing around with some game ideas and I needed to get a bunch of data into my game engine so I can twiddle with it.

Turned out to be a lot easier to do than I thought it would be. Actually, the whole content setup is lovely to use in XNA. If you ever want to do this, you can find a really great start here:

http://msdn.microsoft.com/en-us/library/bb447754.aspx

The stuff seems to work fine in Windows Phone too. I really know how to enjoy myself in summer…..

Sad Rob

Behind the scenes: Gordon Brown and family leave Downing St

We were talking about different versions of Windows today and I mentioned that in Number 10 Downing Street they still use Windows XP on their systems. I told everyone that I’d seen it on the “historic” pictures taken inside the Prime Ministers’ residence during the election aftermath.

For some reason knowing this was regarded as sad…

Rob’s Guide to Marking

Exam Scripts
See rule 5

It was my “big” exam yesterday. Two hours of panic for the students. Four days of marking for me. So, nobody comes out of it particularly happy I suppose. For any academics out there I present Rob’s guide to marking.

  1. Don’t try and do it all at once. You will fail. Make a big hole in your schedule and set out how much you want to get done each day. Then you can point to a day in the future and say “I’ll be clear of marking then”.
  2. Make yourself a nice place to work. I used to cut up the question paper and stick it into one long strip that I could have by the answers so I didn’t have to keep flicking between question and answer as I marked. Now the students write their answers underneath each question. Easier for them, and much quicker for me to mark.
  3. Use a really nice pen. I’ve been known to spend up to twenty minutes in the Student Union shop choosing a pen with the right colour, feel and heft. Actually, this might be a displacement activity, but if the pen makes you enjoy writing the marks then at least some part of the marking process will be fun.
  4. Take regular breaks. I’ve got Professor Layton and the Curious Village fired up on the Nintendo DS. A puzzle every 12 scripts or so stops my brain from melting.
  5. On no account should you make a single pile of all the scripts that you have to mark. This is invariably depressing.

“Hello Silverlight” Book from Manning Publications

image

I’ve been lucky enough to get hold of an early copy of this book. If you are new to Silverlight and want to find out more this will tell you in a very nicely written way. It even has cartoons that are both funny and relevant – which is great. I strongly recommend it.

The book isn’t finished yet, but you can download and read the early chapters and even send comments back to the author. I’m looking forward to getting my hands on a proper printed copy when it comes out.

C# Exceptions and Finally

London Tulips

I’m writing a new version of the C# Yellow Book and I’ve been going through the chapters to make sure they still make sense. Today I’ve been playing with Exceptions. These are things that programs do when really bad things happen. When things are going badly for me in a chess game I have this annoying habit of kicking the board over and storming of to do something else. Exceptions are just like that, but for programs.

If a program finds itself in a situation where it really can’t go any further it can throw an exception and make the issue somebody else’s problem. Really bad in this case means things like “I asked for a number and you’ve given me some text” or “You asked for a file and I can’t find it”.  This means that a proper programmer will put such potentially moody code into a try – catch construction so that they can deal with any tantrums that might be thrown:

try
{
    // Potentially moody code
}
catch
{
    // Code to recover the situation
}

If anything in the block under the try throws an exception the program runs the code in the catch block to try and put things right. When I was younger and more desperate to be liked I used to make sure that code I wrote didn’t ever throw exceptions, but tried to sort things out and carry on. Ask my object to load something from a file that doesn’t exist and it would return a null reference and keep going. Sure, the program that went on to use that null reference would explode some time afterwards, but at least my method hadn’t thrown a tantrum.

Now I’m more nasty. I let my programs throw exceptions if they are asked to do stupid things. That way the fault is generated much closer to the real reason why it happened. Problem is, that sometimes I don’t want to just pass an exception on, I want to do a bit of tidying up myself before I blow away the person that calls me. I can do this by catching the exception in my method and then throwing a new one.

try
{
    // Potentially moody code
    // Code to tidy things up
}
catch
{
    // Code to tidy things up
    throw new Exception ("Bad news message to caller");
}

Of course the problem here is that I have to write the code to tidy things up in more than one place. Once if everything works, and again if the exception is thrown. Which is where finally comes in:

try
{
    // Potentially moody code
}
catch
{
    throw new Exception ("Bad news message to caller");
}
finally
{
    // Code to tidy things up
}

You don’t have to add a finally part to your try – catch construction, but if you do it is where you should put all your tidy up code. This is the code that must run whether or not the exception is thrown, and irrespective of what happens in the blocks above. I use code in the finally part to do things like close files, release objects and say bye-bye to network connections. And it works well except in one situation, which is kind of why I’m writing this blog post.

The code in my finally clause will not run if there is nothing to catch any exceptions thrown by the code in my try – catch construction. In other words, if the exception my code throws will cause the program to end for lack of an exception handler the finally clause will not run. I did some experiments to prove this, and decided it was something worth noting.

The thinking, I suppose, is that if the program is going to stop anyway, what is the point of allowing it to run any more code. Most of the time the finally clause will be releasing resources that will be freed anyway when the program is terminated. However, it is not always as simple as that. Sometimes finally code might want to say a formal goodbye to a remote host, or log some information. 

Since you can’t rely on someone to always catch exceptions that you might throw (particularly if they are stupid enough to make bad calls of your methods in the first place) I think that this means you need to be a bit careful about using finally. If this means putting tidy up code into a method and then calling it both in the try and catch parts of your program, this might be a step worth taking.

Read “Bad Science”

I was talking to some folks today and they told me they had not read “Bad Science”. They should. There are some books that everyone should read, and this is one of them. It does a great job of getting you to think properly about stuff you see in the papers, and things that advertisers tell you. It makes warning bells come on in your head when you hear things like “Studies show…” and “90% of women prefer….”.

Brilliant.

Marking Time

York Railway Museum Engine Controls 2

Been in the labs marking for the last three days. Today I did the last few presentations before I sit down and enter the whole lot into our system. Students have been making games or banking applications. I have seen some lovely stuff. It’s very hard work, I must have asked “..and what does this bit do?” loads of times. But great fun. Thanks to the first year for turning up on time and to Simon and Mike for sharing the work.

Windows 7 Upgrades for MSDN AA Students

Humber Bridge Christian Aid Walk Red Car

This is a tip for students who are lucky enough to study at places that have Microsoft Academic Alliance set up. These students have access to free copies of Windows 7 which may well be better than the ones on their machine.

If you fancy upgrading your Windows 7 machine (which may have the Home version of the software)  to the more advanced version provided by MSDN AA you don’t have to re-install your operating system. You can use the Windows Anytime Upgrade command to enter the product key for your new version and the upgrade happens for you automatically. You can find out more about this here.

Hull Digital Question Time – Free Event

image 

It is funny how the person asking the questions always gets the best chair…

Hull Digital Question Time is in a couple of weeks or so. It brings together a panel of experts and an audience to have a discussion about the internet, mobile, the future of communication and anything else you care to ask questions about. Given that one of the panel is the Vice Chancellor of the University of Hull you might also expect some discussion on the relevance of technology to the future of Higher Education. 

It is being held on the university campus at the Donald Roy Theatre in the Gulbenkian Centre. The free food and networking starts from 6:30 pm onwards on Wed. 26th May.

The event is free and open to anyone who wants to sign up here. I’ve got my ticket, and a question to ask.