Don’t know if this is something to be proud or ashamed off :) . Check it out for yourself. There is some method to the madness though. The bigger your vehicle the more right of way you have. When enough number of smaller guys get together, they trump the big one…its actually quite interesting to watch.

http://video.google.com/videoplay?docid=-2063667852598904740&hl=en

I came across a very cool library in Ruby that allows Web UI testing using OLE automation. One of the problems with running automated tests of Web applications like a end user is the effort it takes to use libraries like Http Unit to setup test cases and execute them as part of your build process. WATIR (pronounced Water) is a ruby library that allows you test you web applications using OLE automation in your windows machine.

This is how it works:

You write unit test cases using WATIR and it actually invokes IE and actually does what a end user would do by entering form data, clicking on links, clicking buttons etc. You can then look at the resulting HTML DOM object and check if the web application did what it is supposed to. This is especially useful for testing multi-page wizard like applications where a lot of data entry is involved.

Here is a Step-by-step on how to install WATIR:

Install Ruby for Windows: http://rubyforge.org/projects/rubyinstaller/ (Look for download link)
Install WATIR: http://rubyforge.org/frs/?group_id=104 (Look for watir 1.4.1.exe)

It is pretty straight forward to create WATIR scripts. But, who wants to write these scripts by hand. You are right, I wouldn’t. Instead you can use WATIR webrecorder, which records all your browser actions as WATIR scripts. All you need to do is record your testing once and then refactor it into a test script.

You can also pass -b switch to the WATIR script and it will not open the IE window and will execute the whole test in a headless mode that is ideal for test suites.

There is also another competing tool called Selenium that uses Javascript to drive tests and works across many browsers. I have not used it. But I have heard more people switch from Selenium to WATIR than the other way around.

It has been long rumored that Google was working on a Calendar service and its finally online for everyone to try. The UI is similar to anything Google : very clean and intutive. I use Yahoo Address book and Calendar today and Y!s UI is not as fresh and snappy as Google’s but it satisfies one of my key requirements : Being able to Sync-up with my Palm Treo 600. Until Google adds a way to sync up with PDAs through a PC or over-the-air, there is no big reason to switch to this service.

In spite of excellent support for HTML authors to create printer friendly version of their documents using CSS, many of the documents on the web today look horrible when printed. Even pages that provide a printable view suffer a major flaw. If the documents have links there is no way of knowing where they point to from the physical copy. This has always bugged me. When I have things printed out and there are links in the page that I would have liked to read, going back to the original document and hunting down the links is too much of a hassle. Take this NY Times article in printable view for example, it would be nice If I could after reading this printed page read the link to the avian flu in the article.

Since I use firefox, I wrote a Firefox Greasemonkey userscript that will automatically create references at the end of the printed document for every link in the page. And to make it really easy, the links are tinyurls that allow for easy typing instead of the original long URLs.

Download Printable.user.js after installing the Greasemonkey plugin in Firefox.

Trac has a lot of complex dependencies and contrary to what the TracInstall page says it is one hell of a painful job installing it in a shared server under one’s own home directory. This is a step-by-step guide of how I made it work and the mileage will vary greatly on the version you try to use. If this guide was helpful or needs corrections, please let me know.

Now lets get on with it… I found the following pages useful for the install:

http://projects.edgewall.com/trac/wiki/TracInstall
http://wiki.dreamhost.com/index.php/Trac

Note:All of my installs follow the same pattern. Untar the distribution into a [tool]-[version]-dist directory and install to $HOME/[tool]-[version] and create a symlink to $HOME/[tool]. This allows me to easily upgrade individual pieces without breaking others (I simply symlink to the new version when its time to upgrade).

Installing Trac’s dependencies:

1. Python (version 2.4) : Eventhough you might have Python in your shared server , you need your own version because of ClearSilver.

