Randomness at its best
Journey from a no one to a someone
Sunday, November 2, 2008
iFlow backend is going to be changed to Q, and the guys in New York have already started their part of work. Couple of weeks back, even I attended Q training just to find out that it is a manifestation of brain of a guy called Arthur Whitney. It is a highly complex language which is supposed to do all kinds of calculations superfast.
Jeff Borror did give us a lot of examples, told us lot of funny stories/incidents (some of them I believe are fictitious). My favorite one is the sudoku one of course .
So, there is this conference wherein people are coming up with shortest solution for a sudoku puzzle. Of course, the Perl guys were the first ones in line as they are famous in writing abstruse code and having sadistic pleasure looking at mortals trying to make sense out of it (after seeing the Q code, I have nothing against Perl guys doing this). Perl guys got their solution in 121 characters and were on the top of the world when Q guys came into the picture. The Q gods got their code down to just 99 characters and were ecstatic.
After all this, there came Arthur boy who managed to squeeze in the solution with just 57 characters, and a variety solutions saying something like "ok, this one takes 17 characters more, but is twice as fast"
I feel this is something very impressive. As I will be doing more hands on, I will be get to know whether my brain is meant to do this or not. They say this langauge is not really for object oriented brains which is exactly what I am.
There will be more on KDB+ and Q as I get my hands dirty with it...
Tuesday, February 5, 2008
GM to Microsoft
Now this is really amusing....
At COMDEX recently, Bill Gates reportedly compared the computer industry with the auto industry and stated, "If GM had kept up with the technology like the computer industry has, we would all be driving $25.00 cars that got 1,000 miles to the gallon."
In response to Bill's comments, General Motors issued a press release stating: If GM had developed technology like Microsoft, we would all be driving cars with the following characteristics:
1. For no reason whatsoever, your car would crash twice a day.
2. Every time they repainted the lines in the road, you would have to buy a new car.
3. Occasionally your car would die on the freeway for no reason. You would have to pull over to the side of the road, close all of the windows, shut off the car, restart it, and reopen the windows before you could continue. For some reason you would simply accept this.
4. Occasionally, executing a maneuver such as a left turn would cause your car to shut down and refuse to restart, in which case you would have to reinstall the engine.
5. Macintosh would make a car that was powered by the sun, was reliable, five times as fast and twice as easy to drive, but would run on only five percent of the roads.
6. The oil, water temperature, and alternator warning lights would all be replaced by a single "This Car Has Performed An Illegal Operation" warning light.
7. The airbag system would ask "Are you sure?" before deploying.
8. Occasionally, for no reason whatsoever, your car would lock you out and refuse to let you in until you simultaneously lifted the door handle, turned the key and grabbed hold of the radio antenna.
9. Every time a new car was introduced, car buyers would have to learn how to drive all over again, because none of the controls would operate in the same manner as the old car.
10. Oh yeah, and last but not least . . . you'd have to press the "Start" button to turn the engine off!
At COMDEX recently, Bill Gates reportedly compared the computer industry with the auto industry and stated, "If GM had kept up with the technology like the computer industry has, we would all be driving $25.00 cars that got 1,000 miles to the gallon."
In response to Bill's comments, General Motors issued a press release stating: If GM had developed technology like Microsoft, we would all be driving cars with the following characteristics:
1. For no reason whatsoever, your car would crash twice a day.
2. Every time they repainted the lines in the road, you would have to buy a new car.
3. Occasionally your car would die on the freeway for no reason. You would have to pull over to the side of the road, close all of the windows, shut off the car, restart it, and reopen the windows before you could continue. For some reason you would simply accept this.
4. Occasionally, executing a maneuver such as a left turn would cause your car to shut down and refuse to restart, in which case you would have to reinstall the engine.
5. Macintosh would make a car that was powered by the sun, was reliable, five times as fast and twice as easy to drive, but would run on only five percent of the roads.
6. The oil, water temperature, and alternator warning lights would all be replaced by a single "This Car Has Performed An Illegal Operation" warning light.
7. The airbag system would ask "Are you sure?" before deploying.
8. Occasionally, for no reason whatsoever, your car would lock you out and refuse to let you in until you simultaneously lifted the door handle, turned the key and grabbed hold of the radio antenna.
9. Every time a new car was introduced, car buyers would have to learn how to drive all over again, because none of the controls would operate in the same manner as the old car.
10. Oh yeah, and last but not least . . . you'd have to press the "Start" button to turn the engine off!
Monday, February 4, 2008
VB6 Deco
As the month of April is approaching, we are getting ready to get rid of VB6. Microsoft has announced that on 8th of April, they will be decommissioning VB6. That means no more microsoft certified support groups, no more hotfixes. Finally they are officially getting rid of something archaic.
We, in office are totally geared up in decommissioning the VB6 based apps. We started the whole getting rid of TFA a while back. That had nothing to do with VB6 deco. OMS deco in Asia was the main reason for doing that. It being a VB6 app is just going to fasten the process now. Anyways, we are almost there now. And we have taken PFA in the umbrella too. So more so, a reason to celebrate.
Actually, I am not very well verse with VB6/macros. I have never really done it. People say with macros you can do more than timepass programming. But I never got such a use case to apply my knowledge of macros, until today. Today there was a randomly color coded list of users in excel and I wanted to sort it colorwise. Now excel does not support sort by format menu. So I was supposed to write a macro to do that. But my limited VB scripting knowledge was a hindrance to that. I was actually contemplating about sorting the list of 150 odd users manually, which actually wouldn't have been such a big deal. A little donkey work..yea... but better than spending a lot of time figuring out 'M' of macro. Finally my manager wrote it to make it easier for me. I have to say he is a really good manager.
We, in office are totally geared up in decommissioning the VB6 based apps. We started the whole getting rid of TFA a while back. That had nothing to do with VB6 deco. OMS deco in Asia was the main reason for doing that. It being a VB6 app is just going to fasten the process now. Anyways, we are almost there now. And we have taken PFA in the umbrella too. So more so, a reason to celebrate.
Actually, I am not very well verse with VB6/macros. I have never really done it. People say with macros you can do more than timepass programming. But I never got such a use case to apply my knowledge of macros, until today. Today there was a randomly color coded list of users in excel and I wanted to sort it colorwise. Now excel does not support sort by format menu. So I was supposed to write a macro to do that. But my limited VB scripting knowledge was a hindrance to that. I was actually contemplating about sorting the list of 150 odd users manually, which actually wouldn't have been such a big deal. A little donkey work..yea... but better than spending a lot of time figuring out 'M' of macro. Finally my manager wrote it to make it easier for me. I have to say he is a really good manager.
Monday, November 5, 2007
Unlocking the Double Checked Locking
In my career of about 1 year in IT industry, I have faced almost all instances of double checked locking failing in case of singleton. Frankly, this is a good problem to have when you know what what is causing the problem and what is the solution... Well, until, your solutions start failing too. Here is my account on what can make singleton create multiple instances.
1) One can serialize a singleton just like any other object. But when you deserialize it, you will get a new instance of class every time because the reference to that object is null. There is a readResolve() method in dateFormat to get around this problem.
2) If your singleton class extends another class that supports cloning, your class also will be clonable.
SingletonObject clone = (SingletonObject) obj.clone();
In order to avoid this, add a clone method of your own in your singleton which throws an exception say cloneNotSupportedException().
3) There can be more than one instances of singleton if you use lazy initialization(neglecting synchroniztion). One should always use double checked locking along with a volatile boolean in order to avoid optimization done by compiler.
4) Multiple singltons might occur if someone subclasses your singleton. In this case if you have made constructor of your singleton protected, the sublclass might expose it making its constructor public. As instance of subclass is an instance of superclass, you will have multiple instances of singleton. To avoid this, always make constructor of singleton private.
5) When inside the constructor, a thread might take considerable amount of time to create an instance, by which time another thread might come, see a non-null instance and proceed with the half created instance. Another flag might come in handy here which you can set to true once the instance has been created. This boolean will be checked along with the null==instance condition.
Well... these are all I have come across so far. If you really don't want to get in this mess and simply don't care about the whole performance bit, simply synchronize getInstance() and you shall achieve what is intended.
1) One can serialize a singleton just like any other object. But when you deserialize it, you will get a new instance of class every time because the reference to that object is null. There is a readResolve() method in dateFormat to get around this problem.
2) If your singleton class extends another class that supports cloning, your class also will be clonable.
SingletonObject clone = (SingletonObject) obj.clone();
In order to avoid this, add a clone method of your own in your singleton which throws an exception say cloneNotSupportedException().
3) There can be more than one instances of singleton if you use lazy initialization(neglecting synchroniztion). One should always use double checked locking along with a volatile boolean in order to avoid optimization done by compiler.
4) Multiple singltons might occur if someone subclasses your singleton. In this case if you have made constructor of your singleton protected, the sublclass might expose it making its constructor public. As instance of subclass is an instance of superclass, you will have multiple instances of singleton. To avoid this, always make constructor of singleton private.
5) When inside the constructor, a thread might take considerable amount of time to create an instance, by which time another thread might come, see a non-null instance and proceed with the half created instance. Another flag might come in handy here which you can set to true once the instance has been created. This boolean will be checked along with the null==instance condition.
Well... these are all I have come across so far. If you really don't want to get in this mess and simply don't care about the whole performance bit, simply synchronize getInstance() and you shall achieve what is intended.
Labels: Tech
Wednesday, August 1, 2007
DB2 Explain
Recently I got to work on yet another interesting thing I always wanted to try my hands on. DB2 performance tuning. Haven't really worked on ANY database performance related tools. Started off with Visual Explain which is available from 8.x. It basically uses a bunch of tables wherein it will dump the performance related data which can be viewed graphically or through command line. (I don't have any idea how command line tool works)
Looking at the graphical display, you will come to know how is your query doing, where is it making use of indexes or just doing blind table scan, where it is doing nested loop join/hybrid join, the no of CPU cycles, I/O utilization etc. Depending upon the plan, you can tweak your query to make maximum use of indexes, MQTs, or maybe create temporary tables to reduce the onus on joins.
I was using control center instead of DBArtisan as query plan was not enabled on that. And control center is painfully slow (I am not sure if it is always slow or it is "Morganised". May be designing UI in java was a really bad idea) . Plus, DB2 9.x is fussy about the machines too. You need a 64 bit linux box to run that shit. I am not saying DB2 is all crap. But I can't find a decent tool to access it man. DBArtisan is really great once the connection is made. But it can die almost instantly while opening/doing select * from the toolbar (Again not sure if Morganisation has made it that way)
Sometimes I just wonder, now that database is one universal thing which is integral part of any moderate size application, why can't there be a decent access tool available. I have heard microsoft SQL server is really good. But who uses it. And its microsoft, come on, how good it will be. There will of course shortcomings. The name says it all!!
Waise.. I managed to bring down the timerons of a killer query from 51000 to 70. How cool is that for performance tuning!
Looking at the graphical display, you will come to know how is your query doing, where is it making use of indexes or just doing blind table scan, where it is doing nested loop join/hybrid join, the no of CPU cycles, I/O utilization etc. Depending upon the plan, you can tweak your query to make maximum use of indexes, MQTs, or maybe create temporary tables to reduce the onus on joins.
I was using control center instead of DBArtisan as query plan was not enabled on that. And control center is painfully slow (I am not sure if it is always slow or it is "Morganised". May be designing UI in java was a really bad idea) . Plus, DB2 9.x is fussy about the machines too. You need a 64 bit linux box to run that shit. I am not saying DB2 is all crap. But I can't find a decent tool to access it man. DBArtisan is really great once the connection is made. But it can die almost instantly while opening/doing select * from the toolbar (Again not sure if Morganisation has made it that way)
Sometimes I just wonder, now that database is one universal thing which is integral part of any moderate size application, why can't there be a decent access tool available. I have heard microsoft SQL server is really good. But who uses it. And its microsoft, come on, how good it will be. There will of course shortcomings. The name says it all!!
Waise.. I managed to bring down the timerons of a killer query from 51000 to 70. How cool is that for performance tuning!
Labels: Tech
Wednesday, June 13, 2007
Moxie
No... this is not about some food item, some pop start or a description of fancy new motorbike. This is the code name for flex 3.0.
Got a chance to attend a seminar by Prayank Swaroop the other day. He
is a java coder turned flex evangelist. Its really amazing to see the newer technologies coming up. There is ActionScript 3.0, AIR(Adobe Integrated Runtime, formerly known as Apollo), Advanced datagrid, improved charting and a lot more.
ActionScript 3.0 is a set of open source libraries now. Just download flash SDK and you will be ready to go along with notepad. At last people understand importance of open source for money making. But they are smart enough to charge IDE. AIR will enable you to run your programs as exe by just changing one property. Advanced datagrid makes the stuff so easy, those kind of things are a nightmare in .NET. This is just some of the new stuff.
My two pennies worth experience so far in flex tells me, it is a frikking hard language to code in. There is no good documentation available. No API so that method details will pop up when u code. I wonder why are they even charging their builder. This is the basic thing that a developer will ask for! On top of that FDS is so fussy about everything. It expects everything in very disciplined fashion. And sometimes it is so not obvious that you just wonder WHY. Agreed, I am just a rookie in flex. But trust me, it is irritating at times.
The only real problem with these upcoming RIA technologies is that the content is not supported by search engines. I guess the way these technologies are getting better and popular, they will make search engines change their way. Though there are some hacky ways to deal with this. I have even seen people putting the intended content in commented HTML tags just to appear in search results!
In spite of all the ranting, I have to agree, this has the coolest GUI available in market. Besides, when you know it well, you know it all.
Here is some flashy stuff...
Check out http://labs.adobe.com/technologies/
Looks Adobe has long way to go with flex.
Got a chance to attend a seminar by Prayank Swaroop the other day. He
is a java coder turned flex evangelist. Its really amazing to see the newer technologies coming up. There is ActionScript 3.0, AIR(Adobe Integrated Runtime, formerly known as Apollo), Advanced datagrid, improved charting and a lot more.ActionScript 3.0 is a set of open source libraries now. Just download flash SDK and you will be ready to go along with notepad. At last people understand importance of open source for money making. But they are smart enough to charge IDE. AIR will enable you to run your programs as exe by just changing one property. Advanced datagrid makes the stuff so easy, those kind of things are a nightmare in .NET. This is just some of the new stuff.
My two pennies worth experience so far in flex tells me, it is a frikking hard language to code in. There is no good documentation available. No API so that method details will pop up when u code. I wonder why are they even charging their builder. This is the basic thing that a developer will ask for! On top of that FDS is so fussy about everything. It expects everything in very disciplined fashion. And sometimes it is so not obvious that you just wonder WHY. Agreed, I am just a rookie in flex. But trust me, it is irritating at times.The only real problem with these upcoming RIA technologies is that the content is not supported by search engines. I guess the way these technologies are getting better and popular, they will make search engines change their way. Though there are some hacky ways to deal with this. I have even seen people putting the intended content in commented HTML tags just to appear in search results!
In spite of all the ranting, I have to agree, this has the coolest GUI available in market. Besides, when you know it well, you know it all.
Here is some flashy stuff...
Check out http://labs.adobe.com/technologies/
Looks Adobe has long way to go with flex.
Labels: Tech
Sunday, April 22, 2007
.equals() and ==
After writing buggy code time and again by wrong usage of .equals and ==, here I am writing about it.
Both check the equality, both return a boolean, but but but...
.equals() is for value equality while == is for object equality. To make it clear, .equals() checks if both the objects have same value and == checks if both objects point to the same memory location.
Make sure that you use the two correctly according to the needs. Its obvious that checking of non null values is to be done by == operator, otherwise for null conditions, it is sure to throw a null pointer exception. Also, if you are checking a concrete value with a variable, make sure the concrete value is the first variable in case of .equals(). That will save you from a few null pointer exceptions.
Both check the equality, both return a boolean, but but but...
.equals() is for value equality while == is for object equality. To make it clear, .equals() checks if both the objects have same value and == checks if both objects point to the same memory location.
Make sure that you use the two correctly according to the needs. Its obvious that checking of non null values is to be done by == operator, otherwise for null conditions, it is sure to throw a null pointer exception. Also, if you are checking a concrete value with a variable, make sure the concrete value is the first variable in case of .equals(). That will save you from a few null pointer exceptions.
Labels: Tech
Sunday, March 11, 2007
Google Vs Microsoft
Kinda unrelated comparison. But still, people love to talk about it. Its more like a religious issue for some. Well, I would like to join the party too!!!
I think as long as google doesn't come up with their OS, there is nothing to compare. But then also, if it is google, it will be open source. And frankly, there are very less tech savvy people on this planet who will say "ok... I am gonna download/install operating system on my laptop today". And when you buy a laptop, you will get windows with it. Because microsoft pays these guys. Dell is not going to give any open source OS on its laptops. Even if one fine day they decide to give google OS with their laptops, it is gonna take a while to uproot a giant which is already in business for 15 odd years. People are so damn used to windows and they love it. Microsoft knows how to make crap, and they know how to sell it!

