Articles by Steve Cheng

17/02/2012

In what ever directory you're in you can type in du -h --max-depth=x to get filesizes. 

Steve
0
07/11/2011

I recently had a problem with the breadcrumbs for blog pages in Drupal 6.  The format was:

Home > Blog > User > Page title

After a bit of searching around and a chat with an expert Drupal 6 developer the simplest way was to override the default breadcrumb rendering in the template.php file.

I was using a sub-theme of Zen so I just copied the function from Zens template.php and modified it to meet my theme's requirement.  So the function would look something like this:

Steve
0
01/07/2011

 INSERT INTO {table_name} (col1,col2) VALUES (val1,val2), (val3,val4),(val5,val6);

This would insert three rows.

Great for relatively short inserts, larger amounts of data can cause MySql server to lock up and possibly abort.

Steve
0
30/06/2011

Steve
0
12/04/2011

I setup Xdebug recently to profile a drupal page that was exceedly slow.  I'm running ubuntu 10.10 with a typical lamp stack and did the following:

apt-get update

apt-get install php5-dev php-pear

pecl install xdebug

locate xdebug.so (should look something like this: /usr/lib/php5/20060613/xdebug.so)

Add the following line to php.ini (zend_extension="/usr/lib/php5/20060613/xdebug.so")

/etc/init.d/apache2 restart

Check your phpinfo to ensure xdebug has been sucessfully installed

Steve
0
17/02/2011

A simple PHP function to calculate current quarter and previous quarters.

Steve
0
31/01/2011

SELECT id FROM table WHERE id in (7,2,5,9,8) ORDER BY FIND_IN_SET(id,"8,2,5,9,7");

Steve
0
25/01/2011

My current development environment and tools are as follows:

  • Windows Vista
  • Virtual Box
  • Ubuntu Server 10
  • LAMP Setup
  • PHPStorm IDE
  • Putty
  • ColorCop
Steve
0
18/01/2011

GRANT ALL PRIVILEGES ON db_base.* TO db_user @'localhost' IDENTIFIED BY 'db_passwd';

Steve
0
02/12/2010

date -s "2 Dec 2010 08:00:00"

Steve
0