$ wget http://www.python.org/ftp/python/2.4.2/Python-2.4.2.tgz
$ gunzip Python-2.4.2.tgz; tar xvf Python-2.4.2.tar;
$ mv python-2.4.2 python-2.4.2-dist
$ cd python-2.4.2-dist
$ ./configure –prefix=$HOME/python-2.4.2
$ make; make install
$ ln -sf $HOME/python-2.4.2 $HOME/python

IMPORTANT: Add $HOME/python/bin to the start of your PATH variable and LD_LIBRARY_PATH in your shell. If you use bash, set it in .bashrc as follows:

export LD_LIBRARY_PATH=$HOME/python/lib/
PATH=$HOME/python/bin:$PATH:$HOME/ruby/bin:$HOME/subversion/bin

2. Installing ClearSilver (0.10.2):

$ wget http://www.clearsilver.net/downloads/clearsilver-0.10.2.tar.gz
$ gunzip clearsilver-0.10.2.tar.gz; tar xvf clearsilver-0.10.2.tar
$ mv clearsilver-0.10.2 clearsilver-0.10.2-dist
$ cd clearsilver-0.10.2-dist
$ ./configure –prefix=$HOME/clearsilver-0.10.2 –with-python=$HOME/python/bin/python –disable-ruby –disable-java –disable-perl –disable-csharp
$ make ; make install –prefix=$HOME/clearsilver-0.10.2

3. Install egenix extensions for python (2.0.6: Trac needs mxDateTime)

$ wget http://www.egenix.com/files/python/egenix-mx-base-2.0.6.tar.gz
$ gunzip egenix-mx-base-2.0.6.tar.gz
$ tar xvf egenix-mx-base-2.0.6.tar
$ cd egenix-mx-base-2.0.6
$ python setup.py build
$ python setup.py install —prefix=$HOME/python

4. Install sqlite (version 3.2.2)

$ wget http://www.sqlite.org/sqlite-3.2.2.tar.gz
$ gunzip sqlite-3.2.2.tar.gz
$ tar xvf sqlite-3.2.2.tar
$ mv sqlite-3.2.2 sqlite-3.2.2-dist
$ cd sqlite-3.2.2-dist
$ ./configure –prefix=$HOME/sqlite-3.2.2
$ edit Makefile to remove references to build and install tclsqlite since I did not have TCL installed

all: sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la) -to-
all: sqlite3.h libsqlite3.la sqlite3$(TEXE)

-and-

install: sqlite3 libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install} -to-
install: sqlite3 libsqlite3.la sqlite3.h

$ make ; make install –prefix=$HOME/sqlite-3.3.2
$ ln -sf $HOME/sqlite-3.3.2 $HOME/sqlite

4. Install PySqlite (version 1.1.6) (I could not get PostgresSQL to work with Trac because my ISP does not start the postgresSQL daemon to accept TCP/IP connections):

$ wget http://initd.org/pub/software/pysqlite/releases/1.1/1.1.6/pysqlite-1.1.6.tar.gz
$ gunzip pysqlite-1.1.6.tar.gz
$ tar xvf pysqlite-1.1.6.tar
$ mv pysqlite pysqlite-1.1.6
$ cd pysqlite-1.1.6
$ edit setup.py and change the following:

include_dirs = [’/usr/include/sqlite’]
library_dirs = [’/usr/lib/’]

-to-

include_dirs = [’/path/to/homedir/python/include/sqlite’]
library_dirs = [’/path/to/homedir/python/lib/’]

$ python setup.py build
$ python setup.py install

5. Install Subversion (Skipping this section) : See my previous post on how to install subversion.

I still had to do the following to get python bindings for SVN in my subversion-1.1.4-dist directory:

$ ./configure PYTHON=$HOME/python/bin/python –prefix=$HOME/subversion –with-swig=$HOME/swig/bin/swig –without-berkeley-db –with-ssl –with-zlib –disable-shared
$ make
$ make swig-py
$ make install-swig-py

