Friday, December 21, 2007

Live to the present

Borrowed from the Charvak;

While life is yours live joyously;
No one can avoid Death's searching eye:
When this body of ours is burnt,
How can it ever return again?


Or the very popular saying of Charvak:

Jab tuk jiyo sukh se jiyo
Chahe udhaar le ke Ghee piyo

Tuesday, November 27, 2007

A quick note on how to install Alfresco

1. Install (if not already there) jre/jdk1.5x (no jdk-1.4x)

2. Set JAVA_HOME environment variable
In the .bash_profile file of root add these line at the last
JAVA_HOME=/Path_Of_Jdk1.5
export JAVA_HOME

3. Create a dir 'alfresco' in /opt

$cd /opt
$ mkdir alfresco

4. Download this file 'alfresco-community-tomcat-2.0.0.tar.gz' from
sourceforge
http://sourceforge.net/project/showfiles.php?group_id=143373

5. Untar the tar file at /opt/alfresco
$ cd /opt/alfresco
$tar -xzf /Path/alfresco-community-tomcat-2.0.0.tar.gz

6. Create one mysql database
$ cd alfresco/extras/databases/mysql
$ mysql -u root -p < db_setup.sql

7. Remove 3 files (default for HSQL) from here

$ cd /opt/alfresco/tomcat/shared/classes/alfresco/extension

custom-db-and-data-context.xml
custom-db-connection.properties
custom-hibernate-dialect.properties

8. Start the tomcat server and run the alfresco
$cd /opt/alfresco
$ alfresco.sh start


9. Point browser at
http://localhost:8080/alfresco

10. Stop alfresco
$cd /opt/alfresco
$ alfresco.sh stop

Thursday, October 25, 2007

NetBeans IDE on Linux

The NetBeans IDE is a free, open-source Integrated Development Environment for software developers.
The NetBeans IDE provides developers with all the tools they need to create professional
cross-platform desktop, enterprise, web and mobile applications.

To install NetBeans IDE on Linux (Steps given here are performed on FC7):

It needs Java SDK-1.5.x so first install Java SDK-1.5.x and the JAVA_HOME in the environment variable in the .bash_profile file

# Download NetBeans IDE from here.

Downloaded file be like this: netbeans-x_x_x-linux.bin

# Make the file executable

$ chmod +x netbeans-x_x_x-linux.bin
Run this file
$ ./netbeans-x_x_x-linux.bin

It will open the Launcher, accept the License and click Next.
Select the Java version you want to use with the IDE, specify the path where you want to install the NetBeans IDE.

It will install all the files in the selected folder to run the NetBeans IDE cd to the bin directory and run the command:

$ ./netbeans

Wednesday, October 17, 2007

Could not find default font "fixed" . X Server not starting

If you encountered this problem in your linux then most probably this is because of there is no enough space left in your hard disk

Login as root in the text mode and check the hard disk space:

$ df -h

If available space is very low then delete some unwanted files/folder and make more space.

Restart your machine.

Monday, October 15, 2007

Breakout game for Linux


Want to play your favorite BREAKOUT game on Linux box. Its open source clone version is available.

Download the sorce code from here .
Open the tar file and run the following commands in the terminal.

$cd lbreakout-x-xx
$ ./configure
$ make
$ make install

The executale will be installed at /usr/local/bin

Thursday, September 27, 2007

RMagick installation on Fedoras

RMagick requires ImageMagick and ImageMagick-devel libraries.
Your distribution may include at least some of these libraries by default and probably provides pre-built packages for the others. If not, these are available as source code tarballs from http://www.imagemagick.org/pub/delegates/.

Or you can install these using the yum command:

$yum install ImageMagick

$yum install ImageMagick-devel

RMagick also needs Windows TureType font, download the rpm from here:

http://www.zacharywhitley.com/linux/rpms/fedora/core/6/i386/msttcorefonts-2.0-1.noarch.rpm

Install this:
$ rpm -ivh msttcorefonts-2.0-1.noarch.rpm

Make a symbolic link the font dir to the place rmagick expects them:

ln -s /usr/share/fonts/msttcorefonts /usr/share/fonts/default/TrueType

Some applications based on RMagick also requires freeimage header files.
Download freeimage from here
http://freeimage.sourceforge.net/download.html
Unzip the file and cd to the freeimage dir and run following commands

# make
# make install

Now install RMagic using the gem

$ gem install RMagick --include-dependencies

Thursday, August 30, 2007

Connecting Bluetooth devices

Tested on FC7 running on Compaq Presario and Nokia-N73 and Sony w300i

Start the bluetooth device like mobile phone having bluetooth support.
Oviously device should have in-front of the Laptop.

