web


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 have been playing with rails whenever I found time the past few weeks. Which isn’t a lot. But I have to say with the little I have tried, it actually is very elegant and easy to use, especially for a database driven website. I was up and running in a few minutes. For the benefit of people who don’t know what Ruby or Rails is about: Rails is a web application framework on top of the programming language ruby. Ruby was invented by a japanese programmer and has recently become very popular due to english language articles and books on the language. The most interesting being the Ruby book by pragmatic programmers.

You might not be aware of didtheyreadit.com or other such services , but it would be good idea to know what it does. If you have used microsoft exchange server and outlook , there is an option to track delivery and read status of email messages. This allows the sender to receive notifications once their emails have been read and when they were read. Of course in Outlook, as a recipient of the email I can choose NOT to send a notification back.

Now back to this service “didtheyreadit.com”, it brings this same service to the web based emails. And it does it without the the recipients knowledge, which is what I hate.

After you signup for this service (there is a free one for 10 email messages), you will be asked to add didtheyreadit.com to the end of the email address for every email you want to track. So If you want to send an email to abc@xyz.com, you will actually write the email to abc@xyz.com.didtheyreadit.com and didtheyreadit.com will then forward your message to abc@xyz.com. And you can now log into didtheyreadit.com and see when the email was read and if they have forwarded it to someone else etc.

So how does this work?.

Didtheyreadit.com adds a single pixel jpeg file to the message and makes the message a HTML message for the recipient. The image looks like this:

<img src=”http://xpostmail.com/745637733fe8414505563ab5f8112449aaworker.jpg” nosend=”1″ name=”dtri” width=”1″ height=”1″/>

When this email is read and IF you have turned on images in your HTML email, this image will be downloaded from xpostmail (which I am guessing is didtheyreadit.com’s domain). And since this URL is unique for the message and the recipient, didtheyreadit.com now knows you have read this email.

I guess this makes it really easy for someone to see if you have read their email. So no more “Oh, you sent me an email!!. I didn’t get it!!” . They will know you are lying :) . If you really don’t want to be tracked, don’t turn on images in your webmail or block xpostmail.com in your firewall.

In the interest of full disclosure though, I have thought of doing something similar by putting an image in my email signature with different URL parameters generated uniquely for every message (wouldn’t have worked for tracking individual recipients , but you can tell a little bit more based on the referer). But I dropped the idea because it was very sneaky. I am sure web based email providers like yahoo, google don’t want to do it for the same reason.

If you pay close attention to your favorites in IE or URL bar in firefox , you will notice that when you view some of the websites like google and yahoo , you will see their logo before the URL. So how did these sites manage to do this?. Simple, browsers look for a file called favicon.ico in the same directory as the current page or in the root of the website and they use this file as the icon. This was something that IE started supporting in IE 5.5 and how pretty much all modern browsers support it. It adds a nice touch to the small business sites making their bookmark or URL standout from the rest.

You will notice that there is an icon for my website as well. Here is how I made the favicon.ico online:

I first created a transparent logo from text using the cooltext website. I then saved this logo to my desktop . I then used the favicon.ico generating service to create the favicon.ico. Once you upload this file to the root of your website, all modern browsers will start recognizing it and showing off your icon in favorites and URL bar.