Friday, March 18, 2011

unfuddle SVN setup with CPanel Shared hosting for small developer team

Hi mates,
I have been using unfuddle as a third party SVN and cPanel based shared hosting for development from more than one year. It is to mention that, cPanel shared hosting does not give you SVN access. But I believe you need a SVN setup for your small team and if you think you going to set it up without cost, then my shown setup will be knocking you the thing what you really need. The team size is really small, only 5 members. The benefits are as follows:

1. FREE of cost
2. Both windows and Linux Users can setup this process
3. Writing Shell script allows cPanel's SVN to run accordingly to perform

1. Unfuddle wont let you have users created more than 3, therefore a team more than 3 will have to share one or more accounts.
2. cPanel based shared hosting's part of monthly band will be using in this regard, but as long as it is a dev stage, it won't be a big issue, because your live application/site won't be conducting this process.

Below I am trying to state what were the steps I had to go through to accomplish such a setup.
1. Setup an SVN in the local system, I have used Tortoise SVN in windows 7 and windows XP.
2. create an account in
3. write SHELL script to execute SVN
4. Setup cron in cPanel and thats it

Lets start processes
Below, I am showing steps required in points.

Create Unfuddle account
1. Go to , the unfuddle plan page and select Private FREE option. Or you could click here. Remember there is no credit info to register/signup.

2. Once created and logged in, you will now have to create a repository. To do this, click Repositories tab and put your project title, abbreviation and version type as subversion and then click Create repository.

3. Subversion URL: you will be given a SVN URL depending on the abbreviation input by you in earlier step, something like this.

4. Login access: username and password for SVN login will be same as what you have used
during account creation in Unfuddle. So your team members will be using the same login access for working in SVN. However you can invite upto three people in free unfuddle account.

Configuring SVN
1. Download TortoiseSVN from here and setup in your system. I have setup 32-bit in windows 7
and windows XP, you may need to restart your PC but it depends, I do not know.

2. Create a folder named whatever your project name is. For example create a folder name, dissertation any where, may be in your htdocs or whatever place your working directory.

3. Right click on the created folder and select SVN Checkout... option. An window like below will appear, put repository SVN URL you have been given by unfuddle and then click ok. Login window will appear, put username and password and then click Save authentication checkbox and then click Ok and again Ok.

4. create files inside the directory and commit the work. your SVN is ready with unfuddle. Actually your team is ready to work with SVN now using unfuddle service. Just give the SVN URL, username and password to your team member and let him follow the steps for Configuring SVN, he will be able to join your team instantly.

Deploying works into DEV site
Now think your team has an web hosting in cPanel or a subdomain in cPanel. You want to deploy your team members work everyday in that domain automatically as soon as they commits their works. This is possible in just following simple steps.

1. Write SHELL Script: following will be the simplest SHELL script for this purpose.
For example you have a subdomain in your cPanel hosting named as mysubdomain, and it is located in your hosting in a directory like this. /home/devproko/public_html/mysubdomain
devproko is the hosting account name, yours will be different, so the directory will be actually, /home/Your_Hosting_Account_User_Name/public_html/mysubdomain

Open notepad and write following code and save that as
#To checkout from unfuddle repository
svn co public_html/mysubdomain

Save it into a directory by creating it as cron_scripts, lets say it is in the following directory. /home/Your_Hosting_Account_Name/cron_scripts
Therefore the files's full location will be something like this.

2. Configure cPanel CRON: login into your cPanel hosting account and click cron jobs tab. Lets say we will be updating our server in every 3 minutes. You may change the frequency but I use to use for every 2 minutes and it did not have any bad impact. For each two minutes this will execute the codes into file. Hope it makes sense. From the common settings option, put the values like following picture and then click Add new Cron Job button.
  • Set common settings selection as every 5 minutes
  • put */3 in Minute field
  • Put following code in Command field
    sh /home/YOUR_HOSTING_ACC_NAME/cron_scripts/

