Saturday, December 23, 2006

across two hours

Recently I moved from Minnesota to California. I took the opportunity to see U of S by road. After spending 48 hours behind the wheel of my toyota corolla, I traveled across 9 states and 2 timezones to reach the sunny state. The journey was full of memorable experiences, mainly the variety of landscapes that drove past me. The first day through Iowa, Missouri, Kansas wasn't very eventful. I enjoyed the ride down the I35 with lots of podcasts on my iPod. In Oklahoma city the route turned westwards along I40. Texas, New Mexico, Arizona and finally California were rich with variety of terrains.

Here are some of the moments ...

... It was the evening of the second day. I was heading west through Texas on the endless road that was going through an empty landscape. Sun was about to set on my left below the southwest horizon. The brightness of the sky was dimming slowly. The gray grass on both sides of the roads was now shining in the orange light, which looked even redder through the tint of the upper edge of my sunglasses. Most of the sky was clear except for few clouds. They looked like some careless finishing strokes on an otherwise clear painting, put by the artist while cleaning up his palette. Suddenly I became aware of the stink in the air. It was hard to see on the left against the setting sun. But soon the source of the stink was visible - huge cattle farms. At a distance ahead where the road made a curve, sun's rays reflected from several speeding trucks creating an illusion of orange squares hurrying towards the horizon. The drive felt more calm with John Mayer's 'Continuum' in the background ...

... It was in Amarillo, TX. I was 100 miles tired after my last gas stop. There wasn't any bypass for this city, so I decided to continue on I40W through the city. It was 5 in the evening, the rush hour for the city's commuters. I was in left most lane at 65 mph. All of a sudden the SUV about 15 feet in front of me glowed its red lights. Within fraction of a second slight smoke was visible around its tires and it came to a screeching halt barely avoiding to bump into the car ahead of it. Now it was my turn for a near-to-impossible halt. Assuming there was no one on my right I suddenly turned into the right lane and then adjusting the speed as soon as possible. Fortunately the assumption was right. But the moment left me totally drained off all energy. An exhausting moment ...

