The Greatest Innovation

Chris Dixon asks “What would be the greatest technological leap you’d have to explain to someone who time traveled from the 1950’s?” It’s hard to argue with his answer. It surely has changed everything.

Posted in General | Leave a comment

UPS and the Traveling Salesman

If you know anything at all about United Parcel Service you know that they put a lot of effort into optimizing their operations. For example, the white roofs on their trucks are actually a translucent material that lets light into the back of the truck so drivers can see the packages and read their labels.

In view of this, I had always assumed that UPS was using some sort of traveling salesman algorithm to plan out their routes. After all, a savings of even 5 miles per route would mean millions of dollars saved over all the routes. It turns out that UPS does exactly that but they didn’t start testing the system until 2008 and have rolled it out to only 50 depots so far. UPS estimates that it will take another half decade before the system is installed throughout the company.

The linked article is pretty interesting if you have even a passing interest in Operations Research or practical applications of the traveling salesman problem. It’s also worth noting the difference between the mathematical solution and the real-world solution as pointed out to one of the UPS staffers working on the problem by a 5 year old.

Posted in General | Leave a comment

Tabs, Spaces, and All That

Xah Lee has a helpful post on dealing with tabs, whitespace, and indentation. Nothing in the post qualifies as advanced and most of you will be familiar with the material but I remember being confused about tabs and indentation when I first started Emacs so n00bs may find it helpful. The Emacs tab behavior is rich and complicated. Vim (and other editors with which I’m familiar) tend to be more straightforward but less flexible so n00b confusion is understandable. In any event, Lee’s post is worth a look.

Posted in General | Tagged | 2 Comments

Schadenfreude

Live by the copyright, die by the patent.

Posted in General | Leave a comment

An Easy VimGolf in Emacs Challenge

Here’s an interesting VimGolf challenge. As they say in the challenge, it’s a simple problem but they’re looking for interesting solutions. The challenge is to turn this

app.config['CHALLENGE_FOLDER'] = SOLUTIONS_FOLDER
app.config['SOLUTIONS_FOLDER'] = CHALLENGE_FOLDER

into this

app.config['CHALLENGE_FOLDER'] = CHALLENGE_FOLDER
app.config['SOLUTIONS_FOLDER'] = SOLUTIONS_FOLDER

The obvious solution that any Emacs user would think of does the job in 81 keystrokes.

【Ctrl+s =】 cursor to =
【Ctrl+k】 kill after =
【Ctrl+n】 down one line
【Ctrl+y】 insert ␠SOLUTION_FOLDER
【Ctrl+k】 kill rest of line
【Ctrl+p】 up one line
【Ctrl+y】 insert ␠CHALLENGE_FOLDER

The best Vim solutions also do it in 8.

What I really want to do is something along the lines of

【Ctrl+s = Ctrl+s】 Mark rectangle
【Ctrl+x r k】 Kill rectangle
【Ctrl+x Ctrl+t】 Swap lines
【Ctrl+<】 Beginning of buffer
【Ctrl+x r y】 Yank rectangle

that’s 12 keystrokes, 50% more than the obvious solution. If I use CUA Selection Mode (as I wrote about previously) I can do it in 9 with essentially the same method as above. Is there a clever way of doing this or is the obvious solution with 8 keystrokes the best we can do? If you can beat 8 keystrokes—especially if it’s something clever—be sure to leave a comment.

Update: Fuco does it in 6.

Update 2: Fuco shaves off another keystroke to a total of 5. Definitely a heavy weight contender.

Footnotes:

1 Using our usual rules of changing the text but not saving the buffer.

Posted in General | Tagged | 8 Comments

Cheswick on Passwords

Over at acmqueue William Cheswich has an interesting article on Rethinking Passwords. After listing the usual litany of problems with passwords as a security measure, Cheswick traces the historical roots of the problem. He says that we are stilling using recommendations laid down in the “Green Book” from 1985. The Green Book—formally Password Management Guideline (Technical Report CSC-STD-002-85)—was one of a series of government publications at the time. The recommendations made a lot of sense at the time and some of them are still applicable today but they were promulgated at a time when the estimated rate of trying passwords was 8.5 per minute. Cheswich says that in many respects we have failed to move on.