How google makes money still beats me. Yea, I know its through advertisements. When people click on the link, google gets money. But there will be one day when these ad guys will realize that advertisements done through TV/radio fetch more clients as compared to online stuff. Really, how many people will be buying stuff through online ads. And even if it is large, as compared to microsoft who have a constant revenue generating product, its nothing.
But imagine this. Google n apple coming together. One is the king of online searches and the other is master of hardware. Together they can kick microsoft's ass... big time...
I think as long as google doesn't come up with their OS, there is nothing to compare. But then also, if it is google, it will be open source. And frankly, there are very less tech savvy people on this planet who will say "ok... I am gonna download/install operating system on my laptop today". And when you buy a laptop, you will get windows with it. Because microsoft pays these guys. Dell is not going to give any open source OS on its laptops. Even if one fine day they decide to give google OS with their laptops, it is gonna take a while to uproot a giant which is already in business for 15 odd years. People are so damn used to windows and they love it. Microsoft knows how to make crap, and they know how to sell it!
How google makes money still beats me. Yea, I know its through advertisements. When people click on the link, google gets money. But there will be one day when these ad guys will realize that advertisements done through TV/radio fetch more clients as compared to online stuff. Really, how many people will be buying stuff through online ads. And even if it is large, as compared to microsoft who have a constant revenue generating product, its nothing.
But imagine this. Google n apple coming together. One is the king of online searches and the other is master of hardware. Together they can kick microsoft's ass... big time...
Labels: Tech
Tuesday, March 6, 2007
IE sucks
Its just crazier at office... Because the microsoft guys have paid them, we are asked to make the apps IE compliant. The damn thing can't support CSS 2.1. Quite annoying. Everyone knows about the horrible track record of IE7 as long as security is concerned. Though the most irritating bit is easily the applications that refuse to work in firefox, RDP included!!!
When you google for "IE sucks", you will see a number of blogs dedicated to the topic. I am just adding one post. I feel like a non existing non entity thing.
Read this analogy online.
Internet Explorer == Microsoft Product,
Microsoft Product == Buggy & Insecure,
Buggy & Insecure == Poorly written.
Thumbs up to whosoever has written it!
Click here to see your browser crash if you are using IE.
Friday, March 2, 2007
Perl is a pearl
Attended the Perl Training given by George Ball... yes again! Perl is such a amazing language, known for its "expressional powerfulness" and very easy for a beginner to learn. Sometimes a task for which you will write 100 lines of code or a performance killing loop, can be written in perl in 2 lines. Perl cookbook, Camel book prove to be really good for reference if you have some scripting to do.
When you have really big number crunchings to do, perl sure is the thing to go for. Regular expressions make it so powerful. On second thoughts though, something like java can pretty much do everything that perl can. All languages aren't created equally. One's knowledge of a particular programming language will help him determine which is the best language to carry out a certain task and which one will fall short for them. One can extend this thought far more than programming language or even beyond computer matters!
Coming back to perl, if you want, you can write most mysterious program so much so that no one will be able to make head and tail out of it. There have been people trying to write most abstruse perl code (I believe some of them have been hired by our firm and I am having hard time comprehending what they are trying to achieve through a piece of code) Having said that, I am must admit, it is very much English language like, syntax wise. Writing a clean, humanly readable and understandable perl program should not be a big challenge as people actually have perl haiku contests... lol. I initially thought its just a joke. But there are so many of them available online!
Here is one that I found:
When you have really big number crunchings to do, perl sure is the thing to go for. Regular expressions make it so powerful. On second thoughts though, something like java can pretty much do everything that perl can. All languages aren't created equally. One's knowledge of a particular programming language will help him determine which is the best language to carry out a certain task and which one will fall short for them. One can extend this thought far more than programming language or even beyond computer matters!
Coming back to perl, if you want, you can write most mysterious program so much so that no one will be able to make head and tail out of it. There have been people trying to write most abstruse perl code (I believe some of them have been hired by our firm and I am having hard time comprehending what they are trying to achieve through a piece of code) Having said that, I am must admit, it is very much English language like, syntax wise. Writing a clean, humanly readable and understandable perl program should not be a big challenge as people actually have perl haiku contests... lol. I initially thought its just a joke. But there are so many of them available online!
Here is one that I found:
y? use Lisp? or C? ;I am not sure whats its output is though.
use less keystrokes, B::Concise;
bless Wall for our @perl
Labels: Tech
