Digital Lysenkoism

Cory Doctorow has a splendid article in Publishers Weekly about the futility of DRM in the publishing industry. In it he compares the industry’s belief in DRM to the disastrous beliefs of Trofim Lysenko, the Stalin-era Russian pseudo-geneticist, that led to mass starvation in the Soviet Union. In some sense, there’s not much point in telling this to Irreal readers: they all know the arguments and despise DRM already. Still it’s a good article and points out some interesting facts.

Most of the line staff at the publishers know, like Stalin-era geneticists knew about Lysenkoism, that DRM won’t work and that it’s really hurting the publishing industry while failing to do anything to stop illegal copying. The problem is that their leaders, like Stalin, do believe in it and refuse to consider the possibility that their faith in DRM might be misplaced.

Doctorow tells the story of how one publisher is planning on sending all its ARCs out as encrypted PDFs. ARCs are the Advanced Reader Copies that publishers send to reviewers before the book is actually published in the hopes of getting a good review. As Doctorow remarks, most reviewers get far more requests for a review than they can honor (Doctorow says 100-to-1 in his case) and that the idea a reviewer would put up with the annoyance of dealing with a “book” that couldn’t be loaded into whatever e-reader he happens to use or couldn’t be conveniently read on a plane, say, is wishful thinking. Instead, those crippled PDFs will be ignored and the publisher and author will miss out on advanced publicity.

Again, there’s nothing in the article that we don’t all know but it’s a good take on the problem with some interesting inside information. Well worth a read.

Posted in General | Leave a comment

Fontifying Code Buffers In Emacs Org Mode

I just learned a nice trick from the Org Mode Mailing List. By default code blocks in Org-mode buffers are colored gray and don’t show the fontification the way it does in a normal programming buffer. But if you add

(setq org-src-fontify-natively t)

to your .emacs or init.el file you get normal fontification for whatever language you’re using. This is especially nice when you open an editing buffer with【Ctrl+c '】 to insert code into the #+begin_src ... #+end_src area.

Posted in General | Tagged , | Leave a comment

TechCrunch: Amazon Is Out To Kill Publishers

Regular Irreal readers know that publishing and its travails are an enduring interest of mine. As I’ve said many times, I like publishers and wish them well but at the same time I recognize that they are making the same tragic mistakes that the music industry did. Unfortunately, they are less well positioned to survive them.

Case in point: TechCrunch has an article claiming that Amazon is purposely killing off rival publishers by giving authors huge advances and very favorable deals with the intention of driving the traditional publishers into bankruptcy. Although it’s not well known, Amazon is into publishing in a big way and has several of its own imprints. TechCrunch goes on to say that Amazon enjoys a number of benefits such as inexpensive print-on-demand facilities and, of course, the Kindle installed base.

All-in-all, the TechCrunch article is pretty depressing not only for the publishers but for those of us who think it a good thing for there to be more than one publishing outlet. It is, I think, dangerous to have only one source of published works but that’s the direction we’re headed in. I hope the traditional publishers can adjust to the times and improve their prospects but I have to say that I am less hopeful than ever.

Posted in General | Leave a comment

Journal Article On Org Mode

The Journal of Statistical Software has a nice paper by Carsten Dominik (the creator of Org mode), Eric Schulte, Dan Davison, and Thomas Dye about Org Mode and its use in Literate Programming and Reproducible Research.

I really like the idea of reproducible research and this paper is an excellent example of it. The authors make available, as supplementary material, everything you need to reproduce the paper, it diagrams, and examples. They also have another example in the paper of reproducible research that makes use of large external sources of data.

Although the paper is published in an academic journal (and one concerning statistics, at that) it is very approachable and anyone interested in learning some of the power of Org mode should give it a read. They cover using Babel to make calculations whose results appear in the paper automatically. So although the code blocks do not (necessarily) appear in the finished paper they are part of the “source code” of the paper and available for anyone interested in verifying the results. Not all of us are generating papers that others might want to verify but the facility is still useful to us. For example, all the diagrams and calculations that appear in my blog posts were generated with Babel and are part of the Org file for the post so I can reproduce them at will. The only exceptions to this are the occasional screen shots that I sometimes include in a post.

I’ve never been able to warm up to Literate Programming but for those who have, the paper shows how Org mode implements it using the Noweb notation. That’s very nice because it’s language agnostic—you can use it with any language. You can discuss your program by presenting code fragments in any convenient (to your exposition) order and then have Org mode export the reassembled code ready for a compiler.

There’s a lot of power in Org mode and I’m always learning new things about it (much like Emacs itself). This paper is a good introduction to some of its features and because the original Org file and supplementary files are available it serves as a laboratory for experimenting with it.

Posted in General | Tagged , | Leave a comment

Emacs Rocks Episode 9 Is Up

Magnar Sveen has another episode of his excellent Emacs Rocks up. In this video he talks about expand-region, an Emacs package that he wrote to help with marking text in an intelligent way. The video is less than 3 minutes so there’s no excuse not to take a look. As with all the Emacs Rocks videos, you won’t be sorry.

Watch the video and if you like what you see, get the code on github.

Posted in General | Tagged | 1 Comment

What Makes Emacs So Great?

Over at The Setup they are featuring Phil Hagelberg who has an especially nice take on what makes Emacs so great. He says that Emacs is as close as you can get on modern systems to the fully dynamic environment of the Lisp Machines of the 80’s. Almost any part of the environment can be changed at runtime without recompiling or restarting.

