Paul - The Programmer

simple & stupid

Hide Vim menu bar and tool bar

" Hide the menu bar

:set guioptions-=m

" Hide the tool bar

:set guioptions-=T

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.

e.g.

javac '-J-Duser.language=en -J-Duser.country=GB' -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>

e.g.

<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="-J-Duser.country=GB"/>
       </javac>
</target>

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

Finding of this weekend

Why China is not a great cultural nation?

www.bullock.cn/blogs/lihuafang/archives/94319.aspx

Quoted from Han Han's speech at  XiaMen University.

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.

e.g.

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

e.g.

jython -Dfile.encoding=UTF8


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

e.g.

set JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

2) Change the Jython console character encoding

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

e.g.

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 "www.114.com.cn"

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 www.that-stupid-jerk-website.com.cn".  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.