Oct
26
2009
0

I am glad to participate in the HKCS extreme contest. The following is my entry for this year:

HKCS eXtreme contest – cha siu bao 叉燒包

Written by Chris Lam in: 生活隨筆 |
Sep
11
2009
0

Week 1: Compeititon Experience

The 40th WorldSkills Competition took place on September 1 – 7. Over 900 Competitors competed simultaneously in 45 skill categories during four days of intense competition at Stampede Park (Calgary, Alberta, Canada). I have been lucky enough to represent Hong Kong to participate in the competition in the skill category of “IT/Software Applications”, competing against 17 competitors from other countries.

10531_134579971811_670701811_2500307_659059_n

Although I lose in the competition (2 more marks to receive a medallion…), but “I have tried my best, I have no regret”.

Written by Chris Lam in: CS3382 |
Sep
08
2009
Enter your password to view comments

Protected: 抱憾終生

This post is password protected. To view it please enter your password below:


Written by Chris Lam in: 生活隨筆 |
Jul
05
2009
0

MySQL: To Check, Repair & Optimize All Tables in All Databases

  1. mysqlcheck -u root -p --auto-repair --check --optimize -A
Written by Chris Lam in: Linux / Unix |
Jan
25
2009
0

Howto: Install Python, mod_python, and Django on CentOS 4

Introduction

I have managed to install python, mod_python, and Django on one of my Linux servers. This howto has been proven to work along with CentOS 4.3 and Apache 2.0.63.

Install Python

Python is bundled on most Linux distro. If you are using Ubutu, CentOS, or any other distro that use yum as the package manager, you may skip this step because yum is written in python.

If Python is installed, you can check its version by running:

  1. python -V

If you don’t have it, install it using yum:

  1. yum install python python-devel -y

The Python version from the yum repository for CentOS 4 is 2.3.4, if you want the lastest stable version, you will need to compile it from source.

Install mod_python

mod_python is an Apache module that embeds Python within Apache and loads Python code into memory when the server starts. It allows you to write Python code with HTML embedded just like PHP.

  1. wget http://mirrors.geoexpat.com/apache/httpd/modpython/mod_python-3.3.1.tgz
  2. tar zxvf mod_python-3.3.1.tgz
  3. cd mod_python-3.3.1
  4. ./configure
  5. make
  6. make install

Configure mod_python to work with Apache

Edit your httpd.conf, add:

  1. LoadModule python_module /usr/lib/apache/mod_python.so

Dont forget to change the path to the mod_python.so

Install Django

  1. wget http://www.djangoproject.com/download/1.0.2/tarball/
  2. tar xzvf Django-1.0.2-final.tar.gz
  3. cd Django-1.0.2-final
  4. sudo python setup.py install

Configure Django

In your home directory, run:

  1. python /usr/lib/python2.3/site-packages/django/bin/django-admin.py startproject project

This will create the directory /path/to/your/home/directory/project with some Python files in it.

Then edit your httpd.conf file and add the following:

  1. <Location "/project/">
  2. SetHandler python-program
  3. PythonHandler django.core.handlers.modpython
  4. SetEnv DJANGO_SETTINGS_MODULE project.settings
  5. PythonOption django.root /project
  6. PythonDebug On
  7. PythonPath "['/path/to/your/home/directory'] + sys.path"
  8. </Location >

Restart Apache

Restart Apache to enable the new settings:

  1. service httpd restart

Now you can access http://www.example.com/project in a browser. If everything went well, you should see something like this:

Create a New Django Project

  1. python /usr/lib/python2.3/site-packages/django/bin/django-admin.py startapp blog

Congratulations! You can now start developing your Django application!

Written by Chris Lam in: 生活隨筆 |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes