Advanced Hashing Techniques

One of the first advanced programming techniques I learned back when I was beginning was the use of hashing for fast table lookup. The use of the adjective “advanced” probably looks strange to younger engineers who are used to languages like Perl, Python, and others that have dictionaries or hash tables built in but they weren’t as well known back then except, of course, that Lisp already had them. Regardless, I was fascinated with the technology and read everything I could find about them. During my career I’ve implemented hashing tens or even hundreds of times.

Attractivechaos over at Attractive Chaos has a very nice post on Advanced techniques to implement fast hash tables. He begins by noting that open hashing is very often faster than the chaining method. That’s a bit counterintuitive for me, perhaps because chaining seems more deterministic even though it really isn’t.

He then goes on to discuss some advanced techniques that can be used to speed up hashing. He concludes by noting that the choice of a hashing library is always a tradeoff and there is no “best choice.” He says there probably isn’t even a best choice for the fastest hashing method.

It’s a fairly short post and well worth reading for anyone who uses hashing in any way more significant that just using Perl or Python’s associative arrays.

Posted in Programming | Tagged | Leave a comment

Ignoring Files Locally in Magit

I learned two things I didn’t know about Magit from a post by Marcin Borkowski (mbork). The first is that you can exclude files locally. That is, you can ignore files just as if they were in .gitignore but that information doesn’t get committed as it does with .gitignore. That’s handy when you’re working in a team and have some local files that are peculiar to you and that you don’t want committed.

The other information is how to add those files to the exclude list from within Magit. Head on over to mbork’s post to get all the details.

Posted in General | Tagged , | Leave a comment

Configuring Org Mode to Look Like a Word Processor

Last month, I wrote about clean screen writing where all the extraneous information is removed from the screen and the writer is presented with a “blank page.” In the same vein, Abhinav Tushar has an interesting post on making Org mode itself look like a word processor. By that he means that Org looks like a word processor as you enter text.

Mostly it’s a matter of picking a nice font, a nice background, adjusting the spacing, and getting rid of everything but the text you’re editing. That include hiding all the Org markup and #+ commands. The result, I must admit, looks gorgeous. Still, as I said in the blank page post, it’s not for me. When I’m writing, I like to see the markup because, among other things, it makes it easier to edit the text.

Not everyone will agree, of course, so you should take a look at his results to see if they’re something you’d like. He has links to his configuration so it shouldn’t be hard to recreate his setup or use it as a jumping off place for your own. Even if you don’t want his setup, you might like using a proportional font in Org. He uses the ET Book, which looks very nice. I am impressed at what he was able to do and how nice it looks.

Posted in General | Tagged , | Leave a comment

The Real Point of All the Talk About Tech Addiction

I’ve written at length about so called “tech addiction” and why I don’t believe there is such a thing—at least not for the vast majority of people not already suffering from psychological disabilities. It makes no difference. We continue to see article after article assuring us that the problem is real and that something must be done.

Having a nasty, suspicious mind, I’ve long suspected that someone is trying to sell us snake oil. Now an article from Loupventures make this explicit: Solving Tech Addiction Is an Underappreciated Market Opportunity. Loupventures is an investment firm so they probably aren’t selling snake oil themselves but they do recognize that there’s money to be made.

As far as I can see, those pushing the tech addiction meme are either clueless journalists looking to fill today’s 500 word slot or someone with something to sell. Don’t take my word for it; read what psychologist Christopher J. Ferguson has to say. When you do, you’ll notice that the Loupventures article starts with assuming most of the myths that Ferguson debunks.

The people pushing this meme are beyond tiresome and I wish they’d stop.

Posted in General | Tagged , | Leave a comment

Virtualized Emacs

I’ve been happily Windows free for more than 20 years but it’s a sad fact that some of our brethren are forced, for reasons beyond their control, to work in the Windows environment. That’s hard on any Unix-head but especially so for Emacs users. It’s a sad fact that Emacs just doesn’t run very well on Windows and setting up the environment is harder than it should be.

Adrien Brochard recently gave a talk to the New York Emacs Meetup on his solution to this problem. He’s a Linux guy whose current job requires he work on a Windows machine. His answer is to Virtualize Emacs. What that means is that he runs Emacs on Arch Linux that in turn runs in a VirtualBox instance. As Brochard points out, this works even on locked down machines to which the developer doesn’t have administrative rights.

One of the nice things about this solution is how easy it is. Brochard has some scripts he uses to automate the installation of Linux and Emacs. During the presentation, he builds the entire environment, including VirtualBox, from scratch. It takes about 25 minutes but most of it is automated so that once he starts it, he can go on with his presentation. He says that even if you get something wrong you can simply blow away the VirtualBox instance and start over.

There is, of course, some overhead and Brochard does a good job on discussing that aspect too. All things considered, though, he believes that it’s the best solution for running Emacs on Windows.

The video is about 33 minutes so plan accordingly. It’s an excellent presentation and interesting even if you aren’t faced with running Emacs on Windows.

As a final note, I’ve discovered that I’m more partisan about editors than I thought. Back in 2016 I was outraged when someone did something similar to run Notepad++ under Ubuntu. In retrospect, it seems that it was the idea of using Notepad++ that outraged me not the use of a virtual environment to run it in.

