VMWare - Simple communication between Host and Guest January 2, 2008
Posted by xk0der (aka Amit Singh) in : Tips and tricks , 1 comment so farRecently I’ve been working on a project which required VMWare as one of the component. As part of this project some sort of communication, albeit simple in nature,was required between the host and the guest machine.
Here are two simple commands, one to be run on host and one on the guest, using which you can pass simple information between the host and the guest virtual machine.
(single line command may wrap to next line … please note this)
Host machine commands:
Syntax:
$ vmware-cmd <path-to-machine.vmx> getguestinfo <variable>
$ vmware-cmd <path-to-machine.vmx> setguestinfo <variable> <value>
Example:
$ vmware-cmd /vmware-stuff/Ubuntu.vmx setguestinfo some_counter 12
$ vmware-cmd /vmware-stuff/Ubuntu.vmx getguestinfo some_counter
The first command, above, will set variable ’some_counter’ to value ‘12′ and the second one will fetch the value of ’some_counter’ on/from the virtual machine specified by /vmware-stuff/Ubuntu.vmx
VMWare typically identifies different virtual machines by their configuration files (.vmx)
To set/get info from other machine use the configuration file path of that virtual machine.
The above variables may be accessed on the guest (Virtual machine), in our case Ubuntu.vmx using the commands shown below (see example).
And yes! make sure the Virtual machine is powered on ![]()
Guest machine commands:
Syntax:
$ vmware-guestd --cmd 'info-set guestinfo.<variable> <value>'
$ vmware-guestd --cmd 'info-get guestinfo.<variable>'
Example:
$ vmware-guestd --cmd 'info-set guestinfo.some_counter 35'
$ vmware-guestd --cmd 'info-get guestinfo.some_counter'
Variables set in Virtual Machine (Guest) may be accessed on Host and vice-versa.
I tested this on VMWare-Server as it is free
… hopefully and very likely the same is applicable for VMWare-Workstation.
For more hardcore scripting, you may Use Perl-SDK provided by VMWare (On windows you may use COM-SDK).
Please leave comments if you found this info helpful (or even otherwise).
- xk0der
Like this post?xstress - xk0derz SMTP Stress Testing Tool November 15, 2007
Posted by xk0der (aka Amit Singh) in : Programming and software development , add a commentxstress is a tool developed by me, that allows users to stress test (their) SMTP Mail servers. The tool is pretty straight forward (and very simple too). It creates multiple connections to the mail server and pumps e-mail traffic on those connection. That’s it.
The good thing is that you can configure lots of parameter to simulate different kind of traffic, like virus traffic and spam traffic for instance.
You may use the links below to get sample (un-harmful) virus file and spam file respectively.
http://en.wikipedia.org/wiki/EICAR_test_file
http://en.wikipedia.org/wiki/GTUBE
The tool contains a README file explaining how to build and run it.
Complete source is available at the following link: http://sourceforge.net/projects/xstress
xstress Home Page : http://xstress.sourceforge.net
Hope this tool is useful to some ( or all
)
Good Design or Smart Engineering? May 30, 2007
Posted by xk0der (aka Amit Singh) in : Programming and software development , add a commentThis is one question that haunts (new) software engineers day after day.
We learned from the days of BASIC to Java and .NET that goto is an incarnation of devil itself, but we find goto in code written by the so called ‘elite’ programmers. What does this mean? Was all that computer science we learned a crap, of no use?
Well the answer is a surprising “yes”! Well a complete yes will be a bit too overboard
, but nevertheless, it is true to a large extent. From the little experience I’ve had as an software engineer and from what I’ve learned from the experience of the so called ‘elite’ programmers, Good design may not always be smart engineering.
What does this mean? Simply put, when writing code that will be used outside of the lab, in the real world, you should use the best possible solution. The best possible here refers to the solution which is faster, uses least number of resources and possibly adheres to other criteria that make your final code perform slick and cool stuff efficiently.
The above does not imply that you start writing obfuscated code! No, not at all. Read the above para again, the essence of engineering is producing efficient solutions not which are hard for other to understand, though this may result due to the efficient solution derived, but that is not the goal here. Science, or more specifically (in our case) computer science proposes ideal designs and assumes ideal conditions for those designs. In reality there is no ideal computer, no ideal processor and no ideal language and rarely do you get ideal conditions
So for the real world, when designing a solution, we need to take many factors into consideration. So a smart engineer will not be swayed away into the idealistic world trying to deliver an ideal solution. In the real world there are no thumb rules that one should (or would) follow blindly! These so called “thumb rules” are suggestion which may or may not apply to your solution.
Time is one of the major factors affecting the design of a solution. For companies to succeeded in todays cut-throat competition, it is not just the delivery of product that is important but it is the timely delivery that takes precedence. You would not like to fall behind your competitors, would you? So a solution that can be implemented in least possible time is at times the best, no matter how many rules of good programming design it may be breaking.
Engineers are not there to prove any scientific law or theorem, they are there to get things done, the most effective way!
Like this post?Apache 2 on Fedora Core 4 May 11, 2007
Posted by xk0der (aka Amit Singh) in : Tips and tricks , add a commentRecently while installing Apache 2 web server on a Fedora Core 4 machine, I ran into some very peculiar problems.
Apache would compile cleanly, install perfectly but when I would start the web server it would fail complaing about, failed to load shared library (some ldap and others).
After much hunting and googling, i found that it’s this SELinux (Security Enhance Linux) stuff that’s creating problems.
If you too have faced a similar problem, just switch off SELinux by modifying the file /etc/selinux/config (file path might be specific to FC4), and changing the line SELINUX=encforcing to SELINUX=disabled
URL Kick Toolbar April 9, 2007
Posted by xk0der (aka Amit Singh) in : Random musings , add a commentI’m writing this, because of the sad state of morality, in this open source era.
Everybody likes being credited for their work, but unfortunately (or otherwise) the people at URL Kick (http://urlkick.com) choose not to credit Ensparc, my previous company, for the toolbar that was created by myself while at Ensparc.
My previous company got this work from Rent-A-Coder and this task was assigned to me. People at URL Kick at said at that time, that ‘Ensparc’ can place their name in the credit, about which we were very happy. (Any one would be, for getting credited).
We’ll that’s past now, poor people at Ensparc, couldn’t survive just on open source and Rent A Coder. Anyways, I’ve moved on to a new company, Intoto and ‘am enjoying every-bit of it here (too).
Coming back to URL Kick, the first thing everybody will ask is, how can I claim that the FireFox tool was created at Ensparc? Here come’s the proof:
1) I had named the toolbar Hit-IT earlier
2) Comments in the source code
Well how do you verify the above proofs and claims?
Download the toolbar from here http://urlkick.com/extensions/urlkick.xpi
Rename the file to urlkick.zip, open with your favourite Archive Manager and browse through all the scripts, specially javascript scripts (.js files). Also notice the file names!
Well, in the end, all I would like to say is that, I hold no grudges against the people at URL Kick, but would really like them to credit Ensparc for their hard work and for their happiness.
Thanks,
- xk0der
Like this post?Number to Words Google Gadget December 6, 2006
Posted by xk0der (aka Amit Singh) in : Programming and software development , add a commentNumber-to-Words is my first experiment with Google Gadgets.
The gadget simply converts numbers written to words. For example “865″ will be converted to “Eight Hundred Sixty Five”.
The current version is specific to Indian counting system, although friends from around the world won’t find it too alien.
Here’s a screen shot

