Migrating from Emacs to Doom

Jethro Kuan, whom I wrote about in regards to his work with smart notes, has another interesting post. This time it’s about his migration to Doom Emacs. There’s nothing unusual about that of course; I’ve written several posts about such migrations. What’s a (little bit) different about Kuan’s journey is that he started from vanilla Emacs instead of Vim like most such immigrants.

Of course, many Emacs users have started using Spacemacs or Doom because of RSI issues. The attraction for them is the Vim keybindings, which most people find easier on their wrists and fingers. That was not Kuan’s motivation, though. He turned off evil mode and is still using the normal Emacs keybindings.

Kuan is interested in simplifying his configuration and using as much of the built-in Emacs functionality as possible. He says that Doom is faster and more responsive than vanilla Emacs and loads faster. I’ve never understood the obsession with Emacs’ load speed. After all, most of us just leave it running—at least in server mode–all the time so a few seconds of load time in the morning doesn’t amount to much. I was a bit surprised that Doom is more responsive. It is, after all, just a prebuilt Emacs configuration. It’s probably a matter of Doom getting things like load order right.

In any event, if you feel like experimenting with your editor, trying Doom may be more advantageous then wasting your time on one of those other editors. Kuan says it took him about 2 hours to complete the migration and then he spent another hour tweaking it to his liking so it’s reasonably low cost to experiment if you feel inclined.

Posted in General | Tagged | Leave a comment

Data is Toxic Waste

Over at Kaspersky, Cory Doctorow has an interesting article that argues that far from being the new oil, data is actually the new toxic waste. He begins by noting that any data you collect will, sooner or later, leak and that when it does criminals will combine it with other leaked data to undo any anonymization that you’ve applied. That data is, he says, “pluripotent, immortal – and impossible to contain.”

So far, companies have been immunized from liability by the difficulty of showing any specific harm to a specific individual from a given leak but that is changing. Just as with physical toxic waste, although a plaintive may not be able to point to a particular harm to a given individual, the fact that a company is responsible for the release of data will be enough to hold them liable.

Doctorow says that the only wise action is to delete the data you’ve accumulated and not gather more except for specific purposes for a short amount of time. The most astounding thing is that the research shows that gathering data doesn’t pay. If there was a large gain to be realized, perhaps companies could write off their potential liability, but it turns out that the data isn’t really valuable. It’s just a liability waiting to subject the companies that collect it to substantial penalties. The people exclaiming that data is the new oil are, in fact, selling snake oil and you accept their arguments at your peril.

Sadly, this message will probably go unheeded until a few companies are driven out of business by ignoring it. Don’t let your company be one of them. Get rid of that toxic waste while you can.

Posted in General | Tagged | Leave a comment

Interactive SQL Queries With Org-mode

Marcin Borkowski (mbork) always has interesting posts that often give me good ideas. Recently, he posted on using Org-mode for SQL. I haven’t had to deal with SQL for a long time and I was never a heavy user so any complicated query always took me multiple tries. If, like me, you’re an interactive programming aficionado, what you’d like to do is to be able to build up your query piece by piece. SQL certainly doesn’t lend itself to interactive programming but Borkowski found a way. Actually, it’s pretty obvious once you see it.

His idea is to execute the query from inside an Org Babel block. He can continually execute and refine the query until he gets what he wants. The nice thing is that your last attempt doesn’t go away. It’s still there to edit and try again.

Take a look at Borkowski’s post for the details and a worked example. The post is worth reading if only to see his definition of “toy editor.”

Posted in General | Tagged , | Leave a comment

Surprising Unix Programs

Doug McIlroy has another interesting post on TUHS. This time it’s about Unix programs that he found surprising. Many of the programs have been replaced by updated tools and are no longer used by most people but they all offer something surprising. Very often, the surprise is the novel application of theory to a seemingly “simple” problem.

For example, dc is the Unix Desk Calculator, a Reverse Polish Notation calculator that featured arbitrary precision arithmetic. At each step, dc performed a backward error analysis to determine the precision needed to achieve the end precision requested by the user. McIlroy says that to this day he haven’t seen another program that does that.

Another surprise is typo, a sort of primitive spell checker that ranked words based on their similarity to other words in the document. The idea wasn’t really to serve as a spell checker but to catch typos. The program worked by counting trigram frequencies but the memory on the first Unix machines was so limited that typo used a probabilistic method to update the 1 byte counters to account for large counts. Rob Pike says that typo was written so close to the machine that he couldn’t port it to newer machines and had to rewrite it in Go.