He has some recommendations but they are pretty much the usual fare. They all make sense but suffer from the facts that

  1. We can’t get the sites to implement reasonable password policies and even if we could,
  2. We can’t get users to give up using “password” as their password on every site they visit.

Still, Cheswich has some interesting ideas and the article is worth taking a look at.

Posted in General | Tagged | Leave a comment

Killing Sentences

Recently I’ve had several occasions where I wanted to kill to the beginning of the current sentence. No problem, I thought, I’ll just write a quick bit of Elisp like

(push-mark nil nil t)
(backward-sentence)
(kill-region)

and bind it to some convenient key. After a little investigation I discovered that Emacs already provided backward-kill-sentence and that it was bound to【Ctrl+x Delete】 so there was nothing to do—the functionality was already there.

That got me thinking about killing to the end of the current sentence. To do that I’ve just always used 【Meta+z .】 but it turns out that Emacs also has a kill-sentence to do the job. It’s bound to 【Meta+k】, which makes sense since you use 【Meta+a】 and 【Meta+e】 to move to the beginning and end of a sentence.

Emacs really is the journey that never ends. There’s always something else to learn.

Posted in General | Tagged | 2 Comments

Seriously?

Surely this is a joke. Either that or someone has way too much time on their hands. And what about the people signing it?

Posted in General | Tagged | 2 Comments

SBCL 1.1.3

The fine folks at SBCL.org have released version 1.1.3 of their Common Lisp system. One of the contributed packages (SB-SPROF) failed a test on my MacBook Pro but worked fine on my iMac. It looks like a VM problem when it ran short of memory, which would make sense since the iMac has twice as much memory as the MacBook.

In any event, it seems to be working fine on both systems. If you’re running Linux on an AMD64 or 64 bit X86 they have a pre-built binary for you to download. Otherwise, you’ll have to build it yourself. That couldn’t be easier. Assuming you have an earlier SBCL compiler it’s just

tar -xvjf sbcl-1.1.3-source.tar.bz2
cd sbcl-1.1.3
sh make.sh
sudo sh install.sh

If you have some other Lisp compiler, the build process is essentially the same but with a different build script (see the SBCL Getting Started page).

If you’re looking to get started with Lisp, the SBCL package is an excellent choice. I’ve used SBCL on OS X, Linux, and FreeBSD and have always been happy with it.

Posted in Programming | Tagged , | Leave a comment

Haldar On Editors

Vivek Haldar published a list of his most popular posts of 2012 and one that I particularly liked was My Setup. In that post, I found this quote about editors exactly right.

Editors

This is where the religious wars usually start. And rightfully so. If,
like me, your digital life mostly revolves around text, then you need
to have a religious fervor for your text editor. When I meet a geek
who does not feel strongly about their choice of text editor (or
worse, uses notepad or gedit), all my “fake geek” alarms go off. As
far as software goes, this is the centerpiece of the entire set up.

You know what’s coming–Emacs and vi–those are the only serious
contenders. I have some measure of objectivity here, because I have
used both for a number of years, and feel comfortable with either. In
the end, I fell towards the Emacs camp. What finally tipped me over
was the customizability. People keep talking about the look and the
key bindings and how many keystrokes it takes to do something. But all
that is not important. What is important is whether you can make this
editor your own. In the final analysis, Emacs is not really a text
editor, but a platform on which to build your workflows. It just
happens to be really good at text.

But–I’m not advocating a particular editor here. It really doesn’t
matter which one you end up with. What does matter though is that you
are a power user of it. It should feel like second nature to you. You
should have no trouble making it do your bidding. It should make you
feel powerful and light and frictionless. When people look over your
shoulder at you going about your work with it, it should look like an
incomprehensible buzz to them.

His experience pretty much parallels mine except that I switched from Vim to Emacs because I started programming in Lisp. Once I made the switch, though, I found the customizability to be a huge win. In any event, I agree with everything he says in the above quote.

A couple months ago I wrote about another of Haldar’s posts on editing, New frontiers in text editing, which is also interesting. If you’re a What the .emacs.d!? fan, you’ll recognize the beginning and ending quotes from that post. Haldar is generally interesting so you might want to subscribe. I do.

Posted in General | Tagged | Leave a comment