A Reproducible Research Toolkit

José A. Alonso’s tweet:

led me to this paper by Vikas Rawal. It’s a excellent introduction to using Emacs and Org mode as a toolkit for writing research papers in a reproducible research way. If you want to write papers in Org mode, this is a very valuable resource.

After reading Rawal’s paper, I vaguely recalled something similar so I did a search for his name in my Irreal archives. Sure enough, I had written about the GitHub repository for this work in a post from a couple of years ago. Reading the PDF version of the paper seems like a different experience so I recommend taking a look even if you’ve read my previous post. Having both the finished document and the Org mode source helps to understand some of the features he is demonstrating.

Posted in General | Tagged , | Leave a comment

A Nice Mu4e Configuration

Steckerhalter tweets about configuring his mu4e configuration for multiple accounts.

He even wrote a macro to make things easier. Follow the link on the tweet to see the macro and his his configuration.

Getting mu4e installed and working can be trickly—although I found the mbsync configuration the main problem—but the result is worth the trouble.

Posted in General | Tagged , | Leave a comment

Org Spreadsheet Cheat Sheet

Yesterday, I pointed to Marcin Borkowski’s tip for easily entering formulae in Org mode tables. For most of us, Org tables provide all the spreadsheet functionality we need. I don’t remember the last time I fired up an actual spreadsheet.

The other day, I found this cheat sheet for using Org tables as a spreadsheet. It by no means includes everything or replaces the manual but it’s handy to keep around while you’re learning the basics. If you work with tabular data and want to make some elementary calculations on it, a spreadsheet is the natural solution. But in most cases, using an Org table is a better solution. It’s better because you get all the advantages of Org mode, including plain text, powerful export functions, and the ability to work in a literate way.

I use this functionality all the time and without it, my workflow would be considerably less efficient. Try it and see. Once you start using Org tables as spreadsheets, you’ll keep finding new uses for them.

Posted in General | Tagged , | Leave a comment

Setting an Org Table Formula

Marcin Borkowski has a useful reminder on how to easily assign a formula to an Org table cell or column. If you use the Org spreadsheet functionality, take a look.

Posted in General | Tagged , | Leave a comment

Video on Searching with Swiper

Those of you who hang around Irreal know that I’m a huge fan of the Ivy/Counsel/Swiper suite. It is, by far, the most important package I have installed1 and has improved my workflow in a major way.

Uncle Dave has a short video on searching with Swiper that shows some Swiper basics. My only problem with the video is that it doesn’t cover some of the best features of Swiper. One example of those features is the way that Swiper does a sort of “automatic regex” searching. A space in the search string is treated as .* so one two will search for any string that starts with “one” and ends with “two”. That sounds a bit odd but turns out to be extraordinarily useful. Once you get used to it, you’ll wonder how you ever lived without it.

Another feature that I use all the time is being able to pop up an occur buffer containing each of the candidate search targets. There’s lots more. Swiper is one of a series of utilities that use the Ivy library to handle its completion features. When you install Swiper, you get all the rest of the functionality too. Check out the Ivy manual to see what else Swiper can do and to investigate the other great functionality that Ivy brings you. Try it out; you won’t, I promise, be sorry.

The video is just a few seconds over 4 minutes so you shouldn’t have a problem finding time for it.

Footnotes:

1

Arguably Org Mode might hold that position but Org is now part of Emacs core even though I keep mine updated through the package system.

Posted in General | Tagged | Leave a comment

Using Multiple Editors

I saw this tweet:

and recoiled in horror. It’s not that I think Mattacchione is doing something wrong or that I doubt he’s a good developer, it’s just that I know I couldn’t work that way.

I appreciate the idea of picking the best tool for the task at hand and it may be that Mattacchione’s choices are exactly that but I keep thinking, “How in the world does he cope with muscle memory?” I’ve been using Emacs for a decade and before that I used Vi/Vim for even longer. Only recently have I stopped doing things like using Ctrl+k to scroll back a line. That’s the result of using only two editors, not even at the same time, over several decades.

I’m sure all this says something uncomplimentary about my flexibility but it is, nevertheless, reality for me. I don’t know what I’d do if I were working in something like Java that requires—I’ve heard—an IDE to use productively.

Anyway, the tweet got me wondering about other people. Do you, like Mattacchione, use several different editors depending on what you’re doing or do you, like me, stick with one editor for all your text-based work? If you use more than one editor, do you find that muscle memory gets in the way? If you have opinions on the matter, leave a comment.

Posted in General | Tagged | 7 Comments

Literate Benchmarking

I’ve written several posts that celebrate Org mode for its ability to document various tasks in a literate way, execute the code, and gather the results. The nice thing about this process is that you have everything together:

  • Documentation of the task;
  • Code to perform the task;
  • Results from running the code.

