Archive for January, 2007

Learning Javascript; A simple game

2007 January 30

The plan for my final project is a web-based application. Because I don’t usually play with web technologies, there are many things that I have to learn. I chose Javascript as my first subject.

So, I’ve been reading w3school’s tutorial on Javascript. It’s great that the syntax is C-ish, so I could skim most of the syntatic stuffs.

Please don’t misundertand the title of this post. It doesn’t mean that “Learning Javascript is a simple game”. It means that “after learning some Javascript, I made a simple game” :). Here’s the game, please test it. (That’s the beauty of web apps, people can run your programs in any platform without the hassle of installing extra programs)

About the game itself, there were 3 major rewrites. The initial version could actually produce starting points that could not be solved! I rewrote it so that the initial state of the puzzle is generated from the completed state through a series of LEGAL moves. Second, the generator could produce an initial state that could be solved very easily. That sucks, so I added a check to keep shuffling if the initial state is too easy. Third, the “empty” cell is changed from the lower right to the middle. The reason is obvious, so that there is more incentive to solve the puzzle 🙂

Morning Musume-sama?!?

2007 January 30

様 (sama) is a honorific personal suffix. You attach it to the end of a name/pronoun of someone you respect very much. Here are some examples:

  • God is oftenly called 神様 (kami-sama). [Fullmetal Alchemist]
  • Hokage is the leader of the Konoha ninja village. People use 火影様 (hokage-sama) to address the hokage. [Naruto]
  • Sapphire, a prince, calls his father (a king) お父様 (otou-sama) and his mother (a queen) お母様 (okaa-sama). [Ribbon no Kishi the Musical]
  • A daughter of a yakuza (Japanese mafia) also calls her father お父様 (otou-sama). [Full Metal Panic Fumoffu]
  • Midori is a daugther of a high-class family. The maid in her house calls her お嬢様 (ojou-sama). [Midori no Hibi]
  • A maid refers to her mistress as 奥様 (oku-sama). [Mini Moni Brementown Musicians]
  • Customer is referred as お得意様 (otokui-sama). [Chokkan 2 ~Nogashita Sakana wa Ookiizo!~]

However, I was surprised to find this:

Morning Musume-sama

It was from a backstage interview of Momusu’s 2nd concert in 1999 (Fukuda Asuka’s graduation concert). There you can see Nakazawa Yuko standing outside Momusu’s dressing room. The room label reads モーニング娘。 様 (Morning Musume-sama)!!! I never knew the staffs honored them THAT much…

However that was in 1999, and we know that culture changes in a blink of eye. I, for one, have never encountered “Morning Musume-sama” in a more modern setting.

Force katakana

2007 January 27

I found a great IME shortcut key (Windows XP’s IME)…

The default replacement for characters we input is hiragana. For example, after activating the IME and writing "suki", the replacement string that appears on screen is "すき". By pressing spacebar repeatedly, we can cycle through the alternatives like "好き".

The magic shortcut key is F7. It directly transforms the string into katakana! キーボードショートカット大スキ!!!

Kanji Mnemonic: Devil’s hand

2007 January 23

Pay attention to these kanji:

  • 猫 (ねこ, cat)
  • 獄 (used in 地獄 (じごく), hell)
  • 狗 (used in 天狗 (てんぐ), a long-nosed demon)
  • 狂う (くるう, to go crazy)

All those kanji have the same shape on its left side. I call that shape “devil’s hand”. Here’s the illustration.

Imagine a devil wanting to kidnap a baby. First, he opens a portal that goes to the baby’s cradle:

Magical portal

After that, he can take the baby using his hand through the magical portal:

The hand

Notice the shape similarity. Here’s the superimposed image:

The hand superimposed

Thus, the mnemonic for that shape is “devil’s hand”, or alternatively just “devil”.

Paying tuition fees

2007 January 23

The procedure seems to change every semester. Once it was on Kinanti. Once it was in BNI. This time it’s in Bank Mandiri.

I arrived there around 10 AM and got number 56. I needed to wait until my number is called by the female worker. The currently called numbers were in the 200s, and simple inquiry revealed that the number will go to 500 before going back to 1. I was additionally told that mine should be called around an hour later (which means around 11 AM).

So I left to browse the web. I took note that I left at 10:18 and the last called number was 285. I arrived back at 10.56 and the last called number was 391.

I deliberately wrote all those info because I wanted to predict when I would be called. After finding a seat, I started to calculate.

The average rate of people processed during my absence was (391 – 285) people / (56 – 18) minutes, which is around 2.789 people/minute.

