Aug
31
2008
Every time I have doubts about how safe flying is, I think to myself:
It is not from the benevolence of the pilot that I expect not to die after crashing into a mountain, but from the pilot’s regard to his own interest.
It amazes me how this line of reasoning seems to never enter into the minds of those whose fear of flying is so great that they simply refuse to board planes. It is as if they genuinely believe that the pilot, who flies many times each week, is not concerned with keeping himself alive.
I suspect the only relevant criterion for selecting potential pilots is an estimate of their disposition to suicidal behavior.
no comments
Aug
30
2008
Until today I’ve felt that, at this point, Leopard has been patched enough to be relatively bug free. While transferring files across my home network today I changed my mind, because I found that the number of files left to delete that’s shown in progress dialogues can become negative. You can see what I mean below:

And just to make clear that the first number isn’t a one-time fluke, here’s another shot of the same progress dialogue a second later:

I’m not entirely sure what caused the negative count: most likely it was the very large number of small files that had to be deleted. I’d bet that the number was originally underestimated when the delete operation began, and that, when more files were found later, this took the count of remaining files beyond 0 into the negative integers.
Personally, I find this a little worrisome.
no comments | posted in Mac OS X
Aug
29
2008
My friend Harek and I were recently discussing the obvious and not-so-obvious reasons why both Amazon’s Kindle and Amazon’s considerable repertoire of e-books are not available for sale outside of the U. S.. I noted that there are many legal hoops one must go through before selling a product in the countries of the European Union, and that these hoops were likely sufficient to explain Amazon’s choice of first entry markets.
While reading “Blown to Bits,” this suspicion of mine was reinforced by the following passage:
National and state borders still count, and count a lot. If a book is bought online in England, the publisher and author are subject to British libel laws rather than those of the homeland of the author or publisher. Under British law, defendants have to prove their innocence; in the U.S., plaintiffs have to prove the guilt of the defendants.
This tidbit relating to the differences between American and British libel law is exemplary of a general pattern: American products are often not available in Europe because American businesses fear the unfamiliar and sometimes incomprehensible laws of European governments. If Europeans want freer access to American goods, they will need to make sure that they will not punish Americans for selling goods that they can sell without fear in the States. In the opposite direction, but following precisely the same pattern, American children will have access to Kinder Eggs and other wonderful European products just as soon as America repeals some of its excessive child safety laws.
2 comments | posted in Law
Aug
25
2008
I generally take the strong consequentialist position that a person who causes A, which later causes B, must be held accountable for B, regardless of whether that person intended to cause B. In short, I broadly claim that factual casuality is moral responsibility.
Therefore, if you stop your child from being vaccinated, I would assert that you are directly to blame for the possible death of your own child and also for the possible deaths of any and all children infected by your child. Moreover, if you advocate refusing vaccinations, you are morally responsible for the deaths of every person who follows your suggestion.
Under this analysis, it looks like I’ll soon be able to claim that Jenny McCarthy is a murderer, because the once eradicated disease measles has started to make a come back in the U. S. recently.
no comments | posted in Consequentialism
Aug
23
2008
This snippet of court proceedings is amazing:
“Why shouldn’t I put you in jail for contempt today?” Booth asked. “I told you twice.”
“I’m sorry,” Arnold said.
“No, you’re not,” Booth said. “I told you twice. I even fined you for being in contempt. Why shouldn’t I throw you in jail today? You apparently don’t care about the court’s orders.
“I forgot,” Arnold said.
“How could you forget?” Booth said. “No, seriously, how could you forget? It’s a complete disregard of court order. Complete. You should go to jail today, and you’re going.”
I particularly like the fact that the judge used the words, “no, seriously.” For those who don’t want to read the original article, the judge was so incensed because the defendant repeatedly wore short shorts during her trial.
no comments | posted in Law
Aug
21
2008
After spending more than two years on the list of authors I want to explore, I’ve finally begun reading G. K. Chesterton’s “The Man Who Was Thursday.” There is a brilliant passage at the start that I plan to quote in the future, but for now I thought I should quote this wonderful aphorism of Chesterton’s, which is cited in Leonard E. Read’s I, Pencil:
We are perishing for want of wonder, not for want of wonders.
no comments | posted in Citations
Aug
20
2008
I don’t care how many movies are available to me. As my personal taste as a customer, I want to watch the new stuff so whether we have 10,000 movies or 200 movies doesn’t matter if I don’t want to see any of the movies that we have . . . our assortment is heavily weighted toward newer releases and mainstream staple titles.
The quote comes from an interview with Blockbuster’s CEO, who evidently finds Netflix’s success very confusing. Every one of his comments reminds me a great deal of the infamous claim by Ken Olson, the President of Digital Equipment Corporation, in 1977, that,
There is no reason anyone would want a computer in their home.
It’s rare that you get a chance to watch a CEO of a once thriving corporation publicly reveal his inability to adapt to a changed market. There is a sort of schadenfreude joy to it, along with a reminder that no monopoly is permanent under capitalism.
no comments | posted in Business
Aug
20
2008
Today I started reading the Ruby Snips website, which has a pretty good sample of interesting snippets of Ruby code on it. I was particularly intrigued by the following snippet from a post on Prime Numbers dating back to March 23rd, 2007:
1
2
3
4
5
| class Fixnum
def prime?
('1' * self) !~ /^1?$|^(11+?)\1+$/
end
end |
At first, I was convinced this code was broken. Before I had given much thought to the algorithm, I was ready to assume that the “prime?” name was a misnomer: I assumed the code was actually testing for members of a specific class of palindromes. After a minute or two, I pieced together what was really happening when testing a number:
- The number, n, is expanded into a string of 1’s of length n.
- The string of 1’s is testing using a regex with back-references that finds the presence of a repeated divisor, a technique that works because a string of length a * b = n is composed of b copies of a string of length a.
At that point, I began to marvel at the simplicity of the algorithm relative to the obscurity of the code. And while I was so amazed by this, it occurred to me: this is an absolutely terrible way to test for primality. Because you have no control over the loop bounds for the regex, you effectively test every number up to n as a possible divisor if n is a prime. But you really only need to test up to the square root of n to determine if n is prime. So your code runs for the square of the time it should run. And the expansion of n into a string, at least theoretically, requires exponentially more space than an integer expressed in binary would. This seemed like one of the worst possible ways to test for primality I had ever seen.
Still, I wanted to verify this empirically as well as theoretically, so I typed in
during an IRB session. The CPU and memory usage were absurd for a primality test on such a small number. I didn’t even bother letting the code complete after a few seconds of the watching interpreter hanging there, silently wasting CPU cycles. In contrast, the simpler, clearer code,
1
2
3
4
5
6
7
8
9
10
| class Fixnum
def prime?
(2..Math.sqrt(self).to_i).each do |i|
if i * (self / i) == self
return false
end
end
return true
end
end |
runs fairly quickly.
The lesson I think everyone should take from this is a simple one: don’t be clever when writing code. At the very least, don’t be clever in the way the author of this snippet was. Your code is likely to end up being unclear, slow and wasteful with memory.
Perhaps I should be clearer about the problems of cleverness. Clever code is a mistake; clever algorithms are wonderful. Quick sort is a clever algorithm that always confuses me until I think carefully about it — and then I marvel at its superiority over other less efficient sorting algorithms; this snippet is a mediocre algorithm written in a style of code that’s needlessly confusing.
2 comments | posted in Ruby
Aug
18
2008
From an article on The Volokh Conspiracy describing the role and traits of swing voters in the U.S.:
The voters who know the least are the ones who tend to determine electoral outcomes.
no comments | posted in Politics
Aug
18
2008
Here is an absolutely amazing article on heavy metal bands in the Islamic world.
no comments | posted in Citations