Travels with a GPS Logger

I'm writing some software which works with GPS. It is for the .NET Micro Framework book and will let you use a Micro Framework based device to log and display location information (assuming I can find a copyright free source of aerial maps).

Anyhoo, it occurred to me that I'm going to need some test data for the system so today, as we drove about East Yorkshire dropping people off and getting free food of friends and family, we took the Samsung Q1 with the Microsoft GPS sensor and a little program to capture the data stream. If you want to relive last night's epic journey from Howden to York you will soon be able to do this. Oh yes.

Micro Framework Sample Chapters

You may not know I'm writing a book (there must be some people left on the planet that I've not told yet). Anyhoo, I am. Writing a book. (makes a change from colouring them in I suppose)

The book is about embedded development using the .NET Micro Framework. This is something I'm very excited to be involved with. I reckon the framework could do wonderful things for the process of writing code for very small processors (the kind you find in remote controls and other small computer controlled devices). It makes embedded code more reliable and easier to write. Wonderful stuff.

If you want to read bits of the book before it gets printed, and even pass comment on them, you can take a look here.

XNA Launch Event

We got up nice and early and headed for the university. Unfortunately, thanks to traffic, we were a bit later arriving on campus than I wanted, but still in time to do a bunch of interviews for the press.

The morning talks were all about how the XNA technology works and how it fits into to the games industry. The answers, by the way, are very well and very well. It is really easy to use and, whilst not yet applicable to "top of the range" games is going to find increasing favour in the games industry as they come to terms with just how much easier it makes things.

Then it was lunch, another interview, and then time for my bit. The talk seemed to go OK, the audience were polite enough to laugh at most (but not all of) my jokes. You can find the presentation, complete with clip art, here.

Then Peter Molyneux gave his session. Which was excellent. The most important thing that came out of his talk was the emphasis that he places on communication skills. You should be good at your part of the game production process. You should be brave enough to take your ideas and champion them passionately. But you also need people skills. If you can't persuade, argue, admit when you are wrong and keep as many people happy as possible during the rollercoaster ride that is game development then you are going to have a hard time. That was very good to hear. At Hull we push those aspects of professional development very hard indeed, and it was good to hear one of the best game creators in the business echo them for me.

We even made the BBC News.

And then we got in the magic bus for the trip home.

322105529
One of these students has won an XBOX 360 at the XNA launch event. Can you use your powers of observation to discover which one?

Pitch me a Snake

I've spent a very happy day in the labs marking student work. Normally I hate marking. Exam scripts send me into a cold sweat. But this was much more fun. Rather than dead trees I was looking at live code. Each of our students in the first year was given 15 minutes to pitch their Snake game. And there have been some super ones. We are going to open up the "wherewouldyouthink hall of fame" and put some of these programs up there for download. Great stuff.

Next semester we are going to take the snake game and move it onto an XBOX. And I reckon we will be the first people in the world to do this in an undergraduate course at first year level.

Ed Gibson is "The Man"

Today we went up to Bradford for a rather special talk. The folks at Black Marble arrange seminars for IT professionals (you'll never guess who's giving the next one) and today they had managed to get Ed Gibson over to talk about Computer Security. Ed is quite a chap, an ex FBI guy who is now Microsoft UK's chief security advisor.  So a bunch of students and myself boarded a magic bus to Bradford.

We were lucky enough to meet up with Ed. before the talk. Thanks to my super advanced planning I managed to get everyone to the venue around 90 minutes early, and so we had plenty of time to sit around a roaring fire in the hotel bar and chat. Ed turned up and the first thing he did was buy everyone a drink. My kind of guy.

Then, after some superb sandwiches courtesy of Black Marble it was time to get down to the serious business of the evening. And it is serious. Ed has been there, done that, and told us some truly scary stories. For me the most interesting thing that emerged from his talk is that the computer fraudsters don't want your bank details. They want your bandwidth. If they can get enough machines on the net under their control they can pretty much take down any server, anywhere. Unless you pay them big money.

At some point we will have laws that extend far enough to catch the perpetrators and enough systems out there hard enough to resist the attacks that can turn your home PC into an agent of the bad guys. However,  until then the rule has got to be keep your system up to date. Don't think of computer crime as a "soft" crime with no real victims. The people who do it are in there for the cash, very organized and totally ruthless.

Ed made some good points on a broad canvas. The speaker that followed him zoomed right down into the low level detail. He showed how breathtakingly easy it is to attack a system. One of my programming rules is "build yourself a nice place to work". What I means is make sure that it is very easy to create, build and test the systems that you are writing. It never really occurred to me that hackers would do the same.

