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.

Monday, December 12, 2005

funny geeky quote

During a disussion on Xen-users mailing list, I found this piece of text from Eric Johansson. It is very amusing geeky humoros quote: "yes, I tried the debootstrap route and sat there watching in childlike wonder as it presented me with a rainbow of failures. Left me muttering something about rocket club open source projects as I am often given to doing lately."

On an independent issue, while just logging into blogger.com I realized that the animation on its login page causes firefox to stammer on a linux machine. I say 'stammer' because the username-password I punch gets batched and appear abruptly later.

And firefox users! Try Aquatint - a fantastic new theme!

Sunday, December 11, 2005

Ease of Linux 2.6 and Virtualization

During thanksgiving I built from the linux 2.6 source tree and realised how easy it has become to install a linux kernel from the source. 3-4 make targets and you have new kernel deployed in /boot/ with grub.conf neatly updated. Maybe because I had tough time with many experimental kernels in the past, I am finding this ease of installation surprising.

And in past 2-3 days I had a similar experience with new version of Xen - Xen 3.0. Although I heard that 'yum update' in Fedora Core 4, would install the latest Xen for me, that hadn't worked for me few months back. So I had shelved it for a while. After learning about new release of Xen, I decided to build xen 3.0. Similar to Linux 2.6, the building and installing of Xen 3.0 is very smooth. I however had first hiccup when running 'xend'. It was because of some version conflicts in some libraries, because I still had old FC4 Xen on my system. Ian Pratt precisely pointed that out on xen-users mailing list and that fixed it. Now I can run xend and tried to fork new virtual machines. I am now having problems with the file-system of my init ramdisk. Not giving ramdisk makes the VM hang at one point. I need to figure put the booting process through init ramdisk in detail to resolve this isssue.

It is amazing to know that with Intel's new VT (Vanderpool) and AMD's pacifica processors, Xen can run Windows XP unmodified. As I understand it these new hardwares will be adding a new protection level (remember those protection rings from 0 to 3 in 386 architecture?) for the VMM's hypervisor. I found it amusing that x86 architecture gave us 4 protection levels to work with and most of the OSes use just 2 of them - as for linux 0 for kernel and 3 for user programs, yet for the hypervisor technology, they needed an additional protection level outside this range. It seems that Intel VT have started shipping, but read somewhere that they are early test versions. AMD pacifica are due in early 2006. I was wondering should I wait till pacifica comes out to build my new desktop. But may be they will be early unreliable versions and probably pretty expensive. And I can't wait to play NFS most wanted, till the hardware virtualization technology stabilizes.

And yes... yesterday I tried these two firefox plugins - GSpace and Gmail notifier. GSpace finally gives a working tool to store your files on internet using your gmail account. Besides this... how can I forget del.icio.us? It has solved my long pending problem of having unified bookmarks. I use firefox/opera on windows/linux on my home/office machines. So that gives me 8 bookmark lists to synchronize. Lately I had given up synchronizing them. But with an account with del.icio.us, I can save them on internet and can access from any machine/browser/OS. They also have an import tool which I figure will allow me to import my existing bookmarks into it. No need to say, I will be spending more of my time in coming week to find new plugins around del.icio.us. :)

Xen, GSpace, Del.icio.us - When I started writing this post, I wasn't finding any common theme for this post. But now I have one - Virtualization. These three pieces of software - miles away from each other in terms of their execution domain - highlight a single trend that will reign the information technology now - 'Virtualization'. Xen virtualizes hardware from the operating systems so that multiple operating systems can run on a machine simultaneously and a single instance of operating system can be dispatched to other hardware on the fly. GSpace achieves storage virtualization by storing the files on a practically omni-present media called 'Gmail'. Del.icio.us works on the same lines by hosting our bookmark lists on some web server.