<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: series60 code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 08:04:34 GMT</pubDate>
    <description>DZone Snippets: series60 code</description>
    <item>
      <title>dbms database class</title>
      <link>http://snippets.dzone.com/posts/show/4242</link>
      <description>I'm at my first attempt at creating something for the PyS60 and I needed a simple sql wrapper class...&lt;br /&gt;I'm an experienced programmer, but has never programmed in python for s60 and it's been a while since I've used Python... So I hope this will help somebody, not annoy ;-)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Filename: db.py save in your Python dir&lt;br /&gt;import e32db&lt;br /&gt;&lt;br /&gt;class db:&lt;br /&gt;    def __init__(self, dbpath):&lt;br /&gt;	self.db = e32db.Dbms()&lt;br /&gt;	self.dbv = e32db.Db_view()&lt;br /&gt;	self.reset_counters()&lt;br /&gt;	try:&lt;br /&gt;	    self.db.open(unicode(dbpath))&lt;br /&gt;	except:&lt;br /&gt;	    self.db.create(unicode(dbpath))&lt;br /&gt;	    self.db.open(unicode(dbpath))&lt;br /&gt;&lt;br /&gt;    def reset_counters(self):&lt;br /&gt;	self.affected_rows = 0&lt;br /&gt;	self.num_rows = 0&lt;br /&gt;	self.__internal_counter = 0&lt;br /&gt;&lt;br /&gt;    def query(self, sql):&lt;br /&gt;	self.reset_counters()&lt;br /&gt;	if sql.lower().startswith('select'):&lt;br /&gt;	    self.dbv.prepare(self.db, unicode(sql))&lt;br /&gt;	    self.dbv.first_line()&lt;br /&gt;	    self.num_rows = self.dbv.count_line()&lt;br /&gt;	else:&lt;br /&gt;	    self.affected_rows = self.db.execute(unicode(sql))&lt;br /&gt;&lt;br /&gt;    def next(self):&lt;br /&gt;	row = {'id': 0}&lt;br /&gt;	if self.num_rows &lt; 1:&lt;br /&gt;	    self.reset_counters()&lt;br /&gt;	    raise StopIteration&lt;br /&gt;	elif self.__internal_counter &lt; self.num_rows:&lt;br /&gt;	    self.dbv.get_line()&lt;br /&gt;	    for i in range(self.dbv.col_count()):&lt;br /&gt;		row[i] = self.dbv.col(i+1)&lt;br /&gt;	    self.dbv.next_line()&lt;br /&gt;	    self.__internal_counter += 1&lt;br /&gt;	    return row&lt;br /&gt;	else:&lt;br /&gt;	    self.reset_counters()&lt;br /&gt;	    raise StopIteration&lt;br /&gt;&lt;br /&gt;    def __iter__(self):&lt;br /&gt;	return self&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now to create and fill db, create a file in the same dir as the db.py with this content:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Change __exec_path to the path of your python script dir&lt;br /&gt;__exec_path = "E:\\Python\\"&lt;br /&gt;dbname = "test"&lt;br /&gt;&lt;br /&gt;import sys&lt;br /&gt;sys.path.append(__exec_path)&lt;br /&gt;from db import db&lt;br /&gt;&lt;br /&gt;# This will open E:\\Python\test.db - it will be created first, if not existing&lt;br /&gt;mydb = db(__exec_path+dbname+'.db')&lt;br /&gt;mydb.query("create table testing (id counter, name varchar)")&lt;br /&gt;mydb.query("insert into testing (name) values ('test 1')")&lt;br /&gt;mydb.query("insert into testing (name) values ('test 2')")&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now go ahead and have fun:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Again change __exec_path to the path of your python script dir&lt;br /&gt;__exec_path = "E:\\Python\\"&lt;br /&gt;dbname = "test"&lt;br /&gt;&lt;br /&gt;import sys&lt;br /&gt;sys.path.append(__exec_path)&lt;br /&gt;from db import db&lt;br /&gt;&lt;br /&gt;# Opens E:\\Python\test.db&lt;br /&gt;mydb = db(__exec_path+dbname+'.db')&lt;br /&gt;mydb.query("select * from testing")&lt;br /&gt;for row in mydb:&lt;br /&gt;    print "-&gt; ",row[0]," ",row[1]," &lt;-"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Have fun!&lt;br /&gt;Dan</description>
      <pubDate>Tue, 03 Jul 2007 21:46:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4242</guid>
      <author>nerdcoder (Dan Larsen)</author>
    </item>
    <item>
      <title>Calling a S60 Python function from Symbian C++</title>
      <link>http://snippets.dzone.com/posts/show/3801</link>
      <description>Calls the Python function 'foo' in the module 'Bar'. &lt;br /&gt;A string value is passed to the Python function, and a string value is returned&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    TInt retVal(KErrNone);&lt;br /&gt;&lt;br /&gt;    // Create a Python interpreter&lt;br /&gt;    CSPyInterpreter* it = CSPyInterpreter::NewInterpreterL();&lt;br /&gt;    CleanupStack::PushL(it);&lt;br /&gt;&lt;br /&gt;    // Save state of any current Python interpreter, and acquire the&lt;br /&gt;    // interpreter lock&lt;br /&gt;    PyEval_RestoreThread(PYTHON_TLS-&gt;thread_state);&lt;br /&gt;&lt;br /&gt;    char *module_name = "Bar" ;&lt;br /&gt;    char *foo = "foo" ;&lt;br /&gt;    char *response = NULL ;&lt;br /&gt;&lt;br /&gt;    TInt32 r_len = 0 ;&lt;br /&gt;&lt;br /&gt;    PyObject *pModule = PyImport_ImportModule(module_name) ;&lt;br /&gt;&lt;br /&gt;    if ( pModule != NULL )&lt;br /&gt;    {&lt;br /&gt;    LOG_WRITE_L("CSenPythonSession::loaded ServiceConnection");&lt;br /&gt;&lt;br /&gt;    PyObject *module_dict = PyModule_GetDict(pModule);&lt;br /&gt;    PyObject *expression = PyDict_GetItemString(module_dict, pre_handler);&lt;br /&gt;    PyObject *arglist = Py_BuildValue("(s#)", aString.Ptr(),aString.Length()) ;&lt;br /&gt;&lt;br /&gt;    PyObject *result = PyEval_CallObject(expression, arglist);&lt;br /&gt;&lt;br /&gt;    response = PyString_AsString( result ) ;&lt;br /&gt;&lt;br /&gt;    r_len = strlen( response ) ;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // Make a Symbian descriptor pointer to the char * response&lt;br /&gt;    TPtrC8 symResponse((TUint8*)response, r_len ) ;&lt;br /&gt;&lt;br /&gt;    // Clean-up, and restore thread state&lt;br /&gt;&lt;br /&gt;    PyEval_SaveThread();&lt;br /&gt;    CleanupStack::PopAndDestroy(it); &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 12 Apr 2007 00:38:10 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3801</guid>
      <author>frumioj (John Kemp)</author>
    </item>
    <item>
      <title>Nokia - User Agent</title>
      <link>http://snippets.dzone.com/posts/show/3102</link>
      <description>// User Agent&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Modello 3230&lt;br /&gt;"Nokia3230/2.0 (5.0614.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6260&lt;br /&gt;"Nokia6260/2.0 (3.0448.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6600&lt;br /&gt;"Nokia6600/1.0 (5.27.0) SymbianOS/7.0s Series60/2.0 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6620&lt;br /&gt;"Nokia6620/2.0 (4.22.1) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6630&lt;br /&gt;"Nokia6630/1.0 (5.03.08) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.1"&lt;br /&gt;&lt;br /&gt;Modello 6670&lt;br /&gt;"Nokia6670/2.0 (6.0540.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6680&lt;br /&gt;"Nokia6680/1.0 (4.04.07) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.1"&lt;br /&gt;&lt;br /&gt;Modello 6681&lt;br /&gt;"Nokia6681/2.0 (5.37.01) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.1"&lt;br /&gt;&lt;br /&gt;Modello 9300&lt;br /&gt;"Mozilla/4.0 (compatible; MSIE 5.0; Series80/2.0 Nokia9300/05.22&lt;br /&gt;Profile/MIDP-2.0 Configuration/CLDC-1.1)"&lt;br /&gt;&lt;br /&gt;Modello 9500&lt;br /&gt;"Mozilla/4.0 (compatible; MSIE 5.0; Series80/2.0 Nokia9500/4.51&lt;br /&gt;Profile/MIDP-2.0 Configuration/CLDC-1.1)"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 07 Dec 2006 05:10:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3102</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>PyS60 - BabelFish</title>
      <link>http://snippets.dzone.com/posts/show/3047</link>
      <description>// Translate from language A to language B&lt;br /&gt;// code not complete but it works&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import urllib&lt;br /&gt;&lt;br /&gt;####################################################################################### &lt;BabelFish&gt;&lt;br /&gt;class BabelFish(object):&lt;br /&gt;    &lt;br /&gt;    def translate(self, lang, message):&lt;br /&gt;        &lt;br /&gt;        try:&lt;br /&gt;            url = urllib.URLopener()&lt;br /&gt;        &lt;br /&gt;            query = urllib.urlencode({&lt;br /&gt;                                      'doit':'done',&lt;br /&gt;                                      'intl':'1',&lt;br /&gt;                                      'lp':lang,&lt;br /&gt;                                      'tt':'urltext',&lt;br /&gt;                                      'urltext':message&lt;br /&gt;                                      })&lt;br /&gt;        &lt;br /&gt;            responde = url.open('http://babelfish.altavista.com/tr', query).read()&lt;br /&gt;        &lt;br /&gt;            start = responde.find('&lt;div style=padding:10px;&gt;') + 25&lt;br /&gt;            stop = responde.find('&lt;/div&gt;', start)&lt;br /&gt;        &lt;br /&gt;            return responde[start:stop]&lt;br /&gt;        &lt;br /&gt;        except Exception, error:&lt;br /&gt;            return '-' + str(error)&lt;br /&gt;####################################################################################### &lt;/BabelFish&gt;&lt;br /&gt;&lt;br /&gt;####################################################################################### &lt;BabelFishUI&gt;&lt;br /&gt;from graphics import *&lt;br /&gt;&lt;br /&gt;import appuifw&lt;br /&gt;import e32&lt;br /&gt;&lt;br /&gt;class BabelFishUI(object):&lt;br /&gt;    &lt;br /&gt;    def __init__(self):&lt;br /&gt;        &lt;br /&gt;        self.__lock = e32.Ao_lock()&lt;br /&gt;        self.__img = Image.new((176, 144))&lt;br /&gt;        self.__language = 'it_en'&lt;br /&gt;        self.__textUI = None&lt;br /&gt;        &lt;br /&gt;        appuifw.app.exit_key_handler = lambda:self.__lock.signal()&lt;br /&gt;        &lt;br /&gt;        appuifw.app.title = u'BabelFish v1.0'&lt;br /&gt;        appuifw.app.body = self.__canvas = appuifw.Canvas(redraw_callback=self.updateScreen)&lt;br /&gt;        &lt;br /&gt;        appuifw.app.menu = [(u'Translate', lambda:self.__translateUI()), (u'About', lambda:appuifw.note(u'BabelFish: v1.0", "Created by\nWhite Tiger\n&lt;Z-TEAM@Libero.it&gt;', 'info')), (u'Exit', lambda:self.__lock.signal)]&lt;br /&gt;        &lt;br /&gt;        self.updateScreen(None)&lt;br /&gt;        &lt;br /&gt;        self.__menuMain = appuifw.app.menu&lt;br /&gt;        self.__bgMain = appuifw.app.body&lt;br /&gt;        &lt;br /&gt;        self.__lock.wait()&lt;br /&gt;    &lt;br /&gt;    def updateScreen(self, rect):&lt;br /&gt;        &lt;br /&gt;        self.__canvas.blit(self.__img)&lt;br /&gt;    &lt;br /&gt;    def __back(self):&lt;br /&gt;        &lt;br /&gt;        appuifw.app.menu = self.__menuMain&lt;br /&gt;        appuifw.app.body = self.__bgMain&lt;br /&gt;        &lt;br /&gt;        appuifw.app.set_tabs([u'Back'], lambda x:None)&lt;br /&gt;    &lt;br /&gt;    def __translateUI(self):&lt;br /&gt;        &lt;br /&gt;        self.__textUI = appuifw.Text()&lt;br /&gt;                &lt;br /&gt;        appuifw.app.menu = [(u'Translate', lambda:self.__translate()), (u'Language', lambda:self.__setLanguage()), (u'Clear', lambda:self.__textUI.clear()), (u'Back', lambda:self.__back())]&lt;br /&gt;                   &lt;br /&gt;        appuifw.app.body = self.__textUI&lt;br /&gt;                &lt;br /&gt;    def __setLanguage(self):&lt;br /&gt;        &lt;br /&gt;        resp = appuifw.selection_list([u'italiano-inglese', u'inglese-italiano', u'inglese-francese', u'francese-inglese', u'inglese-tedesco', u'tedesco-inglese',&lt;br /&gt;                                       u'francese-italiano', u'italiano-francese'], 1)&lt;br /&gt;        &lt;br /&gt;        if resp == 0:&lt;br /&gt;            self.__language = 'it_en'&lt;br /&gt;        elif resp == 1:&lt;br /&gt;            self.__language = 'en_it'&lt;br /&gt;        elif resp == 2:&lt;br /&gt;            self.__language = 'en_fr'&lt;br /&gt;        elif resp == 3:&lt;br /&gt;            self.__language = 'fr_en'&lt;br /&gt;        elif resp == 4:&lt;br /&gt;            self.__language = 'en_de'&lt;br /&gt;        elif resp == 5:&lt;br /&gt;            self.__language = 'de_en'&lt;br /&gt;        elif resp == 6:&lt;br /&gt;            self.__language = 'fr_it'&lt;br /&gt;        elif resp == 7:&lt;br /&gt;            self.__language = 'it_fr'&lt;br /&gt;            &lt;br /&gt;    def __translate(self):&lt;br /&gt;        &lt;br /&gt;        babel = BabelFish()&lt;br /&gt;        &lt;br /&gt;        resp = babel.translate(self.__language, self.__textUI.get())&lt;br /&gt;        &lt;br /&gt;        if resp[0] == '-':&lt;br /&gt;            self.__textUI.set(unicode(resp[1:]))&lt;br /&gt;        else:&lt;br /&gt;            self.__textUI.set(unicode(': ' +self.__textUI.get() + '\n: ' + resp))&lt;br /&gt;                &lt;br /&gt;        appuifw.note(u'Translate', 'conf')&lt;br /&gt;####################################################################################### &lt;/BabelFishUI&gt;&lt;br /&gt;&lt;br /&gt;if __name__ == '__main__':&lt;br /&gt;    &lt;br /&gt;    BabelFishUI()&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 28 Nov 2006 04:35:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3047</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Python - eggs</title>
      <link>http://snippets.dzone.com/posts/show/2736</link>
      <description>1)&lt;br /&gt;&lt;br /&gt;import __hello__&lt;br /&gt;&lt;br /&gt;2)&lt;br /&gt;&lt;br /&gt;from __future__ import braces</description>
      <pubDate>Fri, 29 Sep 2006 22:21:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2736</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Get mobile cpu speed</title>
      <link>http://snippets.dzone.com/posts/show/1717</link>
      <description>&lt;code&gt;&lt;br /&gt;import miso&lt;br /&gt;print miso.get_hal_attr(11)  # 104000 for my 6600&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 19 Mar 2006 18:51:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1717</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
    <item>
      <title>Get LAST_INSERT_ID from Symbian DBMS</title>
      <link>http://snippets.dzone.com/posts/show/1692</link>
      <description>&lt;code&gt;&lt;br /&gt;# table schema&lt;br /&gt;# CREATE TABLE person (id COUNTER, name VARCHAR)&lt;br /&gt;&lt;br /&gt;db = e32db.Dbms()&lt;br /&gt;db.begin()  # begin transaction (lock other inserts)&lt;br /&gt;db.execute(u"INSERT INTO person(name) VALUES 'korakot' ") # insert a new row&lt;br /&gt;&lt;br /&gt;dbv = e32db.Db_view()&lt;br /&gt;dbv.prepare(db, u"SELECT id FROM person ORDER BY id DESC")&lt;br /&gt;dbv.first_line()&lt;br /&gt;dbv.get_line()&lt;br /&gt;last_id = dbv.col(1)  # get it!&lt;br /&gt;&lt;br /&gt;db.commit()  # commit the transaction&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 13 Mar 2006 17:23:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1692</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
    <item>
      <title>Keep light on using thread</title>
      <link>http://snippets.dzone.com/posts/show/1685</link>
      <description>Copy-paste version&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import e32, miso, thread&lt;br /&gt;running = 1&lt;br /&gt;def lighton():&lt;br /&gt;  while running:&lt;br /&gt;    miso.reset_inactivity_time()&lt;br /&gt;    e32.ao_sleep(5)&lt;br /&gt;&lt;br /&gt;thread.start_new_thread(lighton, ())&lt;br /&gt;# end by set running = 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;2 functions (lighton, lightoff) version.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import e32&lt;br /&gt;import miso&lt;br /&gt;import thread&lt;br /&gt;&lt;br /&gt;flag = 1&lt;br /&gt;def _lighton():&lt;br /&gt;    while flag:&lt;br /&gt;        miso.reset_inactivity_time()&lt;br /&gt;        e32.ao_sleep(5)&lt;br /&gt;&lt;br /&gt;def lighton():&lt;br /&gt;    thread.start_new_thread(_lighton, ())&lt;br /&gt;&lt;br /&gt;def lightoff():&lt;br /&gt;    global flag&lt;br /&gt;    flag = 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Sat, 11 Mar 2006 08:44:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1685</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
    <item>
      <title>PyS60 - Gallery Thumbnail Ver. 2</title>
      <link>http://snippets.dzone.com/posts/show/1683</link>
      <description>// Versione riveduta e corretta di Gallery Thumbnail postata da korakot ^_^&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import appuifw&lt;br /&gt;import e32&lt;br /&gt;import graphics&lt;br /&gt;import key_codes&lt;br /&gt;import os&lt;br /&gt;&lt;br /&gt;class FlickrS60Error(Exception): pass&lt;br /&gt;&lt;br /&gt;class FlickrS60Thumb:&lt;br /&gt;&lt;br /&gt;	def __init__(self, path):&lt;br /&gt;&lt;br /&gt;		self.path = unicode(path)&lt;br /&gt;		self.listFile = []&lt;br /&gt;		self.ldivx = 0&lt;br /&gt;		self.ldivy = 0&lt;br /&gt;		self.lock = e32.Ao_lock()&lt;br /&gt;		self.canvas = None&lt;br /&gt;		self.img = graphics.Image.new((176, 144))&lt;br /&gt;		self.img_tmp = graphics.Image.new((42, 36))&lt;br /&gt;		self.x, self.y = 0, 0&lt;br /&gt;		self.p = 0&lt;br /&gt;		self.pages = 0&lt;br /&gt;		self.currpages = 0&lt;br /&gt;		self.mpath = 0&lt;br /&gt;&lt;br /&gt;	def OnRun(self):&lt;br /&gt;&lt;br /&gt;		appuifw.app.exit_key_handler = self.lock.signal&lt;br /&gt;	&lt;br /&gt;		self._createList()&lt;br /&gt;		&lt;br /&gt;		self.canvas = appuifw.Canvas(redraw_callback=self.OnUpdate)&lt;br /&gt;		appuifw.app.body = self.canvas&lt;br /&gt;&lt;br /&gt;		self.canvas.bind(key_codes.EKeyRightArrow, lambda: self.move(1, 0))&lt;br /&gt;		self.canvas.bind(key_codes.EKeyLeftArrow, lambda: self.move(-1, 0))&lt;br /&gt;		self.canvas.bind(key_codes.EKeyUpArrow, lambda: self.move(0, -1))&lt;br /&gt;		self.canvas.bind(key_codes.EKeyDownArrow, lambda: self.move(0, 1))&lt;br /&gt;		self.canvas.bind(key_codes.EKeySelect, self.IMG)&lt;br /&gt;&lt;br /&gt;		self._drawIMG()&lt;br /&gt;		&lt;br /&gt;		self.lock.wait()&lt;br /&gt;&lt;br /&gt;	def OnUpdate(self, rect):&lt;br /&gt;&lt;br /&gt;		self.canvas.blit(self.img)&lt;br /&gt;		self.canvas.rectangle([(self.p+(42*self.x), 36*self.y), (self.p+(42*self.x)+42, (36*self.y)+36)], width=2, outline=0x123456)&lt;br /&gt;&lt;br /&gt;	def move(self, x, y):&lt;br /&gt;&lt;br /&gt;		self.x = (self.x+x)%4&lt;br /&gt;		self.y = (self.y+y)&lt;br /&gt;&lt;br /&gt;		if x == 1: self.p = (self.p+2)%8&lt;br /&gt;		if x == -1: self.p = (self.p-2)%8&lt;br /&gt;&lt;br /&gt;		if self.y == 4:&lt;br /&gt;			if self.currpages &lt; self.pages-1:&lt;br /&gt;				self.y = 0&lt;br /&gt;				self.currpages += 1&lt;br /&gt;				self._drawIMG(start=self.currpages)&lt;br /&gt;			else:&lt;br /&gt;				self.y = 3&lt;br /&gt;			&lt;br /&gt;		if self.y == -1:&lt;br /&gt;			if self.currpages &gt; 0:&lt;br /&gt;				self.y = 3&lt;br /&gt;				self.currpages -= 1&lt;br /&gt;				self._drawIMG(start=self.currpages)&lt;br /&gt;			else:&lt;br /&gt;				self.y = 0&lt;br /&gt;	&lt;br /&gt;		self.mpath = (4*self.y + self.x)+(16*self.currpages)&lt;br /&gt;		&lt;br /&gt;		self.OnUpdate(None)&lt;br /&gt;	&lt;br /&gt;	def IMG(self):&lt;br /&gt;&lt;br /&gt;		try:&lt;br /&gt;			m = self.listFile[self.mpath].replace('_PalbTN\\', '')&lt;br /&gt;			appuifw.Content_handler().open(m)&lt;br /&gt;		except:&lt;br /&gt;			pass&lt;br /&gt;		&lt;br /&gt;	def _drawIMG(self, start=0):&lt;br /&gt;&lt;br /&gt;		self.img.clear(0xffffff)&lt;br /&gt;		z = 0&lt;br /&gt;		&lt;br /&gt;		for id in range(start*16, (start+1)*16):&lt;br /&gt;			j, i = divmod(id-(start*16), 4)&lt;br /&gt;			try:&lt;br /&gt;				self.img_tmp.load(self.listFile[id])&lt;br /&gt;				self.img.blit(self.img_tmp, target=(z+(42*i)+(z+1), 36*j))&lt;br /&gt;				z = (z+1)%4&lt;br /&gt;			except:&lt;br /&gt;				break&lt;br /&gt;&lt;br /&gt;		self.OnUpdate(None)&lt;br /&gt;&lt;br /&gt;	def _createList(self):&lt;br /&gt;&lt;br /&gt;		try:&lt;br /&gt;			for id in os.listdir(self.path):&lt;br /&gt;				self.listFile.append(self.path + id)&lt;br /&gt;&lt;br /&gt;			self.ldivx, self.ldivy = divmod(len(self.listFile), 16)&lt;br /&gt;&lt;br /&gt;			self.pages = self.ldivx&lt;br /&gt;			if self.ldivy &lt;&gt; 0: self.pages += 1&lt;br /&gt;		except:&lt;br /&gt;			raise FlickrS60Error('Errore nella creazione della lista.')&lt;br /&gt;&lt;br /&gt;if __name__ == '__main__':&lt;br /&gt;&lt;br /&gt;	FlickrS60Thumb('E:\\Images\\_PalbTN\\').OnRun()&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 11 Mar 2006 05:36:17 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1683</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Create a primary key with autoincrement in Symbian DBMS</title>
      <link>http://snippets.dzone.com/posts/show/1680</link>
      <description>&lt;code&gt;&lt;br /&gt;CREATE TABLE person (id COUNTER, name VARCHAR)&lt;br /&gt;CREATE UNIQUE INDEX id_index ON person(id)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;COUNTER is UNSIGNED INTEGER with Autoincrement.&lt;br /&gt;You still need a UNIQUE INDEX as well.</description>
      <pubDate>Fri, 10 Mar 2006 16:17:05 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1680</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
  </channel>
</rss>
