January 2005 - Posts

Another Unit Testing convert.

Josh Holmes discusses his recent experiences with unit testing and how he's now a firm believer in automated unit tests:

I'm not spending time repeating myself and typing in the same meaningless test input into the UI over and over. I am using the computer to do that for me. It makes for more repeatable, consistent tests that actually get executed.
Posted by PSteele | with no comments

Refreshing the project failed.

While working on an ASP.NET project over the weekend, I suddenly got an error message when opening my solution file:

Refreshing the project failed. Unable to retrieve folder information from the server.

I was pretty irked since I was in the home stretch of a project (you know -- the last 10% of the project takes 90% of the time!). Luckily, it wasn't that big of a problem and I was able to continue developing and debugging.

Since the problem continued, I finally googled for it and found the answer: Delete the "VSWebCache" folder in your "\Documents and Settings\[Username]" directory.
Posted by PSteele | 29 comment(s)

Don Box predicts the present?

Accodring to Don Box's predictions for 2005, Josh Bloch (author of "Effective Java") will write a C# book called "Effective C#". Hold on there! Local Regional Director (and president of our local .NET User Group) Bill Wagner has already authored such a tome: Effective C# : 50 Specific Ways to Improve Your C#.

Scratch that one off your list Don! :)

Posted by PSteele | 2 comment(s)

Oracle and Blobs

More fun with Oracle! I was reading an Oracle table that contained a "LONG RAW" field. You're supposed to be able to get at those types with the GetBytes method. According to the MSDN documentation for IDataRecord.GetBytes:

If you pass a buffer that is a null reference (Nothing in Visual Basic), GetBytes returns the length of the row in bytes.

You can then use the length returned to create a buffer of the proper size and call GetBytes again, passing the buffer to do the actual read. Unfortunately, Oracle (9i) was returning zero. There was no way the data was zero bytes because I knew I was reading the proper row based on the other fields in the recordset. Googling revealed a few hits about a special Oracle datatype called OracleBinary (along with OracleClob and OracleBlob). None of these worked either.

I finally found a reference to a special property of the OracleCommand object called "InitialLONGFetchSize". By default, this is zero which means that no raw/longraw data is initially fetched when the command is executed. You're instead supposed to use the OracleBinary to fetch them but that wasn't working. If you change "InitialLONGFetchSize" to a non-zero value, this will tell Oracle how much of the raw/longraw data should be pulled back on the initial execution. There's a max of 32k (32767 bytes), so you still may need multiple reads, but you'll at least get your data.

I set this to a non-zero value and the Oracle command finally allowed me to use the GetBytes() method to retrieve the length and then the contents.

Posted by PSteele | 1 comment(s)
More Posts