Posted in General | Tagged | Leave a comment

Formatting Tables

If you’re like me, you automatically think of the Org mode table editor (or Orgtbl minor mode) when you think of tables in Emacs. It’s hard to beat that functionality and Orgtbl mode makes it available everywhere in Emacs, even if you’re not in an Org buffer. Sometimes, though, you’d like to have special formatting for some or all of the table. That’s where delim-col comes in.

Delim-col is built-in Emacs functionality that allows you to do things like adjust what string separates the columns, add a beginning or ending string to each item, add an ending string for each row, and adjust the padding in the table. It can be really handy for copying and pasting and then reformatting tables from an external source.

I didn’t know about delim-col until I read about it over at Emacs Notes, where you’ll find a good explanation of the facility and what it can do. The Emacs Notes post also offers at bit of Elisp to make choosing the strings and delimiters a bit easier. By default you have to set them using a series of setq statements if you want something different from the built-in choices. The Emacs Notes codes arranges for you to be prompted for the values.

You probably won’t need the delim-col functionality very often but when you do it’s much easier than using something like a keyboard macro. Take a look at the post and see if you don’t agree.

Posted in General | Tagged | Leave a comment

Emacs for iA Writer Users

I’ve long since moved all my writing—at least all my new writing—to Org mode. It does everything I need and let’s me stay in Emacs. Different folks favor different strokes, of course, so it’s always interesting to see what they are and especially how they use Emacs to scratch their itches.

Azer Koçulu recently moved to Linux from macOS and wanted to bring his writing protocol with him. He was using iA Writer on his Mac but it wasn’t available on Linux. Koçulu decided to see if he could recreate the iA Writer experience in Emacs. He was happy with the result and documented what he did in a blog post. It turns out that it’s pretty easy to set up an iA Writer environment in Emacs. I’m not an iA Writer user so I can’t say how well it recreates the experience but Koçulu is happy with it.

There’s probably a larger lesson here. If you really like some writing tool but need to move to an environment that doesn’t support it or want to move to Emacs for your writing for some other reason, Emacs probably has you covered. Koçulu shows you how to do it for iA Writer and here’s a video showing how to do it for Scrivener. Doubtless solutions exist for other tools too.

Posted in General | Tagged | Leave a comment

Xmonad

One of the reasons I enjoy working as much as possible within Emacs is that I have a consistent mouseless interface to all my applications. That means that I develop muscle memory for most of what I do and I never have the cache miss of reaching for the mouse. I’m a touch typist so being able to do everything from the keyboard is a real win for me.

But what if you aren’t an Emacs user and still want to keyboard driven environment? It turns out there’s an answer that Ethan Schoonover brilliantly demonstrates in his video, XMonad Demo. Xmonad, for those of you who don’t know, is a tiling window manager for the X Window system. It’s very configurable and can allow you to live an almost mouseless life.

The features are too legion to detail in a short blog post so you should take a look at Schoonover’s video. He demonstrates a custom configuration that can even adjust itself depending on what screen he’s using. There’s a link to his configuration if you’d like to duplicate it or use it as a starting point for your own.

Those of us living in the Mac world can’t take advantage of Xmonad, of course, but if I were using X, I would definitely want it as my window manager. After you watch the video, you’ll see why. The video is 17 minutes so you may have to schedule some time.

Update [2018-10-11 Thu 11:37]: Fixed links.

Posted in General | Tagged | Leave a comment

An Old School Editor

I saw this tweet:

and my first reaction was that it made me feel old. But then I started wondering: in what sense, exactly, is Emacs “old school?”

Certainly not in the sense that it’s a relic. Emacs development is on-going and vigorous. And not in the sense that it’s underpowered and lacking features, either. Emacs is famously the “kitchen sink” editor, containing every possible feature. At one point, a kitchen sink was even used—at least informally—as its logo.

Perhaps it’s old school in the sense that it’s mostly used by gray beards. But no, younger users are constantly adopting Emacs as you can see by their questions and comments on the various forums. Maybe it’s that Emacs is not up to some modern tasks. Again no. Emacs is so extensible that you can configure it to do any possible editing task. You can even understand it as an editor construction kit. As I wrote the other day, no editor can claim to be more powerful because whatever feature they base that claim on can be added to Emacs, probably relatively easily.

So what’s the answer? Bling. Emacs doesn’t have any. I suppose if you really wanted it, you could add some chrome to Emacs but it’s beside the point and most Emacs users don’t see the need for it. To reuse my previous analogy, you don’t want a sports car for working the farm.

So I’ll embrace the “old school” label and wear it proudly as I use the most powerful editor possible even if it is a plain Jane.

Posted in General | Tagged | Leave a comment

The Decline of Penmanship

In response to Friday’s post on going paperless, Smitty notes that one of the consequences is the decline of penmanship. He’s not the first to notice. Here’s what The Oatmeal had to say about it. The Oatmeal is, as always, screamingly funny but the cartoon contains the germ of truth.

Of course, it’s also true that:

Posted in General | Tagged | Leave a comment