Running Windows 7 for Fun and Profit

At the PDC last week we all got given "The Goods", in the form of a hard disk full of software and a bunch of dvds with Windows 7 on them. They are heavily marked "For testing purposes only" since we are some way from a Beta release of Windows 7 and you really aren't supposed to use the system for real work.

I thought I'd give it a go anyway. So tonight at 7:00 pm I started an upgrade install on my main Vista machine. I didn't go for a clean install, life's too short for re-installing all those applications. At 10:30 the upgrade had just about finished and I was able to get my first flavour of Microsoft's new system.

It works. It works fine. I'm using my MacBook (which might make for interesting times if I ever try to boot back into OS X) and all my hardware has been detected with no problems. Since the current test release is based on Vista I wasn't expecting driver trouble and so far I've not had any. Setting up the monitors was a bit fiddly, but I soon managed to get them arranged how I like. And after a slight kerfuffle with the login for Outlook I've now got a very good place to work that does all the things it used to.

The whole machine seems a lot more zippy, with applications opening much more quickly and running very well. I've not really had much chance to play with any of the new features, but I don't think I'm going to have a problem living with this test release. If you were at PDC and are thinking about putting Windows 7 on your machine I'd say go for it.

Head in the Clouds

Sorry for the title. I find cloud computing quite easy to poke fun at. In fact:

"Are clouds the ultimate form of vapourware? And if is called Windows Azure, surely that's the colour of the sky, not the clouds? Shouldn't it be called something like 'Windows White and Fluffy'".

See. Easy. Although after the sessions today I think it is probably a bit unfair.

I was up very early, almost in time to catch the third bus to the conference centre.

2981235018

This scene was outside the hotel at 7:00 am this morning. I think it sums up the American Dream quite nicely.

But enough of this, the keynote started at 8:30 and so after a very nice breakfast it was down to the really big hall.

2980380295

This is just part of the Hall.

Ray Ozzie took over from Bill Gates earlier this year, and this was the first time that he had flown solo so to speak.  He was very good, describing his vision of computing that is just "out there" very well. I'm less convinced by the sample application that they chose to first articulate this vision though, the BlueHoo social networking app that lets you find out if anyone around you is someone you know - I kind of high tech, Bluetooth powered, cloud network,  version of looking and shouting.

But that aside, the underlying thinking seems very solid, and when I heard that one of the people behind the cloud architecture was Dave Cutler, the man who made Windows NT all those years ago, I was much more interested. Windows NT is the basis of the technology that sits underneath all the Windows desktop and server platforms.

2981236454

Ray on the stage

Whether or not cloud computing is the next big thing is debatable, but you can't deny that it is big. What Microsoft want to do is provide a means by which you can take code that you have written using conventional languages and tools and put it up on their servers so that anyone can use it, from anywhere in the world. And if millions decide to use your program, they can - because the underlying system will handle the distribution of the software around the world and the balancing of the load on the various servers.

Of course horsepower on its own is no good to you, there is also a need for data stores of various kinds. from blobs of data to SQL databases. And all this must work in an environment where systems crash, networks fail, and bad people are out there trying to break things all the time.  Tricky stuff.

If Microsoft can pull this one off they will really have moved computing onto the next stage in its development. The architecture and the way you manage your programs seems very well thought out, although they admit that the system will be a "work in progress" for a while yet.

As far as I'm concerned it is all very exciting. People write software so that others can use it. The cloud means that if I have an idea for a million user, killer application - say I want to write the next MySpace - then I don't have to worry about getting server farms, buying network bandwidth and hosting all the user's data. I can get just put my application out there on the cloud behind a network address for people to use.

Of course money will have to change hands. Microsoft will want me to pay them to host my software, but this payment will be based on the use of my program. I only have to pay for the services that I consume. I'll pay more if I have more users, but since the more users I have the more income I should have then it all comes out OK in the end. This is a new business model that anyone who writes programs that provide services to others will have to take note of.

The thing that really does it for me though is the way that I can now take C Sharp and Visual Studio and write code for thumbnail sized computers to control my Christmas tree lights or go all the way to the other end of the spectrum and turn out an application for millions of people to use. All with the same essential skills. 

I went to a few more talks on Windows Azure as it is now called, and I must admit it looks good.

And I'm feeling a bit guilty about poking fun at it.

Hull Computer Science Twitter Feed

We now have an experimental Twitter feed for the department at Hull. This will be used for sending out messages as a supplement to the RSS news feed that we run internally. You can find it here:

http://twitter.com/HullCompSci

