Evo Psych is Never Our Friend

Jacob Weisberg has a new article in Slate riffing on Charlie Sheen’s recent woes that lists eight reasons why people care about celebrities. Reason #7:

Another version of this theory comes from a 2008 article in Scientific American, which attributed our celebrity obsession to status-jockeying. Some research findings: Men are mainly interested in gossip about men and women mainly interested in gossip about women; we care much more about those above us in social hierarchy than those below; we care more about people in our own age group; we care more about negative news (someone got arrested) than positive (someone won an award). According to Frank McAndrew, professor of psychology at Knox College, we instinctively collect information that can affect our social status. Negative information about higher-status, same-sex others is ammunition against biological competitors.

I don’t normally have much truck with Evolutional Psychology, but damn, if this one paragraph doesn’t explain the entire tech press as we know it. Of course, see also Reason #8.

Version Control for Everybody

I once listened to a professional SF writer lecture about his craft. A wonderful fellow — highly competent, writes great stuff, and a super nice guy to boot. His lecture included all sorts of useful and insightful tips. But the part that stuck in my mind to this day was what he said around how he handled backing up his work in progress:

“I have a folders for each story. Every day, when I’m done writing, I click Save As and save my story as ‘name-of-story date.doc’. Then every few weeks, I burn my story folders to a new CD…”

When confronted with a complex software-related problem, “regular” people develop all sorts of rational responses and workarounds that give those of us in the software industry the vapors. Nothing captures the disconnect between software people and regular people better than Yishan Wong’s breakdown of what’s wrong with OpenID:

To answer the most immediate question of “isn’t having to register and log into many sites a big problem that everyone has?,” I will say this: No, it’s not. Regular normal people have a number of solutions to this problem. Here are some of them:

  • use the same username/password for multiple sites
  • use their browser’s ability to remember their password (enabled by default)
  • don’t register for the new site
  • don’t ever log in to the site
  • log in once, click “remember me”
  • click the back button on their browser and never come back to the site
  • maintain a list of user IDs and passwords in an offline document

These are all perfectly valid solutions that a regular user finds acceptable…

One of the tragic things about this disconnect is that Actual Good Ideas that software people take for granted end up taking decades to migrate out to regular people in a form that they can actually use. As an example, take backup — an absolutely critical feature that until fairly recently, regular people would implement (if at all) by occasionally remembering to burn some files to a CD. Pathetic. And by “pathetic,” I mean we the software industry, not the poor end-users.

Which brings us to version control. Version control is one of the few innovations in the field of software engineering that is an unalloyed good. Even a creaky, antiquated version control system is much better than having no version control at all.

Of course, version control systems are designed for software construction, which means they have tons of complicated features for nerds. Version control for regular people would look something like this:

  • It would work automatically on all of your documents.
  • It would save new versions for you in the background.
  • It would have a friendly interface for going back in time and retrieving old versions.

This is what Apple appears to be shipping in OS X Lion. A simple, friendly, OS-level versioning service for apps to hook into. In one master stroke, Apple has just granted millions of people the same power software engineers have enjoyed for years: the ability to author without fear. This is huge.

Granted, it took about three decades to get to this point, but still — this is a great moment for anyone who does creative work. And if you don’t use OS X, cheer up. Any operating system worth using will be implementing something similar very soon.

Come to me, Superplague! I defy you!

Every winter, half the office gets taken out by illness. We call it “the Super Plague”, “the Creeping Crud”, “the Plague of Death.” It’s brutal.

Yesterday, I woke up feeling the tell-tale signs. Scratchy throat, low energy. Uh-oh.

But today I woke up feeling… totally fine! One hundred percent! Yes my friends, the famous Goer immune system, the same one that ensured the survival of prehistoric Goers, kicked in… and kicked ass.

So this is my post where I dance in the endzone, taunting the entire Team Virus defensive line. In your FACE, Team Virus! In your face!

Publishing in Standard Manuscript Format with Sphinx, reST, and Sffms LaTeX

Although it’s the Year of our Lord 2011, and we are blessed with no end of advanced publishing technology, many fiction writers practice their craft something along these lines:

  1. Open Microsoft Word or Libre Office.
  2. Type some stuff.
  3. At the end of the writing session, click “Save As” and save your file as "Title_of_Story Todays_Date.doc"
  4. Occasionally, when you remember, burn all your story files to a CD.

Some writers are a little nerdier. They might use a specialized writing tool such as Scrivener or Ulysses. They might have automated backup set up. Or they might use an online word processor such as Zoho Docs and Google Docs which provide “free” offsite storage and version control.

