Category Archives: Python

Pickling Python New Style Object Using State

Pickling is basically Python object serialization.
See the Python PEP 307 Extensions to the pickle protocol for further details.
Below, I show a simple way to pickle a new-style object using the state of the object. obj.__setstate__(state) will be called when unpickling if the state is being pickled.

def __newobj__(cls, *args): return cls.__new__(cls, *args) # NEWOBJ pickle

class [...]

Getting Sky Explorer to Work on Symbian 3rd Edition

It is actually still quite confusing for me.
Firstly, Sky Explorer needs keycapture module which requires SwEvent capability. Refer S60 3rd Edition Development.
To sign the SIS file with SwEvent capability means that I need to get a symbian cert. Go to www.symbiansigned.com and get a free Symbian Developer Certificate. (need to download DevCertRequest tool to [...]

How to Write a Spelling Corrector

Type in a search like [speling] and Google comes back in 0.1 seconds or so with Did you mean: spelling.
Peter Norvig wrote a toy spelling corrector that achieves 80 or 90% accuracy at a rate of at least 10 words per second, in 20 lines of Python 2.5 code during a plane flight. See his [...]

Advanced navigation

The advanced navigation gives you a quick way to find the file you are looking for in a long list by entering the 1st character of the filename. The current selection is changed to the next item that starts with the character you have entered, If the search reaches the bottom of the list, it [...]

2 keys input method

As its name implied, this is an input method that I devise for mobile phone using strictly 2 keys that combine to produce a character. I like my method more than the default phone input method, but the dictionary input method is obviously easier and faster than mine.
How is the method designed?
First, every possible character [...]

Sky Explorer Settings

The following settings can be set:

Email
SmtpHost
Timezone (eg. 8 )
Text enter mode
File exts-TextEditor(eg. py txt)
Images directory

The Email setting is used as the email sender, the from email address. The SmtpHost is the mail server from which the email is sent through.
A timezone of GMT +08:00 is entered as 8. There is a problem here as this [...]

Application menu and tagging

What is this? It is like the Nokia application menu, except that it is built within the program itself. The menus in the program is equivalent to the tags that you have tagged to an application.
Initially, none of the application is tagged, when you navigate to the Apps folder, you should see a list of [...]