DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world


  • submit to reddit

Recent Snippets

import key_codes
obj.bind(key_codes.EKeyNo, func)  # bind key "No" to a function
See a more detail example here.                
from appuifw import note

message = u"All's well"    # must be unicode , using u""
note(message, 'info')     # 'info' or 'error' or 'conf'

# info = information message box
# error = error message box
# conf = confirm message box
import location
mcc, mnc, lac, cellid = location.gsm_location()
# lac, cellid can be used to guess your location

mcc = Mobile Country Code
mnc = Mobile Network Code
lac = Location Area Code
cellid = Cell Id

mcc and mnc is the same wherever you are.
Normally, you would collect some data of your location
and match it with lac/cellid. Then later you can guess
your location from current lac/cellid.                
Pretty useful when dumping data.                
                    You can set sys.path from command line option.
I use it with Jython
java -Dpython.path="%GUESS_HOME%\src\Lib" -classpath "..."

There are more information when call it again with
obj.__class__ and klass.__bases__                
                    By Lucas Carlson -

class Integer
    alias _to_s to_s
    def to_s
        _to_s.reverse.gsub(/(\d{3})/, '\1,').chomp(",").reverse
<input type="button" value="Close" onclick="CloseWindow();" />
<script type='text/javascript'>
function CloseWindow() {
	ww =, "_self");
font-family: "Hoefler Text", Baskerville, "Big Caslon", "Adobe Garamond Pro", Georgia, Palatino, "Times New Roman", serif;