3. Now wait for minimum 3 minutes so that the server runs the shell script and check out files for only once from unfuddle server.

4. After three minutes are gone, you will have to modify the file as soon as possible. Open the file and remove all codes and paste following codes into that file:

#changing directory
cd /home/devproko/public_html/mysubdomain
#Running SVN Update Command
svn cleanup
svn update

and just save by overwriting the file into its previous location. Thats all. In every three minutes it will update the unfuddle server and will get all updates from the server that are committed by your team. This is a great success for me, hope yours will be :)

Tuesday, April 7, 2009

How to resolve Locked YUM

Mistakenly many times YUM is locked. When this happens for such problem like
Existing lock /var/run/ another copy is running as pid 18092.

Here's the way to resolve.
Locate the file, usually in fedora, it is located in /var/run dir
cd /var/run

press insert
delete pid number and save pressing esc + : +
x then press enter

now run your yum command

Monday, March 30, 2009

Blackberry as a modem with Grameenphone Mobile

To Connect Blackberry USB Modem in your linux machine is now pretty simple with the third party software distribution Barry. Mine is Fedora Core 10 (FC10) but it would work for any Debian System as well. Here's the steps how I did this.

This tutorial is for Grameen Phone Providers, Bangladesh. Other services like rogers, O2 have been automatically configured once you install the software Barry.

Step 1: Initiating Directories as a Preparation
cd /usr/local/src
mkdir blackberry
cd /blackberry
Step 2: Download Barry Distribution by git
If your system is a workstion or desktop configured, then get the following packages
git clone git:// barry
git clone git:// libbarry0
(above line is required in most configurations)

If your system is a development configured then get this as well along with previous twos.
git clone git:// libbarry-devel
Step 3: Configuring and Installing barry/libbarry0
Go inside directory:
cd /barry
Build the source:
Make the install file:
Install the make file:
make install

Step 4: Configuring peers script
Go to ppp dir: cd /etc/ppp/peers
Create a file: touch gp
Edit the file: vim gp

Insert following lines and then save:
debug debug debug

pty "/usr/sbin/pppob"
connect "/usr/sbin/chat -f /etc/chatscripts/"
user "gp"
password "gp"

ipcp-restart 7
lcp-echo-interval 0
lcp-echo-failure 999
mtu 1492


"pty" command is used to connect pppob tool by barry to connect your Blackberry Modem. Here it will be directed to the location where it has been installed
"Connect" command has been used to run a chatscript, which will be written after a while here. The chatscript file will require to pass parameters to Grameen Phone's PPP server.

Step 5: Configuring chatscripts
Go to the location:
vim /etc/chatscripts/

Create a chatscript File:
touch [naming is important according to the tutorial]

Insert lines below and then save:
'' AT&F
OK AT+CGDCONT=1,"IP","gpinternet"
OK ATDT*99***1#

Step 6: Before you run the ppp scripts:
This step is to ensure whether these scripts can run smoothly. Here's a TO DO list before run.
TO DO 1: Inactive your current internet
TO DO 2: If you are in a LAN, then disable your LAN Card before you want to run the scripts.

