miriup.de

...because open source matters

  • Increase font size
  • Default font size
  • Decrease font size
Programming

Running an FTP server on the N97

Написать письмо Print
There are no translations available.

Introduction

Transferring files with bluetooth or via USB is practical, but I have been often wondering how practical it would be to transfer using FTP. FTP is supported pretty much everywhere. I recently played with PyS60 - A Python implementation for S60. It's compatible with 3rd and 5th edition devices and thus with the N97. To my surprise it worked like a charm. It should work equally well for all S60 3rd and 5th edition devices.

Attachments:
Download this file (symbian-ftpd.py.txt)symbian-ftpd.py[The symbian ftpd starter script for PyS60.]0 Kb20.09.2010 22:28
LAST_UPDATED2
 

Python singleton pattern

Написать письмо Print
There are no translations available.

After a quick search where I didn't find a singleton implementation for new-style classes in Python. For classic classes there's the excellent Borg pattern. So here's singleton for new-style classes:

class Singleton(object):

__instance = None

@classmethod
def getInstance(cl):
"""
Get the global engine instance or create one if none exists yet.
"""
if cl.__instance is None:
cl.__instance = cl()

return cl.__instance
Attachments:
Download this file (Singleton.py.txt)Singleton.py[ ]0 Kb17.09.2010 02:30
LAST_UPDATED2