<body >

Ode to My Mouse

Friday, November 30, 2007

O, my beloved nipple!
I return from the heathen wilderness of touchpads
To the glory of your navigational precision.

Labels: ,

Permalink

Good Intentions



I'm so full of good intentions,
I hardly ever do the stuff I mention.
Seems that I should realize,
But I thought of the greatest thing last night!
- to the tune of "Good Intentions" by Toad the Wet Sprocket

Labels:

Permalink

How to retrieve the RETURN value from a stored procedure in .NET

Wednesday, November 21, 2007

If you need to return a single integer from a stored procedure, it's more efficient to use the RETURN statement than SELECT since SELECT is a whole recordset with a cursor. To access the return value from your C# code, you add a "ReturnValue" parameter to your stored procedure call:

(Pretend you have an open SqlConnection called "conn".)

SqlCommand sqlCommand = new SqlCommand("webmail_getMessageCount");
sqlCommand.Connection = conn;
sqlCommand.CommandType = CommandType.StoredProcedure;

SqlParameter messageCount = new SqlParameter("@count", SqlDbType.Int);
messageCount.Direction = ParameterDirection.ReturnValue;
sqlCommand.Parameters.Add(messageCount);

sqlCommand.ExecuteNonQuery();

return (int)messageCount.Value;

Labels: , ,

Permalink

Delphi Dichroic Slide Fusing Results

Saturday, November 10, 2007

Dichroic slides vary wildly in color depending on the background glass, and the result looks nothing like the unfused foil.


High Cyan / Copper Red


Rainbow


Magenta Green


Clear Red


Cyan / Copper


Blue Gold

Labels:

Permalink

Microsoft Log Parser

Wednesday, November 7, 2007

I use Microsoft's Log Parser to collect events that happened in the time surrounding job failures in case they contain helpful data. All the examples of doing this from within SQL Server require you to put the folder containing the Log Parser executable in the server's PATH environment variable, and you have to bounce SQL Server to get it pick up the change. When the operations team forgets to install it during the server configuration, you can't just bounce a production server in the middle of the day when you find out.

I wished therefore not to use an environment variable. I tried specifying the full path to the executable in my call to xp_cmdshell, with and without quotes. No dice. I finally hit upon using the DOS "short names" (the ancient 8.3 names from the bad old days of Windows), which works.

Presuming the default installation location (c:\Program Files\Log Parser 2.2), the DOS short path is

c:\PROGRA~1\LOGPAR~1.2\LogPar~1.exe

on an x86 server, and

c:\PROGRA~2\LOGPAR~1.2\LogPar~1.exe

on an x64 server (Progra~2 is the "Program Files (x86)" directory).

Labels:

Permalink

 
   



Blogger Template by Gecko & Fly, modified by yours truly.