Posts

[Level 3] Install memcached user defined function for MySQL on CentOS 5.4

Memcaced is a good solution for scale out your system. And there is a project for MySQL udf by implement memcached. Prepare libmemcached: # wget http://download.tangent.org/libmemcached-0.37.tar.gz # export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig # ./configure --with-mysql=/usr/local/mysql/bin/mysql_config # make && make install PS. when I use libmemcached 0.38 and complie source, I get a error like below: # wget http://download.tangent.org/memcached_functions_mysql-0.8.tar.gz servers.c: In function 'memc_servers_set': servers.c:122: error: 'memcached_st' has no member named 'hosts' servers.c:123: error: 'memcached_st' has no member named 'hosts' servers.c:124: error: 'memcached_st' has no member named 'hosts' But after down-grade the version from 0.38 to 0.37 then works. Compile memcahced function: # wget http://download.tangent.org/memcached_functions_mysql-0.8.tar.gz # tar zxvf ./ memcached_functions_mysql-...

[Level 3] Show MySQL Porcess in CentOS

Three processes to get process info: 1. show all process: mysq> show processlist; +----+------+-----------------+------+---------+------+-------+------------------+ | Id | User | Host            | db   | Command | Time | State | Info             | +----+------+-----------------+------+---------+------+-------+------------------+ |  1 | root | localhost: 47605 | NULL | Sleep   |   27 |       | NULL             | | 16 | root | localhost       | test | Query   |    0 | NULL  | show processlist | +----+------+-----------------+------+---------+------+-------+------------------+ 2 rows in set (0.00 sec) 2. get process that use port 47605 : mysql> \! netstat -ntp | grep 47605 tcp...

[Level 3] Install Memcached Storage Engine for MySQL on CentOS 5.4

Prepare the package first for build the memcached storage engine. Download libmemacached 0.34 and install: # wget http://download.tangent.org/libmemcached-0.34.tar.gz # tar zxvf ./libmemcached-0.34.tar.gz # cd ./libmemcached-0.34 # export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig # ./configure && make && make install Download libxml2 and install: # wget ftp://xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz # tar zxvf libxml2-2.7.7.tar.gz # cd ./libxml2-2.7.7 # ./configure && make && make install Download  libxmlrow and install: # wget http://download.tangent.org/libxmlrow-0.2.tar.gz # tar zxvf ./libxmlrow-0.2.tar.gz # cd ./libxmlrow-0.2 #  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig # ./configure && make && make install  Download  memcached storage and install: # export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig # sed -i "s#uint16_t#uint32_t#g" ./src/ha_memcache.cc # ./configure --...

[Level 2] MySQLdb Python API -- Connection Objects

Connection have such methods: 1. close() => close database connection. 2. commit() => commit transaction. 3. rollback() => rollback transaction. 4. cursor() => create curosr object and return. 5. begin() => start transaction. (deprecated, and will be removed from 1.3) The sample code for connection/cursor testing: Ex1: #/usr/bin/python import MySQLdb cxn = MySQLdb.connect(host='localhost', db='test', user='root', passwd='admin123' ) ## create cursor cur = cxn.cursor() ## query from database #cur.query(" select * from test.t limit 5; ") ## no query attribute for cursor cur.execute(" select * from test.t limit 5; ") for data in cur.fetchall():   #print(data[0],data[1],data[2])   print(data[0],data[1]) cur.close() cxn.close() Ex2: #/usr/bin/python import MySQLdb cxn = MySQLdb.connect(host='localhost', db='test', user='root', passwd='admin123' ) cur = cxn.cursor() ...

[Level 2] MySQLdb Python API -- Module Attributes

If you want to get some information about MySQLdb API, you can use the following script to get the info. #!/usr/bin/python try:   import MySQLdb   db = MySQLdb   if db:     print "db.apilevel=" + db.apilevel     print "db.threadsafety=" + str(db.threadsafety)     print "db.paramstyle=" + db.paramstyle except ImportError:   print "import MySQLdb fail"   exit The attributes description: a. apilevel => Version of API. b. threadsafety => Level of thread safety     0: Not threadsafe. Should not share the module at all.     1: Minimally threadsafe. Could share module but not connection. ( Default )     2: Moderately threadsafe. Could share both module and connection but not cursors.     3: Fully threadsafe. Could share module, connection and cursor. c. paramstyle => Parameter style of the module     numeric: WHERE addr=:...

[Level 1] Install Django on OpenSolaris.

Use pkg command to install Django: # pfexec pkg set-authority -O http://pkg.opensolaris.org/webstack  # webstackpfexec pkg refresh  Launch Pkg Manager by downloading. # firefox http://pkg.opensolaris.org/webstack [search "Django"] [click "install"] Wish this helps. regards, Stanley Huang

[Info] Password Meter

You can test the strength of your password on this website. http://www.passwordmeter.com Wish this helps. regards, Stanley Huang