Step 7: Running Scripts
Type this in your Shell Prompt:
pppd call gp
After Running this, you would see something like following:
Serial connection established.
using channel 2
Using interface ppp0
Connect: ppp0 <--> /dev/pts/4
sent [LCP ConfReq id=0x1 ]
rcvd [LCP ConfReq id=0x19 ]
sent [LCP ConfAck id=0x19 ]
rcvd [LCP ConfRej id=0x1 ]
sent [LCP ConfReq id=0x2 ]
rcvd [LCP ConfAck id=0x2 ]
rcvd [CHAP Challenge id=0x7 <00>, name = ""]
sent [CHAP Response id=0x7 <6cca03043ecea893752b4767db33835f>, name = "gp"]
rcvd [CHAP Success id=0x7 ""]
CHAP authentication succeeded
CHAP authentication succeeded
sent [CCP ConfReq id=0x1 ]
sent [IPCP ConfReq id=0x1 ]
rcvd [LCP ProtRej id=0x1a 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
rcvd [IPCP ConfReq id=0x1b ]
sent [IPCP ConfAck id=0x1b ]
rcvd [IPCP ConfNak id=0x1 ]
sent [IPCP ConfReq id=0x2 ]
rcvd [IPCP ConfAck id=0x2 ]
local IP address
remote IP address
primary DNS address
secondary DNS address
Script /etc/ppp/ip-up started (pid 3700)
Script /etc/ppp/ip-up finished (pid 3700), status = 0x0

TO DO: let this shell window alone and be run

Note: See the lines above in bold. Primary DNS and Secondary DNS, keep these two IPs it will require in next to complete the process.

Final Step: Configuring resolve.conf
Edit the file:
vim /etc/resove.conf
Now, comment any lines by using ';' (semicolon)
Set nameservers:

Now save and quit

That's All...

Monday, March 16, 2009

Linux: system-config-network does not come in Display Mode

I was working to connect my Blackberry as a USB Modem, suddenly my newly installed fedora core 10 gone through a silly problem. That is, system-config-network, system-control-network etc. are not coming in Display mode. Unfortunately I did not able to figure out why it had happened, but by the way, I had found a silly solution though, which was a consolation to me anyway. ;) I did this as a straightforward YUM updating.

Simply did following
yum update system*

Then just restart your system and hope it will work.

Thursday, March 12, 2009

Shared Links web application for new generation Book Mark features

We have a good book mark applications around. But I think we need a new generation book marking application.
Features of this new generation Book marking web application
1. Basic:
a. Each user has an account and basic functionalities for book marking.
b. Book Mark management
c. Each user can share their bookmarks to another user
2. Graphical
a. Each user will be shown as a star in a dark sky. He can see his friends as
other stars
b. The more reach in a Book Marking a user, the brighter star he will get.
3. Future Scope
a. This can be a kind of community building site

I am thinking to park a domain named or something like this.

Wednesday, March 11, 2009

Fedora Core 10: Disable SELinux

Hi folks.
Not really know why SELinux does not allow to me run some of my applications. Then, I had asked one of my seniors about this problem, he suggested to disable the SELinux running in my Linux Fedora core 10. Then I have disabled the SELinux, which I have shown below.

Firstly: Edit this file ( /etc/selinux/config )
vim /etc/selinux/config
or any of your text editors like vi or nano whatever
vi /etc/selinux/config

Secondly: Now you will see a line like this: "SELINUX=enforcing".
There are three options in that file, options are enforcing, premissive, disabled
Now, set the option as: SELINUX=disabled

Finally: Reboot or re-login the system.

you can do this from /boot/grub/grub.conf in fedora core 7, but this can not be done in fc 10 (fedora 10)


Monday, March 9, 2009

FirePHP is an usefull extension of FireBug, for PHP Lovers in Bangladesh

FirePHP is a very good extension of Firebug plugin. It requires FireBug.
Here you can get it. FirePHP for FireFox

Its a class package by the way. Once you download and install the firePHP plugin you need to follow 3 more very easy steps to active this class.

1. Locate Library files
2. Include Library files
3. Starting output
Please visit FirePHP's official site to learn about it with clear example.

FirePHP after complete installation.

Sunday, March 8, 2009

Bangladesh: Ruby on Rails Trend

Ruby on rails came with a very good trend of latest web technologies, it covers most of the latest securities around web. The most fantastic thing is that, it lets programmers to do coding in a very convenient way that makes programmers life much much easier.

In Bangladesh, Ruby on Rails is not much familiar here, but significant companies and very few persons here are working with Ruby on Rails in Bangladesh. I am one of the part of such trend. We have build an web prescription reminder application, which can remind all patients about their medication, appointments etc, via sms and email.

The status of Ruby on Rails in Bangladesh is true while I am writing this post. Hope this trend will increase quickly in very near future. I will post some tutorials regarding this for Bangladeshi Ruby on Rails coder.


Thursday, March 5, 2009

Fedora 10: yum update rpm db fail and meta data did not match error fixed

hey folks
I was trying to update my yum using: yum update but was getting an error saying that rpm db is failed, but I have fixed up that thing in the following steps.

Step 1: clean the yum
yum clean all

Step 2: removing all rpm db from /var/lib/rpm
rm -fr /var/lib/rpm/__db*

Step 3: Now update the yum
yum update

Now enjoy

Monday, March 2, 2009

Fedora 10: Mount Logical Drives editing fstab

There are two ways to mount Logical Drives in linux, editing /etc/fstab
Using Device's file system path

Using Device's UUID

For example we will mount a unmounted LVM device which has no label yet. Let's assume that our device's system path is /dev/sda5

Structure of /etc/fstab file:
# [file system] [mount point] [type] [options] [dump] [pass]

Using Device's file system path

This is the most commonly used way to permanently mount a device.

Step 1: Open the fstab file, I have used vim. you can use yours.
vim /etc/fstab
Step 2: Put the following line there.
/dev/sda5/ /billah ext3 default 0 1
file system = /dev/sda5/
mount point = /billah
type = ext3
options = default
dump = 0
pass = 1

Now save and restart your PC

Using Device's UUID:
When you are using more than one hard drive in your PC, then most often device's file system path in fstab wont work. Then UUID, that means Universal Uniqe Identifier.

Step 1: Determinig UUID
ls -l /dev/disk/by-uuid/
which will result like following
lrwxrwxrwx 1 root root 10 2009-03-02 20:25 0499e06a-05cb-4272-ac37-7308eb7d7326 -> ../../sda5
Here the UUID of sda5 is
Step 2: Edit the /etc/fstab
0499e06a-05cb-4272-ac37-7308eb7d7326 /billah ext3 default 0 1
Now, restart your PC, thats all.

Tuesday, February 17, 2009

Google Chrome For Linux Users

Now, we can have same taste of Google Chrome in our linux platform.
Chromium is clone of google chrome for linux users.

Download Chromium from here: Google Chrome For Linux

It is developed by Crossover. Crossover is the company that generally develop windows popular software for linux users.

See here I have installed it in my Debian System.

Sunday, February 15, 2009

Joomla from Mambo

I wondered to know that Joomla CMS came from Mambo CMS.

Download Mambo 4.6.2 from Download Mambo 4.6.2


Walking in the Rails

There are few popular PHP frameworks that made easier to PHP Programmers life like, Zend Framework, CodeIgnitor, Cake PHP etc. On the other hand, Rails is the best framework for Ruby. No doubt, I love PHP, and I am a Fan of rails as well. I wondered using various tools of rails to stand various web techniques in our web application (docVia) much easily. I assure you rails is much prettier than any PHP frameworks I have ever used. Now the fantasy is, I got a dam care mind against using PHP anymore, madly searching in google to see how brain stormers differs between PHP frameworks and rails. Finally, Amazingly and gradually I was coming down. All big bosses were differentiating between PHP (a scripting language) with rails (a framework on Ruby scripting language), while I was expecting differences between Zend framework or CakePHP with Rails framework. But did not get sufficient stuffs which distinguish between Rails framework and other PHP frameworks. Then, all I get is that rails makes programmers life much easier than PHP and Perl based frameworks, which at least consulates me. Basically, it is useless to find differences between PHP frameworks and rails. Theres huge arguments while anybody starts to gather differences between these. I tried to figure out what php frameworks can not do while a ruby framework-rails can do. I turned into a wise decision finally, that’s why I am not thinking to go against PHP rather I am trying here to focus rails as a friend of PHP programmers.

Objective of this article is to gradually introducing with the concepts of Rails to the PHP lovers so that they start liking rails.

