Sunday, December 29, 2013

Login with 2 users in one terminal

Requirements : Ubuntu OS

1. Open terminal

2. Set root password incase you dont know
sudo passwd root

3. Create another user, say alice
sudo useradd alice

4. Assign password to alice
sudo passwd alice

5. Open another tab in the same terminal and type
su - alice

6. Likewise you can add as many users you wish on the terminal and make users interact with each other simultaneously.

7. But if you try to do any sudo command then it will give you an error
alice is not in the sudoers file.  This incident will be reported.

8. Exit alice user
ctrl c

9.  For that, open a file
sudo gedit /etc/sudoers

10. Add line in the file

11. Close the file


Saturday, December 28, 2013

Important Firefox Add-ons

1. QuickJava
Enables javascript/java/flash/silverlight/.... on browser.

2. Wisestamp
Enhances your webmail signature in gmail,yahoo etc.

3. Make Address Bar Font Size Bigger
Make the url address font size bigger

4. Selenium IDE
Add-on testing tool.

5. Flash and video Download
Downloads online videos
Description: After installing the add-on, restart the browser. Go to the link from which you want to download the video. Click on the top right corner gray square like with a down arrow icon on the navigation bar of the browser. You will see the name of the video playing in the dropdown. Select it and it will automatically ask for location in your system to save the video. Choose the path and click save. The video will get saved.

6. Abduction
To take screenshot of a region on webpage.

wget command

wget utility retrieves files from World Wide Web (WWW) using widely used protocols like HTTP, HTTPS and FTP. Wget utility is freely available package and license is under GNU GPL License. This utility can be installed in any Unix-like Operating system including Windows and MAC OS. It’s a non-interactive command line tool. Main feature of Wget is it’s robustness. It’s designed in such way so that it works in lethargic or unstable network connections. Wget automatically starts downloading where it was left off in case of network problem. Also downloads file recursively. It’ll keep trying until file has been retrieved completely.

Install wget in linux machine
sudo apt-get install wget 

Create a folder where you want to download files .
sudo mkdir myimages
cd myimages

If there are 20 images to download from web all at once, range starts from 0 to 19.
Right click on the first image and choose "Copy Image Location"
Type in terminal
wget http://example/img{0..19}.jpg ---that image location

If you want to convert all the downloaded images into one pdf then
convert img{0..19}.jpg slides.pdf


Change Bluetooth name in Ubuntu

Requirements : Linux : Ubuntu

I have Ubuntu OS in my system(laptop). There are situations when I want to transfer files from my tab3 to my system through bluetooth in IIT. As all the systems in IIT are configured with Ubuntu OS, all system names are 'ubuntu-0'. It is quite confusing as to which system my tablet is getting connected.

So I changed my system's name. The procedure to do so is as follows:
1. Open your terminal
2. Type
cd /var/lib/bluetooth/XX:XX:XX:XX:XX:XX/

3. sudo gedit config

4. change name 'ubuntu-0' to anything you wish.
5. close the file
6. Reboot the system


Sunday, December 1, 2013

Chat Project with SVN

SVN is version control system.   

1. Install SVN on Linux 
$ sudo apt-get install subversion

2. Install Apache
$ sudo apt-get install apache

3. Now we want to configure apache to run HTTPs.
Following command will enable ssl Apache2 module with a2enmod (cryptic name for “Apache2
enable module”:
$ sudo a2enmod ssl

4. Now configure the SSL site. Fortunately we already have the configuration file for that, we just
need to enable it with a2ensite (cryptic name for “apache2 enable site”)
$ sudo a2ensite default-ssl

5. As we made several changes I prefer to restart apache with
following command:
$ sudo /etc/init.d/apache2 restart

6. First of all, we need to install the Subversion modules for Apache2.
$ sudo apt-get install libapache2-svn
They will be enabled by default. So you don’t need to run a2enmod.
We only need to configure a repository. Let say our project is called ‘myproject’.

7. First of all, let’s decide where our svn repositories will be created. I like /var/local/svn
$ sudo mkdir /var/local/svn/

8. Then let’s create the repository using following procedure:
$ sudo mkdir /var/local/svn/myproject
$ sudo chown www-data:www-data /var/local/svn/myproject
$ sudo -u www-data svnadmin --config-dir /etc/subversion create /var/local/svn/myproject
Above commands will ensure that the user www-data (which is the apache user) can fully access
the repository for reading and updating it.

9. edit /etc/apache2/mods-available/dav_svn.conf
$ sudo gedit /etc/apache2/mods-available/dav_svn.conf
And add a section like the following one:
<Location /svn/myproject>
DAV svn
SVNPath /var/local/svn/myproject
AuthType Basic
AuthName “My Project Subversion Repository”
AuthUserFile /etc/subversion/myproject.passwd
Require valid-user
In the above file we indicated that, at the location svn our repository should respond. And for
updating the repository we want a valid user. As per above configuration anonymous consultation
is allowed; but you can disable it commenting with a leading ‘#’ the lines <LimitExcept ... and
</LimitExcept> or just removing them as in following example:
<Location /svn/myproject>
DAV svn
SVNPath /var/local/svn/myproject
AuthType Basic
AuthName “My Project Subversion Repository”
AuthUserFile /etc/subversion/myproject.passwd
Require valid-user

10. valid users need a password, and in fact we indicated a password file for our repository
called /etc/subversion/myproject.passwd. So let’s create a password file with a couple of users:
$ sudo htpasswd -c /etc/subversion/myproject.passwd foss
$ sudo htpasswd /etc/subversion/myproject.passwd trupti
The -c option indicates that the password file should be created as new; and it is only necessary for the first user. Be aware of the fact that -c overwrites the existing password file without asking

11. Let’s reload apache configuration to make the changes effective:
$ sudo /etc/init.d/apache2 reload

12. And let’s test with the browser that our svn repository is now accessible through HTTP and HTTPs
at following urls:
Now we can download our project using svn under my home/Subversion
root@trupti-HP-630-Notebook-PC:~/subversion# svn co https://localhost/svn/myproject
Checked out revision 0.
The first time it will prompt for accepting the SSL certificate, answer to accept it permanently (p).
Then it will optionally ask you for the password, type it.
Since its a new project that i am starting so there is no file in my repositories. The word Check out
revision 0 says how many time the code is committed.
Now i am creating a new file in my local working copy
root@trupti-HP-630-Notebook-PC:~/subversion/myproject#vi sample.php
Hi this is sample testing
Now i had saved the file
svn add filename” will add the files into SVN repository.
root@trupti-HP-630-Notebook-PC:~/subversionmyproject# svn add sample.php

13. Commit the added file to Repository
Until you commit, the added file will not be available in the repository.
root@trupti-HP-630-Notebook-PC:~/subversion/myproject# svn commit -m "new file added
sample.php" sample.php
Transmitting file data .
Committed revision 1.
Now we have added the file sample.php to our repository. Now we will delete our local copy and
freshly we can download the project from the repository and make whatever changes we want.

This is how we set up the SVN Repository and Work with it.

* Now we shall use svn on a public code repository .
* Create a demo project with a text file chat.txt
* Add content in the file example "trupti:hi"
* Tell your friend to run the command (top one) for checkout in source tab
* It will check out the project in his machine.
* Make some changes to that file example "ayesha:hows u?"
* Then do an svn commit
* When it asks for username, add the gmail id and for password go to profile->settings in the link.
Normal repo is just local to us.
Only difference to local thing and this is that our central repo is now on google code.

Vanakkam Chennai

                                         Its my passion to travel, meet people and know about their livelihood. Having a far adju...