Start the Bluetooth service on FC7.
System => Administration => Server Settings => Services => Bluetooth
Turn on the Wireless on FC7

Run the Bluetooth File Sharing
Applications => System Tools => Bluetooth File Sharing

To check whether FC7 is able to scan the mobile devices
Run at terminal:

$ hcitool scan

It will display the mobile name.

Now open the file browser to send file to mobile.

Right click on file => Send to => Bluetooth => Select the mobile name

In the Mobile it will ask for confirmation, click yes to accept the file from computer.

Wednesday, August 22, 2007

running mp3 and video on Fedora

As default Fedora installation does not support player for MP3 and some video format like avi and MP4, we have to install either MPlayer or VLC to play these files.

To install MPlayer and VLC:

Copy the freshrpm from here

Install this rpm:

$rpm -ivh freshrpms-release-1.1-1.fc.noarch.rpm

Now install MPlayer and VLC

$ yum -y install mplayer vlc

After successful installation you get the 'MPlayer' and 'VLC media player' menu in the Applications => Sound and Video

Wednesday, August 8, 2007

installing and running memcached

memcached is a general-purpose distributed memory caching system.
It is often used to speed up dynamic database-driven websites by caching data and objects in memory to reduce the amount the database needs to be read.

memcached is dependent on libevent library, so firstly download the source files for Libevent
from http://www.monkey.org/~provos/libevent/

Install libevent:

$ tar -xvf libevent-1.3c.tar.gz
$ cd libevent-1.3c
$ ./configure
$ make
$ make install

In Fedora the library (libevent-1.3c.so.1.0.3) will be installed at
/usr/local/lib
Create a link or copy this file to standard libarary location (/lib) of Fedora
$ cd /lib
$ ln -s /usr/local/lib/libevent-1.3c.so.1.0.3 libevent-1.3c.so.1

Download the latest memcached from http://www.danga.com/memcached/download.bml


$ tar -xzf memcached-1.2.2.tar.gz
$ cd memcached-1.2.2
$ ./configure
$ make
$ make install

Running:
$ memcached -h
(Will display various options)

To run as a deoman
$ memcached -d -u apache
Will start as daemon with default options Port(p): 11211 and Max memory (m) to use: 64MB

Wednesday, August 1, 2007

Create swap file in Fedora- Linux

Swap file is used by the Kernel for Virtual Memory.
It is recommended to have swap size double of the RAM but if RAM is more than enough (>512 MB) then
smaller swap has no issue.

To know the actual memory (RAM) and already swap on a Linux box use the free command.

$ free
total used free shared buffers cached
Mem: 507956 489860 18096 0 9580 76876
-/+ buffers/cache: 403404 104552
Swap: 1012084 69668 942416

Now to create extra swap file follow the steps:
(To create swap file of approx 1GB)

$ dd if=/dev/zero if=/usr/more_swap bs=1000000 count=1024

(It will create one swap file more_swap in /usr)

$ chmod 600 /usr/more_swap
$ mkswap /usr/more_swap
$ swapon /usr/more_swap


Now add this file to the /etc/fstab file (at last)
$ vi /etc/fstab

/usr/more_swap swap swap defaults 0 0

Tuesday, July 17, 2007

Installing and running Nagios

Download latest & stable nagios from here. Select the tarball
Download
Also download the plugins

Here these steps have been performed on Fedora 2 and Fedora5 using the nagios-2.9 and nagios-plugin-1.4.9.

Add one user nagios and one group nagcmd
$adduser nagios
(There is no need of assigning password to this user as this user is not going to login to the
system)
$groupadd nagcmd

Add user nagios and web server user apache to this group
(To know who is the owner of web server
$grep "^User" /etc/httpd/conf/httpd.conf
)

$usermod -G nagcmd nagios
$usermod -G nagcmd apache

$cd /usr/local/
Create one dir to hold all the nagios files
$ mkdir nagios
Change ownership of this dir to nagios
$chown -R nagios:nagios nagios

Untar the downloaded nagios tar file
$tar -xzf nagios-x.x.tar.gz

It will create one dir nagios-x.x inside the /usr/local
$cd nagios-x.x/

Configure the nagios and install
$./configure --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd
$make all
$make install
$make install-init
$make install-commandmode
$make install-config

Installing Plugins
$ cd /usr/local

Untar the downloaded nagios plugin
$tar -xzf nagios-plugins-1.x.x.tar.gz
$cd nagios-plugins-1.x.x/

Configure the nagios plugin, and install plugins
$./configure --prefix=/usr/local/nagios

$make
$make install

Plugins will be installed at
/usr/local/nagios/libexec

Setup The Web Interface

Configure Aliases and Directory Options For The Web Interface
Add these line (at last) in the httpd.conf file (at /etc/httpd/conf dir)

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin



Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user


Alias /nagios /usr/local/nagios/share


Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user


Restart the webserver
$ /etc/init.d/httpd restart

Configure Web Authentication
$htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

(Enter the password)

Rename the config sample file
Nagios creates sample configurtion files at /usr/local/nagios/etc
Rename these files
$cd /usr/local/nagios/etc
$mv nagios.cfg-sample nagios.cfg
...and so on

Start nagios
$/etc/init.d/nagios start

After changing any config file check the main nagios.config
$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

It will display any syntax error in any config file with file name and line number, rectify the errors and reload the nagios.

$/etc/init.d/nagios reload

Point your browser at:

http://localhost/nagios

It will ask for apache authentication, supply the user: nagiosadmin and password

Thursday, July 12, 2007

Friday, June 29, 2007

add svn repository

1. add one svn user and group

$ useradd svn -c "SVN Owner" -s /bin/false
(-c comment, -s shell , here no shell access)

2. If we want more than one repository then add group for each one.

$ groupadd reposgp
$ usermod -G reposgp svn
(Add this group to svn user/group)

3. Create a Subversion repository

We are creating it at /var ; svn will be the folder containing all repos
$ install -v -m 0755 -o svn -g svn -d /var/svn
$ svnadmin create --fs-type fsfs /var/svn/repos

(Here 'repos' will be our repos)

Now we can import some files/dir to the repos

$ svn import -m "Initial import." /path/to/source/tree
file:///var/svn/repos


Now change owner and group information on the repository, and add
an unprivileged user to the svn and reposgp groups:

$ chown -R svn:odotgp /var/svn/repos
$ chmod -R g+w /var/svn/repos
$ chmod g+s /var/svn/repos/db
$ usermod -G svn,repsogp sanjay

(here sanjay is already a user in the system)

We can verify the existing groups of user with the commands

$ groups sanjay

Monday, June 18, 2007

Regular Expressions

Regular Expression:

^ : Matches the Beginning of string
$ : Matches the End of string
(): Parentheses, define the scope and precedence of Operators

Quantification: How often the preceding expression is allowed
There are 3: ?, * and +

?: 0 or 1 [ colou?r will match color or colour ]
*: 0, 1 or any number [ go*gol will match ggol, gogol, googol, gooogol etc ]
+: at least 1 [ go+gol = gogol, googol, gooogol etc ]

{n}: Repeat n times the previous exp

Examples:

1xx : ^1[0-9]{x}
21xx or 22xx: ^2[12][0-9]{2}
3xxxxxxxxxx, 4xxxxxxxxx, 9xxxxxxxxx (10 digits telephone number starting with 3, 4 or 9)
^[349][0-9]{9}

Thursday, June 14, 2007

Setting a Crontab

Syntax:

* * * * * command

# Use the hash sign to prefix a comment
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executed


Crontab Example
_______

A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.

30 18 * * * rm /home/someuser/tmp/*

Changing the parameter values as below will cause this command to run at different time schedule below :

min hour day/month month day/week Execution time
30 0 1 1,6,12 * -- 00:30 Hrs on 1st of Jan, June & Dec.

:

0 20 * 10 1-5 --8.00 PM every weekday (Mon-Fri) only in Oct.

:

0 0 1,10,15 * * -- midnight on 1st ,10th & 15th of month

:

5,10 0 10 * 1 -- At 12.05,12.10 every Monday & on 10th of every month
:

By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .

>/dev/null 2>&1

Thursday, May 17, 2007

Happy Bday to Shlok


My son Muthu aka Shlok just celebrated his first birthday at 12th May

Wednesday, May 16, 2007

bugzilla installation on Fedora

Download latest stable Bugzilla from here
Untar the package at /var/www/html folder
$ tar -xzf bubzilla.x.x.tar.gz

Bugzilla's installation process is based on a script called checksetup.pl. The first thing it checks is whether you have appropriate versions of all the required Perl modules. The aim of this section is to pass this check. When it passes, proceed to Section 2.2.

To check you have the required modules, run:

bash# ./checksetup.pl --check-modules

checksetup.pl will print out a list of the required and optional Perl modules, together with the versions (if any) installed on your machine. The list of required modules is reasonably long; however, you may already have several of them installed

$ perl -MCPAN -e 'install ""'

Create one database in mysql with user/passord

Change the localcongif file of bugzilla (db related)

Run the
./checksetup.pl

Change the apache httpd.conf file add

AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit


Restart the webserver
Point browser at
http://localhost/bugzilla

Monday, May 7, 2007

Favorite Hindi books

1. Shekhar - Ek Jeevani (part 1)- Agyey

2. Shekhar - Ek Jeevani (part 2)- Agyey

3. Nadi ke Dweep - Agyey

4. Apane-apane ajnabi- Agyey

5. Yayaati - Vishnu Sakharaam Khandekar

6. Rag-Darbaari - Shree Laal shukla

7. Vishrampur ka Sant - Shree Laal shukla

8. Mujhe Chaand Chahiye - Surendra Verma

9. Mratunjay - Vishnu Sawant (Hindi)

10. Yatha-sambhav - Sharad Joshi

11. Vaishnav Ki Fislan: Harishankar Parsai

12. Gunaho ka Devata - Dharmveer Bharati

13. Aur Ant mein Prarthana- Udai Prakash

14. Tastari mein toofan: Meenaxi Puri

15. Apka Bunty : Mannu Bhandari

16. Saara Akash : Rajendra Yadav

17. Warren Hastings Ka Saand : Udai Prakash

18. Zindaginama : Krishna Sobti

19. Ghaalib Chuti Sharab: Ravindra Kaaliya

20. Chaak: Maitreyi Pushpa

21. Edennmam: Maitreyi Pushpa

22. Mitro Marjani: Krishna Sobti

23. Paul Gomara ka scooter: Udai Prakash

24. Maila Aanchal: Renu

25. Sunita : Jainendra

26. Peeli Chhatri Wali Larki: Udai Prakash

27. Tirich: Udai Prakash

28. Andha Yug: Dharam Vir Bharti

29. Dilo Daanish: Krishna Sobti

30. Kasap: Shyam Manohar Joshi

31. Tyaag Patra: Jainendra

Monday, April 23, 2007

Install Alfresco from the Source Code in Fedoras

1. Install Java 1.5x
If you dont have the java downlaod it from
here

2. Install Tomcat 5.2x
Take tomcat 5 from
here

3. Install Ant 1.6x
Download latest Ant from
here

4. Set these Environment Variables: In Redhat/Fedora linux these vales can be
set in .bash_profile file
JAVA_HOME
TOMCAT_HOME
VIRTUAL_TOMCAT_HOME
(For virtual tomcat you need to install one more tomcat 5.2x)

5. Checkout Source Code from here:
$svn co svn://svn.alfresco.com/alfresco/HEAD
$cd HEAD/root/projects/installer/HEAD
(delete 3 files custom*)

6. $cd HEAD/root/
ant build-tomcat
This will create one alfresco.war file and copy it to the
TOMCAT_HOME/webapps/

7. copy mysql-java connector jar file form
HEAD/root/projects/3rd-party/lib/devenv/mysql-connector-java-5.0.3-bin.jar
to TOMCAT_HOME/common/lib

8. Create one alfresco database and grant all to alfresco user
Connect to mysql as root
mysql>create database alfresco;
mysql>grant all on alfresco.* to alfresco@localhost identified by 'alfresco';
mysql>grant all on alfresco.* to alfresco@localhost.localdomain identified by 'alfresco';

9. As default memory (heap size) allocated by tomcat for java is less than required to run the alfresco sp increase the heap size.Edit the tomcat/catalina.sh file and make

$_RUNJAVA.... line like this
$_RUNJAVA -Xmx512M $JAVA_OPTS $CATALINA_OPTS

10. Start Tomcat
$./catalina.sh run &

11. Point Browser to:
http://localhost:8080/alfresco

Friday, April 20, 2007

Change sugarCRM password from backend

If you forget your sugar admin password then dont be panic.
Can reset it from the mysql backend.

Connect to your sugar mysql database and execute this query:

For sugar version < style="font-family:verdana;">
update users set user_password=MD5('NewPass') where user_name='admin';

For sugar version >= 45
update users set user_hash=MD5('NewPass') where user_name='admin';

Wednesday, April 18, 2007

Install Java on Linux Machine

Download the latest JDK from http://java.sun.com/javase/downloads/index.jsp
Select jdk-xxx.xx.Linux.xxx.bin to download for Linux machine

This is a binary file so execute this file.

$ cd /usr
$ ./jdk-xxx.x-linux-i586.bin

Edit your bash profile file to set the Java home.

$cd
$vi .bash_profile
Add/edit these lines
PATH=/usr/jdk-xxx-x.x/bin

JAVA_HOME=/usr/jdk-xxx-x.x/
export JAVA_HOME

#Save and Exit from the vi

$source .bash_profile

Check the java version
$ java -version

Whats new in Ajuby 0.5