Sunday, August 1, 2010

The Last Airbender

So, this weekend I went to the movies to watch "The Last Airbender".
I've seen the entire cartoon series on Nickelodeon, thanks to my little brother, so I had a certain expectation of the movie. While the movie was certainly not bad, I had the feeling that it did not live up to the expectation I had.

Several of the key characters have a lack of depth in the movie. You're suddenly thrown into the world of element bending, without proper context. The story is told at the start of the movie, but it's lacking. Some of the characters are pretty shallow in regards to their background and important in the story.

A big plus however are the special effects. The bending of the various elements was nice to watch, as were the duals between elemental masters. The only downside on this was the bending of the element earth. It appears as if the rendering of those effects took a dent during the making of the movie. All elements are smooth, yet when earth is used the effect seems to "slow down" as if the computer used for making the effect could not render it properly or display it properly.

Besides that I recommend the movie to anyone who is into this kind of stuff. The expectations aren't met, but all in all it's not a bad movie to watch.



p.s I watched the 3D version.

Wednesday, May 5, 2010

Creating a bootable USB Drive

These days, most computer systems come without a floppy drive build into them. In most cases you probably don't require the floppy drive anymore, but if you're like me; then chances are that you come across a situation where a system dies and you require a bootable floppy drive or similar means to access the command prompt and investigate Windows.

Fortunalty for us, most systems come installed with USB connectors and have the ability to support USB sticks. Only problem is that you cannot boot from a USB device if there is no boot sector on it.

I've been looking on the Internet for quiet some time to find an easy work around for this issue, and came across the following solution to make a USB stick bootable like a floppy drive.

- Download the following tool and install it : click me
- Download the Windows 98 boot disk files: click me
- Run the tool and format your USB stick into FAT32 using the files of the boot you downloaded.
- Now you can use your USB stick as a bootable device if your BIOS supports "boot from USB".

With this modified stick, you can add small tools to it in subfolders and run them from the commandprompt. Easy if you want to flash a BIOS or graphics card and need to do this outside Windows for example.

The supplied boot image comes with generic drivers, so you can even access your CDROM station if you have one connected.

Thursday, April 29, 2010

LINQ

or should I say Ruby on Rails.NET?

Today I started experimenting with LINQ in the .NET 3.5 framework, and my first impression was "this looks so much like Ruby on Rails". I'm not complaining about this, because it makes my life soo much easier now that I can apply the knowledge I have about the Ruby on Rails framework with it's hashmaps and active directory to the .NET model with LINQ.

To demonstrate with a small piece of code that I have:
I have a List that is filled with Cell objects. Because I wish to make sure that each cell can only be added once to the List, I need to verify the names of the Cells in the list prior to adding the cell. So I made a special indexed property that uses a bit of LINQ.

The function body of my property looks like this:
public Cell this[String name]
So, if I wish to select the cell that matches the given name from my internal List object I need to call the following line of code:
return m_cells.Single(c => c.Name == name);
The line above will return a Single Cell object that has the specifed name and resides in the List collection. If no Cell matches the given LINQ expression and InvalidOperationException is thrown.

But because a property works in 2 ways, I need to make sure I can assign a cell as well. The logic behind the following function might be a bit weird, but I wish to be able to select a cell based upon it's name and assign it a new value. However I do not wish to add the same cell twice to the collection. To facilitate this I wrote the following code:

// Use LINQ to count the cells in the CellCollection with the specified name.
// We will perform a count on it, because we need to check if the cell is present.
Int32 cell_count = (from c in m_cells where c.Name == name select c).Count();
// Check if the specified cell was found in the collection.
if (cell_count == 0)
{
// Count 0 means the cell was not present in the first place, so
// add it at the end.
m_cells.Add(value);
}
else
{
// The cell is present, so locate it that we can overwrite it.
Cell cell = (from c in m_cells where c.Name == name select c).Single();

// Change the cell with the new value.
cell = value;
}
The above code does exactly what it's supposed to do. Overwrite the cell if it's already in the collection or add it at the end if it's not present.
LINQ makes writing code a bit trickier to understand, but it shortens the total amount of lines you need to write by ALOT.