Sometimes we need to decide which tool we should choose for a particular project, the key facts we need to think are as follows:

  • Size of app, particularly UI: large apps are easier with Rails
  • Size of team: small teams can do more with Rails
  • Quality of team: PHP is easier to work with
  • Need for change: changes are easier in Rails
  • Expected initial traffic: high-volume apps are easier in PHP

Few More Exciting Things that could let you to pick rails:

Besides these above matters there are few exciting things for what you might choose rails as a tool. Like, migration in rails is just wonderful. It’s migrationing system lets you sit behind relaxed. (Same thing, you might have in other tools, but I am not offending anyone else)

Scaffolding is a popular term in frameworks world. CakePHP and a few other PHP frameworks can do such stuffs as well but rails will give you much user friendly command line scaffolding and cool CRUD interface for any database structure. This is the starting, you will see how you become more relaxed accessing various gems* and plugins of rails. Instanlty, gems are small distribution packages which works with core rails system for all applications using rails to provide its coolest features.

RESTfull Rails:
Its alike an web service. Explicitly, it is not only a web service but a technology that extends HTTP into a new dimension, which optimizes and organizes the architecture. Rails provides RESTfull architecture. Exclusive thing is that from Rails version 2.0 it lets the RESTfull architecture with scaffolding.

Localization & Internalization:
It is integrated in Rails 2.0. Multilingual problems are nicely solved here.

Rails as a ruby framework:

Rails is a full-stack framework. Full-stack basically means that when you decide to use Rails it will provide practically all of the tools necessary all by itself. While you are welcome to use other tools for sections of Rails’ functionality, most current Rails developers are not (and for obvious reasons described below).

In Rails, we follow a mantra of “Convention Over Configuration.” With this in mind, Rails will follow industry conventions to make your job easier whenever possible. One example where you can see this in action is with page templates. *1

In Rails, if you have, for example, a BlogController and it has a method called list, Rails will automatically use the list.rhtml file inside of a folder called blog in your views folder. Not only that, but Rails will automatically pass on any instance variables you were using in the controller so that the view has access to them. *2

Now, when I am doing something similar in my own PHP apps, I have to manually instantiate the template object, manually pass references to any variables I know the view will be interested in and then manually tell it what template file to use. While all that manual code is pretty simple and easy to write, on even medium-sized apps it starts to take a toll on the leaness of the codebase. *3

Rails includes features that help in increasing developer productivity. Some of the main features include the followings: *5

  • MVC architecture: Ruby on Rails is based on the MVC (Model View Controller) architecture that enables the data to be separated from presentation.
  • Database Access Library: Ruby on Rails includes a database access library - Active Record - that simplifies data handling in databases. Active Record automatically maps tables to classes and rows to objects.
  • Database Relationships: One to many and many to many relationships can be easily implemented in rails.
  • Libraries for common tasks: Ruby on Rails includes a host of libraries that simplify the coding of common programming tasks such as form validations, sessions management, etc.
  • AJAX Library: An extensive library of AJAX functions is provided in the Rails framework. Ruby code can be used to generate AJAX code. The associated java scripting required for AJX gets generated automatically.
  • Convention over configuration: Ruby on Rails does not have any XML configuration files. It includes simple programming conventions that can be used to specify the configuration parameters.
  • Customized URL: Custom or Search Engine Friendly URLs can be developed using the Ruby on Rails framework.
  • Lines of code: Amazingly reduced huge number of lines of code which decreases code complexity.
  • RESTFull Rails: it is built in from Rails 2.
  • Testing: Testing is a wonderful feature in rails.
  • Debugging: Detailed error logs are provided, making it easier to debug applications.
  • Components: Components can be used to store reusable code. Components can be included to modularize templates.

Finally, Rails recent versions provide excellent REST full technology to secure the web apps and other facilities to make faster your web apps. Another great facility is to reduce time and size of any team while you try to build any application using rails. Unless learning Rails looks hard or there’s a huge marketing budget in place at launch, consider Rails.



*1, *2, *3 :
*4 :
*5 :


