-
Recent Posts
Links
Archives
- July 2026
- June 2026
- May 2026
- April 2026
- March 2026
- February 2026
- January 2026
- December 2025
- November 2025
- October 2025
- September 2025
- August 2025
- July 2025
- June 2025
- May 2025
- April 2025
- March 2025
- February 2025
- January 2025
- December 2024
- November 2024
- October 2024
- September 2024
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023
- March 2023
- February 2023
- January 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- June 2021
- May 2021
- April 2021
- March 2021
- February 2021
- January 2021
- December 2020
- November 2020
- October 2020
- September 2020
- August 2020
- July 2020
- June 2020
- May 2020
- April 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- October 2019
- September 2019
- August 2019
- July 2019
- June 2019
- May 2019
- April 2019
- March 2019
- February 2019
- January 2019
- December 2018
- November 2018
- October 2018
- September 2018
- August 2018
- July 2018
- June 2018
- May 2018
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- September 2017
- August 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- December 2016
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
Categories
Meta
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?
The Acme Editor
Russ Cox has posted a video tour of the Acme editor. If I weren’t using (and extraordinarily happy with) Emacs, this is the editor I would be using. For a long time it was only available with Plan 9 but Cox missed it so much when he stopped working on Plan 9 that he ported it and much of the Plan 9 environment to Unix like systems (such as FreeBSD, Linux, and OS X). That port is available to all as Plan 9 from User Space.
The video is entertaining and well worth a look. Perhaps it will give you some ideas that you will want to port to Emacs.
Have You Tured Today?
Of course you have. Wait. What is turing? For reasons explained on his Web site, Don Knuth defines to ture as to use the Internet. Knuth asks that if you agree with this definition that you encourage its use via social networks.
I’m not sure if this will catch on but it does fulfill a need and is not offensive so I’d be just as happy if it did. If you agree, you should pass on the suggestion in whatever way you have.
Posted in General
Leave a comment
Internal Irreal Links with Emacs
I try to keep a couple of posts in reserve for those days when nothing strikes me as worth writing about. Other times, I may write a series of posts on a related topic and not post them until the entire series is done. Whenever possible, I like to provide internal links to previous posts to provide readers with context. For example, in a series the subsequent posts might have links to the previous posts in the series.
The problem is that those earlier posts haven’t been published yet so there’s nothing to link to. Fortunately, org2blog inserts the page ID of the post into the org file when it get’s pushed to WordPress so I can push the posts to WordPress as drafts and then publish them later. That means that the org file has the page ID of the post so that I can link to it even though it hasn’t been published yet. Of course, the post containing the link has to be published after the linked post.
As I’ve mentioned before, org links have the form
[[url][label]]
so knowing the url, which for Irreal posts is http://irreal.org/blog/?p=ID where ID is the page ID, makes it possible to add links to not yet published posts.
Naturally, I’m much to lazy too do that by hand so I whipped up a bit of Elisp to do it for me:
(defun irreal-post (label id) "Make a link to an Irreal post given its ID number and a label." (interactive "sLabel: \nsID: ") (insert (concat "[[http://irreal.org/blog/?p=" id "][" label "]]")))
Now I just call irreal-post, fill in the label and post ID and the link is inserted. As with most of these little helper functions, it’s not a big thing but it does make my life a little easier.
Some Good News From PHP
Here’s some encouraging news on the security front. As regular readers know, I’ve written several times about how to safely hash passwords and complained about sites that don’t do it correctly. Now PHP 5.5 has a function that does the right thing automatically. Just make the call
$hash = password_hash($password, PASSWORD_DEFAULT);
and you get a properly salted password hash processed by bcrypt. The default algorithm of bcrypt can be overridden as can the amount of work required to hash the password.
PHP programmers no longer have an excuse for not doing the right thing. No special knowledge or crypto expertise is needed. Simply use the provided API and get safe password storage. Let’s hope a facility such as this comes to other programming environments.
A Simple Common Lisp REPL
I love this simple Common Lisp REPL by Stas Boukarev over at Zach Beane’s Common Lisp Tips. In just 5 lines of code you get a complete REPL that even handles *, **, and ***.
In the comments, Brit Butler adds two more lines that makes it display the current package as well. Good stuff.
I’ve mentioned Common Lisp Tips many times before and can’t recommend it enough. Xach always has something useful to say and, most often, something I didn’t know. If you’re a Lisper, you really should subscribe.
A Nice Elisp Tutorial
Christian Johansen has posted a nice introduction to Elisp. He had a particular problem he wanted to solve with Emacs and the tutorial is about how he went about learning enough Elisp to program a solution.
The tutorial is focused on that particular problem but is nevertheless an excellent introduction to Elisp programming. It’s perfect for the programmer who wants to learn some Elisp but has no Lisp experience. If you’re a lisp neophyte wanting to try out some Emacs Lisp, this tutorial may be just what you need.
Common Lisp Tip Tweets Redux
I’ve mentioned Jean-Philippe Paradis’ Common Lisp Tip Tweets before. He’s reorganized the site a bit and categorized the tweets so that it’s easier to find what you’re looking for. If you don’t follow him on Twitter, it’s worth stopping by his site every once in a while to check out the new tips.
My favorite new tip since my last visit:
CL tip: Indentation-saving trick: (multiple-value-bind (a1 a2 b c1 c2 c3) (multiple-value-call #'values (values 1 2) 3 (values 4 5 6)) ...)
A Silly But Beautiful Quicksort
Steven Goss over at the zero bit stream has another great Common Lisp post. His idea is to compare a minimal Haskell Quicksort routine to the same function written in Common Lisp. A case can be made that the result is not really Quicksort in either language because of the performance profile but they do follow the Quicksort algorithm and are interesting even if they aren’t useful as production code.
Goss’s final result makes use of a list comprehension macro that is interesting in its own right but the first attempt is also nice. Here’s Goss’s code for the first attempt:
(defun quicksort (list) (when list (destructuring-bind (p . xs) list (let ((lesser (remove-if-not (lambda (x) (< x p)) xs)) (greater (remove-if-not (lambda (x) (>= x p)) xs))) (append (quicksort lesser) (list p) (quicksort greater))))))
Notice how it makes the structure of the Quicksort algorithm explicit. Of course it doesn’t choose the pivot in an intelligent way—which can result in n2 behavior—and all those remove-if-not and appends are each tacking on O(n) penalties but you still have to love the beauty and brevity of the code.
Quicksort, like any other industrial strength algorithm, is hard to get right. As I mentioned in my post on Jon Bentley, perfecting the Quicksort algorithm is definitely not trivial. This implementation doesn’t come close but it is useful because it makes the structure of Quicksort clear and because it shows how Common Lisp can express algorithms in a beautiful way.