Hedging Investments in Las Vegas

Usually gambling is a risky proposition, but occasionally it can be used to reduce risk.

I heard on the radio today that many months ago a Mattress Entrepreneur in Houston, Texas, said, “If the Astros win the World Series, I’ll refund all purchases over $3,000.” Tonight is a big night for Houston-area mattress buyers; if Justin Verlander pitches well a lot of refunds will be forthcoming, to the tune of $5 million.

Mattress Guy emphasizes that most of that liability is covered by insurance — his business is not at risk — but he finds himself in an interesting situation: if a sporting event comes out a certain way, he loses a lot of money. Tonight it looks like he could use a little more insurance.

Las Vegas to the rescue! By placing a substantial bet on the Astros, he can make back some of the money he loses if they win. If they lose both the next games he loses his bet, but he’s not out the five million. By placing a bet he ensures that either way he loses some money, but he won’t lose as much as he would have, should the Astros win the series.

Meanwhile in Los Angeles, one of the big winners in a World Series game 7 are the ticket brokers, and apparently the Dodgers are particularly broker-friendly, releasing tons of tickets into the market. Should there be a game seven, the brokers will make millions. So what can the brokers do to improve the chances of a payout? Head to Las Vegas! By placing a big bet on there NOT being a game seven, the brokers get a guaranteed payout either way.

What these two things have in common is that wagering on the outcome of the game is the exact opposite of gambling. In one case, it is turning a potential big loss into a guaranteed-but-manageable smaller loss. In the other case it’s turning a potential big gain into a guaranteed-but-smaller gain.

Not long ago some kid became famous because he had bet on Auburn to win the college football championship game. At the time he placed his bet, no one thought Auburn had a chance to even reach the game. But holy shit, after a few amazing upset victories there they were. If they won, the kid stood to make something like $65,000. That’s a lot of clams for anyone, let alone a college kid.

Before the game, some Web site took a less-than-scientific poll asking people: Should the kid place a hedge bet to get a guaranteed $30K (less than half of his big payoff), or should he let it all ride? The results of the survey were presented by state — respondents from every state but one said “Let it ride!”. You want to guess which lonely state had a majority of respondents vote “hedge”?

That state was Nevada, of course, where people who gamble for a living reside. Auburn was winning late in the game, but ultimately lost. The kid got nothing. He failed to accept the gambler’s axiom: If you stand to gain or lose significant money over an event that other people are betting on, use that action to eliminate risk. Gamblers hate uncertainty, and feast on greed.

Unlike hedge funds — mutual funds designed to go up when the market goes down but which actually completely fail at that objective — hedge bets are a pretty cold lock, if only for a very specific circumstance. Here’s hoping that matters to one of us, someday.

1

November is Coming

In this entire mad, mad world, there are only a handful of people who have “won” NaNoWriMo every year since 2001. There were about 100 of us who won that year, and the number can only shrink from there.

So while I sit on the third blow-it-up-an-do-it-again exercise with chapter 40 of Knives, I’m also looking at November, trying to decide if my reason to participate is habit, pride, or actual creative need.

But I thought of a good moment, and the moment led to a couple of characters with a very small struggle in a vary large universe that cares not what becomes of them. Characters which, for the sake of dragging things out to 50,000 words, will have to stumble across some other, contrived, larger struggle.

In December I can maybe produce a smaller story that fits them better.

1

Swift, the Programming Language, and Why I Love It

He had me at closures. Nomadic chunks of code that show up when they’re needed.

Quick note: This episode is heavy geek.

A few years past Apple was looking for something to fill a few minutes in their presentation to their faithful developers. “Let’s tell them about Swift”, someone high up decided. I was watching that presentation, and at first I was all like, “Another language? This will be a fiasco.” Apple has a mixed (and mostly bad with one great success) record when it comes to languages. A few minutes in, I was intrigued. By the end, I was sold.

Swift built on the work of great designers of other languages, and managed to bring (most of) the best of untyped languages with (most of) the best of strongly-typed languages. In my heart, I’m a strongly-typed guy, but I’ve been using javascript long enough to appreciate its flexibility.

But there’s one place Swift went that no other language has ever tread. Nil. One of the most common problems in software is when you expect something to the there, but for whatever unexpected reason, nothing is there. This is literally the cause of every blue screen of death you have ever seen.

In Swift, when you say that variable x will be of a particular type, right from the get-go you have to decide if x can ever be nil. If you allow that x can be nil, then every time you use x you have to take the potential that it is nil into account. No getting around it. If you say that x can never be nil, then the compiler will not allow you to create any condition that x is nil.

You can, of course, punch the compiler in the face and say you know goddam well that by then x will not be nil. But, awesomely, you don’t have to be all aggro. You can be totally graceful and say, “if x is not nil, then let’s have some fun.”