There are some other gems in McIlroy’s list so take a look. A final surprise is that many of these programs were written by women. That wouldn’t occasion much comment today but back when these programs were written, women were much rarer in our industry.

Posted in General | Tagged | Leave a comment

Elfeed and Goto-address

The other day I was reading an Elfeed entry and wanted to follow a link so with the point on the link, I typed Ctrl+c Ctrl+o as usual. Nothing happened. In Elfeed you can click on a link or press Return when the point is on it to follow a link so it wasn’t much of an inconvenience but then I vaguely remembered that I’d done something to make Ctrl+c Ctrl+o work in non-Org buffers.

I browsed through my init.el file until I found the code and used it to find the blog post I’d written about it. Looking at the code, it was immediately clear why it wasn’t working: you have to specify which modes you want it to work in. I just added the mode that Elfeed uses for viewing stories and everything worked fine. The necessary mode to enable is elfeed-show-mode.

In case you’re in similar predicament, here’s the code I’m using. As I mention in the post, goto-address-mode is built in so despite the use-package there’s no package to load.

(use-package goto-addr
  :hook ((compilation-mode . goto-address-mode)
         (prog-mode . goto-address-prog-mode)
         (elfeed-show-mode . goto-address-mode)
         (eshell-mode . goto-address-mode)
         (shell-mode . goto-address-mode))
  :bind (:map goto-address-highlight-keymap
              ("C-c C-o" . goto-address-at-point))
  :commands (goto-address-prog-mode
             goto-address-mode))
Posted in General | Tagged | Leave a comment

Zamansky 68: Tramp and Org-publish

Mike Zamansky is back with another video in his Using Emacs Series. This video discusses maintaining a simple Web site with Emacs and Org-mode. Usually when I write about this sort of thing, it’s in the context of publishing to a blog. Zamansky’s need is a bit different. He has a couple of Web sites he maintains that support some of his programs at Hunter College. These are simple sites that Zamansky had been writing directly in HTML by logging into the host machine and editing the file in situ.

Then he realized that rather than logging onto the host machine to edit the files, he could use Tramp and do his editing from the comfort of his own environment. That’s already an improvement but then he wondered why he was going through the pain of writing in HTML when we could write in Org-mode and export to HTML. The default look of the HTML exported from Org isn’t very pretty but it’s easy to disable the default CSS and add your own. You can even embed custom CSS in the Org source file if you need something special for that page.

Zamansky’s final realization was that rather than export to HTML and then transfer the HTML to the host machine, he could simply use Org-publish and have the whole process automated. All he needed to do was write the Org source and call Org-publish to export it to HTML and transfer it to the host machine. His solution is much like Sachin Patil’s that I wrote about last Friday. It’s a nice work flow that eliminates the boring rote work and lets him concentrate on the site’s content.

Follow the link to the video for more details on his set up and how he arrived at his solution. The video runs 16 minutes, 20 seconds so plan accordingly.

Posted in General | Tagged , | Leave a comment

Sort and Uniq

I’ve been using Unix for 3 decades but I just learned something new about two of the basic Unix tools sort and uniq. If you’re not familiar with Unix command line tools, sort does just what it sounds like. You can specify fields of interest and sort will sort the file based on those fields. The uniq filter takes a line-sorted input and eliminates duplicate lines.

The sort function has a -u option that eliminates duplicate lines after sorting. For years, I—along with many other people, apparently—thought of the two commands

sort -u ...

and

sort ... | uniq

as being the equivalent. That turns out to not be true.

One of the things old Unix-heads like to complain about is the proliferation of option flags to the basic commands. Unix orthodoxy decrees that each tool should do just one job and do it well and that additional functionality should be implemented as a filter in a pipeline. Thus the proper way of eliminating duplicate lines in a file is

sort file | uniq

In a recent discussion on The Unix Hertigate Society mailing list on the topic of extraneous command options, Doug McIlroy explains that there’s a good reason for the seemingly redundant -u option to sort and that there’s subtle difference between sort -u ... and sort ...| uniq. Follow the link to see what that difference is and why sort’s -u option make sense.

Posted in General | Tagged | Leave a comment

COVID-19 and Data Caps

One of the most annoying things that ISPs perpetrate on their customers is broadband data caps. It’s one of the main reasons Comcast is the company that everyone loves to hate but AT&T and others also have them. These companies justify the caps by saying that they’re necessary to prevent their networks from being saturated but that hasn’t been true for many years. The truth is that, like exorbitant SMS messaging fees, the data cap fees are merely a way of squeezing more money out of their customers.

