Archive for the "Tech" Category

Resources for Learning Git and GitHub

Resources for Learning Git and GitHub
http://chronicle.com/blogs/profhacker/resources-for-learning-git-and-github/48285

Audiences, Outcomes, and Determining User Needs

A List Apart: for people who make websites

via Audiences, Outcomes, and Determining User Needs.

MySQL Export to CSV File

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.

via 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

Run the following command while logged in as root or sudo:

#Open port 80
/sbin/iptables -I RH-Firewall-1-INPUT 3 -p tcp -m tcp –dport 80 –tcp-flags SYN,RST,ACK SYN -j ACCEPT

#Make the changes permanent
/sbin/iptables-save

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')); ?>