Miscellaneous Mac-appropriate locate(1) script of the day — June 9, 2017

Miscellaneous Mac-appropriate locate(1) script of the day

If you’re on a Unix variant of most any sort, this command will find you every file whose name contains foo anywhere on your machine:

find / -name '*foo*'`

It will also run impossibly slowly, because it’s scanning all of the (maybe millions of) files on your machine. A better option is to periodically generate a database of all files, then do something akin to

select distinct filename
from my_filesystem
where name like '%foo%'

As luck would have it, most Linux distributions that I’m familiar with come with a tool called locate(1) that does this for you, which allows you to write

locate foo

and get what you want. It requires periodically running a tool called updatedb(8) to refresh the database. A quick check of a Linux box I have on hand says that updatedb(8) runs once a day. That’s probably fine, but works less well if you’re changing a lot of filenames; then locate(1) will be behind the times. Which is sad.

Macs have it quite a lot better. They are constantly running a tool called Spotlight, which indexes everything all the time. As I understand it, the Spotlight DB is updated whenever you modify anything about a file, including its contents or its name. There’s a vast Spotlight architecture lurking underneath everything you do on a Mac. At the command line, the mdfind(1) tool lets you search for files whose Spotlight metadata matches any number of criteria, and mdls(1) lists the metadata for a specified file. I’m a Spotlight-metadata novice at this point, but here are some good resources:

  1. This is a good set of tips for accessing the full variety of metadata available to you through the md* tools.
  2. The documentation on Uniform Type Identifiers (which are one part of the Spotlight metadata).

I wrote a tiny little script whose job is to invoke mdfind(1) when you’re on a Mac, and invoke locate(1) on any other Unix. This is handy to me, since I copy my ~/bin directory to every Unix machine I use, and would very much like to use the same locate command on every machine. (You should see my ~/.bashrc, he said sexily.) Here it is:

(15:32 -0400) slaniel@laptop:~$ cat ~/bin/locate 
if [ ${os_ver} == "Darwin" ]; then
    mdfind "kMDItemFSName=\"*${pattern}*\"c"
    /usr/bin/locate -i $@

That mdfind line initially said

mdfind "kMDItemContentType=\"public*\" && kMDItemFSName=\"*${pattern}*\"c"

until I realized that not every file I cared about was in the public domain: public would only catch files of some publicly known type (e.g., QuickTime videos, GIFs, etc.). For instance, here’s what mdls(1) says about a .DOCX file:

kMDItemContentType             = "org.openxmlformats.wordprocessingml.document"
kMDItemContentTypeTree         = (
kMDItemKind                    = "Microsoft Word document (.docx)"

That last item (kMDItemKind) is interesting. It leads to a quick bit of command-line hackery to find every Microsoft-format file in your filesystem:

(15:53 -0400) slaniel@AKAMAI_laptop:~$ mdfind "kMDItemKind == '*Microsoft*'" | tr '\n' '\0' | xargs -0 mdls | grep kMDItemKind | grep -o '[^"]\+"$' |sed 's#"$##' | sort | uniq -c | sort -nr
    542 Microsoft Word 97 - 2004 document (.doc)
    534 Microsoft Excel Workbook (.xlsx)
    307 Microsoft Word document (.docx)
    145 Microsoft Word 97 - 2004 document
    145 Microsoft Excel 97-2004 Workbook (.xls)
     33 Microsoft Excel template
     29 Microsoft PowerPoint presentation
     28 Microsoft Excel workbook
     28 Microsoft Excel Macro-Enabled Workbook (.xlsm)
     28 Microsoft Excel 97-2004 workbook
     27 Microsoft Word document
     20 Microsoft PowerPoint 97-2004 presentation
     15 Microsoft personal dictionary
      9 Microsoft Word 97 - 2004 template
      8 Microsoft Outlook document
      8 Microsoft Graph preferences
      3 Microsoft Word Macro-Enabled template (.dotm)
      1 Microsoft Word MHTML document (.mht)
      1 Microsoft Word 97 - 2004 template (.dot)
      1 Microsoft PowerPoint toolbar
      1 Microsoft PowerPoint 97 - 2004 Template
      1 Microsoft Outlook signatures
      1 Microsoft Office Theme

There’s a whole world of Spotlight metadata here, of which I’m only skimming the surface. Suffice to say that it’s an extraordinarily powerful tool to have in your kit.

A modest proposal for all current and future presidents —

A modest proposal for all current and future presidents

When a terror attack happens in London and eight people are killed, world leaders line up to demonstrate their seriousness and give their thoughts and prayers to the victims. When the 9/11 attacks happen and 3,000 people are killed, it is a world-historical event. On the other hand, when 33,000 people die every single year in car crashes — a 9/11-sized death toll just about once per month, or around 90 people dying every single day — it’s counted as part of the noise; it’s the cost of living in a car-dependent society.

My modest proposal for our presidents is that the gravity of their public pronouncements be proportional to death tolls. Preventable deaths (and who would argue that automobile-crash deaths are not preventable?) are a superset of murders; murders are a superset of deaths from terrorism; deaths from terrorism are a superset of deaths from Muslim terrorists. The public wailing and rending of garments should match up with this ordering.

Capsule book reviews, 2017-04-23 — April 23, 2017

Capsule book reviews, 2017-04-23

  • C. Wright Mills, The Sociological Imagination

    Critique of sociology as it’s commonly practiced. On the one extreme (according to Mills) are those who dwell in the loftiest of abstractions; Talcott Parsons’s The Social System comes in here for particular scorn. Mills says that Parsons’s work is so committed to defining concepts, and getting definitions correct, that it can only focus on syntax rather than on semantics. That is, Parsons can tell us how words work together, but not how those words relate to the actual lived experience of real human beings. At the other end of the spectrum are those sociologists (Mills’s “abstracted empiricists”) who are excessively focused on the details of lived experience, such that they can tell us exactly what happens in, say, a specific Midwestern village. Without ever coming out and saying it, I think Mills’s critique of these excessively detailed sociologists is aimed at the Middletown studies.

    The proper study of a sociologist, says Mills, is the social system: the complex of psychological, economic, social, cultural, governmental, and (this last one Mills calls out for special attention) historical influences that impinge on the life of an individual human being living at a given time and place. Studying one small town, and then another small town, and then a third small town, and then pipe welders within a given city, and so forth, will not give a picture of the social system. The social system can only be understood by someone who appreciates both both the low-level (psychological) picture and the high-level (society-wide) one. This simultaneous understanding of, and empathetic living within, the two worlds is the sociological imagination.

    Much of the book feels like a mildly coded attack on specific sociologists, whom specialists within the field at the time of the book’s writing would have instantly decoded; 56 years later, it’s somewhat more difficult. Despite this encoding, the book’s directness — almost brashness — is refreshing — as when Mills notes that in the abstracted empiricists’ studies,

    the details are piled up with insufficient attention to form; indeed, often there is no form except that provided by typesetters and bookbinders. The details, no matter how numerous, do not convince us of anything worth having convictions about.

    or when he attacks Parsons and friends:

    What has happened in the fetishism of the Concept is that men have become stuck way up on a very high level of generalization, usually of a syntactical nature, and they cannot get down to fact.

    This directness has some value in what might otherwise be a dry recitation of petty academic squabbles. Mills argues convincingly that the disputes matter to real humans; his style especially calls this out.

    The 1960s come through as a faint rumbling in the background of Mills’s book. He angrily laments the industrialization and bureaucratization of sociology: the social sciences, he says, have become co-opted for use by governments, by militaries, and by corporate human-resources departments. That’s not how you understand a social system; it’s how you use science to more perfectly control human beings. And its effect on sociological practice is to turn sociologists themselves into cogs in a bureaucratic machine:

    explicitly coded methods, readily available to the technicians, are the major keys to success. In some of the founders [Weber, Durkheim, etc.], empirical techniques serve an imagination which, it is true, has often been curiously suppressed, but which one always feels to be there. When you talk with one of the founders you are always dealing with a mind. But once a young man has spent three or four years at this sort of thing, you cannot really talk to him about the problems of studying modern society. His position and career, his ambition and his very self-esteem, are based in large part upon this one perspective, this one vocabulary, this one set of techniques. In truth, he does not know anything else.

    I’ve read critiques of social science of this sort from other authors, though I can’t think of references at the moment. We’re (or at least I’m) inclined to think of the modern Ph.D. as the timeless way of things: you go to grad school, get assigned your little problem by your advisor, then solve your little problem, then spend the next 15 years of your career working on your little problem until you get tenure, at which point (the doctor dreams) you can work on whatever problem suits your fancy. It’s an argument like this by which my college mentor dissuaded me (whether he meant to or not — I think he was just being honest) from getting a Ph.D. You get sucked into one end of the bureaucratic machine and spat out the other. It’s the rare person (my mentor was one) who’s lucky enough to direct his own study; he’s one of the people of whom Mills would have said that “you are always dealing with a mind.”

    Mills’s final chapter — instructing up-and-coming sociologists on how to do meaningful work, and how to keep their minds active even while they’re getting churned through the machine — justifies the price of admission on its own. I found it deeply inspiring for anyone, not just sociologists, who’s afraid of going stagnant as he ages. While much of the book can feel like a flamethrower applied to the rest of the field, the last chapter is patient shepherding; it reveals Mills for what he is, namely a passionate, deeply humane researcher.

  • Pankaj Mishra, The Age of Anger: A History of the Present.

    We’ve lived before, says Mishra, in a world that feels chaotic and exhausted, as ours does today. The ISIS of yesteryear were the anarchists of the mid- to late-1800s. The global élites whom everyone loves to hate today were the capitalists of the industrializing world. Voltaire, whom the world remembers as the father of the Enlightenment, made a fortune and was happy to see the world run by merchants. There have always been two sides: on the one side, what today we might call the neoliberals or the technocrats, happy to tweak marginal tax rates here or grant the poor more or less health insurance there; on the other, those who believe that tribalism, community, blood, and fire are the real basis of society. There have always been anarchists happy to blow up the existing order; there have always been Mikhail Bakunins and Steve Bannons. There have always been Voltaires and Hillary Clintons.

    I hope I don’t sound like I’m coming down on either side here. On the one hand, books like Democracy for Realists convince me that the bulk of people are not moved by policy; they’re moved by the success of their team, their tribe, their party. They’re moved by war and by destruction. On the other hand, industrializing economies have been growing exponentially for centuries, and it should be our job to share this growth with the neediest members of our society; if expanding Social Security and improving the health of all Americans is the policy of a milquetoast technocrat, then count me as a milquetoast technocrat. The job of a humane politician in the 21st century is to channel this desire for blood and fire into socially desirable outcomes that help all Americans — to build up rather than to burn down.

    “We’ve been here before” is the lesson of Mishra’s painfully over-written book. “Go read yer Rousseau, yer Nietzsche, and your Voltaire” might be the secondary lesson. For all the ink this book spills, it doesn’t go much beyond “a pox on both your houses”: the anarchists are guilty of perverting Rousseau’s ideas into an ethic of destruction, while the heirs of Voltaire are the exponents of trickle-down economics who lack any empathy for the wretched of the earth. The only conclusion Mishra comes to is perhaps implicit: the last time we were in such a world, it only ended when World War I and then World War II detonated a large part of the world’s wealth. Maybe the only correct conclusion is that inequality needs a cleansing fire to wipe it out. That’s certainly the conclusion that Thomas Piketty, coming at the problem from a completely different different angle, arrives at. And maybe Mishra avoided the common problem of all books that diagnose a social ill, namely that the last chapter tries and fails to suggest solutions.

    Still, I think the right thing to do with this book is to skip it and mine the bibliography instead. Voters need more than the occasional tweak to the welfare state; they need to feel that they’re part of a community. And there will always be those whose only goal is to destroy that community. It’s the job of political leaders to harness these destructive impulses and direct them toward productive ends. What we need is political leadership, not the hopelessness that Mishra serves up.

Recent reads — April 1, 2017

Recent reads

I’ve been dreadfully behind on writing about books I’ve read, and there’s a danger that I’ll forget what they were about. So here’s a quick rundown:

  • The Sound Of A Wild Snail Eating. The author found herself struck down with a debilitating autoimmune disorder, which left her confined to bed for months and years. Rolling herself over in bed counted as the day’s big activity. In the midst of this, a friend brought her a snail to hang out in her flowerpot, or in a terrarium. The author spent her days watching the little guy up close: how his little proboscises sensed the world around him; his ability to carry large weights while stuck to the sides of walls; his slow digestion of any of her papers. Years later, she researched the biology of, and history of our perceptions of, snails, including (for reasons that she never really elaborates on) a great deal of 19th-century writing. Somehow the interleaving of “I am lying here staring at a snail” with “here’s what Victorians had to say about snails” was particularly delightful.

    There’s every temptation for this to turn into a cheesy sermon on living in the moment and smelling the flowers. Thankfully the author mostly avoids that temptation.

  • The Accidental Empire: Israel and the Birth of the Settlements, 1967-1977. Fascinating, in-depth look at the birth of the settlements, from the Six-Day War through the Yom Kippur War, and onward through the postwar peace talks and to the conservative ascendancy over the Israeli Labor Party. It’s in many ways a story of politically conservative Orthodox Jews rebelling against the socialist Zionists who founded the country; conservative Jews forming settlements in the Occupied Territories becomes, to many young Israelis, what campus protest was to American students during the Vietnam War.

    Vietnam also plays a role in this story. Nixon lurks on the edge of the story, with Kissinger playing shuttle diplomat between Israel, Egypt, and Jordan. Kissinger appears in town; every time he does, Nixon is getting more and more embroiled in Watergate. Eventually Nixon disappears, but Kissinger remains (under Ford).

    The fundamental conflict in the book is between the doves, who want to leave the Occupied Territories empty as a mere buffer between Israel and its neighbors; and those mostly religious people who believe that God himself decreed that Jews should occupy “The Whole Land”. (Presumably The Whole Land has a well-known boundary within today’s political map; I’m not sure what that boundary is.) The Arabs, for their part, didn’t help — e.g., with the Khartoum Declaration after the Six-Day War declaring that “the main principles by which the Arab States abide [are] no peace with Israel, no recognition of Israel, no negotiations with it, and insistence on the rights of the Palestinian people in their own country.”

    The settlers’ main technique, which comes up again and again throughout Accidental Empires, is “creating facts”: establish settlements within the Occupied Territories, and fill them with people before anyone has time to write laws forbidding them. That, and just persistence: by the end of the book, settlers and soldiers have a routine that they’re obliged to act out. The settlers move in; the soldiers load the settlers onto buses and escort them out; the next week, or the next month, the settlers try again. Eventually they win: the settlements are an established fact.

  • Mary Norris, Between You & Me: Confessions of a Comma Queen: delightful candy. A memoir and grammar guide by the long-time copyeditor at The New Yorker. Exactly the book for you if you’re both a compulsive copyeditor and a lover of The New Yorker. I happen to be both. Manages to not be needlessly fussy: the job of the copyeditor — apart from shoehorning the world’s finest writers into TNY’s house style (“reëlected” and such) — is to convey the underlying ideas as clearly as possible. This is why it’s both hilarious and completely correct when the author spends a fair amount of time discussing the appropriate hyphenation on “star-fucker”. It’s not a “star fucker”, since that could be confused with someone who is exceptional at having sex. The hairs can be split pretty finely, and there’s a lot of room for disagreement. Elaborating on the choices she makes, and the arguments she has with New Yorker staff on these topics, is a large part of the charm.

    Another large part of the charm is when she delves into The New Yorker’s storied history — in particular, the continuing reverberations of William Shawn, The New Yorker’s editor for many decades. This is the “Mr. Shawn” of whom John McPhee wrote, in the introduction to his Oranges: “While mentioning a number of story possibilities to Mr. Shawn, I uttered the single word ‘oranges?’ … He answered right back. He always answered quickly. It seemed impossible to propose any subject to him that he had not thought about before you had. He kept his writers at the far ends of something like bicycle spokes — all separate, all somehow spinning together and apart, with him at the center — and when he turned down an idea he was usually protecting the interests of some writer whose name would never be mentioned. ‘No. I’m very sorry. No,’ he would say typically, his voice so light it fell like mist. ‘That subject is reserved in a general way for another writer.’ To my question about oranges, though, he said, ‘Yes. Oh my, yes.’

    Norris says that Mr. Shawn “was squeamish about fish hooks, wigs, twins, and midgets”, along with the usual “piss, shit, blood, and spit.” The pile of Shawn curiosities piles higher and higher: “Mark Singer once had a reference to Ex-Lax removed from a story about the dirty-tricks campaign for state senator of Roy Goodman, whose family money came from Ex-Lax.” Fast forward. We’re now in a era when David Remnick, the current editor-in-chief and much-beloved host of the New Yorker Radio Hour podcast, can have a competition with his colleagues on the magazine to see who can fit the most instances of the word “fuck” into an issue. (Remnick himself has a significant leg up, since he spent many years reporting from Russia and is fluent in Russian.)

    If you’re not already into The New Yorker, you really, really need to remedy that. I would recommend starting with most any book by John McPhee (Oranges, The Curve of Binding Energy, or Uncommon Carriers, say), or the collection of Anthony Lane’s movie and book reviews (Nobody’s Perfect), or Fierce Pajamas, the collection of New Yorker humor pieces from throughout its history. Or just grab a copy from a newsstand. Individual issues are some monstrously high price these days (above $7, I think), but that just says that you should subscribe; after reading just one or two issues you’ll want to.

  • Peter Pomerantsev, Nothing Is True and Everything Is Possible: The Surreal Heart of the New Russia. This is the story of a modern-day authoritarian régime, whose mechanism of control over the populace is less through a gun barrel and more through shrewd manipulation of the media. “This isn’t a country in transition”, says Pomerantsev, “but some sort of postmodern dictatorship that uses the language and institutions of democratic capitalism for authoritarian ends.” The danger for the rest of us is that we thought Russia would be confined within its boundaries, but we were wrong: the Russian oligarchy and secret police is extending its tendrils ever outward, such that London now feels (according to Pomerantsev) like a suburb of Moscow. The book was published in 2014, so I’m sure the author has things to say about how far those tendrils extended during the 2016 U.S. presidential election.

  • Masha Gessen, The Brothers: The Road to an American Tragedy. Gessen’s argument is that the Tsarnaev brothers, who carried out the Boston Marathon bombing in 2013, can’t be understood without understanding the position of the North Caucasus (Dagestan and Chechnya specifically) within Russian society, and without framing the Tsarnaevs’ identity as predominantly that of displaced American immigrants. They should not be viewed, Gessen says, as “Muslims”. Their attachment to Islam was tentative at best. They were displaced immigrants, within a community of immigrants who were just barely holding on in Cambridge, Massachusetts, and whose North Caucasian norms were constantly butting up against those of the American community that surrounded them.

    Scaling out from the Tsarnaevs, there are also a lot of questions within this book about the history of the FBIs’ involvement in American terrorist activities. To quote Gessen: “When the FBI undercover agent or informant is the only purported link to a real terrorist group, supplies the motive, designs the plot and provides all the weapons, one has to question whether they are combatting terrorism or creating it.” She goes into more detail about this in her Longform-podcast interview about this book, which I would highly recommend. And if you’ve not already read the essays she’s written since Trump’s election — principally Autocracy: Rules for Survival — you need to. She has a distinctive, necessary, strong voice.

  • Anthony Bourdain, Kitchen Confidential: Adventures in the Culinary Underbelly

    Mind candy. Parts of it had already percolated out into the broader society and thence into my brain, including Bourdain’s observation that anyone who orders steak well-done on a busy night in a restaurant will get a briquette that’s been deep-fried. Other, equally useful parts had not — for instance, when Bourdain notes that everyone hates brunch service, that it’s horrendously overpriced, and that all your best cooks will have worked the Saturday-night shift and will not be in to work on Sunday morning.

    There are other bits that I would have found useful back when I was a less-experienced cook — for instance, his advice on knives:

    Most of the professionals I know have for years been retiring their Wusthofs and replacing them with the lightweight, easy-to-sharpen and relatively inexpensive vanadium steel Global knives, a very good Japanese product which has — in addition to its many other fine qualities — the added attraction of looking really cool.

    I love my Global. I’m glad Anthony Bourdain says I’m right.

    Bourdain is fun for his “I’mma tell it like it is, and fuck you if you disagree” attitude. Not that I agree with him all the time — he hates vegetarians — but it’s just entertaining. Here he is on garlic:

    Avoid at all costs that vile spew you see rotting in oil in screw-top jars. Too lazy to peel fresh? You don’t deserve to eat garlic.

    A couple hundred mind-candy pages of this is entertaining.

  • Alexander Stille, The Sack of Rome: Media + Money + Celebrity = Power = Silvio Berlusconi

    I can’t imagine why I’d be reading a book containing quotes like this:

    Rather than asking themselves how Berlusconi had amassed his vast fortune in such a short time, many voters more or less took for granted that Berlusconi had done the kinds of things most other businessmen had done, but they did not necessarily see this as a problem. Since many voters assumed that most politicians were corrupt, they felt that a rich businessman might be less inclined to milk the system than a professional politician.
    Italians, voters and journalists alike, paid remarkably little attention to the problem of the conflicts of interest represented by such a major economic figure, particularly in the delicate area of the media, combining so much public and private power. Berlusconi insisted that he would resolve the problem shortly after the elections, and no one made a big issue out of it.
    Berlusconi understood that voters were more interested in personality than in programs, and that what he needed to do was to sell himself and the lifestyle he represented. His own story as self-made man and billionaire soccer club owner was more convincing and appealing than the explanations by economists of the left of the short-term sacrifices and long-term benefits involved in Italy’s joining Europe’s single currency.
    Over and over, he hammers away at points that are preposterously untrue—that his “enemies” enjoy a media monopoly and use it ruthlessly against him; that there is no conflict of interest between his private and public roles; that the many criminal investigations of him and his companies have turned up no evidence—and yet amplified and repeated by his newspapers and television stations, they gradually become common misperceptions that one hears coming out of the mouths of ordinary Italians who know few of the underlying facts.
    In his usual manner, Berlusconi at first denied that he had used the vulgarity, but when his comment was replayed on tape he insisted the left didn’t know how to take a joke.
    It is equally true that Romano Prodi and the center-left failed to give Italians strong positive reasons to vote for them. They seemed to think it was enough not to be Berlusconi.

    The book is from 2007.

  • Jennifer 8. Lee, The Fortune Cookie Chronicles: Adventures in the World of Chinese Food. This book starts out feeling like — and its cover suggests that it will be — a trivial little thing about Chinese food. And it’s got some of that, which feels like it was mandated by an editor who didn’t think it would move product as it was. Fundamentally, though, it’s a book about the structure of the Chinese immigrant community in the United States, and the pipeline connecting the U.S. to Fujian Province. You should read it on that basis; some of the other bits — such as when she tries to find The Best Chinese Food In The World — feel like insignificant baubles.

  • Bradley Efron and Trevor Hastie, Computer Age Statistical Inference: Algorithms, Evidence, and Data Science. If you’re familiar with the field, these authors’ names are self-recommending: Efron for having invented the bootstrap, and Hastie for having written, inter alia, books on machine learning. CASI is half a survey of modern, computer-based techniques for analyzing data, and half an outline of the theory behind why those techniques work. We’re in an era when the techniques have outrun the theory, so we’re using a lot of machinery that seems to work, but for which we can’t provide mathematical guarantees. What brought us into this era, of course, was the computer, which suddenly allowed us to build models involving millions of parameters, trained on billions of data points. It’s an exciting time, but for people of a certain stripe it’s an uneasy time. CASI is a delightful introduction to both the classical methods (which by now have strong mathematical justifications, but didn’t necessarily have such justifications when they started being used), and the new world we’re in now. I used it as beach reading; it’s honestly that readable. Highly recommended.

  • James Mcbride, Kill ‘Em and Leave: Searching for the Real James Brown. A good book up to a point. It’s good to learn this much about James Brown, who appears to be a legitimately fascinating figure. During my lifetime, he was sort of a washed-up has-been with a well-publicized drug addiction. In Mcbride’s telling, Brown was a deeply generous man who let few people get close to him, and who fought for everything he had. If it were possible to strip the author out of the book, leaving behind almost a bare recitation of facts about Brown’s life, I’d be happier with it. The author is trying too hard, as when he writes, “You speak foul of the Redeemer Who Spilt His Blood in these parts and you’re liable to find yourself knocked upside the head hard enough to spend the rest of your life leaning like a flower a week after the rain.” The author dumped too much of this inauthentic noise over the top of Brown’s music. But Brown’s life and music are interesting enough to dig themselves out.

  • Mehrsa Baradaran, How the Other Half Banks: Exclusion, Exploitation, and the Threat to Democracy. It is very expensive to be poor. The interest you pay to borrow money is higher. Around one in four American households is unbanked or underbanked. If you’re unbanked, your ability to function in the economy is crippled. After working, grippingly, through a history of American banking, to include savings-and-loans, credit unions, and Morris banks, Baradaran comes to recommend a system of postal banks — a “public option” for banking. It’s a simple, brilliant idea, and one that we need urgently.

    The author’s ability to research and write readable history is matched only by her controlled moral outrage, as when she contrasts our finger-wagging attitude toward the “irresponsible poor” with our unlimited bailouts for U.S. banks: “Perhaps we Americans will renounce our easy credit culture, call for structural change, go back to the gold standard, eliminate the national debt, or force the financial world to take on less debt, but until we do, it is sanctimonious to direct our collective aversion to debt at just one portion of the population.”

    And certain of her illustrative statistics pull the reader up short:

    the average unbanked family with an annual income of around $25,000 spends about $2,400 per year, almost 10 percent of its income, on financial transactions. This is more money than these families spend on food. [4] In 2012, the unbanked spent a total of $89 billion on financial transactions alone. [5] And these expenses can mean the difference between a family’s financial survival and its failure. For example, on average, families who filed for bankruptcy in 2012 were just $26 short per month on meeting their expenses.[6] Saving $2,400 per year, or $200 per month, could save many families from the devastation of bankruptcy.”

    (Citations in the original, albeit without the square brackets to mark them off, and without hyperlinks.) I felt more informed, more morally outraged, and more equipped with solutions after reading this book than I was when I began. I couldn’t recommend it more strongly.

  • Kingsley Amis, Lucky Jim

    My friend Dan pointed me toward this delightful little thing. It’s in the vein of P.G. Wodehouse, if Wodehouse weren’t just raising his palms to the sky and lamenting these silly devils here on planet Earth. Amis is what you’d get if Wodehouse were engaged with the world, and enraged at it. This book is deeply funny, and surprisingly moving. (Amis’s One Fat Englishman, which I moved to after Lucky Jim, isn’t nearly as polished or as moving. I’ll let you know when I find the second Amis novel that you should move on to.)

  • Ottessa Moshfegh, Eileen: A Novel

    You’re going along, reading the autobiographical novel of a woman who had a fucked-up upbringing and who may, possibly, be not-fucked-up in her 70s. It’s well-written as far as it goes, though it’s a couple hundred pages of the form “I woke up, ate Frosted Flakes doused in bourbon, forced out a poop with the aid of copious laxatives, and went to sleep”. And then … the last bit of the book happens. I won’t mention what happens, except to say that it’s borderline incoherent. And it’s borderline unbelievable within the world of the book, except inasmuch as the world of the book is already bleak and hellish. I can’t really recommend reading this novel. It doesn’t feel like an interesting enough stylistic innovation to justify the plot. The parts of the plot in which something happens feel like they were feverishly hacked together after the author realized she didn’t know how to end the book. And then, to justify the ending, she went back through the novel and introduced a periodically recurring theme of people’s “death masks”. That is, we’re given to understand that the narrator pays attention to the false faces that everyone presents to the world. I don’t think these death masks are useful, except as a way to justify some characters’ real personalities at the very end of the novel. The real personalities don’t, to my eye, match up at all with the model we’ve built of the characters throughout the story. “Well, that’s the sort of crazy shit that happens in this novel” is, up to a point, an answer, but it’s not satisfying to me. The end feels hastily bolted on, and it ruins the entire novel for me.

    I’ll ROT13 some spoilers here. They’re sexually graphic, because the novel is sexually graphic, so be forewarned.

    Fb ng gur raq bs gur obbx, Rvyrra’f sevraq Erorppn gheaf bhg gb or, orarngu gur cbyvfurq rkgrevbe, penml. Naq fur’f nyfb oyrnx va zhpu gur fnzr jnl gung gur erfg bs gur abiry vf oyrnx: Erorppn vf qvfuriryrq, naq fbzrubj raqf hc va gur cevfbare’f zbgure’f onguebor. Ubj gung unccraf vf abg pyrne.

    Rvyrra fgebatyl fhttrfgf gung fur qehttrq gur cevfbare’f zbgure, gura yrsg ure gb qvr bs pneoba-zbabkvqr vaunyngvba va ure pne. Gur pne’f pneoba-zbabkvqr ceboyrzf ner nabgure guernq gung yvatref guebhtubhg gur obbx, frrzvatyl bayl gb frg hc gung svany fprar. Gung’f svar, ohg V guvax gur nhgube guvaxf fur’f zber pyrire guna fur vf. Gurfr yvggyr ovgf guebja va urer naq gurer gb frg hc gur svany fprar qba’g srry yvxr n chccrgznfgre qrsgyl chyyvat fgevatf; gurl srry yvxr na njxjneq cngpu wbo.

    Nyfb, jul qvq fur pubbfr gb xvyy guvf jbzna? Jryy, orpnhfr gur jbzna’f pevzrf jrer fb zbafgebhf: fur nvqrq ure uhfonaq va encvat gurve fba sbe znal lrnef. (Fur qvqa’g encr uvz; fur tnir uvz n ynkngvir orsber ure uhfonaq jbhyq encr uvz, fb gung frk orgjrra ure naq ure uhfonaq jbhyq or yrff vawhevbhf gb ure.) Guvf, ntnva, srryf obygrq ba. Gur xvq vf vagebqhprq naq oneryl tvira n snpr; gura uvf zbgure vf vagebqhprq naq oneryl tvira n snpr; gura jr svaq gur zbgure gvrq hc va gur onfrzrag bs ure ubhfr juvyr jvyq-rlrq Erorppn — jubz jr xabj nf fjrrg, phgr, naq cbyvfurq hc gb guvf cbvag — vagreebtngrf ure. Guvf vf pbzcyrgryl bhg bs punenpgre sbe Erorppn, vapyhqvat ure cbhevat bhg jvar jvgu funeqf bs tynff va vg. Gung whfg frrzf rtertvbhf. Lrf, jr frr gung ure choyvp snpr vf zvyrf njnl sebz ure ernyyl vaare yvsr, ohg ernyyl? Funggrevat n jvar obggyr gb cbhe bhg n tynff? V thrff vs lbh srry yvxr znxvat gur cbvag va n pnevpngherq jnl, gura fher.

    Abar bs guvf obbx svgf jvgu nal bs gur erfg bs vg, rkprcg va n cnvashyyl negvsvpvny jnl.

  • Norbert Wiener, The Human Use of Human Beings

    This is a wide-ranging book that I am going to need to think about for a long time before I really come to grips with it. Wiener was the founder of the discipline (and inventor of the term) cybernetics, which seeks to use analogies from the world of machines to understand the world of human beings. But that short-sells it; the OED goes a little broader, defining it thusly:

    The field of study concerned with communication and control systems in living organisms and machines.

    That’s accurate, but the scope is breathtaking. As Wiener lays it out, cybernetics includes the whole system by which information reaches an organism or a machine (we’ll just say “control system” to make it generic), the information is processed, and the control system performs some action on the basis of that information. There’s a lot to unpack there. For instance, the information could arrive at the organism with the known intent to deceive — as, for instance, when information flows in from a military adversary, and the control system has to decide how to react. In this way cybernetics encompasses game theory. Cybernetics is concerned, too, with the optimal flow of information itself — whence cybernetics encompasses information theory of the Shannon variety. Its applications include any system that exploits positive or negative feedback (concepts which were born in the cybernetic toolkit, as I understand it), so that the design of a robot that can reach its arm toward a glass of water, pick it up, and put it back down again is necessarily a cybernetic endeavor.

    Wiener often returns to an example that seemingly consumed him during World War II, when he was tasked with developing a self-governing anti-aircraft gun. This is a system that needs to predict, at the moment of firing, where the aircraft will be when the shell reaches it, which in turn requires a psychological and physical model of how the airplane pilot can maneuver his plane. The pilot’s behavior is constrained by the laws of physics and by, as I understand it, the slight problem that a too-aggressive evasive technique could cause the pilot to black out or the plane to rip apart. Having bounded, in some sense, the pilot’s set of choices, we now have to add in the complexity that the pilot knows what the anti-aircraft gun thinks, and the anti-aircraft gun knows that the pilot knows what the anti-aircraft gun thinks, and so on. Hence the design of an anti-aircraft gun is necessarily game-theoretic in the von Neumann-Morgenstern sense.

    The part that I’m going to have to reflect on is where Wiener essentially presents science, the law, and international relations as cybernetic problems of a sort. The difference between the adversary we face in science, and the ones we face in law and international relations, is that — to quote Einstein — “the lord God is subtle, but malicious he is not.” That is, science is interrogating a being that may be difficult to understand, but is not actively out to fool us. The rules of the game are there for us to discover, and will not change with our having discovered them, whereas international relations is a game in which our adversary is very often out to dupe us. Wiener labels the control problem in science as an ‘Augustinian’ problem, after his characterization of St. Augustine’s view of evil, and labels the adversarial control problem ‘Manichaean’.

    He finally moves on to note that, even if we have the means to solve any specific control problem, the larger question is whether we’ve correctly specified the goals of the control system. That is, even if we could design a self-governing machine that could, in some sense, solve international relations for us, we’d still need ethics. I need to understand why, even theoretically, the ethics problem is not also solvable by means of cybernetics. Wiener is an extremely smart man, and extremely erudite, and his book is extraordinarily vast in its scope, so I imagine he’s already thought of this and that it is I, the reader, who is the problem.

I have more to write about other books, but this is what I could rapidly get out the door. Apologies for the relative terseness. I’ve left out some books that require a more careful elaboration than I’m able to give at the moment. I’ll try to get to those presently.

Name for a particular SQL pattern? — March 31, 2017

Name for a particular SQL pattern?

A colleague just came to me to ask if I knew how to make a particular thing happen in SQL; turns out I’d done what he wanted before, so it jogged a memory and I could solve it. But I don’t know what the term of art is for this pattern. Basically, it’s a missing-values problem: you have a large number of observations from, let’s say, every hour of the day; they’re stored in the form of (day, hour, value) triples. You expect one value for every hour of every day. When the value should be there but isn’t, fill it in with some default.

For this I use a cross product, like so:

create view expected as
select distinct day, hour
    select distinct day from my_table
) a,
    select distinct hour from my_table
) b;

The values we actually do have would be retrieved with “select * from my_table”. Now if we want to find (day, hour) pairs for which we don’t have values, we do

select a.day day, a.hour hour, nvl(b.value, 0) value
from expected a left outer join my_table b
    on a.day = b.day
    and a.hour = b.hour

where nvl(a, b) is a function that returns b if a is null, a otherwise; the PostgreSQL equivalent is coalesce().

This solution works okay, so long as the cross product of days and hours isn’t too large. In the specific case of days and hours, it probably won’t be. But in the more generic case where you’d left-outer-joining a cross product to a set of actual data, there’s no guarantee that the cross product will be small.

So is there a SQL term of art for this? Is there a more elegant solution?

Dear U.S. news media — February 16, 2017

Dear U.S. news media

You’re clearly doing your job. This is awesome. Keep it up. We’re in the middle of a war between an authoritarian and the truth. You seem to be benefiting from two facts:

  1. The ruling party, in both the legislative and executive branches, has no interest in controlling its leader.
  2. There are still men and women of conscience within the civil service.

A lot of us had lost hope. This is helping us regain it. Let us know how we can help. I’m doing my part by subscribing to the New York Times, the Washington Post, Mother Jones, Slate, Pro Publica, and any other real news sources I can get my hands on.

A lot of us were scared that our institutions of civil society were too threadbare to stand up to a wannabe authoritarian. This is giving us hope. I’m still scared, but I’m more hopeful now than I was a few days ago.

A downpayment on a review of Ernst H. Kantorowicz, The King’s Two Bodies: A Study In Mediaeval Political Theology — February 13, 2017

A downpayment on a review of Ernst H. Kantorowicz, The King’s Two Bodies: A Study In Mediaeval Political Theology

Some sort of Christ image, which I'll research later

This will have to be the most cursory of reviews. I took nearly 2600 words of notes as I read the book, and I’ll find the time soon to distill them into a review (along with everything else I’m behind on writing here). Suffice to say in the meantime: this book blew my mind, and both the depth and the breadth of the erudition are staggering.

The book starts from, seemingly, a simple premise: what exactly was meant by the term “the king is dead; long live the king”? On this slender reed is solidly balanced a mountain of scholarship. In what at times feels like extreme amounts of word parsing, Kantorowicz elaborates on the slow evolution, from Aristotle through to George III, of our understanding of kings’ dual natures — to simplify greatly, they are part man and part god. (If you want the less-simplified version, I’d recommend you read the whole book.)

When we say that the king is dead but that the King lives on, we mean something like: the immortal institution of the Crown persists, even though the fallible body of the king may have passed on. But what is this immortal institution of the Crown? Is it the corporate body of the people? Is it, like Jesus, the angelic soul of the King himself, set aside the corruptible body of the king?

I really must be going, but let me just say in parting (temporarily, I assure you) that, almost as a passing thought, Kantorowicz’s next-to-last chapter contains a full elaboration of Dante’s philosophy (drawing heavily on Gilson, it seems). It completely upends my understanding of the Inferno, which I formerly took to be about Christianity. To Kantorowicz, Dante is doing nothing less than inventing a humanistic parallel to Christianity for man’s intellectual ideals, as manifested in the human community.

Periodically I encounter a book that gives me a feeling of intellectual vertigo; the last book that did that before Kantorowicz was Plagues and Peoples. The King’s Two Bodies is the first book I can remember that combines intellectual vertigo with an extraordinary level of intellectual precision. I was focusing intently on each sentence, even while each chapter drew me through centuries of scholarly history. It’s a shockingly expansive masterwork. Recommended in the highest terms.