(Bash) Copy with Find

Wanted to copy all my EPM .list files to a separate folder so I can do a bit of edit and test with it. Wanted to do it in a true geek mode and hence decided to make use of bash’s find command (Thanks to floyd_n_milan for introducing me to this wonderful command). Since it some time I really used `find`, I had to do a bit of Googling to find I needed. This might be a piece of piss for seasoned Bash’ers but for me it was a chance to revive my detoriating Bash knowledge and as it always happens, I love to post newbie stuffs.

$ find ./myproj/pkgs -name \*.list -exec cp {} epm-list/ \;

This command searches the myproj/pkgs directory (within current directory) and its sub-directories for files ending with .list. Upon each file found, it executes the `cp` command copying the file to the directory epm-list. The {} is replaced by the name of the file found (each time).

Please note the escaping ‘\’ before the ‘*’ in the regular expression and before the trailing ‘;’. If you miss the trailing semicolon or the escaping, bash will complain that the -exec has no options. We need not put `epm-list/{}`, it uses the file name automatically (if we use {} then it tries to put the file in epm-list/<path-where-the-file-is-actually-found> which ends in a path not found error).

Improved desktop

Off late, I was not satisfied with my desktop i.e. how it looked. One of the main things I like it to have is display fonts small but still crisp so i can comfortably read them. I like small icons, small window border, etc. This makes me have more stuffs on my small 14″ display. I was even thinking of trying other desktop managers/window managers.

Yesterday when me and Onkar shinde were discussing about something else, he told me about the availability of Intel drivers as the default one. He asked me to install the driver and try. So did I, installed ‘xserver-xorg-video-intel’ and restarted X. The main aim was to get a better resolution option and ability to reduce my resolution at times when projectors ask for a 800×600. When I logged in back, I was surprised to see everything a bit smaller than what they were. Suddenly my desktop seem to be more spacious and I just love it.

Even the font rendering has changed, now I see crisper fonts (am not sure, I feel so). But surely I have more space on my desktop to keep stuffs. I was also trying out gdesklets (on my KDesktop) and with the new drivers, everything seems to be perfuct for me.

If you have an Intel video card and using the ‘xserver-xorg-i810′ driver, then give up a try with intel driver. But remember to edit xorg.conf in the “Device” section as shown below,

Section "Device"
Identifier "Intel Corporation Mobile Integrated Graphics Controller"
Driver "intel"
BusID "PCI:0:2:0"
EndSection

K3b – How to ‘write’ CDs

K3b is as famous as Nero in the GNU/Linux world as a GUI for burning CDs. It works with both GNOME as well as in KDE (which is its native). I have been using it for more than 3 years now. Its another wonderful piece of software that makes life easier. But, since I got it on my Laptop I had not used it really to ‘burn’ CDs/DVDs because it failed to write.

Whenever I select an image/file to burn into a disk, and click the ‘burn’ button, it does something for sometime and then pops up a message saying I do not have enough permissions over cdrecord to write into the disk. So, cdrecord command had become my favourite.

A couple of days ago, I got determined to end this issue as I have to show them at the up coming GNU/Linux demo at a Coimbatore college. So, I sought the help of my buddies in KDE-In. Thankfuly floyd_n_milan came to my rescue. It was actually a problem of proper permission for the device to be writable. If you are facing the same problem this is what you have to do…

1. On the top menu, Settings –> k3b Setup. It opens up a window, where permissions on various devices are listed. Look for the device named cdrecord and its permissions. It should be ’4710 root.burning’. If its not having ‘burning’ in it, then the burning group does not exists.

2. Now to add the burning group, open up a terminal and enter the following commands


$ groupadd burning
$ gpasswd -a username burning

3. Now we have a burning group. Check the top of the k3b setup window, where there will be a checkbox labelled ‘Use burning group’ and with a value ‘burning’. Check that one and press apply.

Thus, we have enabled a burning group and made it active. Now, try to burn a CD/DVD. Hurray! We would be able to :)

Qt4 from source

I had installed Qt4, Qt3-designer and Qt3-assistant from Ubuntu repos. I had been using Qt3-assistant examples and writing them in PyQt4, whole the document I was referring actually corresponds to Qt3.

Pradeepto was looking at my earlier blog post which had a PyQt4 code and pointed to me that I was rather working with PyQt3/Qt3. He was the one who suggested to make a source install of Qt4, as everything comes with it in one go. So here are the steps..

1. Download the source tar ball from the Qt’s home page which is Trolltech’s Qt Download site.

2. Untar the tar ball where ever you like to have it.

3. Like a typical source installation, with your current working directory pointing to the directory where you extracted the tar ball, run the following after one another in a terminal/console.


$ ./configure # check ./configure --help to know more options like -debug
$ make -j 4 # this may freeze your computer, do it if you have a powerful horse!

4. The ‘make’ command will build Qt4 from source. Generally, we run ‘make install’ also, which will install the built files in appropriate fixed locations. But, this is not mandatory, we can still run Qt4 from where we built it with a few additional things.

5. First, we need to add the files in /bin of Qt4 into the path; likewise the librariries and docs as well. We can sym link the files to existing path such as ‘/usr/bin’. Or else, we can set a few environment variables and proceed with out work. This can be done with a simple shell script, which needs to be executed before we start working with Qt4 everytime.


