December 2009

You are currently browsing the monthly archive for December 2009.

command:

sudo apt-get install php5-gd

Don’t forget to restart apache

service apache2 restart

Related posts

Tags: , ,

# change a hexadecimal string to decimal number and reverse
# check two different representations of the hexadecimal string
# negative values and zero are accepted
# tested with Python24        vegaseat     11oct2005

def dec2hex(n):
“”"return the hexadecimal string representation of integer n”"”
return “%X” % n

def hex2dec(s):
“”"return the integer value of a hexadecimal string s”"”
return int(s, 16)

print “dec2hex(255)  =”, dec2hex(255)    # FF
print “hex2dec(‘FF’) =”, hex2dec(‘FF’)   # 255

print

print “hex(255) =”, hex(255)                # 0xff
print “hex2dec(‘0xff’) =”, hex2dec(‘0xff’)  # 255

Related posts

Tags: , , ,