At school my son is looking at polyhedra (that's the proper word for polyhedrons – like cubes, tetrahedrons, etc).


The other day he came home with pictures of a dodecahedron (that's the one with 12 pentagon sides) and an icosahedron (20 triangle sides). The icosahedron is really neat. Each point has 5 edges hitting it, and if you hold it right, you can have 5 sides in a top layer, 5 on the bottom, and 10 around the middle. It's nicely symmetrical, and it feels familiar.

I think the reason it feels so familiar is because if you chop off the corners you get a truncated icosahedron. This makes each point into a pentagon (because there are 5 edges that meet at the point), and each triangle into a hexagon (because you've chopped each the corner off). Pump it up a little, and then you can play football with it. I think this should be called an 'isoccerhedron' though.

(Image is from the Wikipedia site)

The class didn't actually look at the isoccerhedron, but I think the class full of boys would've enjoyed seeing such an application of polyhedra. After all, maths doesn't get applied much when you're in Grade 5.

No File Conversion in Windows Mobile Device Center?

In the days of ActiveSync (which means before I upgraded to Vista), I could connect my mobile device to my laptop, and copy files across from one device to another. This hasn't changed.

But ActiveSync didn't just COPY the files. It would CONVERT them as well (something WMDC doesn't do). ActiveSync would convert Pocket Word files to/from .doc files (a problem Nick Randolph has faced too), Pocket Excel files to/from .xls, and also tag PDF files so that my mobile device could view them in Reflow mode.

Like the Pocket Office formats (which are must more compact than the Office 2000 equivalents), Reflow mode is just so useful – but without the ability to tag the file, it makes reading PDFs on my mobile device a thing of the past.

DATE and TIME data types in SQL Server 2008

Sick of using DATETIME to store values which are always going to be the date-part only? Yeah, me too. This is why SQL Server 2008 has new data types called DATE and TIME, which store just the DATE or TIME component of a DATETIME, respectively. Half the size, and much more appropriate if that's all you need.

So now you can picture code like:

where cast(thedatetime as date) = '2007-06-11'

But please be aware. This kind of query is likely to cause a table scan, just as if you cast a FLOAT to an INT. In this scenario, it would be better to use code like:

where thedatetime >= '2007-06-11' and thedatetime < '2007-06-12'

…so that an index on thedatetime can be used. But of course this is the code you would've used in SQL Server 2005 anyway.

So what's the point? Well, if you're dealing with DATETIME fields, I would still be using them in a DATETIME way. But there will be plenty of data models that will start using the DATE type instead, if that's what's most appropriate to use.

NOTE: These data types are not available in the June 2007 CTP of SQL Server 2008

Documents in SQL Server 2008

One of my favourite aspects of SQL Server 2008 is the fact that you can store documents (well, files) in the database. Annoyingly, this doesn't seem to be implemented in the June 2007 CTP.

There has long been an argument about whether images should be stored in the database or in the file system. The same argument occurs when discussing Word documents, Excel spreadsheets, and all the rest. With SQL Server 2008, the answer is simple – store in the database using a varchar(max)/nvarchar(max)/varbinary(max) type with the FILESYSTEM option. This will store the information in the file system, but still let you manipulate the data using standard constructs like UPDATE and DELETE. Very cool! Now people can access your data through whichever medium they need.