export QTDIR=/home/joe/qt-4.2.2
export PATH=$PATH:$QTDIR/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QTDIR/lib
export PKG_CONFIG_PATH=$QTDIR/lib:$PKG_CONFIG_PATH

6. When I openned up qt4-assistant, it showed me an error pop up stating that files were not found at a specific location. So, I had to copy these files to that specific location. I tried sym link but unfortunately it did not work, so I copied them rather.

Destination: /usr/share/qt4/doc/html/    Source: $QTDIR/doc/html/
assistant.dcf
designer.dcf
linguist.dcf
qmake.dcf
qt.dcf

The above files can either be sym linked (if it works for you) or copied by creating the destination directory. Now, open up the qt4-assistant and you should be able to see the contents.

7. I have a problem, rather a bug, which I suspect to be specific to Ubuntu Edgy. When I export the above paths and open up qt4-assistant or qt4-designer, as well sym link both to ‘/usr/bin’ or anywhere, the fonts on the window is not rendered properly. But, when I execute them from the place where I built them, which happens to be under ‘home’ directory, they get rendered properly. This is quite odd and till now I haven’t got a reason and solution to this.

This is just an account of my experience of installing Qt4 from source. But it was rather a very good experience. Installing from source is always fun, except when you get caught in a maze of dependencies :D

Switching between Ubuntu/Kubuntu/Xubuntu uspalsh

When I installed Kubuntu desktop to try KDE in my laptop, it replaced my earlier Ubuntu usplash such that when I booted up it showed a kubuntu splash screen. I have been wondering how to change this back for almost a month now, having tried a few tricks which did not work.

Today, when trying to get something for ‘tuxplorer’s query, I got to see this ubuntu forum post which actually helped me in getting back my ubuntu usplash screen. Here is what you gotta do..

techno_freak@edgy:~$ sudo update-alternatives --config usplash-artwork.so
Password:

There are 2 alternatives which provide `usplash-artwork.so'.

Selection    Alternative
-----------------------------------------------
1    /usr/lib/usplash/usplash-theme-ubuntu.so
*+        2    /usr/lib/usplash/usplash-theme-kubuntu.so

Press enter to keep the default[*], or type selection number: 1
Using `/usr/lib/usplash/usplash-theme-ubuntu.so' to provide `usplash-artwork.so'.
techno_freak@edgy:~$ sudo dpkg-reconfigure usplash
update-initramfs: Generating /boot/initrd.img-2.6.17-10-386

Gallery – Web/Online Photo Album Service

Sometimes we surprisingly get to know some nice software. The world is becoming more and more web oriented than desktop oriented. The things which are done is desktop has become online services like bookmarks, address books, why even presentation and word processing softwares are available as web tools. One such tool is online albums. When I say this, the first thing to come to your mind are either flickt or yahoo/google albums.

But what about one album which you can host in your own web site, if you have one ? It was during the discussion about FOSS softwares being developed by Indians, in the mailing list, it got mentioned about Gallery. I immediately checked out the web site of gallery project. it seemed woth a try. I checked whether I have it in my ubuntu repos and surprisingly it did. There are two versions gallery1 and gallery2, I went for the latter.

The advantage of using apt is that, we neither need to worry about dependencies as well as configurations. 90% things are taken care by it mostly, and rarely it needs some tweaking. I went for an apt-get install of gallery2 package, which also installed libnetpbm10, netpbm and wwwconfig-common packages along with it.

The package got installed in /usr/share/gallery2, while I had to actually access it as a web service. So, I wanted it to be in /var/www/ rather, which is supposed to be my DocumentRoot. I asked this in #gallery-support but did not get a contempting answer. At last, my buddies in #linux-india came to help and suggested to have symbolic link of it in DocumentRoot. This actually worked out and when I accessed `http://localhost/gallery2`, the installation and setup screen opened up in my browser window.

Ok, then walk through the 7 step process and you get your online album service before you. You need Apache2 and either MySQL or PostgreSQL installed.Obviously it works on other webservers and OS as well.

The Gallery main page shows you all available galleries/albums. You can create as many albums and sub-albums as you want. You can modify settings and appearance of the albums and sub-albums individually. If you are on a network, then you can make this service available to other also. I tried it out in my personal laptop and just running it in ‘admin’ mode. In real use, we need to create user accounts for individual users. These is also provisions for large scale user management, which is available as optional modules during installation. If you are doing an installation in stand-alone machine, better install only modules pertaining to your needs and not all those which is available.

There are two things which may trouble you during installation.

  1. You need to copy a text file login.txt, which contains a key generated by the gallery app itself, and copy it to your installation directory (/usr/share/gallery2).
  2. You need to change the value of maximum memory limit in your php.ini file, which is in /etc/php5/apache2 directory. In addition or alternate to this, is to create a .htaccess file in your /usr/share/gallery2 containing the following line,

php_value memory_limit 20M

This is by default set to 8M, which is not sufficient. The suggested value is 16M or above and I have given 20M.

Also, when you create an user account, the confirmation mail will be sent and for it we need a mail service such as sendmail installed, configured and working. Else, it results in an error and the user account is not created.

Here are a few screenshots of the Gallery…

The main album page

Main Page of Gallery2 Album

Individual albums inside view

Sub-albums view

View of a single photo, where the properties of the photo are shown below the photo.

Individual Photo view

e17 on Ubuntu – A brief enlightenment

