Nov 2007

CL HyperSpec Info pages in Emacs

I just discovered the following blog article by Bill Clementson, from way back in 2003. Luckily, the links still worked, so I was able to get Info pages today for the Common Lisp HyperSpec courtesy of the GCL project.

Once installed, I found I could not easily lookup documentation for, say, mapcar, because it’s actually on the page for mapc. But SLIME’s hyperspec.el contained the indexing info I needed to write a new module which fires up the Info system on the correct section for the symbol you want defined.

This new module is called cl-info.el and is available from my Lisp repository. It rebinds the standard Emacs key for function help (C-h f) to lookup help in the HyperSpec instead, if you’re in a lisp-mode buffer.

NOTE: A fellow Lisper pointed me to this blog entry which offers a much nicer way to get the HyperSpec in Info form. It’s a little more work, but the quality of the result is superior and it has an index! Also, it makes my cl-info.el unnecessary, by relying entirely on the Info system itself.

|

Script of the week: redirect

This week’s script of the week is so simple, it doesn’t really deserve to be called a script. But since it’s highly useful and comes as a surprise to many people that it can be done so easily, here it is.

The purpose of this script is to create momentary TCP routes. TCP routing is also called Layer 4 routing. That is, one machine momentarily serves as a transparent gateway between two TCP ports on two other machines. The advantages to layer 4 routing are:

  1. It’s “port to port” (you aren’t opening up subnets to each other, or even whole machines).
  2. It doesn’t require complicated routing tables entries, or IP forwarding, or NAT.
  3. It can be done entirely in user space. No strange kernel drivers required!

Here’s an example: Let’s say you use a web server sitting on a private network which you access over VPN. You can see the server just fine by typing it’s address in your web browser. One day, however, you find a bug on the server, but it only happen on that server like for your friend — who knows about such servers — to see what’s happening, but you obviously can’t grant him access to your secured network.

What would be really cool is if your friend could connect to your machine instead, and have your machine transparently proxy the connection into the VPN and over to that web server. It would also proxy responses back, so that from your friend’s point of view: your machine becomes the web server for as long as you keep the link up.

Here’s the command to do this, assuming I expose port 8080 on my machine for my friend to connect to, and I’m linking him to port 80 on the VPN’s web server:

$ tcpserver <MY-PUBLIC-IP> 8080 nc <VPN-WEB-SERVER-IP> 80

Did I mention that this doesn’t even require root privileges to work?

Note: If you have the socat utility installed, things get even simpler. In that case, the above command is just this:

$ socat tcp-listen:8080 tcp:<VPN-WEB-SERVER-IP>:80

Now you have a transparent route from port 8080 on your machine to your secured web server. After your friend is done checking things out, just cancel the command and the tunnel is destroyed. This is the best way I can think of to temporary and easily create transparent tunnels into otherwise inaccessible networks.

For this scriptlet to work, you’ll need ucspi-tcp installed (for the tcpserver command), and netcat, which comes pre-installed on OS X 10.5.

|

Hunchentoot: Persisting across reboots

In my earlier article on running Hunchentoot behind Apache, I mentioned that it would not be very difficult to have Common Lisp persist your runtime state across a system reboot. Well, after a bit of work, I now have that support available. I’ve revised the article to reflect these changes, so please read there for more information!

|

Ready Lisp for OS X Leopard

After upgrading my system to Leopard this weekend, I decided to refresh Ready Lisp as well. It now contains both 32-bit and 64-bit builds of SBCL (which has been bumped to 1.0.11), so if you have a Core 2 Duo machine, you’ll be running Lisp at full 64-bit! Alas, Emacs itself cannot support 64-bit as a Carbon app, because there are no 64-bit Carbon libraries. SLIME has also been updated, to CVS latest as of today. Aquamacs is still the same version at 1.2a.

I did spend several hours trying to build a fully Universal package that would run on PowerPC as well (I have a PowerBook G4 in addition to this MacBook Pro), but it seems Leopard has broken the PowerPC port of SBCL. Some of the core OS structures have changed, such as os_context_t.

Ready Lisp is now being versioned according to the SBCL version it contains, which makes today’s release ReadyLisp-1.0.11-10.5-x86.dmg. The older version, which still works on 10.4, can be downloaded here.

NOTE: The recent loading bug for Leopard users has been fixed. Please re-download. Also, it still does not work on OS X 10.4 (Tiger) at the moment. I will have to create a separate build of SBCL for that version this weekend.

|

A quick Hunchentoot primer

I wrote yesterday about setting up Hunchentoot, a Common Lisp web server running behind Apache, for rendering dynamic web pages in Lisp. What I neglected to mention was how one goes about coding such pages. Fortunately, that's the easiest part of all, so I wanted to provide a very short primer on getting your first Lisp web pages up and running. Read More...
|

Running Common Lisp behind Apache

It's hard for me to think of a more ideal platform for web design than Common Lisp. Imagine having a system that runs indefinitely — with the ability to "snapshot" its running state and restore exactly where you left off after reboot — where updates can be applied live at a functional-level granularity, from anywhere. Oh, and let's not forget the remote debugging and inspection capabilities! And I thought ASP.NET was nice.

Where Lisp lacks today is primarily in easy to use, pre-packaged services. One of these is getting it to run behind Apache, which although easy to do, took a bit of figuring out from several different web pages. Hopefully I can share how simple it is to get such a system running, so you can try out this highly understated environment for yourself. Read More...
|

Script of the week: bzdmg

I haven't written much this past week because I've been upgrading all the home's machines to Leopard. So far it's gone very smoothly, and I like the new OS!

The script for this week is about disk images... Read More...
|
© 2008 John Wiegley