Sunday, April 27, 2008
2008 Presidential Election Poll
Sunday, April 20, 2008
Range Voting Application
Sunday, March 23, 2008
SuperDuperApps.com
After several attempts to get Google to index my server at home on my DSL (using a dyndns.org hostname, of course), I decided I needed to set up a more "legitimate" host. So, I bought a VPS instance at BuyAVPS.com for $9.99 a month so I could mess around with my own Ruby on Rails apps.
I tried to use some of the pointers I got from The Principles of Beautiful Web Design, which I finished reading last week, and ended up with a logo and welcome page that I can actually be proud of! Ok, so it's not much, but now I have a home for StampCalculator so people can actually discover and use it.
Thursday, March 6, 2008
Werewolf: Kill the quiet people!
Monday, March 3, 2008
Improbable Truths in Ruby
The following statements are all true in Ruby 1.8.6:
0.6 - 0.5 < 0.1
(0.29 * 100).to_i == 28
0.28 * 100 != 28
(0.28 * 100).to_i == 28
(0.27 * 100) == 27
Well, what can I say? Floating point errors in Ruby can really bite you. I had always thought higher precision numbers were necessary only when dealing with very small numbers or when computing compound interest, but look out! Ruby floating point can really bite you with some strange, unexpected results. It makes me wonder why Matz included a to_i method at all!
Saturday, March 1, 2008
Weird Floating Point Problem in Ruby
irb(main):001:0> 0.5-0.4
=> 0.1
irb(main):002:0> 0.5-0.4<0.1
=> true
irb(main):003:0> ((0.5-0.4)*10)
=> 1.0
irb(main):004:0> ((0.5-0.4)*10).to_i
=> 0
irb(main):005:0> ((0.5-0.4)*20).to_i
=> 1
irb(main):006:0> ((0.5-0.4)*20)
=> 2.0
...well, this certainly violates the principle of least astonishment, but I guess the lesson is that I should be using values in terms of pennies (ie, integers not floats).
Sunday, February 24, 2008
Misconceptions about diet and exercise
- "Going on a diet" is a good way to lose weight.
- If only I could exercise more, I could lose weight.