Org 9.1.12

Bastien Guerry tweets that there’s a new version of Org available:

If you’re tracking the Org repository, the new version is already there.

Posted in General | Tagged , | Leave a comment

Happy Birthday Irreal

Today is the 7th anniversary of Irreal as a WordPress blog1. Irreal started out as a way to make occasional posts about Scheme, Common Lisp, and a couple of other Lispy subjects. It’s evolved into a daily blog that considers a broad range of technical areas and, occasionally, a rant about privacy and government spying on its citizens.

A lot of readers think of Irreal as an Emacs blog, which isn’t surprising given that the majority of my posts are on Emacs. I didn’t expect that but I suppose it’s a logical outcome of my interest in Lisp and my yearning for a Lisp Machine-like environment.

As Irreal enters its eighth year, I expect things to stay pretty much the same: daily posts featuring a lot of Emacs, some Lisp, and the occasional venting of my fury about government surveillance abuses. If there’s something that you’d like to see me write about more, feel free to leave a comment.

Footnotes:

1

The original Blogger version of Irreal started in 2009.

Posted in General | Tagged | Leave a comment

Programs that Program

I’ve written before about Eric Raymond’s (esr) UPSide project that aims to build an open source UPS that has reasonable performance and sensible operation. Esr’s latest post is especially interesting to me because it uses one of my favorite techniques: having programs write programs.

The control logic for UPSide features a state machine that listens for events—loss of AC power, say—and performs the required action based on the current state of the system. The traditional way of documenting state machines (at least for reasonably sized ones) is with a state transition diagram. Here’s the state transition diagram for UPSide. It’s straightforward and easy to understand. Spend a couple of minutes with it and you’ll understand the broad view of how UPSide works.

The diagram itself is produced with the Graphviz dot language. Dot is pretty simple to use but there’s a lot of boilerplate and it can be hard to read. Rather than deal with the grunt work, esr wrote the states and their transitions (what he calls “actions”) in a pseudocode that he shows at the bottom of the state diagram. I almost always do something like this when I’m dealing with a nontrivial dot graph because it lets you think about the diagram you’re producing rather than the dot language.

Esr took this one step further. He realized that he could use that pseudocode to generate the Go source code for the state machine too. That’s a big win because it’s much easier to understand and debug the state diagram then it is the Go code. Indeed, within an hour of posting the diagram, people were already reporting a bug in the state machine. Did you see it? Fixing it was easy: Esr simply changed a single action in the pseudocode and regenerated the diagram and Go code.

Generation of the diagram and code are both done with this small Python program. Everything that’s needed—including the pseudocode—is contained in the source for that program. It’s easy to understand and worth studying if this technique is new to you. Or even if it isn’t, you may learn some useful ideas.

Esr talks about using this technique in this UPSide progress report.

Posted in Programming | Tagged | Leave a comment

Enough With Smartphone Addiction Already

The new luddites are ever with us, of course, but I must say that the constant harping on smartphone addiction is becoming tiresome. Actually, it became tiresome some time ago; now it’s infuriating.

I was saddened to see that Tony Fadell has joined the cacophony and is agitating for Apple—of course—to do something about it. As I argued before, it’s not up to Apple or anyone else to solve this problem for you. If you think you have a problem—something I find unlikely—then it’s up to you to find a solution, not Apple or any other smartphone provider.

The TechCrunch article on Fadell’s remarks notes that he makes an analogy with healthy eating. Just as we listen when the nutrition experts tell us what constitutes a healthy diet, we should also listen when the tech addiction experts tell us what constitutes healthy behavior. Maybe I’m just feeling curmudgeonly today but that statement infuriates me.

In the first place, those nutritional experts have been telling us for 50 years to avoid fats and eat carbs instead. Except, oops, they were wrong and we ended up with a nation (or world) of overweight people. Now we’ve got a bunch of “experts” from a field that can’t even manage a 50% reproducibility rate in their studies1 telling us how we’re behaving unhealthily with our phones. My attitude is, “Get back to me when you can show me some reproducible studies.”