I think that’s exactly right. There are, I suppose, Emacs users who don’t change anything from the default setup but as Irreal readers know, I have all sorts of customizations to my Emacs and I am not in the least unique in this. One of the nice things about this is that I wrote those customizations using the same mechanisms as the authors of Emacs itself. Hagelberg says, “It’s hard to overstate the benefits of this setup.” It’s something that you get “for free” because when we make extensions to Emacs we’re writing in Lisp and as Doug Hoyte says in Let Over Lambda, “…lisp gives you the same tools available to the people who created your programming environment.”

Hagelberg goes on to say that this reduces the friction of tweaking your environment to such a low level that you’re more willing to experiment and improve things than you would be in a more standard environment. For example, I use OS X and really love it but it’s too hard to make anything other than fairly simple changes to the default behavior and most of those are changes that the system implementors anticipated and provided some way of effecting. I would guess that this ability to customize things is the reason that many Emacs users try to avoid leaving Emacs at all, choosing to read and send mail, use IRC and IM, listen to music, and many other things all from Emacs. Why not? You can pretty much have it anyway you want it.

Posted in General | Tagged , | Leave a comment

Demand Curves By Age

H S Dent has a set of endlessly fascinating demand curves that show the demand for various kinds of consumer goods by the age of the consumer. Many of these are pretty much what you’d expect: demand for bicycles, for example, grows until about age 40 and then drops off to nothing a little after age 80. Still, there’s a lot of surprises.

Children’s clothing (of all sorts) drops off with increasing age as you’d expect but then rises again at a little after age 80. You see this again and again in everything from boys’ underwear to girls uniforms. I have no idea why this is. Oddly, adult clothing doesn’t follow the same pattern: you generally see the expected drop off with increasing age. Not all the curves show an increase to some age and then a decrease. Some rise and fall repeatedly throughout the age span—college tuition is an example of this. Some, like safe deposit box rental and prescription drugs shows a steady increase throughout the age span.

I doubt any of this is of particular importance to the typical Irreal reader but I find the graphs entertaining and in some cases puzzling. It well worth a look—you may be surprised at how interesting they can be.

Posted in General | Leave a comment

Russ Cox: Part 4 Of A Trilogy

As long time readers know, I am a big fan of Russ Cox’s work. In particular, his 3 part series on implementing regular expression search is just outstanding. Now Cox has added a fourth article to the series that describes how he implemented Google Code Search.

There is, of course, too much code on the Web to do a grep over the entire corpus. Instead, they built a trigram index of the documents and then analyzed each regexp to decide which trigrams would need to be present in a document to satisfy the regexp. Then they used the trigram index to retrieve and grep just those documents. Cox’s paper discusses how they did the analysis—it more complicated than you might imagine—and presents some results on a smaller version for which the code is available. (Google discontinued Code Search so the standalone version is all there is).

One example is searching for “hello world” in the 3.1.3 Linux kernel. There are 36,972 files to search but only 25 of them contain the necessary trigrams: “ wo”, “ell”, “hel”, “llo”, “lo ”, “o w”, “orl”, “rld”, “wor”. That cuts the search time by 2 orders of magnitude.

This paper is a beautiful example of using some elementary data structures and some smart analysis to bring a huge problem down to a manageable size. I really recommend the article for anyone interested in programming.

Posted in General | Leave a comment

JSON And S-Expressions Redux

After yesterday’s post on JSON Versus S-Expressions I thought that one obvious solution for people who want to use JSON tools to process logs is to have the (Lisp-based) logs convert themselves to JSON much like we did for S-expressions to XML. I thought about issuing another challenge to write Elisp code to do the conversion but it’s so similar to the Sexpr-to-XML example that I decided not to.

I’m pretty sure that I remember seeing Lisp code that converts JSON into Sexprs and vice versa so you could start with either Sexprs or JSON and easily convert to the other if that was more convenient. I think the code I saw was for either Scheme or CL so a good exercise would be to write Elisp code that converts JSON into Sexprs. That way you could work with JSON in Emacs.

Actually, that seemed like such a good idea that I thought someone must surely have done it and, of course, someone has. It’s even included with Emacs. Is there anything Emacs can’t do?

Posted in Programming | Tagged , , | Leave a comment

More On JSON Versus S-Expressions

I’ve written several posts on JSON, most recently here and here. These last two posts considered the advantages of JSON over S-expressions for writing log files. Although S-expressions are more powerful and flexible than JSON, as explained in the 7-part series referenced in the Writing Log Files In JSON post, I concluded that JSON might, nevertheless, be the right answer because there are tools available for working with JSON in almost every language, whereas S-expressions, with a few exceptions, are most naturally handled with some flavor of Lisp.

Now, a post on the SHiNKiROU Blog entitle S-Expressions: The Fat-Free Alternative to JSON is giving me second thoughts. The context of the post is a bit larger than log files and includes such things as document markups. JSON is certainly a win over XML for key-value-pairs, the post says, but not so good for things like HTML markup. S-expressions, on the other hand, can do both jobs equally well. Chapter 16 Paul Graham’s ANSI Common LISP, for example, describes a set of functions for turning S-expressions into HTML.

I find the post pretty persuasive although I do still worry about non-Lispers being comfortable with sexprs or at least being able to do useful things with them right off the bat. Say what you will about JSON, it’s very easy to learn just about everything you need to know about them—excluding the various tools that work on them, of course. S-expressions are pretty easy too but I don’t think there are as many (non-Lisp) tools available to work with them. Much as I would like everyone to learn a bit of Lisp, we all know that’s not going to happen so where does that leave us? Should we use the more powerful and simple S-expressions, or should be use JSON because of its multi-language support? What do you think?

Posted in General | Tagged , | 1 Comment