Using Directory Local Variables

I’ve written before about directory local variables (1, 2) and how they can be useful for setting variables or actions with a directory-wide scope. Over at the Emacs reddit, fearbedragons has a nice tip that leverages them to slightly reduce his workflow friction.

Fearbedragons has a project in which he needs to make a lot of small compiles as he goes about his testing. To help with that he set up a small .dir-locals.el file in the project directory that automatically compiles the whole directory when any file is saved. You may or may not want to do that for your own projects but the same idea works for any action that you want to take on a file event. As fearbedragons says, “You don’t always need it, but it’s sure handy when you do.”

This post is already longer than fearbedragons’ whole tip so stop reading here and go on over to reddit to take a look at the tip. It’s also worthwhile to follow his link to the dir-locals documentation to see how things work. The syntax can be a bit confusing but, as usual, Emacs can help you out by writing the entries for you. Just call add-dir-local-variable and follow the prompts. This is a useful facility that I, at least, do not use nearly enough.

Posted in General | Tagged | Leave a comment

The Nature of Lisp

The other day I ran across a pointer to Slava Akhmechet’s post The Nature of Lisp from back in 2006. It’s an old post, obviously, but is worth reading because it does a very nice job of explaining what’s so good about Lisp and why a programmer should spend a bit of time to understand it.

Akhmechet tried several times to understand Lisp and what all the excitement was about but kept failing. The problem, he says, was the strange syntax. Of course, Lisp doesn’t really have much syntax and what it does is extremely simple. What he was really complaining about is what all newcomers to Lisp complain about: all those parentheses.

Akhmechet’s approach to explaining Lisp’s notation and concepts is to relate them to something that many programmers are already familiar with: XML. Lisp’s s-expressions are basically like XML but simpler and less verbose. Why not just use XML then? To answer that question Akhmechet considers the ANT project builder from the Java world. If you squint real hard, ANT is also Lisp-like in its architecture. You can, for example, define new operations by writing a Java class to implement it. In that way, it’s extensible.

But that approach has its limitations, the first being that you can’t extend the ANT language in XML itself and you can’t introduce new syntax constructs. Akhmechet’s post describes, in a series of steps, how Lisp overcomes these difficulties and offers a much better solution.

If you’re a Lisp weenie or if you’re wondering why anyone would want to be one, take a look at this post. It does a great job in explaining the Lisp nature.

Posted in General | Leave a comment

The Beat Goes On

The last time I wrote about the open access movement, I reported that the University of California had refused to renew its Elsevier subscriptions and that the next logical step was for individual researchers to refuse to publish in Elsevier journals. I haven’t seen news of more researchers refusing to publish in those journals but in a related move 31 UC researchers who are editorial board members of Elsevier’s Cell Press imprint, which publishes Cell and other journals devoted to cell biology, have told Elsevier that they’re withholding editorial services until the dispute is resolved.

This is significant because these are obviously people who believe in and support the journals. If they’re willing to join a boycott of Cell Press’s publications, think how much easier it would be for others in the field. Cell in particular is a top-notch journal and there’s a lot of prestige in being published by them. That will translate, I’m sure, into reluctance on the part of researchers to forego the opportunity but the growing trend among senior researchers to wash their hands of Elsevier and its journals might hasten such a boycott.

It’s probably still a little too early to tell what will happen and the situation is certainly ripe for an application of the law of unintended consequences but it feels if something is going to change. Perhaps we will, at long last, see the end of closed publishing and pay walls. Science and the world will be better off for it.

Posted in General | Tagged | Leave a comment

Six Useful Git Tips

I feel pretty safe saying that the version control wars are over and that Git has won. To be sure, there’s Subversion and a couple of other distributed version control systems whose names nobody can recall but mostly it’s Git. After Emacs converted to Git, it was pretty clear that the rear guard actions had failed and Git had prevailed.

Of course, git has a reputation for being opaque and even though systems like Magit help at lot, it’s easy for a newcomer to Git—or even a more experienced but naive user—to become confused regarding its proper usage.

James Turnbull has a useful post that contains six tips to help you become a more proficient Git user. If you’re still a little shaky on proper Git usage, it’s definitely worthwhile taking a look at his post.

I don’t want to repeat his content but I will list the six things he considers:

  1. Use of the reset command.
  2. Using cherry picking to package up the last commit for application to other branches.
  3. Amending a commit.
  4. Using stashing to temporarily save away some work in progress so that you can switch branches without having to commit.
  5. How to leverage the full power of the log command.
  6. Using the powerful bisect command to locate the commit containing code that’s causing an error.

Turnbull’s post is reasonably short and well worth a few minutes of your time.

Posted in General | Tagged , | Leave a comment

ELPA Failing to Load Packages