Fadell notes that Apple can already provide use tracking to help iPhone users use their phones responsibly. Does anyone else find that condescending and annoying? Apple, Fadell says, is willing to provide this capability for young people so parents can monitor their iPhone use. Just what we need: another way for parents to spy on their kids. I’m a long way from being a kid but that enrages me even so.

I wish these people would throw their phones away and go live on a farm. Maybe carrying water from the well will keep them busy enough that they’ll leave the rest of us alone to enjoy the benefits that technology brings.

Footnotes:

1

According to a 2015 study in Science, only 39% of psychology studies were reproducible.

Posted in General | Tagged , | Leave a comment

Zamansky 48: Silver Searcher

The other day, Mike Zamansky made a post that I really liked. It was about his grading workflow and how he tries to lessen the tedium by making it as efficient as possible. As many of you know, I enjoy reading about other people’s workflows and invariably learn something useful from them. It didn’t have a video but I was planning to write about it anyway. Then, Zamansky produced an accompanying video that talks about some of the tools he uses.

Zamansky has his students submit their homework and projects into git repositories, which he clones so that he can examine and grade their work. A typical (abbreviated) setup might look something like this on his computer (stolen from his Grading Workflow post):

hw
├── doe_jane
│   ├── hw_01
│   ├── hw_02
│   └── hw_03
│ 
└── doe_john
    ├── hw_01
    └── hw_02

Suppose he’s grading hw_02. He’d like to produce a dired listing that has just the hw_02 repository for each of his students. It’s a little tricky because the hw_02 repositories have separate parent directories. You need something like find to locate those files and pipe them into dired. The dired command find-name-dired does this but adds the inode number to the listing, which makes it wrap and look confusing.

Zamansky’s solution is to use The Silver Searcher and Philip Snowberger’s ag.el package that include the function ag-dired-regexp. That allows Zamansky to search for hw_02 in the hw directory and produce a nice dired listing of all the repositories for that assignment.

The video and post are definitely worth your time. Even if you’re not a teacher, you may have a workflow that can leverage the same ideas. The video is just short of 12 minutes so you can watch it while you’re enjoying a cup of coffee.

Posted in General | Tagged | Leave a comment

The Trouble With OneNote and Evernote

In a post that serves as a nice complement to my recent musings on Open Source Tools, Karl Voit notes that Microsoft is discontinuing OneNote. Although he’s too polite to say so directly, if you’re a OneNote user, you have no one to blame but yourself. OneNote suffers from all the disadvantages that I discussed in my Open Source Tools post: it runs on someone else’s computer, uses a proprietary file format, and, as Voit’s post reminds us, is subject to discontinuance at someone else’s whim.

Not being a Windows user, I’ve never used or even seen OneNote but I have read about it in Bell and Gemmell’s Total Recall. That’s the book that got me interested living a (more) digital life and eventually led me to Evernote. Like OneNote, Evernote’s purpose is to store all your data, whether it’s a Web page, a note, some audio, or whatever. Like OneNote it has a proprietary file format, runs on someone else’s server, and could be gone tomorrow. I no longer use it although I still pay for it and have a few notebooks containing material that I mostly don’t care about very much.

My solution for replacing these proprietary and, in the end, dangerous-to-use services is the same as Voit’s: switch to Org mode. Unlike OneNote and Evernote, Org runs on your own machine, is open source so it will always be there for you, and, most importantly, stores its data as plain text1. The data is readable by any application that knows about text.

Voit makes the case for Org mode in his post but by now we2 should all be familiar with it. For most of us, what’s required is to import any data we care about into Org so we no longer have to worry about what third parties are planning to do with their products.

Footnotes:

1

You can, of course, ask it to store a file that’s not text but that’s a function of the data itself, not how you’re storing it.

2

In this context, “we” means the community of Emacs users, of course.

Posted in General | Tagged , | Leave a comment

Org Babel Recipes

I find that one of the most useful features of the phenomenally useful Org mode is the Babel code block capability. You have to have facility with at least one programming language, of course, but this is Irreal so that’s probably not a problem if you’re reading this.

