September 2006 Entries

The FromFile Exception name quiz - answer

In a previous post I asked what exception System.Image.FromFile() threw if you passed it a file that is not actually a supported image format. The answer? Well, it's not 'UnsupportedImageFormatException', that's for sure. It's not even 'ArgumentException'. No, the answer is, it throws an 'OutOfMemoryException'. Seriously. Look it up. In the course of investigating this bizarre API decision, I also discovered that the .NET framework contains a subclass of OutOfMemoryException called an InsufficientMemoryException. Presumably so that you can distinguish between those circumstances when you have sufficient memory, but nonetheless have run out of memory...

posted @ Monday, September 25, 2006 10:06 AM | Feedback (2)

I'll give you three guesses

In .NET, there is a class called System.Drawing.Image. You use it to manipulate image data. You can create an instance of this class by calling the static System.Drawing.Image.FromFile() method, passing it a filename. Now, if the filename you pass does not exist, this method throws, very sensibly, a 'FileNotFoundException'. So far so good. Pop quiz time: what exception does this method throw if the file you provide exists, but is not in a supported image format?

posted @ Saturday, September 23, 2006 11:14 AM | Feedback (2)

Meanwhile, in space

Good news, everyone! At last, everyone's favourite Kuiper Belt object, Pluto, has been denounced as the pretender it has always been. With its jauntily-angled orbit, it always rejected the convention common to real planets of orbiting in the ecliptic plane, and even flaunted its whacky eccentricity by hopping continually inside and outside of Neptune's orbit, like it was some sort of galactic skipping rope. So, astronomers have agreed to stop pretending that Pluto is the same kind of thing as the other eight planets (or, the four 'Proper' planets and four 'Giant Balls of Gas', as I prefer to think of...

posted @ Sunday, September 03, 2006 3:49 PM | Feedback (1)