Paul - The Programmer

simple & stupid

Configure javac to report messages in English

On my Chinese version Windows XP, the javac always shows Simple Chinese messages. But I'd rather see the English ones.

The traditional way is to change the default system Local setting, then the JVM local is changed as well. But this solution is too inconvenient and painful.

Fortunately, we do not have to do that. We can pass the '-J-Duser.language' option to the javac to change its JVM Local setting.


javac '-J-Duser.language=en' -help

 The javac will show the help messages in English instead of the Simple Chinese.

Those two options can also be passed in the ant script by adding the <compilerarg> in the <javac>


<target name="compile" description="compile hello world">
       <mkdir dir="${classes}"/>
       <javac srcdir="${src}" destdir="${classes}"  fork="true" >
           <compilerarg value="-J-Duser.language=en"/>
           <compilerarg value=""/>

The attribute fork="true" is mandatory. The two options can only effect the forked compiler.

Fix the Jython console on my Windows XP

The Jython console didn't work properly on my Chinese version Windows XP. It can not interprete the strings properly.


>>> print "hello world"


Looks like it's looking for a futher input.  After I input a '\n', ther console crashed and complains

LookupError: unknown encoding 'gb18030'.

This error never happens on the English version Windows XP. So, this problem definitely caused by the system default encoding.


With a few hours study for the JVM & the Jython encoding setting, I found 2 solutions.

1)  Change the JVM default character encoding

Start up the jython with option -Dfile.encoding=UTF8,then the Jython console's encoding will be UTF8 as well.


jython -Dfile.encoding=UTF8

For change the JVM encoding automatically, you can also create one environment variable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF8.


set JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

2) Change the Jython console character encoding

Start up the jython with option -Dpython.console.encoding=UTF8


jython -Dpython.console.encoding=UTF8

Or add this setting in the Jython registry file. On my laptop, the file is C:\jython25\registry


Now, you enjoy.




My Firefox was fucked by the ""

The story begins with I want to try the Powershell this weekend. But somehow the windows updater can not get the Powershell patch from microsoft official webpage.  So I decide to download the Powershell by myself from some software sharing website.

Anyway, I managed to install myself powershell. Everything looks good until I lunch my firefox. The Firefox always connects to that garbage website I mentioned in the title. Well, obviously that powershell installation package is not as clean as I wish. Somthing changed my Firefox configuration! I guess my system is not be infected any virus or worm. Since the anti-virus firewall didn't rise any alarm during the powershell installation.

The guys on the internet point out this kind of jerk website usally change the starup command of your appliction shortcut. So when you start the IE/Firefox, the application will open that webpage.

So, after a quick check, I found my Firefox shortcut starup command has been changed to "Firefox.exe".  The same to the IE, even though I seldom use it.

After recover the startup  command, my Firefox finally get rid of that stupid website.

Fuck them again.  All the thing they can produce is garbage.

The differences of df and du

  • df:
  1. df gets most of its information from the filesystem's primary superblock.
  2. df calulates the space used by the open files and the inodes.
  3. Check the open file size with "lsof -s <filesystem name> ".
  4. Check the used inode with "df -i".
  • du:
  1. du calculates the exatly size reported by the files on the filesystem. 
  2. du does not count the inodes and the open files.
  3. The block size setting does not effect du's calculation.

df is preciser for the logical used amount of filesystem. As well as du is good at reflecting the use of filesystem from the physical point of view.

Play wmv video in Firefox

Since the wmv files is only supported by the windows media player.  The firefox does not support the wmv files directly. Fortunately there is an addon can let the firefox recongnize the wmv video in the web page and play it with windows meida player Firefox plugin.

Here are the steps I took for playing windows media player video / audio in Firefox.

  • Install the windows media player Firefox plugin.

Download the installation package from the web page

Of cause, it's always recommended keep the Firefox shutdown while the installation.

  • Install the Firefox addon MediaWrap. We count it to translate the ActiveX  for the window meida player Firefox plugin

Install the addon from the web page        

That's all. After a quick restart of the Firefox, you can enjoy the wmv videos with Firefox.