A wgrep Demonstration

Xah Lee has a post recommending wgrep, an Emacs extension that allows you to edit the results of grep and have the results reflected in the original file(s). This is good stuff. Although he didn’t write wgrep, Magnar Sveen demonstrates it in his Web Rebels talk. As I’ve said before, this is a great talk and worth watching with or without wgrep.

If you want to see how wgrep works, go watch the talk. I promise you, you want be sorry.

Posted in General | Tagged | Leave a comment

Getting Started with Common Lisp on OS X

I was reading Nikodemus Siivola’s excellent Common Lisp FAQ and came across a reference to Jonathan Fischer’s guide to getting started with Common Lisp on OS X. If you’re an Machead who’s wanting to get started with CL, these instructions will help a lot. Fischer outlines his plan as

  1. Install SBCL
  2. Install Aquaemacs
  3. Install Quicklisp
  4. Configure everything to work together.

The rest of post expands on the individual steps of the outline.

My only quibble with Fischer’s plan is the recommendation to use Aquaemacs instead of GNU Emacs. I’ve used Aquaemacs and it’s a great tool but I much prefer GNU Emacs. Perhaps I’m not enough of a Machead to worry about having the Emacs UI modified to do things the Mac way but I like using the “standard” Emacs because it’s always more up to date and because it’s available and works the same on all the platforms that I use.

In the comments, Greg Pfeil makes the case for Clozure Common Lisp as easier to install and having an IDE for the Mac. I’ve used CCL and it’s definitely a great CL implementation. I use SBCL because it’s used by many of the Lispers I admire and follow and seems to be preferred by most experienced Lisp hackers. The integrated CCL IDE holds no attraction at all for me. As I’ve written before, I’m all about using and mastering a single editor for ALL my work. In fact, my original impetus for moving from Vim to Emacs was to get Slime so I don’t need no stinkin’ IDE. Again, though, I used CCL for some time and I can recommend it without hesitation.

If you’ve been wanting to try out CL but it seemed too hard to get started, Fischer’s post may be just what you need.

Posted in General | Tagged , , | 2 Comments

Images in Emacs

Christopher Wellons over at null program has a nifty post on rendering fractals in Emacs. He shows how to draw and display fractal using Emacs lisp. I didn’t know you could do stuff like that. The Elisp writes the image in Netpbm format and then switches the buffer to image-mode. The code is surprisingly simple.

None of this is going to change your life, probably, but it is a lot of fun and it shows off the amazing versatility of Emacs. Head on over and take a look just for fun. You might also want to experiment a bit to see what pretty pictures you can come up with.

Posted in Programming | Tagged , | Leave a comment

Security Roundup

It’s been a busy week on the security front. Of course, that’s true of most weeks but here’s some interesting stories from the past few days:

  • CloudCracker is offering a special this week on their MS-CHAPv2 service. They will break any MS-CHAPv2 password for only $20, a $180 discount. As CloudCracker puts it

    This means that any PPTP VPN connection or intercepted MS-CHAPv2 WPA
    Enterprise wireless credentials can be cracked and decrypted with a
    100% success rate for only $20.

  • The IEEE (!) had a “data breach” in which 100k of plaintext passwords were exposed on their FTP site for over a month. I don’t know what else can be said about this.
  • Hotmail is helpfully (and silently) shortening users’ passwords to 16 characters. Honestly, there’s really no reason or excuse for this. If they were doing things correctly, they’d be hashing those passwords with bcrypt or something similar so it wouldn’t matter how long the password is. What this means, of course, is that they’re storing the passwords unhashed.
  • W3C has published a draft of its Web Cryptography API. When this is finalized and implemented it could help improve Web security. But it probably won’t because the usual people still won’t bother doing the right thing.
Posted in General | Tagged | Leave a comment

Emacs Rocks! Episode 13

Magnar Sveen is on a tear and has posted another Emacs Rocks! episode. This one is, to use a phrase Sveen might utter, mind-blowing. It’s a demonstration of his Emacs extension multiple-cursors. When I first saw this extension demonstrated in Sveen’s Oslo Web Rebels talk (that I discussed here) I was blown away by the seeming magic of it. Episode 13 gives a much more comprehensive demonstration and simply must be seen to be appreciated.

The really good news is that multiple-cursors is now available on Marmalade and Melpa. I’ve been using mark-multiple (also by Sveen) but disabled it after I downloaded multiple-cursors because the latter is essentially a superset of the former. Watch the demonstration and you’ll want to install it too.

I’ve just started using it but I’m already Addicted. As I say, watch the video and you’ll be an addict too. And if you haven’t already, watch the Web Rebels talk too—it’s fantastic.

Posted in General | Tagged | Leave a comment

An Elisp Puzzle

Xah Lee points to this interesting tweet The three S’s of SUCCESS by Gary Fredericks and asks for something similar in Elisp. Fredericks’ code is

(map (vec "SUCCESS") [0 5 6])

which certainly isn’t Elisp.

My first attempt at Elisp is

(mapcar (apply-partially #'aref "SUCCESS") '(0 5 6))

which does the trick but outputs the results as integers

(83 83 83)

because that’s how Emacs represents characters.

If we want to print out the actual S’s we need to wrap the above in some extra code

(mapcar #'char-to-string (mapcar (apply-partially #'aref "SUCCESS") '(0 5 6)))

which yields

("S" "S" "S")

What we really need here is something like the Common Lisp char function that outputs the actual characters but, of course, Emacs can only do this my making strings. On the other hand, CL lacks the nice currying function apply-partially so I don’t see a nice succinct solution in it either.

Update Noam has a much better solution in the comments.

Posted in Programming | Tagged , | 4 Comments

Common Lisp Type Hierarchy

Greg Pfeil over at Techomatic has a nice chart of the Common Lisp Type Hierarchy. Technically, there’s no new information here, of course, but it is nice to have all the information in any easy to read diagram.

If you’re a Lisper, this diagram is worth a look. It makes the whole hierarchy visible in a simple and clear way.

Posted in Programming | Tagged | Leave a comment

Emacs Rocks Episode 12

Magnar Sveen has Episode 12 of Emacs Rocks up. This time it’s about editing HTML. As usual, Sveen demonstrates some nifty tricks to make editing easier. Some of them use standard Emacs functionality and others extensions that he has written.

My only complaint is that the video moves very fast and it’s sometimes hard to see what he’s doing without replaying it several times. That problem is mitigated to some extent by a listing on the episode page of all the commands that he’s using. The pacing problem notwithstanding, this episode, like the others, is outstanding. You may also want to pick up some of Sveen’s extensions. They are very useful; I already can’t live without some of them.

Posted in General | Tagged | 1 Comment

The Vim Horror

Via Xah Lee: The horror! The horror!

Posted in General | Tagged , | Leave a comment

What the…

If you’re a Lisper here’s a surprising bit of Common Lisp arcana from Xach’s Common Lisp Tips. Did I mention that you really should subscribe?

Posted in Programming | Tagged | Leave a comment