The History of cat

Over at Two-Bit History Sinclair Target makes the case that although it seems as if computer technology is always advancing and changing, we are still using software that is virtually unchanged from the dawn of the computer age. As a case study he looks at the history of the cat command.

The cat command was in the first edition of Unix in 1969 and has been there ever since. Target looks at the code to see how much it’s changed since then. Thompson wrote the first version in PDP assembly language and it wasn’t until the 7th edition that it was rewritten in C.

Most of the changes since then have been the usual accretion of features and their flags. So many flags were added that Rob Pike complained about it in his famous essay UNIX Style, or cat -v Considered Harmful. Nonetheless, the heart of the utility remains the two lines

while ((c = getc(fi)) != EOF)
    putchar(c);

Target provides a link to gist that contains all the implementations of cat that he discusses (including those written in assembly) so you can see how things have changed. He concludes that the macOS version of cat that he uses today has not changed at all in 13 years. If you like reading through code and enjoy Unix history, be sure to take a look at Target’s post.

Posted in General | Tagged , | Leave a comment

A Theme for Prose Writers

I came across a pointer to Kunal Bhalla’s Emacs Poet theme that may interest Emacsers writing prose using the Org or Markdown modes. As you can see from the screenshots at the above link, it uses a variable pitch font for prose text and a fixed pitch font for code examples. It has a number of other formatting options that makes the text pleasant to look at while you’re writing. The look is a bit like Abhinav Tushar’s writing configuration that I wrote about a couple of months ago.

If you’re writing pose and like the more finished look you get when using a word processor, you should definitely take a look at the Poet theme. It doesn’t turn Emacs into a word processor—thankfully—but it does make your source text look prettier.

One of the additional packages that Bhalla recommends is Jorgen Schaefer’s typo. It makes entering quotations and other punctuation such as em- and en-dashes easier. It even lets you enter non-breaking spaces and special characters such as arrows. Take a look at the README to see what it can do. Even if you’re not interested in the type of eye candy that Poet offers, you may like the ease of entering punctuation that typo offers. Although the README doesn’t say so, the package is available on MELPA.

Posted in General | Tagged , | Leave a comment

Another Blogging Workflow with Org Publish

I have a cold and feel awful so today’s post will be short but I did want to point you to Narendra Joshi’s excellent post on how he uses org-publish for his blog. What I really like about his setup is that it does everything with Org. That means it takes care of building the RSS feed, the index page, the archive, and the Disqus comment block. Once the system is set up, all he has to do is write his post as an Org file and push a couple of buttons to publish the post.

He has pointers to the complete source so you can see how everything works and use it to build your own blogging system. Again, I like that it doesn’t depend on a third party blogging engine. It’s simple and portable and doesn’t depend on the continued existence of anything but Emacs and Org mode. If you’re looking for a nice blogging solution, take a look.

Posted in General | Tagged , | Leave a comment

The Yoda of Silicon Valley

The New York Times has a nice article on Don Knuth entitled The Yoda of Silicon Valley that talks briefly about his life and contributions to Computer Science. It’s been all over Internet but if you haven’t had a chance to read it, you really should. It’s a look at one of the super stars in our field.

Speaking of Knuth, I watched his 24th annual Christmas Lecture the other day and it’s also well worth spending some time on. It’s about “Dancing Links,” a data structuring idea for backtracking that turns out to be useful in a wide variety of combinatorial problems. In the talk, Knuth mentions that a draft of the section of AOCP that deals with Dancing Links is available but not linked. Since the talk, he has supplied a link so you can get it from his Website if you’re interested in reading some more.

Posted in General | Tagged | Leave a comment

Org to Dotfiles

Back in 2016, I wrote about Haoyang Xu’s idea of keeping all your dotfiles in a single Org-mode file that tangles the individual dotfiles to their proper place in your directory structure. This allows you to write the dotfiles in a literate way and have a single, version controlled source for them. Sadly, Xu’s post has disappeared so his examples are no longer available.

Happily, Toon Claes has rediscovered the idea and posted a description of his process. He also has a GitLab repository with the dotfiles he’s implemented in this way. Claes has a separate Org file for each dotfile but there’s no reason they couldn’t be combined into a single file. If you follow the link at the bottom of each Org file to the source and then click on the Display source button, you can see the raw Org that he used.

I really like this idea although it’s probably not worth the effort if you have a single machine. If, like me, you have two or more machines running the same OS, it can be a real win. If you like keeping your configuration files under version control and want a way of recording why you made the choices you did for your dotfiles, this can be a useful technique. It’s just another example of how Org is assimilating everything.

Posted in General | Tagged , | Leave a comment

Scrolling with Emacs

Back when I was still a Vim user, I would occasionally try Emacs because of its nice features. It never stuck—until it did—because some of its behavior seemed too alien. The most prominent example of that was the scrolling. By default, Emacs has a sadistic scrolling mode where the screen will suddenly scroll up when the point got a certain distance from the bottom of the window. I found it very jarring and usually abandoned my Emacs adventure shortly after it started. I can see how, in a theoretical sense, you can make the case that the default behavior is the right thing but I can’t believe anyone actually likes it1.

