The Daily Parker

Politics, Weather, Photography, and the Dog

U is for UUID

Blogging A to ZFor day 21 of the Blogging A-to-Z challenge I'm going to wade into a religious debate: UUIDs vs. integers for database primary keys.

First, let's define UUID, which stands for Universally Unique Identifier. A UUID comprises 32 hexadecimal digits typically displayed in 5 groups separated by dashes. The actual identifier is 128 bits long, meaning the chance of a collision between any two of them is slightly lower than the chance of finding a specific grain of dust somewhere in the solar system.

An integer, on the other hand, has just 32 or 64 bits, depending on the system you're using. Not only do integers collide frequently, but given that incrementing integer keys typically start at 1, they collide all the time. Also, using an incrementing integer, you don't know what ID your database will give you before you insert a given row, unless you create some gnarly SQL that hits the database a minimum of twice.

Many people have weighed in on whether to use UUIDs or auto-incrementing integers for database keys. People argue about the physical alignment of rows, debugging and friendly URLs, stable IDs vs deterministic IDs, non-uniqueness across tables, inadvertent data disclosure...lots of reasons to use one or the other.

The bottom line? It doesn't really matter. What matters is that you have sensible, non-religious reasons for your choice.

Both UUIDs and serial integers have their place, depending on the context. If you have a lookup table that users will never see, use serial IDs; who cares? If you use an ORM extensively, you might prefer UUIDs.

If you're new to programming, all of this seems like angels on the head of a pin. So read up on it, listen to the arguments on both sides, and then decide what works to solve your problem. Which is basically what you should do all the time as a professional programmer.

How a fundamentalist sect may be wiped out by polygyny

A fundamentalist Mormon sect living along the Nevada-Arizona border has a serious problem with a rare genetic disorder, because everyone is closely related to everyone else:

“With polygyny you’re decreasing the overall genetic diversity because a few men are having a disproportionate impact on the next generation,” says Mark Stoneking, a geneticist at the Max Planck Institute for Evolutionary Anthropology, Germany. “Random genetic mutations become more important.”

In isolated communities, the problem is compounded by basic arithmetic: if some men take multiple wives, others can’t have any. In the FLDS, a large proportion of men must be kicked out as teenagers, shrinking the gene pool even further.

Which brings us to the good news. Since inbreeding tends to uncover “recessive” mutations that would normally remain in hiding, studying these communities has helped scientists to identify many disease-causing genes. That’s because genetic information is useless on its own. To be meaningful to medical research, it must be linked to information about disease. In fact, more human disease genes have been discovered in Utah – with its Mormon history – than any other place in the world.

It’s not the legacy Brigham Young expected, but in the end, it’s possible that the controversial practice might have some unintended positives.

Religion, man. Religion.

The Pope and the pagan

Andrew Sullivan's note Friday analyzes the President's trip to the Vatican from a distinctly conservative and Catholic perspective:

Trump is not an atheist, confident yet humble in the search for a God-free morality. He is not an agnostic, genuinely doubtful as to the meaning of existence but always open to revelation should it arrive. He is not even a wayward Christian, as he sometimes claims to be, beset by doubt and failing to live up to ideals he nonetheless holds. The ideals he holds are, in fact, the antithesis of Christianity — and his life proves it. He is neither religious nor irreligious. He is pre-religious. He is a pagan. He makes much more sense as a character in Game of Thrones, a medieval world bereft of the legacy of Jesus of Nazareth, than as a president of a modern, Western country.

Every pillar of Trump’s essential character is a cardinal sin for Christians: lust, gluttony, greed, envy, anger, and pride. We are all guilty of these, of course, but there is in Trump a centrality to them, a shame-free celebration of them, that is close to unique in the history of the American presidency. I will never understand how more than half of white Catholics could vote for such a man, or how the leadership of the church could be so terribly silent when such a monster stalks the earth.

He also fumes about Trump's trip to Saudi Arabia, a country we trade with but shouldn't exactly want to emulate.

Remember the American tourism industry?

Travel site Frommer's reports that foreign travel to the U.S. has plummeted since the inauguration, for obvious reasons:

[T]he prestigious Travel Weekly magazine (as close to an “official” travel publication as they come) has set the decline in foreign tourism at 6.8%. And the fall-off is not limited to Muslim travelers, but also extends to all incoming foreign tourists. Apparently, an attack on one group of tourists is regarded as an assault on all.

As far as travel by distinct religious groups, flight passengers from the seven Muslim-majority nations named by Trump were down by 80% in the last week of January and first week of February, according to Forward Keys, a well-known firm of travel statisticians. On the web, flight searches for trips heading to the U.S. out of all international locations was recently down by 17%.

A drop of that magnitude, if continued, would reduce the value of foreign travel within the U.S. by billions of dollars. And the number of jobs supported by foreign tourists and their expenditures in the United States—and thus lost—would easily exceed hundreds of thousands of workers in hotels, restaurants, transportation, stores, tour operations, travel agencies, and the like.

Wow, didn't see that one coming. But hey, with the euro at $1.05 and Sterling at $1.24, maybe it's time to check airfares?

Even on a day off

Welcome to February, in which I hope to increase my pathetic blogging rate (currently 1.23 per day for the last 12 months). Of course, even taking a day off to catch up on things doesn't seem to be helping, because I have all of these articles to read:

So, a lot to read. And still almost no time to read it.

Beer and Bibles

The Economist has found that craft breweries are inversely correlated with religiosity in the US:

Some states are craftier than others. Atop the list of craft breweries per capita is Vermont, with 44 of them crammed into one of the nation’s smallest and least populated states. In addition to being better liquored, Vermonters are a good bit more godless than the national average. This reflects a broader trend: there is a markedly negative correlation between a state’s religiosity and breweries per person.

Local regulations determine the level of production much more than demographic characteristics such as income or education, says Bart Watson, chief economist of the Brewers Association, a craft-beer trade organisation. And religious legislators may get a bit overzealous. Utah, a state populated with many teetotaling Mormons, strictly limits the strength of draught beers and cocktails.

As you'd expect from that newspaper, they have a cool chart, too.

During a four-hour WebEx session...

Stuff to read later:

OK, conference call is ending. Time to perambulate the pooch.

More consequences of religious extremism

After the criminal gang known as ISIS held the Mosul Dam in Iraq last year, it did not follow the campsite rule when it fled the Iraqi government's counter-attack. Consequently, engineers say the dam is in danger of imminent collapse:

[P]ressure on the dam’s compromised structure was building up rapidly as winter snows melted and more water flowed into the reservoir, bringing it up to its maximum capacity, while the sluice gates normally used to relieve that pressure were jammed shut.

The Iraqi engineers also said the failure to replace machinery or assemble a full workforce more than a year after Islamic State temporarily held the dam means that the chasms in the porous rock under the dam were getting bigger and more dangerous every day.

Nasrat Adamo, the dam’s former chief engineer who spent most of his professional career shoring it up in the face of fundamental flaws in its construction, said that the structure would only survive with round-the-clock work with teams filling in holes in the porous bedrock under the structure, a process known as grouting. But that level of maintenance, dating back to just after the dam’s construction in 1984, evaporated after the Isis occupation.

People are worried that the rise of Donald Trump in the polls here in the U.S. signals a new dumbing-down of our country. But nothing beats the destructive power of religiously-fueled anti-intellectualism of the kind that ISIS and, even better, Boko Haram perpetrate on innocents.

Also, let's not forget who is most responsible for the chaos Iraq has suffered for the last 12 years: us. This is one more legacy of George W. Bush's needless war.