Swift has many other features created with one purpose: Make the costly mistakes commonly made with other languages impossible. One of the motivators of this language was a potentially awful security flaw on iPhone a few year back, caused by a stupid missing curly brace.

The Swift compiler is almost spooky. I’m not going to go into its almost-magic ability to resolve generics, but dang.

I do have a quibble: If one is focussing a language on security and preventing bad programming patterns, I would like to see the end of “break” and “continue”. We all learned long ago how terrible “goto” is; it’s time to recognize goto’s buck-toothed kin. (In the iPhone security problem above, goto was part of the problem. I was stunned that any code from my company included that instruction.) I once sat through a long discussion on the WebKit boards while they argued about how to define constants to handle exceptional cases, when the exceptional cases themselves could have been eliminated by banishing “break”.

Programmers out there: any time you want to type “break”, there is a better answer. If you can’t find that answer, it’s time to grow. Seriously. Outside of case statements, there is no time “break” is the right answer. EVER. (Swift eliminated break in case statements for you.)

Maybe I’ll fork the Swift open source and create hard-ass Swift. The same as Swift, but without the goto’s. Or maybe I’ll just challenge my peers to embrace the spirit of Swift, and write good code.

I program in four languages day in and day out, and a few others now and then. Give me Swift.

1

Giving with Maximum Gain

In this case “gain” is used in the electronics sense. We are prepared to amplify your donation 6x. Six! X!

We can all be excused if disaster fatigue sets in; first one hurricane, then another (carrying two disasters with it), and finally fires. Hopefully finally.

But many people lost their lives and their loved ones, and many more lost their homes to the wildfires in Northern California. As someone who watched a large chunk of my home town burn down in years past, I feel for the folks up in wine country.

The fires are mostly out, or at least contained, and the weather is cooling. The first part of the disaster is over. But now comes the much more difficult part. The rebuilding. Providing shelter for thousands of people who are, unexpectedly, homeless. Some of those have enough insurance to get back on their feet (eventually), but not all.

Habitat for Humanity exists to build homes for those who need them. We’re holding a fundraiser right now, and it works like this:

You donate $10. The Official Sweetie and I match that donation (up to a total of $250). Now your donation is at $20. But then my employer gets involved. They are currently matching donations to Habitat times two.

Your humble ten bucks is now sixty mighty dollars of world-improving power.

Just so we’re clear, because you don’t give the money directly to the charity, but instead use us as a proxy, you won’t get a tax deduction. You’ll just do six times as much good.

Ready? Let’s do it!

1

The Pledge of Allegiance was Written by a Socialist

Here’s a fun fact I bet you didn’t know: The pledge of allegiance was written by a socialist. I’m not quite sure what Francis Bellamy was thinking; although he imagined all the people of the world pledging to their various flags, the result of the exercise is inevitably nationalistic.

But Bellamy was a socialist, and he wrote the pledge, and a treatise on the etiquette surrounding it. Much of that was slurped up by the flag code (although the text of the pledge has undergone two significant edits). The flag code includes language that states one should face the flag while speaking the pledge, and remove any non-religious headwear while one salutes the flag.

Uh, Whups, my original source contains the phrase “non-religious”, but the current code does not. I’m very curious when the change was made. If the flag code were on GitHub this would be much more transparent.

Most of this same etiquette has been transferred to the national anthem. So let’s get this straight. If sitting or kneeling or quietly protesting is bad, shouldn’t ignoring the whole pledge be worse? Not an act to raise awareness, just pure sloth. Sitting around, yapping to the people around you, absolutely ignoring the flag out of pure contempt should be far worse.

Right?

Tune in and watch your congress during the pledge tomorrow morning. Watch the senate. Glory in the patriotism. All those fuckers are far worse than a conscientious athlete hoping to deliver a message. Most of your elected representatives just don’t care. There is protest, and there is contempt.

Tree-Climbing

There is a tree in my backyard, and I’ve never climbed it. There was a time earlier in my life where that would have been unthinkable. Gotta climb trees, after all.

But somewhere between then and now I passed from being a climber of trees to a non-climber. I didn’t notice when it happened, but I do appreciate the shade.

A coupe of days ago I punched the time clock at the end of the day and transitioned from coding to writing… and kept coding. Yesterday, the same thing. Today, so far it’s mostly been coding.

It’s not a bad thing that there’s something I’m working on at Apple that has taken root so deeply in my brain. If your database isn’t normalized, what tools can you offer at the just-above-driver level to make it as easy as possible to keep data consistent, without degrading write performance? It’s a very small part of my job, but chasing questions like this is geek nirvana.

But now — right now — I’m gonna finish a draft of Knives 40.

1