Friday, June 19, 2009

Howto install python and mod_python on linux

Installing Python

If you want to install it onto custom directory, for example like /home/you/opt/Python

Get python sources from python.org

Untar it.

./configure --prefix=/home/you/opt/Python --exec-prefix=/home/you/opt/Python --enable-shared

make; make install;

Installing mod_python

Get mod_python from here http://httpd.apache.org/modules/python-download.cgi

Untar it.

./configure --prefix=/home/you/opt/mod_python --exec-prefix=/home/you/opt/mod_python --with-apxs=/home/you/opt/httpd/bin/apxs --with-python=/home/you/opt/Python/bin/python

# because normal 'make install' needs 'su' access,
make; make install_dso; make install_py_lib

add below configurations into httpd.conf

LoadModule python_module modules/mod_python.so

<Directory [absolute path]>
AddHandler mod_python .py
PythonHandler test
PythonDebug On
</Directory>
Restart httpd. It'll works.

Thursday, June 18, 2009

Terminal login message and broadcasting message

Login message : /etc/motd

Broadcast message : use 'wall' command

MySQL Installing DB and setting password

Before starting server, you need to install database to use.

./mysql_install_db --datadir=<path where db is installed> --user=<dbuser>

Now, you can start server.

./bin/mysqld_safe --user=<user> --port=<dbport> --socket=<sockfile path> --datadir=<path where db is installed> &

As a default, root user can login without password on console. This should be changed.

mysql> delete from mysql.user where user = '' ; # disable anonymous login
mysql> set password for 'root'@'localhost' = password('<root password>'); # set root password

Thursday, June 11, 2009

The way to program smartly.

Don't stick to one methodology.

Things should be done as simply as possible.

They don't read documents. Make it simple as possible.

Requirements always changes.

We don't need to fix tools or process. What we should matter is people.

Organize your team less than 10.

Don't draw all detail architecture. Just draw the big picture.

Monday, June 8, 2009

Httpd configuration for including expire times in response http header

  • First, you need to compile httpd using --enable-expires option. Then it's compiled with expire module built-in your httpd binary(You can check it like, > httpd -l).
  • Second, configuration file should include following setting.
    ExpiresActive On
    ExpireByType image/gif A25920000
    ExpireByType image/png A25920000
    ExpireByType image/jpg A25920000
    ExpireByType image/jpeg A25920000
    This means image file has its expire time as 2592000 seconds later (one month from now)
  • Now, you can check whether expire information is included in the response header like below

Httpd(apache) server status using scoreboard

If you're using httpd as a web server, you can check the status of your server using following url.

"http://localhost:/server-status?auto"

You can check how many workers are busy or idle by checking response page

Thursday, June 4, 2009

Asshole Driven Development

Asshole Driven Development : Any team where the biggest jerk makes all the big decisions is asshole driven development.