Null or Not Null

That is the question…

I am working on an old Visual Basic project. It is not my own, it’s just an existing project in which I have to make some changes. There’s an existing database connection and in one of “my” functions, I have run a query, and created a recordset (rs). In a loop, I am iterating through the records with a bit of code like this:

  If Not IsNull(rs!X) Then
    strX = rs!X
    strX = ""
  End If

or, if you like

  strX = IIf(IsNull(rs!X), "", rs!X)

Somehow, I get an error, “Invalid use of Null”, on the second line! So, rs!X is Null on the second line, but it wasn’t on the first line, or else the code would never have come to the second line! How is this possible?!?

› Continue reading


Saturday, January 19th, 2008 Computing No Comments

Locales and date format in SQL

I am working on a VB.NET project. The program is a Windows service that connects to an MS Access database. Everything worked fine on my own pc, but on another pc, we ran into some problems. It appeared to be related to regional settings. By default, the service ran as the LocalSystem account. I don’t know how to change the settings for that account, (anyone?) so for testing we ran the service under different user accounts. And indeed, for a user with “en-US”-settings, everything worked fine, but for a user with “nl-NL”-settings, we got weird results.

› Continue reading

Tags: , , , ,

Tuesday, January 23rd, 2007 Computing 2 Comments

The Daily WTF

A friend of mine pointed me to this website, The Daily WTF, Curious Perversions in Information Technology.
On this website you can get your daily dose of funny, stupid or weird bits of programming code.

How about this bit of code for converting a byte array to hexadecimal?
Notice the use of constants to improve readibility, such as:

public static final int FIRST_BIT_OFFSET = 1;
public static final char ZERO = '0';

Here’s another nice example of the use of constants, to make SQL query building much easier!

› Continue reading

Tags: , ,

Tuesday, April 4th, 2006 Computing, Funny No Comments

#pragma warning(disable: 4786)


I have successfully ported my Linux code to Windows.
My application (for time-dependent isosurface extraction and rendering) uses VTK for the visualisation, FLTK for the user-interface, and pthreads for multi-threading.

Well, the first two are cross-platform toolkits, so no problem getting them compiled under Windows. But POSIX threads… nope… So I had to try something else.

› Continue reading

Tags: , , , , , , , , ,

Friday, July 2nd, 2004 Computing 5 Comments

Porting from SGI to Linux

OK, I’ve got the RWB VRX library working under Linux!
Eeeh? Say what?
The Responsive Workbench library with the Virtual Reality eXplorer!

We’ve got this Virtual Reality Workbench running on a SGI Onyx2, and one of our PhD students, Michal Koutek, wrote a library, based on SGI’s Performer, for building applications for this machine.

› Continue reading

Tags: , , , ,

Wednesday, February 12th, 2003 Computing No Comments