## HACK WARNING ### I also had copy some of the svn libraries from the original python install at my ISP:
$ cd $HOME/python/lib/python-2.4/site-packages
$ cp -R /usr/lib/python2.3/site-packages/libsvn .
$ cp -R /usr/lib/python2.3/site-packages/svn .

6. Install SWIG (version 1.3.24):

$ wget http://easynews.dl.sourceforge.net/sourceforge/swig/swig-1.3.24.tar.gz
$ gunzip swig-1.3.24.tar.gz
$ tar xvf swig-1.3.24.tar
$ mv SWIG-1.3.24/ swig-1.3.24-dist
$ cd swig-1.3.24-dist/
$ ./configure –prefix=$HOME/swig-1.3.24 –with-python=$HOME/python/bin/python
$ make; make install
$ ln -sf $HOME/swig-1.3.24/ $HOME/swig

Installing TRAC

Now to the real reason we went through all this pain… installing trac itself

$ wget http://ftp.edgewall.com/pub/trac/trac-0.9.3.tar.gz
$ gunzip trac-0.9.3.tar.gz
$ tar xvf trac-0.9.3.tar
$ mv trac-0.9.3 trac-0.9.3-dist
$ cd trac-0.9.3-dist
$ python setup.py build
$ python setup.py install –prefix=$HOME/python

Create a trac environment and test

$ trac-admin $HOME/trac-projects initenv

answer the questions as part of the above command. You will need to pay close attention only to the location of your svn repository , in my case it is $HOME/svn.

Your Trac install is DONE.

Now to access this through a browser. Do the following in your public_html directory:

$ mkdir $HOME/public_html/trac
$ cd trac
# create a projects.cgi with the following content:

#!/bin/bash
export LD_LIBRARY_PATH=”/path/to/home/python/lib”
export TRAC_ENV=”/path/to/home/trac-projects”
/path/to/home/python/share/trac/cgi-bin/trac.cgi

$ chmod +x projects.cgi
# create a .htaccess file:
AuthType Basic
AuthName “Log in to Trac. guest access use (guest/guest) as userid/password”

require valid-user
AuthUserFile /path/to/home/htpassword/file
DirectoryIndex projects.cgi

$ ln -sf $HOME/python/share/trac/htdocs trac-static
# edit $HOME/trac-projects/conf/trac.ini and add the following under [trac]
htdocs_location = /trac-static

Now go to http://[your-domain]/trac and you should see something like this (login as guest/guest: http://trac.chandraonline.net/

I stumbled on a new we based project management system called trac that nicely integrates a bug tracking system, wiki and subversion into one little neat package. Since I have a subverison repository at my ISP, I thought I would give this a try. After following a few step-by-step guides and a few thousand lines of shell command line history, I finally had Trac installed and working on chandraonline.net.

Trac has some weird list of dependencies and installing it in a shared server only makes it worse. But hopefully I will put it to good use building some of my hobby projects.

I deviated quite a bit from the step-by-step guide linked above and hope to document it sometime soon.

So. I was wrong. I admit it. I was wrong about ABC’s Lost. I missed the entire first season and was pretty mad that it won Best drama over 24 last year at the Emmys. Now I know why this show is so loved. Its an awesome piece of writing. I started watching it this season and I loved it so much that I watched the entire first season of Lost on video IPod in a couple of days (yes…couple of days…you have a problem with that??). I was a big fan of X-files and this show is in some ways very similar to that show. If you have never seen it , you should give it a chance.

For the lost fans with IPod, checkout Ryan and Jen’s Lost Transmission podcast at http://www.hawaiiup.com/lost. Its very entertaining.

For anyone who has not heard of Subversion , it is an open-source version control system (very much like CVS but much better) to manage your source code. I had started to play with Ruby on Rails using the RailsIDE and I would hate for my source code to be without version control and much worse just kept in my hard drive. So I wanted to have a version control for my personal projects just like I do at work. And I didn’t want to host this subversion repository in my windows box at home, I would rather keep it at the ISP machine where I host my domain. Sounds simple enough, right?. Wrong!!. I found so little on the net about it that I was compelled to write this down for others who might want to do this . Here is a step-by-step guide on running and connecting to a subversion repository in an ISP account.

