Archive for the ‘Hardware & Software’ Category

Multilanguage support in Windows programs

2008 April 6

This post has been moved to “Multilanguage support in Windows programs”. Please visit the new server.

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 πŸ™‚

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! γ‚­γƒΌγƒœγƒΌγƒ‰γ‚·γƒ§γƒΌγƒˆγ‚«γƒƒγƒˆε€§γ‚Ήγ‚­!!!

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. sorter

2006 October 10

This post has been moved to “ sorter”. Please visit the new server.

Google Code Search

2006 October 7

Google now searches source code! The URL is Other than indexing easily accessible source files (.cpp, .cs, .java, etc stored in a web server), it also searches inside a compressed file (like .zip) and code repositories (like cvs).

Anyway, I got 2 hits on Google code search :)…

Starting a new process on the .NET Framework

2006 September 30

To run another program from a .NET program, call the System.Diagnostics.Process.Start method. An example C# program is:

using System.Diagnostics;

class RunNewProcessTest
	static void Main()

In the example, Notepad will be invoked.

A document can be given to the start method (for example “c:\test.txt”). If there is an associated application for the file, the application will launch. Else an exception will be thrown.

If any arguments must be given to the invoked process, put it in the second argument of the Start method. An example is:

Process.Start("notepad", "c:\\test.txt");

(Note: backslash (‘\’) must be escaped)

In this regard, the Process.Start method is different from C or C++’s system function (defined on stdlib.h (C) or cstdlib (C++)), which would be:

system("notepad c:\\test.txt");

Embedding a resource into a .NET assembly and loading it

2006 September 30

This post has been moved to “Embedding a resource into a .NET assembly and loading it”. Please visit the new server.

McCune-Reischauer Converter

2006 September 27

I like to use the McCune-Reischauer form of Korean Go players’ name because that’s what Sensei’s Library use for page titles. Therefore, it is “Yi Se-tol” not “Lee Sedol” and “Yi Ch’ang-ho” not “Lee Changho”. Unlike other romanizations, we can reconstruct the hangul correctly from its McC-R form.

It was a pain in the arm to write articles containing Korean Go player names because I had to repeatedly look at the reference and do lots of “find & replace”. Therefore I made a small tool to do that job:

$ mcrconverter --help
This program will change Korean Go player names in a file into
their McCune-Reischauer form.

mcrconverter [options] file:
    change the contents of a file
mcrconverter [options] folder:
    change the contents of SGF files in a folder

Options can be:
    also changes the file/folder name
    search for files inside subfolders recursively

Other than useful for writing articles, this tool can also be used to mass-rename the contents of an sgf file, and even the filename itself.

The source and executable are here (requires .NET Framework 2.0).

I’m a computer scientist, not your tech support

2006 September 27

Problems worthy of attack
Prove their worth by fighting back
    – Piet Hein

A Princeton computer science major writes about his/her annoyance of being asked to fix computer problems.

What are problems in the field called “Computer Science” anyway? It’s NOT about how to make a web site. It’s NOT about fixing a machine that won’t boot up. It’s NOT about getting rid of worms investing your computer. It’s NOT about making the best hardware purchase.

Wikipedia has a list of unsolved computer science problems. It includes the famous P=NP. There is also a similar, significantly longer, list for mathematics and physics. This probably reflects the relatively young age of computer science. (those thinking mathematics is finished is dead wrong; the amount of mathematical research activity is in fact getting much bigger from time to time)

Anyway, does the reverse happen? (which means, people enrolling CS expecting to be taught about fixing computer problems)