jump to navigation

Dying Democracy? April 10, 2008

Posted by xk0der in : In My Opinion, Random Musings , add a comment

I do not know what to make out of the ruling by Supreme Court (SC) of India with respect to the quota for Other Backward Classes (OBCs) in “IITs, IIMs and other Central educational institutions” the ruling adds that the SC “excluded the creamy layer from the benefit”. Here is the full coverage of the verdict at rediff.com:

http://www.rediff.com/news/2008/apr/10quota.htm

Who decides who belongs to the creamy layer of OBCs? How do they decide who belongs to the creamy layer? and why the hell do we need reservations based on castes/creed/religion/sects and the like?

Quoting from the article: “All judges favoured periodic revision on the implementation of the 27 percent quota.”, remember when the original constitution was drafted and the reservations were to last just for 10 years? What year is it now? 2008!

It is but clear, why after every five years the reservations policy is extended to yet another five year term. And every now and then new categories are added to the beneficiary list.

When will this vote politics end? Never!

What to do about it? Think beyond caste, think beyond they-me, think beyond their state-my region, Think beyond India, think Global, think Humanity!

Like this post?

Overcoming the fear of Python January 16, 2008

Posted by xk0der in : Programming , add a comment

As all C, C++ and Perl devotees, I too looked upon Python with apprehension. Python? What? I asked. The very idea of white-spaces being part of syntax gave me jitters and I convulsed with disgust. Why Python? Perl can do it. OOP? Perl has it … errm .. Kind of.

After reading numerous articles about python by putting the search terms “I hate pyton“, “python will die” and the like, I started getting a grasp of differences and likeness between python and other languages. One thing more I learned was, never be judgmental about a programming language if you have not used it. So after traversing threads at various forums related to “Love Python” and “Hate Python” I started understanding the various mumbo-jubo related to python. And then the thought occured to me, let’s give it a try. I downloaded python on my Windows XP machine at home and Vim for windows. Then jumped right into coding a problem that was asked to me in an interview. It was a design problem actually, but nevertheless a design can be implemented :) .

Within minutes I was automatically indenting code as I used to with C,C++ or Perl (or other free form languages I had used, for that matter). So the frown over mandatory white-spaces soon turned into a smile. And by the time I could realize I was finished creating a four road junction traffic simulator. I did searched the net for some reference, but the best thing was I just looked at the example and understood what it was, no reading what the code does or will do. Other syntax came so naturally that I didn’t even had to look online. That is I guess the beauty of Python.

In around half an hour or so, I had a complete running program in Python, using classes, random number, lists and other subtle features. The code was so readable, I thought, do I need some of those comments I’ve put in there? Some were required. But most of the time the code was itself very much self-explanatory.

Later I booted my laptop (it has FC7 installed) and copied the code on my Lappy. Python comes bundled with FC7 so I straight-away executed the code. Wow! … Its faster than windows .. Ha ha … yes this is what I noticed. Then I tinkered a bit more with the code, optimizing some things and learning new stuff in the process. Overall I enjoyed my first step into Python, very much.

I’m not going to shun C,C++ or Perl for that matter. For quick one-liners Perl is still the best. My domain is embedded systems and Linux Kernel programming so C and C++ are essential. But this discovery about Python has really give me an option. Option to create large and manageable programs in less time. They say in the python community, You spend more time solving the problem as you code and less time worrying about the language and its syntax. I Agree!

Like this post?

VMWare – Simple communication between Host and Guest January 2, 2008

Posted by xk0der in : Programming , 2comments

Recently 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 in : Programming , add a comment

xstress 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 ;) )

Like this post?

Good Design or Smart Engineering? May 30, 2007

Posted by xk0der in : In My Opinion, Programming, Random Musings , add a comment

This 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 in : Miscellaneous , add a comment

Recently 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

Like this post?

Current URL in FireFox November 30, 2006

Posted by xk0der in : Programming , 9comments

I 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 in : Miscellaneous , add a comment

I 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.

Like this post?

C# and .NET will die! June 8, 2006

Posted by xk0der in : In My Opinion, Random Musings , 4comments

Not 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 – *The* programming language June 4, 2006

Posted by xk0der in : In My Opinion, Random Musings , add a comment

I Happen to stumble upon Ruby lately, and this is one heck of a cool language!

You may say! Oh! no… I don’t need another language now! Probably most of us(the coder specie) have spent years on our favourite language(or not so favourite language?). And would certainly not like to plunge into yet another language. We’ve already got a bunch of them in our heads already!

But take my word! I too had the same apprehension, but after just spending ten minutes futzing with the Ruby interpreter … I had the same fun when I started learning QBasic during early 1990s. (Yeah!, you may try and guess my age from this fact!)

This language is simple, yet powerful. And as the creator intended it to be the language with “least-surprise”, it really has features that come intuitively to the programmer specie. I would surely recommend to all my programmer friends to give this cool new toy(or weapon!) a try!

Here are some links to get you started

Ruby Tutorial
http://www.math.umd.edu/~dcarrera/ruby/0.3/chp_01/first_steps.html

Download Ruby (Homepage)
http://www.ruby-lang.org/en/ (English version)

Ruby on rails
http://www.rubyonrails.org/ (a web development framework for ruby!)

Interview with the creator of Ruby (Yukihiro Matsumoto ~aka~ Matz)
http://www.artima.com/intv/ruby.html

Ruby on wikipedia
http://en.wikipedia.org/wiki/Ruby_programming_language

I Hope these links will get you started and most importantly interested in this serious yet fun (to code) language.

Obviously, I’m not getting converted (from *my* language to this new one) but I’m surely enjoying every bit of code I write in Ruby!

Regards
– xk0der

PS: I would love to receive comments about new members who join the force!

Like this post?