Before we get started, there are a few assumptions:

  • Your ISP provides you with shell access using ssh. You can’t do what I am describing below using Control Panel. Not all of ISPs allow Shell access and some will do it if you ask them. This is an absolute requirement.
  • You have permission to install anything under your user directory. This I know almost all of them allow you to do.
  • Step 1: Installing subversion server

    The following instructions are for a linux machine. Surf to subversion site and look for the latest stable source code package. When I did the install , this is what I ended up using: http://subversion.tigris.org/tarballs/subversion-1.1.4.tar.gz. Now ssh into your account and do the following:


    $ cd $HOME;
    $ curl -o subversion-1.1.4.tar.gz http://subversion.tigris.org/tarballs/subversion-1.1.4.tar.gz
    $ gunzip subversion-1.1.4.tar.gz; tar xvf subversion-1.1.4.tar
    $ mv subversion-1.1.4 subversion-1.1.4-dist
    $ cd subversion-1.1.4-dist
    $ ./configure --prefix=$HOME/subversion-1.1.4
    $ make
    $ make install
    $ cd $HOME; ln -sf subversion-1.1.4 subversion

    Thats it. Add $HOME/subversion/bin to your PATH variable and you are all set. Now its time to create a svn repository. I chose to use $HOME/svn as my svn repository.

    Now test your subversion install by adding a dummy project to the subversion respository:


    cd $HOME;
    mkdir projects;
    cd projects;

    # create a dummy project source
    mkdir -p dummy-project/src
    touch dummy-project/README

    # add the project to subversion
    svn import -m "Initial Version" dummy-project file://$HOME/svn/dummy-project

    If everything went according to plan, your project is now in subversion.

    There is not much use to a subversion server if it can only be accessed locally. There are three ways to front a subversion server to access the repository remotely: using apache webserver (using http://) , using a custom svnserve daemon (using svn:// url scheme) or by tunnelling svn over ssh (svn+ssh://). The first two options are automatically out for a hosted account and the only option is going svn over ssh.

    Step 2: Connecting to subversion by tunnelling over ssh (svn+ssh)

    This is where I found the least documentation and most difficulty. To connect to the subversion repository you two pieces of software on your client machine : a subversion client (I use tortoise svn) and a ssh client (I recommend Putty) . Install putty and the utilities it comes with preferebly through a windows installer (http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.58-installer.exe). Install Tortoise subversion to c:\TortoiseSVN (The default location in Program Files will create a problem later during ssh configuration).

    In order to tunnel svn commands over ssh , you need to be able to ssh to your ISP account without having to give a userid and password every single time the client wants to talk to the server. There is a way to setup a public-private key pair to enable this dialogue without a need for entering a userid and password.


    $ ssh-keygen -t dsa -f mykey

    You will see two files mykey and mykey.pub, the openssh private and public keys. Now add the contents of mykey.pub to the file $HOME/.ssh/authorized_keys in your shell account. Create the directory and file if you don’t have it already.

    Now add the following to the begining of the line you just added to the authorized_keys file. It should look something like this (replace your-home-dir with the right value):

    command=”your -home-dir/subversion/bin/svnserve -t -r your -home-dir/svn” ssh-dss AAAA……………

    Now move the private key file mykey to the windows machine that you will be connecting to subversion from. Run puttygen.exe, and click the button Load and choose the mykey that you just moved from your shell account . Putty will successfully load it and now you choose the “Save private key” button and save the private key in putty format as mykey.ppl. Save this to c:\TortoiseSVN\bin.

    Now run Putty.exe and under Session choose ssh , your host name , in Connection->Data enter your login name, Connection->SSH->Auth section , click the Browse button to choose the private key file. Now choose c:\TortoiseSVN\bin\mykey.ppk. In Session, give it a name like SVNConnection and choose Save. Click the open and you should see the following :

    Using username “your-user-name”.
    Authenticating with public key “imported-openssh-key”
    ( success ( 1 2 ( ANONYMOUS EXTERNAL ) ( edit-pipeline ) ) )

    This means your ssh connection to subversion is working. Now you just need to get the subversion client (tortoise svn) to use the private key file when connecting to your repository. In the following subversion config file (C:\Documents and Settings\Your-User-Name\Application Data\Subversion\config) look for the section title tunnels:


    [tunnels]
    ### Configure svn protocol tunnel schemes here. By default, only
    ### the 'ssh' scheme is defined. You can define other schemes to
    ### be used with 'svn+scheme://hostname/path' URLs. A scheme
    ### definition is simply a command, optionally prefixed by an
    ### environment variable name which can override the command if it
    ### is defined. The command (or environment variable) may contain
    ### arguments, using standard shell quoting for arguments with
    ### spaces. The command will be invoked as:
    ### svnserve -t
    ### (If the URL includes a username, then the hostname will be
    ### passed to the tunnel agent as @.) If the
    ### built-in ssh scheme were not predefined, it could be defined
    ### as:
    # ssh = $SVN_SSH ssh
    ssh = C:/TortoiseSVN/bin/TortoisePlink.exe -2 -i C:/TortoiseSVN/bin/mykey.ppk

    Now open the Repo-Browser of TortoiseSVN and enter the URL to your dummy project:

    svn+ssh://SVNConnection/dummy-project

    and you should see the files under dummy-project. If you can’t connect, its probably because you didn’t setup the puTTY session correctly. Verify that you entered all the required information correctly.

    You can connect to svn repository from inside RADRails using the following URL (this does not work in TortoiseSVN for some reason):

    svn+ssh://your-user-name@your-machine-name/dummy-project

    Whoa. I haven’t blogged in a long while now. But since I was off on vacation for a month in November, I have a good excuse. I have some Google desktop hacks to share. Actually I have a hack to share. But its a useful one. I have been using Google desktop for a while now and I have a lot of emails (in archives of course) and files that it indexes. The cache has been eating away so much of my C: space where I can’t do any decent work anymore. So I went registry hunting for a way to move the cache from my c: drive to my external drive (a huge 160 gb). And I actually found a way. Here is how (This is not for the faint of heart. Doing wrong things to your registry might render your machine useless. Consider yourself warned):

    shutdown google desktop by right clicking on the tray icon and choosing exit.
    start->run and type regedit
    In regedit go to My Computer->HKEY_CURRENT_USER->Software->Google->Google Desktop
    On the right you will see an entry data_dir. Double click it and change the value data to a directory of your choice.
    now start google desktop again and you should see your cache in that directory.

    Some words of caution though:

  • Don’t make your cache go to a network directory. You will completely flood the network. Google writes a lot to the cache.
  • If you choose an external drive as your cache, turn encryption of index and datafiles on in Google desktop preferences. This might take google desktop longer to index, but it is the wise thing to do because anyone could take off with your external drive more easily than your desktop.
  • In my case I reinstalled the google desktop (because I was upgrading to a new version) and removed all the indices and cache and then changed the data_dir fresh after an install. I am not sure if it works as expected if you just changed the registry entry without a reinstall.
  • I just finished watching the Emmys. I can’t believe 24 did not receive the best drama series award or the best lead actor. The Emmy voters are seriously LOST (get it?). And to make matters worse they award the best lead actor to James Spader and the best series to Lost. I would have been completely ok with West Wing taking the best drama series if not 24. Since the votes are cast based on one episode of the series , I wonder if a show like 24, which requires you to watch the entire series to appreciate how wonderful it is, will ever win.

    But it does not matter whether the show receives an Emmy or not. We are all on your side Jack, when these jokers in hollywood get kidnapped by terrorists, you look the other way :) .

    Next Page »