The SMS scam came to an abrupt end when the Apple and Android platforms provided their own messaging apps that didn’t use the cell network command channel. Today, SMS is mainly used so Apple and Android users can text each other and is free for almost everyone. Now, another event may be the harbinger of the demise of data caps.

In the wake of the COVID-19 crisis and those who can being encouraged to work from home, ISPs are under tremendous pressure to suspend data caps. As Devin Coldewey over at TechCrunch puts it, any ISP who tries to charge data overage fees during the crisis will instantly become radioactive. In Coronavirus could force ISPs to abandon data caps forever, Coldewey argues that ISPs will be forced to suspend the fees or become pariahs. Once their networks operate successfully without data caps and with the increased traffic that working from home will bring for a few months, it will become clear to everyone that there’s no reason for the caps other than to gouge customers.

It’s a persuasive argument but in the comments Neil Jones, who works for a smaller ISP, says that small ISPs must buy their bandwidth from the Tier 1 providers and that they definitely need data caps. Take a look at his comment to see if you agree.

In any event, it will be interesting to see if the ISPs are indeed forced to abandon data caps. We can only hope.

Posted in General | Tagged , | Leave a comment

Blogging With (Only) Emacs

If you’re an Emacser and a blogger, you will, of course, want to write and publish your posts from within Emacs. If you’re using WordPress, org2blog provides an excellent solution. You write your posts in Emacs and Org-mode as usual and push a couple of keys to publish them to WordPress. Of course, not everyone likes WordPress and may prefer to maintain a website with static posts. In many ways that’s a lot simpler and if you don’t have complex requirements may be the best solution.

Over at Opensource.com, Sachin Patil has a nice post that explores publishing a blog completely from within Emacs. There are plenty of solutions that are sort of like this that use Django, Hugo, or Jekyll but Patil wanted a solution that required only Emacs. Not surprisingly, Emacs has a solution for that. The solution is to write your posts in Org-mode, leveraging all its formatting capabilities, and then use Org-publish to convert the posts to HTML and push then to the server.

There are ways to include and publish a site CSS file to make your site your own. Patil covers all this in his post. If you’re looking to start a blog and would like to handle everything in Emacs, take a look at Patil’s post. It’s amazing how much one can accomplish with just Org-publish. The nice thing about this approach is that you have total control over how you publish to your site and what the end result looks like.

Posted in General | Tagged , | Leave a comment

Smart Notes

I’m currently reading Sönke Ahrens’ How to Take Smart Notes, a book that describes Niklas Luhmann’s method of taking, storing, and retrieving notes about ideas he thought could be useful later. Luhmann kept his notes on what amounted to index cards and stored them in a wooden box. The idea, Zettelkasten in German, is usually translated as “slip-box” in English. I first came across the idea in this review and summary of Ahrens’ book by Tiago Forte.

Implementing Luhmann’s idea with physical index cards is still possible, of course, but most of us would prefer to use digital methods. There’s a whole site, Zettelkasten, supporting the idea as well as commercial applications such as Roam to help you implement the system.

As soon as I heard about the idea, I thought it would be an ideal application for Emacs and Org-mode. That’s hardly an original insight, of course, and a quick search yielded two excellent posts that discuss it. The first, by Jethro Kuan, describes his note taking work flow using the org-roam package that he wrote as a way to replicate Roam with Org-mode. Most of the post is a sort of précis of the ideas presented in Ahrens’ book.

The other post, How to Make Yourself Into a Learning Machine, describes the system used by Simon Eskildsen, Director of Production Engineering at Shopify. Eskildsen doesn’t use Org—he’s a Vimer—but he’s built his own Zettelkasten. I liked his post because he gives examples of actual notes and how he links them together.

Kuan points to a nice video by Nat Eliason that shows how he uses his (Roam-based) Zettelkasten to pull together an outline for an article he’s writing. It’s very enlightening and shows the power of the Zettelkasten method. It’s 15 minutes, 12 seconds long and definitely worth watching if you’re interested in the Zettelkasten idea.

I’m waiting to finish Ahrens’ book before I try my hand at using the method. It seems pretty straightforward to implement in Org but Kuan found he needed more so I’ll take a closer look at org-roam before I commit any serious effort to the project.

Posted in General | Tagged , | Leave a comment