Sunday, November 19, 2006

Thousands of mails? You need a powerful Genie!

My home doesn't have internet connection. Though this is generally fine, because I spend most of my time in office, enjoying Google's bandwidth and food. But, lately, I had couple of problems with my health leading me to spend time in my room. Its crazy spending time in a dark dungeon (hi friend!) like room, no T.V., no internet connection, with just a standalone computer and myself. Gossip magazines, which btw I am fond of, talking about Brad Pitt, sexy Angelina Jolie and their (almost always?) newly adopted kids is fine for some time, but then it has its limits. It was then that this idea occured to me, of pushing some of my online interests offline. Totally not a new idea; but isn't it true, that you get them, only when you really need them.

This was the time when I thought of installing Thunderbird, to download and crank upon the thousands of mails I need to browse through while at work. Thunderbird is open source, and a great mailing client, but my love for easy on RAM command line stuff just doesn't seem to like it. This also removes out Evolution. PLUS, I always wanted to be able to mail my attachments without having to open up firefox, login to Gmail, and waiting for the file to be uploaded to the server. Nautilus send can serve the purpose, but again, its not command line. My first intuition was to use libgmail, and write up a script to send mails. But then, it has limited usage. That's when, the age-old powerful client showed up to my mind, there is Pine, there is Elm, but there is nothing like Mutt. So, serving my old love for Gentoo (replaced practically by Ubuntu, but it can never even come close in terms of documentation. hmm.. shd I add yet?!), I browsed through its docs to configure Mutt with Procmail, Fetchmail, and msmtp. Took some time, to configure it exactly, but things worked up fine. And I got myself a Genie!

Know that, I had to download 27,000 mails over one long evening and night, when I replaced my mailing solution for Google internal mails, with Mutt. However, somehow the number of mails I get now, just doesn't seem to be enough for what I'm capable of! And talk about it, just a week back, I was complaining about the huge volume of mails I've been getting.

Edit, Addition: My initial intuition for Mutt was to just use it for reading mails occasionally, and send attachments. But then, there is something more to it. There is no doubt that web-based clients are portable, but the problem is that almost all of them take their own loading times, when showing mails. Its not that this is wrong or unexpected, but when you have so many mails which you need to just browse for your reference, the time adds up. On the other hand, desktop based clients download these mails in the background, and provide you with a smooth and quick browsing experience. Very productive! So, I have decided to give Mutt a shot as my sole email client. It would be interesting to try it out for a couple of weeks, and see if it suits well. As it goes, I'll keep you posted on my experiences with Mutt.

Sunday, November 12, 2006

Printing beautiful code

While writing beautiful code is an art, printing it beautifully is a frustation. I've long been bugged by this problem, and interestingly Dr. Google has been silent about my query. So, here's my search results for the world:
Use enscript, which is installed by default on linux systems.
$ enscript --help
will show you a whole list of options to choose from. If you're as lazy as me, just rely upon the configuration which I found most useful:
$ enscript -2rGC --color -Ec code.c
The options passed along with what they do is as follows:
  • -2 : 2 columns. To have single column, you can use -1. Use --columns=NUM, if you want to specify more than 2 columns.
  • -r : landscape view.
  • -G : cool fancy looking header, which includes file name, page number and creation time.
  • -C : print line number in front of each line.
  • --color : colored output
  • -Ec : formatted using C syntax. Though enscript supports various coding syntaxes, which range from Java to Python to Tcl etc., it is not intelligent enough to understand which language is the code written in, so you need to pass this flag. For e.g. To get the code formatted using python syntax, use -Epython.
By default, the output will be sent directly to a printer. However, you can retrieve a postscript output by specifying '-p' flag.
$ enscript -2rGC --color -p -Ec code.c
That's it! Enjoy code reading!