Posts tagged utility

Released MonitorES 1.0b

Hello All,

I am pleased to announce that new version of MonitorES ( Monitor Energy Saver) 1.0b is released with lot of cool features.  Please download the latest from http://code.google.com/p/monitores

Features:

  • Support for Windows 7 ( including mute)
  • Custom Hotkey’s
  • Disable Screensaver.
  • and more…

Cheers,

Umakanth

Export MySQL database in XML format

This small python program can export mysql database in a xml format

import MySQLdb
 
hostName="hostnamehere"
userName="usernamehere"
passWd="passwordhere"
dbName="dbnamehere"
 
print "Started...."
 
#open file
file = open("out.xml", 'w')
 
file.write("");
file.write("\n\t<" + dbName + ">");
 
print "Connecting to " , hostName , "...";
conn=MySQLdb.connect(host=hostName,user=userName,passwd=passWd,db=dbName)
cursor = conn.cursor ()
 
table_list = []
 
#get server version
cursor.execute ("SELECT VERSION()")
row = cursor.fetchone ()
server_version = row[0];
print "Detected MySQL version ", server_version
 
# get all the tables
print "Getting tables...";
cursor.execute("show tables");
for row in cursor:
table_list.append(row[0])
 
# lets get all the tables values
for table in table_list:
file.write("\n\t<" + table + ">");
print "Processing ", table , " ..."
sql_desc = "desc " + table;
cursor.execute(sql_desc);
type_list = []
for row in cursor:
type_list.append(row[0])
# now data
sql_table_rows = "select * from " + table;
cursor.execute(sql_table_rows);
for row in cursor:
for i in range(len(type_list)):
file.write("\n\t\t<" + type_list[i] + ">" + "%s" %row[i] + "")
file.write("\n\t")
 
file.write("\n\t");
file.close();
print "XML file(out.xml) successfully written"

Monitor Energy Saver 0.1

This utility helps to turnoff monitor automatically when the user locks his computer / laptop .

http://code.google.com/p/monitores

Open Source / Apache 2.0