Archive for the ‘Biology’ Category

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…

Am I learning Japanese or Biology?

2007 March 25

One essential aspect of learning a language is learning its vocabulary. In my Japanese study, this tranlates into learning kanji which are the building block of many words.

Most kanji are for things I am familiar with. Some examples are 人 (hito, person), 玉 (tama, ball), and 火 (hi, fire). Many are for common animals like 虫 (mushi, insect), 亀 (kame, turtle), and 猫 (neko, cat). Unexpectedly, I quite oftenly encounter kanji for an animal or plant that I have no knowledge about.

An example is 藤 (fuji, tou) which is the kanji for the plant genus Wisteria. It is found on many people’s name, such as 藤本美貴 (Fujimoto Miki), 後藤真希 (Gotou Maki), and 工藤新一 (Kudou Shin’ichi).

Using KANJIDIC or EDICT, I only get a brief description like “wisteria”. That is useless for someone with a shallow knowledge such as me, but enough as a pointer to get more information elsewhere. If I’m not online, my next stop is Stardict, which gives more detail such as “a climbing plant with purple or white flowers”. At least I could know that “Wisteria” is a plant, not something else like “hysteria”. My final stop is of course Wikipedia, which gives detailed descriptions and more importantly, images!

I’ll share some of the new living things I’ve discovered… Do you know them?



In Japanese, it is フジ (藤, fuji). And no, Mount Fuji is written differently. It is native to Japan and other countries including eastern US. It can climb by twisting itself along any available support. As I have written above, it is used on many people’s name. Anyone knows its Indonesian name?



In Japanese, it is セミ (蝉, semi). I found it on Berryz Koubou‘s song titled “Semi”. It is a family of insect that makes a lot of noise (but it’s different from Cricket). According to Wikipedia Indonesia, the Indonesian name is Tonggeret (never heard it before).



In Japanese, it is キク (菊, kiku). I found it on an author’s name (菊池, Kikuchi) at the digital library Aozora Bunko. In Japan, this plant is a symbol of death and are only used for funerals (which means, don’t give it to your Japanese girlfriend). 菊花紋章 (kikukamonshou) is the name given to the position of Japanese emperor. By the way, I recently went to Moro department store and found a Chrysanthemum product. It is a Chinese product and how happy I was to see the character 菊 written on the box :). The Indonesian name is Seruni (never heard it before too).

Manchurian Violet

Manchurian Violet, Viola mandshurica

In Japanese, it is スミレ (菫, sumire). I also found it on a writer’s name (薄田泣菫, Sasakida Kyuukin, and please don’t ask me what “sasaki” means). Is it also “Violet” in Indonesia?

Japanese Royal Fern

Japanese Royal Fern, Osmunda japonica

In Japanese, it is ゼンマイ (薇, zenmai). I knew what a fern is, but I was curious whether this fern has a striking difference (nothing striking to a layman like me). Strangely, it is the kanji used in Rose (薔薇, bara), which is where I found it. In Indonesia, ferns are called paku or pakis.

If you want to be able to read people’s name, you’ll be sure to encounter lots of these exotic kanji. It’s almost like they’re forcing us to be a botanist or zoologist. You’ll also find these kanji in songs and literatures (e.g., novels), because writers want to look cool by using obscure characters.

As a closing, note that I use katakana to write the name of the plants and animal above. This is a modern practice, which originates from the scientific community. Even in the Japanese Wikipedia, the article for dog is titled イヌ (inu) despite its kanji 犬 being taught in grade 1 elementary school. It is probably a sensible decision, considering that there are countless living things on Earth.

Laborous questions in a test

2007 March 13

Why must instructors give a very “long” problem which doesn’t test understanding any better than a “shorter” problem?

Here’s an example problem to test the understanding of shift cipher:

Encrypt the plaintext “example” using the shift cipher with key B.

That problem should suffice. However here’s what some instructors like to give:

Encrypt the plaintext “iliketoseemystudentssufferhahahaiamevil” using the shift cipher with key P.

The second problem isn’t intellectually harder, it’s just more laborous!

I can forsee a similar agony in a microbiology test:

The nucleotide sequence of one DNA strand of a DNA double helix is:
(dunno whether it is realistic, I just typed the ATGCs randomly)
What is the sequence of the complementary strand?

Isn’t a strand of -ATGC- enough?

PS: Oh and about that second example, it’s actually quite nice considering that my instructor gave a LONGER ciphertext to encrypt… Unbelievable…