Archive

Archive for the ‘database’ Category

Tcl scripting and SQLite

December 24th, 2008

Tcl scripting and SQLite

Tcl tutorial
Download Tcl/Tk (source/binary)
SQLite API (tclsh)
Download SQlite (source/binary)
A simple example (taken from sqlite.org):

#!/usr/bin/tclsh
if {$argc!=2} {
  puts stderr "Usage: %s DATABASE SQL-STATEMENT"
  exit 1
}
load /usr/lib/tclsqlite3.so Sqlite3
sqlite3 db [lindex $argv 0]
db eval [lindex $argv 1] x {
  foreach v $x(*) {
    puts "$v = $x($v)"
  }
  puts ""
}
db close

database, develop, projects, security, windows ,

MySQL 5.1

December 17th, 2008

MySQL 5.1

“We ran a side by side comparison between MySQL and Oracle both partitioned and unpartitioned. MySQL outperformed Oracle at least 2:1 in all like for like tests and, at the extreme, well partitioned MySQL was over 31 times faster than vanilla Oracle tables.”

Guy Adams

Chief Technical Officer

Parallel Ltd.

Downloads:

http://dev.mysql.com/downloads/mysql/5.1.html#downloads

MySQL Workbench:

http://dev.mysql.com/downloads/workbench/5.1.html

GUI Tools:

http://dev.mysql.com/downloads/gui-tools/5.0.html

Connectors:

http://www.mysql.com/products/connector/

database, develop

SQL File to PHP5 Classes (sql2class)

November 25th, 2008

SQL File to PHP5 Classes (sql2class)

(shell prompt) perl sql2class.pl database.sql > classes.php

Download sql2class-0.2.tar.gz sql2class-0.3.tar.gz

I have little time programming in Perl hope to expand this script to support other languages in the future

With this post I dismissal from 2008 until January 2009.

database, develop , ,

Saturday Morning Hacking

November 8th, 2008

Saturday Morning Hacking

Este sabado en la mañana (madrugada para mi) acompañe a mi tia a un curso de RNA (Redes Neuronales Artificiales) aplicadas a la valuacion (mi tia es Arquitecta)

Me meti a un ruter AirLink101 (pesimo password: admin) aburrido un poco empeze a jugar con la pagina de AINetSolutions, despues de un tiempo consegui el usuario y password de MySQL.

Aqui un screenshoot:

No modifique nada, solo estuve de observador.

Saludos a toda la raza del MHT, recordando viejas costumbres este dia.

Les mande un correo a los de AINetSolutions espero no se molesten por publicarlo en mi Blog.

Como medidas de seguridad siempre cambien el password del ruter nunca dejen el password que viene por defecto, de preferencia no utilizen conexiones remotas de MySQL o si las requieren utilizen un filtro de IP.

database, network, personal, security, web ,

Google App Engine

November 5th, 2008

Google App Engine

Downloads (http://code.google.com/appengine/downloads.html)

Google App Engine use Django, webob, yaml.

You need Python (http://www.python.org) (Python 2.5)

The configuration file app.yaml

There are two main Python scripts:

Video from the The Google Code Channel:

See the applications gallery

Google App Engine

database, develop, hardware, network, projects, web , ,

GeoIP PHP Script

October 1st, 2008

GeoIP PHP Script

I made this script utility to check what country is some ip, you need GeoIP Database

I hope you have PHP in your path:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/php -q
<?
 
if (count($_SERVER['argv']) <= 1) {
	echo "use: geoip xxx.xxx.xxx.xxx\n";
}
else {
	$ip=$_SERVER['argv'][1];
	$out=sprintf("%u", ip2long($ip)); // don't ask why, you need this line	
 
	$sql="SELECT country_name FROM geoip WHERE ($out BETWEEN ip_begin AND ip_end)";	
 
	$link = mysql_connect('localhost','root',''); // HOST, USER, PASS
	mysql_select_db('GEOIP'); // DATABASE
 
	$query = mysql_query($sql,$link);	
 
	while ($row = @mysql_fetch_array($query,MYSQL_ASSOC)) {
		$data[] = $row;
	}	
 
	if (count($data) == 1) {
		echo $data[0]['country_name']."\n";
	}
	else {
		echo "Unknown\n";
	}
}
?>

Examples:

~$ geoip 79.130.90.12
Greece
~$ geoip 207.33.11.33
United States
~$ geoip 148.234.13.23
Mexico

I think i made a good tool.

database, network , ,

MySQL Workbench (Linux)

September 24th, 2008

MySQL Workbench (Linux)

What is MySQL Workbench ?

MySQL Workbench is a cross-platform, visual database design tool developed by MySQL. It is the highly anticipated successor application of the DBDesigner4 project. MySQL Workbench will be available as a native GUI tool on Window, Linux and OS X.

For Ubuntu (8.04) users i made this install script (run as root):

#!/bin/bash
# This script tested only on Ubuntu 8.04 (32 bits)
# You need some extra libs to run MySQL Workbench
sudo apt-get install liblua5.1-0 libzip1 libmysqlclient15off
# Download MySQL Workbench Ubuntu 8.04 Bin Files
wget -c ftp://ftp.mysql.com/pub/mysql/download/gui-tools/mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz
# Download the md5 checksum file
wget -c ftp://ftp.mysql.com/pub/mysql/download/gui-tools/mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz.md5
# Check md5sum
real=`md5sum mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz | awk '{ print $1 }'`
confirm=`cat mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz.md5 | awk '{ print $1 }'`
if [ "$real" = "$confirm" ]
then
	# Extract (/usr/local/bin/ /usr/local/lib/mysql-workbench/ /usr/local/share/mysql-workbench/)
	tar xvzf mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz -C /
else
	echo "Wrong MD5, run the script again."
fi

Note: MySQL Workbench is alpha on Linux

More information about MySQL Workbench

database, develop , , ,