jueves, 21 de noviembre de 2013

phpmyadmin on ubuntu connecting to mysql by phyton

Just follow these links and few more steps:

Then enable design view, this is really useful

Now you can setup python for apache2:


don't forget to install python-mysqldb

apt-get install python-mysqldb

restart apache:

/etc/init.d/apache2 restart

Now let's try a small db connection:

agonzalez@kozlex:~/django-dev$ cat /var/www/test4.py

import MySQLdb

# enable debugging
import cgitb

print "Content-Type: text/plain;charset=utf-8"

print "Hello World!"

# connect
mydb = MySQLdb.connect(host="", user="root", passwd="root",

cursor = mydb.cursor()

# execute SQL select statement
cursor.execute("SELECT * FROM test")

# get the number of rows in the resultset
numrows = int(cursor.rowcount)

# get and display one row at a time.
for x in range(0,numrows):
    row = cursor.fetchone()
    print (row[0], "-->", row[1])

def index(req):
  return row[1];


That should work although the prints are not shown!

P.D.  Libya flag is the only country flag with single color and no design.

Read an ISO content on ubuntu

Has been a while since I don't add something here.. I've been working with PXE to overwrite an MBR and I found a small tip that I share now...

To install PXE is needed to install some files from alternate ubuntu, what I did is to get the iso, mount it and find what I need.


To read an iso content on ubuntu:

# sudo mkdir /mnt/iso
# sudo mount -o loop -t iso9660 ubuntu-12.04.3-alternate-amd64.iso /mnt/iso

agonzalez@kozlex:/mnt/iso$ ls /mnt/iso/
boot  cdromupgrade  dists  doc  EFI  install  isolinux  md5sum.txt  pics  pool  preseed  README.diskdefines  ubuntu

Annnnd... there it is... I found what I need..

agonzalez@kozlex:/mnt/iso$ find . -name  pxelinux.0

P.D. The vatican is also a country and its flag and is one of the two sqare flags in the world.