Monday, December 29, 2014

Some Work, So I Can Do Some Work, Emacs-style

Today, on my work box (OS X, version 10.9.5), I installed/updated packages in order to get org-mode to work completely and properly. Specifically, I downloaded the huge MacTex package so that I could export a buffer in org-mode to TeX (and likely to PDF from there). Also, I'd been running into small but frustrating errors ever since I switched the machine over to Mavericks.

But then something odd happened: when I tried to open a new buffer, "test.org", I encountered the following error:

Symbol's function definition is void: org-with-silent-modifications

I ended up commenting out the line: (setq org-startup-indented t), and was able to open a buffer. I don't like those excessive asterisks, though, so I called M-x org-indent-mode, but that also raised an error. Oddly, by calling it a second time, I got the same error message, but the buffer indented properly anyhow.

It was puzzling to me, but I copy-pasted the error message into Google and found this blog. I found that this was a well-known issue when using ELPA. It then came back to me that, when I first set up org-mode, I installed the package manually, and only came to use ELPA later. So I moved the 'org-20140728' file to ~/tmp, restarted emacs, and used the 'package-install' command to get a fresh org-mode installed.

Long story short: it eventually worked, but I had to comment out a single line in my init.el file (after uncommenting the setq line above):

(require 'org)

I don't know exactly why; I suspect it has something to do with when the org-mode files are actually read, and either is required before some necessary function or variable is defined, or requiring it twice messes up an existing function or variable. In any case, that line is now commented out, and I can once again export my notes to PDF.

cheers,
Adam

Monday, December 22, 2014

David Manning Calls North Korea "A Rollicking Thrill Ride"

I do not know what embarrassing secrets North Korea could hold over Sony Pictures that they could intimidate Sony into dropping The Interview from theatrical release. It should be embarrassing enough that they're the company that had so many mediocre films, they had to invent a fictitious critic to hype them.

cheers,
Adam

Thursday, December 18, 2014

Android, Emacs: Slow Progress

So I'm trying to get Emacs working on my Nexus 7 (using cyanogenmod). As with many things Android related, it's three steps forward, two steps back. But even that is progress.

I first wanted to remap the Caps Lock key to Control, which I've done on every system I've been in charge of for the last ten years. That's easy: just edit the /system/usr/keylayout/Generic.kl file.

IN ORDER to do that, of course, I needed to remount the /system filesytem, because it's mounted read-only:

$ su
# mount -o rw,remount /system

But then the file itself is read-only, so:

# chmod 666 /system/usr/keylayout/Generic.kl

... and then edit it (which I did with the VIM port, VimTouch), commenting out the line:

key 58 CAPS_LOCK

... and adding:

key 58 CTRL_LEFT

... and finally rebooting.

THEN, after downloading and installing the only Emacs port I could find, I get a segfault when it opens. This is a known bug, with a known (and ugly) workaround: after going into Preferences and changing the Font Size to 10, it successfully launches.

So I try to edit a file. The first file I want to edit, of course, will be the .init or .emacs file, whichever one this app comes with. And then I run into another problem: Alphanumeric keys work, as do any non-alphanumeric symbol that shares a key with [a-zA-Z0-9] , but not such silly keys like ,<.>?/{[}]|\~`_-+= .

So now I have a hobbled, marginally functional version of Emacs on the tablet. Suggestions include to use the Hacker's (virtual) Keyboard, but I really need honest, physical keys to type with. I have found no workaround for this issue, and the project seems to have been abandoned.

Ah well, a wild goose chase gives you exercise, if nothing else (to paraphrase Neil Stephenson).

cheers,
Adam

Friday, December 12, 2014

Orwellian Newspeak

The Senate released it's (partially redacted) report on the CIA's use of "Enhanced Interrogation Tactics" ten years ago. Their list of practices that "weren't torture" included keeping prisoners awake for days on end, or allowing them only a few hours of sleep per night.

As someone who has suffered periodic bouts of acute insomnia many times in my life, I have only this to say: anyone who denies that sleep deprivation is torture is a damned liar.

cheers (of a sort),
Adam

Thursday, December 11, 2014

Directions

In the last 24 hours, I've tried to do three simple things:

  • Set up an Android development environment on my xubuntu box and run the "Hello World"-style example here.
  • Make sure that, while creating Common Lisp packages in SBCL, I could easily create and load them with Quicklisp and Quickproject, as per the directions in xach's blog.
  • Replace the flourescent lightbulbs in my closet.

First, the good news: Quickproject works as well as advertised, or at least it did for the minimal set of files I created. I was able to close down my box, reboot, open emacs with SLIME, and type (ql:quickload "games-dice") (a lisp file based on Philip Newton and Ricardo Signes's perl module Games::Dice, and there it was: (games-dice:roll "3d6") returned a beautiful 14. That was the one unqualified success I had last night.

Next came the flourescent lights. Given 45 minutes, I was able to figure out how to install them. The clips that hold the bulbs are plastic, and seemed to fold back, so I took the bulbs out by doing that; this turns out to be the wrong way. You're supposed to twist the bulbs until they fall out of the socket.

This would not have occurred to me, although, given my age (over 19), I should have encountered this task before. Oddly, I hadn't. The only time I've ever twisted flourescent bulbs was when I was about eight, and they broke, so the thought of turning them at all when they were set in their sockets just wasn't on my radar.

I headed over to youtube to see if I could find some how-to videos to help me. Videos I found, but helpful they were not. The first few I found were about how to install the brackets and wiring. Then I found one where the narrator was changing them from a bracket on the floor as opposed to on the ceiling.

Several times in my googling for directions, I found the same dumb piece of advice: "turn the bulb clockwise until it slips out". Think about it: "clockwise" on one end of the bulb is the opposite direction from "clockwise" on the other, so this is pointless advice unless there's a canonical side of the bulb that you orient yourself towards.

In the end, I observed that the pins in the bulb line up with rotating slots at either end, and those slots rotate independently of each other. When I pulled the bulb out, I twisted one side, but not the other, so they were misaligned with each other. It was impossible to put the pins in until I figured that out and lined them up again. I had to insert the pins in one side, twist until it lined up, then do the same with the other side.

After that, it was a piece of cake. Simple, once you know how, but none of the directions I could find were clear enough to make that point.

Finally, I tried to install Android Studio and create a very basic, proof-of-concept, "Hello World"-style app. That took a long time, and I'm still getting errors. It turns out that Android is not wholly compatible with OpenJDK, which was the Java toolkit I had installed on my computer. The directions, however, either assumed I was using Oracle's Java, or that it wouldn't make a difference, but I ended up having to purge OpenJDK and then, semi-automatically, semi-manually install the Oracle JDK. And by just clicking on the stuff they told me to click on and typing what they told me to type—you'll have to trust me on that—I ended up with an app that compiled with a couple of errors in the source files... source files I have yet to touch with a text editor, mind you. So I'm still working on that one.

What to make of all of this? I don't know. In the case of the lights, the moral seems to be "slow down and look closely". But in the case of Android Studio, there's nothing to really look at. I guess the moral of that story is, directions are hard, and you should never make assumptions about a user's environment. And the wider-ranging suggestion might be, when you see someone struggling with something that seems easy to you, consider that they might be struggling with complications you can't even imagine, since you came to the same problem from a cleaner setup.

cheers,
Adam

Thursday, November 6, 2014

Seraphinianus

I have wanted to own a copy of the Codex Seraphinianus for over thirty years, ever since I saw a copy at my best friend Erik's house that belonged to his father. It is a book of fantastic illustrations and seemingly indecipherable text, an Encyclopedia of an impossible, surreal dream world. The creator is one Luigi Serafini, an Italian architect who did the drawings and wrote the text over a period of three years in the late '70s. The drawings—ink and colored pencils, mostly—show animals that look like plants, plants that look like man-made artifacts, and artifacts that look like people. In one series of illustrations, people having sex on a couch transform into an alligator.

On another page, pairs of fish with iris-like decorations appear as the malevolent gaze of a living ocean.

The text is a combination of strange capital letters, some of which look like illustrations of knot work, and some kind of flowing script that looks like mirrored cursive mixed with Arabic writing. Diagrams appear that seem to illustrate taxonomies, or possibly some kind of imaginary math, or linguistic diagrams of his made up language. I doubt it really means anything, but it does a remarkable job of looking like it means something.

It has also been notoriously hard to find, having been out of print in the US for twenty years. Good copies of the original sell on ebay for hundreds of dollars, maybe even thousands. In 1996, when I went to work for the now-defunct Borders Books, it was the first book I looked for, and finding it out of print was my first great disappointment at that job.

There's a second edition out, however, which I discovered a little over a month ago when I was idly musing about the book and entered the title into Google. My heart soared when I saw that among the first hits was a link from a certain well-known online retailer, and I put it in my shopping cart until I could afford to spend $85 US—on sale, nonetheless—for a book.

I do not regret that decision.

cheers,
Adam

Tuesday, November 4, 2014

Stumbling Blocks, One-character Wide

Lisp, the programming language, is one of the oldest still in use. It has many variants, or "dialects", as the programming language people like to call them: Common Lisp, Elisp (specifically for the Emacs text editor), Scheme, and Clojure are popular ones. Because of macros, because of the (relatively) straightforward syntax—throw parentheses around everything—and because of sheet hype, the people who love Lisp love it almost fanatically.

I'm trying to be one of those people. I threw in with Common Lisp because of Peter Siebel's excellent book, Practical Common Lisp; I can't say it hasn't been without some bumps.

Case in point: what is 'a'? Encodings and character sets aside, what is it, really? The intuitive answer is, "it's a letter", or, more computery-sounding, "it's a character". With lisp, it isn't always so clear, however: it could be a character, yes, or it could be a string of length: 1. Lisp has both characters and strings, rare in my experience: either you have strings as a fundamental data type, or you have characters and fashion strings as an array or vector of characters. But having both: that's something I'll have to get used to. (EDIT: Nope, I'm wrong. And this entire post is an example of how far I have to go in understanding Common Lisp.)

Likewise, numbers can be confusing. Perl has a "DWIM" ("Do What I Mean") ethos behind it, and is usually pretty good at guessing what you mean, at the cost of some runtime cycles. One place where it's so good at doing what I mean, it tripped me up in my initial attempts to learn Lisp. If the perl interpreter sees something that looks like a number, it treats it like a number, espcecially if you're trying to do numeric things with it like sorting or arithmetic.

Lisp, or at least Common Lisp, doesn't do that. It sees a "7" somewhere, and it might be a number. Or it might be a character.

I can tell this is something that's going to bite me again before I gain proficiency.

cheers,
Adam