e17 is the DR17 version of the Enlightenment window manager. Enlightenment is one of the other well known window managers in Unix/Linux world and its advantage is light weight and simplicity. e16 was simpler, yet it did not satisfy the eye candy that the users migrating to Linux demanded. But, e17 has solved this much by bringing in some elite eye candy which doesn’t ask you for much RAM.

I had used e16, though GNOME has been my favourite. But, I wasn’t confortable with e16 much. When I came across an article in LFY about e17, I wanted to have a look. The enlightenment which is available in ubuntu repository is e16 (am afraid so!). And, it messed up along with my GNOME/metacity that when I booted back in metacity, it was showing elements of enlightenment along with it. I had a bad day clearing all the mess it did.

But yesterday, Sudharsh told me about e17 and showed me a script which will download the required files from the CVS repos and compile-install it on my machine. I tried it in my workbox at office, but it demanded some dependencies which weren’t met. But, I thought of checking it out in my Laptop at home.

I tried it today. We need to just get this script in your local machine, give it executable permission and run it in a terminal. The script will run in 2 phases, phase 1 takes care of downloading all the files and phase 2 compiles the downloaded files and installs them in the local system.

$ sudo apt-get install build-essential cvs libtool libltdl3-dev automake1.9 autotools-dev libpopt-dev libcurl3-dev libx11-dev x11proto-xext-dev libbz2-dev libid3tag0-dev libpng12-dev libtiff4-dev libungif4-dev libjpeg62-dev libssl-dev libfreetype6-dev bison flex xlibs-dev gettext libimlib2-dev libxml2-dev libxcursor-dev libgtk1.2-dev autoconf pkg-config libpng3-dev libxine-dev libxkbfile-dev libsqlite3-dev giblib-dev libxmu-dev libxdamage-dev libxcomposite-dev libtag1-dev libtagc0-dev giblib-dev libasound2-dev

A small note on this, rather a warning: you need an additional library which is missed in the list of dependencies to be installed prior to running the script. The missing thing is libxslt and do an apt-get install for these 2 packages – libxslt1.1 and libxslt1-dev

$ sudo apt-get install libxslt1.1 libxslt1-dev

To run the script

$./easy_e17.sh –skip=etk_server -i

The `–skip` option skips the download and installation of ‘etk_server’ which I was adviced to.

If you want any additional help then,

$./easy_e17.sh –help

If you encounter any problem, especially dependency, then install the corresponding package. If it happens during compilation stage, later you can run the script skipping the download part using this command,

$./easy_e17.sh –skip-cvsupdate -i

After it has compiled and installed, there is one step you need to do before you can login into e17. Do the following

$sudo vi /usr/share/xsessions/e17.desktop

Add the following lines into the file and save

[Desktop Entry]
Encoding=UTF-8
Name=E-17
Comment=
Exec=/opt/e17/bin/enlightenment_start
Icon=
Type=Application

If you refer to the actual ubuntu forum page, then you will notice it is ‘enlightenment’ instead of ‘enlightenment_start’. But, when you boot it using that option then when you login it will ask you to change the option as I have given.

The last thing to do is that add the path ‘/opt/e17/bin/’ to your $PATH. This is because e17 got installed in ‘/opt/e17/bin’ and hence we need to put in on the PATH environment variable to be found.

$ export PATH=$PATH:/opt/e17/bin/

Now, logout of the current desktop. While loging in back, remember to change the session to e17. I will advice you to select ‘Use for this session only’ option, so you can first experience, hang around and change if you do like. Otherwise, you have the existing desktop/window manager as the defaulft.

Will add more about my e17 experience later. Enjoy the enlightening experience.

Faster Browsing !?

We all do browse and wish we can browse faster. Am not meaning the ability of the individual to browse faster, neither the ability of the browser like FireFox, but some thing else which looks techy but really determines the speed of browsing. It is called resolving domain names or Domain Name Servers (DNS).

If you have ever tried to configured your network, even your Internet connection at home, you would have encountered something called as DNS. DNS can be simply said as a service which resolves domain names into the corresponding TCP/IP address. For example, when we type http://www.google.com in the address bar of our browser and press enter/go, something happens in the background which we haven’t worried much till now. The domain name which you typed (google.com) gets translated into the corresponding IP address which will specify the server where google.com is hosted or where the actually request for the page `google.com` should be sent. This is done with the help of DNS servers which help our computer to resolve the domain name to its IP address.

But where are these servers and how will I know them ? Do not worry, your system can obtain them automatically from your Internet Service Provider (ISP). Or else, there are enough number of DNS around the web, which are globally accessible and available for public.

Ok, lets come to the point.. making the browser resolve the domain names faster. Is it with the browser, your computer hardware, operating system, your ISP or the DNS itself ? Hmmm.. its within our reach, perhaps within the reach of our operating system.

How ? There are some software tools which can help you with this. One such tool, which is available for all famous distributions of Linux, all flavors of BSD, Mac, is dsnmasq.

The official site of dnsmasq defines it to be a light weight, easy to configure DNS forwarder and DHCP server. Let us now mind about the DHCP part now. The dnsmasq can pick up the addresses of the local machines which are not in the global domain as well. Hence, it is more suitable for small home networks where using BIND is an overkill.

How does dnsmasq help us ? What dnsmasq does is that, it caches the nameserver lookups and make use of this cache for future looks ups. Its nothing but similar to taking a history of the dns lookups and referring this history for future. Thus, when we lookup for a domain name resolution, then the cache is searched first. If there is an entry there, then the domain name gets resolved within our local system itself. Else, the DNS servers are contacted and an entry is added to the cache for the resolved domain name.

