SVN Post Commit hook

Some days ago, I got a requirement of giving access to 3 users to my SVN repo over ssh.

#groupadd dev
#useradd -g dev auser
#useradd -g dev buser
#useradd -g dev cuser

Then set the passwords for each user.

For SVN, update changes, you need to have the working copy owned by dev group

#chmod 0775 -R myworkingcopy
#chown -R apache:dev myworkingcopy

For svn post commit hook

#chown apache:dev post-commit
#chmod 0755 post-commit

The point here is that the user committing the changes should have the write permissions to the working copy and execute permissions on the post-commit hook

and all is good.

Installing python 2.7.1, mysql-pythondb and PIL (python Imaging Library) on centos


yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-develsqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel make

cd /var/tmp

wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz

tar xvfz Python-2.7.1.tgz

cd Python-2.7.1

./configure --prefix=/opt/python2.7.1 --with-threads --enable-shared

make

make install
touch /etc/ld.so.conf.d/opt-python2.7.1.conf

echo "/opt/python2.7.1/lib/" >> /etc/ld.so.conf.d/opt-python2.7.1.conf

ldconfig
ln -sf /opt/python2.7.1/bin/python /usr/bin/python2.7
cd /var/tmp

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg

sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.1
/opt/python2.7.1/bin/easy_install pip

ln -sf /opt/python2.7.1/bin/pip /usr/bin/pip
pip install virtualenv

ln -sf /opt/python2.7.1/bin/virtualenv /usr/bin/virtualenv
echo "alias python=/opt/python2.7.1/bin/python" >> ~/.bash_profile

echo "alias python2.7=/opt/python2.7.1/bin/python" >> ~/.bash_profile

echo "PATH=$PATH:/opt/python2.7.1/bin" >> ~/.bash_profile

source ~/.bash_profile
# install mysql python db

cd /var/tmp

pip install http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download

#install PIL

yum install libjpeg freetype

pip install http://effbot.org/downloads/Imaging-1.1.7.tar.gz

Spliiting a Huge text or CSV file into smaller chunks

I got into a situation where i had to import a 10GB CSV file into mysql. I tried to open the file using excel, but it hanged and gave errors of Lesser Resources (RAM). 

Then I came to know about one less know tools of Linux shell called ‘csplit’.

I ran the command:

# csplit -k tenGB.csv +50000 {*}

-k = do not delete  the files on error encounter

+50000 = split to a new file after 49999 lines

{*} = repeat the same pattern on next files.

 

 

it created almost 43 files. with pattern xx00, xx01 and so on…

then i renamed all these files using the command:

#for f in *; do mv "$f" "${f%}.csv"; done

and thats it!!

Planner 0.14.4 complete progress issue

I have been using the Planner for quite a long time. Its a very good software for Project Management and Planning. Over the time many improvements have been made in the project. The latest stable release you can find at http://live.gnome.org/planner is 0.14.4. I upgraded from 0.14.2 on my Vista Laptop. Everything is fine, however a strange thing I noted is that the complete progress of any task does not move beyond 75%. I tried on subtasks and individual tasks, but invain.

Finally, I consulted planner development team regarding this issue and Rhian Geleick guided me the temporary solution for the bug. The solution is

  1. Go to the installtaion directory of planner
    <INSTALL DIR>/share/planner/glade.
  2. Edit the file named ‘task-dialog.glade’ in this directory, in any of the text editors
  3. Goto Line number 236, and change
    <property name=”adjustment”>0 0 100 10 25 25</property>
    To
    <property name=”adjustment”>0 0 100 10 25 0</property>
  4. Anyone using the priority field should should also change line number 257
    From
    <property name=”adjustment”>0 0 9999 1 10 10</property>
    To
    <property name=”adjustment”>0 0 9999 1 10 0</property>
  5. Save the file and then Check in Planner. The bug is rectified.

Thanks for the Planner Team for their timely support.

Enable mod_rewrite in apache

If you are using Windows OS and want to enable mod_rewrite module here is how to do it.
This is the general configuration guideline both for Windows and Linux server:

QUOTE

1. Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines)
2. Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound ‘#’ sign from in front of the line)
3. Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

For Windows, find the following section in httpd.conf file:


DocumentRoot "C:/path/to/my/root"

# Each directory to which Apache has access, can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# permissions.
#

Now modify the option for AllowOverride to look like this:
<Directory />
Options All
AllowOverride All
</Directory>

Open rar file or Extract rar files under Linux or UNIX

download binary package from official rarlab site:
$ cd /tmp
$ wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz

Untar file
$ tar -zxvf rarlinux-3.6.0.tar.gz

Both unrar and rar commands are located in rar sub-directory. Just go to rar directory:
$ cd rar
$ ./unrar

Now copy rar and unrar to /bin directory:
# cp rar unrar /bin

How to use unrar

unrar command supports various options below are common options that you need to use everyday.

Task: To open rar (unpack) file in current directory type command:

$ unrar e file.rar

Please note that replace file.rar filename with your actual filename.

Task: List (l) file inside rar archive:

$ unrar l file.rar

Task: To extract (x) files with full path type command:

$ unrar x file.rar

(D) To test (t) integrity of archive, file type command:
$ unrar t file.rar

PHP 5.3 upgrade in Centos 5.3

I’ve finally figured out a way to install PHP 5.2.x instead of PHP 5.1 which installs on CentOS 5.3 by default. I’ve wanted to use phpMyAdmin 3.x but could not because of this. Now I can, and if you keep reading you will too. Note if you follow this how-to and do everything correctly you won’t even loose your current database. But I highly recommend you backup your database before you proceed.

First lets download this following repositories:

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/el5.i386/remi-release-5-8.el5.remi.noarch.rpm

## Lets remove old MySQL 5, will install newer version later.
yum remove mysql

## Now lets install them:
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

## OK, Now you should be able to install PHP 5.2.9 without a problem =)
yum  – -enablerepo=remi update php-cli
OR
yum  – -enablerepo=remi update php*

(Note:     – - enablerepo has two dashes without space before it)

## Now install MySQL
yum –enablerepo=remi install mysql mysql-server
chkconfig -levels 235 mysqld on
service mysqld start

If you get the following error when you try starting newly installed MySQL;
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

## Now install PHP-MySQL module
yum –enablerepo=remi install php-mysql

1. Try restarting your web server;
service lighttpd restart
or
service httpd restart

2. Type this command:
cd /

3. Restart your mysql server;
service mysqld restart

## Set root and hostname passwords
mysqladmin -u root password ‘new_pass_here’
mysqladmin -h server.yourdomain.com -u root password ‘new_pass_here’

When it asks you to import signature, do it. press y and hit enter. It should ask you twice.

I use the first one because I don’t have Apache Web Server, I use LightTPD.

## Now run update on your system.
yum –enablerepo=remi update