Hello from Bellevue
/Well, after a boring (but in a very good way) journey I’m now in Bellevue, where the conference is based this year. The whole setup is very nice, with a king sized bed in the room. I wonder if they measured it up against a real king?
Anyhoo, it is a very nice bed, although of course my body wants to use it at all the wrong times. I may have to do some “Jetlag coding” to get around this. The hotel is linked to a big shopping centre (how useful)
On the way to the mall I saw this really fancy glass sculpture thing.
Bellevue centre (or should that be center)
Packing for Seattle
/It is that time of year again, when I head off to Seattle for the MVP Summit. I’m really looking forward to this year’s event. It is always nice to meet up with folks I’ve not seen for a while, and talk about technology.
Of course this means that I have to choose which gadgets get to go with me. I’ve left the trouser press at home. Three is a good chance that the hotel room will have one anyway…..
Hull Students: Freeside Needs You
/If you are a CS student at Hull you might consider getting involved in Freeside. This is a student run organisation that operates out of our department. Their primary focus is on building systems that can host student services and they have been know to build the odd cluster.
They are also linked to Hull ComSoc and are involved in running game servers used in the department. Jon from FreeSide used some time in my lecture this week to give a short presentation about the group and recruit new members. He made the point that the skills you can get from Freeside will stand you in very good stead for future employment. Apparently big chunks of the server management team at Last.FM are ex Freeside stalwarts.
First Open Day of 2010
/
Another satisfied customer wins a PSP in our Open Day draw from Mike. With a copy of FiFa you can even play as Hull City….
We had a bunch of people up to see us today. Thank you very much for coming folks, we hope you found the visit worth your journey. This is the time of year when we start to get busy, we have a bunch of open days over the next few weeks.
Processing Lots of Files in C#
/Elliot came to see me today with a need to process a whole bunch of files on a disk. I quite enjoy playing with code and so we spent a few minutes building a framework which would work through a directory tree and allow him to work on each file in turn. Then I thought it was worth blogging, and here we are.
Finding all the files in a directory
The first thing you want to do is find all the files in a directory. Suppose we put the path to the directory into a string:
string startPath = @"c:\users\Rob\Documents";
Note that I’ve used the special version of string literal with the @ in front. This is so my string can contain escape characters (in this case the backslash character) without them being interpreted as part of control sequences. I want to actually use backslash (\) without taking unwanted newlines (\n)
I can find all the files in that directory by using the Directory.GetFiles method, which is in the System.IO namespace. It returns an array of strings with all the filenames in it.
string [] filenames = Directory.GetFiles(startPath);
for (int i = 0; i < filenames.Length; i++)
{
Console.WriteLine("File : " + filenames[i]);
}
This lump of C# will print out the names of all the files in the startPath directory. So now Elliot can work on each file in turn.
Finding all the Directories in a Directory
Unfortunately my lovely solution doesn’t actually do all that we want. It will pull out all the files in a directory, but we also want to work on the content of the directories in that directory too. It turns out that getting all the directories in a directory is actually very easy too. You use the Directory.GetDirectories method:
string [] directories =
Directory.GetDirectories(startPath);
for (int i = 0; i < directories.Length; i++)
{
Console.WriteLine("Directory : " + directories[i]);
}
This lump of C# will print out all the directories in the path that was supplied.
Processing a Whole Directory Tree
I can make a method which will process all the files in a directory tree. This could be version 1.0
static void ProcessFiles(string startPath)
{
Console.WriteLine("Processing: " + startPath);
string [] filenames = Directory.GetFiles(startPath);
for (int i = 0; i < filenames.Length; i++)
{
// This is where we process the files themselves
Console.WriteLine("Processing: " + filenames[i]);
}
}
I can use it by calling it with a path to work on:
ProcessFiles(@"c:\users\Rob\Documents");
This would work through all the files in my Documents directory. Now I need to improve the method to make it work through an entire directory tree. It turns out that this is really easy too. We can use recursion.
Recursive solutions appear when we define a solution in terms of itself. In this situation we say things like: “To process a directory we must process all the directories in it”. From a programming perspective recursion is where a method calls itself. We want to make ProcessFiles call itself for every directory in the start path.
static void ProcessFiles(string startPath)
{
Console.WriteLine("Processing: " + startPath);
string [] directories =
Directory.GetDirectories(startPath);
for (int i = 0; i < directories.Length; i++)
{
ProcessFiles(directories[i]);
}
string [] filenames = Directory.GetFiles(startPath);
for (int i = 0; i < filenames.Length; i++)
{
Console.WriteLine("Processing : " + filenames[i]);
}
}
The clever, recursive, bit is in red. This uses the code we have already seen, gets a list of all the directory paths and then calls ProcessFiles (i.e. itself) to work on those. If you compile this method (remember to add using System.IO; to the top so that you can get hold of all these useful methods) you will find that it will print out all the files in all the directories.
Console Window Tip: If you want to pause the listing as it whizzes past in the command window you can hold down CTRL and press S to stop the display, and CTRL+Q to resume it.
Best Laid Plans of Mice and Robots
/So, I had this plan to make a line following robot. I’d even figured out how to do the lines. The idea was to print track segments on A4 pages, and then laminate the pages and lay them on the floor. The robot would go from page to page and it would all work.
That was the plan.
So I drew out some track segments in Photoshop Elements, printed them out and then laminated them. Then, and only then, (and this is the stupid part) did I get round to testing my track design with the robot sensors. Turns out that the line sensors can see white paper really well. Really, really well. I get 99% reflection when I put the robot on the white parts of the paper. Only problem is, I also get 99% reflection when I put the robot on black parts. This is not a problem with the laminate, it seems that, as far as the sensor is concerned, black is most definitely not black. Robot fashion shows must be awfully dull.
Anyhoo, my line following plans were in danger of not being plans any more. Finally I had a brainwave. Carpet seems to give me only around 20% reflection, even through plastic. So I’ve now made some track parts that just have transparent sections where the dark bits should be. You can just see how this works in the corner section above. The green LED is lit because the sensor at the far side of the robot is on the white part.
And now I’ve hit another snag. The robot runs rather roughshod over the path sections. I was hoping they would be heavy enough to stay put when the robot goes over them, but it seems that Jason is rather heavy footed, and messes them up. I’ve now got to find some velcro, or something that will stop them getting moved around as the robot travels over them.
That’s for tomorrow though, I’m off to bed now.
As I lay in bed last night, worrying about my robot, I had a thought. Perhaps the sensors don't like inkjet pigments. I'm going to print out some more stuff tonight using a laser printer and see if that works better.
Such excitement...
Yep. That's it. A line printed by a laser printer works a treat. And I've even found some velcro to stick the map segments to the carpet. Great Stuff.
A “Bustlectomy” for Jason the Micro Framework Robot
/I did a bit of surgery on my Fez Micro Framework Robot yesterday. I took off his “bustle” at the back. I say his bustle, because my Micro-Framework robot is now called Jason, in honour of the JSON framework I’m working on to give him simple two way communication with a host machine.
The bustle was fine, but it hung out over the back a bit, and I wanted to make him (it?) a bit leaner and meaner. The new slim line Jason has all the sensors on his nose. He has a range finder right at the front and a pair of line followers underneath and coloured LEDs he can use to tell the world how he feels. At the moment he zooms around the living room nearly bouncing off things. I must admit it is great fun building him and writing programs to control what he does. You can write any number of desktop apps, but there is something very satisfying about seeing your code make the robot rush up to a wall, notice it, spin round and then vanish under the sofa. I’ll put up some more construction details later, when I’ve finished playing…
Kodu Rocks
/
I must admit I was a bit underwhelmed when I first saw Kodu. At first glimpse I couldn’t see how it would help to teach people how to program.
It turns out that this is because it is not really a teaching tool as such. The point that I seemed to miss was that the intention was to put people in touch with the experience of making a machine do a fairly complex task under their control. Rather than teaching programming, they were aiming to teach the joy of programming. Then, with a bit of luck, folks who find this fun will move into more formal ways of making this happen and turn to real coding.
I downloaded the free Kodu Technical Preview which runs on the PC (you can also get the program on Xbox Live for 400 credits) and had a play. It is great fun. In no time at all I had created a world and had my little creature running round after the ball and picking it up. I want to have another go with this.
I can see this being one of those things you show your kids and then after a while they will grab the gamepad and kick you off the machine so that they can have a go at finding all the things you can do with the environment. At first I was comparing the system with Little Big Planet, which also offers a way you can build your own worlds, but I think Kodu is better in this respect. It is presented from the start as an environment where you create behaviours, rather than as a platform game you can add things to.
From a teaching perspective it is great in that it gets you thinking about a program as a sequence of actions and decisions, and that is fine by me.
Mass Effect 2 Game Review
/I must admit that I’ve not actually played the game. But I have watched number one son play quite a bit of it on his laptop. Seeing him play you could have mistaken the action for a movie. The dialogue is so seamless, with the voice acting so pitch perfect for the various options he was choosing that it was only when I saw the screen that I figured out that he was actually making selections, and not just watching a cut scene.
The action looks good too, with a rich (if a bit scary) story beginning to play out. Anyone who doesn’t think that video games can stand alongside other art forms is seriously behind the times. This really is a new medium, and games like this show just what you can do with it.
Excellent.
Links for Software Engineers
/
I was talking to our .NET Development Postgrad students and we decided that there were a few things that you should be familiar with if you want to become a “proper” Software Engineer. These are the things I think you should do:
Read “Code Complete 2” by Steve McConnell. Perhaps the best book ever on software construction. Then keep your copy where it is handy, and have a policy of reading a bit now and then, just to keep up to speed. If you can track down a copy of “Rapid Development” you should read this to.
Read I.M. Wright’s “Hard Code” blog. And buy the book if you like.
Read “How to be a Programmer”. Excellent stuff.
This is not everything you should do. There are other good places to look. But it is a start. Oh, and if anyone out there has other ideas about good, pragmatic texts for budding coders, then let me know and I’ll add them.
Tag those T-Shirts
/I spent some time this morning working on the logo for the 2010 Where Would You Think T-Shirts. We give these away to guests who attend our Admissions Open Days in the department and they have a slightly different design each year.
The release of the design is of course an event eagerly awaited by the fashion press, and it is rumoured that Chanel, Christian Dior and Yves Saint-Laurent actually hold back releasing their spring collections until they see what we have come up with.
The byword this year is “Tag chic”. You can point your cameraphone at the design and the magic of Microsoft Tag will take you to our admissions community site.
Microsoft Inspiration Tour with Andy Sithers
/One of the people in this picture is a Microsoft employee. See if you can spot him. Clue: He has his eyes shut….
..and in case the other side of the room were feeling left out…
Andy Sithers from Microsoft came to see us today. We all went for a meal in Staff House, had a quick meeting with the Imagine Cup teams to discuss their entries (looking good people) and then he gave a presentation as part of the Inspiration Tour. Great fun. He dished out some hoodies and T shirts as prizes and then left me with some which I’m going to give the team that comes up with the best looking game idea to enter into the Game Design Challenge for the Imagine Cup. One of the hoodies that was left is XL, i.e. my size. Better get those ideas in before the end of the month folks, or I’ll have something new to wear…
Angry Rob
/I got very angry tonight. Banging the table angry. Not like me at all. Really. I was recording another in the XNA Screencast series (you can find the previous ones here). Normally I do the whole thing in one continuous take. That’s not to say that everything always goes right, it is just that I try and keep going whatever happens.
Anyhoo, this time I made a rather serious blunder, and was forced to stop and re-record a section which I then had to tidy up. Big mistake. The program I was using to prepare the screencast has an interesting foible on my machine. When editing things the mark points are never where you think they are. Whenever I cut out a phrase the program actually removed out another part of the soundtrack so editing just got more and more frustrating as I tried to compensate by cutting the “wrong” parts in the hope I would get what I wanted. I didn’t. In the end number one wife came in to find me thumping my desk with annoyance and told me I was being stupid, which I was.
Eventually I figured out that by cunning use of the undo command I could refine my edits to the point where I actually got what I wanted. And it only took me an extra hour or so. I’ve now resolved not to bash the desk any more. It doesn’t achieve much. And it hurts.
Resources from Rob
/A couple of new resource postings you might have missed:
- Find out how to load images into your Flash/Chumby programs here.
- Find out how to reset your TinyCLR Micro Framework device if it has got stuck here.
I’ve just about got my JSON serialiser working to send and receive JSON structured messages between the Micro Framework robot and another machine. When I’ve got the whole thing sorted I’ll post all the source. It lets you create message frameworks and then push status information between two systems.
Windows 7 Tablet Madness
/I think I’m on a quest to find the smallest and slowest computers around and then put Windows 7 on them. Latest contender is my venerable old Fujitsu Stylistic Tablet PC. One of the first tablet PCs ever, this boasts a mighty 800MHz processor and 512MBytes of ram. I had this idea that, in the absence of the iPad any time soon, it might be a useful handheld device that I could use to sit around and read Safari books on.
And it mostly works. I had a bit of fun when I installed the “proper” graphics drivers. For some reason it didn’t register the installation properly, and so I ended up with a machine with three or four graphics devices, which didn’t end well. And every now and then the display would go black because these drivers didn’t support the correct version of Direct X. I solved these problems by using the original Microsoft drivers, which means I can’t rotate the screen, but it works fine in landscape.