I always update my Emacs packages on Sunday. I’ve found that upgrading once a week is more than enough and helps limit the ever-increasing entropy here at Irreal. This past Sunday, I noticed that there was a new Org-mode in ELPA. Because Org is central to my workflow, I’d taken to using the GNU ELPA version rather than the more up to date but maybe not quite stable version from the Org repository.

When I tried to update the packages, the update aborted because it couldn’t load the new Org-mode. It said there had been a bad request. I took that to mean that the tar file was missing for some reason or another and put off upgrading until Monday. But on Monday the same thing happened. Finally, on Tuesday I saw a tweet pointing to a reddit discussion of the problem.

It turns out that there is a problem downloading from the GNU archive that’s related to TLS. Happily, the answer is simple: just add

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

to your init.el file.

Oddly, it turned out that I already had that line but it was commented out and replaced by a line that set gnutls-algorithm-priority to nil. I vaguely remember changing it to nil some months ago because of a security problem with gnutls. Presumably that’s been fixed now. I switched the commenting on the two lines, evaluated the uncommented one, and when I invoked the update function everything worked fine.

If you’re getting weird errors when you download from the GNU repository, try adding the above line to your file. It worked well for me.

Posted in General | Tagged | Leave a comment

The DMV and NULL: A Cautionary Tale

The other day, I came across an amusing story on the KNRS Website. It involved an IT worker named Droogie who thought it would be fun to prank the DMV by buying the vanity license plate “NULL”. It was, he thought, if nothing else a nice little joke for the in-crowd and, who knows, maybe it would confuse the software that issues parking violations.

Of course, things starting going wrong right away. First, the DMV software wouldn’t allow him to register his car and he had to resort to manual means to get NULL entered into the system. Then it turned out that the company handling violations were both smarter and dumber than he imagined. On the one hand, the system didn’t care if his plate was NULL so he still got parking tickets.

On the other hand, the system entered the plate number “NULL” whenever there wasn’t enough information to correctly identify the vehicle. You can guess what happened next. Droogie got all those incomplete violations as well for a total of over \$12,000 in fines. He got that straightened out but, sadly, the violations people kept using the same system and now he has another \$6,000 in fines he has to deal with.

Who’s to blame for this tragicomedy? It’s tempting, depending on your political outlook, to blame either Droogie for being an annoying twit or the DMV and their violations contractor for being incompetent clowns. The truth, I submit, is otherwise. The real villain is the programmer who failed to consider what would happen if someone had the plate NULL. It’s not as if the problem is without precedent. Every few years we read a story about some poor soul with the name NULL and the difficulties he’s encountered at the hands of this problem. XKCD even has a cartoon about it.

You may think that your special word for an empty or invalid field will never be encountered in real life. As this story demonstrates once again, you’d be wrong.

Posted in General | Tagged | Leave a comment

The Never Googlers

Resistance to Google and its spying may be going mainstream. Well, at least people outside of tech are talking about it and taking action. For some time, a small group of noisy people have been shouting about Google’s relentless spying and trying to rid their on-line life of it. These were mostly people who

  1. Knew enough about security to understand the dangers that Google and the other data gatherers/brokers represented.
  2. Were technically sophisticated enough to be able to adjust their computing environments to reduce the tracking.

Over at The Hour there’s an article about ordinary people trying to rid themselves of Google. That’s almost impossible, of course, unless you want to go completely off the grid. Search and email—which is what everyone seems to worry about—is easy: use DuckDuckGo for search and something like Fastmail for email. If you live in the Apple garden, Apple’s email service is excellent, free, and doesn’t spy on you.

Similarly for browsers. There’s no reason at all to be using Chrome except that you’re used to it. It spies on you and it’s no longer the fastest. You’re much better off with Firefox or, if you’re an Apple person, Safari. And, PLEASE, don’t get me started on Google Docs and the rest of their office suite.

The hard parts—at least for me—are YouTube and all the other sites that run on Google’s cloud services. Realistically, your choice for on-line videos is don’t watch them or watch them on YouTube. The problem with Google’s cloud services is that they host sites that have nothing to do with Google and unless you’re very diligent and determined it’s hard to find out which sites those are.

Will the Never Googlers succeed or make a difference? Almost certainly not unless there’s a huge uptake in their numbers, which strikes me as unlikely. If Google has any weakness, it’s probably search. Last I knew, that’s where they make their money and it’s very easy for anyone inclined to draw back from Google to just change their default search engine to DuckDuckGo.

Update [2019-08-12 Mon 17:44]: Firefox → DuckDuckGo

Posted in General | Tagged | Leave a comment

What Happened At Boeing?

As the dismal story of the Boeing 737 Max fiasco drags on, it’s worth taking a look at how the disaster happened. Boeing, after all, has been around since 1916—to put that in context, the Wright brothers made their famous flight in 1903—and has produced such astounding successes as the B-52, the 707, and the 747. How then, did the company that produced such great aircraft manage to stumble into the 737 Max morass?

