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 http://sourceforge.net/projects/pys60/files/pys60/1.4.5/

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 http://sourceforge.net/projects/pys60-compat/files/pys60-compat/.

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

Convert file format from dos to unix

Convert file format by sed

$cp you-file-name your-file-name.bak
$sed 's/^M//g' your-file-name.bak > your-file-name

Covert file format by Perl

$perl -i.bak -pe 's/^M//g;'  your-file-name

Covert file format by vim

:setlocal ff=unix
:wq

 

Detect file format is dos or unix

Detect file format with grep.

$ grep '^M'  your-file-name

^M is Ctrl-V + Ctrl-M. If the grep returns any line, the file is in DOS format.

Detect file format with vim.

1) Open the file with vim.

2) Use the vim set command to show the file format.

:set ff?

The command returns fileformat=<dos/unix/mac> to indect current file format.

 

 

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.