They’re all in a single file that makes it easy to share and reproduce.

My favorite example of this is Howard Abrams’ post and video on Literate DevOps. His presentation is specialized to DevOps but the techniques he uses are easily adaptable to other types of tasks.

Alex Bennée has a nice example of using these techniques for running benchmarks. The problems with running benchmarks are similar to those encountered in DevOps so the same sort of “literate” solution can be applied. The post doesn’t show the entire benchmarking file but Bennée does provide a pointer to it. The file is on GitHub and therefore gets reformatted so if you want to see what’s really happening, click on the Raw button to see the actual Org file.

If you’ve been a developer for a while, your tendency—or at least mine—is to just run the necessary commands from the command line and be done with it. That’s quick and easy but now you have to remember exactly what you did to share the results or to repeat the task at a later date. I’ve been making a concerted effort to slow down and do these tasks in a literate fashion using Org mode. The extra time and effort pay off in the end and you can even link to the file from your lab notebook—you are keeping one, right?—so that everything is documented.

Posted in General | Tagged , | Leave a comment

Zamansky 43: Playing Music with MPD

Mike Zamansky has posted another video in his Using Emacs Series. This video looks at playing music with MPD and Emacs. Of course, Emacs can’t play music on its own but it can be used to control music players, effectively moving music playing functions into Emacs.

MPD provides the server side of a music playing client/server system so you have to choose a client (the player) as well. There are lots of clients available and Zamansky considers three that leverage the MPC player and integrate well with Emacs. He tried but didn’t like the built-in Emacs MPC mode and Mingus. The video shows them both in action so you can decide for yourself if they work for you. Finally, Zamansky demonstrates a player that he did like: simple-mpc. It has a simple interface that is explicitly modeled after that of mu4e so it will be familiar to those using mu4e for their email.

All of this is really intended for Linux but as far as I can tell it’s possible to make it work with macOS as well. Apple, of course, has the iTunes player—which despite what many say, I find easy to use and flexible. I keep my music collection (mainly) on my iMac but AirPlay makes it possible to stream music to my laptop or other Apple device. All in all, I’m happy with the Apple solution.

Still, I like moving everything possible into Emacs so I’ve added a TODO to investigate getting MPD running on my Mac. I know that MPD can run on a different machine from the player so I could still have my centralized music collection. If anyone has any experience with MPD on Macs, please leave a comment.

The video runs just short of 15 minutes so you can probably watch it on a break. As usual with Zamansky’s videos, it full of information and definitely worth watching.

Posted in General | Tagged | 1 Comment

Brent’s Cycle Detection Algorithm

Anyone who’s prepped for a technical interview or who has an interest in algorithms is probably familiar with Floyd’s Tortoise and Hare algorithm for cycle detection in a linked list. The idea is that you traverse the list with two pointers, the tortoise and hare, with the hare moving twice as fast (by taking two steps at a time). If the hare laps the tortoise, the list has a cycle. It’s a cute algorithm that I’ve known about for years.

Recently, I came across a related algorithm, which I’d somehow managed to overlook, that solves the same problem: Brent’s algorithm. Like Floyd, Brent uses a tortoise and hare but the movement is different. The hare moves one step at a time and the tortoise mostly doesn’t move except that every so often it teleports to the hare’s position. If the hare ever moves to the tortoise’s position, there’s a cycle. The strategy of when to teleport the tortoise is what makes the algorithm work. There’s a nice description of the algorithm and the reason for the teleportation strategy at the link. According to Brent, his algorithm is 24% to 36% faster than Floyd’s.

Although Brent’s algorithm is usually considered more complex than Floyd’s, I find it easier to remember because the implementation details are less finicky.

Posted in General | Tagged | Leave a comment

Zamansky 42: Git Gutter and Git Time Machine

Mike Zamansky has another video up in his excellent Using Emacs Series. This time he looks at Git Gutter and Git Time Machine. These are a couple of small utilities that make working with Git files and repositories a bit easier.

I’ve used Git Time Machine for a while. It’s one of those things you probably aren’t going to use that often—unless you have a special use case like Zamansky—but when you want to see how a file has changed over time it’s just the thing. You can see how it works in the video.

I haven’t used the other utility, Git Gutter, but it looks interesting. What it does is mark the differences between your current file and what’s in the repository. That makes it easy to see what changes you’ve made. That can be useful, especially when your working on a file for an extended time. You can also stage or revert individual hunks of code right from the utility. Again, Zamansky demonstrates this in the video. After watching the video, I’m going to install Git Gutter and see how it fits with my work flow.

The video is about 8 and a half minutes so it will fit nicely into a coffee break.

Posted in General | Tagged , | Leave a comment