How to get dnsmasq ?

  1. From the official archive of dsnmasq at thekelleys.org
  2. From the repository of your distribution, using apt-get (if present)
  3. Using package managers like Synaptic, if dnsmasq is supported by your distribution.

Installation and Configuration

First, get dnsmasq installed using apt-get,

$ sudo apt-get install dnsmasq

Once dnsmasq got installed, we need to fiddle with some configurations before everything works fine.

Edit the file /etc/dnsmasq.conf, uncommenting the line that reads

listen-address=127.0.0.1

The next thing to edit is /etc/dhcp3/dhclient.conf, to ensure that the following lines are present.

prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;

This line just makes sure, the first place the domain name is looked up is 127.0.0.1 which is nothing but your own computer, a place where your dnsmasq is running to serve you. Thus, the dnsmasq cache is first searched for domain name resolution and then proceeded to the other DNS servers listed in /etc/resolv.conf.

There are couple of steps left, first is to edit /etc/resolv.conf once and add the following line,

nameserver 127.0.0.1

Next, the final step, is to restart your dnsmasq service for the changes we made till now to take effect. To do this, type the following in the terminal,

$ sudo /etc/init.d/dnsmasq restart

Testing ?! Yes, indeed we have to test to make sure its really working out. Hmm.. being connected to the Internet, fire up your terminal and execute the following…

$ dig yahoo.com

The output will be as follows…

; <<>> DiG 9.3.2 <<>> yahoo.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32837
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 5

;; QUESTION SECTION:
;yahoo.com. IN A

;; ANSWER SECTION:
yahoo.com. 68 IN A 216.109.112.135
yahoo.com. 68 IN A 66.94.234.13

;; AUTHORITY SECTION:
yahoo.com. 172691 IN NS ns2.yahoo.com.
yahoo.com. 172691 IN NS ns3.yahoo.com.
yahoo.com. 172691 IN NS ns4.yahoo.com.
yahoo.com. 172691 IN NS ns5.yahoo.com.
yahoo.com. 172691 IN NS ns1.yahoo.com.

;; ADDITIONAL SECTION:
ns1.yahoo.com. 172268 IN A 66.218.71.63
ns2.yahoo.com. 172268 IN A 68.142.255.16
ns3.yahoo.com. 172270 IN A 217.12.4.104
ns4.yahoo.com. 172270 IN A 68.142.196.63
ns5.yahoo.com. 172268 IN A 216.109.116.17>

;; Query time: 325 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Nov 10 21:10:08 2006
;; MSG SIZE rcvd: 229

It took 325 msec. But, we expected it to be fast, isn’t it ? Wait! This is the first time we are resolving the domain name. Lets see what it happens when we try it again. Execute the same command again and check, it will result as below..

; <<>> DiG 9.3.2 <<>> yahoo.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7500
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;yahoo.com. IN A

>;; ANSWER SECTION:
yahoo.com. 66 IN A 66.94.234.13
yahoo.com. 66 IN A 216.109.112.135

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Nov 10 21:10:10 2006
;; MSG SIZE rcvd: 59

See, the query time is 0 msec. This is really fast isn’t it (unless you expected some negative numbers there :p). Good work, dnsmasq!

So, the post ends here ? Naah! I have a little more to say. I had the problem that everytime I connected, the resolv.conf got replaced with the DNS nameservers sent by the ISP. The reason is I have configured pppoe to obtain the nameservers from the peer during connecting up. Also, i wasn’t having resolvconf. So, if you are in a similar situation that you have to manually add “127.0.0.1″ every time you get connected, then better do the following.

$ sudo apt-get install resolvconf

Edit the file /etc/resolvconf/resolv.conf.d/head and add this line to it,

nameserver 127.0.0.1

In addition to this, you can edit the file /etc/ppp/peers/dsl-provider and comment the following line.

usepeerdns

Now, disconnect your Internet connection and connect again. Check out the resolve.conf file whether you have the entry for “127.0.0.1″ at the top of the list. If you have, then you have done everything fine. If not, then you have messed up somewhere. You can also check this blog, which is the one I used up to set dnsmasq :)

Happy Browsing! Faster Browsing! :)

Long Live CLI !! (CD Burning with CLI)

Whenever I tell non-FOSS people about Linux, the first question they ask me is “Does Linux have a GUI?” or a slight variant, “Isn’t Linux all command line?” Mostly, I don’t asnwer in words. I rather show them my laptop and ask them try moving around. The next thing they mostly ask me is, “How to install this on my computer?” :)

But, right from my own Linux guru, many have emphasised exposure and proficiency in CLI (Command Line Interface). Right from the day I started learning to work around in Linux, I always felt it nice to use the terminal to do some basic things. But, I haven’t really used some utility in CLI other than working in Vi in the terminal.

Today, I had a guy from HCL who had been asking for a copy of Dapper Drake and I had asked him to get it burnt from me. He came today in the after noon. The first mistake I did was that I forgot to copy an iso image of the Ubuntu CD to my system. I was in a hurry as I can’t make him wait for too long.

I fired up K3b, from the terminal, and copied an iso image to my home directory. It took some 15 mins to create the iso image of a 698 MB disk. Then, with all enthusiasm, I inserted the empty CD the guy gave me and tried to burn the iso image into the CD. What I got was that an error message that i do not have write permissions over the CD R/W drive. It asked me to check some k3b setup where I had no clue to give the drive a write permission for k3b to work.

