More VB Suckage

I don’t mind VBscript so much, it’s ok as a web scripting language, if not a bit of stupid one. Sessions are very easy to deal with, so doing things like session authentication is dead simple. However, the one thing that had me all in a tizzy was the fact that a variable has to be checked (from what I can see) for three different conditions to see if it exists or not.


I was working on some password authentication stuff and trying to do a simple check to see if the variable username was set or not. I figured that a check of IsNull(username) would do it, but no. Seems that IsNull() checks for something different than IsEmpty which checks for something different than an empty value (“”). So in the end my code looked something like:


If IsNull(username) or IsEmpty(username) or username = “” Then
….
End If


Instead of the far more sane way that Perl does it:

if not $username {
….
}

Apparently in VBScript there is a difference between a variable existing, existing but not being initialized, and existing, being initialized but not having a value. To wit, a quote from the IsNull page:

Use the IsNull function to determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null, and therefore, False.

sigh


Got my first roll of film with my new camera this morning, and while not all turned out, some are not completely sucky. I am going to start recording the settings that I take pictures at however, so that when I get a roll back I can see the results of slightly different f-stops or shutter speeds. I’ll get the good ones scanned and throw them up in the gallery.