Since Twitter has an API I was thinking of writing a program that reads an RSS feed and tweets any item under 150 characters in length to twitter. This would make it a completely automatic extension to our message system. Does anyone know if this has been done already? Does anyone fancy doing it?

Oh, and you can follow me on Twitter at:

http://twitter.com/RobMiles

I'm not a very good twitterer (or is it twit?) to be honest, I have enough problems thinking of something to say in daily blog posts, but if you want to follow me you are more than welcome.

EverNote is Neat

If you do anything that involves holding little bits of data and then using them from wherever you happen to be you will probably find EverNote useful.

It is a "cloud" application that lets you lob pictures, notes, web links, bits of files and whatever onto a central storage location that you can then access from your PC, Mac, browser, Windows Mobile device or iPhone.

It has some nifty search facilities, even being able to pull handwriting out of images you have captured as notes and then use them as search keys.

It seems to work really well, and you can use it for free if you don't want to upload much content. Even the paid service is not bank breaking, at $5 a month.

Whether you are studying on a degree course, running a business or just going shopping I reckon that it is well worth a look.

Software Design

I'm still writing stuff that is intended to teach programming. Great fun,but very hard work (apparently). I'm up to the bit where I'm trying to make a game more interesting.

BlockBuster
..but how do you detect when all the red bricks have gone?

I am recreating a game I first made many years ago in Lucidata Pascal on a South West Technical Products 6809 based microcomputer.  It is a simple breakout clone with one or two interesting touches as you go through the game. Apparently it was responsible for a lot of lost time in the Psychology department at the time I wrote it, because they had the same computers and spent ages playing it. Chris used to spend entire lunch-hours on it, holding a ruler against the screen to line up really tricky shots....

Anyway, I digress. The place we've got to is where we have a row of blocks and a ball, and we can destroy the blocks with the ball. It gets a bit boring when all the blocks have gone, so our program must detect when the last block is removed. There are essentially two ways you can do this, you can keep a counter of blocks that are left and reduce it each time you remove a block, or you can look through the blocks and see if you can find any which are still visible. But which is better?

Keeping a counter has the virtue of simplicity and makes the smallest program. However it also adds a counter variable which is coupled with the array of blocks. If the counter and the array get out of step for any reason the program will misbehave. If the program checks the array each time there is no question of this happening. In other words one design leaves the system open to bugs that could not occur in the other. I'm trying to get people thinking about the craft of software development and into the habit of worrying about things like this when they write programs.

I often get asked "What is the best way to do this in software?" as if there is an solution which is perfect in every way. I tend to reply that there usually is no such thing a best solution, there will be a fast one, one which doesn't use much memory, one which has the shortest program code and so on. To that you can hopefully add "simplest" which is the one that I tend to go for, unless I'm really worried about performance.

Engineering Windows 7 Blog

I have a kind of love-hate relationship with Windows Vista. I love it on some machines and hate it on others. This has a lot to do with the quality (or indeed existence) of device drivers, some manufacturers seem to have got away with sticking "Vista Capable" on things that were definitely not ready for showtime. More like "Vista Culpable".

You can't blame Microsoft for all these problems, but at the end of the day it is their name on the Vista tin and I hope they get tougher with hardware makers in the future. At the moment all eyes are on the upcoming "Windows 7", which is rather cleverly not pitching itself as the answer to all prayers, the wonder of wonders and the operating system to end all operating systems. Merely something that is better than XP and Vista.

As part of the efforts to keep everyone informed of how the development is going the senior managers of the Windows 7 team (and I do mean senior, these folks report directly to the top of Microsoft) have started an Engineering Windows 7 Blog. This is actually quite a worthwhile read. It gives you a nice insight into the way that enormous software products are created, and the conflicting pressures that the teams are exposed to. I also rather like the way that they are using the same blogging tool as I do, the venerable Windows Live Writer. (although I bet they get more hits than I do).

Casting?

I'm writing some new teaching material at the moment. It is going roughly half as fast as I expected, which is about right in my experience.

Anyhoo, I'm doing casting, where you tell the compiler to convert from one type to another by putting the type in front:

int i, j;

float factor = (float) i / j;

I have to cast i to floating point in the sum, otherwise I get an integer division and no fractional part.

In other words, in the above code if the value of i is 1 and the value of j is 2 I want the value of factor (1/2) to be 0.5 (floating point division) rather than 0 (integer division). I get this result by casting i to float in the sum. C# uses floating point division with floating point operands, and everything comes out OK.

