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

OrgMode Tutorial Plans

Rainer König is back, after 15 months, with news of some changes in his life and his plans for his video series. In the latest video, König explains that he’ll be changing jobs soon and is also considering starting his own business consulting on productivity.

One of his problems, he says, is that it’s easy for your Org mode TODO list to become so large that it’s overwhelming. König says that there’s a couple of ways of dealing with that. One way is to become more disciplined about what you add to the list and to realize that you can’t “do it all.” The other thing you can do is allow yourself to say that you don’t feel like working on some task today and put it off for later.

To assist with that second coping mechanism, König has been thinking about writing an addition for Org that he calls “Procrastinate Mode.” The basic idea is that you can mark items on your TODO list to be put off for a while by having them moved into the future. His idea is a little richer than that so you should watch the video for the details. He’s soliciting advice and feedback on his Procrastinate Mode idea so if you have some wisdom to depart, you can leave it in a comment to the video.

I’m glad to have König back and I hope he produces more of his excellent videos.

Posted in General | Tagged , | Leave a comment

Privacy.io

From John Cook’s Data Privacy Twitter feed we have this recommendation:

If you’re at all interested in privacy, you should take a look at the PrivacyTools.io site. It has informative articles but also lists of privacy tools along with recommendations. If you’re wondering what VPN provider to use or you think your current browser is unnecessarily collection information about you, take a look at the recommendations on this site. Similarly, if you’re tired of Google reading your emails, get off Gmail by using one of the privacy-conscious email providers that they list.

This is a great site and resource for those who want to recapture a bit of their privacy. You’re never going to be able to stay completely anonymous while on line but by using the tools discussed on the site you can remain safer and retain more privacy than you otherwise could.

Posted in General | Tagged , | Leave a comment

Custom Highlighting

Last month someone pointed to this Emacs Notes post from last year and I thought some of you might find it handy. As the post points out, syntax highlighting can be a wonderful thing but sometimes you have a weird or custom file format for which no highlighting has been implemented. The author gives a simple example of this and goes on to show how to implement your own custom highlighting.

It probably seems as if it’s not worth the trouble most of the time but once I got used to having syntax highlighting, files seemed “dead” without it. If you have files in strange formats that you use more than very occasionally, you should read over the post to see if it’s worthwhile providing some highlighting.

Posted in General | Tagged | Leave a comment

An Analysis of Some Password Managers

Over at the Independent Security Evaluators site they have an interesting article on the security of of several password managers. It’s virtually universal advice from security experts that you should use a password manager and the authors of the article emphatically agree. They note, however, that every one they examined leaked some information. An attacker would have to have access (either physical or network) to the machine the password manager was on to exploit these leaks but it’s good to have the problems revealed so that the vendors can fix them.

The article begins by proposing a list of security guarantees a password manager should provide and then examines how we those guarantees are met. They look at

  • 1Password4
  • 1Password7
  • Dashlane
  • KeePass
  • LastPass

all running under Windows 10.

The article doesn’t call out any actions for users other than to use a strong master password. My only experience has been with 1Password and they are diligent about fixing problems that come up. On the other hand, it’s discouraging that version 7 leaked more information than version 4 but they’re undoubtedly aware of this research and I expect they will fix things.

The other caveat is that only the Windows 10 versions were tested but there’s probably little reason to expect that the versions for other operating systems would be much different. Again, even the researchers say that password managers great applications and that you should continue to use one.

Posted in General | Tagged | Leave a comment

Open Offices Again

I thought I was finished with writing about the horror known as Open Offices for a while but I just came across an article that so fully mirrors my feelings on the subject that I had to wade into the morass once more. The article, Open-Plan Office: Great for Photo Shoots, Terrible for Collaboration, is over at the Nuclino Blog and does a good job of summarizing the problems with open offices. I’ll let you read the post for those reasons and while you’re there, take a look at the pictures and see if they don’t make your blood run cold. The first one, with its high ceiling and lack of walls reminds me of a local mall whose architecture amplifies every sound and makes it painfully noisy. But there’s one aspect of the article that bears more comment.

I’ve been pretty vocal in my belief that the real driver of open offices is cost savings on real estate and buildout. Sometimes I felt that maybe I was being a bit too cynical or overwrought. The real problem is that I was being naive. I had no idea how large those saving were. I thought it was probably a few hundred thousand dollars for a Google-sized company. Silly me. It turns out that Google—Alphabet, actually—saves about $350 million a year on real estate charges by moving to open offices. That’s chump change, though. JPMorgan & Chase saves over a billion dollars a year with open offices. The article has a chart showing the savings for several large companies.

Those savings, as the article points out, make it unlikely that we’ll ever get rid of open offices. It offers a few suggestions for living with them but, really, your best option is to find a job with a sane office arrangement or that will let you work from home.

Posted in General | Tagged | Leave a comment

Benchmarking in Emacs

Marcin Borkowski (mbork) has posted an instructive article on benchmarking Elisp code. He had a theory on the run time of alternative implementations for some code he’d written and rather than wave his arms, he did what we all tell ourselves we’ll do but often don’t: he benchmarked the run time of the two implementations.

He used the benchmark library to do this. It’s worth reading his post just to remember (or familiarize yourself with) the details of benchmark. In any event, he confirmed his suspicions about the implementations but discovered that he was right for the wrong reasons.

Take a look at his post to see the details and discover what he learned about working with strings.

Posted in General | Tagged | Leave a comment