... I was planning to reach phoenix on the second night, but it seemed impossible when I was good 300 miles away from Arizona border itself and it was already pitch dark. With shorter milestone in my mind, I started for the last leg of my second day journey. As I mentioned, it was pitch dark, so I had no idea if there were mountains on the sides or just miles of plain dry desert. From my experience with the terrain so far it was flat empty space. Another proof of that was very strong winds. That's what made this segment of drive one of the difficult ones and also a memorable one. A '02 Toyota corolla is not that powerful a car, and that becomes evident when you are driving it up a steep slope. (Later in California I verified this when I couldn't keep up with the aggressive traffic in the mountains) But here in New Mexico it was miles of level road. But yet I could not push my car beyond 60 mph at times. I suspected there was something wrong with the car. To make it worse, I was only surrounded by behemoth trucks that could push their way to 70+mph (the limit being 75mph, they could hurry). Sometimes I could push the car beyond 70 and overtake group of 4-5 trucks, but then later on when I couldn't keep up above 65, they would pass me. Switching places with heavy trucks in such a way is annoying in a long journey. When they pass you or you pass them, there is some action in air pressure that needs your concentration on the wheel. It is tiring after a while. And it needs more effort in such heavy winds. What made this 3 hour drive memorable, was the presence of that enormous force of the wind with no visible signs. With the windows closed there was no indication of this force. This force only showed itself in the RPM meter and the speed dial in front of me and occasionally in the irregular swaying of the trucks around me. Hell of a windy moment ...

... On last day I started very early in morning. I had to cross Albuquerque, NM first so, I started around 6. That plan worked out pretty well. Next 3 hours of drive and I entered Arizona, had red mountains at distance on both sides of the road. The sun was rising from behind. The peaks and troughs of the mountains were so smooth, they looked like orange red cover sheets covering the mannequins in a fashion store, that was yet to open for the day. These sheets had dull green spots in the form of sparse tiny bushes. Oddly enough it was so cold, some snow was visible on both sides of the road ...

... The dusk on the last day had fallen and I had just come out of Mohave desert heading down I15 towards Los Angeles. I was getting my first few glimpses of california traffic. The I15 comes form Las Vegas and leads into Los Angeles while passing by San Bernardino. Just before San Bernardino the freeway runs down a big mountain. And it is one steep joy ride. Before the steep slope starts there are several cautionary signs for vehicles to check their breaks. Once the downslope starts you feel like one sitting in one of 100s of toy cars glowing their red tail-lights gliding down the curves at the speed of 65 mph. Even when you are in an enclosed car, in your mind you feel the wind in your face. As you descend down the mountain, you see San Bernardino city glowing with thousands of lights. In the dark dusk the hundreds of speeding cars look like, a stream of light points trickling through the mountain peaks heading to meet a huge lake of light. After that race down the mountain it is literally a breath-taking view ...

It took 6-7 hours along I5 north from Los Angeles to San Jose. This last stretch was about pushing the envelope. It had been 20 hours of continuous driving with momentary stops for gas or food. I was desperate to reach at the final destination. The last hour was particularly worse. I chose to take a small highway to switch from I5 to Hwy 101. From the available map it wasn't clear how long this highway was. It turned out to be the worst drive in entire journey. It was a 26 miles of road, going through pitch dark woods and hills, completely ill-documented - without any milestones telling how far is next main road, with no exits to anywhere at all, remote from cellular phone signals, with dense fog at places allowing only 10 feet visibility in some parts. I had really pushed myself to limits at the point, the car felt like just another extension of my body now. Fortunately I had had a cup of coffee so at least I wasn't sleepy. I was afraid I had missed the 101 exit and was leading towards pacific. Fortunately it wasn't true and after 45-50 minutes I successfully came out of those woods and back to civilization with 4 bars of T-mobile.

I concluded my journey at around midnight.

Needless to say, the whole journey was a memorable experience. It left me with an interesting feeling though...

... I had only "seen" all these places. I felt like, a lifetime is too short a period to experience what each of these towns, terrains, farms, roads, woods, hills, people would "feel" like. There is so much to do, so much to see, so much to learn and I am so tiny a part of it. How insignificant one's own worries are when compared to such a huge world. Aren't they?

Friday, December 01, 2006

What I read...

Recently I have been reading news/blogs through many different channels - Google Alerts, Google Reader, digg, del.icio.us, slashdot, plus website hopping. So when I try to recall where did I read particular piece of news, very likely I don't recall. That's what happened today at a friend's place.

But still I will keep using them...

I have added a new window on this blog page in the right panel - titled 'What I read ...'. This is Google Reader's cool (this adjective is now a cliche when used with Google) tool, which will post some top N blog posts that I decide to share from my Google Reader. So you can read what I like to read. ... just another way to solve the problem I mentioned before.

Monday, November 20, 2006

How do I backup to Amazon S3 storage service

All of today I spent putting together all the tools to do an incremental backup to the Amazon S3 storage service.

Amazon is a good brand and providing storage as service is very good utility. But I was not very happy by the fact that Amazon has tried to reinvent storage with this web service. Web Services are a good interface for remote inter process communication. But why do storage operations like function calls. Anyway, cheap cost of the offered storage and good brand were enough for me to pursue it as my backup solution.

I spent whole evening setting up different tools that provide front end for S3 service. The most useful tool would be a NAS server that provides NFS/CIFS mounts and does S3 transactions at the backend. However it was hard to find any such direct tool. As of today there are many under-development or beta scripts written in perl, python, ruby, java. I gave a shot to few of them, but they weren't very handy for solving my simple backup solution. JungleDisk is very good frontend tool for S3-service. It gives WebDAV frontend interface (again why WebDAV and not NSF?) and it's available for all platforms. It is good if your needs are manual access to this storage. It is difficult to treat WebDAV URL as a drive so that a backup utility can write to it just like any other local drive. I investigated lot of options, NFS-to-WebDAV bridge, WebDAV CLI clients which can be called by backup scripts, but there isn't a great solution for all platforms. My current need is Windows desktop backup. Finally I got 'S3Drive'. It mounts the S3 storage as just another drive on your windows box. This was gr8 for my current needs. One thing to note - JungleDisk does not show the files stored by other front end tools to the same S3 bucket - it didn't show the files stored by S3Drive. There are some other tools however which show objects stored by other tools as well, e.g. S3Safe.

So storage is ready, now the backup software. I was using EzBack-it-up. But after reading through its docs, I realized that it is very dumb in doing incremental backups. I had considered WinRAR some time back as backup option, but didn't get its archiving logic. After reading thru some documentation and its CLI options I figured out a way to do incremental backups. When its CLI tool is run with -ao option it "adds files with Archive attribute set". With -ac option it "Clears Archive attribute after compression or extraction". Thus "rar a -ao -ac backup.tar " will backup only the files that have changed since last backup (unless someone else changes the archive flag - I need to check with my CVS tools for this). So I got incremental backup tool.

How to enforce policies and schedules. CronForWindows solves schedules problem. I spent better part of an hour on very minute problem. Being alergic to BATCH files I couldn't find a programmatic way to create the unique target tar file name that will have timestamp embedded in it. I tried running bash script using cygwin, but backslashes and/or '%' symbols in date command format caused problems. I thought of writing quick java code, but thought that wasn't really quick. So I decided to give python a shot. After half an hour I came up with following script:

from datetime import date
import os

today=date.today()
today_str = "%s%s%s"%(today.month,today.day,today.year)
command = 'rar a -ac -ao'+'b:\e%s'%today_str+'.tar'+' c:\workspace\project'
os.system(command)

I had to put rar.exe in one of the directories in PATH, but it worked. The Cron scheduler can run this script as per the schedule I set.

I have few MBs of source directory that I need to backup. I expect its contents to change under an MB per day. Looks like pretty good deal with cheap prices of S3 service.

Friday, November 10, 2006

Stranger than fiction

I saw this movie today. I don't know if it's a good movie or a bad movie. It's not about that. It certainly made me write about it.

Warning: If you have not watched this movie, don't read further. Go watch the movie and read this post later. You have been warned.

The movie creates an unusual plot, quite unlike anything that has been tried before (at least in my limited knowledge). The pinnacle of the story is the point where the professor (Dustin Hoffman) reads the ending and tells Harold that the end is worth dieing for. The speech that the professor gives to Harold, opens numerous possibilities in which the story can end. Not to mention, this is also the most dramatic point in the whole film. It creates lots of expectations from the finale.

Now I thought that the director/creator of the film lost his grip of the story after this pinnacle. When actually the fatal climactic accident happens in the movie, it doesn't live up to the expectations the professor created about it. It may be poetic, sad and heartbreaking as described, but it certainly is not worth dieing for. This is where the film looses the chance of being extra-ordinary.
..... But wait I haven't finished yet.

Now let's assume that the ending of the story was something really fascinating and worth dieing. (That's a detail after all - or is it). So in the movie, the author of the story decides to sacrifice this fascinating ending of the story for a mundane one, for saving the life of a good soul - a moral decision with fitting justification.

