jump to navigation

Ive moved January 3, 2010

Posted by razasayed in Uncategorized.
add a comment


Ive finally moved to a self hosted WordPress blog. My new blog address is http://blog.razasayed.com.

Cya around folks,
Have fun ! 🙂

Share folders between Windows host and Linux guest in VirtualBox September 15, 2009

Posted by razasayed in Uncategorized.
Tags: , ,
1 comment so far

1. Start the Linux virtual machine. If you have Guest Additions installed go to step 5 directly.
2. Click on the Devices menu and choose Install Guest Additions…
3. Now, run the following commands as root at the terminal.

 cd /media/cdrom0

Note: The VBoxLinuxAdditions.run file may be called VBoxLinuxAdditions-x86 or something similar on your system. So, please verify before you execute the file.
4. Reboot the virtual machine
5. From the Devices menu, choose Shared Folders… and add any folder or drive from your Windows host. Make sure that the Make Permanent checkbox is ticked . For example, add D:\VirtualBoxShared with the name VirtualBoxShared.
6. Now, on your Linux guest create the directory to mount your shared folder from Windows on. For example,say a user foo,wants to mount the shared folder from Windows on /home/foo/vbox_shared . So, on your Linux guest run the following command at the terminal.

mkdir /home/foo/vbox_shared

7. Now, we need to mount the shared folder from the Windows host i.e. D:\VirtualBoxShared on the folder in the Linux guest we created in the previous step i.e. /home/foo/vbox_shared . To do that run the following command as root on the terminal.

mount.vboxsf VirtualBoxShared /home/foo/vbox_shared

Note: mount and vboxsf are separated by a period.
8.But, there is a problem . If you now reboot the virtual machine, the shared folder wont be accessible, as the mount is valid only for the current session.So,to mount the shared folder every time your Linux guest boots, edit the file /etc/rc.local and put the following line at the start:

mount.vboxsf VirtualBoxShared /home/foo/vbox_shared

Voila !, you now have a folder shared between your Windows host and Linux guest with full read write access from each ! 🙂

Incorrect name resolution to in Debian Lenny while using DSL 502-T ADSL router August 9, 2009

Posted by razasayed in Hacks.
Tags: , , , , ,
add a comment

I was facing a strange problem in Lenny, wherein any websites i tried to access  from the console were resolving to .Because of this apt-get update was not working . Also, other applications requiring network functionality like the x-chat irc client were not working .

So, i did a lil bit of googling, and found that this had something to do with the handling of IPv6 packets by the DSL-502T adsl router which i use for my MTNL Triband service. Im not sure whether this was a problem with my adsl router,but what was happening was that the name resolution requests were going to my adsl router (, as it was the nameserver specified in /etc/resolv.conf, and it was incorrectly returning as the ip.

A temporary workaround i did was hardcoding the ip address of my repos listed in /etc/apt/sources.list and the irc servers, in /etc/hosts.

However, luckily enough i discovered a permanent solution , which would work for any website henceforth, and that was to use the free service OpenDNS .  Quoting Wikipedia , “OpenDNS offers DNS resolution for consumers and businesses as an alternative to using their Internet service provider’s DNS servers” .  What this means is , i could use the DNS severs provided by OpenDNS instead of passing the name resolution requests to my adsl router at

OpenDNS provides two DNS servers and . To use them i did the following.

Step 1) In  /etc/dhcp3/dhclient.conf , i uncommented and replaced

# prepend domain-name-servers;


prepend domain-name-servers,;

Step 2) Reboot
After reboot, i could see those nameservers added to my  /etc/resolv.conf as well . To confirm, i was using OpenDNS , i visited http://www.opendns.com/welcome .

Another thing,if you are facing issues with browsing websites in Firefox or Iceweasel, then from about:config just set network.dns.disableIPv6 to true and restart the browser.

If you still face any issues you can refer to http://www.debian-administration.org/articles/409

Hope this helps any Lenny users out there who might be facing the same problem .

Till the next post,
Adios 🙂

Convert Vi into a powerful Python IDE March 9, 2009

Posted by razasayed in Hacks, programming.

Below is a simple two step recipe for converting Vi into a full fledged IDE for python . Though there are numerous powerful features which can be added to Vi, to make it more powerful as an IDE, for simplicity’s sake and also to enable newcomers to easily get started with using some of these great features, im gonna share a couple of ways in which you can use Vi as a Python IDE.

These tips would enable you to get all those cool features like code completion , syntax highlighting , automatic indentation in Vi which would definitely make you more productive as a python hacker.

Step 1) For automatic code completion, download the pydiction plugin for Vi, from http://www.vim.org/scripts/script.php?script_id=850

Then, you need to extract this file into  your .vim directory. Assuming its in your home directory e.g.) /home/raza/.vim (If .vim directory does not exist create it), you run the following command from the location where you dowloaded the plugin