Gem: A Gem is a packaged Ruby application using the packaging system defined by RubyGems. Installed in the Ruby or JRuby installation and is available to all applications run using that interpreter. Where, plugins are installed for any specified project scope.

Framework: Concept of framework came while programmers try to get more organized in engineering way. It helps to build the concept of Shelf-Off term in Software Engineering. For example, Rails is a Ruby Framework. That means, using Ruby, there is an architecture on MVC, which is calles as Rails.

MVC: It is one of the leading famous framework technologies.

Rails: Rails was created in 2003 by David Heinemeier Hansson and has since been extended by the Rails core team, more than 1,400 contributors, and supported by a vibrant ecosystem

Ruby: Ruby is a scripting language like PHP, Perl etc. Targets of all these languages are almost same. The main difference between these language is, Ruby is fully Object Oriented while PHP and other language is not like that, they are merely Structure based. For example, the value ‘2′ is considered in Ruby as a Object, thus it has some identical properties as well, in instance, like 2.days.ago or something like that. In PHP, value ‘2′ might be considered as an integer or string, what it needs, whatever its just a value in PHP.

Wednesday, February 11, 2009

Find and Replace using find and sed command

This is the best command line I have ever found to search and replace text into files within directories, sub directories.


find searching_dir -name .dir_name_to_prune -prune -o -exec sed -i 's/Searched Text/Replacing Text /g' {} \;

find . -name .svn -prune -o -exec sed -i 's/Powered by: /Site Developed by /g' {} \;
find : the find command
. : current directory (you can set other)
name : name the file list
svn : the svn dir will be prouned
prune : used to prune dirs/files
o : options
exec : executind sed command
sed : the sed command
i : this will insert new text while searched text matches
's/ : this will search for finding matches
/g' : make the operation globally.
{} \; : Out put and termanating the command line

Thats all, this works nice.....

How To Migrate Sites from one site to another site

Migrating a site from one server to another server has been confirmed by following steps:

  • Copying site contents, such as files into one server to another server

  • Making Database backup and copy the backup SQL file from one one server to migrating server
  • Restoring Database and creating DB user with necessary privileges
  • Creating Virtual Host for the migrating site into desired server
  • Testing the site by setting desired server's IP into local machines hosts file.
  • Confirming migration completion and request to set the IP to the desired server.

Copying site contents, such as files into one server to another server
Using rsync command:

rsync -avh -e ssh root@source_server_ip:~/source_directory ~/destination_directory

This command will prompt for a password, here it will prompt for root password

Using scp command:

scp -r root@source_server_ip:~/source_directory ~/destination_directory

This command will prompt for a password, here it will prompt for root password

Note: Copying Site contents made by rsync command and database SQL backup files have been copied by scp command.Making Database backup and copy the backup SQL file from one one server to migrating server:

Following command has been used frequently in database backup into *.sql files.

mysqldump -u root -p db_name > db_name.quick.sql

This will prompt root password

Note: Each database back up in sql has been stored into ~/backup_db directory

Restoring Database and creating DB user with necessary privileges:

Following process has been followed for this step:
  • Creating the database using create
    database db_name
  • Dumping database using
    mysql -u root -p db_name < db_name.quick.sql
  • Creating DB user, DB pass and setting necessary privileges with the following command :
    grant all privileges on db_name.* to 'user_name'@'hostname' identified by 'db_pass';
  • Flush privileges using :
    flush privileges;
Creating Virtual Host for the migrating site into desired server
To do this the following file needs to be edited.

vi /etc/httpd/conf.d/vhosts.conf

Testing the site by setting desired server's IP into local machines hosts file.

This is done by following steps
  • edit this file:
    vi /etc/hosts
  • put following in that file on local machine:
    desired_server_ip testing_site
  • See each functions are OK for the domain coming from that IP. If OK then migration is successful.

Confirming migration completion and request to set the IP to the desired server.

After testing it is confirmed that migration is successful, then requesting the supervisor to

set the desired/migrated host's IP for the domain.