Make gedit to know Chinese encoded text automatically

The gedit, a text editor default provided by GNOME desktop environments, is set to recognise UTF-8 encode ONLY. To make it known how to open files encoded by another character sets correctly (eg. Chinese Big5, GBK, and so on), a simple step is given for GNOME 2. There are two ways to do it, one is by command line, and the other one is by GUI.

1. By command line – using the gconftool-2 tool:

First to get your current setting by

$ gconftool-2 --get /apps/gedit-2/preferences/encodings/auto_detected

and you will get the result like:


And then to add the wanted character sets, for example, Big 5 and GBK, w/ the command:

$ gconftool-2 --set --type=list --list-type=string /apps/gedit-2/preferences/encodings/auto_detected "[UTF-8,CURRENT,ISO-8859-15,UTF-16,GBK,BIG5-HKSCS]"

2. With GUI editor – gconf-editor:

$ gconf-editor

and then find out the path: /apps/gedit-2/preferences/encodings/auto_detected. The settings will show on the right side, and then you can add the character sets.

History search backward/forward for bash

One way to make the up/down arrow more functional in BASH environment is to assign the history search binding to them. But in my  Gentoo box (w/ long usage for about 2 years), the configuration is just:

$ vim ~/.inputrc

And then add the settings:

"\e[A": history-search-backward
"\e[B": history-search-forward

After re-login, the function works.

But in my new install Ubuntu box (10.04, 10.10, 11.04), it is not work. For some references: bash 記憶指令 For Linux, the solution is to use the HEX code of the keys not he old binding method (maybe for some API changes?). The detail step lists:

1. Find out the HEX code of up/down arrow. With this command:

$ showkey -a

and then keystroke them, you will get the output like:

^[[A      27 0033 0x1b
          91 0133 0x5b
          65 0101 0x41
^[[B      27 0033 0x1b
          91 0133 0x5b
          66 0102 0x42

2. Set up the hex code with bindings:

$ vim ~/.inputrc


Missing gcin (or applet) icons with Unity on Ubuntu 11.04

It is tragedy to upgrade my ubuntu box before it actually release. The new desktop environment – Unity, which was used in netbook Ubuntu version previously makes a new experience but with more missing thing. For example, the notification area icons are blacklisted via some reason (Farewell to the notification area).

The solution to solve it is simple, just settings via some commands, the reference is from How to re-enable notification area applets in Ubuntu 11.04. The commands are:

1. Get your current settings via:

$ gsettings get com.canonical.Unity.Panel systray-whitelist

And the result will like

['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype', 'hp-systray']

2. Modify it w/ adding gcin, like:

$ gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype', 'hp-systray', 'gcin']"

3. Relogin and the tray icon shown. 🙂

P.S if it is no work, retype the command via root, it may help.

Thanks for the people for help in thread on gcin forum.

Strange behavior of tomcat

Today, I work till midnight and waste much time for two stupid bug of Tomcat.

1. My configuration(locale web.xml) of a web service did not be active. That is, no mater what I modify the configuration and reload the application, it still no work.

For a long long long trace (for the correct application code and also tomcat re-installation twice), the problem is due to the file permission.

After I change it from 600 to 644, it works.

2. For servlet which setting correctly response and request charset, and content-type to UTF-8, the GET method for Chinese String is broken.

The final answer to solve it is modify the global web.xml configuration and adding the URIEncoding="UTF-8" into the Connector.

The two bugs wasting much more time for me and they are all stupid which make me cry.

Virtualbox 4 on Ubuntu 11.04 w/ kernel version 2.6.38

After I upgrade my office box for testing Ubuntu 11.04 (natty), my virtual box is broken w/ no error messages. After I try to start it as root, the message shown. The major problem is there no suitable kernel module for virtualbox.

After surveying this document: I am failing to build VirtualBox driver for Linux 2.6.38, I clean up my system and finally found the bug.

First it’s recommended for you to purge the whole system’s old packages to make it clean by using:

# aptitude purge virtualbox-ose virtualbox-ose-dkms
# dpkg --list |grep "^rc" | awk '{print $2}' | xargs sudo dpkg --purge
# locate -e virtualbox | xargs -n 1 rm -rf

Second, after I reinstall virtualbox, the problem exists. In that time I check my kernel version by uname -a and found the strange thing. My box is just install the generic version kernel, but boot w/ the -pae version. Tragedy, my box did not install the corresponding header version which is the major reason.

So I use the commend to install it by apt-get install linux-headers-....-pae and then the dkms module built and ran correctly.

Third, the default instillation of virtualbox-ose is no with the guest-additional package. The package is useful for sharing, mounting, seamless mode and etc features between host and guest OSes. That, I recommend you to install it.

GCIN overspot problem on skype with qt-static

As the same time I upgrade my system, I also encounter that my GCIN IME cannot be used the overspot feature on skype (it will disappear). And some strange problem like I cannot use ctrl+space to switch IMEs.

The solution is also simple, that is, to modify the gtk-immodules settings of the global system. Because in the newer Gtk version, the configure file changed that my poor system cannot find it.

The detail step is listing as:

 $ sudo gtk-query-immodules-2.0 > /etc/gtk-2.0/i686-pc-linux-gnu/gtk.immodules

And modify gcin’s setting from “zh:jp” to “*”. Then, the step is to setup the modules to make QT/XIM based program works.

$ vim ~/.xprofile
And add the following settings:

export QT_IM_MODULE=gcin

Then the overspot feature works (although in skype, it just stick at the left-top corner of program).

xorg-server 1.9.4 with Gallium and xf86-video-ati-6.14

About a month ago, I’ve upgrade my Gentoo box to xorg-server 1.9.4, which is a long time since last upgrade. Despite much more conflict packages with uninteresting solution steps, there are some note can be shared.

The Gallium, a new 3D environment proposed by free-desktop, is a new feature for some graphic chip user. My ATI Radeon chip is luckily to have it.

With enable it, my gentoo box will hang on X started at first. After surveying some resources such as radeonBuildHowTo, the solution is easy and I’ve post my solution to gentoo’s bugzilla(#350280).

The crux is due to some kernel options I didn’t enable it, such as:

# CONFIG_FB_RADEON is not set

where is referenced from the radeonBuildHowTo above (detail).

Finally, my gentoo box is worked w/ Gallium, and the detail system info is listing:


OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on softpipe
OpenGL version string: 2.1 Mesa 7.9.1
OpenGL shading language version string: 1.20

If you have the same problem, try it and I hope it is useful.