I ran to #linux-india and codemarauder (IRC Nick) was there to help me :) He told me how to burn the iso images using the “cdrecord” command. I fired up a terminal and started issuing commands..

technofreak@dapper:~$ sudo cdrecord dev=/media/cdrom0 speed=4 -v Downloads/k3b_0.iso

It resulted in an error saying “/media/cdrom0″ was a dir. Then, on his advice i did,

technofreak@dapper:~$ sudo cdrecord -scanbus

This showed my CD RW drive to be dev 1,0,0. Then, I modified the cdrecord command and fired it once again,

technofreak@dapper:~$ sudo cdrecord dev=1,0,0 speed=4 -v Downloads/k3b_0.iso

This time, it was all fine and it asked me whether i can proceed with the write action. I agreed and it started. As I was burning a 698 MB image at 4X speed, it took some 15 minutes. I felt that I should have atleast given a 8X speed. Atlast, after 50 mintues of activity I got one hot copy of Ubuntu Dapper Drake on my hand and it brought smiles in the guys face. Won’t it be, he showed patience for around an hour to get it in his hands. Community, lets welcome another Ubuntero on board !! ;-)

Remember, CLI can really help you out at times. So, never neglect learning to work with command line. “Know both the ways (GUI and CLI), let situation decide which will serve the purpose better” is the moral of this experience! B-)

SVN, the first steps – A Mini HowTo for n00bs!

I had to deal with teaching a few Linux n00bs on how to start with SVN. Though my last post deals with using the SVN basically, it missed one big point which I perhaps myself learnt today – How to create a reposiroty and start with a working copy. I agree, I had difficulty over creating a repository though I very well know how to work on a working copy. This day, I had more things to learn and especially to find a list of things to be learned. Thus, I wrote a simple step-by-step howto for those who haven’t tried their hands on SVN before. As usual, I blog them too therefore someday when I myself couldn’t figure out how to do things, I can look at my own blog (Which I did today while dealing with MySQL).

Here goes my mini how-to for noobs on SVN….

Procedure to Create a Repository using SVN and basic operations with Subversion:

Step1. Create a repositry named mysvn in your home directory (assuming your shell’s current directory is your home, which is by default),

noob@dapper:~$ svnadmin create mysvn

Step1(b). Check whether your repository is created in the intended location,

noob@dapper:~$ ls
Apps Django-0.95 GNUstep Collections Documents Linux Music confman Downloads LUG mysvn WorkSpace
Desktop

Step2. Create a directory called code in your home, crate 3 sub-directories under it namely branches, logs and trunk. If you have some files to be placed, place it in the ‘trunk’ sub-directory.

noob@dapper:~$ mkdir ./code
noob@dapper:~$ mkdir ./code/branches
noob@dapper:~$ mkdir ./code/logs
noob@dapper:~$ mkdir ./code/trunk
noob@dapper:~$ ls ./code/
branches logs trunk

Step3. Now, import your newly created directory, named code to the repository using the SVN’s import command as follows,

noob@dapper:~$ svn import ./code file:///home/noob/mysvn/code -m ‘Initial Import’
Adding code/trunk
Adding code/trunk/testfile.txt
Adding code/logs
Adding code/branches

Committed revision 1.

Step3(b) This will add an invisible directory named code in the repos, though you cannot see them by getting into mysvn repos direcotry manually from FileManager or so. Don’t worry.

Step4. Checkout the newly created project in the repos, namely code, thereby cretaing a working copy in local filesystem. (may be in the same name or a slightly different name like mycode)

noob@dapper:~$ svn co file:///home/noob/mysvn/code code
A code/trunk
A code/trunk/testfile.txt
A code/logs
A code/branches
Checked out revision 1.

Step5. Now, change the content of any file in the local working copy under trunk and save the file. Now a file in your working copy is changed and lets have some fun with svn :)

Step6. Lets check the difference between the file in the repository and the local working copy, as we have made a change. The changes will the printed on the terminal, where a + denotes addition and – dentoes deletion or change.

noob@dapper:~$ cd code/
noob@dapper:~/code$ svn diff
Index: trunk/testfile.txt
===================================================================
— trunk/testfile.txt (revision 1)
+++ trunk/testfile.txt (working copy)
@@ -1,3 +1,6 @@
-This is a test text file. This file is intended to be moved to local
+8.20 PM: This is a test text file. This file is intended to be moved to local
repository (not working copy) named ‘mysvn’ under the project
‘code’. Hope everything works fine :)
+
+8.25 PM: Repository creation successful. Added files to repos and created a
+local working copy of the same name.

Step7. The change is found. Now as we have a modified working copy, we need to commit the changes so it gets updated int he repository as well.

noob@dapper:~/code$ svn commit -m ‘changed text contents’
Sending trunk/testfile.txt
Transmitting file data .
Committed revision 2.

Step8. Update your working copy so that you get the laest revision in your working directory.
noob@dapper:~/code$ svn update
At revision 2.

Note:
#1. This procedure is for creating a repository in your local machine, as well as the working copy in the same machine. This is a simple example of how to do the basic things. Read the SVN documentation available in the SVN’s official web site.