But what if you’re a really nerdy writer? Nerdy enough to want to author in an open plain text format? Nerdy enough to want to check your files into a real version control system? Nerdy enough to run diff and sed and perform other text-munging feats of strength?

It all sounds promising, but there’s one major obstacle standing in your way: Standard Manuscript Format. Double spaced, 12pt monospace, one-inch margins, a running header with the author and title, you know the drill. This exacting print-ready format is easy to produce with a word processor, but if you want to stay outside of that world, you’re in for some serious pain. So what to do?

  • Give up and use Word.
  • Wait for the current generation of publishers and editors and all the people they have trained to die.
  • Other.

I choose… “Other!”

Using Sffms

When it comes to exacting typesetting, nothing beats LaTeX. And it just so happens that M. C. DeMarco has designed a LaTeX document class named sffms that outputs Standard Manuscript Format.

DeMarco has documented sffms to the point where you can use sffms without actually knowing much about LaTeX itself. There’s a bunch of config-y header-y stuff at the top of the file. Paragraphs look like paragraphs. Occasionally you need to add a special command like chapter{In Which Stuff Happens} to create a chapter break, or emph{Look out!} for emphasis. You run the thing through latex and then pdflatex, and out comes a beautifully typeset manuscript complete with wordcount. You have to watch out for reserved LaTeX characters, but quite honestly, authoring a story in LaTeX is easier and cleaner than, say, hand authoring the same thing in HTML. It’s all quite civilized.

The one wrinkle is that the LaTeX toolchain really only works for print. All the TeX to HTML conversion tools I’ve tried are ancient and horrible. They’re particularly bad with sffms, which has some differences from a “normal” LaTeX article that trip up the ordinary HTML converters.

So if all you want to do is submit manuscripts to publishers, you are golden with LaTeX and sffms. But if you want anything even remotely reasonable to post to the web, you’ll need to roll your own converter. Or read on.

Using Sphinx and reST

LaTeX is a great technology. But for a humane plain text format that converts nicely to HTML, we have to move forward in time a couple of decades. reStructuredText (aka reST) is a lightweight markup language developed by the Python community for technical documentation. Sphinx is a builder tool that transforms reStructuredText into different target output formats.

The nice thing about authoring in reST is that the source files are even cleaner-looking than LaTeX (let alone an angle brackety language). Paragraphs are paragraphs. Chapter headings are titles with underlines. Emphasized text is text surrounded by asterisks. Even if the entire Python documentation toolchain disappears, even if you’re looking at your story’s source files decades from now, your work will still be perfectly readable as plain text.

For the fiction writer, what Sphinx brings to the table is solid, easy to use HTML production. If you don’t like the built-in HTML templates, it’s straightforward to hack your own. Sphinx also produces EPUB out of the box, as should all writing tools worthy of your consideration. So to recap: reST is a really nice source format, while Sphinx provides you with lots of power and control over how the HTML and EPUB output looks. Looking good so far!

Sphinx also produces LaTeX output. The problem with Sphinx’s LaTeX output is that — surprise! — it’s designed to typeset a nice looking technical manual, not a novel. The results look nothing like Standard Manuscript Format. Ah, well.

But wait a second:

  1. sffms LaTeX is designed to typeset documents into Standard Manuscript Format… but its HTML output is unacceptable.
  2. Sphinx and reST have great HTML facilities… but its LaTeX output is unacceptable.

Hmmm…

Someone Got sffms Peanut Butter in My reST Chocolate!

So it turns out that it’s not terribly difficult to write a Sphinx extension, even if you are a Bear of Very Little Brain who hardly knows a lick of Python. Now available for public consumption: the sffms Sphinx extension. And yes, the source code is available on github.

To use this extension:

  • You must be able to install LaTeX with the sffms document class included.
  • You must be able to install Python and Sphinx.
  • You must be comfortable editing configuration files and running commands on the command line.

There is also very little documentation other than some comments in example files (though I’m working on that). In other words, this extension is for software engineers who also like to write fiction. Preferably software engineers who have used Sphinx before, and who have lots of patience.

You don’t have to be familiar with the sffms LaTeX class, but reading DeMarco’s original documentation might help you wrap your head around what sffms actually can do. My extension currently exposes almost all the knobs that are available in the sffms LaTeX class. For example, you can set sffms_frenchspacing = True in your Sphinx conf.py, which injects a frenchspacing command in the resulting LaTeX output.

