Cars that never made it

These names were not dreamed up in a Staff Meeting. Oh no. I spent the entire time paying careful attention and making copious notes.

The Ford Caveat: "The car with the hidden surprise"

The Fiat Scenario: "The car that sounds like a great idea"

The Renault Gravitas: "For the driver who wants to boost their presence"

The Seat Ulterior: "You'll never really know why it just did that"

Indiana Jones and the Kingdom of the Crystal Skull

2592031503

Tonight we went to see the latest (and probably last) Indiana Jones movie. It felt like this is one of those films that you are obliged to go and see and so we went and did our duty. At the end of the day I reckoned that it was a proper Indiana Jones movie (but then again I watched some of the originals recently and formed the same opinion about them).

Much has been made made about the directors' determination to use "real" special effects rather than the inferior computer generated ones. This approach seems to have extended into making the CGI effects that they did use look rubbish, one or two sequences would have looked bad in a computer game. And some of the model work was so obviously a model that they didn't need to add a trademark camera wobble to give the game away as they panned over it. But they did.

And for a movie produced by seasoned professionals the continuity was very bad. I'm not very good at noticing things. Just ask number one wife after she has had her hair done. But even I spotted the way that the sauce bottles mysteriously stood themselves back up again in the diner scene.  All this served to detract a bit from the lush locations and expansive musical score.

At the end of the day, as I always say, "If you don't like what it says on the tin, don't open the tin". This was always going to be a big, dumb, action movie with one or two good set pieces. I don't think anyone has a right to ask for anything else. If that is what you want, you'll love it. Like I did.

Loading Web Pages

I don't usually put up techie pages with code in them, but today I present something that I think might be useful and I've not found anywhere else. It is part of my RSS reader for the XNA display program, and it solves a couple of problems that you might hit. My feed reader needs to read feeds that are on a password protected site, and it also needs to read feeds that are compressed. This method does both:

private StringBuilder readWebPage(
    string url,
    string username,
    string password,
    string domain)
{
    // used to build entire input
    StringBuilder sb = new StringBuilder();

    // used on each read operation
    byte[] buf = new byte[8192];

    try
    {
        // prepare the web page we will be asking for
        HttpWebRequest request = 
            (HttpWebRequest)WebRequest.Create(url);

        if (username.Length > 0)
        {
            request.Proxy = null;
            NetworkCredential credential = 
               new NetworkCredential(username,
                                     password,
                                     domain);
            request.Credentials = credential;
        }

        // execute the request
        HttpWebResponse response =
            (HttpWebResponse)request.GetResponse();

        // we will read data via the response stream
        Stream resStream;
        Stream inputStream =
            response.GetResponseStream();

        // Might have a compressed stream coming back

        switch (response.ContentEncoding)
        {
            case "gzip":
                resStream =
                   new GZipStream(inputStream, 
                          CompressionMode.Decompress);
                break;
            case "":
                resStream = inputStream;
                break;
            default :
                debugOutput.PutMessageLine(
                    "Invalid content encoding: " +
                    response.ContentEncoding + " in: "
                    + url);
                return null;
        }

        string tempString = null;
        int count = 0;

        do
        {
            // fill the buffer with data
            count = resStream.Read(buf, 0, buf.Length);

            // make sure we read some data
            if (count != 0)
            {
              // translate from bytes to ASCII text
              tempString = 
                Encoding.ASCII.GetString(buf,0,count);

              // continue building the string
              sb.Append(tempString);
            }
        }
        while (count > 0); // any more data to read?

        return sb;
    }
    catch (System.Net.WebException w)
    {
        debugOutput.PutMessageLine(w.Message);
        return null;
    }
    catch (System.Net.ProtocolViolationException p)
    {
        debugOutput.PutMessageLine(p.Message);
        return null;
    }
    catch (Exception e)
    {
        debugOutput.PutMessageLine(e.Message);
        return null;
    }
}

This is not very elegant code, but it does work. I've pulled it straight out of the program and so there are a few things you need to know. I have a class called debugOutput which I use to send messages to the user. You either need to create one of your own, or remove those lines. If you need to use a username and password you need to add those to the call, otherwise you can leave those fields as empty strings.

Mending Headphones with McDonald's Straws

I got some Ultimate Ears headphones a while back. They sound wonderful. However, they have a little problem which has been causing me grief recently. They use an "in ear" design, with a tight fitting plug which goes inside your ear so that all the sound comes your way. Nothing wrong with that, until the plug bit starts to come off and stay in your ear when you try to remove the phones. I think this is caused by the rubber stretching slightly and becoming slack on the fitting. Whatever causes it, I don't like it as it then leaves me picking bits out of my ear canal, which doesn't look very cool.

Anyhoo, I've fixed the problem by the use of some drinking straws from McDonalds. I've put them around the outside of the rubber sleeve that goes over the headphone bit. This stops the sleeve from stretching quite so far, and makes it fit really tightly. I don't think it is the kind of thing you can get the Nobel prize for, but it works for me.