This is a standard computing thing, most languages provide support for casting. And I started to wonder why it is called casting? Popular wisdom seems to be that it is related to casting things in a foundry, where you pour liquid metal into a mould of a particular shape. The shape of the mould determines the result of the cast. So by casting you can change one thing into another.

However, I've thought of another way to look at it. You can think of casting as making a movie. You take an actor (Christian Bale) and cast him as a character (Batman). For the duration of the film the character will behave in terms of the role they have been cast into. This even works when we consider stupid casts. In C# you can't do things like cast a string into an integer. In films you can't do things like cast Christian Bale as City Hall. I quite like this way of looking things, but one thing does worry me. Maybe this is the original meaning, and it has taken me years to figure it out.....

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.

Growing your own game content

There are two ways you can get content into games. You can hand craft and design your entire environment, painstakingly the drawing trees, rocks, grass and sky. Or you can get a program to create all this for you. In the first approach you get exactly what you want, but it takes a while and you have to do all the work yourself. In the second you use carefully managed randomness to get something which "grew" by itself.

First thing this morning we were at a talk by the developers of FarCry 2, which is due for release later this year. They've gone for the programmatic approach to making their jungle. Their trees really grow, based on parameters and design settings from the graphics designers creating the game world world. They don't actually create the scenery when the game runs, instead they use a whole bunch of programs to make it before it is fed into the game. The end result was really impressive, with very realistic trees which wave in the breeze, and even come to bits when the weather hits storm force.

I expect that in the future more games will work this way, as the power of the consoles increases and the increasing amount of detail in the game environments makes it harder to make this stuff by hand.

Fraught Software

Some software is what I call "Fraught". By this I mean that it is somewhat unstable, but just useful enough to make it worth living with the problems it causes. Early versions of PowerPoint were like this. They let you create great slides, but they also had a habit of crashing when you thought about saving your deck. At one point I suspected that they might have some form of mind reading ability.

Anyhoo, PowerPoint is now solid, and very good at recovering if anything bad does happen. Photoshop Elements is however fraught. It does what I want, it has a very sensible and useful range of features and it didn't cost me too much. And every now and then it tips over, the most recent one giving me the blood curdling message "Can't open the catalogue". As the catalogue is the file that ties everything else together, this could well be a bad thing as it would have meant re-importing and categorising everything. Fortunately, after a reboot and a fifteen minute repair session we are now back on the rails again, but I'll always be slightly on edge when I use the program. I hope at some point Adobe can get around to un-fraughting the code.

In One Ear

Since my early experiments with speech recognition I had been looking out for a decent head set. I was really pleased when I discovered some Logitech headphones at a knockdown price in our local Staples store.  I took them home and plugged them in and started talking.  And they didn't work very well. 

The sound was indistinct and the recognition was very poor.  I spent a while fiddling with the settings and re-training but it was nowhere near as good as it used to be.  At this point I decided that I might have bought a duff device so I did a little investigating.

Rather surprisingly, results seemed to be equally bad with the headset microphone switched off or even unplugged.  After some investigation I discovered the speech recognition software was still using the microphone inside the computer.  It seems that it doesn't always automatically select the headset microphone.

However, now I've managed to make the switch must handle the speech recognition works an awful lot better.

A tip, you can disable and enable sound devices by going to Control Panel -> Hardware and Sound and clicking Manage audio devices.  This opens up the Sound dialogue. When you disable a device it rather annoyingly vanishes from the list of devices. You can get a device back again, so you can re-enable it, by right clicking in the device window and selecting show disabled devices from the context menu that appears.

Adobe Photoshop Elements 6

Microsoft have stopped making my favourite image manipulation tool. The 2006 version of Digital Image Suite was the last, which is rather sad as I always quite liked the program. Unfortunately, the code is showing its age a bit now, and it doesn't handle raw camera images very well, and so I've had to look around for a new image processing program. Paint .NET is great for a freebie, but doesn't do much with raw images and I also wanted some image cataloguing tools.

So last week I downloaded a 30 day evaluation copy of Photoshop Elements from Adobe, and this week I bought a book which tells me how to use the program (essential in this case because even a seasoned computer user like me finds some of the ways the program works to be quite opaque). Next week (or perhaps the week after) I might even buy the software itself.

I've always had a kind of "dis-affection" for Adobe software. It never seems to quite work properly for me. Their PDF reader is a huge, unwieldy beast for something which is essentially a file viewer, and it really upsets me when such a lowly program insists on rebooting my machine when it has updated itself. It used to annoy me even more when it hid the update confirmation window behind everything else, and brought my machine to a standstill waiting for a response. Having said that, the latest reader does have some rather nice tools that you can use to annotate PDFs which are rather cute, although I guess they contribute to the "bloatiness" of the program and make it much slower to load when all I want to do is look at a document.