Of course, I was a n00b then and didn’t understand that with Emacs you can have it your way. A little Googling and I discovered that it’s easy to stop that scrolling behavior. I did that 10 years ago and really haven’t thought about scrolling since.

Now Clemens Radermacher over at (with-emacs has his own issues with scrolling and wrote a bit of Elisp to get scrolling the way he likes it. His solution scrolls the screen by half a page each time he calls his code and highlights the line the point is on for a short time. There’s an animated GIF in his post so you can see what the result looks like.

If you’re dissatisfied with Emacs’ scrolling, take a look at Radermacher’s post and see if his method feels more comfortable.

Footnotes:

1

This will, I know, bring me many explanations of how it is the right thing but I stand by my judgment. Of course, that’s the beauty of Emacs: we can both be right. Or at least have it our way.

Posted in General | Tagged | Leave a comment

Proced on the Mac

Four and a half years ago I wrote about proced and Mickey’s excellent post about it. Sadly, it didn’t work on the Mac so I forgot about it until I saw this tweet from psnebc:

On a whim, I checked to see if it had finally been ported to the Mac and was delighted to find that it had. On rereading Mickey’s article, I see that in the comments Steve Purcell notes that they’d just merged support for the Mac into the Master branch. Mickey doesn’t supply any dates so it’s hard to know when Purcell made that comment but I’m guessing that it was contemporaneous with Mickey’s post. That means that:

  1. I’m probably the last person on Earth to learn that proced is now available for the Mac, and
  2. I’ve gone 4 years without the benefit of this excellent Emacs feature.

The bottom line for me is that now there’s one less function that I have to fall back to the shell for. I can get all the information that I’ve been depending on ps and top to give me right in an Emacs buffer. Life is good.

Posted in General | Tagged | Leave a comment

An Example of an Engineering Notebook

Antonin Januska has posted a video showing how he set up and uses an engineering notebook. I’m always interested in how people implement engineering/scientific notebooks and Januska’s video is especially interesting because he implemented his as an Org-mode file.

His idea is that the notebook shouldn’t be a log so much as a collection of technical notes to remember how he accomplished some task or even shortcut key sequences that he might otherwise forget. His set up is a nice example of starting slow with Org-mode and learning new features as you need them.

His notebook is a sequence of topics as the top level headings and lists of items or further subheadings underneath the main headings. The most complicated thing he uses is code blocks and he hasn’t gotten around to making them executable yet. Again, it shows how far just a little Org-mode can go.

The video is only 10 minutes, 48 seconds so it should be easy to fit it in if your interested in seeing how you might set up an engineering notebook.

Posted in General | Tagged , | Leave a comment

China Backs Plan S

The Open Access movement got some good news when China announced they would back Plan S. Plan S is the European-led program to make all publicly funded research freely available upon publication in a journal.

One would hardly think this would be controversial. After all, the public pays to have the research done and then has to pay again if they want to see the results. The journal publishers love it, of course: they don’t pay for the research, they don’t pay for the writing, they don’t pay for the reviewing, and, often, they don’t even pay for the editing yet they get to sell it back to the producers at outrageously high subscription fees. The University of California, for example, spends about $8.7M per year on subscriptions from Elsevier alone.

The U.S. and Europe have been pressing the publishers on open access issues for some time but China’s announcement caught everyone by surprise, especially the publishers. China is a huge market and produces a significant amount of research so their support of the open access movement is a big deal.

Irreal would be failing in its curmudgeonly duty if we didn’t point out that the problem the open access movement is trying to remedy is largely the result of the victims’ own actions. The publishers’ only leverage—if you want to publish your paper in our journal, you can’t make it available for free or you can’t make it available until a year after publication—disappears if academics simply refuse to publish in those journals. The problem is that publishing in top flight journals, which largely adhere to those restrictions, are important in tenure and promotion decisions so faculty continue to submit their papers to those journals. I don’t expect a lot progress until academia resolves its own issues.

Posted in General | Tagged | Leave a comment

Tell Me Again Why You’re Still Using Windows

Microsoft has been caught again spying on their users. Microsoft, of course, claims it’s all a big misunderstanding. They explain, Facebook like, that if you don’t want to share your data you have to adjust this obscure setting involving diagnostic data not the setting labeled “Send my activity history to Microsoft.” Or maybe you have to adjust them both. It’s hard to tell and Microsoft isn’t very helpful to users trying to set up their machines to maintain a decent level of privacy.

Google, of course, is a bigger invader of its users’ privacy but at least they have the decency to provide their services for free. Microsoft, on the other hand, makes you pay ($139 for the Windows 10 “Home” edition) for the privilege of being spied on. Their users—at least some of them—are angry and mumbling darkly about suing under Europe’s GDPR. Microsoft will claim that, “Gee, we did have a setting—or series of settings—that turn off the collection” so we’re not doing anything wrong. It’s hard to say what those in charge of GDPR enforcement will say but the Dutch Government’s reactions to similar findings isn’t encouraging.

Regardless, it’s hard to feel sorry for Microsoft’s users. This type of thing keeps happening and every time it does, the users are shocked and repair to their fainting couches but they keep using Windows. As with Google, if you use their products, you’re going to be surveilled. Full stop.

Posted in General | Tagged | Leave a comment