#2. Did you see, when we added the files from code folder using an import command, the revision changed to ‘revision 1′ from the initial ‘revision 0′ (sorry, how did i miss the output which showed revision 0 ?? :( ). And check again, when we did a ‘commit’ at step7, the revision again got updated to ‘revision 2′. Wow! It’s cool, isn’t it ?! :D

*********************Licence*******************************************
This work was created by Parthan.S.R. on 13th August, 2006. Parthan can be contacted at parth.technofreak@gmail.com
This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit
tp://creativecommons.org/licenses/by/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Subversion – A Scoop of it!

Subversion, famously known as SVN in the open source world, is a vesrion control and management system. It forms a vital part of software development, where the code development is a continuous process and hence results in frequent change of small part of the code. Thus, it is veri important to keep track of the change so that the various modules and components of the project are in sync with one another.

SVN serves three main purposes:

  1. Tracks the changes done by individual contributors of the project and produces a new version with each release.
  2. Helps in collaborative development of the project, where many developers can work over a stable main code.
  3. The modifications done by one developer can be easily tracked by others and hence they can modify their work to keep themselves in sync with the main trunk of the project.
  4. It allows branching of a main project, where the branches run parallely with the main project but still keeps in sync with those components which it has got from the main trunk.

How does SVN do this ?

SVN consist of a main repository in a central server location which can be accessed from the individual clients who are contributors to the project. Each individual developer has a working copy of the project code, which he has got from the main repos and ensures it is updated with the changes made to the repos code. His local working copy is where he makes his own changes as well as where he adds his own new codes. Before he starts his work, it is his responsibility to update his working copy so that it is in sync with the main project code. Once he has the updated working copy, he starts his work. When he has finished his work, he adds these to the repository. At this point, SVN checks with the existing version of the project. If both are same, i.e. the developer hasn’t made any changes with respect to the repository, then he is intimated that there is nothing to be updated. If he has modified or added some files, then his files are marked for addition to the repository trunk. When he ‘commits’ his changes, the files are added/modified as per his working copy, creating a new version of the project code. The SVN creates a new version in the repository, which is one more than the previous version. The term version is known as ‘Revision’ in SVN. Thus when another developer checks the his working copy with the repos, SVN finds out that the code has changes and ask him to update his local copy so that it is aware of the changes made. Then the second person updates his working copy and continues with his work.

A peculiar case that can occur at odd times is, two persons making change in the current version at the same time. That is, they start with the same version/revision, make their own changed and commit. Whoever has comited first, updates the repos and hence a new version/revision is made. When the latter commit is obtained, the second persons working code is obscure and hence the SVN warns him that some one has made changes since he updated his code last time. Then he checks with the current code, what are the changed made. If the changes made don’t affect his code, he goes on with a new version. Else, he has to get the new copy and make changes in it to incorporate his work. He can also accept a part of the changes made, if he finds them to be correct.

To make things clear here is a small example. Consider that a repos named sandbox to be created and a local working copy is named as sbox. The repos is accessed by https at example.com. Here is a simple step-by-step to create and manage with SVN:

1. Create a local copy of svn for the corresponding repos

$svn co https://svn.example.com/public/sandbox sbox

2. Having a local working copy been created as above, we check the status of the svn as follows,

$svn status

3. Now, after creating our new file ‘ReadMe’, we add it to the repos.

$svn add ReadMe

4. Commit the changes made to the local copy, so that it is updated in the main trunk

$svn commit -m ‘First change’

5. Check the svn log for more info,

$svn log ReadMe

6. To check whether there is any difference between working copy and local copy, use dif command with svn,

$svn diff

This will give those codes in the working copy that differs with the current active revision in the repos.

7. When a conflict occurs with the current version and the local copy, to make the svn accept the corrected loca copy, issue resolve command as follows,

$svn resolved ReadMe

8. To delete a file in the current version, isse a remove command..

$svn remove ReadMe

These are the basic commands for common svn operation. Manual/Tutorial for svn, called as the Subversion Book, is available at http://svnbook.red-bean.com/nightly/en/svn-book.html.

Enjoy svn, enjoy collaborative development! :)

The Birth of ‘foss4mylang’ – Tamil Localization

When 10 people unite, the work done by a single person for a week finishes in a day! This became true when 14 people united to translate around 400 strings of software terms for ‘Django’ , a well known web interface, into equivalent thamizh strings.

This endeavor also led to the formation of a group or perhaps the birth of a community who will strive to translate every other Open Source Software in thamizh, that one day every OSS will be available in thamizh itself. This was also a show which proved that Open Source community has all the enthusiasm and determination to do things which are otherwise put in shelves for years.

The members of this group come from different domains and even geographical locations, and necessarily need not be software professionals. But all have the passion to involve themselves in the community efforts to make this world, at-least this ‘part’ of the world, OSS aware. We mainly had people from our own NRC-FOSS and CDAC, as well as many active volunteers from ilugc. We formed a google group, christened it as ‘foss4mylang’, perhaps in a democratic way of collecting names and voting for each name. Finally ‘foss4mylang’ was what everyone wanted our group to be called.

The day started with a brief introduction to Tamil Translation Endeavours that have been taken up in the past as well as the success stories of the same. We were lucky enough to have Vel Murugan who had been into one such effort and later joined by Shivakumar who had been indeed one of the initiators f such effort. We had a long session of setting up ‘scim’ and ‘kbable’ in our Linux machines – Fedoras’ mostly with my Ubuntu and one Debian being an exception. I had some initial hitches in making scim actually work, though i had almost everything right.

