Tags
Abstract Android Apache apt-get Art bash C++ calendar CentOS circuit CSS electronics emulator Excel ffmpeg FTP HTC http ImageMagick images ip javascript jquery LED linux math memory mvc MySQL nodejs PHP phpize PHP RAD Sharpy plaintext PostgreSQL Python resize root rotate security socketio ubuntu ui Windows yumCategories
Meta
Category Archives: MySQL
Very simple MySQL backup bash script
This code backups up mysql databases and gzips them into the current working directory. If you want to backup the mysql table, remove it from the for loop. #!/bin/bash usage(){ echo “Usage $0 <mysql_user> <mysql_password> [host]” exit 1 } if … Continue reading
Posted in bash, Commands, Linux, MySQL
Leave a comment
Python MySQL Associative Array
By default, the MySQLdb module to access a MySQL database returns the data as an integer indexed array. Sometimes this is not desirable and an associative array is preferred, such as the mysql_fetch_assoc function in PHP. In addition, we will … Continue reading
PHP function to validate MySQL UUID or GUID
/** * Function to validate a generated GUID / UUID * @param string $guid GUID * @return bool */ function validGUID($guid){ return preg_match(‘#^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$#’, $guid); } Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers … Continue reading
PHP function to emulate MySQL UUID
/** * uuid * * uuid() simply replicates MySQL’s UUID function, which returns a 36 * character "random" hash (32 alphanumeric, 4 dashes). * @return string */ function uuid(){ return sprintf(‘%04x%04x-%04x-%04x-%04x-%04x%04x%04x’, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | … Continue reading
