Ever needed to export data from MySQL into a CSV file? Its actually fairly simple,
SELECT * INTO OUTFILE ‘/tmp/name.csv’
FIELDS TERMINATED BY ‘,’
OPTIONALLY ENCLOSED BY ‘”‘
ESCAPED BY ‘\\’
LINES TERMINATED BY ‘\n’
FROM [tablename]Certainly easier then writing a quick Python/Perl/PHP script to do the job.
MySQL Export to CSV File
InnoDB is red hot, MyISAM not
Planet MySQL
via InnoDB is red hot, MyISAM not.
Everyone who started using MySQL before 5.5 started off with MyIsam. It was the default storage engine and you had to go out of your way to use anything else. It was a good looking database, rugged…
Compile PHP Extensions on Mac Snow Leopard OS X
If you have to custom compile PHP Extensions on Mac with Snow Leopard OS X while using MAMP , you will need to execute following commands. These are necessary to compile modules with both 32bit and 64bit support.
/Applications/MAMP/bin/php5.3/bin/phpize MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load" export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
Moved this site on to a VPS from IntoVPS
Few days ago, I moved this website on to a VPS from IntoVPS. So far IntoVPS has been quite good. It took only few minutes to get access to my VPS after signing up on IntoVPS site.
I picked Ubuntu 9.10 Server Edition for the OS because it is much easier to build a server on Ubuntu than dealing with Centos/Redhat crap.
P.S. Suprisingly IntoVPS guys also run super handy IntoDNS.com service!
Open Port 80 for Apache in iptables on Centos or Red Hat
One mod deflate filter to rule them all …
Add the following code to your .htaccess file to automatically have all of your text files compressed by mod-deflate on the fly.
Warning: Make sure you are running Apache 2.0 server with Mod Deflate enabled.
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/javascript text/javascript text/css application/xml
All in one line.
Drupal Best Practices : Use Theme Image Function to embed images
Often times, when you are themeing in Drupal, you may have to embed an image inside a template file. If the image is local, then it is best to use the theme_image theme function to embed it rather than using straight HTML tags. This not only makes your HTML output less error prone, but also automatically embeds height and width attributes to the tag. Embedding height and width attributes reduces the amount of repainting that the browser needs to do while rendering a webpage.
Here is sample code, which embeds a User’s Profile Picture.
<?php echo theme('image', $u->picture, $u->name, $u->name, array('class' => 'content_img')); ?>