Alienated Effects
Controversial computing made easy in few steps...
2011-04-06
2011-02-23
Height of programming
If you know how to sell, you can sell sand in Beach
Telecommunications market has seen its best days in 90's. But in today's cut-throat market, this age old adage seems to be fitting just perfect in this sector.
Back at my previous job, I would manage the lab using some perl scripts which would run for about a few minutes and then produce a list of devices and their status. The logic here would be simple. I give a set of IP addresses to the script. Then the script would look-up a small CSV file to see if the IP Address is a known address and if so, it would directly use the appropriate protocol to figure out the status of the device. And if could not be identified, do a port sniff and try to do some guess work. My manager never bothered to know anything more than a device's working status and its usability. The script did just that and I used to think this is how most large/real telecommunication network setup would do their management and I was completely convinced that some administrtors may have, over years, added some cute looking GUI to it.
Well, let's say its more of a pipe dream than reality.
Now comes the grand crux. Can you believe that there is a Product which actually does this?! And ridiculously this product has a market too!
This wierd product actually stores .jar files into a database table as a BLOB. During runtime, these jar files are retreived from the database and pushed into some cache directory from where they are ClassLoader.findClass(...)'ed with the help of a manifest XML. The original developers might have as well patented this technology. Performce related tickets on this would not surprise me.
Hell! This product is an abuse to the cutting-edge engineering at various processor laboratories across the world.
2010-11-01
Link-Monkey: Windows finally...
It took a several drops of blood, sweat and tears to accomplish that. Firstly, I was doing things all wrong. Secondly, I should have done parallel development by testing each small piece of code on both platforms before pushing it in.
A small comparison on how Platform object would contain on both platforms:
Terminal Data
-------------
Username/ID = Administrator
VM Version = 0.0.1 - 20101101
System Name = Windows
Version = Microsoft Windows XP Professional Service Pack 3
System Release = 5.1-2600
Architecture = x86
Host-FQDN = hcube
CPU = Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz
Cores = 2
Memory Total = 2086612992
Memory Free = 1184010240
Swap Total = 584269824
Swap Free = 4013883392
Process Count = 71
Up Time = 10560921
Terminal Data
-------------
Username/ID = gorilla
VM Version = 0.0.1 - 20101101
System Name = Linux
Version = #41-Ubuntu SMP Thu Aug 19 01:12:52 UTC 2010 [Ubuntu 10.04 LTS]
System Release = 2.6.32-24-generic
Architecture = i686
Host-FQDN = hcube
CPU = Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz
Cores = 2
Memory Total = 2051399680
Memory Free = 193531904
Swap Total = 267378688
Swap Free = 267341824
Process Count = 266
Up Time = 3939570
Source code to this was checked-in on sf.net and can be seen via git browser.
Based on this output, it seems a default build of Ubuntu will have a little over 250 processes and has just about 184 MiB free memory, while after running Symantec and even Louts Notes with Open Office running on Windows the memory available is still over 1 GiB and only about 71 processes. Despite all this very high memory usage, Linux is still more responsive than Windows. Food for thought!
By the way, source code of this platform.js is:
#! /usr/bin/monkey
stdout.writeLine("Terminal Data");
stdout.writeLine("-------------");
if (Modules.require("Platform")) {
stdout.printf("%-15s = %s\n", "Username/ID", Platform.userID);
stdout.printf("%-15s = %s - %s\n\n", "VM Version", Platform.vmRelease, Platform.vmBuild);
stdout.printf("%-15s = %s\n", "System Name", Platform.systemName);
stdout.printf("%-15s = %s\n\n", "Version", Platform.version);
stdout.printf("%-15s = %s\n", "System Release", Platform.release);
stdout.printf("%-15s = %s\n", "Architecture", Platform.architecture);
stdout.printf("%-15s = %s\n\n", "Host", Platform.nodeName);
if (Platform.hasExtendedData) {
stdout.printf("%-15s = %s\n", "CPU", Platform.cpu);
stdout.printf("%-15s = %s\n", "Cores", Platform.cores);
stdout.printf("%-15s = %s\n", "Memory Total", Platform.memoryTotal);
stdout.printf("%-15s = %s\n", "Memory Free", Platform.memoryFree);
stdout.printf("%-15s = %s\n", "Swap Total", Platform.swapTotal);
stdout.printf("%-15s = %s\n\n", "Swap Free", Platform.swapFree);
stdout.printf("%-15s = %s\n", "Process Count", Platform.processCount);
stdout.printf("%-15s = %s\n", "Up Time", Platform.upTime);
}
}
2010-10-29
Plaining Generation
It is always funny to see code that migrates from a super-set source language to a sub-set of it. In other words, it is really entertaining to see how a C language code slowly migrates into C++. It is even more entertaining when FSM states are written in C while their handlers are written in C++. And the best of it all, which takes the cream of the crop, is when documentations have missed impacts. Who peeps into the bottom of an ice-cream cone when there are two layers of topping above that to lick?
When terse Architecting documents apparently forget subtleties for the sake of brevity, the code sings evil raphsodies from the grimoire of what was enciphered by the masters. And when you are at it you will have two choices: Work indefenitely or quit.
It takes courage, determination and a prejudiced inclination to feel come-what-may to modify such a code. And it takes one more step closer to the edge to check-in the code and tag it. And when it all bunrs down, it give birth to another bug, opened in a tracker, with a short palnned-fix date and a neatly crafted e-mail to the managers mentioning the complexity of further soiling the code. Never forget to mention that testers will have a field day (and night) testing your code. It was once told to me by an elderly man that we pay for the sins of our ancestors.
I realised that there is no point in whining and weeping and slapping breasts to make a point. They know that they know nothing, but we do not know we know nothing. A great master once told me that water flows over the rocks and so the former is stronger than the latter. I corrected him. I said "smarter". He was enlightened. And I quit.
Link Monkey: A Windows Paradigm
I have finally compiled SpiderMonkey and NSPR4 on Windows. It took me ages to realise that the libraries should be compiled using /MT and /MTd options on MSVC++ 2008. Somewhere in a certain file in js/src directory, I found that it defaulted to use /MD or /MDd option which links the code to the dirty sick MSVCR90.dll or MSVCR90d.dll file and the annoying message that MSVCR90.dll was not found and that reinstalling will "take care" of it.
Finally, I can now continue testing on Windows...
Only now, it hangs in JS_CompileFileHandle(...) function, damn it! And the funny shit part is that I don't have the liberty of using Debuggers. Right now, the 'msdbg' says there are no debug symbols in it, which is way more annoying than compiling it.
Let me see that too.
Maintenance Programs
He views your code through a toilet paper tube. He can only see a tiny piece of your program at a time. You want to make sure he can never get at the big picture from doing that. You want to make it as hard as possible for him to find the code he is looking for. But even more important, you want to make it as awkward as possible for him to safely ignore anything.
Programmers are lulled into complacency by conventions. By every once in a while, by subtly violating convention, you force him to read every line of your code with a magnifying glass.
You might get the idea that every language feature makes code unmaintainable — not so, only if properly misused.
Refactoring is a most emotionally-satisfying activity. It is second only to sex. Your own inchoate intention suddenly shines through with blinding clarity.
2010-10-23
Vowel Parsing
This is about a time somewhere ca. 2006 when I was learning database. I came upon some blog elsewhere which was basically a tutorial about using Hibernate (java based ORM layer). The discussion was about overriding default behaviour with a small POJO which can be used to translate table names to class names. It was a very interesting thing and I caught upon it pretty quick.
The idea was to remove vowels and then remove consecutive repeating characters from table names so that it becomes difficult to people reading the DB directly. The code for example did something like this to a table named "class_schedule_t". First it removes the vowels from it, so the name now looks like this "clss_schdl_t" and then removes consecutive repeating characters from the name making the final name look like "cls_schdl_t".
I was so attracted to this philosophy that I caught on this habit to make variables smaller too in my day to day programming. I even went as far as signing mails with my name shortened to "-nd"!