Monthly Archives: November 2008

Right-click a file and choose to launch in vim.

Gvim is a good application.  Right-click on a file (e.g. *.html) will give me the option to launch it in gvim.  But gvim has a big problem.  It uses a built-in terminal with limited functionality.  For example, I am used to pressing Shift-k to view the man page for the function where my cursor is.  If I do this is gvim, I’ll get WARNING: terminal is not fully functional, and the man page is filled with “codes” (for creating bold effect I guess) that makes it hard to read the content.

There seems to have no way to workaround this gvim issue, so I decided to stick with vim.  In order to have “right-click then launch in vim in a gnome-terminal”:

1. Right-click on the file with the said extension (e.g. *html).
2. Click on Properties.
3. Choose Open With tab.
4. Click on the Add button.
5. Click on the Use a custom command.
6. Write the command gnome-terminal -x vim
7. Click the Close button.

Now, right-click on the file gives you an option to Open with “gnome-terminal”.  Choose that and you have your file open in vim.

All is good except the name of the option Open with “gnome-terminal” which is wrong.  I want it to be Open with “gnome-terminal-vim”.  So, I write a one line shell script called gnome-terminal-vim with the content:

gnome-terminal -x vim "$1"

Make the script executable and place it somewhere in $PATH.

Lastly, change the command in step 6 to gnome-terminal-vim

That’s it.


Metacity and AWN in Lenny


Earlier today, I posted my setup of Compiz and AWN.  But then, I found that, my system is taking too much CPU (mostly xorg).  Even during video playing (MP4), xorg hits 90% CPU.  Then, I started to find another composite window manager to replace Compiz.  Metacity is a compite window manager, but when I start AWN, it said:

Error: Screen isn't composited. .....blah blah

Then I try to look around in the net and finally found that, I have to turn on the “composite manager” support in metacity explicitly.  It is off by default.  So, just fire up the gconf-editor, edit the key:


set it to true (tick the check box).  That’s all.  My system is now as fast as before and with the AWN!  🙂  Well, there goes all the compiz effects, but usability is more important.

Finally, ~/.gnome2/session (copied from /usr/share/gnome/default.session) has the following content:


0,RestartCommand=gnome-wm --sm-client-id default0
1,RestartCommand=avant-window-navigator –sm-client-id default1

Compiz-Fusion and AWN on Lenny


I’ve been using Compiz-Fusion from Shame repository since Etch.  After installing Lenny, I tried to use the Debian official Compiz package.  Too bad, it didn’t work.  So, I go back to Shame repository.  It just work out-of-box, not to mention, with all latest and greatest features.  Oops, almost out-of-box.  I need to enable composite extension for X myself.

At the end of “/etx/X11/xorg.conf”, add the following:
Section "Extensions"
Option "Composite" "Enable"

repos: deb ./
repo key: wget -O- | apt-key add -

Avant Window Navigator (AWN) is a Mac-OS-like docker.  Etch does not have the package and building from source requires newer libraries also not available in Etch.  Now I have lenny and I have AWN installed.  I’m using the official debian package and pretty happy with it.  Lenny has the latest version of AWN!  Unfortunately, not all applets work and not all available applets are there in the package.  The missing applet that I want the most is: notification-area applet (thanks to debian decision that the applet is not stable!!!).  Without this, checkgmail and scim cannot be shown.  Found a firefox add-on that can do some of the task I used to do with checkgmail (but still not a total replacement).  For scim, luckily I can use key-board shortcut (CTRL+SPACE and CTRL+SHIFT) to enable / change scim input methods.


In Etch, I used to start the compiz-manager in gnome-session, but this time I simply don’t want to waste any time in starting metacity then replace with compiz.  I want Compiz to be the default window manager.  After hours of searching and testing, finally, I found a working solution:

Copy /usr/share/gnome/default.session to ~/.gnome2/session and edit it to your preference.  Mine has the following content:

0,RestartCommand=compiz-manager --sm-client-id default0
1,RestartCommand=avant-window-navigator --sm-client-id default1

VIOS 撞车 第3次



Find broken symlinks

I’m going to make some directory moving and it will break some symlinks.  So, I need to find out those broken symlinks and update them accordingly.  After some googling, I found a nice and easy way:

find . -type l | while read i ; do test -e $i || ls -l $i; done

The command not only show you the broken symlinks but also the missing destination file (or directory, etc).

Enabling / Disabling services in Debian

Enabling / disabling services in Debian is easy.  Just add / remove symlinks in /etc/rcX.d directory that points to /etc/init.d/serviceName.  This is simple and it works.  Just now, I found an easier way, using sysv-rc-conf.  First you need to install it

aptitude install sysv-rc-conf

Then, run it with root user.  A nice console GUI appears and show you all available services in the system.  You just need to enable / disable the appropriate check-boxes by pressing space bar or mouse click.  Becareful, all changes take effect immediately.

This is how it looks:


ACE+TAO and Naming Service

Building ACE+TAO and Naming Service can be difficult.  The default build which compiles everything takes hours to complete.  To speed up the process, I usually compile the items I want selectively.  But it took hours as well, because I’ve been making mistake due to the clarity of the documentation.  I did it again yesterday but this time I’m going to write down the steps, so that I won’t need to go through the reading, testing, redoing another round.

cd ~
tar jxf ACE+TAO-x.y
mv ACE_wrapper ACE+TAO-x.y
export ACE_ROOT=~/ACE-x.y
echo '#include "ace/config-linux.h"' > $ACE_ROOT/ace/config.h
echo 'include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU' > $ACE_ROOT/include/makeinclude/platform_macros.GNU
make -C ace -j3
make -C apps/gperf/src -j3
make -C TAO/TAO_IDL -j3
make -C TAO/tao -j3
make -C TAO/orbsvcs -j3 Naming_Service-target







1. 请一定要耐心聆听我的话
1. 私の話を  がまん強く  聞いてください

2. 信赖我  我永远是你的伙伴
2. 私を信じて。  私は いつでも  あなたの味方です。

3. 多和我一起游戏
3. 私と  たくさん遊んで

4. 别忘记我也有感情哦
4. 私にも心が  あることを  わすれないで

5. 不要和我吵架
5. ケンカは  やめようね

6. 如果我不听你的话 那一定是有原因的
6. 言うことを  聞かないときは  理由があります

7. 你能去学校 还有朋友 可是我只有你
7. あなたには  学校もあるし  友達もいるよね  でも  私には  あなたしかいません

8. 即使我变老了也要和我做朋友哦
8. 私が年をとても  仲良くして  ください

9. 我的寿命只有十年左右 所以请珍惜我们一起生活的时间
9. 私は  十年くらいしか  生きられません  だから  一緒にいる時間を  大切にしようね

10. 我不会忘记和你一起度过的时光 当死去的时候 拜托你 请一定要在我身旁
10. あなたと  すごした時間を  忘れません  私が死ぬとき  おねがいします  そばにいて。

ごめんね 小黄