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

Snippets

  • 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.
http://discussion.forum.nokia.com/forum/showthread.php?threadid=58993                
                    
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.                
                    
set_time_limit(0)
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 "..."
                
                    
dir(obj)
vars(obj)
obj.__dict__

There are more information when call it again with
obj.__class__ and klass.__bases__                
                    By Lucas Carlson - http://tech.rufy.com/

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