..and it works!
All the hardware apart from the tablet buttons works properly, even the WIFI card works perfectly. Performance could be better, but browsing is just peachy and I’m even thinking about putting Office on there so I can look at documents. I might even upgrade the RAM to a massive 768MBytes to get even more speed. I guess the lesson here is that you really can bring dead machines back to life with the magic of Windows 7.
York Laptop Shopping
/Went to York to do some shopping today. The weather was great for photographs. I took a quick bunch of the Minster and then stitched them together. The above isn’t perfect, there are some rather strange shadows here and there, but I’m still quite pleased with the result.
And we bought a laptop. We managed to get quite a powerful beast for dad with 4G of RAM, 500G hard disk and Windows 7 64 bit edition. All for less than 400 pounds. Which got me to thinking. This is the entry level price for the Apple iPad when it comes out in 60 days and 60 nights or so. Why would you want to buy something small and shiny when you could get something much more useful for less money?
I remember coming up with a similar argument against the iPhone when that came out. For the same money, I reasoned, you you could get a really nice little 3G SkypePhone, and an eePC. (You still can). Much more sensible. And yet the iPhone was a roaring success and I’m expecting the iPad to do just as well. People are going to use it and fall in love with it. A whole section of users (those who don’t really aspire to an all powerful computer) is going to appear and, having had what the iPhone offers, buy the same on a bigger platform. And number one wife quite fancies one too. Case closed.
Hull Graduation Congregation
/I did the warmup for today’s graduation day for students from our faculty. Thanks for being a great Congregation. It was a really good occasion and we had a lovely speech from our honorary graduate. I’m sorry that some of the pictures I took from the stage came out a bit more blurred than I would have liked, but you should be able to recognise yourself. There are much larger versions in Flickr. Click on the images to find your way to the pictures on there.
…to the right..
Left of stage
Right of stage.
Hull Students on the Road
/
Earlier this week a bunch of our students went off on a road trip to visit some game companies, including Black Rock and CodeMasters.
These are students on our game development courses, and it will be interesting for them because they will be meeting up with ex-Hull students who now work in the game development business.
I’ve just received this picture back from Alexander, along with a bunch of others. It looks like things are going well..
Andy Sithers from Microsoft Coming to Hull
/
Andy Sithers from Microsoft (the one in the front with the biggest brush) is coming up from Reading to see us next week.
He will be giving a presentation on Microsoft Technologies and talking about the Imagine Cup. And he might dish out a few freebies.
The presentation will take place on Wed. 3rd Feb at 2:15 pm in LTA in the Robert Blackburn Building. If you are up in Hull it is well worth the trip.



















