Posted by
Pete McBreen
20 Apr 2010 at 22:11
How SQLite is tested makes interesting reading about the process and techniques used for testing the database. The ideas from this system could probably be usefully applied to other systems that we need to be reliable.
Posted by
Pete McBreen
08 Apr 2010 at 23:25
Just who is pulling the strings?
the real story is not the relationship between science and the media at all. It’s the story of how the media has been completely taken in by a third group, a third culture, consisting of ideologically-driven, pathological liars, who will say almost anything in order to score political points, and will smear anyone they regard as an opponent.
Krugman has written about Building a Green Economy
If you listen to climate scientists — and despite the relentless campaign to discredit their work, you should — it is long past time to do something about emissions of carbon dioxide and other greenhouse gases. If we continue with business as usual, they say, we are facing a rise in global temperatures that will be little short of apocalyptic. And to avoid that apocalypse, we have to wean our economy from the use of fossil fuels, coal above all.
Interestingly Krugman didn’t write much about James Hansen’s proposal for a tax and dividend to cut down on CO2 emissions. James Hansen is against the Cap and Trade for reasons he explains very well. Hansen also has a paper that shows pictures of what cold winters used to be like - when the Niagara falls could freeze.
What we need is an approach that addresses the fundamental fact that keeps us addicted to fossil fuels: they are the cheapest form of energy, provided their prices do not have to include the damage they do to human health, the environment, and the future of our children.
For the sake of the people, especially young people, there should be a rising price on carbon emissions. The price should rise at a known economically sensible rate, so that businesses have time to plan their investments accordingly. The money collected should be put in the hands of the public, so they are able to make the purchases necessary to reduce their carbon footprint.
Posted by
Pete McBreen
07 Apr 2010 at 17:00
Selection with Replacement
Had a problem when testing something that did random selection from a large pool that was showing more duplicates than expected. When sampling out of 500, we were seeing duplicates very frequently. Turns out it was the birthday problem - in a group of 23 people, there is an even chance that two or more people will share a birthday.
Amazing part of this problem is that even doubling our sample to 1000, after just 40 tries there is a better than even chance that we will have a duplicate.
Formula is as follows, for a sample size of n, with m selected,
percentage chance of duplicate is n!/((n-m)! * n power m)
Code below shows this using irb, first off with the standard birthday numbers (just to check the formula) and then with the sample size of 1000
irb(main):001:0> class Integer
irb(main):002:1> def factorial
irb(main):003:2> (2..self).inject(1) { |f, n| f * n }
irb(main):004:2> end
irb(main):005:1> end
=> nil
rb(main):006:1> (365.factorial * 100)/(342.factorial * 365**23)
=> 49
irb(main):007:0> (1000.factorial * 100)/(960.factorial * 1000**40)
=> 45