Redneck DBA

It’s 5:47AM and two things woke me up.

The dogs at the dairy next door. Like clockwork except driven by the sun and not adjusted for human convenience. Rumour has it that no “foreign” non-Homo sapien has ever made it half way down the drive-way. It may have no scientific data to back it up, but I take it is a fact.

The other is a heifer mowing grass three feet from the bedroom window. A beautiful animal, but get the fuck of my lawn! The 2-wire electric fence must have shorted due to a fallen branch and they have waltzed right into the house paddock.

I command the sleeping Blue Heeler.

KADIE! GET IN TO ‘EM!

I should have known the ensuing chaos would wake the whole family. Doesn’t matter…it’s a school day.

There is so much data to check and record. First the rain gauge, humidity sensor and wind speed average for the night. The thermometer backs up the fact that we are a having a cool summer. The chicken output remains a steady one egg per chicken per day. Experience says that any variation from that rate usually brings bad news. The Access database that manages these data sets has performed flawlessly for 8 years. If it ain’t broke…

Making my way to the network, I discover that 2 computers have rebooted during a power spike/surge. The UPS has protected the main development machine and backup server. Maybe next payday I will buy another UPS.

The spam idiots are relentless. Opera always does a great job filtering the crap but I check for false positives and find a perfect score. No sign of any problems from clients. The day just got a little brighter.

“Eat your breakfast…get dressed…your shoes are outside…where is your hat?...Hurry up or we will miss the bus!” The morning ritual is completed and we start the 15km drive down the dirt road to the bus stop.

I like this time of the day. With the radio playing mindless garbage, it gives me time to contemplate the day ahead and to try and model various database and code problems. With the kids safely on the bus, I turn for home. Nothing brilliant comes from my mind during the trip.

2 shots of locally grown coffee are consumed quick smart and I make my way towards the office. I have 4 different projects that I am currently working on. Two of them are in the .NET space while the others are a LAMP stack and a legacy VB6 data warehousing project. I find myself confusing language syntaxes each time I switch between projects. The equality and assignment operators always screw me.

I classify the programming task I am working on into one of three realms. I call them the “B” worlds. Bits for low level programming, Bytes for general programming and Boolean for the SQL work. Thankfully, the closest I have come to Bits programming in these projects is interfacing with USB devices.

The contrast between the B world and R (real) world is vital for my sanity. I like to finish the day doing something on the farm. Today I have a choice of 2 tasks. Fix the slave cylinder on the ute or turn the blood and bone fertiliser compost heap. I don’t feel like working upside down at the moment so I select the later task.

Walking back to the house brings a smile to my face as I realise that tomorrow is more of the same.

A gift from Alistair

After my series on implementing relational operators on.NET DataTables, I received several requests to post the whole code library.

I was reluctant to do it for 2 reasons
1. The code is already there. <SCREAMING MAN> Just copy and paste it you lazy bastards!</SCREAMING MAN>
2. The initial library was designed for a specific application with many specialised routines.

In the haze of comments received, only one poster choose to donate time and effort to refactor the SQLOps routines into a convenient (and IMO, elegant) set of classes.

Alistair Bayley’s implementation makes significant improvements in functionality and usage.

Here is a short summary from Alistair:

- subclassed DataTable and added the static methods as instance/object methods. This allows nice infix usage of operators, instead of the prefix-style that static methods force.

- added various API overloadings, and a few changes (I think Project is a bit different; Divide too).

- made some of the suggested improvements to GroupBy. I used an additional class "GroupByExpr" to avoid the problem where the array arguments might have different lengths. Also added type inference for
the aggregate expressions.

- added a suite of Nunit tests. These are not complete or exhaustive; they largely test the stuff I've been fiddling with.

- fixed a bug (depending on how you look at it) with Project, where the ordering of the result-set columns was not the same as the specified columns. I needed to be able to re-order columns for output purposes.
This not really in the Relational spirit (where ordering doesn't normally matter), but still useful.

- added a more general Divide.

- added a left-outer-join (OuterJoin), which I needed. Haven't bothered with right- or full- yet.

- added NaturalJoin.

- added Extend (append a literal column).

- added Sort (obvious).

- added Rename, but note that this is different from the other operators, in that it modifies the argument i.e. it's destructive. It seemed overkill to copy the table just to rename a column... I don't like this, because it doesn't return a new table like all of the other operators, and so it destroys the nice closure property.

As a small gesture, I have added operator overloading into the class as well.

The file (zipped VS2003 IDE compatible solution (C#) – 20Kb) can be found at SQLTeam here thanks to graz..

Thankyou Alistair!

Chess using SQL Server

I thought I would pimp my latest article...

http://www.sqlteam.com/item.asp?ItemID=26942

I am hoping to get it completed in 3 articles.  The first article looks at technique, the second on modelling and finally the last article brings it all together...

Enjoy!

A letter to MS press writers

Dear Microsoft Press Writers,

As a long time user of your database products, I find myself becoming increasingly aggravated by the utter nonsense that your press releases state.

Specifically, the utter lack of knowledge of the theory that underpins your enterprise database engine.

Considering that you are increasingly trying to compete in the VLDB space against Oracle and DB2, it is imperative that no ignorance is shown when it comes to the relational model.
The men and women who manage these VLDB environments will have the “ear” of CTO’s and CIO’s. These people are usually well versed in the relational model and can spot bullshit from a mile away.

Unfortunately, your current press releases pertaining to Katmai, showed enough ignorance to be spotted by the Huygens probe currently buried under the surface of the moon Titan.

The offending text is as follows.

Beyond Relational Data
Manage any type of data including relational data, documents, geographic information and XML

Yours truly,

A DBA

A new error

It had been nagging me for a while.  When I started building this application, I reached into my code library and started copying and pasting various bits and pieces.

One in particular was an Error dialog control.  My exception framework uses this form to display errors to the user.  Depending on the type of exception, the interface changes to reflect the severity and type.

The original control was built nearly 6 years ago, so I quickly modified the internals (overloaded the constructor) to accept the new applications typed exception and thought no more it.

There are no technical issues with it.  It works.  But boy, it is UGLY when compared to the rest of application.

So I set about to change the interface.  A fairly risky proposition in a stable application.  The exception framework abstracts the calling of this control, so it has a very minimal profile to the rest of the application.

Feeling brave, I dove right in... 

The image below shows a database violation.  I have deliberately blanked out the name of the application. 

The client is a fan of "Little Britain" and insisted on the text in the form header.

The "Details" tab displays the stack trace, and the "Environment" contains information about the computer, OS and the applications state.

So what do you think?