Some Pithy Advice to Engineers About Crypto

Via Karl Voit we have this Tweet from Tim Dierks offering some pithy but good advice to engineers about crypto:

Crypto is notoriously difficult to do correctly; even the experts don’t always get it right. Dierks advice boils down to “Don’t roll your own,” and that’s a good rule.

Posted in General | Tagged | Leave a comment

Git and Plain Text for Writers

Bastien tweets a pointer to an interesting article on using Git for
writing:

Although the article, by Seth Kenlon, is advertised as considering the question “Why (prose) writers should use Git,” I think the more important takeaway is that writers should embrace plain text. Kenlon makes a persuasive case that authors would be better off trashing their word processors and using a combination of a text editor and Markdown.

Kenlon’s text editor of choice is Atom (although he does mention Emacs as an alternative), which is, I think, leaving money on the table. Other than the obvious but subjective judgment that Emacs is a better, more customizable editor, it is virtually universally acknowledged that Magit is the best Git interface—integrated or not—and that Org mode markup is superior to Markdown, especially when its Babel interface is taken into consideration.

Of course, those are the opinions of an Emacs partisan so others may disagree but it’s hard to see how one can argue about Magit or Org mode. In any event, the important point stands: embrace plain text. If you do any writing at all, you should take a look at Kenlon’s article, especially if you’re still using Word or one of its evil offspring.

Posted in General | Tagged , | Leave a comment

Screen Real Estate

A month ago, Mike Zamansky posted that he’d just replaced his two 27 inch monitors with a new 43 inch 4K monitor. I commented that every time I saw a post like his, I had an urge to run out and buy my own huge monitor because I would be sure it would make me a bazillion times more efficient. Sadly, I never do because I like working on my 13 inch laptop on my couch.

I was reminded of all this when I saw a post discussing the productivity gains that could be achieved with more screen real estate: either two monitors or an ultrawide monitor like the one Zamansky got. The post was interesting not so much for the experiment that the author performed—I didn’t find that particularly compelling—but for the two studies that they quoted.

More screen real estate won’t magically make you a bazillion times more productive, of course, but it can give you a significant increase of about 20 to 30 percent depending on the particulars of the monitors. It used to be that large monitors were pretty expensive but these days you can get one very reasonably. The studies quoted in the post suggest that it’s a worthwhile expense. Maybe you can even convince your boss.

If you like this sort of thing, Ali Abdaal has a video on his new(ish) 35 inch curved monitor.

Posted in General | Tagged | Leave a comment

Zamansky 57: Dired Subtree and Narrow

Mike Zamansky’s been busy dealing with admissions for next year’s Freshmen and other professorial duties but he has found time to give us a new video in his Using Emacs Series. This one is about using dired-subtree and dired-narrow, two packages that can simplify working with Dired.

The first package, dired-subtree, allows you to open a subdirectory displayed in a Dired listing inline with a single key. Zamansky has mapped this to Tab, which makes a lot of sense. Another Tab and the subdirectory listing is collapsed again. That can be very handy when you want to peek in a subdirectory but don’t want to open a separate Dired buffer.

The second package—the one that Zamansky finds a game changer—is dired-narrow. The idea is that you can (temporarily) narrow the Dired buffer to just the files you’re interested in. That makes it easier to see what you’re working with—especially with long Dired listings—or to perform a mass operation on just those files.

Both of these packages are part of Fuco1’s dired-hacks collection. I’ve written about dired-hacks before, here and here. If you’re a Dired user—and you should be—take a look at the collection to see if there’s anything that could improve your workflow.

Posted in General | Tagged | Leave a comment

Swiper-isearch

Abo-abo has added a new function to the swiper suite that fixes a couple of problems with swiper. The new function, swiper-isearch, acts more like isearch. The first thing you’ll notice is that multiple matches on a single line are treated as individual candidates as with isearch. You no longer have to use Ctrl+ to choose the desired entry (although Ctrl+ still works).

The second change is that an external process is longer called to process large buffers. Follow the “swiper-isearch” link above to see all the details.

Abo-abo likes the new function enough that he is using it for his default search mechanism. I’m being a bit more conservative—since I just updated swiper today—and have bound swiper-isearch to Ctrl+Hyper+s. So far, though, I like it a lot although I’ve only really used it in tests, not in my actual workflow. If, after a little more experience, I still like it, I’ll swap the bindings for swiper and swiper-isearch.

If you’re not already using swiper, you’re missing out. I recommend it without hesitation—it will improve your searching immensely. If you are a swiper user, check out swiper-isearch. The new swiper library is already in Melpa so you need only update your packages to get it.

Posted in General | Tagged | Leave a comment

The Magic of a Write-Enabled Dired

Here’s a great tip from learn emacs on how to change a group of file names:

I’ve been doing this for so long that I almost didn’t bother writing about it because I thought of it as something everyone knows. But perhaps not and that’s too bad because it’s a very useful technique. I use it even to change the name of a single file because the workflow is easy to remember and execute. Here’s an Emacs Rocks! video where Magnar Sveen uses the idea in combination with multiple cursors.

It’s definitely a habit worth cultivating if you’re not already using it. It will save you time and effort when you need to rename a set of files.

