Category Archives: Programming

Dating A Developer

Matt posted an entry the other day about how to get lots of links and traffic. One of the links in his “list” was a link to Emily Hambidge’s site. The article in question was about dating an Apple developer and I just couldn’t help but put something down about it – it was pure gold.

Emily’s points were mostly generic to anyone that works in software development, not just software development at Apple. For the benefit of those that aren’t in the loop, the environment that software developers work in is generally more work than hours in the day and everything is mentioned today but needs to be delivered yesterday. If the latter fails, it is mentioned today and needs to be delivered in an unrealistic timeframe of say, tomorrow. This combination of attributes creates a fun and interesting environment to work in, which for some people is known to cause quite a bit of stress. Thankfully, I’m not the stressing type.

If you know a programmer or the wife/partner of one, you’ll probably get a kick out of 1o points to remember about dating a developer; especially if you’re a little computer savvy yourself!

XmlHttpRequest Object

With all the press that the XmlHttpRequest object has received lately, I thought I would check out what all the fuss was for myself.

I did a little research online, as you do and scoped out what it could and couldn’t do. From here, I started trying to do anything with it that made sense. Initially, this failed as I was trying to hit an RSS feed on this site from my home machine. This might seem like a logical thing to do, however the object is restricted to opening URL’s from the same domain. In my failed example, that would have been http://localhost/. You could get around that by mirroring a remote feed onto your particular domain using your favourite server side language.

Once I established that I could instance the objects and access a URL, it was time to start interacting with the content. The first attempt involved trying to access the information returned from the open method of the XML object. However, if you’re actually accessing XML data and not randomly formed SGML, you need to hit the responseXML property to return you an object you can interact with through the DOM. After assigning responseXML to a variable, you can now interact with it through the standard DOM methods, such as getElementById() and getElementsByTagName().

With that in mind, I set about creating something semi useful – an archive page for WordPress enhanced using XmlHttpRequest that would degrade gracefully should the XmlHttpRequest object not be available. To accomplish this, I utilised the existing feeds that WordPress provides, which are accessed through http://domain.com/<something>/feed/.

As soon as I get a little spare time, I’ll wrap it into a plugin and release it here.

ASP Error ‘ASP 0104: 80004005’

As a follow up to the new hardware added the other day, I had to fix a problem in an administration section of a site. The page in this case, allowed you to upload files (images and so forth) to the server and manage the files. This was all working as expected on the existing box (Windows 2000 Server/IIS5), however after moving to a new one (Windows 2003 Server/IIS6), we had some problems.

What follows is the short error message:

  1. Request object error 'ASP 0104 : 80004005'

After inspecting and changing some code, the error was caused by invalid permissions on the file system where the files where being written to. At some point, the previous servers directory permissions had been changed to allow the IIS user writing permissions to that directory.

The solution was simple and fast, change the permissions and allow IIS write/create type permissions on that particular folder.

ASP Error ‘800a000d’

We recently purchased new hardware at work (2x IBM eServers) for the pending rollout of our new software. The new software went live on Monday and as a by product of the change, some of our existing sites in ASP3 also had to be moved around.

Before the move, all the sites were functioning error free on a Windows 2000 Server platform with IIS5. Once moved onto the new servers, which were Windows 2003 Server and IIS6 – some of them started throwing errors in various places. These sites were initially written between 12 and 18 months ago now; so the code was capable of working fine if the initial programmer had taken some care.

The error I received was:

  1. Microsoft VBScript runtime error '800a000d'
  2. Type mismatch
  3. /default.asp, line 518

Line #518 had this to reveal:

  1. If Session("GreatDealID")=52 Then

So the error is clear, Session("GreatDealID") was being stored as a string in the Session. It was compared to a numeric type and failed. The solution would be either of the following lines:

  1. If Session("GreatDealID")="52" Then
  2. If CInt(Session("GreatDealID"))=52 Then

What I find interesting, is that in IIS5, it was more than happy to automatically cast the Session("GreatDealID") from a VBString into a VBInteger, yet IIS6 threw an error. I initially thought it might have had something to do with IIS6 enforcing an Option Explicit for ASP. However if it did that, all of the undefined variables used through the site (I know) would have also thrown errors, yet they didn’t.

I haven’t bothered looking to find out exactly why the error suddenly appeared. For the moment, “the code was poor, it then errored”, will do. Anyone else come across it or know why it changed in IIS6, if that is infact the cause?

ASP isNumeric

You would assume that the isNumeric fucntion would return a false value if you passed it an alphanumeric string. However, after checking through some things; it appears that it considers 6,6 as an numeric value.

In this instance, the value is coming from a query string so you would assume that the variable sub-type would be a string. If you test that using the VarType function, it does indeed return a value of 8 (indicating VBString as the sub-type), yet some how it is also numeric.

The only way I can see that this is logical, is that it might be allowing the comma through based on the premise that it is a valid currency formatting character, such as $123,456.78. The Microsoft documentation for isNumeric indicates that it will allow a period (.) through, however mentions nothing about a comma at all.

A simple code example:

  1. Dim sValue
  2. sValue = 6
  3. Response.Write isNumeric(sValue) ' prints True
  4. sValue = 6.0
  5. Response.Write isNumeric(sValue) ' prints True
  6. sValue = "6,6"
  7. Response.Write isNumeric(sValue) ' prints True
  8. sValue = "6, 6"
  9. Response.Write isNumeric(sValue) ' prints False

If it is allowing the comma through for currency reasons then I would consider the function to be flawed. A comma isn’t part of a number system, it is part of a currency system which changes from country to country. Further to that point, if isNumeric considers “6,6” to be a number, then you should also be allowed to cast it into a numeric type (from the variable sub-type VBString) into an integer for instance.