Doctrine 2.1.0 ORM Installation

$ sudo pear install pear.doctrine-project.org/DoctrineORM-2.1.0
downloading DoctrineORM-2.1.0.tgz ...
Starting to download DoctrineORM-2.1.0.tgz (211,677 bytes)
.............................................done: 211,677 bytes
downloading DoctrineSymfonyYaml-2.0.6.tgz ...
Starting to download DoctrineSymfonyYaml-2.0.6.tgz (22,204 bytes)
...done: 22,204 bytes
install ok: channel://pear.doctrine-project.org/DoctrineSymfonyYaml-2.0.6
install ok: channel://pear.doctrine-project.org/DoctrineORM-2.1.0

$ doctrine
Doctrine Command Line Interface version 2.1.0
....

How to Find the Last Day of a Month in PHP

Start PHP in interactive mode.
$ php -a

Find the last day using the current UNIX timestamp.

The Procedural Style
php > echo date('t', time());
31

The Object-Oriented Style
php > $date = new DateTime();
php > echo $date->format('t');
31

Find the last day using date.

The Procedural Style
php > echo date('t', mktime(0, 0, 0, 7, 1, 2011));
31
php > echo date('t', mktime(0, 0, 0, 2, 1, 2011));
28
php > echo date('t', mktime(0, 0, 0, 2, 1, 2012));
29

The Object-Oriented Style
php > $date = new DateTime();
php > echo $date->format('t');
31
php > $date = new DateTime('2011-02-01');
php > echo $date->format('t');
28
php > $date = new DateTime('2012-02-01');
php > echo $date->format('t');
29

Symfony 1.x PHP Framework Installation and Setup

1. Download Symfony framework from http://symfony.com/download

2. Extract the tarball to /var/www/symfony

3. Point your browser to http://localhost/symfony/web/config.php

4. Fix the directory permission
$ cd /var/www/symfony
$ sudo chown -R www-data:www-data cache logs

5. Refresh step 3. Adjust the all the outstanding issues

6. Edit /etc/php5/apache2/php.ini and set these parameters
date.timezone = Asia/Kuala_Lumpur
short_open_tag = Off

7. Install the missing php's intl module
sudo apt-get install php5-intl

8. Restart the Apache2 webserver
sudo /etc/init.d/apache2 restart

9. Refresh step 3. No warning, click Configure your Symfony Application online

10. Setup database. Fill in all your database connection details.

11. Setup global secret key. Leave it as it.

12. Copy, paste, and save the configuration detail into /var/www/symfony/app/config/parameters.ini

13. Click Go to the Welcome Page >

14. Click RUN THE DEMO and select Hello World >

15. Browse. Click. Read. Browse. Click. Read. OMFG!

How to Properly Set External Definition Using Subversion

$ svn propset svn:externals "local_folder http://remoteip/project_name" .
$ svn up
$ svn commit -m "Add external library link"

Two important points,
  1. You must quote the property value
  2. The dot (.), which is referring to the local directory, at the end of the command IS NECESSARY