analitics

Pages

Tuesday, December 29, 2009

New book for kids with Python 3

Few days ago i found a new site about python .
I saw on this site the a new book about python for kids .
This is the link "Snake Wrangling for Kids".
The author says:
  • Snake Wrangling for Kids” is a printable electronic book, for children 8 years and older, who would like to learn computer programming. It covers the very basics of programming, and uses the Python 3

Friday, November 13, 2009

GTK - get display resolution

Sometime is need to get the display resolution.
This python code show how to do it:
>>> import gtk
>>> dgd=gtk.gdk.display_get_default()
>>> gsd=dgd.get_default_screen()
>>> height=gsd.get_height()
>>> width=gsd.get_width()
>>> print "height=",height,"width=",width
height= 1024 width= 1280

Quite simply ...

Wednesday, October 21, 2009

MD5 - password generator

Why do we need this script?
Internet is full of generating MD5.
The Internet has and dictionaries for decrypting md5.
So safe is our script.
You must use the code line:
p = md5.new ()

otherwise if you use:
pass = md5.new ()

you get the following error:
>>> pass = md5.new()
File "", line 1
pass = md5.new()
^
SyntaxError: invalid syntax

pass is a python keyword.
You'll need a different name for the variable.
And now to see the code:
import md5 
p = md5.new()
p.update("password")
p.hexdigest()
'5f4dcc3b5aa765d61d8327deb882cf99'

This is all you need.