Tips

Automatic virtual host with Apache

When developing with CakePHP, we can setup Apache to automatically redirect a domain to a specific CakePHP application.

We can set computer’s aliases using hosts file. Apache will automatically map aliases to different DocumentRoot:

app1.mybox.com -> /var/www/cakephp/app1.mybox.com/webroot app2.somewhere.com -> /var/www/cakephp/app2.somewhere.com/webroot

Step 1: Enable the mod_vhost_alias:

$ sudo a2enmod vhost_alias

Step 2: Replace the DocumentRoot statement in default virtualhost configuration file with two lines:

UseCanonicalName    Off VirtualDocumentRoot /var/www/cakephp/%0/webroot

(If ... read more ...

How to prevent a package from being updated in Ubuntu

If you want to update all the packages other than one package in your Ubuntu system follow this procedure

There are three ways of holding back packages, with dpkg, aptitude or with dselect.

Using dpkg

Put a package on hold

sudo echo “package hold” | dpkg --set-selections

Example

sudo echo “apache2 hold” | dpkg --set-selections

Remove the hold

sudo echo “package install” | dpkg --set-selections

Example

sudo echo “apache2 install” ... read more ...

Viết blog bằng Google Docs

[Bài này tôi viết đã lâu.  Cách làm này không thực sự giúp ích được nhiều.]

Trước đây tôi vẫn thường soạn thảo các bài viết trực tiếp bằng HTML hoặc sử dụng một richtext editor được nhúng sẵn trong Drupal. Tuy nhiên việc cắm thêm richtext editor khá bất tiện vì việc thêm module này làm trang web nặng lên ... read more ...