Click on the button below to add the Number to Words gadget to your Google personalized page
Like this post?Current URL in FireFox November 30, 2006
Posted by xk0der (aka Amit Singh) in : Programming and software development, Tips and tricks , 1 comment so farI required this while creating an extension for Firefox that bookmarked the current URL at some site.
After some hacking I found that the Address bar object that displays the current tab’s URL has the id set to ‘urlbar’
Following simple Javascript code accomplishes the task
var obj = document.getElementById("urlbar");
returns the reference of the address bar. Now you may use obj.value to get the URL text in the address bar.
There is a function implemented by FireFox named handleURLBarCommand(); that opens the current URL in the address bar in the current tab.
So the following code will open http://ensparc.com in the current tab.
var ub = getElementById("urlbar");
ub.value = "http://ensparc.com";
handleURLBarCommand();
Using handleURLBarCommand() function may not be the standard function to open URLs but Mozilla developer probably won’t rename it to anything else in the near future.
if you want to safeguard yourself from probable future modifications use the following method
var myHandleURL = handleURLBarCommand
// Now use myhandleURL wherever you
// were to use handleURLBarCommand
myHandleURL();
If they change the name, all you have to change is the first line, that’s it!
Hope this was helpful !
Like this post?How to pick a programming language June 19, 2006
Posted by xk0der (aka Amit Singh) in : Random musings , add a commentI happen to read this very interesting article by Tim Daneliuk
http://www.tundraware.com/Technology/How-To-Pick-A-Programming-Language/
I really don’t know if it will help anybody pick out the language of their choice, but the article makes a very good reading, specially if you like nerd humour.
C# and .NET will die! June 8, 2006
Posted by xk0der (aka Amit Singh) in : Random musings , 1 comment so farNot yet, but slowly!
They may rise to a certain level before they die, but they will!
Clarification
Before I continue let me clarify that this post is not about whether C# or .NET is a good technology or not; .NET might be very good concept coming out of Microsoft’s closet, but again popularity and sustainability of a language is not governed by a language being the best in terms of syntax or it’s robust compiler or the object code it generates and the like.
Desktop
For the desktop we already have a plethora of languages available, so C# might eat into that share but wouldn’t be able to dominate that domain. VB6 is far better in terms of development time and ease of code writing that the new VB.NET and C# for creation of desktop applications. And now that Microsoft has announced that their new OS, Vista, will have support for legacy VB6 and COM objects, there is no point for these developers to switch to something entirely different from what they are used to.
Let’s face it, still the majority of desktop apps written in .NET use the interop mechanism to interface with COM objects. And that’s not going to change any soon. This means extra burden for the programmer, interop is more of a workaround than a feature. Most of my peers have this to say about interop wrappers “When I can write do_this( ); to do a thing, why write do_this( ); do_that( ); do_this_too( ); do_that_too( ); now_using_something_else_do_what_I_want( );” Not a pretty thing to look at too!
Web
After the prospects of desktop apps being bleak for C# and .NET, the other arena where C# might try to fight a losing battle is the web! The reason it will be a losing battle is that there are already many scripting languages available for server side scripting and development. The other fact that Unixes and Linux Boxes are now becoming the first choice for web servers makes it even more difficult for .NET to survive. At least I don’t see, that, in foreseeable future windows will release a .NET framework for *nix boxes. There have been some attempts by some people and groups to create a .NET framework for Linux, but they have all not been a hit to the extent required.
PHP, Python and even Perl are the choice of programmers for server-side development. C# does not provide any uniqueness that the programmers will love to adopt, at least not on the surface level.
The final words
All said, programmers do not want to learn a new language just for the sake of the language being new. The new language needs to have that something “special” in to attract the masses. C# and .NET family of languages lack this very basic essence. They are essentially camouflaged Java!
Like this post?
Ruby @ Yahoo Groups June 5, 2006
Posted by xk0der (aka Amit Singh) in : Miscellaneous , add a commentYou may join the Ruby group on Yahoo here!

Click to join ruby-central