What baffles me is the recursive nature of this movie. Let's say what I said initially is true - that the movie goes downslope after creating lot of anticipation. So the author inside the movie settled for a mundane ending for moral reasons. Is that the same reason, the director of the movie also decided to make a simple easy ending? Was this recursion intended by the creator of the movie? Because if it is, then that's really amazing - the effect is created by coming out of the movie (I hope you understand what I mean by this sentence, I can't explain it clearer).

... Anyway if I could work on this art form, I would try to think of more intriguing ending for this movie than the traditional ending it has. As I said, the plot reaches a hilltop from where it can take numerous paths to conclusion. Sadly it takes the regular bitten road down the hill.

Wednesday, November 08, 2006

Gas prices... seems like big scam

I told my friends last weekend that I am gonna fill my tank on the day before election, to avoid the gas price hike that will follow once elections get over. I was little serious though at the back of my mind. But I did fill my tanks on Monday.

I was astonished to watch the gas price change on election day however. In the morning I saw the rate of $2.07 per gallon. It did not wait even for the last voter to cast his vote before rising to $2.29 in the evening. I was dumbfounded. Moreover I don't see this as a news this morning. I searched google news for gas prices, but no one seems to register this fact. There are news that industry rate will go by 4 cents or something in some parts. What I observed was a quarter per gallon. By filling in 10 gallons of Monday I saved $2.5. Are the local gas station owners hiking the prices on their own? Who knows!?

Anyway I am glad I verified my theory (and saved couple bucks too).

Thursday, September 28, 2006

Another nice quote

I don't know much poetry... but I can see the beauty of this quote:

In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite.
Paul Dirac
English physicist in US (1902 - 1984)

Saturday, August 19, 2006

Hilarious nerd comment

Read this in a Register article today. Most hilarious nerd comment I heard lately:[context - the reporter was at LinuxWorld conference where he saw a FreeBSD booth]

"When I approached the FreeBSD booth, my first question was, "So, what's FreeBSD doing here at LinuxWorld?" Without losing a beat, the FreeBSD guy responded, "Actually, in an alternate universe, I'm attending BSDWorld and there's one Linux booth. However, my transporter malfunctioned 'cause it was running Linux, and so here I am." Best nerd one-liner I've heard at the show. "

Read the full story at http://www.theregister.co.uk/2006/08/19/linuxworld_virtualisation_techs/

Sunday, August 13, 2006

Programming & Painting

Surely Computer programming is an art like painting or sculpturing [1]; Painting is two dimensional, Sculpturing is three dimensional, we have yet to find out how many dimensions are involved in creating a beatiful piece of software.

Monday, May 15, 2006

Troy

Liked this quote from Troy. As Achilles says:
"I'll tell you a secret......something they don't teach you in your temple. The gods envy us. They envy us because we're mortal. Because any moment might be our last. Everything's more beautiful because we're doomed. You will never be lovelier than you are now. We will never be here again. "

Saturday, April 22, 2006

If Harry Potter were a computer hacker ...

Rebellion, that makes him the Chosen One, is the quality that Harry Potter seems to share with a computer hacker. So I cannot resist the temptation to see HP's adventures through a computer geek's spectacles.

The idea came to me from Marauder's map and the difficulties Harry faced while finding Malfoy on that map. I wished so strong to suggest Harry to write a simple script (in some magical languages they might have) so that he could write a simple search engine for finding any desired person. After all it was another clever prankster before him who must have put together few magical things together to make that Marauder's map. (I am sure they must be having MagicSoft in their world - but that would cost many galleons to them). Also Harry must have learnt something from the muggle Map sites about the zooming facility they had added. I felt sorry for him when on that sizable map he had to see all the names in the school moving around.

Room of Requirement is a very interesting design pattern. Primarily it is a Factory design class. It creates variety of Room objects to suit the user's requirements. The implementation however is little fuzzy to me. One of the confusing things is its ability to maintain state and moreover its ability to restore that state to the user without any visible mapping using UIDs etc. To elaborate, Harry hides his Half Blood Price potions book in the Room that this RoR generated for him. The fact that one can hide things in these Room objects and can retrieve them later makes it necessary for the Room to maintain state. If RoR generates new Room objects every time then how would it know when to open an old Room object according to the wish of the user. So there should be a unique ID in RoR's database that maps the Room instance to a User and his/her Wish. But I doubt if this magical RoR factory pattern does so. I highly suspect that it's a factory that just picks up Rooms from persistent physical rooms and returns them to the user. That way it makes sense when the same room opened for Prof Trelawney and Malfoy in HBP. But then it remains unexplanied what is RoR's behavior when a user wishes some room with extra-ordinary requirements that physically might not exist at all. Will the RoR throw an exception in such case? NonPracticalWishException ? :)

