Archive for May, 2007

SQLite, mesin SQL yang kecil dan cepat

2007 May 29

Tulisan ini telah dipindah ke “SQLite, mesin SQL yang kecil dan cepat”. Silahkan kunjungi server barunya.

This post has been moved to “SQLite, mesin SQL yang kecil dan cepat”. Please visit the new server.

I knew it! Files are living things! They have genes!!!

2007 May 26

The problematic file is freetest.htm. I have identified that it has an NS_ERROR_XPC_NOT_ENOUGH_ARGS gene. With that gene, you cannot do any AJAX from the file on certain environments…

No, I’m not on a crack… Listen to my detailed account, all you Javascript developers… That defective gene might be on YOUR file.

After learning how to use AJAX on a dummy page, I coded the real thing on freetest.htm, the real page. Like most Javascript programming, sure enough it only works on one browser. The lucky one is Opera 9 this time. The suckers are Firefox 2 and IE 6.

Browser programmers are ultra-smart guys, I assume the mistake is on my part. OK, so I copied the AJAX code to a dummy, clean, HTML page to find the bug. However it works!

Ah, so it must be some arcane interaction between the previously-existing Javascript code and the newly-added AJAX code. But my AJAX code is pretty complicated. Therefore I tried adding the simplest possible AJAX action in my real page, trying to see whether a simple AJAX works at all. The simple AJAX creates an XMLHttpRequest, sends a request, and retrieves the response. This time it works in Opera 9 and IE 5. Firefox (using Firebug debugger) gives this error:

uncaught exception: [Exception... "Not enough arguments"
nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)"
location: "JS frame :: http://localhost/aspx/freetest.htm ::
doAjax :: line 26" data: no]

It’s time to hunt which other js file conflicts with this one. I deleted the reference to other js files one by one, until there is no Javascript code other then the AJAX itself! But still AJAX doesn’t work!

Lol now that’s funny. OK, so I tried modifying my real file further (I’ve backed it up), deleting more useless things like CSS and title, until it matched another dummy file (freetest-simpleajax.htm) with the same AJAX code down to every character. Browsers are weird, so there is still the slight possibility that the TITLE tag messes things up. However it still doesn’t work while AJAX works on the other dummy file!

Obligatory md5 result:

1ab3bdf1ab23aabd6cfa4b1210bc7ee2 *freetest.htm
1ab3bdf1ab23aabd6cfa4b1210bc7ee2 *freetest-simpleajax.htm

(since the content of the files are identical, the genes must be stored somewhere else such as in the NTFS Master File Table)

Lol… I tried using the save as command to save freetest.htm into freetestxxx.htm. That’s probably the equivalent of reproduction. Amusingly, freetestxxx.htm works fine. Did the defective gene not get passed?

Ah, I forgot a very basic thing! Phenotype (visible traits, like the body height of an ape and an HTML page throwing exception) comes from the intricate interaction between genotype and the environment! Basic Biology… Let’s try opening freetest.htm on another tab of the still-running firefox.exe instance…


It works!

So, it must be the environment. The other tab must be too humid or something for freetest.htm to do AJAX. It’s not a problem of cache (the tab loading an old, nonworking version of the file). I tried modifying freetest.htm by adding visible text and reloading it on both tabs. The text appears on both, signifying that both tabs opened the most recent version of the file. However AJAX still doesn’t work on that cursed tab…

Whatever… I still haven’t achieved what I wanted, making the real AJAX code work on the real page… Back to work…

Edit: The culprit is the function named parent. Renamed it to domParent. What’s weird is that after the exception occurs, the tab will be unable to do AJAX on that page even after the problem has been corrected (hence the story above).

Edit 2: It doesn’t work in IE! The ringleader is different this time… In IE 6, there is no XMLHttpRequest required for AJAX, but we can achieve the same thing by creating an ActiveXObject as shown:

var foo = new ActiveXObject('Msxml2.XMLHTTP');

However, it turns out that the variable foo won’t behave completely like a real Javascript object! It fails when we try to dynamically add a property, such as: = 'This thing normally works';

My code adds an id for every XMLHttpRequest object created, so it fails miserably in IE 6… Geesh, I now have to code a different way of tracking those requests…

Indosiar melakukannya lagi: Virus SCA

2007 May 15

This post has been moved to “Indosiar melakukannya lagi: Virus SCA”. Please visit the new server.

Tulisan ini telah dipindah ke “Indosiar melakukannya lagi: Virus SCA”. Silahkan kunjungi server barunya.

Using the prefix -an to make an informal verb from a noun

2007 May 12

This post has been moved to “Using the prefix -an to make an informal verb from a noun”. Please visit the new server.

Kenapa aku (dulu) tidak mau jadi dokter

2007 May 5

Tulisan ini telah dipindah ke “Kenapa aku (dulu) tidak mau jadi dokter”. Silahkan kunjungi server barunya.

This post has been moved to “Kenapa aku (dulu) tidak mau jadi dokter”. Please visit the new server.