Matt Stoller tells the sad tale in his blog post, The Coming Boeing Bailout?, which has lessons for the software industry as well. Stoller’s post is really excellent and I urge you to read it. Until the Clinton administration, Boeing—at least the civil aviation division—was an engineer-run organization. Management all had aviation backgrounds but more importantly, all the engineering decisions were made by the engineers. As quoted in Stoller’s post, Fortune described Boeing as “…less a business than an association of engineers devoted to building amazing flying machines.”

That changed when, under pressure from Clinton’s Deputy Secretary of Defense, Boeing merged with McDonnell Douglas and the suits from McDonnell Douglas took over running the combined company. These people, by and large, did not have aviation backgrounds and what they did was in the military sector with its infamously corrupting, political, and inefficient design, procurement, and contracting practices. They immediately started making decisions of the sort you’d expect from people who are mostly bean counters. For example, they started off-shoring critical work for political reasons. The engineers, of course, complained and predicted disaster but were ignored. Ignoring the prediction didn’t prevent the disasters, though. The first was the 787 Dreamliner that came in (way) over budget and had such problems as batteries that caught fire.

Then in 2005, Boeing hired James McNerney, their first CEO without a civil aviation background. This was like Apple hiring Pepsi Cola president John Sculley to be CEO and the results were the same. One of McNerney’s first decisions was to launch the 737 Max project. There’s no point in recounting the results because they have been well told elsewhere but the TL;DR is that hundreds of people are dead, Boeing has lost billions of dollars and, more importantly, their reputation is in tatters.

When reading Stoller’s post, I couldn’t help but compare the old Boeing to Bell Labs. In both organizations the engineers made the engineering decisions and the suits were pretty much ignored when they tried to butt in. That’s how it should be. The C-level executives set the goals for the company; schmooze the customers and Wall Street; and run the finances, accounting, and all the silly stuff like HR but the engineers make the engineering decisions. When that discipline breaks down you get a 737 Max.

Posted in General | Tagged | Leave a comment

An Emacs Tale From Bizarro World

One of the most constant complaints about Emacs is its reliance on finger mangling key chords forever memorialized by the “Escape-Meta-Alt-Control-Shift” backronym. Indeed, many Emacs users, including some Irreal regulars, use one of the vi emulation packages, evil, Spacemacs, or Doom, precisely to avoid those awkward key chords and the damage that they’re purported to cause to one’s wrists and fingers. Some Emacs users have even had to abandon the editor because of the strain it put on their hands.

Today’s title is due to a post from Manuel González, who like an inhabitant of Bizarro World where everything works the opposite of how it does here, says that Emacs saved his wrist. The TL;DR is that the constant switching from mouse to keyboard with his old IDE was causing him to suffer RSI in his right wrist. He tried a more ergonomic mouse, which helped a bit but still didn’t solve the problem. He decided to try an editor that could be used with just the keyboard and ultimately settled on Emacs. Surprisingly, to us here on Earth, using Emacs did solve his problem and now he’s pain-free.

The weak humor of Bizarro World aside, González’s story is interesting exactly because it goes against the conventional wisdom. My guess would be that a lot—not all but a lot—of the RSI troubles that Emacs gets blamed for is really the fault of a mouse. You don’t have to take my word for it, ask González. And do read his post; it’s an interesting story.

*Update [2019-08-10 Sat 17:41]: Fixed link to González’s post.

Posted in General | Tagged | Leave a comment

Another Why I Use Emacs

Kasim Tuman has a nice blog post entitled Why Emacs in which he discusses why he likes Emacs and his strategy for getting the most out of it. His viewpoint is interesting and worth reading.

Tuman thinks of Emacs as a workbench that evolves with your changing requirements to always provide a perfect fit for your current needs. One way of looking at Emacs is exactly that: it’s a workbench or toolbox for working with text. Tuman looks at it as a library for working with text. Of course, it’s much more but in its guise as an editor, that’s a good description.

Tuman takes a contrarian view by recommending that you don’t start with someone else’s configuration or with one of the prebuilt configurations. The real power of Emacs, he says, is that you can mold it to be exactly what you want it to be and to do that most efficiently you should build up your own configuration from a bare-bones Emacs. There’s much to be said for the opposite viewpoint, of course, but I take his point that if you want to make Emacs truly yours, you’re going to have to do it yourself by building your own configuration. That’s what I did—but only because there were no prebuilt configurations when I started—and it worked out well for me.

Finally, Tuman reminds us—or at least me—that the info menu command, the m key, works on any menu and that includes the top level directory node. So if you want to read, say, the Bash info file you can go there quickly and easily by typing Ctrl+h i m bash. I’m always forgetting that and doing something stupid like searching for the proper node when all I need to do is invoke menu.

There’s nothing startlingly new in Tuman’s post but he does have a unique way of looking and things and that makes for an interesting read.

Posted in General | Tagged | Leave a comment