Being the chosen one, Harry Potter has knowledge of some advanced languages that could help understand Dark viruses spreading in Magic cyber world - for instance Parselmouth (I wish they had named the script language as Parselmouth rather than Python :)

Excuse me if this was a complete torture for you. If you didn't think so, let me know how did you like it!

Cheers!!!

Wednesday, April 05, 2006

Gentoo, XGL, HGG

These are the things to talk about from last month. Gentoo is a hacker's distribution. It is for the bravest of hearts. Starting from a bare minimum installation (aka portage), it lets you build the system of your choice. The package management tool 'emerge' is more powerful than yum/apt. It allows you to build the source code of the application you want to install (with USE flags). I found the power of this feature when I installed Xgl with it. In fact Xgl being available on Gentoo was one of the reasons to try Gentoo. The building of Xgl, compiz window manager and other libraries with opengl support was very customizable because of the emerge's USE flags. Xgl being still an alpha software, this facility for tweaking proved very helpful.

Xgl is a new desktop rendering technique that uses graphics card's support for opengl. Most of the new graphics cards by Nvidia and ATI support OpenGL in hardware. Xgl (and Redhat's Aigl something) are linux window management tools that give very rich desktop effects. I was stunned to see a demo video of this and couldn't work with my old desktop till I got Xgl installed on them. The wobbly windows, opacity of windows, workspaces on the sides of a cube, all these things put the day-to-day computer access to a new level. Users of MAC will find this stuff familiar. But I am sure that having this thing in open source will show up very innovative results in not so distant future. After looking at this I really felt Microsoft sucks. They have very pathetic traditional window management. I hope vista at least tries to leverage some of OpenGL in hardware stuff. Delay of Vista is a whole new blog topic in itself.

Hitchhiker's Guide to Galaxy has been my latest read. I finished two Harry Potters before this. HGG is so "hatke" (or offbeat) ! I am totally amazed how can a person think so abstract and absurd things. I haven't yet decided if I liked this book or not. The shear distinctness of this book is appealing. Besides, it is a collection of many humorous quotes, that is something I am sure I like :)

Apart from this, Xen has been a main occupant of my mind for past couple months. But that's serious matter - 'll save it for some other time.

Friday, March 10, 2006

Henry Ford