Anyhoo, I digress. The Elements installation went smoothly, and I quickly had a picture open for edit. And I got that sinking feeling again. All I wanted to do was darken one part of the image, to hide some of the background. An adjustment layer might have hit the spot, if I could have figured out how to mask it over the bits that I need. A darkening brush might have been nice too if I could figure out how to use it. There's usually a scene in most action movies where the hero gets into the pilot's seat in a helicopter, spaceship, ocean liner or some such and is confronted by a huge, complicated array of controls. You then get a close up of their baffled face as they scan the buttons, dials and levers in front of them. I get that face whenever I use Elements. Stuff I never want to do ("Conte Crayon" anyone?) is right in front of me and stuff I always want to do ("make this bit darker")  is nowhere to be seen. In the end I gave up and resolved to buy a book.

I then had a go with the photo catalogue software. Now, granted, bringing 50 gigs of images into the index in one go might be pushing it a bit, but I was hoping for something a bit more useful then a terse "import failed" message after thirty minutes of hard disk rattling.  I imported the pictures in a directory at a time and this time it worked OK. Then Elements started nagging me to do a backup of my catalogue so eventually I said yes, hooked up an external drive and pointed the program at it. At which point it put 24 thousand images into the root directory of the disk. Most backup programs that I've used create a directory to put their files in. Not Elements. Actually, kudos to Vista here, in that I managed to select all the files and put them into a more sensible place without the file explorer window tipping over.

However, the program is growing on me bit by bit. I've been reading the book I bought to find out what it can do, and it really is a powerful beast. And perhaps I've been a bit harsh in expecting it to just work. We shall see.

Deathmatch Bot Fun

I took some time off from the glossary to have a go in our Deathmatch challenge today. We've run these before and they are always great fun. We write C# programs that control bots in Unreal Tournament and pit them against each other. I'd not had much time to write any code so I quickly knocked up a "happy camper" who grabbed a gun and then took pot shots at anyone who wandered past. If you want to run your own challenge you can find out more here. The going was tough.

2108791890
A tense moment

2108017765
Darren's Ripper Santa does the business (note my best score)

2108016941
Zoe takes first prize from Darren

Why Software Sucks...

There are some books that anyone working with computers should just read. Code Complete by Steve McConnell is one of them. And now I've found another one.

Why Software Sucks... (and what you can do about it)  is by David Platt is a book you really should get. It is not hugely technical. It is not hard to read. It will make you laugh (and if you are a developer promptly feel guilty). It is a text which takes as its starting point the fact that we are not really very good at writing software.

It ties in rather neatly with a lot of things that I tell our students when they are writing programs for other people to use, but it also touches on security and a whole host of other issues, always with humour and always grounded in real life experience.

Even (or especially) if you are not a programmer you must read this book. Excellent stuff.

Live Writer Goes Live

It looks like Live Writer (the thing that I'm using to write this blog) has finally gone, er, live. It was in beta for ages, and the "Help About" screen in my version still says Beta, but now it looks much more like a finished product. All the nice features are still there, along with the plugin structure (which seems to have sprouted a bunch of extra plugins - but nothing as nice as my Flickr Inkifier of course).

If you write blogs and want a lovely place to work, you should take a look here:

http://get.live.com/writer/overview

Get Paint .NET

I've been messing around with images and for some time I've been using a free program called "The Gimp" which can do useful things like layers and transparency. It can probably do lots of other tasks too, but it is such a pain to figure out how it works that I will never know.

For some time I've been looking for a decent free graphics editor which doesn't make me tear my hair out, and luckily I seem to have found one. Paint .NET started life as student project and now is a very well specified graphics editor which is great to use. It has a bunch of artistic effects as well as those features that I need to create images for the XNA games.

If you are after a good program to work with images, take a look here.

The Silliness Starts Here

I've put my first XNA file on VerySillyGames. It is just a silly screen display. The source code will be provided when the book is released. It is a nice example of how you can get really good graphical effects almost by mistake. You can find a runnable version of the program for the PC at www.verysillygames.com. It is optimised for 1280 x 1024 displays on a PC with the XNA framework installed. An Xbox version will be available later.

1580731593
I've added rotation to the original program, let me know what you think

If you are lucky enough to be a student at Hull you can join the VerySillyGames.com development effort, where we are going to take some of the silly game ideas and try to make them real. This time next year we'll all be millionaires. Oh yes.