Friday, September 28, 2007

Javascript repository

I've decided to document and share the standard javascript functions, I use for my web development.
I've only just decided it, so for now there are only a few files ready - but the repository will gradually expand...

You can find it here:
http://www.blizan.com/repository/javascript/

Friday, September 07, 2007

How did I not see that?

I had a nice experience today. I have been developing a website that uses the native ASP.NET 2.0 provider model. To save time I've just installed the default provider implementations for the MembershipProvider and RoleProvider and am using them.

So now I am in the process of creating an administration-system for the entire website, including the providers, and found myself having an insane bug/error. I had two users in my database, myself and a test person (Hans Hansen). When I updated the users everything was fine, unless I wanted to change the users' roles. If I was editing my own user it worked. If I wanted to edit Hans Hansen, however, the app crashed. The error message was something like: "Cannot update user name ''" (empty user name).

Now, I am pretty sure the user name isn't empty, so I began debugging. After about 2 hours of hopeless looking through code (even the ASP.NET provider stored procedures!), and plenty of theories about the origin of the error (including one or two angry thoughts to Microsoft), I developed a theory. What if the user name was required to be minimum 3 chars? Hans Hansens ("hh") was only two, but my own ("mgj") was three, and for the latter everything worked! Well, I changed "hh" to "hah", and suddenly everything worked! So now I'm thinking, that Microsoft is behind the error, and begin looking quite deeply into their stored procedures looking for the unwanted feature.

After another hour down there, I coincidentally passed the [aspnet_UsersInRoles] table, and lost my jaw. I had finally found the problem. In the aspnet_UsersInRoles table, a previous test user had not been deleted. And he happened to have the same username as Hans Hansen ("hh").

So, in the words of Sting, "I hate to say it, but it's probably me"


Note to self: Make sure test environment isn't corrupted, before pointing fingers!