If you want to kick the tires, here is a sketchy outline of what to do:

  1. Install LaTeX with the sffms LaTeX class.
  2. Verify that you can run latex successfully on one of DeMarco’s example stories.
  3. Install Python 2.x (if necessary), followed by the Sphinx and sffms Python packages.
  4. Verify that you can do a vanilla Sphinx doc build. You can use sphinx-quickstart to create a test Sphinx document. Try creating a PDF manual of your test document.
  5. Download the skeleton short story and skeleton novel from GitHub. (These artifacts are not currently included in the sffms package itself, but they should be).
  6. cd into one of the skeleton directories and run sphinx-build -b sffms . _build.
  7. cd into _build/sffms and run latex index.tex — twice.
  8. Run pdflatex index.tex. View the resulting PDF.
  9. Go back to the story directory and start playing around with the Sphinx conf.py file. The configuration file contains all the available sffms configuration options with comments. The file also contains some minimal options for Sphinx in general. These other options are uncommented and you can ignore them if you are just working with sffms LaTeX output.

The next order of business is to write some real documentation. Beyond that, I welcome any bug reports or suggestions for feature enhancements. I am neither a professional programmer nor very experienced with Python, so any help you can provide would be very… helpful. Thanks!

Counter-intuitive Thinking on the Battleship Movie

Hoisted from comments in $social_network, a friend of a friend says:

“And for what it’s worth, when it come to the Battleship film, I have a sneaking feeling that it’ll be a stormer. Look at this way: producer and director go into film exec’s office and starts by saying ‘look, we’ve got this idea to turn Battleship into a film, and it’ll star Rhianna.’ You’ve got to imagine that the rest of this pitch must have been of Godfather dimensions not to have been kicked into touch after that opening sentence…”

“Look, we’ve got this idea to turn the Pirates of the Caribbean ride into a film, and it’ll star Orlando Bloom.”

“Look, we’ve got this idea to turn…”

… and, actually, I’m out. Still, an intriguing theory.

How Does Scott Adams Do It?

Dilbert.com

It’s hard to understand how he does it. Scott Adams hasn’t worked as an engineer since when? The 70s? The early 80s? And yet even after all this time, he is still able to write cartoons that are pitch-perfect.

The only real explanation I can think of is that tech industry bullshit is so conservative and formulaic that even if you happened to master its syntax thirty years ago, you can plug in new buzzwords today and sound completely up-to-date.

That just raises the question — does all industry bullshit work like this? Is fashion industry bullshit today the same as fashion industry bullshit from the 70s? Or do different industries have wildly different bullshit mutation rates?

As an aside, is it just me or does Dilbert really match the color scheme of the site really well? I should start embedding these things more often.

HOWTO Fix a ‘Mail has undone actions’ IMAP error

When using OS X Mail on Leopard with IMAP, it is possible to get Mail.app into a bad state with respect to the server. When this happens, Mail will start displaying an extremely-hard-to-dismiss dialog that resembles:

Mail has undone actions on some messages so that you can redo the actions while online.

Additional information: The IMAP command “UID COPY” (to Deleted Items) failed for the mailbox “Junk E-mail” with server error: Command Error. 10.

For the benefit of the entire Internets, here is the solution.

  1. Close Mail.app.

  2. Open a terminal and cd ~/Library/Mail/.

  3. In this directory is a subdirectory that is called something like IMAP-youremail@yourmailserver. (Or if you’re living dangerously and/or stupidly like me, Exchange-youremail@yourmailserver). cd into this directory.

  4. cd .OfflineCache/ and rm everything in this directory.

You’re welcome!

White Teeth

Recently my friend Shelly went on a trip to Europe, where she had the opportunity to take a tour of the crypts of Vienna. The tour guide pointed out some skulls, one of which had incredibly poor teeth.

“Do you think this is the skull of a rich person or a poor one?” asked the guide.

A poor one, the tourists guessed.

“Wrong,” said the tour guide. It turns out that the entire upper class in old Vienna suffered from severe tooth decay, because unlike the poor, they had access to all the sugar they could eat.

No reason to bring this up, other than I was reminded of this story while staring at Paul Allen’s horrific visage. All that money to spend on lawyers, and not a penny for dental floss. Sad.

XML: Not Great for Documents, Actually

Norman Walsh, “Deprecating XML“:

“In short, if all you need are bundles of atomic values and especially if you expect to exchange data with JavaScript, JSON is the obvious choice. I don’t lose any sleep over that.

XML wasn’t designed to solve the problem of transmitting structured bundles of atomic values. XML was designed to solve the problem of unstructured data. In a word or two: mixed content.”