Code blocks can be useful for anyone who needs to massage some table data (tax data, say). Some, like John Kitchin, a Chemical Engineering Professor, use them extensively for reproducible research. Professional developers can leverage them like Howard Abrams does in this excellent post and video about literate devops.

Using code blocks is conceptually easy: you put some code—in any of several languages—in a source block and it gets executed and (can) automatically insert the results in the org document when you export the document or otherwise execute the block. There are details, though. The peculiarities of different languages mean that the details of using a language effectively differ between the languages. The Worg site has documentation for several languages, which is very useful.

Dfeich has put together a set of Babel recipes for several languages. They’re basically his notes for using the languages effectively in code blocks. If you’re using a language in a code block for the first time, it’s worth your while to take a look at his recipe (and the Worg documentation) to avoid any gotchas.

Posted in General | Tagged , | Leave a comment

Sed

In the days before GUIs, Unix users depended on a suite of command line tools to do their text manipulation. One of those tools, sed, is still used and useful today but many younger engineers are unfamiliar with it. The basic idea is that it will read each line of a file, perform a series of transformations on it, and write the result to stdout. Hence the name: stream editor.

If you’re a vi/vim user, the sed command structure will be familiar to you but even if you’re not, it’s easy to learn. Daniel Leary over at Theodo has a nice introduction to sed that shows how to perform a series of changes to a CSV file. It covers only a small part of sed’s functionality but that part is probably the most used and useful part.

Once you’ve read through Leary’s tutorial, you’ll be able to make basic changes to a file and read the sed man page to figure out the other functionality. Sed is one of those utilities that you—or at least I—don’t need that often but when you do, it’s just the thing. Emacs users will say, “But I can do that easily in Emacs,” which is true but what if you have to do it repeatedly, say on a daily basis? With sed you can record the commands in a file and then just run sed on a file as needed. It’s really very handy and worth spending a few minutes getting familiar with. Leary’s tutorial is a good place to start.

If you want more information, The Unix Programming Environment by Kernighan and Pike has an excellent section on sed that covers more of the details.

Posted in General | Tagged , | Leave a comment

RMS on Data Collection

RMS has an article in the Guardian that discusses the safety of your on-line data. With the recent exposure of Facebook surveillance practices and their consequences, reporters have been asking him if he thinks it could be a turning point in the battle to regain some of our privacy. He has an interesting proposal that he says would help accomplish that.

That proposal boils down to not collecting data unless it’s really needed for the application. The emphasis on “really” is to prevent the inevitable cheating that would otherwise occur to gather too much information. RMS gives the example of London’s oyster cards, which are used to pay for trips on London’s trains and buses. Those cards link the user with the trips that they take. But as RMS points out, there’s no real need to collect the user’s identity. The cards are simply a convenient proxy for cash that make using the transportation system a bit more seamless.

The authorities counter that by linking the information, they allow the user to review a list of past trips but that is not an essential part of the application—which is providing a convenient way of paying for transportation—and therefore the information should not be collected.

I like the idea but it’s hard to see how it could be effectively enforced. The data collectors will simply declare that, for example, providing a list of past trips is an essential part of the service so they need to collect the data. It’s possible that Europe will move in that direction but, sadly, I see little chance of that happening in the US. Maybe after a few more Facebook-like debacles.

Posted in General | Tagged | Leave a comment

Blogging with Hugo and Org Mode

Over at ZCL.SPACE there’s an informative post about blogging with Hugo and Org mode. The post serves as a reasonable go-by for setting up and using Hugo for an attractive, static blog. Although Hugo now supports Org markup natively, the post recommends exporting to Hugo compatible format using ox-hugo.

The ZCL blog is a bit unique because it is divided into distinct sections. Each section has its own Org file in which each level-one heading is a post. If you’re looking for a way of writing a static blog with Emacs and Org mode, take a look at this post for some good ideas.

While I still prefer to blog with WordPress, my ongoing problems org2blog and the XML-RPC interface to WordPress that it uses are tempting me to consider switching over to a simpler static blog. There’s a lot to be said for a blogging platform in which pushing a post amounts to transferring a file to the site.

Posted in General | Tagged , | Leave a comment