The gimmick to make tamil translation is…

1. Turn on your tamil/indic language support in your linux boxes,

2. Download ‘scim’ and all its additional modules for your language. Yum and apt may help you with this.

3. Make sure you have these modules for your scim:

scim-gtk2-immodule, scim-modules-socket, scim-modules-table, scim-tables-additional, scim-m17n and finally scim-uim.

These modules are very much important for you to get Indian languages running under scim.

4. Go to the ‘SCIM Setup’ and select the languages you wish to turn on and the keys for turning them on, off and to toggling between them.

5. Download and install kbable, which is the translation software. If you have a database of translated words as ‘po’ files, then upload them in kbable so that you wont be translating same words again and again, espeicially in your own way.

6. There is a small gimmick which you have additionally play to make thing work in the end. Make a symbolic link for the xinput.d folder to your home directory. This will give you the option to configure your own personal input settings, though you need not alter this file at this stage.

ln -s /etc/X11/xinit/xinput.d/scim ~/.xinput.d/en_US

Now, load the to-be-translated files in KBable and start translating. the words which you are not sure of proper tamil translation can be marked as fuzzy. And if you find some fuzzy and know how to spell it right, translate and remove the fuzzy mark.

I very well understand that my above description is too simple for the task, its only by practice we learn things. We learnt it yesterday and that’s why am writing this blog today. If you have any difficulty when trying your own hands at translation, then you are free to refer foss4mylang@googlegroups.com. You can also add this to your groups by joining the group and thereby join the team of tamil-loving translators.

Note: The group is named ‘foss4mylang’ rather than ‘foss4tamil’ because we are not restricted to ‘thamizh’ alone. As the people who were there yesterday were thamizh speaking souls, we did a tamil translation. We also help and support all other Indian languages, and we indeed welcome people from other languages to join our team and do translations in their own mother-tongue. :)

வாழ்க தமிழ் ! வளர்க தமிழர் பெருமை !

Changing to KDE from Other Window Managers

I have been writing in this blog whenever I had a new learning experience in my tux box. This shows that I have a new one this time. Yes, indeed but rather a very simple one – Windows Manager.

If you aren’t aware or probably forgot in due course of time that GNOME and KDE are one amongst the numerous window managers available to be operated under X windows system, I bring it to your kind notice. When I first installed FC4 on my system, I decided to have the default GNOME over the X. For months, I have been working over it that I got bored and yesterday I decided to try KDE for sometime. Although I have previously logged into KDE and made up some personal preferences for desktop, its been months since I did it. So, after a long time I logged into KDE. To my surprise, as it should have done, it didn’t ask me whether I would like to choose KDE as my default window manager or just use it up for the current session. This was my first suspicion. So, I went in, tweaked up the desktop to my current flavours and requirements. Then, I decided to check whether its getting into KDE or GNOME from next login. So, I restarted my system and the login screen was up.

When i entered my login name and password, it went straight to the GNOME welcome screen rather than KDE, which I was very much eager to see. Once into GNOME, I started finding out how to make KDE the default WM. After a hour of Google and trying out things, still I remained in vain. The X was booting only GNOME by default and not the KDE. As it was late into the night already, I decided to ask some LUGies the next day and shut my system down.

Day 2

I was happy to find my buddy Prashant online. I told him my experience and he too started to Google. Though he came up with the web page for a different solution, it did open up a new door to me. And, at the end of it I finally made KDE to be the default WM. This is how it should b done…

Check the file: /etc/sysconfig/dektop

There will be, most probably, only a single line there

DESKTOP=”GNOME”

now change this line to something like this

DESKTOP=”KDE”
DISPLAYMANAGER=”KDE”

Remember, this file can only be altered as *root*.

Now, either restart X with ” CTRL+ALT+BACKSPACE ” or Reboot the system.

When you login now, you will directly get into KDE.

Hope, this finds useful to someone at least some day. If it did, then please comment my blog so I will come to know that someone indeed got use of my blog. :)

The Journey of the ChennaiTuxian Continues…

First time with MySQL !

Everybody will have a day when they decide to try something which they knew for a long time. That day is very unique, they will try their best, seek help from many, refer to many things and finally it ends up in merry when they succeed in running it. I have been learning SQL for the past 50 days but I could not have a hands on experience till today. I decided to somehow run SQL today, and the reason I am on FC4 made me to go in for MySQL. My Window’ian friends have always been complaining that I am becoming more into Open source softwares / Linux there days, and to add fire into that burning fuel I wanted to successfully run MySQL :D I began the endeavor by first installing MySQL server using the Add/Remove programs option. After successfully installing MySQL, I searched the Main Menu for a MySQL option. Not finding them there ( I know where to go now ;) ) I opened up the terminal and typed ‘mysql’. To make me smile, MySQL started up and showed me ‘ mysql> ‘ prompt. As I assumed to have successfully got into MySQL, i tried my first command straight away !

mysql > CREATE TABLE PDATA (NAME CHAR(10), PHONENUM CHAR(10));

Like hitting me in the head, it said ” Error: No database found”. I resolved to use the help to find something

mysql> help

The help gave me many commands but there wasn’t one how to create a database. Luckily I had my LinuxGuru on line, so IM’d him to find what to do. He said I have to create a database using,

$ mysqladmin create data_base

