Tuesday, November 3, 2009

Friday, June 26, 2009

Saturday, June 13, 2009

Pair Programming

What Pair-Programing is Not

-misko hevery

Let me tell you about Arthur, the last developer which joined us for a month, and how productive he was. Arthur showed up on Monday at 9am. I sat down with him behind his computer and said, “Let’s get you up-to-speed.” I made sure that he was driving, and I was talking and we started installing all of the software which he needed to develop code. The compilers, the database the IDE, checking out the code from the repository and running it. The key here is that Arthur was doing all of the work and I was just telling him what to do. By noon, he was up and running, thanks to a very intensive hand-holding from me. We went to lunch and talked about the application, not in general terms but in specific terms which Arthur could translate to what he did few minutes ego.

After lunch, I said let’s go and fix a bug. I picked a simple bug and for the most part again i was doing most of the talking but made sure that Arthur had the keyboard and understood what, and why he was doing things. By 3 pm we had a fix. We ran all of the tests, and submitted the code. We watched the build to make sure we did not break anything.

This is pairing, and it is exhausting! By 3 pm I was beat and went home, but Arthur stayed to play some more with the code. Turns out he fixed another bug on his own before he went home. Not bad for first day. Now I could have fixed the bugs myself in 1 hour flat both of them, but than Arthur would not learn anything. I sacrificed my productivity to make Arthur productive in a single day. If I did not it would take Arthur weeks before he would figure out how to set everything up how things worked and enough courage to fix a bug. Yet that is exactly what most companies do. Think about the confidence Arthur had on day one working with us. He was up and ready and he fixed two bugs on day one. WOW!

More importantly is what we did not do. We did not get distracted by checking email. How can you, you have a single monitor, and that means that Arthur would read my email. Arthur did not waste time looking for documentation which is poor or does not exist, he was spoon fed the knowledge in the most efficient way, and he did it all by himself, i was just talking, he was typing. It is amazing how much more focused you are when you have two people working on something.

Tuesday, April 14, 2009

Seeking help from Statistician

Suppose I have distinct samples of a cumulative density function at 0.01, 0.25, 0.5, 0.75, and 0.99 obtained from an interview. I can provide some constraint that the 0.01 point is not "too close" to the 0.25 point and similarly for the 0.99 and the 0.75 points.

I need to interpolate between the given points.

Now, of course there is not a unique interpolation, but I guess there is a maximum entropy interpolation that is in some sense closest to a Gaussian. I wonder how I would find out what it is.

Secondly, I would like to find distributions of the sum of two such distributions. I am imagining a Monte Carlo method would work, but if there is a closed form, so much the better. It needs to be reasonably computationally efficient and either available as a Python package or relatively easily programmed and tested. 

Thirdly, similarly for a product of two such distributions.

If there is not a closed form, I need a way to take samples of the distribution from Python. It's not hard for me to construct a method that is crudely correct in the sense that the biases are unlikely to matter for the purposes at hand, but it seems someone ought to be able to tell me how to do better.

It would be nearly hopeless for a small traffic blog like this to get an answer by itself, but I wonder if Twitter isn't going to prove useful for scientists to answer questions of this sort. So I've tweeted a call for assistance and pointed to this posting. It will be very encouraging if I get a useful response; I have little hangups like this one all the time.

Monday, April 13, 2009

Python float input validation

If you put 'nan' in as a string, a cast to float will not raise an exception.

I am not sure this is a good design, but the counterintuitive workaround is this.

To test if a Python float is not a number, see if it is equal to itself!
try:
....val = float(raw_input("Air speed of an unladen swallow: "))
except:
....print "foo"
if val != val
....print "foo also!"

Thursday, April 2, 2009

Turing Test Passed; Humanity Obsolete

@LizNeeley tweets:
A reverse image search engine - upload a pic, find where it came from, modified versions. Still in beta, but incredible. http://tineye.com


So I submitted this image, stolen for my main blog from Tom the Dancing Bug here.



I wanted to see if tineye could find the original, but it outdid me, and came up with this from
here: a different clip from the same strip of the same size and shape!

Google chat bug: Majitao

Who is Majitao?

Thursday, March 5, 2009

Buckminster Fuller Tweet

When I am working on a problem, I never think about beauty but when I have finished, if the solution is not beautiful, I know it is wrong.