29 April 2012
27 April 2012
Life Imitates An XKCD Cartoon, Hilarity Ensues
Seen on StackOverflow:
Clearly, this employee comes from a long lineage of people who were destined to break poorly glued together computer systems.
How can I pass the string “Null” through wsdl (SOAP) from AS3 to ColdFusion web service without receiving a “missing parameter error”?
We have an employee whose last name is Null. He kills our employee lookup app when his last name is used as the search term (which happens to be quite often now).
Clearly, this employee comes from a long lineage of people who were destined to break poorly glued together computer systems.
18 April 2012
I Love Lucy Almost As Much As I Love Successful Optimization Efforts
I've had a good couple of days.
This started a couple of days ago, when I became aware of a rather serious performance problem in some code that I help maintain. This problem exhibited itself on a busy production machine with lots of users. Solving this problem was Very Important.
At this point I started gathering data, trying to answer the question "where in the code are things going bad?".
After many hours of data collection, I analyzed the data and got a sense of the general neighborhood of the problem. I looked at the code in this area and thought about what was really going on in this area of the code. Eventually, I had a mini-epiphany: I realized that the algorithm I was looking at was (in a non-obvious way) actually an O(N) algorithm, and that I could probably replace it with an O(1) algorithm.
So, I rolled up my sleeves and implemented that O(1) algorithm I had in mind. After doing all of the testing that I could think of, I installed the new code on the production machine.
Like I said, this code was running on a production machine with lots of users. It didn't take long for the traffic load to ramp up. I'm pretty happy with the results: before my new code was installed on the production machine, this four-CPU-core machine had a 15-minute load-average of around 12.0 . After my updated code was deployed on the machine, the 15-minute load-average dropped down to 3.0.
Fifteen-minute load-averages of ~12.0 on a four-core machine remind me of a certain scene from "I Love Lucy". I'm glad I was able to help solve this problem without having to acquire some new hardware....
This started a couple of days ago, when I became aware of a rather serious performance problem in some code that I help maintain. This problem exhibited itself on a busy production machine with lots of users. Solving this problem was Very Important.
At this point I started gathering data, trying to answer the question "where in the code are things going bad?".
After many hours of data collection, I analyzed the data and got a sense of the general neighborhood of the problem. I looked at the code in this area and thought about what was really going on in this area of the code. Eventually, I had a mini-epiphany: I realized that the algorithm I was looking at was (in a non-obvious way) actually an O(N) algorithm, and that I could probably replace it with an O(1) algorithm.
So, I rolled up my sleeves and implemented that O(1) algorithm I had in mind. After doing all of the testing that I could think of, I installed the new code on the production machine.
Like I said, this code was running on a production machine with lots of users. It didn't take long for the traffic load to ramp up. I'm pretty happy with the results: before my new code was installed on the production machine, this four-CPU-core machine had a 15-minute load-average of around 12.0 . After my updated code was deployed on the machine, the 15-minute load-average dropped down to 3.0.
Fifteen-minute load-averages of ~12.0 on a four-core machine remind me of a certain scene from "I Love Lucy". I'm glad I was able to help solve this problem without having to acquire some new hardware....
09 April 2012
How Not To Iterate
I can't believe that I am currently devoting serious brainpower into rewriting some code that I got from ${third_party_vendor}. The code sort-of looks like this:
The hilarious thing about the code that I am dealing with is that everything is a bit more complicated than this toy code, and that the original programmer(s) seemed to be dimly aware of the problem here ("gee, why don't all of the expired objects get removed from the "list"?). But...instead of fixing the problem correctly, they built some crazy scheme in this area of the code to address the problem.
Of course, the "scheme" that was developed in this case is also buggy. So, my task is to rip out all of this insane code and try to ensure that no crazy side-effects are triggered when the code in this area is actually run correctly.
Who writes code like this? Arrrrgggghhhhh......
import java.util.*; // This class defines an object that, for whatever reason,
// can expired over time. When this object has expired,
// it can be removed from the system. class SomeObjectThatCanExpire { private boolean expired = false; public boolean getExpired() { return expired; } public void setExpired(boolean e) { expired = e; } } ..... class StupidArrayIterationTest { public static void main(String argv[]) { int i; ArrayListal = new ArrayList (); for (i=0; i<10; i++) { al.add(new SomeObjectThatCanExpire()); } ....time passes.... // remove all expired objects from the system // (unfortunately, this code is incorrect) for (i=0; i < al.size() ; i++) { if (al.get(i).getExpired() == true) { al.remove(i); } } } }
The hilarious thing about the code that I am dealing with is that everything is a bit more complicated than this toy code, and that the original programmer(s) seemed to be dimly aware of the problem here ("gee, why don't all of the expired objects get removed from the "list"?). But...instead of fixing the problem correctly, they built some crazy scheme in this area of the code to address the problem.
Of course, the "scheme" that was developed in this case is also buggy. So, my task is to rip out all of this insane code and try to ensure that no crazy side-effects are triggered when the code in this area is actually run correctly.
Who writes code like this? Arrrrgggghhhhh......
01 April 2012
Perhaps certain social networks should give a complimentary "I like to be stalked!" t-shirt to their members?
Ewwww.... This is creepy.
However, it is also unsurprising. It is easy for anybody with decent reasoning skills to be able to see that this is just the logical consequence of what happens when people share so much of their information with social networks whose entire purpose is to learn more about you....and then to make this information available to other entities...
I think that this is one of the best points made in the article:
This is an app you should download to teach the people you care about that privacy issues are real, that social networks like Facebook and Foursquare expose you and the ones you love, and that if you do not know exactly how much you are sharing, you are as easily preyed upon as if you were naked.As someone who cares deeply about security and privacy issues, I hope that this app serves as an effective wake up call.
Subscribe to:
Posts (Atom)