2008年9月26日星期五

Make vim support GBK

Add set fencs=utf-8,gbk to ~/.vimrc

2008年9月7日星期日

The ultimate solution to MySQL chinese charset problem using ant sql task

This is the check list of items that need to be set to unicode:
1. The character encoding of SQL file for ant to call
2. The url attribute of ant task needs to be like this:
jdbc:mysql://localhost:3306/cocomoII?useUnicode=true&characterEncoding=UTF-8
3. The encoding attribute of ant task needs to be set to utf-8
4. Database and tables need to use utf-8 by adding CHARACTER SET utf8 COLLATE utf8_general_ci to the end of create database/table statement. The default is latin1!
5. (Optional)Start mysqld with --character-set-server=utf8 --collation-server=utf8_general_ci

Character encoding of mysql can be set in several levels, they are: server>database>table>column. If encoding at lower level is not specified, the one of higher one level is used.
The above 4 steps guarantee that the data would be correctly stored in database. If you want to view data correctly from mysql client, the additional steps are needed:

6. In mysql prompt:
mysql> charset utf8;

2008年8月26日星期二

ADSL on Ubuntu

Input
sudo pppoeconf
to configure user name and password.

Type pon dsl-provider to turn on the connection

Type poff to turn it off

2008年8月8日星期五

Install Grub from Ubuntu Live CD

This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.

(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see "sudo" that will mean to you that the following command should be entered at a root terminal.)

Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.

When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)

Code:

sudo grub

This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands

Code:

find /boot/grub/stage1

This will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)

Code:

root (hd?,?)

Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)

Next enter the command to install grub to the mbr

Code:

setup (hd0)

Finally exit the grub shell
Code:

quit

That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.

Now the explanation.
Sudo grub gets you the grub shell.
Find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub's files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.
So root (hd?,?) tells grub it's files are on that partition.
Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive's mbr.
Quit will exit you from the grub shell.

Original Post: http://ubuntuforums.org/showthread.php?t=224351

2008年7月16日星期三

Configure the default Java in Ubuntu

sudo update-alternatives --config java

2008年7月3日星期四

To work around JVM 64 bug causing Eclipse crash

Add
-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith
to eclipse.ini

The above option did not work.
Try delete it and add
-Xint
So far so good.

Other cue:
Try to use JDK 5 to run eclipse and use JDK 6 to develop
Disable automatic compiling

2008年6月28日星期六

SCIM bridge

安装scim-bridge后,需要配置

/etc/X11/xinit/xinput.d/scim

设置

GTK_IM_MODULE=scim-bridge
QT_IM_MODULE=scim-bridge