Video iPod – meh.

Well, i’ve only had the iPod 60gig since March. Does this count as one of those ‘as soon as I buy one it’s half price‘ things? I don’t particularly care. How am I supposed to watch the iPod while I’m driving? or walking? When I’m sitting and listening to the iPod, it’s normally while I’m programming. Feh, who cares about the new iPod?

Don’t forget to cast (a.k.a. 1 / 5 = 0)

You would think that people would remember this. C keeps things as an integer unless you tell it otherwise. This means that unless you tell the computer otherwise, it will keep blithely working on integers. so to get a proper answer cast one of the values to a float, and the entire operation gets done as a floating point operation.
Simple rules for simple languages.

Patch Wednesday

9 XP patches today. I think it was the same last month. This is not a good track record, and wreaks havok on attempting to create a pre-patched OS image for reinstallation.

First rule of profiling

The first rule of profiling is that by profiling you change the behaviour of a system. This can mean intermittent bugs, performance slowdowns, or general wierdness. Nothing earth shattering, but you just have to keep reminding yourself of it occasionally.

[Listening to: The Lion and the Cucumber (The Doctor and the Rockit Remix) – Dr Rockit – The Spirit of Vampyros Lesbos (5:48)]

New GroupLayout manager run time exception prevention

Just a hint for those who might forget, because the new layout manager is not standard in Java, you need to make sure that your application ships with the new layout code in tow. To find the location of this layout manager on your system, open the library manager and look for the ‘Swing Layout Extensions’ library. This will give you a pointer to the .jar file needed to run under the new layout manager. In my case that’s J:\Program Files\netbeans-5.0beta\ide6\modules\ext\swing-layout-0.7.jar, Your jar file name and directory mileage may vary.
java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group. Then again if you don’t know why the error is happening I’m slightly shocked.

[Listening to: Little Earthquakes – Tori Amos – Little Earthquakes (6:52)]

Now here’s something that really kicks ass…

image of the layout manager

The new layout manager for the Netbeans 5 designer. This form designer kicks ass on so many levels. It’s really quick and easy to get things into the correct places without having to worry about baglayouts within flowlayouts within gridbaglayouts. Truly a joy to make use of.

[Listening to: U Boat – Kasabian – Kasabian (10:50)]

Paycheck

I saw this last night on the telly. It’s a fun action flick with a premise that could have been taken from a PKD short story. There is the mandatory dove that is part of all John Woo movies. I would not have seen this at the cinema, and I don’t think it would have lasted long enough there to have even slightly piqued my interest.
On the other hand, someone was telling me that ‘The Magic Roundabout‘ wasn’t in the cinemas here. I can’t seem to remember it, but I may have been not paying attention to the cinema at the time. Anyone else remember?

Serenity!

I went. I liked. It didn’t suck. I know why they had to do the ‘world saving‘ stuff – nobody likes a low scale movie.
Apart from that, I hope there is more to come from that universe because I find it an interesting place to see, but don’t over-do it like Buffy. Maaan I was sick of it by the end and just wanted it to be over.
For all the fanboys: Please don’t shoot me!

Good old PromptDataSource

This one makes building ADO connection strings in client applications very easy. PromptDataSource is a member of the IDBPromptInitialize COM object. Creating it involves a small bit of C++ code:

IDBInitialize *pIDBInitialize = NULL;
IDataInitialize *pIDataInitialize = NULL;
IDBPromptInitialize *pIDBPromptInitialize = NULL;
LPOLESTR strConn;
CoCreateInstance(CLSID_DataLinks, NULL, CLSCTX_INPROC_SERVER, IID_IDataInitialize,
(void **)&pIDataInitialize);
CoCreateInstance(CLSID_DataLinks, NULL, CLSCTX_INPROC_SERVER,
IID_IDBPromptInitialize, (void **)&pIDBPromptInitialize);
pIDBPromptInitialize->PromptDataSource(NULL, 0,
DBPROMPTOPTIONS_PROPERTYSHEET, 0, NULL, NULL, IID_IDBInitialize,
(IUnknown **)&pIDBInitialize);
pIDBInitialize->Initialize();
pIDataInitialize->GetInitializationString(pIDBInitialize, true, &strConn);

There are no checks anywhere here! You should add your own. C# makes things quite a bit easier.

MSDASC.DataLinks oDL = new MSDASC.DataLinksClass();
ADODB.Connection conn = new ADODB.ConnectionClass();
conn.ConnectionString = "Provider=sqloledb";
object oConn = (object)conn;
oDL.PromptEdit(ref oConn);
OleDbConnection xconn = new OleDbConnection(conn.ConnectionString);
xconn.Open();

Of course, you need to add a reference to the com types: ‘Microsoft ActiveX Data Objects 2.8 Library’, and ‘Microsoft OLE DB Service Component 1.0 Type Library’, which provide access to the MSDASC and ADODB COM objects. You just extricate the Connection string at the end. I’m explicitly setting the provider in the second instance as I’m lazy, and I’m always accessing sqloledb. The 2.0 .NET framework may introduce an easier mechanism for doing this.

Toe the line

Or: Gyles Brandreth shame on you!
on the generic complaints program ‘Room 101‘ on the BBC, he claimed that phrase’s origin was from the Houses of Parliament where they have a pair of red lines separating the opposite sides of the room. The problem is that it is a slight confusion. He was mixing up the ‘Thin Red Line‘ phrase and the toeing the line definition. No-one in the houses of parliament would have been bare-footed, so they would have never ‘toed the line‘. The origin of the phrase is most likely military or naval, where people were required to line up at various times for inspection. Convention claims the navy, as most common crewmen on a boat were bare-footed.
The lines in the House of Commons themselves are actually quite thick, and are positioned two sword lengths apart from each other. The principle being that you stayed behind the line during a debate, and thus could not attack your opponent on the opposite side. Such was the animosity of the two sides during certain periods of England’s history that this principle was created, and it is still adhered to.
The origin of ‘Thin Red Line‘ is slightly different. In the mid 19th Century there was an understanding between officers and men that British Infantry would never be asked to stand and face an enemy onslaught in less than three ranks, four was more common. The retreat would be sounded rather than allowing this to happen. At the Battle of Balaclava on October 25th 1864, Colin Campbell’s 93rd Highlanders (Argyll and Sutherland) stood in just 2 ranks and faced a Russian Cavalry charge. It was here that the phrase originated.
There is a similar, but not identical phrase ‘Coming up to Scratch‘, which refers to the scratch line that bare-knuckled boxers were supposed to get to before resuming fighting once they’d been knocked down. If they didn’t come up to scratch, then they were out of the fight.