tar xvzf pydiction-0.5.tar.gz -C ~/.vim

To use auto-completion, simply press Ctrl-n or Ctrl-p , while in Insert mode.

Step 2) Now, add the following piece of code to your .vimrc file. This file is located either in your home directory or in /etc/vim.
If you dont want to risk messing up your existing .vimrc, you can create a backup of it, and create a new .vimrc file and then paste the following code in it:

[Note:] Dont forget to replace /home/raza/.vim in the code below with the location of your .vim directory

set nocompatible
syntax on
set showmatch
set ignorecase
set showmode
set ts=4
set sw=4
set autoindent
set smartindent
set number
autocmd FileType python runtime! autoload/pythoncomplete.vim
imap <c-space> <c-x><c-o>
:set backspace=2
if has("autocmd")
        autocmd FileType python set complete+=k/home/raza/.vim/pydiction-0.5/pydiction isk+=.,(
        endif " has("autocmd"

filetype plugin on
filetype indent on

" Mappings
nmap <C-N> :noh <CR>

Thats all there is to it ! . If you want to directly execute your program , without having to leave vi, then switch to command mode and execute the following command:

:!python <yourfilename>.py

There are more cool features like adding support for snippets, debugging etc that can be added to Vi, but maybe ill cover them in a later post.
If readers would like to share any more tips for customizing Vi for python development, then you are welcome to post them in your comments.
Hope this makes your python programming more productive and fun.

Happy Hacking ! 🙂

Launch your program from within Notepad++ February 22, 2009

Posted by razasayed in programming.
Tags: , ,

Notepad++ is a good editor for programmers, that supports multiple languages, and also has some other cool features like syntax highlighting, some basic intellisense etc.. . It is free and open source , but the downside is that its available only for Windows . However, it does work on Linux too, by using Wine. Notepad++ is a good alternative for people (especially those using Windows,on Linux  vi or  emacs  are the commonly used editors) who for whatever reason are not using full fledged IDE’s , and want a simple editor with some of the bells and whistles required for their programming work.

Recently, i discovered a cool feature supported by Notepad++, which i thought id blog about . How many times have we encountered situations where we write code in an editor and then switch back to the command line to execute it , especially if we are dealing with interpreted languages like perl, python , ruby etc..

Wouldnt it be nice if we could execute the program within the editor itself  ?. Now that would come in really handy . Would definitely save us some time and overhead involved in the context switch 😉 .

Guess what, Notepad++ being plugin based , has a plugin called NppExec , which allows us to do just that .  All you have to do is download it (assuming this plugin is not already installed)  , then after extracting the archive, place the dll in <Notepad++ Installation directory>/plugins .

Heres how to use it (assuming you are using python , and have the python interpreter installed on your system , however it could be any other language for which you have the corresponding interpreter installed)

Step 1) First type in your program and save the file

Step 2) Go to Plugins->NppExec->Execute (or press F6), and in command section type


$(FULL_CURRENT_PATH) , is a Notepad++ internal variable ,that contains the full path of the file currently open in the editor . There is a list of 10 such global variables here

Step 3) Now click on Save, and type a name for this script, so that we can use it again later on.

Step 4) Press OK

Voila, you can now see the output of your program in a console window in the editor itself ! .

Then again when you make some changes to your code, you dont have to go through all the above steps again, simply press Ctrl+F6, which is the shortcut for repeating the previous command.  To switch to a different language you can press F6 and select any other language for which you have saved a script.

Tip : If you dont want those extra messages that you see along with the output, just select Plugins->NppExec->No Internal Messages

Hope someone finds this useful,

Have fun 🙂

Python programmers can fly :) January 10, 2009

Posted by razasayed in programming.
1 comment so far

Heres a nice one from xkcd :).

Master Foo and Unix December 25, 2008

Posted by razasayed in programming.
Tags: , ,
add a comment

The Unix operating system has been greatly influenced by the Zen philosophy . A “Koan” is a puzzling, often paradoxical statement or story, used in Zen Buddhism as an aid to meditation and a means of gaining spiritual awakening.The  Rootless Root has some wonderful unix koans which is a must read . These koans would help you find the way. And, if  you mock at them you’ll lose merit and be reborn as beasts or MCSE/MCSD/MCTS etc 😉 . Here are a couple of samples .

1. Master Foo and the Graphical User Interface

