Archive for the 'Things I forget' Category

CSV export from MySQL

Saturday, September 15th, 2007

If you have access on the machine with MySQL and you need to export all tables in a database you can use: hpatoio@namazu:~$ mysqldump -uroot -p DATABASE_NAME -T '/home/simone/export_csv' –fields-terminated-by "," –fields-enclosed-by '"' –lines-terminated-by "\n" the script will create a files for each table of the DB and will place it in export_csv. If you [...]

Add days to a date in javascript

Wednesday, May 30th, 2007

shiftDay = 10 var myDate = new Date(); myDate.setDate(myDate.getUTCDate() + shiftDay) day   = myDate.getUTCDate() month = myDate.getUTCMonth()*1 + 1 year  = myDate.getUTCFullYear() This code is quite easy: shiftDay hold the number of days you want to add, if you need to go backwards you can set it to a negative value. myDate is set to [...]

MSSQL | Convert unix timestamp to date

Tuesday, April 24th, 2007

select dateadd(ss, {field_name}, '19700101')

Slang

Thursday, November 2nd, 2006

Here some slang/vocabulary from the english course "Rain dogs" Yes man – Brown nose Lecchino, paraculo Shitting bricks Avere paura, ironico Spew Vomitare Bill Banconota in americano, conto in inglese Note Banconote in inglese Check Conto in americano, assegno in inglese Jack the ripper Jack lo squartatore

Ops …

Sunday, October 8th, 2006

Oh no ! It happend again !! The sysadmin turned on the gpc_magic_quotes and you got the DB full of \' Here a fast way to get back the correct values. UPDATE table_name SET field_name = REPLACE(field_name,'\"',"")

Access Mysql from other machines

Tuesday, August 29th, 2006

For security reason, MySQL doesn't allow access from other computer. If you try to connect with a MySQL administration client like MySQL Administrator you will get a Mysql Error Number 2003. All this operations modify system settings, so they must be executed with root privileges If you want connect from a computer in your LAN [...]

Import dump in MySQL

Monday, July 17th, 2006

From a shell run mysql -u USER -p DBNAME < dump.sql then insert the password and is done.

Enable display errors for PHP

Saturday, June 24th, 2006

Create or open the file .htaccess and add this line php_value display_errors On

Yes !