Outage Status

I still can’t reach the administrative page so I assume the WordPress attacks are ongoing. That’s annoying but at least I’ve figured out how to push new posts. That still leaves those comments stuck in moderation, of course, but all I do about that is apologize again.

Posted in Administrivia | Leave a comment

My Solution to EmacsGolf 3

Here’s my solution to the EmacsGolf 3 challenge. When I first saw Saul’s post, the first thing that popped into my mind was that this is the classic use case for a keyboard macro. The only problem is that each line is slightly different. Fortunately, Tim Visher showed us the way early in his VimGolf in Emacs series.

We start by beginning a keyboard macro with 【F3】 and then just start typing the first line until we get to Route. Next we enter recursive edit with 【Ctrl+u Ctrl+x q】, type in Route, and exit the recursive edit with 【Ctrl+Meta+c】. Now we backwards kill the last word (textViewRoute), yank it back again, and type in the rest of the line until we get to the second textViewRoute where we yank it back in again. Finally we finish the line, type 【Return】 and end the macro.

We complete the problem by running the macro again for each line but type in the unique word for that line. Here’s the keystrokes for the macro definition:

TextView                ;; self-insert-command * 8
SPC                     ;; self-insert-command
textView                ;; self-insert-command * 8
C-u C-x q               ;; kbd-macro-query
<C-backspace>           ;; backward-kill-word
C-y                     ;; yank
SPC                     ;; self-insert-command
=                       ;; self-insert-command
SPC                     ;; self-insert-command
(TextView)convertView.findView  ;; self-insert-command * 30
ById(R.id.              ;; self-insert-command * 10
C-y                     ;; yank
);                      ;; self-insert-command * 2
RET                     ;; newline

That’s 69 keystrokes for the macro, two for the start and stop macro, 42 for the unique words, and 7 for the macro invocations. That’s a total of 120. It’s hard to see how you can do much better since almost all the keystrokes are just text that must appear1. If you have a better solution, by all means leave a comment.

Update: Oops. We need 8 more keystrokes for the 【Ctrl+Meta+c】 after each recursive edit.

Footnotes:

1 You could, I guess, save another 5 keystrokes by repeating the macro invocation 7 times with 【Meta+7 F4】.

Posted in General | Tagged | Leave a comment

Still More Information on the Outage

Here’s another article on the ongoing attack on WordPress sites that helps explain what’s going on. From the description of the attack, I think Irreal is pretty safe since we don’t use stupid passwords but who knows. When all this is over, I’ll definitely be doing some forensics.

Posted in Administrivia | Leave a comment

More Information on the Outage

Apparently, this is what’s going on that’s causing the problems with Irreal. It looks as if all WordPress sites are getting hit. I’ll post more information as it becomes available. Let’s hope this latest round of silliness ends soon.

Posted in General | Leave a comment

Outage 2

OK, I guess that worked. I had to rename the post file so that it didn’t get stuck in the queue but at least I was able to get it pushed out.

Also, I forgot to mention that there is at least one comment stuck in the moderation queue (for the Elisp Challenge post) that I can’t release because I can’t get to the admin page. My apologies to the commenter. Believe me, I’m not ignoring you—especially since your solution is close to mine.

Posted in General | Leave a comment

Back of the Envelope Calculations

I love this. I’m a big believer in the utility of making back of the envelope calculations. It’s amazing how often it can reveal poor assumptions or that someone is trying to peddle malarkey.

The technique is also extremely powerful. For example, the slides at the link pose the question: “How many piano tuners are there is New York City?” At first it seems like it’s impossible to know or that at least you’d need specialized knowledge but that’s not true. By making some reasonable assumptions—the average piano is tuned once a year, for example—and combining them with a plausible estimate for the number of families in New York, you can reach a reasonable guess for the number of piano tuners. The idea is to get an estimate that is accurate to within an order of magnitude.

If nothing else, doing some of the exercise on the slides may help you with your next job interview when someone asks you how many pizza parlors there are in San Francisco.

Posted in General | Leave a comment

Outage

I am unable to reach the administrative panel of Irreal to release today’s blog. Technical support reports that they are undergoing a DOS attack that (somehow) only affects administrative logins.

I’m going to try pushing today’s post again. If you see the post for 2013-04-13, you will know I succeeded. If you don’t see the post, all we can do is wait until the hosting folks resolve the problem.

Sorry for the outage.

jcs

Posted in Administrivia | Leave a comment

Window Configuration and Management

Xah Lee has a couple of nice posts on managing window configurations. One posts deals with having a single (large) frame and dividing it into several windows. The other deals with the opposite case of having several frames with one or two windows in each. I tend to prefer a single large frame (although I sometimes pop up another temporarily) while Lee likes several frames.

No matter, between the two posts he’s got you covered. The posts will be useful mostly for n00bs but he does mention winner-mode and windmove, packages that I only recently became aware of and started using, so there may be something there for you even if you’re an old hand.

Posted in General | Tagged | 12 Comments

An Elisp Challenge

Here’s a simple Elisp challenge suggested by a problem from by ProgrammingPraxis. We call one string a cycle of another if one string can be transformed into the other by a rotation of the characters. Note that this means

  1. They have the same number of characters.
  2. They have the same characters.
  3. The characters are in the same order when considered as a cycle.

Thus, “abc” and “cab” are cycles of each other because if “abc” is rotated right by 1 (or left by 2) it equals “cab.” Notice that “abc” and “acb” are not cycles of each other even though they meet conditions 1 and 2.

The challenge is to write an Elisp function, cyclep, that tests whether two strings are cycles of each other.

Posted in Programming | Tagged , | 7 Comments

Babcore

Arne Babenhauserheide, who you may remember as the “Eminent Babenhauserheide” from Episode 7 of Emacs Rocks!, has a nice post up on Babcore, his version of Bozhidar Batsov’s prelude. If, like me, you enjoy mining other people’s configurations for ideas to improve your own workflow, you will probably find something useful in Babcore. Everyone’s needs and interests are different so rather than list everything that Babcore contains, I’ll let you follow the link and see for yourself.

One of the really nice things about Babenhauserheide’s post is that he wrote it in Org mode so he was able to export it in many different formats. There’s HTML, of course, put he also has a link to a PDF version (for printing) and a version that contains just the Elisp that you can import directly into your .emacs. He also includes the Org source file so that you can see how he did all this. That’s very nice and serves as an excellent go-by for others who want to do something similar. As usual, the power of Org mode continues to astound me.

Posted in General | Tagged | Leave a comment