It created the corresponding database “data_base” and gave me the result ” Query OK, 0 rows selected (0.01 sec) “. I again assumed the process has ended and I can go on with creating tables, issuing the CREATE TABLE statement. To my surprise again got an error message but this time as ” Permission denied to access database as @localhost”.

This time he suggested me to refer the MySQL site for help. Then I created the required permission for me to login as parth@localhost and access the MySQL server. Then I again tried to login as user, but still wasn’t able to as it needed a slightly different command. Finally, after again referring to the MySQL Site I was able to finally start MySQL as user and create tables and insert data into it.

The entire procedure for a first-time-run of MySQL is as follows,

1. Loging in as ‘root’ or obtaining root permission with ‘su’, issue the following command at shell,

[root@localhost]$ mysql –user=root mysql

mysql > GRANT ALL PRIVILEGES ON *.* TO ‘user_name’@'localhost’
IDENTIFIED BY ‘passwd’ WITH GRANT OPTION;

This assigns ‘all’ privileges to the user ‘user_name@localhost’ who can be identified and can access mysql using the password ‘passwd’.

2. We have to create a database for the user to use, by issuing the following command as root ( or su ),

[root@localhost]$ mysqladmin create user_database

which will give the reply as ” Query OK, 0 rows affected (0,01 sec) ” on successful creation of the database.

3. Login as user by issuing the following command in the shell,

[user_name@localhost]$ mysql –user=user_name –password=passwd

The welcome text will indicate your successful login: “Welcome to MySQL Monitor.” and you will get the ‘mysql’ prompt.

4. Now, we have to change the database into ours by issuing the following command,

mysql > USE user_dbase

which will be confirmed with “Database changed”.

5. Now, you can issue the MySQL statements at the ‘mysql’ prompt and your ‘user-dbase’ will be the used database.

To Create Table : mysql > CREATE TABLE PDATA (NAME CHAR(10), PHONENUM CHAR(10));To add data into the table : mysql > INSERT INTO PDATA (NAME , PHONENUM) VALUES ( Name , 9880098800 );

To view the table : mysql > SELECT * FROM PDATA;

Does your Fireofox Say “Java Plugin Not Found” ??

Last night I was trying to install the Java Plug-in for my Firefox. One of my buddies suggested me a website having cool Applets on Maths Physics and Engineering Phenomenans , which made me to try my best to enable the plug-in and have a look at them. When i opened this web page, it said “Java Plug-in Not Found” and gave me an option to install it. I used the link which started the FireFox Plug-in installer, which tried installing the plug-in and ended up saying ” Not able to install the plug-in” and further gave me an option to try installing JRE (Java Runtime Environment) it manually.As I was determined to see the applets the night, I decided to install the JRE manually. It took me to the Sun Java download page, where there were options to select th package I would like to download. There I found the package for my FedoraCore 4, eventually an RPM package, but in a hurry I downloaded ‘binary’ package instead of the ‘RPM’. But as I have previous successful experiences in installing with a Binary source code, I was determined to face the challenge :D . I installed the package and sought the installation help in the same Sun Java site. I sincerely followed the steps it said, first as an User with Root permit, then logged in as the ‘root’ itself to prevent confusion. The package got successfully installed at the determined location such that all users would be able to use it ( /usr/Java/jre/ ).

Now, as I have downloaded and installed the JRE successfully, I then started the FireFox and went to the site, eager to view the applets. But, still luck hasn’t been with me. Though the JRE got installed there were no corresponding plug-ins in ‘ /etc/firefox/plugins/ ‘ directory. On my LUGC buddy Prashant’s advice finally made a Google for ‘Java Plugin Install for Firefox’ and ended up here. Let me make a brief procedure to install the plug-in, if after installing JRE, still suffer from “No Plug-in Found” problem.

  • Assuming that you installed ur JRE in ‘ /usr/Java/jre….. ‘ as I did, then ur plugin canbe found at : ' /usr/java/j2re1.4.2_01/plugin/i386/ns610-gcc32/libjavaplugin_oji.so ‘ .
  • Open the terminal and gain root access with su.
  • Go to the firefox plugins directory which will be most probably ‘ /etc/firefox1.0/7/plugins/ ‘ using :

    # cd /etc/firefox1.0.7/plugins

  • Issue the following command at the shell prompt :

    # ln -s /usr/java/j2re1.4.2_01/plugin/i386/ns610-gcc32 /libjavaplugin_oji.so

  • Now check the firefox plugins directory for the plugin, which would have a symbolic link of the actual plugin you have it your JRE plugins directory, using :

    # ls -a /etc/firefox1.0.7/plugins

  • If you find the plugin there, Kudos! You have installed the plugin. Now turn on your Firefox and check the site I told you. As I was able to, when you click on any of the applets a separate window wall pop up and display you the applets :)

If you have any difficulties then make a Google, or ask some mailing-list, and if the problem still persists then feel free to contact the Firefox Help. :) TechnoFreaking Continues…..

Update for Ubuntu Dapper Drake:

There is a few changes when trying the same in Ubuntu Dapper Drake, which I did a few minutes ago. They are,

1. Create a new directory called ‘jre’ within ‘/usr/share/java’ and CD into that directory before running the downloaded file. This will install the j2re within the ‘/usr/share/java/jre/’ directory.

2. Copy the plugin file into /usr/lib/firefox/plugins/’ for global effect and into ‘~/.mozilla/plugins/’ for local effect.