Posted in General | Tagged | Leave a comment

When You Should Use Gotos

A couple of weeks ago, I wrote about Vivek Haldar’s discussion of Dijkstra’s famous paper on why you shouldn’t use gotos in higher order languages. Dijkstra’s admonition has become received wisdom these days to the point of becoming a shibboleth that many recite without any understanding of Dijkstra’s point or why gotos should be avoided.

Haldar is back with another video that discusses a couple of cases where gotos are not only appropriate but the right choice. The first case is to enable a quick exit from a series of complicated code when an error is detected. Most of the time, a simple return statement will suffice but sometimes there’s cleanup code that needs to be run. You could, in principal, accomplish this with a really nasty set of complicated (especially if there is more than one such need to exit) if statements but that makes the code ugly and hard to read. Not convinced? Consider that the Linux kernel has over 13,000 such gotos doing exactly that. It’s a common strategy among experienced engineers and less experienced engineers shouldn’t let superstition about the evilness of all gotos keep them from using it to advantage.

The other case is a little more technical. The idea is to replace a large switch statement with what amounts to a jump table of precomputed gotos. The common application of this is in an interpreter where the main loop looks at each pseudo-op and uses a switch statement to perform the desired operation. Significant speed increases (\(\approx 25\%\)) can be realized with that strategy. The technique is used, for example, in the Python interpreter.

Take a look at Haldar’s video for more details. Good engineers can, and do, disagree as to when, if ever, gotos are appropriate but Haldar’s video will give you some tools to decide for yourself whether a particular case is justified or not.

Posted in General | Tagged | Leave a comment

Dvorak and QWERTY

It’s probably just my innate grumpiness and contrariness but I’ve never bought into the Dvorak hype. Adherents of the Dvorak layout will tell you that it’s much more logical and will make you a faster typist. I’ve never been convinced but even if it’s true, I’m already a pretty fast touch typist with QWERTY and could never see the point of enduring the pain of learning to type with the new layout just to achieve a modest increase in typing speed.

I was, therefore, interested in the views of Jon Porter who’s been a Dvorak typist for 10 years but agrees with me that it’s probably not going to make much difference in your typing speed. In an article in The Verge, Porter says that when he switched from QWERTY to Dvorak, he did see a large jump in his speed but not for the reasons given by Dvorak adherents.

He says that when he started typing on a QWERTY keyboard he used hunt-and-peck and could never break himself of the habit. He tried learning to touch type but always fell back to hunt-and-peck. Then he read about this wonderful new Dvorak system that promised greater speed and ease and decided to try it out. He learned to touch type with Dvorak and, of course, his speed was much increased.

A resounding win for Dvorak? Porter doesn’t think so. It is, he says, really a win for touch typing. The thing is, when he was learning Dvorak, he could no longer drop back to hunt-and-peck because the key caps—which he hadn’t changed—were all wrong. He had to rely on the key chart he was using to learn so he was forced to use touch typing.

People I respect, like Xah Lee and Sacha Chua, have put a lot of effort into learning Dvorak or some other alternative system and have great typing speeds as a result. I suspect, though, that those guys would achieve good speed no matter what system they used because they were willing to put in the time practicing and doing boring drills. Sadly, I’m too lazy for that so I’m sticking with QWERTY.

Posted in General | Leave a comment

Org Mode 9.2.3 Has Been Released

Bastien writes that Org-mode 9.2.3 is out:

It’s a bug fix release so if you’re having any issues with Org you should consider upgrading.

As I wrote previously, I’ve been getting my Org-mode updates from the GNU repository for stability reasons so I haven’t installed this update and can’t offer any guidance about it. If you install it and have a problem, leave a comment so others will know.

Posted in General | Tagged , | Leave a comment

Understanding the Emacs Font System

I’ve always felt a little bad that I have a hard time understanding how to work with Emacs fonts. Even simple things like setting the default font seems harder than it should be. It turns out that it’s not (just) because I’m slow: the font system really is hard to understand.

At least that’s what Alan Third says. He’s got a really useful article on how to work with the font system so you can do common things like configuring a backup font. That’s important if your default font doesn’t include the Unicode symbols that you use. For example, my default font, Inconsolata, is missing many of the Unicode symbols that I use so I had to download and configure the Symbola font to supply the missing glyphs. Third says that Emacs has an automatic fallback to Symbola so it may not be necessary to configure it. See what I mean about not understanding the font system? If, like Third, you need support for several Asian languages, you’ll appreciate his section on how to set things up to support the various fonts.

It turns out that Emacs will try really hard to find a glyph that matches the symbol you’re trying to use so in theory you really just need to make sure they’re on your machine. But that means Emacs has to search all the fonts you have installed so you’re better off configuring your fallback fonts so Emacs can limit its search space. On the other hand, if you’re using your configuration on a machine that doesn’t have that particular font installed, Emacs will just put an empty space in its place. Fortunately, Third shows you to get around that problem too.

The information in his post isn’t the type of thing you need everyday—or even often—but when you need to do something with fonts, it’s invaluable. It’s definitely worth bookmarking the post for when that day comes.

Update [2019-04-04 Thu 12:33]: your → you’re

Posted in General | Tagged | Leave a comment