One evening, Master Foo and Nubi attended a gathering of programmers who had met to learn from each other. One of the programmers asked Nubi to what school he and his master belonged. Upon being told they were followers of the Great Way of Unix, the programmer grew scornful.
“The command-line tools of Unix are crude and backward”, he scoffed. “Modern, properly designed operating systems do everything through a graphical user interface”.
Master Foo said nothing, but pointed at the moon. A nearby dog began to bark at the master’s hand.
“I don’t understand you!” said the programmer.
Master Foo remained silent, and pointed at an image of the Buddha. Then he pointed at a window.
“What are you trying to tell me?” asked the programmer.
Master Foo pointed at the programmer’s head. Then he pointed at a rock.
“Why can’t you make yourself clear?” demanded the programmer.
Master Foo frowned thoughtfully, tapped the the programmer twice on the nose, and dropped him in a nearby trashcan.
As the programmer was attempting to extricate himself from the garbage, the dog wandered over and piddled on him.
At that moment, the programmer achieved enlightenment

Heres one more 🙂 . Master Foo and the Script Kiddie

A stranger from the land of Woot came to Master Foo as he was eating the morning meal with his students.
“I hear y00 are very l33t”, he said. “Pl33z teach m3 all y00 know”.
Master Foo’s students looked at each other, confused by the stranger’s barbarous language. Master Foo just smiled and replied: “You wish to learn the Way of Unix?”
“I want to b3 a wizard hax0r”, the stranger replied, “and 0wn ever3one’s b0xen”.
“I do not teach that Way”, replied Master Foo.
The stranger grew agitated. “D00d, y00 r nothing but a p0ser”, he said. “If y00 n00 anything, y00 wud t33ch m3”.
“There is a path”, said Master Foo, “that might bring you to wisdom”. The master scribbled an IP address on a piece of paper. “Cracking this box should pose you little difficulty, as its guardians are incompetent. Return and tell me what you find”.
The stranger bowed and left. Master Foo finished his meal.
Days passed, then months. The stranger was forgotten.
Years later, the stranger from the land of Woot returned.
“Damn you!” he said, “I cracked that box, and it was easy like you said. But I got busted by the FBI and thrown in jail”.
“Good”, said Master Foo. “You are ready for the next lesson”. He scribbled an IP address on another piece of paper and handed it to the stranger.
“Are you crazy?” the stranger yelled. “After what I’ve been through, I’m never going to break into a computer again!”
Master Foo smiled. “Here”, he said, “is the beginning of wisdom”.
On hearing this, the stranger was enlightened.

And finally for all the programmers out there, The Tao Of Programming is a must read !

Thus spake the master programmer:

“It is time for you to leave.”

Windows mimicking Linux ? November 25, 2008

Posted by razasayed in general.
Tags: ,
1 comment so far

Came across this screenshot of Windows 7 . Doesnt the desktop bear an interesting resemblance to KDE 3 ?

Also , heres a screenshot of Windows PowerShell running on a Windows 7 machine . Linux users have always enjoyed a powerful command line and Windows PowerShell , is Microsofts attempt to provide a powerful command line interface to Windows . However,as the below screenshot suggests there seems to be more in common 😉

Online C compiler November 22, 2008

Posted by razasayed in Hacks, programming.

Sometime back i was at my friends place . He was preparing for some test and he showed me a complex looking C expression , and asked me what it would evaluate to . I told him what i thought would be the answer but anyways we needed to verify it .  He did not have a C compiler installed on his machine . But, luckily enough he did have an internet connection , and google came to the rescue .

There is an online C compiler available at http://www.delorie.com/djgpp/compile/ . It runs your program and gives the executable for download . Pretty cool and quite handy when we quickly need to check the output of some C program , but dont have access to a C compiler . Saves some time on downloading and installing one.

However, of course this wont work if you are using a GNU/Linux system, as the output is an exe . However, for those users gcc is just a synaptic away 😉

Microsoft giving away free software ! November 20, 2008

Posted by razasayed in general.
Tags: ,

Its been quite a while since my last post . Have been busy with college projects and presentation stuff . Well, now here is something interesting i came across . Microsoft has started an initiative called “DreamSpark” , which aims towards giving students all over the globe access to Microsoft software like Visual Studio 2008 Professional edition , Expression Studio , Windows Server etc, which usually costs a lot of money, absolutely free ! .  Let me point out that these are not the “Express Editions” which anyways microsoft has made available for free download , but rather the commercial versions . Bill Gates recently visited IIT-Delhi , to launch the DreamSpark program in India .

Even though i love to hack on and am a big fan of GNU/Linux,  Im not “anti-MS” , like the people i talked about in my earlier post .  I absolutely hate getting into all those platform wars, and bitching about MS and all other crazy stuff like that . But still i was wondering about the “sudden interest” of Microsoft to give away its software tools to the student community for free .

I mean Microsoft is a company which has been around for a long time now, and why is it only now that Microsoft wants to give free access to its tools to the students ? . Is this because of the growing competition from FOSS , which has become a really strong alternative to the MS platform , and which gives people a lot of “freedom”, in the true sense of the word, to explore and innovate ? .

Well, i would prefer not to answer these questions myself ,and keep them open to interpretation . Readers however, are welcome to express their views in the comments . Again, no MS bashing please, just thoughtful and honest answers 🙂 .