Ubuntu Apache2 : Change default DocumentRoot /var/www

By default the document root folder for apache2 in Ubuntu is /var/www. This were you can store your site documents. In order to change the default site location to a different one, /opt/mysite use the following method. A detailed steps to install LAMP on ubuntu is given here.

To do this, we must create a new site and then enable it in Apache2.

To create a new site:

Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite

Edit the new configuration file in a text editor “sudo nano” on the command line or “gksudo gedit”, for example: gksudo gedit /etc/apache2/sites-available/mysite

Change the DocumentRoot to point to the new location. For example, /opt/mysite

Change the Directory directive, replace <Directory /var/www/> to <Directory /opt/mysite/>

You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites

Save the file

Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).

sudo a2dissite default && sudo a2ensite mysite

Finally, we restart Apache2:

sudo /etc/init.d/apache2 restart

Shell script: Rename extensions of multiple files.

Shell provides easy way of renaming multiple files.

Eg: your directory has ’01 – Song1.mp3′, ’02 – Song2.mp3′, ’03 – Song3.mp3′ and you want to rename them to .txt. use the following commane.

$rename mp3 txt *.mp3

The above command renames .mp3 files to .txt.

An alternate script solution from here


#!/bin/sh
ls *.mp3|while read file
do
target=`echo $file|cut -d . -f 1`
#mv "$file" "$target.txt"
echo "$target.txt"
done

First test the above script by seeing the echo "$target.txt" output then uncomment the line above it and comment this line.

Search and replace text in multiple files.

I had a bunch of html files where a particular style sheet inclusion had to be removed from about 500 odd html files.

Knew this could be done through an sed script , but found a better one using perl from here.

export OLD_TEXT=’<link rel=”stylesheet” type=”text/css” href=”style.css”>’

export NEW_TEXT=’some new text’

and use it in the perl command as follows.

perl -w -i -p -e “s/$OLD_TEXT/$NEW_TEXT/g” *.html

or use it against all .html files from the current directory using find and xargs

find . -name “*.html” | xargs -i perl -w -i -p -e “s/$OLD_TEXT/$NEW_TEXT/g” {}

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Get PNR status on your mobile sms. Powered by Google

Google has a host of mobile products for the Indian market, the full list can be seen here. Among them, the pick of the lot is the SMS product, using which one can get instant PNR status for your Indian railway ticket reservation.

Excerpts from the page here.

Get cricket scores, Indian Railways train schedules & ticket status, horoscopes, movie showtimes, restaurant information and more …all through SMS on your phone.

Best of all, you don’t pay a premium charge for any of this, just the price of a standard SMS.

Try it out! Simply send your search query by SMS to 9-77-33-00000 and we’ll send you results back by SMS immediately.

Of course, don’t forget to save 9-77-33-00000 to your phonebook for quick and easy access to Google SMS in the future!

There are no premium charges for this service, only the cost of sending a standard SMS. Incoming messages from Google are not charged.

Also there are host of other services we can use too. Found them useful. Like movies, news, train fare, local business etc.

Duplicate tab for firefox 3.5

Until I saw this post , I was sorely missing the duplicate tab for firefox. It was near the top of my most loved firefox extensions till firefox 2.x. The addons page for this extension said it does not support 3.5. Well, and then I learnt 3.5 has a built in duplicate tab feature.

Just press the ctrl key and hold the tab you want to duplicate, drag and drop it to the place/area you want the new duplicate tab to appear. And thats it!!..

Life is simple now :)

Add to: Facebook | Digg | Del.icio.us | Stumbleupon | Reddit | Blinklist | Twitter | Technorati | Yahoo Buzz | Newsvine

Undo SVN merge from a Collabnet eclipse merge client

Collabnet has added a enhanced merge client to work on top of Eclipse and subclipse. While it replaces the existing merge client given by default in subclipse, it adds quite few features for the merge process.

Every body knows the pain surrounded in an svn merge. No matter how you do it, there’s always a “merge related bug” that props up post a merge. The intention of this client was to simplify the merge process in a wizard fashion. While it does so, a very important feature was done away with: the dry-run feature.

Instead, it expects you to go ahead with the merge type you choose to, and then preview the conflicts and results in the Merge Results view. There is a menu option a called “Undo Merge” given there to let you undo your actions. So all these are done post a actual merge but before you commit the changes back to the server tree.

I got little nervous and uninstalled the feature coz I wanted to preview my merge before i “actually do it”.  And then I bumped into this article on the new merge client, which clarifies the reasons for removing dry-run feature.

Happy merging :)

Enable sound for 3gp videos in ubuntu using mplayer

To play 3gp videos with audio using mplayer in Ubuntu Jaunty, add the following line to your /etc/apt/sources.list file

sudo wget http://www.medibuntu.org/sources.list.d/jaunty.list --output-document=/etc/apt/sources.list.d/medibuntu.list

You need the GPG key for medibuntu packages. Get it the following way.

sudo apt-get update

sudo apt-get install medibuntu-keyring

sudo apt-get update

now install the following packages

w32codecs mplayer mencoder amrnb amrwb

You should be able to hear the sound in mplayer now.

Source

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Unable to connect Yahoo messenger in Kopete?

[UPDATE] As of now the latest update on jaunty for the kopete package, the problem is fixed in the version 4:4.2.2-0ubuntu2.

It seems Yahoo! is changing their protocols for client connection. Heard somewhere this is done to disallow 3rd party clients like pidgin and trillian access yahoo’s messenger service. On my Ubuntu Jaunty, this has not affected pidgin yet! (looks like it auto adjusted) , but for Kopete I had to override the server connection to cn.scs.msg.yahoo.com and now its working fine.

Got the workaround from here.

Kopete is the only yahoo client on linux, AFAIK that allows video chat. Not sure if anything else has surfaced up yet. Haven’t been able to use Gyache yet with my webcam.

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Flex builder on Linux kept on Hold?

This post has reported that the flex builder work on linux has been put on hold.  Noted Adobe techie has said “there is not enough requisition for the product to continue its development”

Well, that’s not a great news to hear.. considering the open sourced SDK of adobe flex,  good amount of interest was generated in the FOSS developer community. To help it revive again, use this link to vote on the adobe site.

http://bugs.adobe.com/jira/browse/FB-19053

From the current builder available on linux ,which is infact a eclipse plugin, the main feature I missed was, the design view in it. Hopefully, when the development continues design view is also ported to linux.