Monday, December 17, 2007

Getting off the ground with SVN.

Do you frequently ask your colleague to email code to you and then "integrate" on your machine? Do you frequently miss somebody's code before deploying the application? Have you had days when you have felt, "it would have been great if i had my code of 2 days ago!"?
If you are in a situation similar to the ones above you should seriously consider using a version control system. At its most basic level a version control system would improve your situation in the following ways:

  1. Allow for easy collaboration:, no more "code emailing, pen drives".

  2. Maintain history: You can go back to your code of 2 days or 20 days ago, check what did you change, get it back if you want. This must be sweet music if you have redone code that you did sometime ago.

Ok - I want all that but question is which version control system do i use? Honestly, tough question, but from a newbie point of view I have found subversion (frequently called svn) the easiest to get off the ground.

So lets take our first baby steps to setting up subversion:

  • Step 1-Download and Install subversion: Subversion for Windows can be downloaded from here. Download the latest version (1.4.5 currently). Run the exe and you should get through the installation fairly easily.

  • Step 2: Create a Repository: Subversion can be thought of as a client server system. It works by having a central respository which several clients can access for doing various operations. To create a repository, open cmd from Run and type out the following command

    c:\>svnadmin create c:\my_repository

    This will create a folder called my_repository in c drive which will be the Subversion admin area.

  • Configure SVN Access - Now you have a repository, and you are the SVN Admin :), so time for you to decide who gets to access the repository, what rights do they have? To configure these things navigate to the folder c:my_repositoryconf and open the file called svnserve.conf. You will see a section title [general] and under that you will see 2 commented entries (# denotes a comment line), these commented entries which are the default values are

    anon-access = read
    auth-access = write

    These signify that a user with no credentials will be able to read whats in you repository, but not modify files in it, whereas an authenticated user will be able to modify files.

    If you are in a trusted environment then you could probably alter the anon-access (Please make sure that if you make any changes to file, you remove the # before that line and there is no space at the beginning of the line) property to write, so that almost anyone can edit the code in your repository, but going further you would want only authenticated users to change the code in the repository.

    Now to specify which file to use as the file which contains the usernames and passwords uncomment the line(remove the # from the beginning, again remember no spaces after line start).


    To configure users for your repository open the file called passwd.
    Under the [users] section in that file you will see that the format of users is


    Create the users that you want with their passwords, be sure that there is no # before the line, it indicates a comment.

  • Step 3: Start SVN Server - SVN comes with a bundled server that you can use for basic purpose. In advanced cases svn repository can be exposed through a webserver like apache.

    To start the SVN Server execute the following command

    c:\>svnserve -d -r c:\my_repository

    Now you have an svn server running on your machine which the others will be able to access. The -r argument above should be followed by the location of the repository. The -d argument specifies that the server should be run in daemon mode. This will keep a DOS window open all the time and if you restart your machine (i.e. the machine where the server is running) you will have to restart the server also by running this command again.

    In order to get around this problem you can run the svn server as a windows service if you have admin privileges on your machine. To create and automatically start the service each time the computer starts execute the following commands:

    c:\>sc create "SVN Server" binPath= "svnserve --service -r c:\my_repository" start= auto

    Please be careful about the spaces in the above command. There is no space between binPath and =, similarly there is no space between start and This creates a service by the name of "SVN Server". Now in order to start the service, execute the following command:

    c:\>sc start "SVN Server"

    To verify if the service has been started you can go the services admin control, by running services.msc from the run dialog.

  • Add your code to repository: Now you are all set to add your code to the repository, this code will serve as your initial revision, think of it as your first step in the sand, no matter how many steps you take, you will always be able to come back and see how this looked :). To import code thats say located in c:my_code directory, execute the following command

    c:>svn import c:\my_code svn://youripaddress/ -m "Initial Import" --username youusername --password yourpassword

    Replace your ip address with your actual ipaddress (You can check this by running the command ipconfig), and yourusername and yourpassword with the actual values. This username and password must match one of the entries you created in passwd (in c:my_repositoryconf) file. Once you execute this, you will see a lot of status messages showing the files added, and in the end you will see "Commited Revision 1".

  • Working with SVN: Once you have the repository in place, you are more or less there in terms of getting ready to start utilizing the power of svn. SVN works by every user having their own working copies, and then commiting and updating(these are the 2 most basic and most used operations, you will learn the rest as you get good at the trade).
    A commit sends all local modifications to the repository, and an update fetches the latest code from repository into your working copy.
    Everything you can do with SVN is possible through the command line, but if you are not comfortable using it, you could download Tortoise SVN client. It simplifies working with SVN by integrating with windows explorer, and adding cute icons to folder and files which are under SVN version control.
    Now lets get down to the step by step of working with SVN:

    • Step 1: Checkout working copy: In SVN world every developer has his/her own working copy. This is your playing field, this where you try out that cute new feature that going to change the world :-). Ok now to make working copy you need to get the files from the server. Here is how you do it.

      c:\mywork>svn co [Your SVN Server URL e.g.svn://] [Path where to checkout]

      When you hit enter, you will see a listing of all files being fetched from the server. Once the operation completes you will have a new directory in the folder which you specified as the argument for "path to checkout". This is your working copy.
      If you have "Show hidden files" turned on in you Windows Explorer settings you will see a hidden directory by the name of .svn inside every folder of your working copy. This is svn control area, where you shouldnt, absolutely shouldnt be altering anything.

    • Step 2: Working with the your working copy: Ok now that you have your working copy you can do what you want, ditto for your colleagues, once they checkout using the process mentioned above, they will have their own working copy.
      Working with your working copy is nothing special, SVN doesnt care what IDE you use, or whether you use one at all. Open up your code modify, build, break it :-).

    • Step 3: Commit and Updates: In one line, commit sends your changes to the server, update fetches latest changes from the server. These two operations do just that and nothing else i.e. commit will not fetch anything new, and update will not send anything period. Think of these operations as push and pull. Commit pushes, update pulls. Now lets get into the nitty gritty of commit and Update

      • Commit: The commit command can commit a single file or multiple files or all files in a directory. The syntax is:

        c:\my_work\my_project>svn commit [path...] -m "LogMessage"

        c:\my_work\my_project>svn commit -m "Added calculation for Service Tax"

        This sends the all the modifications that you have made to the files specified in the paths to the server. The log message is meta information which is very useful when tomorrow you want to know "what did I do that day?".

      • Update: The update command can update a single file or multiple files. The syntax is:
        c:\my_work\my_project>svn update [path...]

        e.g. suppose you have directory called unitests.

        c:\my_work\my_project>svn update unittests

        This fetches all updates to files in the unitests directory. When you run svn update along side each file updated you will see a letter (A/D/U/C). Following are the

        A Added - This file was added to SVN

        D Deleted - File was deleted from SVN. Don't panic. This DOES NOT mean file is lost forever. It just means that in revision number, say 10 of this directory this file was deleted. You can get the file from the previous revision.

        U Updated - The file was updated

        C Conflict - A conflict occurred while updating, i.e. some local modifications that you made couldn't not be automatically merged with the latest file from the server. See section below on what to do when a conflict occurs.

        G Merged - Some local modifications and the latest file from the server were automatically merged.

      • I am getting an error!! what do I do?
        Errors messages thrown by SVN in most cases are very informative, and tell you whats wrong. Some errors that you might encounter frequently when you are starting up on SVN are:

        • "Transaction is out of Date": At the time of commiting you might get this error "Transaction is out of Date". This means that the file that you are trying to commit has been changed since you last pulled from the repository, i.e. while you were working with the file, someone committed a new version. To commit your changes you must first get the newest version from the repository, merge your changes into that (more on this later) and then commit thereby creating a newer revision.

        • Conflict: Conflicts might be encountered while pulling changes from the server, i.e. while updating. RELAX, its normal, it does not mean that everything is corrupt now, and you need a major cleanup effort. First of all lets understand what happens when you do an update. For each file that is apart of the update that you are trying to pull, there are two things to consider: have you made any local modifications to the file, and if the file has been changed by anyone on the server since you last updated your copy.
          If the file has been changed on the server by someone and you don't have any local modifications, then an update will just replace you existing copy of the file with the updated file.
          If you have local modifications but the file hasn't been updated on the server, then nothing happens and you know why. right??
          If you have local modifications and the file has been updated on the server, then in the first place SVN tries to merge automatically. For e.g. if the file you checked out had the following content.

          Address=a-236 hill towers wonderland

          Now you the spelling bee, saw the galring mistake in the spelling of "client", so you change it. But in the meanwhile, your friend John updated the address and performed a commit. So now your local copy had the following content

          Address=a-236 hill towers wonderland

          And the latest server copy had the following content

          Address=a-236 high hill towers wonderland

          Now you run the update command. SVN sees that your change, and the change on the server are on separate lines and it merges them automatically. So after the update your local copy is as follows

          Address=a-236 high hill towers wonderland

          Now you can run a commit to make your merged file the latest version.

          But suppose your change was something like this:
          Address=a-236 low hill towers wonderland

          In this case, there is no way for SVN to know whats the correct version (low or high), and now you have to decide whats right. This is reported as a conflict (C) when you run the update command.

          When SVN reports a conflict it creates 3 extra files and puts markers in your existing file. The 3 extra files have the following names.

          • filename.rOLD e.g. Clients.txt.r12 - This is the latest version you were in synch with

          • filename.mine - e.g Clients.txt.mine - This is your file before you ran the command. Look at it this way, you got r12 from the server and you changed it to mine.

          • filename.rLATEST e.g. Clients.txt.r14 - This is the latest file on the server.

          • The markers in your original file are put in the following fashion.

            <your changes in the conflicted area>

            <the conflicted area as per the latest copy in the repository i.e. The changes made by the last author>


            So your file will look like this:


            Address=a-236 low hill towers wonderland
            Address=a-236 high hill towers wonderland

            Now you decide whats right. High or low. Once you make your decision, remove the markers from the file and run the following command.

            svn resolved Clients.txt

            and then to commit the resolved file

            svn commit Clients.txt -m “Merged mine and his changes”

SVN provides a lot of features which you will need as you become a top notch developer. A very good reference for anything related to SVN is

Please contact me (puneet dot lakhina at gmail dot com) in you case find some problems and or have some comments with regards to this tutorial.

Thursday, November 29, 2007

Firefox crashing

I don't know if I can call this an accomplishment, but I have been able to crash firefox in a consistent repeatable manner by following a sequence of steps. The test case goes like this:

  1. Start Firefox - Open firefox. I have 2-3 live bookmarks one of which is My reading list on google reader, now when I initially launch firefox this live bookmark doesn't load as i need to sign into my google account through any of google services.

  2. Log into gmail - My usual routine, I log into gmail to check my mail.

  3. Reload live bookmark - After logging in I reload the google reader, my reading list live bookmark. It loads, no hitches.

  4. Visit problem item - This is where the problem is, I click on the item that leads to this link on lifehacker. After a few status messages on the status bar, FREEZE.
    Then i get the mozilla talk back screen asking me to report the problem, which I did giving full detail. I also get the Windows Vista dialog saying "This program has stopped responding".
    An interesting thing to note is that the bar on the bottom right corner that normally shows progress in terms of page loading doesnt appear. I dont know if its relevant or not, thats how it is.

  • I have the following add-ons installed - Chatzilla 0.9.79, Bookmarks 1.5.44, DOM Inspector v1.8.10, Firebug 1.05, Indic IME 1.6.3 (disbaled), Talkback 2.0.10

  • The problem is limited to this profile. I created a new profile (by running firefox -p) and added just my reading list live book mark and repeated the above steps. It runs without problems, so I am guessing some configuration in my profile is causing the problem.

  • The problem does not occur if I click on any other item of the feed.

  • Other details on my setup: OS: Windows Vista Home Premium, Firefox 2.0.10

If you can help please post a comment. I would be very happy to provide any additional details required. I have the dump generated by the talkback client which it sends back to mozilla.

  • The problem is firebug 1.05 extension. I disabled that extensions and the crash did not happen.

Sunday, November 25, 2007

Earthquake in Delhi

An earthquake shook Delhi and its neighboring areas in the wee hours of Monday morning on 26th November 2007. The earthquake was a relatively strong one and lasted for about 4-5 seconds. I must mention that it was a little scary as earthquakes have a history of widespread devastation in India, and the memories of that poignant republic day in 2001 are still fresh.

Update: The earthquake occurred at exactly 4:43 AM IST and measured 4.3 on the Richter scale. The epicenter as per news reports was in Bahadurgard, although this cant be confirmed at the moment.
The Delhi Met Department website should be able to provide more details in the days to come.
The location in Google Maps (Double click the map to zoom in):

View Larger Map

Friday, November 09, 2007

GMail probable bug

While using the new GMail, which I believe everyone hasn't received as yet, I observed the following behavior. While using the chat, it showed one of my friends as offline even though i was chatting with them and there was no problem in recieving the messages. See screenshot below? Post comments if you have seen this kind of behavior. For the record I run Google sidebar on Windows Vista Home Premium also. My browser is Firefox with only the delicious extension being of note. I also have firebug which was disabled.

Thursday, November 08, 2007

GMail new mailist feature

Click to view full size image.Gmail new mailing list feature.The new feature for filtering messages of a particular mailing list in Gmail. I subscribe to a number of mailing and up until now had to use from addresses to filter my messages, this is a lot more precise.
This keeps up gmail's appeal to people who use mailing lists quite a lot. The conversations feature still prevents me from even thinking about any other web based email.

Sunday, November 04, 2007

Academic Research Commercial Research

An academic research effort in any field is supposed to establish outer boundaries. Commercial efforts demonstrate what is profitable; academic efforts show what is possible.

Tuesday, October 09, 2007

Airtel 220BX router forgot password

If you are reading this, you like me belong to the forky lot, who just cant rest without forking around in something unitl its messed up. Why do we do it, "thats how we learn!!!" right?
So, you know that blackbox in your home is not some magic but a Beetel DSL router, whose default username is admin and password is password
But that was default, the moment you you got to know of it, you had to change it. So you did, and couple of boring office days later you decided to access the router again, but alas you had forgotten that password, that secret known only to you 6 letter phrase.
Although your internet still works but this being denied access to a box sitting right in front of you, no I cant take it.
So what do you do?
Warning: This might lead to your internet not working for sometime, till you configure it right.

  1. Get your username and password: For most people your ADSL router works using PPPoE
    , which requires a username and password. You will need this to restablish your connection to the internet. It could be
    You can confirm this by calling up the helpdesk and asking them to tell you your username, and reseting the password.

  2. Reset your router: Now make sure your router is on and then reset your router by pressing that black button hidden inside a hole at the back of your modem using a pen or some pointed thing, See screenshot below:

  3. Switch off and Switch on your router.

  4. Open Router Management Console: Now fireup your browser and access your router using
    As the router has been reset you will be able to log in using the default username: admin and the default password: password
    1. Once you have logged in Click on WAN.
      Now you might see a couple of entries here, delete them by selecting the checkboxes
      next to them and clicking on remove. Reboot the router by clicking on save/reboot.
    2. Login to the router again. Click on WAN, and click on Add to add an entry.
    3. In the ATM PVC configuration screen Enter VPI value 1 and VCI value 32
    4. Next you will see the connection type screen, select PPPoE in that screen.
    5. In the Next screen enter the PPPoE username and password.
    6. Keep default values in all subsequent screens and save this newly created entry.
    7. Reboot your router, by Switching on and Switching Off.
    8. Once up again, Login to the router again and click on the WAN.
    9. The entry you created should show status UP. This signifies you internet is back up and running.
Access your favourite website and voila, ur back again. Happy surfing!

Wednesday, October 03, 2007

Enabling Indic in Firefox on Ubuntu

Do you have problems reading Indic lanaguage websites? Do you see incorrect rendering such as misplaced matras, aadha akshar appearing with a halant? Have you been blaming firefox/Ubuntu for not getting such basic stuff right?
Well not to worry as the fix is a very simple series of steps.

  1. First check if your browser has been compiled with the --enable-pango flag. To check this, type "about:buildconfig"(without quotes) in your address bar and look for the string --enable-pango (See screenshot below). For most people on Ubuntu, this flag should be there, but in case you have one that doesnt have this flag, you will have to obtain a firefox build that was compiled with this option.

  2. Now you will need to set two environment variables, naemly MOZ_ENABLE_PANGO and MOZ_DISABLE_PANGO. To set these variables(On Ubuntu) open the file /etc/environment in your favourtie text editor, and type the following lines at the end:

  3. Now you will need to install certain fonts (in case these are not already present), to install these fonts type the following in your terminal(See screenshot to know where to open the terminal from),

    sudo apt-get install ttf-indic-fonts

  4. And thats it, you are done just log off and log in and you should see Indic text being rendered properly. To check, see if you can read this beautiful poem in Hindi properly,
    If you cant read Hindi open your favourite website and see if it renders properly.
Troubleshooting: In case you still cant get Indic script to render properly, before asking your LUG or any help group gather the following Information:
  1. Your Operating System details: You can get display operating system details by typing uname -a on your terminal.(See above on how to open the terminal)

  2. Your browser version details: In firefox go to Help -> About Mozilla Firefox

  3. Your Browser Build Details: Go to address bad type about:buildconfig

  4. Font Details: On Ubuntu Go To System->Preferences->Fonts and check what Hindi/Tamil/Your Language fonts(if any) you have.
  1. For more detailed information on enabling Indic on your system, please visit:

  2. Pango is a free and open source computing library for rendering internationalized texts in high quality. Different font backends can be used, allowing cross-platform support, that was written as a part of GTK+ widget toolkit.

The "I have 2 orkut accounts problem"

This is a problem that a lot of people tell me about. I have 2 orkut accounts or separate Gmail and orkut accounts but how do i open them both in Firefox. Opening 2 separate windows doesn't work.

Well the solution is pretty simple if you follow the following Step by Step. This is a solution on Windows which i believe is the majority audience here.

  1. Close all firefox windows, including any download windows.

  2. Right click on My Computer. Click on properties. You will see a tab "Advanced". Click on that and then click on the button "Environment vairables".
    Now click on New and a small dialog box will appear asking you for Variable Name and Variable Value. In the variable name field write MOZ_NO_REMOTE

    Make sure its in Capital Only. In the variable value field enter 1.

    Now click on OK in the dialog Box, and then OK in the System Vairbales Dialog.

  3. Go to Start->run. Type firefox.exe -ProfileManager.You will see a window like below. Here Click on "Create Profile" and then create a profile named "Separate Gmail". Once you do that and click on finish you will see 2 profiles "default" and "Separate Gmail". Click on default and Make sure "Don't ask on startup" checkbox is selected. Now click on "Start Firefox". This opens a Firefox window, login to your orkut/gmail account.

  4. Now for opening a separate window with your other account, we will first create a shortcut. Go to your Desktop, right click and click on New->Shortcut. This will open a Create Shortcut dialog. In the location box enter the following String
    "C:\Program Files\Mozilla Firefox\firefox.exe" -p SeparateGmail
    In case you selected some other directory while installing firefox navigate to that directory and select firefox.exe. Once you do that at the end add " -p SeparateGmail"(without quotes).
    Now click on Next and give an appropriate name to this shortcut, say Separate Gmail Firefox.

  5. This will add another Firefox icon to your desktop, with the above name. Now double click on that to open another firefox window. Now go to orkut/gmail , you will see the login screen, login with your other account and you are there.
    Please Note: The Firefox window opened through this shortcut will not have your settings like proxy settings, addons etc. You will have to add them again for this profile.

Tuesday, October 02, 2007

Google News Strange Behavior

Last night I was up till about 2 AM watching the English Premier League Game between Totenham Hotspurs and Aston Villa. Spurs have had a horrendous start to the season, so I slept off when it became 1-3 thinking it was a done deal.
Then today through a news report on TV i got to know Spurs had actually drawn level at 4-4. Now i wanted more of this news. Fired up my browser went to Google News India and searched for "totenham", href="">here here is the result page I got. Strange part was it had only one result a Sky Sports news report. This was a pretty strange, had everyone in UK slept off not written anything about spurs Liverpoolish achievements?? Obviously not, Next I searched for "totenham villa", and here is the result page i got, with all the results I wanted.
Isnt it a little strange that when i include more terms i actually get more results, shouldn't more terms mean narrower results.
I am not a search expert but something has to explain this.

Monday, October 01, 2007

Quote Unquote

The idea
that the value of the system will be discovered rather than known at the time of
installation implies, in turn, that product flexibility and adaptability, as well as ongo-
ing account service, should be critical components of any buyer’s evaluation check-

Geoffrey Moore