Long time, no post. So today I am going to post this quote I just read. So true...

"All Fords are exactly alike, but no two men are just alike. Every new life is a new thing under the sun; there has never been anything just like it before, never will be again. A young man ought to get that idea about himself; he should look for the single spark of individuality that makes him different from other folks, and develop that for all he is worth. Society and schools may try to iron it out of him; their tendency is to put it all in the same mold, but I say don't let that spark be lost; it is your only real claim to importance."
Henry Ford

Thursday, January 19, 2006

VI - A capable IDE

Among the tools software professionals use 'vi' can be considered most geeky (read cooooooooool) tool. People using *nix based systems for development settle for xemacs or more modern editors/IDEs. vi seems to be a preference of system administrators or people who do more of configuration stuff than only writing and compiling code. This is because vi is very handy and fast tool (no GUI launch like xemacs). One of the reasons for vi being less popular in many developers and more popular in geeks is its very compact and hence hard to learn keyboard commands.

I was an xemacs guy, but 3 years back at a job I had to learn vi, because everyone else used it. I learnt it with very difficulty. Later on I found the h-j-k-l key combo as an alternative to arrow keys and realized how one can browse a text without moving their palms from the center of the keyboard. That's when I started loving vi.

Lately I use ONLY vi for all kinds of editing. But I have also used eclipse, Visual studio in the past, so I know what great is in IDEs. IDE's give you different tools that you need for software development in one single application - multiple windows, build window, execution window, cross referencing, source code highlighting, integrated debugger and many other useful plugins. Over time I have found all these features in vi.

I learnt how to use multiple windows. Switching windows in vi is a tricky dance of fingers, but once you learn it you do it unknowingly. One very useful feature of modern IDEs is folding. They parse the source code and allow you to fold the source code at different nesting levels. In case of C, C++, Java, that would be done using braces. Considering vi is totally a text window tool, the way vi developers have achieved this folding effect is remarkable. You have to give a bunch of commands though before achieving this. But I now have defined macros for these commands and at a hit of a function key I can collapse a huge C/C++ source file in screenful of folds. This feature gives a comfort in browsing through the code, because it essentially summarizes the code. (One thought - If you fold the code of a C++ class implementation file, then what you see is more or less the interface of the class)

In past few days I got to try some of the advanced features of vi. Vi's latest version lets us import a cscope database file in vi. That way you can browse through a source tree using cscope from the comforts of Vi. An Explorer plugin of vi gives you one special window that you can use to navigate through your directory structure. One can also integrate vi with a debugger. I however haven't got time to look at that, mainly because it's of little use in my particular environment as my development machine and test machine are always different and have different platforms.

The most versatile feature that I find most interesting is a support for shell in a window. Unfortuanately I read that this is not integrated by vi development community as part of vi. So I had to download a private patch and build a patched vi of a little old version and use it. Regular vi lets you run shell commands, but while doing that your vi disappears from the screen - I don't like that. I always wanted to execute shell commands in a little window in a corner bottom, so that I can kick off my build process in that window and watch the compilation errors right besides the source code. This is a very versatile feature, because using it you can have a super customized window that you can use for compilation, execution or file browsing. A little inconvinience is that, the patched vi for vimshell is only a little old, but it is old enough not to have cscope support. And I did not find vimshell patch available for latest vim 6.4. But that's just a minor issue.

The following two links should let you do all these things that I have described above:
[1] Vim documentation help - This is the bible of vim
[2] The VIM-Shell

Sunday, January 15, 2006

New blog

From yesterday, I have started a new blog. It's a hardcore technical blog.

varlogdmesg.blogspot.com

Check it out!!! (but you have already been warned)

Safari Bookshelf

O'Reilly's Safari bookshelf is a great aid for people learning computer programming/ network administration. You can seach through their database of books to find the book that you want and if the preview of the book's chapters looks like what you are interested in, then add this book to your bookshelf to have full access to it. You can fill your bookshelf with such books. There is a limit on the size of bookshelf and it is proportional to the subscription fee. They have 14 day trial period as well if you want to try.

I started using it from yesterday and I must say it is very useful. Currently I am trying to learn about linux networking tools. Oreilly has THE useful books for learning such stuff and as you read through chapters the cross reference links they suggest under 'Additional Reading' give you wholesome learning experience.

This is worth the money. It gives 5 slot bookshelf for 10$ a month. The only catch is you cannot replace a book on the shelf until 30 days. But I feel that's fair game. The quality of Oreilly books is worth the cost of this tool.

I think this is an innovative example of how a modern library or an online book store should be.