Friday, July 27, 2007

World is full of bugs




It happens to me pretty often. I'm up to something. Doing some research, playing with a new technology or just using a system that should work. And then when you really need something, you find out that that feature is buggy. In my flat in London I'm using D-link router to connect to the internet. I'm using a WiFi connection, with mac address filtering. My D-link router looses (somehow???) a safe list. The list of mac addresses that should be allowed to use WiFi connection. Then you have to go to router, connect to it by cable and re-add your mac address to the safe list once again. Sound simple, unfortunately there is a problem. The problem is called software bug, or laziness. I'm using web interface to configure my router. Unfortunately software that runs there was written to support only IE, in some cases. And this part is really interesting, cause majority of functionality is working under Firefox, Safari or you call it. Unfortunately not the functionality responsible for the modification of the safe list. Operating systems that I hold on my computer change in time (always doing something). Sometimes I have a working version of windows sometimes I do not. The only operating system that is working all the time is my Ubuntu. I was trying to use IE for GNU/Linux to modify the safe list, and it worked. I would not be myself if I did not write software that would run not only on IE but also on other thin clients. First thing to do is to see what the problem is. Firebug showed me that javascript engine can not find any element by it's id:


function jslSetValue(variable,value)
{
document.getElementById(variable).value=document.getElementById(value).value;
}


I've search the web to find out if somebody had already reported D-link with the problem, or did D-Link created any software update for that router model. I did not find anything. I've reengineered JavaScript that is used in that web interface and I've send it to D-link, maybe they will use my code instead of the current one. Now don't laugh I always send corrected code to the producer, unfortunately not very often I receive any reply. I can even bet that D-Link is not going to do anything with my code, they will just /dev/null it. But if even one per 20 companies that you send a code to will replay and thank you it is worth a try. If you face this same problem as I do there is a more simple way to quick fix your problem. After loading "Wireless Management" page just type in your URL:


javascript:document.forms.uiSetForm.uiPostAddMacAddress.value="00-1b-77-27-ca-72";


where 00-1b-77-27-ca-72 is your mac. And hit enter. Then hit history.back button in your browser. Then click "Add", now you will notice in a JavaScript console that there are bugs on the page, then click the "Apply button". Vuala your mac is added.

For smart ones, don't try to use 00-1b-77-27-ca-72 mac near my flat, it won't work cause it is just an example, I don't use it.

There are some interesting things about this particular pice of software. You may say that it is not a bug but producer simply just not want to support anything else besides IE. If it is true then why did they write JavaScript so some functionality will work on Firefox and some will not? Next interesting thing is the design. You probably noticed that they extracted some very simple logic into separate functions. I truly enjoy that. It also means that somebody did either a good design or refactored that software in a really nice manner. Why then he did not check if all the functionality works on different then IE thin clients? I'll never known. Whatever guess I'll take I'll still be just a child living in the big world. The world that I can never truly understand.

2 comments:

Unknown said...
This comment has been removed by a blog administrator.
Mateusz Kopij said...

Oryginal article had a big bug. It happened because I didn't want to explain myself deeply, and I wrote something that I didn't mean. The way that I choose to fix it was to re-edit the text so people won't get confused. Thanks for comment.