Let us assume that the processing rate is constant. My number is equivalent to 556, so I would be called around ((556 – 391) / 2.789) minutes later, which is around 59 minutes later. Because the time was 10:56, that means I will be called around 11:55.

I waited while practising writing some kanji. I got called at 11:57. Pretty close, eh? (compare with the 11 AM prediction which was pulled out of thin air)

Some number types in Japanese

2007 January 23

In Japanese, number is 数 (かず, kazu). In compounds, the on-reading すう (suu) is used. Here are some compounds which denotes number types:

Kanji Kana English Literal meaning
整数 せいすう integer arranged number
正数 せいすう positive number correct number
負数 ふすう negative number defeated number
偶数 ぐうすう even number unexpected number
奇数 きすう odd number strange number
素数 そすう prime number elementary number
実数 じっすう real number real number

In the Mechaike Bakajo Test, one of the math question asks to name “integers which are divisible by 2 and integers which are indivisible by 2”. Niigaki Risa answered “divisible numbers” and “indivisible numbers”.

Windows XP Half-Japanese Edition, Service Pack 2 (more commonly known as “Windows XP 半Japanese エディション, Service パック 2”)

2007 January 20

Windows isn’t Windows if it doesn’t behave crazy from time to time.

OK, so I installed Japanese fonts (for an obvious purpose). I also installed Japanese IME so that I could input Japanese in a sane way. Last, I set “Language for non-Unicode programs” to Japanese so that I could activate IME on console programs (“Regional and Language Options” -> “Advanced”).

See, I did all those Japanese-related tweaking, but never did I order Windows to set its user interface to Japanese (and I couldn’t see any way to do it). But this is what I get:

Windows XP Half-Japanese Edition

I don’t know what caused it. When started, the program was fully in English. When the menu went crazy, other programs were also still fully English.

Oh, and previously I’ve observed half of my Notepad’s menu turning into Japanese. A precious moment, but I delayed taking a screenshot until the computer went down (electricity outage or Windows crash).

Or perhaps Windows has an advanced detection technology that could detect my kanji level. I’ve learned all kanji in the above screenshot. Maybe as I improve, more menu items will turn into Japanese.

Recent word dumps summary

2007 January 20

The previous n posts (this, this, this, this, this, this, and this) are word dumps that were pending for long because of the finals. It is evident from those posts that I now change my word hunting pattern. Previously, I did a very lengthy word dump for one topic before moving to another topic. Now I hunt from various places at a time, so those words dumps are “work in progress”.

With all those dumps, I now know 913 kanji and my word list contains 4949 words. That means my kanji and vocabulary level is between JLPT level 3 (300 kanji, 1500 words) and 2 (1000 kanji, 6000 words). Of course for grammar, I’m probably around JLPT level 6.

We shall eradicate illiteracy in the best possible manner. – Ayatollah Khomeini

Dump: Aozora Bunko

2007 January 20

Aozora Bunko is an electronic library of Japanese literature. Supposedly, I can find things like novels inside.

Currently I’m learning all kanji and words from the front page. Haven’t reached the end, but I’ve gathered 34 kanji and 176 words. After the front page is done, I’ll try to find a nice (torturing) reading inside. It will be a perfect complement to the encyclopedic nature of Japanese Wikipedia.

Here are the kanji:

凝宴源探署載訂介紹及権覧延著佐呉扱随模資営規総保確護掲視経証緯垢河藤

…and the words:

(more…)

Dump: Ribbon no Kishi – The Musical

2007 January 20

Sapphire (Takahashi Ai) and her mother
Sapphire (Takahashi Ai) as a prince
Niigaki Risa as a court lady

Ribbon no Kishi is a manga by the legendary Osamu Tezuka. The story is about Sapphire who is born with two souls. She is a girl, but must pretend to be a boy so that she can inherit her father’s throne.

On the end of 2006, Morning Musume, v-u-den, and 2 “real” theater actors did a musical drama of Ribbon no Kishi. The performance is magnificent, and I’m using it for word and kanji dump.

Of course there is no Japanese script available. Therefore I must match what I hear to the English sub. Sometimes they talk so fast or slurry, so after desperately failing to dechiper the hard parts I just skip them. A great and challening listening practice.

I’ve only done the first 30 minutes of Act 1. The whole Act 1 is around 1 hour 18 minutes, and there is still the second Act. Here are the 50 kanji I’ve gathered:

乱摘亜忍隣騎脚染麻渡此鬘羨久許危程頂遥唾宣鮮揺団宜燃盗唐険誤妃哀堪復閲盆黙嘆舞渦飾扇頃嫌香踊詰掛冒振

And the 307 words:

(more…)