2577991277

Earpiece with straw power

Oh, and while we are in a McDonalds mood, don't the drink lids look a lot like faces?

2578823268

Scary face or coffee cup cover? You decide.

"Upgrade Your Life" by Gina Trapani

Now here is a book I really do like. Generally I avoid "self help" books, seeing myself as mostly beyond help - especially from myself. However, having spent a while last week in the Tech-Ed bookstore reading this one and trying to make mental notes of all the good tricks presented in this book, I eventually cracked and bought a copy. And it is jolly good too.

It is broken down into chapters that deliver tips to improve your life. It starts with email and then move into data organisation, using the web effectively and even how to motivate yourself to get work done. None of it is really rocket science I suppose, but you have to know these things to be able to use them. For example, I didn't know that Outlook has an option that lets you display all email sent only to you (as apposed to a list with you on it) as blue. (Tools->Organise->Using Colors). You can also flag messages from different people in different colours.

You can read the book from cover to cover and try to remember everything, or you can dip into it at random in the sure knowledge that you will learn something useful. The content is based on material presented over the years at lifehacker.com and covers Windows and Mac platforms, along with good old common sense.

Great stuff.

"Microsoft 2.0" by Mary Jo Foley

Whilst I was at TechEd last week someone gave me a free copy of "Microsoft 2.0" by Mary Jo Foley". It is supposed to tell me "How Microsoft Plans to Stay Relevant in the Post-Gates Era". I'm not sure it does.  I summarised it as follows:

  • Bill Gates is leaving Microsoft and other people will be doing his job
  • The Future for Microsoft is complicated, and almost certainly not the same as The Present

There is a lot of background on the people at Microsoft, which stops just shy of being libelous in some cases. There is some detail on products and where they might be going in the future which you can pick up more easily (and in an up to date form) on the web. There is a a fair bit of repetition. And more than a few errors. The Xbox 360 has never suffered from the "Three Rings of Death" - that just sounds like a very dangerous circus. And Microsoft didn't actually manage to buy Yahoo that I recall...

Each page has big callouts on it, presumably designed for high flying types who don't want to read all the text (and it also reduce the number of words required to fill the 283 pages). My favourite is on page 191 "Microsoft must avoid several obstacles as it moves from the old way of doing business to the new." Yeah. Right.

I did not like this book much, and I got it for free. If I'd paid 29 dollars for it I would be rather cross. Perhaps the detail was lost on me, or perhaps I already know a fair bit of what was being said. Either way, take a look at the text before you part with any cash.

.NET Micro Framework Hardware

If you want to target real hardware with your .NET Micro Framework programs you will need to obtain a device. I pulled this information from the .NET Micro Framework pages on MSDN.

Developer Kits

Crossbow Technology WSN Developer Kit

The Imote2.Builder Kit includes everything you need to create wireless sensor networking applications, including three development boards with embedded radios and two sensor boards.

Digi Connect ME JumpStart Kit for Microsoft .NET Micro Framework

The industry’s first Ethernet networking solution for .NET Micro Framework. Digi JumpStart Kits are a new breed of development kits that make it easy, fast, and economical for engineers to develop network-connected devices.

Device Solutions Tahoe Development Kit

The Tahoe Development kit, featuring the Meridan CPU, allows for experimentation, evaluation and just plain fun, while slashing the time it takes to transition from prototype into production.

Freescale i.MXS Development Kit for SideShow

Freescale's high performance i.MXS Development Kit supports .NET Micro Framework applications.

GHI Embedded Master Development System

The Embedded Master includes FAT file system and USB host support, in addition to Ethernet, CAN, and other connectivity options, to provide everything you need to get started developing small devices.

SJJ Embedded Micro Solutions EDK

Includes a multipurpose development board with the .NET Micro Framework installed and ready to run C# applications. Suitable for a wide variety of embedded applications, the EDK is ideal for engineering students, hobbyists, and OEMs of small devices.

Home, with Added Jetlag

We thought we were coming home to chill out in "Cool Britannia". How wrong we were. England is very hot and, allowing for the fact that nobody here has aircon, less comfortable than Florida. Special thanks must go to Manchester Airport for taking over an hour to serve up our luggage, and Airparks Gold, for only having one working bus ("Really funny story" said the man, "The gearbox broke on one, and the other burst a water pipe...") and taking an extra hour to get us to our car.

Final TechEd Sessions

Today I went to my final two sessions at TechEd 2008, which is rather sad. I really love these conferences. I only have to get a whiff of brand new nylon carpet (which they must use loads of) to be transported into a world of name badges, backpacks and session planning.

The first session I went to was by Jonathon Kagle who was doing something rather uncharacteristic for a Microsoft Product Manager. He was lifting the lid on the next version of his product, .NET Micro Framework 3.0, and even inviting comment and discussion. He has put a really good post onto the Micro Framework blog describing what is coming down the tracks, believe me it is good stuff.