We were shown a tool which used SQL injection (basically a way of putting database commands into the text you feed into a web page) to stripmine entire company databases. I knew about the technique, but I never thought there would be such advanced tools for this kind of thing. The next thing that we were shown fair took my breath away. It involved changing the way that the .NET Framework itself works.

Imagine that a developer has got some permissions set on a program. And they want to stop users from pressing certain buttons on certain screens. The Forms library that ships with Windows will do this for you. With a simple property change you can disable a button. If the button is disabled it turns grey and the user can't press it. Job done.

Unless someone changes the guts of .NET so that this property change no longer works. By just changing one particular byte in the right library file a nasty person who has access to your machine can make every single button work all the time. So simple, sooo scary.

Admittedly you'd have to do something rather stupid to let someone else run their program on your machine in the first place, but the result of this is that even securely written code can now be totally banjaxed by being hosted on a corrupted system. Amazing stuff. Simple yet brilliant. And a very worthy follow on to the talk from Ed.

This was a superb evening. Kudos to Black Marble, Ed and his associate (who's name I've forgotten I'm afraid). All the students had a great time, with some pretty deep conversations on the bus on the way back. This was the first Black Marble event I've been to. It will not be the last...

And with that, I'm just going to update my virus scanner...

Robs Laws

I was talking in a Software Engineering lecture today about "Rob's Laws" amongst other things. I think it is time these were finally written down.

  1. Any given computer is too slow. No matter how fast you think it is when you get it, after a while you will think it is too slow.
  2. Any given project will take longer than you think. Even (or especially) if you allow for this. The only exception to this rule is a project you won't get paid for, or one where you have massively misunderstood the requirement and are therfore doomed.
  3. A program that is useful will have bugs in it. The only programs that can be proved to be correct are too small to do anything that you might want.
  4. A highly successful, fully working, system which contains hardware components will just about always have a massive "kludge" somewhere in the middle of it. This is the bit that has to be there, otherwise it won't work. Nobody will completely understand why it has to be there, or what it does, but they do know that if you take it out the system stops working.
  5. A customer will never ring you up and tell you their program is working fine. Never. If the phone rings, it is always bad news. Silence either means they haven't got round to testing it yet, or it is working fine. At the point where you think it has gone quiet for long enough for it to be definitely working the phone will ring and they will tell you they've just got around to testing it and have found something they don't like.
  6. As soon as you assume something about what the customer wants you are doomed. For sure.

A Peek at Office 2007

Yesterday I took my life in my hands and upgraded from Office 2003 to Office 2007. Of course I had a backup. Of course...

Anyhoo, unlike the move to 2003, where on the surface things were pretty much the same as before, when you go to 2007, your whole world changes. The file menu has gone, and in its place you have an Office Button which sometimes glows for no reason that I've been able to establish.

In use I'm reminded of when I got to use a posh SLR camera many years ago. The arrangement of the controls seemed rather arbitrary and counter intuitive. Until I started using it. Then I found that the buttons and levers were actually just where you needed them. Someone who knew a lot about the business of taking photographs had put the features on the hardware in just the right way.

Office 2007 is very like this. After a while you find that commands you used to use a lot and had bother finding (undo and the Format Painter in my experience) have been made big, bold and easy to find. The grouping of tools into particular tasks makes it much easier to find what you want to do, and encourages you to try things that you hadn't seen before. I've only used Word and PowerPoint, but they are shaping up very well.

So far I only have one major grouse. Like most people, I use Styles a lot. Therefore I was pleased to see that Styles have been given an overhaul, which much better preview and the ability to sort the list of styles into alphabetical order. Finally.

However, there is one thing which they do seem to have got wrong in a big way. In the old Word you could click on a paragraph and the style of that paragraph would be instantly displayed in the toolbar. In the new Word the styles are shown on a kind of rotating panel which is good because you can see more than one and easily select from those available. But they don't automatically change to show you the style of the paragraph you are presently typing.

Even if you get a full list of the styles on the screen this still doesn't help if the style you are using is not on the part of the list you can see. So when I'm typing there is frequently nothing telling me which style I'm presently using, and I really hate that.

For me this is a major step backwards and almost, but not quite, negates the good things that they have done in this area. Perhaps there is an option you can select which will make this work better. I certainly hope so.

I'll write more about the shiny new bits as I find them.

Put some magic into your life

298266118
Now you can have one....

My all new "Magic Message System" is now available for download. If you've ever wanted a message system as good as the one in Computer Science at Hull University then you can have one... For now. I'm going to make it play videos and do 3D next. And I might not give that version away......

Because it uses Windows Presentation Foundation you will need either Vista or XP with .NET Version 3.0 installed.

So, what does it do? Well, it will display a slideshow of your Flickr pictures and at the same time read messages off an RSS feed reader of your choosing. We are going to use it on our plasma screen in the meeting area.

You can find it here.

One Day and Counting

298266118
Now I just need to add the movie playback...

My wonderful new Message Display program has now managed to keep going for a whole day. It is my first ever Windows Presentation Foundation (WPF) program and it is running on Windows Vista RC2 on the machine in my office all hours of the day and night.

Since the real thing is required to run for weeks, and any failures of the system will be very visible (and therefore highly embarrasing) I've embarked on this soak test. The program is running in "dog time" (i.e. around seven times faster than it should) so that the results are better than realistic. Later this week I might dare to go live with it on the big plasma screen.

Make your own jigsaws

249244108_ef4b99b2b5.jpg
My first ever test..

Moosaic lives! I'm about to embark on a new project and so I'm going round finishing off some old ones. And the first result of this is that you can now download my Moosaic program. This lets you create image jigsaws out of your Flickr pictures and then get them printed onto little bits of card. Fun for all the family and just in time for Christmas..

Find out more here.

Danger at 300 feet

Well, I'm back home now. The conference was great fun. You can see a video of me here.

The trip back was slightly enlivened by the landing process, which seemed to involve a bit more going up than I remembered from previous flights. Then the captain came on and said that a warning light had come on concerning the undercarriage as we were making our final approach. However, not to worry because he had done the aeronautical equivalent of bashing the dashboard of the plane and things were fine now...

Although it was a bit disconcerting to find all the fire engines lined up alongside the runway when we finally touched down...

C# 3.0 and Stronger Magic

Warning: This is a techie heavy post. If you are after witty prose and belly laughs then I suggest you look elsewhere (but then again - what are you doing here in the first place).

Just been to the presentation by Anders Hejlsberg about what C# will be doing in the future. I took a bunch of notes on the mobile phone which I've tidied up to post here (apologies for typos and spelling errors that got through):

Extensions

You you can add a method to an interface. Then any object that implements the interface can use the method. Extension methods are brought in with the interface by means of a using statement. You can add them to classes too. Serious potential for stupidity/confusion here but also a lot of power. What I call a Spiderman situation (With great power comes great responsibility).... You may end up leaving the impression that your extension is part of C# itself. I wonder if anyone has thought about colour coding the intellisense?

Talking of Intellisense (the bits in Visual Studio which suggest what items you might want to enter at a given point in the code) it seems that it is now part of the language design in that there is an inherent assumption by the language that it will be there for the programmer.

Var

The var keyword lets you simplify the deceleration process. The type of the thing that you are making is inferred from the type of the expression on the right. In this respect it smells a bit like the dim statement in Visual Basic, but there is a bit more to it than that. It underpins a general principle that you can manipulate items for which you have not specifically created a type, but from which the compiler can infer the required information to make sure that your code has integrity.

Lambda Expressions

Lamda expressions let you pass code as a parameter to a method. Sometimes you need to tell a method what to do. In C# you usually need to create a delegate type which you then point at a method which does the job. With a lambda expression you can put the behavior right in place. There is no need to make a delegate.  

Object Initialisers

Object initialisers let you set initial values during declaration of an instance. Can also initialize collections.

Expression Trees 

These are scary. They let me manage code as data. The compiler will produce the tree based on a lambda expression it is given. It ends up as a bunch of atomic actions which you can pass around as data. You can also modify the tree or produce one of your own from scratch. You can also compile these into IL or use them to make things like SQL statements. This is how we get our C# program code mapped into database queries for the Linq stuff.

Automatic Properties

Not sure about these, they just seem to save you typing. They let you create properties directly without needing to produce the get and the set right at the start. Must have both get and set, but you can make set private if you want a read only property. You can also put real methods in later.

Linq Database Access

This is perhaps the jewel in the crown of the C# upgrades. Query expressions use context sensitive keywords to map the query into method calls. This happens during compilation. Linq uses lambda expressions to denote the selection criteria. 

A query result can deliver a result as an  anonymous type (created based on the context of the result required). Because this class implements things like IEnumerable (so you can work through it) you can use the var keyword to create variables to work on the data. C# will be able to infer the required type. This means that you don't need to create loads of classes just to deal with query results.

There were some good code examples which show how queries are mapped onto code. And the other good thing is that if you download the whole thing and play with it yourself.

You're Using a Q1 for that?

Last presentation of the day found me at a talk about the use of ink in Windows Presentation Foundation. This was a lovely presentation, not least because of what the speaker was using to run all the demonstrations.

He was running big chunks of the show on a lowly Samsung Q1. This is an ultra-mobile PC which you can just about fit in your pocket (if you have a big jacket). He swore that, over and above some slightly fancier hardware for the pen, his was a very standard machine, with only 512Mb of ram. Notwithstanding these limitations it proved quite happy to run all the demos, including the 3D one at the end, as well as Visual Studio, all sitting on top of Windows Vista.

This left me determined to put Vista on my Q1 when I get home. I don't have the fancy touch screen stuff, but I do have an extra 512Mb of ram, which should be interesting...

The talk itself was about how Windows Presentation Foundation supports ink. Unlike the original Tablet PC, which was forced to shoehorn ink in alongside all the other user interface gubbins, with WPF ink is an equal partner as far as the programmer is concerned. Couple this with the fact that all the WPF pages are rendered as vector items (no nasty size dependence and infinite scalability) and ink starts to look very viable in the future.

Qn: When is a protocol stack not a stack?

Ans: When it is a "framework".

Had a very good talk about Windows Communication Foundation.

This is the means by which software shall talk to software in the future. And jolly good it is too. For me the most impressive thing is the way that they have used the features of C# (interfaces, attributes etc) to make it easy to set up connections and select the components that you want to use in any given situation.

When I was a lad there was much talk of protocol stacks. I even wrote a song about the ISO/OSI seven layer stack for one of my world famous lectures in rhyme....

But these days things have moved on, and now the talk would seem to be of "frameworks". I think these are a bit like stacks, but laid on their sides and with the ability to have extra bits (like security and compression) plugged in alongside.

It does seem very easy to link two process on the same or different machines and it looks as if this technology will make a lot of hard wraught code redundant as it takes away a lot of the difficulty in linking programs together.

Windows Presentation Foundation Fun

Just been to a presentation on Windows Presentation Foundation. This is the thing that I've been using to write a message system for the department. I thought I'd go along and find out how the grown-ups do it.

The answer is "Very well indeed". I was kind of pleased to find that my basic understanding of the way things work (describe how it is going to look in one file - the XMAL and what it does in another file - the DLL) was pretty much right. However, what really blew me away was how far you can take this stuff in skilled hands, and with the right tools.

It also opened my eyes to the potential for 3D and so the message system might be going to get even prettier. And something else that I'm going to find out more about is the statement that WPF is going to be available for mobile devices. That, my friends, is seriously interesting......

Customer Impressions

I love my job. Today has been uber busy. Updating the XNA presentation, giving a couple of lectures, attending a mid-semester review meeting with the second year (we had loads of students turn up - and some really good discussion about how we do what we do).

And acting as a customer in our Software Engineering project. At first I was not looking forward to this. We usually try to get people to do this who the students doing the work are not familiar with. I've been giving lectures to this group for a while, and in this respect I'm quite well known.

But for the project I have to be "just a customer". But actually it is quite fun. Some of the people who have come to see me have asked jaw droppingly sensible questions that I would not have thought of asking if I was doing the job, which is great. And I quite like being unhelpful and uncommunicative for a change. At least, I think it is a change......

I hate Microsoft

I had all the slides ready for my talk at TechEd 2006 in Barcelona. I'd even scheduled a presentation today so that I could preview the material to the students on our MSc course. Everything was ready. What could go wrong?

Well, what went wrong was that the Microsoft XNA team were too darned efficient for me, and released the second beta of the XNA Express yesterday. What's worse, they've fixed a bunch of issues that were irritating me and also made the Content Manager bit work so well that I just can't ignore it in the talk. I hate them all.

Because I have no intention of standing up next week and saying a whole bunch of stuff which is out of date or plain wrong it has meant that I've had to spend a big chunk of last night and this morning updating the slides and the sample code.

The good news is that the talk seemed to go OK (although I'm going to tighten it up just a bit) and that the sample game, "Hot Salad Death with Cheese" went down quite well.

287922640
Next stop Spain.

Web Tools to Ruin Your Life (and improve it)

One of the students put me onto something that is going to keep me amused during lunch hours for a while. It is called StumbleUpon, and it is an add-in for Firefox or IE which suggests funky web sites that you might be interested in. You assign a bunch of categories that you like and then press the Stumble! button. It then takes you somewhere you might find interesting. When you get there, you can rate what you see so that other people can find it later. Great fun and highly unproductive, in that I can see myself spending hours with this thing. Within minutes I had found this link. I'm sure there are thousands of others.

But if you want to use the interweb to improve your life productivity wise you should really take a look at del.ico.us. Stupid name not withstanding it is actually massively useful. Again, it installs buttons on your IE toolbar, but this time it lets you manage and tag web favourites that you find. When you find a site that you don't want to forget (perhaps one you Stumbled across) you press the "post to de.lico.us" button and it then lets you enter tags for the link. It also shows you a "cloud" of existing tags so that you can easily find related sites. Very useful. You can see my tags here.