Daniel Lemire, “You probably misunderstand XML“:

“Thankfully, it appears that history is on my side. Developers got tired of getting these annoying XML payloads. In time, they started using JSON, a much more appropriate format for passing small loads of structured data between a server and an ECMAScript client…

Where does that leave XML at? Precisely where it started. XML is a great meta-example on how to deal with semi-structured data. And it is just as useful as ever. Want to deal with documents? DocBook and OpenDocument are great formats.”

Speaking as a technical writer who has spent the last several years authoring DocBook, customizing DocBook stylesheets, and writing build scripts around DocBook: no. No, DocBook is not a great document format. It is an acceptable document format.

First, I’ll grant that DocBook is vastly superior to the proprietary binary formats that came before it, for all the obvious reasons: you can diff it, you can check it into version control, you can edit it with just about any editor you like on any platform, the base toolset is free, et cetera. That’s kind of the minimum you want to see for any modern documentation format, and with that in mind, I am thrilled to use DocBook over, say, AuthorIT or Word. (I actually still miss FrameMaker, but DocBook wins there too, unless your only output format is a 7″x9″ perfect-bound book.)

Second, DocBook contains a number of critical design errors that, to be perfectly fair, have nothing to do with its XML nature. The fact that man pages require a completely different syntax from books and articles is not XML’s fault. The frightening size and complexity of DocBook’s vocabulary is (probably) not XML’s fault.

But even ignoring these flaws, DocBook is saddled with a number of XML-related problems:

  1. As an XML document format, DocBook has tied itself to the boat anchor of XSLT. The DocBook stylesheets expose a wide array of fiddly knobs to turn using parameters, and if you just stay in that space, you’re basically okay. But if you want to do a more aggressive customization — say, have a full TOC on the left hand side of every page — you are screwed. You either need to do radical field surgery on the stylesheets, with the patient screaming and fighting you all the way. Or you need to throw away the XSLT and transform DocBook some other way, starting over from scratch.

  2. As an XML document format, DocBook is an unproductive authoring environment. Even though I’ve been successfully hand authoring angle-brackety things for my entire professional career, and even though I’m aware of a vast array of tools to make hand authoring angle-brackety things easier, I am choosing to author this post in Markdown, not HTML or DocBook. Why? Because no tool is ever going to change the fact that creating a list by typing “n1. As an XML document format…” is easier than typing a slew of open and close tags.

    DocBook also penalizes you on reads as well as writes. DocBook is readable, in the sense that it can be read. Lightweight markup languages like Markdown and reStructuredText are readable, in the same way that a book is readable.

    And yes, there are a couple of decent semi-WYSIWYG DocBook editors out there. I even use one! It is so choice. If you have the means, I highly recommend picking one up. But that’s kind of the point — these tools are just an expensive patch to make up for the massive productivity loss of actually writing DocBook XML directly. (“But wait!” you cry. “I’ve set up all kinds of clever DocBook shortcuts and macros in my editor!” That’s swell. You are still wasting huge amounts of time. Stay the hell off my doc team.)

  3. As an XML document format, DocBook is forced to use draconian error handling. One mistake and parsing must stop, you’re done. The thinking behind this feature was that if you’re sending a transaction to your bank, and the payload is malformed, you don’t want the bank’s server “guessing” what you might have wanted.

    But novels and articles and technical manuals are not bank transactions. If I forget to close an inline tag, or I screw up a cross-reference, that’s not a good thing. But should a minor mistake break my doc build? For my team, I lean towards an answer of “yes.” You, however, write in a different environment, for a different audience, and perhaps have a different answer for how you would prefer to run your workflow. But screw what you and I think. The XML specification has made that decision for us.

    Oddly enough, draconian error handling was built for the very use case that XML evangelists now seem to be backing away from. Okay, JSON has superceded XML for data interchange on the web — but that’s just fine! XML was always for document formats, really.

    If XML is more or less popular than JSON among front end engineers, it’s really not a big deal to me. I don’t write web APIs for a living, I just write about them.

    But if people are arguing that XML’s core strength is in documentation, then as someone who writes documentation full time, let me say that this is just bunk. That might have been true in 1998, but today there are better choices out there. Markdown is simple and has multiple implementations. If you need something more powerful, reStructuredText + Sphinx has a rich feature set that in many places matches DocBook, but with far less complexity.

Not that DocBook is terrible. However, its XML lineage is not an asset. XML is not the best way to say, “Here is a paragraph. Here is a list item. Here is an index entry. Here is a cross-reference.” Don’t let anyone kid you into thinking it is.