SBCL 1.3.9 Released

Steel Bank Common Lisp’s newest version, 1.3.9, is ready for download at the usual place. This month’s release is a small one that fixes a bug, optimizes some operations with complex numbers, and adds an enhancement that helps with garbage collection. See the NEWS page for details.

After compilation, I ran the regressions tests and everything looked fine except that the test script itself exited with a bad status. The test summary showed the expected results though. In any event, everything installed correctly and is working.

Once again, SBCL is an outstanding Lisp environment that’s open source, comes with complete source and documentation, and has an industrial strength compiler. If you’d like to try out Lisp or move to better environment than you have, try SBCL.

Posted in General | Tagged , | Leave a comment

Wisdom From Wilfred Hughes

Some wisdom from Wilfred Hughes. I think this is right.

Posted in Programming | Tagged | Leave a comment

Rewriting Git History with Rebase in Magit

Charl Botha has a useful video on rewriting Git history with Magit. Botha gives three examples:

  1. Changing the commit message on any old commit
  2. Squashing two or more commits into one
  3. Splitting a commit into two or more separate commits

These are all accomplished by rebasing. In all of these, you bring up the rebase menu from the Magit status buffer by pressing 【r】.

For example, to rewrite an old commit message you bring up the log with 【l l】 and move the cursor to the commit you wish to reword. The you call up the rebase menu and choose 【w】 to rewrite the commit message.

The other cases are a bit more complex but follow the same general procedure. Take a look at Botha’s post for the details. The video is a few seconds over 15 minutes so you can probably fit it into a coffee break. It’s a useful adjunct to Howard Abrams’ Magit Introduction and Demonstration video, which covers some of the same material.

Posted in General | Tagged , | Leave a comment

Cool Fact of the Day

Matthew Anderson is right: I didn’t know I knew this but I do

Hat tip to Karl Voit.

Posted in General | Leave a comment

Zamansky on Keyboard Macros

Mike Zamansky has another video up in his Using Emacs Series. This time it’s about keyboard macros. I’m always inclined to think that everyone knows all about them but I keep reading tweets about people discovering their power and being amazed so Zamansky’s video is apt to be useful for many people.

If you aren’t using keyboard macros, you’re almost certainly working too hard. Zamansky gives a couple of examples that show how macros can make quick work of repetitive tasks. Often you can accomplish these tasks with something like multiple-cursors but keyboard macros are built in and always available. Zamansky compares them to a Leatherman but I like the Swiss Army Knife analogy better. In either case, the point is that macros are a flexible and powerful tool to quickly get things done. As Zamansky says, there might be a better tool for a particular task but macros are almost always good enough.

Take a look at the video to see a few more tricks like counters and saving macros. The only thing I would add is that the ability to repeat the macro a fixed number of times or until the end of the buffer is often useful. On the other hand, as Zamansky says, usually it’s just as easy to manually repeat the macro the required number of times.

As usual, the video is short—11:31 (min:sec)—so it should be easy to find time to watch it.

Posted in General | Tagged | Leave a comment

Computerphile: Unrolling Loops

Professor Brailsford of Computerphile has an interesting short video on unrolling loops. He motivates the discussion by relating a story about the introduction of the Laserwriter. John Warnock, from Adobe, and Steve Jobs planned to show off the Laserwriter’s capabilities by having it print a U.S. tax form. The problem was that the form is visually complicated and took a minute and 20 seconds to print.

Jobs felt that that was too long for an effective demonstration so Warnock took the PostScript file and removed all the procedure calls and unrolled the loops. The new file printed in 20 seconds, only 25% of the initial version.

Brailsford goes on to explain how unrolling loops can dramatically increase the speed of your code. Of course, doing so violates all sorts of rules about properly structuring your code so it’s something you should do only for critical code paths. He also mentions that once you get away from trivial programs, manually unrolling loops is too burdensome so he introduces the notion of translation programs to do the unrolling.

He demonstrates all this by writing a short PostScript program and then unrolling the loop inside it. His notes for the video contain the PostScript program, the flattened version of it, and the PostScript program to automatically unroll loops.

It’s an excellent video and just short of 10 minutes so it’s easy to find time for it. Don’t worry about the program being in PostScript; Brailsford explains everything you need to know.

Posted in General | Tagged | Leave a comment

Random Medical News

