Thursday, December 24, 2015

We interrupt this travelogue...

... to wish you a Merry Christmas / Solstice / Saturnalia / Chanuka / Yule / Kwanzaa / Festivus/ Holiday or whatever your winter festival of choice may be.  I wish health and happiness to you and yours.  May there be peace on earth and good will towards all living things.  (Except mosquitos.  Ooooh, I hate mosquitos!)



(That's actually a photo from the trip.  This tree is in the lobby of the Saxon Hotel in Johannesburg.  But I'm getting ahead of myself.)

Wednesday, December 23, 2015

Travelogue day 5: Banjul, The Gambia

Yes, the locals call it "The Gambia", not "Gambia."  (By way of contrast, it's just "Ukraine", not "The Ukraine."  I think the only other country with a "The" in front of its name is The Netherlands.)

The Gambia seemed a lot more ready to receive tourists than Senegal had been.  There was a welcoming committee singing and dancing at the dock.


Still, the local transportation was still pretty rustic.


We rode in that vehicle for a good hour and a half (each way).  You see a lot of things that you don't see much of in California.  It's a little hard to see, but this guy is carrying a very large tuna on his bicycle:


All over the place we saw shops selling overstuffed armchairs on the street.


Some of the natives were camera shy.


Others not so much.


Eventually we arrived at our destination, a wildlife refuge in the rain forest outside of town, where they fed us lunch and took us on a nice canoe ride.


There were a lot of baboons.  They were accustomed enough to humans that you could get pretty close to them and get some really amazing shots.  It's a shame that the light wasn't better.  It was overcast all day, so the light was really flat.



Did I mention there were a lot of baboons, and they were used to having humans around?


Got some nice bird shots too.  I don't remember what this one is called.  


All in all, just a pleasant and mostly uneventful day.  Which turned out to be pretty remarkable in this part of the world.

Tuesday, December 22, 2015

Travelogue, day 4: Dakar, Senegal

Senegal was our first port of call in West Africa proper, i.e. on the continent rather than an island.  The country seemed to be not quite ready for prime time in terms of welcoming western tourists.

Dakar is a city of 1 million people (3 million if you count the suburbs), and like most large third world cities it is chaotic and dirty.  Most vehicles are diesels, and emissions controls are unheard of.



Street vendors are everywhere:



as are beggars



and, somewhat incongruously, these ads for Nutella:



Notwithstanding the chaos and the poverty, the city seems to be vibrant and occasionally we got little glimpses of a unique culture.  For example, these cheerfully (if somewhat haphazardly) painted busses are ubiquitous:



There is an indigenous art form called "sand painting" where the artist applies glue to a wooden board and "paints" with various colors of sand.  The results can be quite striking.



The painting you see the artist holding was done in about five minutes.  The ones on the wall in the background are much more elaborate.

But there are also signs of (ahem) ineffective government everywhere as well.  This is, as you will see if you keep reading this series, a recurring theme in Africa: corruption is a way of life.  For example, some of the worst slums sit in the shadow of this multi-million dollar sculpture:



It is the tallest statue in Africa, and it was built by a North Korean company.

Our bus driver was particularly proud of the fact that the government had recently managed to import an enormous shipment of onions, which we could see as we came back to the port to rejoin our ship.





One final interesting bit o' trivia: Senegal does not have its own currency.  It uses the West African CFA Franc, which is a sort of African Euro, with eight countries sharing a single currency.  One U.S. dollar currently trades for about 600 CFA francs.  Wherever I go I try to collect some of the local currency, but when I asked people if they could exchange some dollars for CFAs they looked at me like I was crazy.  Why would anyone in their right mind want them?  I finally did manage to get a few tattered old bills for my collection, which seems like a fitting metaphor for the West African economy.

---

Administrative note: if you're reading this, I'd appreciate it if you could click on one of the "reaction" buttons below, even if it's just the "Read it" button.  My previous travelogues have been pretty popular, but these don't seem to be getting as much attention, and couple of people have actually unsubscribed to my blog since I started posting them.  There's no point in writing these if there's no audience.  Thanks.

Monday, December 21, 2015

Travelogue day 3: Cape Verde

Cape Verde (pronounced Cape Verd -- the final E is silent) was our first port of call that was no longer part of Europe.  Madeira is part of Portugal, and the Canary Islands are part of Spain, but Cape Verde is today an independent country.  Like Madeira and the Canaries, it's an archipelago off the coast of Africa, so it's not quite "really" Africa yet, but we could definitely tell that we were not in Kansas any more.

Parts of Cape Verde are beautiful.  There are pristine beaches...


(That's our ship in the background.)

Some lovely Portugese colonial architecture...


A charming central market...


(as long as you ignore the fact that there is no refrigeration for the fish)


It's tricky to take good photographs because the locals (understandably) don't like to have their photos taken.  But they'll pose for you if you offer them a tip.  This woman's job was to sweep leaves off the gravel in the background.


This one was selling food out of this little stand.


And this was our guide.


His name is Joe.  He's a native Cape Verdeian but he grew up in the United States so he spoke flawless English with a heavy Brooklyn accent.  If you ever find yourself in Cape Verde, I highly recommend him.  You'll find him by the dock along with all the other local guides hustling for business.

Joe showed us around for about five hours.  He did a terrific job, and he did it on spec.  We had no agreed-upon price, and at the end when we asked him how much we owed him for the day's work he said that what he would really like is if we could bring him some fresh fruit from the ship, and some English-language books.  He didn't care what the titles were.

This is not an uncommon experience.  Seven years ago when we were in East Africa, I went into town in Zanzibar.  To get into town you had to walk a gauntlet of high-pressure sales tactics from local merchants, so I had deliberately taken no money with me in the hopes that this would encourage the locals to leave me alone.  It mostly worked, but this one guy simply would not take no for an answer, and for two hours he walked around town with me, showing me the sights.  I was very glad he did, because we ended up going to some places where I would not have felt safe on my own.  At the end, after walking around with me for two hours in 90 degree heat and 90% humidity, he asked for the sweaty T-shirt I was wearing.  I gave it to him.  He was happy with it.

This, and many other similar experiences I've had traveling in third-world countries, are why I have zero tolerance for people who say that poor people are poor because they don't work hard enough or are unwilling to take risks.

Sunday, December 20, 2015

Travelogue, day 2: La Palma and Tenerife

[Third in a series]

After Madeira we had two back-to-back ports of call in the Canary Islands of La Palma and Tenerife.  They were two separate stops on two different days, but I'm going to lump them together because there's not that much interesting to tell, and I want to get to the main attraction, West Africa.

The Canary Islands are volcanic tropical islands not unlike Hawaii or the Galapagos.  The most interesting thing about Tenerife is that it was the site of the world's worst ever aviation accident, and the most interesting thing about La Palma is that it is rumored to pose an existential threat to the eastern seaboard of the U.S. (though apparently, it's not true).  Both islands grow a lot of bananas, offer a nice tropical getaway easily accessible from Europe, and that is about the extent of their claims to fame as far as I could tell.

On La Palma I took a tour into the rain forest, and decided to go off-script and explore this interesting-looking path:



which led me to this tunnel:



Unfortunately, I had left my cell phone behind (I have an old CDMA iPhone which is mostly useless overseas) so I had no light, and the tunnel was long enough that I could not see through to the other side.  Fortunately, a good samaritan couple showed up and let me follow them through.  The tunnel led to this spectacular waterfall:


On Tenerife, my experience was almost the exact opposite.  Tenerife also has a rain forest, but my tour took me up to the volcano, well above the clouds and the rain forest.



To me it was indistinguishable from parts of the American southwest.



Next stop: Cape Verde.  That's when things started to get more interesting.

Saturday, December 19, 2015

Travelogue: West Africa day 1

Well, it wasn't really day 1 because it took us two days to get there, but I figured it would be easier to number things sequentially.  Our first port of call was Funchal, Madeira, which is off the coast of Morocco, but technically part of Portugal.  It's a quaint little European town clinging to the side of a series of cliffs, not unlike Amalfi or Cinque Terre in Italy, though not quite so dramatic.



It's nice enough, but the most interesting bit is this place, which is near the port:



That rock is the self-styled Principality of Ponthina, ruled by the benevolent dictator Prince Dom Renato Barros (who, regrettably, I did not have the honor of meeting whilst I was there).  Here's what it looks like going in:



It's the world's smallest country, much smaller than Vatican City or even the Republic of Molossia.  There are no passport checks (good thing because I didn't have mine with me), but there is this cool statue of Santa Claus on top:



And a little tiki hut:



And some cats (gotta haz cats if you're gonna write about it on the Internet, right?)





And that's about all there is to tell about Madeira.  Oh, and I think they make some wine there too ;-)

Thursday, December 17, 2015

Travelogue: West Africa, Prologue

I just got back from a six-week-long trip to western and southern Africa.  On previous trips like this I wrote travelogue entries in real-time, but there has been a rash of burglaries in our neighborhood recently and so I decided it would not be wise to advertise the fact that we were out of town.  So I'm going to go back and blog about the trip stop-by-stop as if it were happening in real time.

The trip consisted of two parts.  The first was a cruise on the Oceania Marina from Lisbon to Cape Town, and the second was a safari that took us to Victoria Falls, the Okavango delta, and the Madikwe game reserve in South Africa.  Then at the end we spent two days in Johannesburg before returning home (though, as you will see, we didn't get to see much of the town).

We flew to Lisbon on Lufthansa by way of Frankfurt.  We were originally scheduled to have a two-hour layover in Frankfurt, but two months before we left, Lufthansa suddenly cancelled our connecting flight, which left us with an eight-hour layover.  That's an awfully long time to be hanging around a terminal (particularly with ten time zones worth of jet lag), so we decided to get a day room at one of the hotels adjoining the airport.

The flight to Frankfurt was uneventful.  Once we arrived, it was quite a hike to get to the hotel, but we finally found it.  Nancy settled down for a nap, but I had gotten some sleep on the plane so I decided to go exploring.  When I did, I found this:



A close-up:



There was our original connection to Lisbon, the one that would have given us a two-hour layover instead of the eight-hour one we were now facing.

To say that I was annoyed would be quite the understatement.

Since I'm not writing in real time, I can fast-forward a few days and report what our travel agent told us when we reported this to him.  As you can see from the departures board, the flight to Lisbon is not a Lufthansa flight, it's a TAP (Air Portugal) flight.  It had been cross-listed as a Lufthansa flight.  According to our agent, TAP cancelled the flight and then reinstated it without the cross listing.

I was a little skeptical of this explanation even at the time.  I found it hard to believe that Lufthansa's lawyers did not insist on having some sort of contractual obligation that would prevent TAP from pulling the rug out from under its customers like this.  I thought I would never really know the truth, but it turns out I was wrong about that.  The Internet never forgets, and the record shows that this flight did operate under a Lufthansa code share that day:



Maybe I should write a letter to Lufthansa's CEO.

Notwithstanding the extra delay, we finally made it to Lisbon, spent the night there, and the next day embarked on our journey.  As it happens, it turns out there are much worse things that can happen while traveling than having a flight delayed by six hours.  On the ship I encountered a couple whose bags had been lost, and were not located until the end of the three-week cruise -- in San Francisco!  So maybe I should just count my blessings and forget about getting bumped off the earlier Lisbon flight.

Stay tuned.

Friday, November 13, 2015

Those who live by the wingnut shall die by the wingnut

I must confess to engaging in more than a little schadenfreude in watching the Republican party leadership reaping what they have sown.
Less than three months before the kickoff Iowa caucuses, there is growing anxiety bordering on panic among Republican elites about the dominance and durability of Donald Trump and Ben Carson and widespread bewilderment over how to defeat them. 
Party leaders and donors fear that nominating either man would have negative ramifications for the GOP ticket up and down the ballot, virtually ensuring a Hillary Rodham Clinton presidency and increasing the odds that the Senate falls into Democratic hands.
Awww.

Friday, October 23, 2015

Colonizing space won't save us

I don't have too much time for non-work-related writing nowadays, but I really feel the need to spread this meme.  Earlier this week I got into a little dust-up with a hacker-news user called moonchrome over the sustainability of exponential growth.  It was in response to a story about the catastrophic fires in Indonesia that are intentionally set in order to clear farmland for oil palms, i.e. the plants from which coconut oil is produced.  Oil palms have become a growth industry (no pun intended) since trans-fats have become unfashionable.

During that exchange I suddenly realized that there's probably a whole segment of the population that thinks that overpopulation is not a problem because — space colonization!  When earth gets overcrowded, we'll just move to Mars.  And besides, those Malthusians have been crying wolf since forever.  No matter what happens, technology will save us.

Sorry to be the one to break it to you, but no, it won't, and if you think it will you don't understand the truly awesome destructive power of exponential growth.

There's a classic puzzle that goes like this: imagine you have a jar filled with growth medium and a single bacterium of a species that divides twice an hour.  After a week, the jar is full.  At what point was it half-full?

The classical answer is: half an hour before the end of the week.  But that is wrong.  The real answer is that the problem as posed is not possible.  A week's worth of unchecked bi-hourly doubling would result in a bacterial population vastly greater than the number of elementary particles in the universe.

It helps only a little that our doubling time at the moment is running about 60 years rather than 30 minutes.  That stretches the week out to a few hundred or a few thousand years depending on whether you take the total biomass of earth or the mass of the universe as your limiting factor.  Predicting the future is usually a fool's errand, but I hope I don't have to convince you that before we have converted every last carbon atom on earth into a human body, life will get very, very unpleasant.

Even if we manage to colonize Mars, that will only help a little.  Imagine that we are able to completely terraform Mars, and produce a biomass more or less equal to that of earth.  For starters, colonizing Mars will only help the situation here on earth if we are able to emigrate en masse, which isn't very realistic.  But even if we were able to do that, having one more planet only buys us one more doubling time, that is, 60 years at current growth rates, after which we would be right back where we started.  And now to get ourselves out of that mess we need two more planets!

OK, say the optimists, so we'll go to the next solar system.  No, we won't.  Even sending a robot probe to the nearest star is a pipe dream at the moment.  The massive emigration required for interstellar colonization to improve the situation here on earth is a pipe dream N times over for some very large value of N.  And even if that were not so, as I mentioned earlier, even if you take the total mass of the universe as your limiting factor you only get out to a few thousand years.  That's the blink of an eye in the grand scheme of things.

The simple fact of the matter is that exponential growth is necessarily transient.  Always.  It is not possible to sustain exponential growth in a finite universe.  At some point, any instance of exponential growth will cease.  The only question is whether it happens because we decide to stop it, or because we discover the hard way what the limiting factor actually turns out to be.

Personally, I hope we do the former, because dealing with the latter will not be fun.  But to achieve that we have to change our collective mindset.  We have to start thinking about steady-state as the goal rather than exponential growth, because open-ended growth is simply not an option.  If we don't control our growth, then sooner or later the laws of physics (and mathematics) will do it for us.

Thursday, October 15, 2015

Lincoln Chafee deserves a do-over

Normally I too would have very little tolerance for a Senator making lame-sounding excuses for having cast a disastrously wrong vote, but I nonetheless think that Lincoln Chafee got a bum rap over his vote to repeal Glass-Steagall.  Look at the actual timeline of what happened back in 1999:
The final vote came on Nov. 4, 1999, the same day Mr. Chafee was sworn in as Rhode Island’s senator. He filled the seat vacated by the death of his father, John Chafee, on Oct. 24, 1999.  [Emphasis added.]
So... his dad dies and a week and a half later he finds himself on the Senate floor having to cast a vote on this bill that is on its way to being passed by an overwhelming bipartisan vote (90-8 with two abstentions).  His vote isn't going to make a whit of difference in the outcome.  Under those circumstances, I don't think it was completely unreasonable for him to decide to punt on his homework and just go with the flow.  Surely not his finest hour, but you know, if that's the worst mistake he ever made in his political career I think he would actually make a fine president.

Saturday, October 03, 2015

A Moral Puzzle

I was discussing idea-ism with someone the other day when I came up with what turns out to be a very interesting moral dilemma.  Unlike the classic trolley problems, this is actually a somewhat realistic scenario, and one on which reasonable people really do seem to disagree.  Here it is:
John is a wealthy businessman whose heart is failing. If he doesn’t receive a transplant he will die. John has a large family, and his business has many employees. If he dies, they will suffer various degrees of emotional and economic pain. 
John travels to Malawi, the world’s poorest country, where the average income is about $250 per year. He finds a 20-year-old man (let’s call him Achmed) whose tissue type matches John’s, and offers him $15,000 in exchange for his heart (which will, of course, result in Achmed's death). $15,000 is pocket change to John, but it is an unthinkably large amount of money to Achmed. Life expectancy in Malawi is about 50 years, so this is twice what Achmed can reasonably expect to earn in the rest of his life. It will substantially improve the standard of living for his family, to say nothing of the fact that with one less mouth to feed (since Achmed will be gone) the money will go even further. Achmed’s brother is willing to adopt Achmed’s children, so they will not be orphans. The money will substantially improve Achmed’s family’s standard of living. It will allow Achmed’s children to attend school and give them a shot at lifting themselves out of poverty. And Achmed is not well-loved by his family. He’s a bit of a neer-do-well. What little money he currently earns he mostly spends on alcohol, and when he gets drunk he becomes abusive. He will not be missed. And Achmed knows all this, and so his life is not particularly happy, at least not when he’s sober. So everyone will be happier if Achmed accepts the offer, possibly even including Achmed, even though he doesn’t really want to die (or at least he thinks he doesn’t).
The question: is it moral for John to make Achmed this offer?  Would it be moral for Achmed to accept it?  Why?

I am actively soliciting people's opinions on this.  Please weigh in in the comments.

Monday, September 21, 2015

Coming up for air

I've been away, both literally and figuratively.  It has been over a month since I wrote a blog post.  This is in part because I've been busy with my startup, and in part because I've been on a trip to the Northwest Passage.  I would have written a travelogue, but we were so far out in the middle of nowhere that we had no internet connection for two weeks.  It was an interesting experience to be off the grid for that long.  People were starting to get a little antsy.  Personally, I thought it was kind of refreshing to be unplugged for a while.

The Northwest Passage is at once amazing and terrifying.  Amazing because it's the furthest I've ever felt from civilization.  At one point we were visiting a little Innuit village well north of the arctic circle and I decided to go for a walk out of town to see the world's most northerly golf course.  When I got there I realized I was probably, at just over a mile, further from another human being than I had ever been in my entire life.


The greens are made of astroturf.  There are no fairways.  The whole course is basically one giant super-gnarly sand trap.


The scary bit was that the Northwest Passage is now almost entirely free of ice. We did manage to find some (complete with polar bears) but we had to go out of our way.


So for two weeks we navigated one of the most notoriously treacherous and ice-bound waterways on the planet on completely calm and ice-free waters, under clear blue skies.  At one point in the trip I was actually comfortable taking my shoes and socks off and walking around barefoot and in a T-shirt.



It was beautiful, but it was creepy.  The arctic is supposed to be cold, dammit!

I don't have near enough time to do a full writeup right now, but I do want to share two more images.


No, that is not a watercolor, it's a photograph.  Of actual scenery.  No photoshopping.  It really did look like that.  And then on the other side of the boat it looked like this:


That's a moonrise.  Again, completely unaltered.

Wednesday, August 19, 2015

And the award for the most ironic statement goes to...

...an unnamed individual, self-identified as "Eagle One", who was defending a "Muslim-free" gun range:

I will fight to the death for someone’s right to practice whatever religion they want to. I’m not here because of that. I’m here because when people start resorting to violence, we can’t allow that.” [emphasis added]
The amount of self-unawareness it takes to say something like that while defending a gun range is truly staggering.  What exactly does Eagle One think guns are for?

Oh, the reason this is a story?  One of the clowns defending the gun range accidentally shot himself.  No, really.


Sunday, August 16, 2015

PSA: Beware of sudo on OS X

There's a little kerfuffle going on over on HN about a newly discovered local root exploit on OS X 10.10.5, so I thought this might be a good time to make sure everyone is aware of something that I just discovered myself a few days ago: Apple ships sudo with tty_tickets disabled by default.  What this means is that if you use sudo to give yourself root privileges, your sudo authentication is not bound to the TTY in which you ran sudo.  It applies to any process you (or malware running as you) start after authentication.  The way Apple ships sudo it is, essentially, a giant privilege escalation vulnerability.  To see this: open two terminal windows and run sudo in both of them.  Only the first one will ask for your password.

It's easy to fix.  Just run visudo and add this line:
Defaults tty_tickets

Saturday, August 08, 2015

Ayn Rand destroyed in six words

Sorry if I'm stepping over the line in terms of tooting my own horn here, but I'm kinda proud of this.  User CWuestefeld over on Hacker News wrote this comment on a thread about bee colony collapse:
[T]his isn't a shortcoming of the market as such. It's a failure in conjunction of our incomplete recognition of private property rights. By preventing certain types of property from having private ownership, we don't allow the market to correct itself. More specifically, if we had some private entity or entities that were recognized as the owners of air or water, then they would be able to recover damages from the polluters, thus removing ability to externalize the cost of pollution.  [Emphasis added.]
To which I replied:
I volunteer to be that entity.
Those six words have gotten more upvotes than any other comment I have ever posted on HN :-)

Friday, August 07, 2015

So that's what an enclave is!

Three years ago I wrote about some little bits of one country that are completely surrounded by another country.  Turns out I didn't have a clue.  Such things are far more common than I thought.  They even have a name: they are called enclaves.  And there are even second- and third-order enclaves, i.e. a piece of one country that is surrounded by a piece of another country that is surrounded by a piece of the first country that is surrounded by the second country.

AFAICT the motherlode of enclaves is on the border between India and Bangladesh.  The northern edge (if you can even call it that) of that border is so riddled with enclaves it looks like a Swiss cheese.  Or maybe a fractal.

What brought this to my attention is this story in the Washington Post about a third-order enclave that is going away due to the resolution of a long running border dispute between India and Bangladesh.  I don't really have anything to say about it, but I thought it was interesting so I thought I'd share.

Sunday, July 12, 2015

A simple way to make your site more secure

Let users have different passwords for web logins and mobile logins.

Why?  Because in my desktop browser I can use a password manager to store strong passwords.  In your proprietary mobile app, I will (almost certainly) have to type the password in manually, and on a tiny keyboard, which makes it almost impossible to use a strong password in that context.  Also, it's actually not necessary to use a strong password in a mobile app because you can use the device identifier as an additional security factor.

And for the love of God, don't deliberately undermine the use of password managers by disabling autofill in your login forms.  (I'm looking at you, Citibank!)

Thursday, July 09, 2015

A guest post from Captain Obvious

I was watching the news reports about the a Confederate flag finally being removed from the grounds of the state house in South Carolina and they were interviewing defenders of the flag, some of whom of course insisted that the flag had nothing to do with slavery.

These people need a history lesson.  Fortunately, the founders of the Confederacy wrote a Constitution in which they codified exactly what they were fighting for:
Article I, section 9, paragraph 4:
No bill of attainder, ex post facto law, or law denying or impairing the right of property in negro slaves shall be passed.
And just in case that wasn't clear enough:
Article IV, secion 3, paragraph 2: 
The Confederate States may acquire new territory; and Congress shall have power to legislate and provide governments for the inhabitants of all territory belonging to the Confederate States, lying without the limits of the several Sates; and may permit them, at such times, and in such manner as it may by law provide, to form States to be admitted into the Confederacy. In all such territory the institution of negro slavery, as it now exists in the Confederate States, shall be recognized and protected be Congress and by the Territorial government; and the inhabitants of the several Confederate States and Territories shall have the right to take to such Territory any slaves lawfully held by them in any of the States or Territories of the Confederate States.
Of course it was about slavery!  They wrote it into the fucking Constitution, for Christ's sake!  They even went so far as to make it explicitly negro slavery!  At least the original U.S. Constitution expressed a certain queasiness about the institution by using the term "other persons" instead of "slaves."  The Confederacy could have pussy-footed around the issue just as easily, but they didn't.  Why?  Because that's what they were fighting for!  They were proud of it!

That's the ultimate irony.  All those people who insist that the flag is about "heritage" and not about hate are actually denying the very heritage they are purporting to honor.  Anyone who professes to want to fly the Confederate flag in the name of Southern heritage needs to read those passages from the Constitution of the Confederate States and let the words "negro slave" sear themselves into their soul.  Maybe the only way to heal the still-festering wounds of the Civil War is to cauterize them.



Monday, July 06, 2015

Why the data do not support profiling Muslims

I'm going to go into some detail here about why the recently published data about extremist violence do not support profiling Muslims.  I thought this would be obvious, but apparently it isn't.

Let me start by summarizing the (fallacious) argument for profiling Muslims.  It goes something like this: Obviously, most extremist violence in the world is undertaken by Muslims.  In fact, by the recent numbers, Muslims are about 40 times more likely to engage in extremist violence than non-Muslims.  So it is obviously we should be profiling Muslims rather than non-Muslims.

When couched in those terms it seems like a pretty compelling argument, doesn't it?  But here is a completely equivalent argument, which is (I hope!) obviously bogus:
Self-identified atheists are about 2.4 percent of the U.S. population.  If we assume that these are more or less uniformly distributed across the country, then there are probably about 1500 self-identified atheists living in Chapel Hill, North Carolina.  (More likely the number is lower, but let's be conservative here.)  One of these, Craig Hicks, shot and killed three Muslim students in February of 2015.  So about 0.06% of self-identified atheists living in Chapel Hill have committed acts that could reasonably be characterized as terrorism.  So the concentration of terrorists among atheists in Chapel Hill is about 200 times greater than the concentration of terrorists among Muslims in the U.S.  Therefore we should be profiling Chapel Hill atheists in order to improve our odds of catching terrorists.
Hopefully I don't have to convince you that this argument is fallacious, and yet it is structurally identical to the argument for profiling Muslims.  So why does it seem so much more compelling when applied to Muslims?

Part of the problem is that there really is a connection between terrorism and Islam.  Most of the world's terrorists are Muslims.  However, it is emphatically not the case that most of the world's Muslims are terrorists!  And if your goal is to find terrorists (as opposed to figuring out what religion a terrorist happens to be) that is what matters.

The real problem with all of these arguments is that terrorists are actually quite rare, and in the U.S. they are extremely rare.  There have been 26 documented terrorist attacks in the U.S. since 9/11.  That's less than two a year.  So out of 300,000,000 people, less than two of them will (on average) commit a terrorist act in any given year.

The problem is that when the numbers are that small they become very sensitive to outliers and boundary effects.  For example, I've been using the number-of-incidents as my statistic, but the NewAmerica web site actually headlines the body count instead.  If we use body count, things look worse for the Muslims: the ratio of Muslim to non-Muslim violence grows from 37% to 54%.  However, note that fully half of the Muslim body count is due to a single event: the Fort Hood shooting.  If we ignore this one event as an outlier, the body count ration plummets to 27%.  Even if we also ignore the Charleston church shooting as an outlier on the non-Muslim side, the ratio is still only 33%.

But all of these numbers are red herrings.  They will help you figure out after the fact whether a particular terror victim was likely killed by a Muslim or a non-Muslim, but that's not really what we want to know.  What we want to know is how to improve our odds of catching terrorists before they commit acts of terror, n'est pas?  And for that goal, these numbers don't help at all.

The reason they seem to help is that the rate of terrorism among American Muslims is 37 times higher than it is among American non-Muslims.  That seems like a compelling number, until you recall that the incidence of terrorism among Chapel Hill atheists is 200 times higher than it is among American Muslims, and 7400 times higher than among the population at large.  I hope I don't have to convince you that profiling Chapel Hill atheists will probably not have a positive impact on the problem of terrorism, despite the overwhelmingly higher rate of terrorists among them.  Yes, profiling Muslims might increase your odds of finding terrorists from 0.0000001 to 0.0000037.  But those are still mighty poor odds.  And the resentment that you would instill in the American Muslim community might well cause more terrorist acts than the profiling prevents!

So what should be done instead?  Surely we have to do something about terrorism?

Well, no, actually we don't.  The fact of the matter is that terrorism is really not that big of a problem in the U.S.  The total body count since 9/11 is only 74, or only about five people a year.  About that many people die in car crashes every hour.  Even if we include 9/11 and Oklahoma City that's still only about 150 people a year, less than two days worth of traffic fatalities.

Of course, we really do want to keep weapons of mass destruction out of the hands of crazy people.  But your ordinary run-of-the-mill terrorism of the sort that anyone can accomplish with readily available light ordinance is just not that big of a problem, despite the splashy headlines.  It is hard to imagine a more irrational policy than profiling Muslims to prevent terrorism.

The definition of a no-brainer

The state of Colorado has made the startling discovery that if you give women access to birth control, they have fewer babies.

Friday, June 26, 2015

A bittersweet victory

Today, almost twelve years after I first addressed the topic in this blog, same-sex marriage became legal in all 50 states.  It is a cause for celebration, but my happiness today is tempered by my fear that Obergefell v. Hodges will become the next Roe v. Wade.  I was really, really hoping that John Roberts would join Anthony Kennedy on the enlightened side of history and make it a 6-3 decision rather than the 5-4 it actually was.  (There was never any hope for Scalia, Alito and Thomas.  Those men are irredeemable social fossils.)  Because the decision was 5-4, the right will for years, maybe decades, rant and rave about judicial activism and how the court needs to be packed with even more right-wing extremists so that we can finally (finally!) roll back social progress and go back to the Good Old Days before those damn liberals stole the country away from good God-fearing folk.

The ranting, of course, has already begun, with John Roberts blazing the trail in his unequivocal and incoherent dissent.  Actually, it's not the unequivocal part that bothers me.  If someone has a good-fath disagreement with government policy, they should give it voice, whether that person is a Supreme Court justice or an untitled citizen.  But if that person is a Supreme Court justice I would expect them to hold themselves to a higher standard, and at the very least base their arguments on actual facts and the actual law.  And John Roberts doesn't.

I don't have time to do an exhaustive analysis of Roberts's dissent, so I'll just point out what I consider to be the two most egregious examples of sloppy thinking.  His closing sentence really steams my clams:

If you are among the many Americans—of whatever sexual orientation—who favor expanding same-sex mar- riage, by all means celebrate today’s decision. Celebrate the achievement of a desired goal. Celebrate the oppor- tunity for a new expression of commitment to a partner. Celebrate the availability of new benefits. But do not celebrate the Constitution. It had nothing to do with it.
Um, excuse me, Mr. Justice Roberts, but my copy of the Constitution has this in it:
No State shall ... deny to any person within its jurisdiction the equal protection of the laws.
Now, it is arguable (but wrong) that this means that it's perfectly OK to discriminate against gay people because everyone is "equally" allowed to marry someone of the opposite sex.  It is similarly arguable (and equally wrong) that it is perfectly OK to outlaw interracial marriage because everyone is "equally" allowed to marry someone of the same race as themselves.  There was a time not so long ago when the absurdity of the second argument was not self-evident, just as we are now living in a time when the absurdity of the first argument is not yet self-evident (though that will surely happen in good time).  But to say that the Constitution had nothing to do with it, that the five justices who voted on the right side of history just invented the right to marry whoever you fall in love with out of whole cloth, is not just wrong, it's an insult.

The second egregious rhetorical sin that Roberts commits is his invocation of the slippery-slope-towards-polygamy argument while at the same time arguing for one-man-one-woman on historical grounds.  It's unsurprising that a conservative would rewrite history to suit their ideological agenda, but the fact of the matter is that polygamy has been a common and accepted social practice throughout history.  The idea that polygamy is an axiomatic evil, a boogeyman with which to scare the good citizens of the United States into fearing the horrible consequences of today's judicial activism, is an invention of the modern right-wing.  No less a Christian luminary than Martin Luther, founder of the protestant reformation, once wrote:
I confess that I cannot forbid a person to marry several wives, for it does not contradict the Scripture. If a man wishes to marry more than one wife he should be asked whether he is satisfied in his conscience that he may do so in accordance with the word of God. In such a case the civil authority has nothing to do in the matter.
Note that I'm not necessarily staking out a position in favor of legalizing polygamy here the way I staked out my support of gay marriage twelve years ago.  All I am saying is that if you're going to argue one way or the other you should at the very least base your arguments on premises that can't be trivially refuted by reading Wikipedia.  Especially if you are a Supreme Court justice.  That's your job, for fuck's sake.

So, yeah, I'm happy at today's outcome.  But Roberts's dissent is going to be a burr in my saddle for a long time.  Instead of dwelling on it, thought, I think I'll just go have another look at this map.  That has brought a smile to my face every time I've looked at it today.

Wednesday, June 24, 2015

How's the Muslim-hunt working out for you, Sam Harris?

Three years ago, Sam Harris wrote in defense of racial profiling of Muslims because they are overwhelmingly more likely to commit acts of terrorism than non-Muslims, specifically:
"We should profile Muslims, or anyone who looks like he or she could conceivably be Muslim."
(Emphasis added.)

Turns out there is actual data to inform this debate.  As The New York Times reports:
Since Sept. 11, 2001, nearly twice as many people have been killed by white supremacists, antigovernment fanatics and other non-Muslim extremists than by radical Muslims: 48 have been killed by extremists who are not Muslim, compared with 26 by self-proclaimed jihadists, according to a count by New America, a Washington research center.
...
Non-Muslim extremists have carried out 19 such attacks since Sept. 11, according to the latest count, compiled by David Sterman, a New America program associate, and overseen by Peter Bergen, a terrorism expert. By comparison, seven lethal attacks by Islamic militants have taken place in the same period.
So, anyone want to place a bet as to whether this will prompt Sam to issue a retraction?  I'll give you long odds against.

Sunday, May 31, 2015

Easy as falling off a bicycle

There's a video making the rounds about how hard it is to re-learn how to ride a bicycle if you reverse the control sense of the handlebars.  It's an interesting video, but I think it misses a very important point.

I need to digress for a disclaimer: I have not had the opportunity to ride a reverse-handlebar bicycle, so I have not put the theory I am going to advance here to the test.  If anyone knows where I can find such a bike in the Bay Area I would really welcome the opportunity.

The reason people have a hard time learning to ride a bicycle for the first time is that they think that the direction of the bicycle is controlled by turning the handlebars the way that the direction of a car is controlled by turning the steering wheel.  It's not.  The mechanics of two-wheel vehicles are completely different from four-wheel (or even three-wheel) vehicles.  A bicycle's direction is controlled not by turning the handlebars, but by shifting your weight.

There's a simple experiment you can do on an ordinary bicycle to convince yourself that at least part of what I have just said is true: find a moderately sloped hill that lets you coast at a moderate speed (10-15 MPH) without pedaling.  Stabilize your trajectory in a more or less straight line.  Now let go of one handlebar, so you are "steering" with only one hand.  Use that hand to push that handlebar forward.  Don't do it abruptly, just apply gentle, even pressure.  If you're using your right hand, you will be turning (at least feel like you're trying to turn) your front wheel to the left.  What you will find is that your bike will actually turn to the right.  If you want to turn back to the left, you have to pull back with your right hand as if you were turning your front wheel to the right.  (I say "as if" because you will find that the front wheel actually does turn to the left despite the fact that you are applying pressure to turn it to the right!)

All this only works if you're going fast enough.  When a bike is moving slowly, its direction is controlled more by how you turn the handlebars than how you lean.  The hardest part of learning to ride a bicycle is learning to manage the transition between these two control regimes.  This is the reason that training wheels are worse than useless when learning to ride a bike.  They change the bike from a two-wheel vehicle to a four-wheel vehicle, which doesn't undergo this change in dynamics.  If you want your kid to learn to ride a bike, take the pedals off instead of using training wheels.

When a bike is traveling at speed, what happens when you apply pressure to the handlebars is this: let's say that you apply forward pressure with your right hand so that the wheel would ordinarily turn to the left.  For a fraction of a second, it actually does turn to the left, and the track of your tires moves to the left.  But your body is still moving in the same direction it was before, so you have essentially shifted your weight to the right.  So at the moment, you are out of balance.

What happens next is a little tricky to describe.  Notice that the head tube (the part of the frame that the front fork is attached to, is angled so that the bottom of the tube is further forward than the top.  The result of this is that when the bike leans in one direction, the weight of the bike and its rider causes the front wheel to turn in the same direction as the lean.  It is this force that controls where the front wheel is pointing when the bike is moving at speed.

The reason a bike is stable when it is moving is not the gyroscopic stability of the wheels, it is the angle of the head tube, which causes the front wheel to want to point in the same direction as the bike is leaning.  As soon as you start to lean one way or the other, the front wheel naturally turns in the same direction, which moves the wheels back underneath your center of gravity and "undoes" the lean.  In order to turn, you have to intentionally overcome the bike's natural stability and induce a lean in order to force the front wheel to turn to one side or the other.

So what happens when you apply pressure to the handlebars at speed is not that you are turning the bike, but you are inducing a lean.  You can do exactly the same thing by actually leaning, and it doesn't take much.  Once you are stabilized, just moving your head from one side to the other can be enough to cause your bike to turn.

Once you realize this, it is easy to learn to ride without having your hands on the handlebars at all.  You slowly release your grip until you just have your fingertips on the handlebar.  At this point you will notice that you can control your bike by applying pressure to the sides of the seat of the bike with your inner thighs, or by tilting your head back and forth.  It takes just a few minutes to learn how to steer the bike this way, at which point you can just take your hands completely off the handlebars.  At that point, of course, it doesn't matter whether the handlebars are reversed or not.

But, of course, all this only works once the bike is moving.  The hard part is getting to that point from a standing start.

The key here (and at this  point I'm really only guessing) is to remember two things: 1) the object of the game is to get the bike moving as quickly as possible and 2) what you're trying to do during that time is not to steer, but simply to keep the front wheel straight.  To do that with a reverse-sense handlebar you do have to change your mindset.  My guess is that what would work best is to make a conscious effort to think of the process as a game of "chase the front wheel with the handlebars", i.e. if you see the front wheel turning to the right, you "chase" it by turning the handlebars to the right, and vice versa.  The result will be the wheel wobbling back and forth around its forward position, but that should be enough to keep you upright long enough to get up to speed.

My prediction is that someone who has read this blog post can learn how to ride a reverse-handlebar bike much more quickly than someone who hasn't.  I'll bet that I can learn to ride such a bike in an hour if I had an open space free of obstacles to practice in (like a parking lot).  The reason I would need this is that initially I am not going to be able to control the direction of the bike, just keep it stable long enough to get up to speed and into the stable control regime.  Like I said in the opening, if anyone knows where I can get my hands on such a bike so I can do this experiment please let me know.

Thursday, May 07, 2015

Why Lisp?

A number of people have contacted me about a comment I wrote yesterday on Hacker News asking me to elaborate, e.g.:
my impression is that lisp is *only* a different notation. Is that correct, or am I missing something? I don't see why it is so important that lisp code matches the data structure (and my assumption is that the match is the answer to 'why lisp') - am I overlooking the importance of macros, or is there even more that I'm still not aware of?
The answer to this question is long, so I thought I'd go ahead and turn it into a blog post.

The short version of the answer is that Lisp is not merely a different notation, it's a fundamentally different way of thinking about what programming is.  The mainstream model is that programming consists of producing standalone artifacts called programs which operate on other artifacts called data.  Of course, everyone knows that programs are data, but the mainstream model revolves around maintaining an artificial distinction between the two concepts.  Yes, programs are data, but they are data only for a special kind of program called a compiler.  Compilers are hard to write, a field of study unto themselves.  Most people don't write their own compilers (except occasionally as academic exercises), but instead use compilers written by the select few who have attainted the level of mastery required to write one that isn't just a toy.

The Lisp model is that programming is a more general kind of interaction with a machine.  The act of describing what you want the machine to do is interleaved with the machine actually doing what you have described, observing the results, and then changing the description of what you want the machine to do based on those observations.  There is no bright line where a program is finished and becomes an artifact unto itself.  Yes, it is possible to draw such a line and produce standalone executables in Lisp, just as it is possible to write interactive programs in C.  But Lisp was intended to be interactive (because it was invented to support AI research), whereas C was not (because it was invented for writing operating systems).  Interactivity is native to Lisp whereas it is foreign to C, just as building standalone executable is native to C but foreign to Lisp.

Of course, there are times when you have no choice but to iterate.  Some times you don't know everything you need to know to produce a finished design and you have to do some experiments, and the faster you can do them the better off you will be.  In cases like this it is very helpful to have a general mechanism for taking little programs and composing them to make a bigger program, and the C world has such a mechanism: the pipe.  However, what the C world doesn't have is a standard way of serializing and de-serializing data.  And, in particular, the C world doesn't have a standard way of serializing and de-serializing hierarchical data.  Instead, the C world has a vast array of different kinds of serialization formats: fixed-width, delimiter-separated, MIME, JSON, ICAL, SGML and its offspring, HTML and XML, to name but a few.  And those are just serialization formats for data.  If you want to write code, every programming language has its own syntax with its own idiosyncrasies.

The C ecosystem has spawned the peculiar mindset that thinks that syntax matters.  A lot of mental energy is devoted to syntax design.  Tools like LEX and YACC are widely used.  In the C world, writing parsers is a big part of any programmer's life.

Every now and then someone in the C world gets the bright idea to try to use one of these data serialization formats to try to represent code.  These efforts are short-lived because code represented in XML or JSON looks absolutely horrible compared to code represented using a syntax specifically designed to represent code.  They conclude that representing code as data is a Bad Idea and go back to writing parsers.

But they're wrong.

The reason that code represented as XML or JSON looks horrible is not because representing code as data is a bad idea, but because XML and JSON are badly designed serialization formats.  And the reason they are badly designed is very simple: too much punctuation.  And, in the case of XML, too much redundancy.  The reason Lisp succeeds in representing code as data where other syntaxes fail is that S-expression syntax is a well-designed serialization format, and the reason it's well designed is that it is minimal.  Compare:

XML: <list><item>abc</item><item>pqr</item><item>xyz</item></list>

JSON: ['abc', 'pqr', 'xyz'] 

S-expression: (abc pqr xyz)

The horrible bloatedness of XML is obvious even in this simple example.  The difference between JSON and S-expressions is a little more subtle, but consider: this is a valid S-expression:

(for x in foo collect (f x))

The JSON equivalent is:

['for', 'x', 'in', 'foo', 'collect', ['f', 'x']]

Rendering that into XML is left as an exercise.

The difference becomes particularly evident if you try to type those expressions rather than just look at them.  (Try it!)  The quotes and commas that seem innocuous enough for small data structures become an immediately intolerable burden for anything really complicated (and XML, of course, like all SGML-derivatives, is just completely hopeless).

The reason that Lisp is so cool and powerful is that the intuition that leads people to try to represent code as data is actually correct.  It is an incredibly powerful lever.  Among other things, it makes writing interpreters and compilers really easy, and so inventing new languages and writing interpreters and compilers for them becomes as much a part of day-to-day Lisp programming as writing parsers is business as usual in the C world.  But to make it work you must start with the right syntax for representing code and data, which means you must start with a minimal syntax for representing code and data, because anything else will drown you in a sea of commas, quotes and angle brackets.

Which means you have to start with S-expressions, because they are the minimal syntax for representing hierarchical data.  Think about it: to represent hierarchical data you need two syntactic elements: a token separator and a block delimiter.  In S expressions, whitespace is the token separator and parens are the block delimiters.  That's it.  You can't get more minimal than that.

It is worth noting that the reason the parens stick out so much in Lisp is not that Lisp has more parens than other programming languages, it's that Lisp as only one block delimiter (parens) and so the parens tend to stick out because there is nothing else.  Other languages have different block delimiters depending on the kind of block being delimited.  The C family, for example, has () for argument lists and sub-expressions, [] for arrays, {} for code blocks and dictionaries.  It also uses commas and semicolons as block delimiters.  If you compare apples and apples, Lisp usually has fewer block delimiters than C-like languages.  Javascript in particular, where callbacks are ubiquitous, often gets mired in deep delimiter doo doo, and then it becomes a cognitive burden on the programmer to figure out the right delimiter to put in depending on the context.  Lisp programmers never have to worry about such things: if you want to close a block, you type a ")".  It's always a no-brainer, which leaves Lisp programmers with more mental capacity to focus on the problem they actually want to solve.

And on that note, I should probably get back to coding.  Iteratively, of course :-)

[This post has been translated into Chinese and Japanese.]