New device detected: Boeing 747

I would have loved to have seen that ono pop up on the scrren.

Back in 1994, Boeing considered equipping each seat with a serial modem.
Laptop users could hook up to the modem and dial out. (Dial-up was the primary means of connecting to the Internet back in those days.)

We chuckled at the though of attaching the serial cable and getting a Plug-and-Play pop-up message:

New device detected: Boeing 747

[via The Old New Thing]

Deleting lots of data in batches

The fun part is in the “where…” bit, knowing how to set your query to only get a portion of the data is heavy lifting here.
I know where I’m going to be using this in some soon to be written code. For the code, the data will timestamped, I can safely iterate by day and nuke all of the records for each day.

So we’ve all come across the need to delete 10 million records. however we all no that this won’t be quick and will result in a large log file and as we get nearer deleting the 10 millionth row the process is going very slowly.

Well the standard way around this is to run the command in batches, this way our transaction is never very big. So you can write a while loop and check an iterator, but first you need to get into the loop so you need to store the iteration in a variable and have something like this

set rowcount 10000
declare @rc int
set @rc =0
while @rc < 1000 
  begin 
  –Do my update/delete etc    
  delete from mytable where ….
  set @rc = @rc+1
  end

Well in SQL 2005 in SQLCMD mode and the new TOP clause in an update/delete you can do the following

–your update statement
delete top (10000) from mytable where ….
:go 1000

which of these looks easier to you. I vote for number 2.

[via WebLogs @ SqlJunkies.com]

Regular Expression Tools

I’m still at the point where I can use stuff like ^\d{3}[-| ]?\d{2}[-| ]?\d{4}$ and not fully understand the pieces. So i’m always looking for decent RegEx tools. Eric Gunnerson had a good post about suing RegEx to validate a SSN

But first, a word about tools. It’s a lot easier to use a tool to do this sort of thing than it is to write code to do it. So, I suggest one of the following

RE: Another Blast of Cold Water in the face – "The Build Master" by Vincent Maraia

Bill lists a couple of good references for doing the build the right way. I want these two books.

Eric Garulay, one of the uber cool folks over at Addison-Wesley shot me a copy of The Build Master Microsoft’s Software Configuration Management Best Practices by Vincent Maraia ( Build Master Web Site ) . Well, looks like Kim is going to appropriate the book from me so I need to hurry up and get it read, fortunately that’s not a problem because it’s pretty amazing.  Let me step back a second.  A while ago, my buddies at http://www.apress.com sent me a book titled Expert .NET Delivery using NAnt and CruiseControl .NET  and it was a real eye opener.  Until then, my build strategy was about as sophisticated as “Get Latest Version” from Visual Source Safe, flipping the Release bit and compiling. 

For rest of the posting, go to [Bill’s House O Insomnia]