From John Cook we have this bit of humor that also has the feel of truth:

I’m old enough that I can remember at least 3 cycles of

  • Coffee is good for you and prevents heart disease and other ailments.
  • Coffee causes heart disease and cancer.

Basically, I’ve stopped listening. For years butter was really really bad and you should eat margarine if you must have a butter-like spread. Now, it’s margarine that’s bad and butter is all right after all.

The best medical advice is eat what you like: sooner or later someone will publish a study showing it’s good for you.

Posted in General | Tagged | Leave a comment

Escaping Org Examples in Org

From Karl Voit we have this really useful piece of advice:

If you follow the link to Stack Overflow you’ll discover the proper way to include Org markup as an example in an Org file. For a trivial example of this see yesterday’s post in which I included a small bit of Org markup.

The idea is that you put the example in an Org source block rather than, say, an Example block:

#+BEGIN_SRC org
* A heading
** Subhead
   With a bunch of other stuff
#+END_SRC

but that’s not quite enough. In my Org source file for this post the above was entered as:

#+BEGIN_SRC org
  ,#+BEGIN_SRC org
  ,* A heading
  ,** Subhead
     With a bunch of other stuff
  ,#+END_SRC
#+END_SRC

As you can see, the Org markup that you want to appear as the example (and not be acted on) is escaped by a comma. Although the Stack Overflow post does not make it clear, the easy way to do this is to insert the #+BEGIN_SRC org and #+END_SRC markers and then call org-edit-special, which is normally bound to 【Ctrl+c '】, and enter your Org example without worrying about escaping. When you finish by typing 【Ctrl+c '】 again, Org mode will automatically add the escaping for you.

I’m really glad to learn this trick. Trying to add Org mode markup in an example never worked well for me. Yesterday, I saw Voit’s tweet and, serendipitously, was able to use it immediately in my next post.

Posted in General | Tagged , | 1 Comment

Two New König Videos

Rainer König has posted two new videos in his OrgMode Tutorial series. Unfortunately for him but fortunately for us it’s raining in Augsburg so König has had to forego gardening in favor of making more of his excellent Org Mode videos.

This time he discusses dynamic blocks and habit training. Unless you’re really an Org mode expert, there’s sure to be a lot of things you didn’t know in the videos.

The first video talks about dynamic blocks. You may be familiar with them for displaying clocking data but they turn out to be much more general. It’s easy to set one up: you just add

#+BEGIN: function <parameters>
#+END:

to your Org file. The function identifier on the #+BEGIN: line represents the name of the function to generate the dynamic block. You can add parameter name/value pairs if necessary.

There are two builtin functions—clocktable and columnview—to cover the common cases of building dynamic blocks of clocking data and columnview representations. These are useful since the clocking data and columnview representations are normally buffer overlays and there’s no way to capture or export them. By building a dynamic block you get normal text that you can process however you like. See the video for the details on how to generate these dynamic blocks. There are keyboard shortcuts so you don’t have to bother with adding the #+BEGIN:/#+END: markers.

The second video considers habit tracking. The idea is that you have some periodic task that you want to establish as a habit—practicing an instrument, say—so you tell Org mode that it’s a habit you want to track and how often you want to do it and Org mode will provide a nice graphic in your agenda tracking your performance. You handle them just as you would TODOs. When you complete a task you mark it complete and Org tracks it for you. König has an excellent demonstration of this with his own bass and guitar practicing.

As always, these are excellent and informative videos. The two video are 13:12 and 12:37 (min:sec) long so you should have no problem scheduling them. As I’ve said before, these videos are the best introduction to Org mode that I know of and I can’t recommend them enough.

Posted in General | Tagged , | Leave a comment

Configuring Emacs for PHP

Ben Simon has a nice post on setting up Emacs for PHP. I don’t write in PHP and have no plans to start but Simon says it’s hard to get an intelligent setup for it that works for all PHP coding styles.

Simon recommends using php-mode from Melpa instead of the one that comes built into Emacs. That works well for files that are strictly code but for files that have markup he recommends web-mode. He gives his configuration for both packages; they should provide a good starting point for your own setup.

If you like autocompletion, you might also want to try ac-php. Simon shows a configuration for that as well. Simon offers step-by-step installation and set up instructions for each of these packages and says that together they make for a modern PHP development environment.

Posted in General | Tagged | 1 Comment