Archive for July, 2007

Bagel Success

Tuesday, July 31st, 2007

I think I have finally figured out how to make good bagels. Our neighbor has a friend whose husband loves to bake, and he makes bagels very frequently. What he does is to make up the bagels and then put them in the refrigerator for a day or two, until they rise and get nice and plump. Fortunately there is a refrigerator out in the garage, and I can just leave my bagels in there for a couple of days, out of sight and out of mind.

Also, since I tend to make my bagels with 50% whole wheat flour (you know, to be healthy and all), I thought that using bread flour instead of all-purpose (AP) flour could also have a big impact. Whole wheat flour has less gluten than AP flour, so it isn’t able to rise as well as AP flour. Bread flour, however, takes it to a whole new level, containing even more gluten than AP flour! This means the bagels can rise better and hold more of the CO2 emitted by the yeast.

These were the two things I tried for the last batch of bagels, and they were hands down the best I have made. Unfortunately, they were so good that I didn’t really get any pictures of the finished bagels. Anyway, I just need to make a few more tweaks to the bagel recipe and then I think it will be a winner. At that point I’ll try to write up a page and put it on my website.

The TDF Esplodes

Thursday, July 26th, 2007

Well isn’t the Tour de France getting interesting now. And here I was worried about it being boring. First Alexandre Vinokourov gets sacked for doping on the individual time trial, and his entire team Astana is kicked out of the race. Then Michael Rasmussen gets pulled from the race, by his own team Rabobank for lying about his whereabouts in the time leading up to the TDF - after wearing the yellow jersey for 9 stages! And now team Cofidis has been kicked out of the tour because one of their riders tested positive for testosterone use.

Personally I think this is all just great. The riders are completely mad about cheaters; they all detest Vinokourov and they completely distrust Rasmussen. The race administrators are putting the fear of god into everybody by imposing harsh penalties on whole teams when one person blows it. I don’t know if it’s accurate to say that pro cycling had the most athletes engaging in illegal performance enhancing practices, but they are clearly the most serious about getting things under control. The people in charge and the people actually in the race are equally committed to wiping out even the slightest hint of questionable behavior. This is great, and I think it’s the only way that pro cycling can have any chance of establishing a truly clean sport.

Plus, it makes all those flat stages much more interesting because you never know who is going to be left in the Tour each day, and it’s just fun to hear the commentators rant about doping and the athletes who have been caught.

Counting Bits

Monday, July 16th, 2007

This is an interview question I had at Microsoft, from when I was interviewing for my very first internship. That would have been way back in early 1996.

“You are given an integer n, and you need to write a function to count how many bits in n are set to 1.”

As most reasonably savvy programmers would do, I wrote a function that shifts n to the right, counting the times that the least-significant bit is set to 1, until n is 0. Something like this:

  int countBits(int n) {
    int count = 0;
    while (n != 0) {
      if (n & 1)
        count++;

      n = n >> 1;
    }

    return count;
  }

In general, this function will take O(b) time to complete, where b is the bit-width of n. This is fine; it’s a constant, so we are all happy with that.

But it turns out that there’s a faster way!

Question 1: Do you know what the faster way is?

Question 2: Do you know how it works?

I will admit up front that my interviewer showed me, way back in 1996, the faster way. But I just figured out how it works this weekend. :-)

(more…)

Powering the Planet

Friday, July 13th, 2007

This quarter’s Engineering and Science magazine has a really fascinating article in it by Nate Lewis, analyzing the problem of providing energy for the entire planet. Here is a link to a PDF of the article. Check it out!