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

Managing Dotfiles with Org

I’ve written before about the idea of combining your dotfiles into a single Org file and then tangling them out to their proper locations. That’s a nice solution because it provides an easy way to document what you’re doing and makes it convenient to put them under version control.

Toon Claes, from that previous post, likes to have a separate Org file for each dotfile but I like the idea of keeping everything in a single file. The individual dotfiles can still be tangled out to the correct places but all the source and commentary is in a single easy-to-find file that can be version controlled without a lot of fuss.

I’m not the only one who likes the idea. Mike Hostetler has also implemented it and posted his version along with a link to it in his GitHub. Like Claes, he puts each dotfile in a separate Org file but it’s easy to change that if you prefer the “one Org file to rule them all” method instead. You’ll have to put individual tangle commands with each source block instead of a single one in the headers but you still have to specify those tangle commands even if you use multiple files so it’s not really any extra work.

Ever since I first saw this idea, I’ve thought it was the right thing but I’m ashamed to say that I’ve been too lazy to implement it myself. There’s really no excuse because you can do it piecemeal, even doing a single file at a time. As I wrote before, this idea is especially useful if you have more than one machine running the same OS. My iMac died recently so when I get around to replacing it, it would be useful to have a set of dotfiles ready to go. Maybe that will encourage me to actually do it.

Posted in General | Tagged , | Leave a comment

Composability in Vim

To the uninitiated, Vim’s command set seems a mishmash of arbitrary letter sequences that don’t seem to make any sense. To make matters worse, there are a lot of them. The truth, though, is that the commands are very regular and built up from operators, motions, and (text) objects. Once you learn that d is the command for delete you can delete letters, words, lines, paragraphs, whole files and many other objects simply by combining the d with a motion or object.

Ismail Badawi has a very nice post that explains all this in detail. The nice thing is that although you can perform hundreds of actions in vim, the number of keys you have to learn is relatively small. That makes learning and mastering vim much easier than it first appears.

The scheme is so tractive that an experienced user will know the command for an action even if they’ve never seem it before. Badawi has a story about combining the actions of two completely different plugins in the expected way and having it work as he thought it would. He says that he didn’t even think about it, he just used his muscle memory and got the right result. This despite the fact that the plugin authors almost certainly hadn’t anticipated an interaction between the two plugins and, of course, the interaction was nowhere documented.

As those of you who have been around for a while know, I was a Vi/Vim user for a long time and still think very highly of it. If you’re looking for a fast, powerful editor that concentrates on doing one thing (editing) well, Vim is for you. If you’d like an environment that allows you to do multitude of text-based tasks easily and with a single UI, Emacs is a better bet. Both are great editors; the choice boils down to what you want from your editor rather than the editor themselves.

Update [2019-08-07 Wed 14:26]: Added link to Badawi’s post.

Posted in General | Tagged | Leave a comment

Bayes’ Theorem and The Replication Crisis

I’ve written before about the replication crisis and the shockingly low reproducibility rates in scientific research. I’ve usually focused on psychology but sadly medicine is even worse. I’ve usually viewed these problems through the lens of reproducible research and have focused on ways reproducible research could help solve the problem. It turns out, though, that there’s another more relevant problem that needs addressing.

Over at the Nautilus Website, Aubrey Clayton has an excellent article on what he and a growing number of scientists believe the problem is: a reliance on statistical inference. Using these techniques was something I was taught at school along with, I’d guess, most Irreal readers. The use of them is standard and probably required in almost every scientific journal. At least, they have been. Now, due to the ongoing crisis with studies not reproducing, some journals are rethinking that policy and even going so far as to outlaw them in the papers they publish.

Clayton starts his article with what he calls three versions of the same story:

  1. A woman convicted of murder based solely on the fact that her two infant children died shortly after birth.
  2. A woman who discovers a lump in her breast and after having a mammogram is told the lump is almost certainly malignant.
  3. The famous Norenzayan study that concluded staring at Rodin’s sculpture, The Thinker, led to decreased religious belief.

They’re the same story, Clayton says, because they all depend on the same flawed statistical inference to reach their erroneous conclusions. The rest of the article discusses what went wrong and how incorrect findings were reached in each case.

Clayton makes a cogent argument—including a worked out example in the case of the woman with the breast lump—that the proper way to analyze these cases is with Bayesian Analysis, that is by using Bayes’ rule. I won’t repeat his arguments here because you should read them for yourself: The ongoing reproducibility crisis has serious implications for all of us, as the story about the woman with the breast lump makes clear. The article is not at all Mathematical so don’t be put off by that.

Posted in General | Tagged , | Leave a comment