One of the great things about the Micro Framework team is that they are staying true to their roots. Some products get kind of bloaty and feature creepy as they get older. Stuff gets added which might be useful in some contexts, but not all, and the whole thing gets larger and more complex as time goes by until it becomes less useful with each release. I'm a bit worried about C# 3.0 in this respect, stuff has been added which I don't really see the need for.

This is not happening with the Micro Framework. Version 2.5 actually has a smaller memory footprint than 2.0, as the team have got better at squeezing quarts into pint pots. At one point Jonathon said that they had actually figured out how to add generics (a very useful but by no means essential part of C# 2.0) to the framework but that this would have added around 17K to the memory footprint of the platform, with no easy way to disable it.

That amazed me for two reasons. The first is that someone managed to get generic support into the runtime in 17K of code, the second is that 17K is a tiny amount of memory. Less than a full stop in this text is taking up on the screen. However, in the context of a platform that needs to be able to fit into 400K or so, it is big deal, at around a 5% increase. So they left it out. The Micro Framework will now fit onto a single chip microprocessor (a single 9mm square chip). Amazing.This platform just gets better and better.

The next session I went to was about Linq, which is also amazing. The reason you go to TechEd is to find out things that you'd never get hold of any other way. Like PasteXmlasLinq. You can find it in amongst the samples provided with Visual Studio 2008. For me it was  C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033\CSharpSamples.zip\LinqSamples\PasteXmlAsLinq.

This does exactly what it says on the tin. it converts a file of XML into the Linq code to produce that XML output. it provides a magical way of taking an existing lump of XML and getting code that will write it. So rather than having to mess around with writing elements and building up the structure the hard way, I can just paste the XML source into Visual Studio had have the code written for me. You have to play with it to believe it. If you have any interest in the use of Xml you should know about Linq. In fact, if you work with data in any way (even if you are not even using a database, just objects) you should know about Linq. Dan Fergus, the MVP who gave the talk did a first rate job of showing the power of Linq, and how you can use it to good effect on a mobile device.

TechEd Party Time

Imagine a theme park where the queues for the rides are around 10 minutes, all the food and drink is free, and there are people wandering around just giving you stuff. I don't have to imagine this (lucky me) because I've been to the TechEd 2008 party. It was at Universal Studios, which was nice because we got to go on the brand new Simpson's ride, which is ace by the way.

2557544566

Entering the park.

2557545118

Invasion of the nerds....

2556723335

The Simpson's ride is quite a big deal, and great fun.

2557546570

...indeed it does

2556723367

The end of a perfect evening.

The .NET Micro Framework in Action

Today I went down to the Hands On Lab area at TechEd and had a go at the Micro Framework lab, just to see what it was like. The first exercise was to drive an LCD panel from a Micro Framework device....

2557543376

Shameless .NET Micro Framework promotion....

Then it was on to building a little burglar alarm controller. Great fun. And the lab section was enormous.

2556720635

We think our labs are quite large at the university in Hull, but this is just silly....

2557544286

In fact the conference itself is just plain enormous. This is one part of one part.

If you want to find out more about the .NET Micro Framework, including devices and how to get hold of the development kit you can go to their site on MSDN. They also have a very active blog.

Superb Micro Framework Book

There is already one superb .NET Micro Framework book available (the one wot I helped to write) but now there is another.

Expert .NET Micro Framework by Jens Kuhner is excellent. It is written for those who want to really find out how to use all the features of the framework.

Whereas our book is more of an introduction to the field the Expert book, as the name implies, goes into more detail on the various class libraries and how you can use them. It also has the benefit of having been published a year or so later, and so has more up to date detail on the platforms that are now available. The people "lucky" enough to be at my session yesterday all got a free copy of the book (which really put a spring in their step) and they will find it very useful.

If you are serious about the framework you should get this book. If you are not serous about the framework you should this book and become serious about it.

Sessions and Very Silliness

Well, I did my session. Thanks to everyone who turned up. I enjoyed doing it and it was nice of you to all laugh in the right places. For some reason (perhaps because this was my first "proper" TechEd session (last time it was a lunchtime session) I was a lot more nervous than usual, even to the point where the brain went blank and I forgot that the word for pin is "Pin" when typing in the demo code. Such is life, I did manage to make it work at the end and I hope that everyone who turned up got something out of the talk.

mysession
My name in lights, still can't quite believe it

After the talk I went down onto the exhibition floor to catch up with the .NET MicroFramework crew. There seem to be loads more devices and configurations now and it is great to see the platform progress. If you have ever thought "this hardware stuff is too hard" then please remember that in this case the clue is not in the name. Hardware can be easy, and the .NET Micro Framework is a great way to start making code really do stuff. 

TechEd 2008 Orlando 184

Loads of toys!

Then I went on to meet up with Dan Fernandez, who wanted to do a video interview for the famous Channel 9. We spent some time chatting and got on so well that I unbuttoned my serious speakers shirt to to show him the very-silliness of the T shirt beneath. When the video is up on the site I'll post a link so you can revel in my embarrassment.