Paul - The Programmer

simple & stupid

Setup a Linux PyS60 development environment

Well, I know that symbian is somehow out of fashion nowadays. Since Nokia just announced their mobile phone will move to windows mobile weeks before. 

But since I just have a 5230 on my hand. I'd like to get a little bit fun from this new toy.

The S60 SDK is quite heavy and windows only. The PyS60 is the only choice left for me.

First thing first. The python runtime is needed on the phone itself. 

The latest sis package is available on the source forge

I just download the S603rd edition sis packages which should support the S60 5th on 5230. Install the python runtim and python shell by the pc suite.

Now python shell is ready on the phone. There is one useful feature that you can remote connect to the python console via bluetooth.

But debug on the phone is not so convenient. The project PyS60 emulation library supports run the S60 python script in a general python runtime environment.

The needed libraries can be found on

Unzip the python libraries and set the PYTHONPATH accordingly. I can run the S60 python script on my laptop.

Let's see what I can do with the PyS60. Maybe try to create a tic-toc-toe for fun.

Maybe I should buy a bluetooth adapter for my old laptop. Then I can connnect to the python console via bluetooth with the minicom. This should be interesting.

I will update you with my findings. ;-)

Add prefix and append suffix to each line of text file

I need to update one text file to add prefix and suffix to each line. For instance, let's say the text file I need to update is like:


I want the file be updated as below.

prefix line-number-one suffix
prefix line-number-two suffix
prefix line-number-three suffix

Here are my solutions.

To update with vim:

:%s/.*/prefix & suffix/g

To update with sed:

$ sed 's/\(.*\)/prefix $1 suffix/' sample-file.txt

To update with awk:

$ awk '{ printf( "prefix %s suffix\n", $1 ); }' sample-file.txt


Enable Adobe Flash Player GPU acceleration on Linux

Flash Player uses the OpenGL to support GPU acceleration on Linux.

This feature requires the below features from the OpenGL facilities.

  • GL_ARB_multitexture
  • GL_EXT_framebuffer_object
  • GL_ARB_shader_objects
  • GL_ARB_shading_language_100
  • GL_ARB_fragment_shader

Flash player automatically checks the video card and driver combination meet the GPU compositing requirement.

However we can ask the Flash player to skip the GPU valiadation by define option OverrideGPUValidation in mms.cfg.

The mms.cfg is a system wild configuration file for policy setting. For Linux, mms.cfg has to be created with the path /etc/adobe.

So, what I need to do to enable the GPU acceleration is :

  1. Create file /etc/adobe/mms.cfg.
  2. Add  "OverrideGPUValidation = 1" ( without the quotes ) in mms.cfg. 1 is for true, 0 is for false.

Unfortunately, this trick does not work for my ATI X300 card. I didn't notice any improvement. The flash played in a little window still make CPU run over 70%.

After checked with glxinfo, I found only the GL_ARB_multitexture. All the other needed OpenGL features are missing. I thought that is the root cause.

By the way, the option OverrideGPUValidation may need Flash rendering problems or even system crash. You should use it with care.

Replace scim with ibus on Debian

The default input method framework of Debian is scim.

You may know from my last post that I just change to use sunpinyin for my default Chinese input method. But the scim sunpinyin engine seems like a little buggy. I can not switch between English and Chinese input by the shift. The window may hangs when I am typing pinyin.

Okay. I change to use ibus as well.

Firstly, the scim should be remove completely from system. Use the Synaptic or apt-get to remove all the scim related package ( scim,  scim input engines, scim libs and so on ).

$ sudo apt-get purge scim

Secondary, install the ibus and ibus sunpinyin engine.

$ sudo apt-get install ibus
$ sudo apt-get -t experimental ibus-sunpinyin

Finally, set ibus the default input method then restart the X session to active the ibus input method.

$ im-switch -s ibus


Install sunpinyin on Debian

The default scim-pinyin engine is too hard to use. It almost have no support to Chinese words. I have to pick up the Chinese characters carfully.

The great google told me sunpinyin is a better choice.

I don't like to download the sunpinyin source code from its google-code repository and compile it by myself. My laptop is not so powerful for gcc compiling. I prefer Debian package installation.

I only find the sunpinyin package in the expriemental repository.  So, I take the risk to install a experimental package. I just had enough for the scim-pinyin. ;-)

Warning: The expriemental packages is not complete distribution. They may do harm to your system without care.

You have been warned.

Let's go on.

1) Add the experimental repository to the /etc/apt/source.list

deb experimental main

2) Since I am using the scim. I install the sunpinyin engine for scim.

$ sudo apt-get update
$ sudo apt-get install -t experimental scim-sunpinyin

You may want to try the ibus. Some says ibus is more user-friendly than scim.

3) Configure the scim to set the scim-sunpinyin engine the default Chinese input engine.

Now I feel more comfortable for typing in Chinese. :-)