Lisp movies

Here’s a page (from a blog that’s on my blogroll) which links to two screencasts that show using LispWorks (a Common Lisp implementation on the Mac with a nice IDE) to do HTTP client and server stuff and then to develop a Reddit-like web site in around 20 minutes.

I think these would be very impressive for someone who is a die-hard C/C++ coder
and who hasn’t played around much with Python, Ruby, etc. They are probably less impressive to the Python and Ruby crowd or to people who have watched screencasts for Ruby on Rails, Django, TurboGears, etc. Or the campy Erlang movie.

The main thing that is shown in these videos is the fluidity of developing in Lisp – the ability to make a change and see it right away without a lengthy compile/link. This of course is nice but is not unique to Lisp. There are also some neat things shown regarding the LispWorks IDE, but these have more to do with the IDE than with the Lisp language. The thing that is shown that seems most unique to Lisp is the seamless embedding of the HTML generation in the code via the clever use of s-expressions. On the other hand, the value of doing this is questionable as this is essentially throwing out the concept of separating presentation from logic and making it impossible to farm the web design out to the Dreamweaver crowd.

One interesting thing I noticed is that it was easy for me to follow along and to understand the code as he was writing it, but in the end the code had the quality that Lisp has for me – that is, the meaning of it does not leap off the page. I can follow it, but only after mentally parsing the indentation while ignoring the wash of parentheses and internally translating the flet‘s and mapcar‘s.

So while I like the whole rapid prototyping, incremental development vibe illustrated here, I still feel like I’d rather do it in a different language.

Sorry, no red pill for me just yet.

links for 2007-04-19

Up Yaws!

Getting yaws own Erlang web server running on Ubuntu Edgy Eft

I wanted to set up Yaws on my home Ubuntu box so that I could play around with ErlyWeb.

I started by installing the available Ubuntu package:

marc@tbird:~$ sudo aptitude install yaws

This installed just fine, but when I tried to run it, I ran into immediate trouble:

marc@tbird:~$ yaws -i
Eshell V5.5.1  (abort with ^G)
1> exec: 1: setuid_drv: not found

A quick peek at the Yaws page suggested that this was a known problem that had been fixed recently. I guess Ubuntu hasn’t picked up the fix yet, at least in Edgy.

So I downloaded the source code and set about building it. The only hitch was that my first attempt failed with an error about a missing PAM header file.

gcc -c -g -O2 -I/usr/include/security -I"/usr/lib/erlang/usr/include"
-I/usr/include/pam/  epam.c
epam.c:2:22: error: pam_appl.h: No such file or directory

Strange that the configure script didn’t catch the missing header file, but I digress.

The missing pam_appl.h header file was easily remedied with:

marc@tbird:~/sw/yaws-1.68$ sudo aptitude install libpam0g-dev

Then it built just fine and I could install it to my home directory using:

marc@tbird:~/sw/yaws-1.68$ make local_install

links for 2007-04-18

  • ELF statifier make one executable file with no run-time dependencies from a dynamically linked executable and all its libraries. This file can be copied and run on another machine with no need for all of the libraries.
  • Krumo is a debugging tool for PHP that is intended to replace print_r() and var_dump(), which display structured information about any PHP variable. It does the same job but presents the information beautified using CSS and DHTML.
    (tags: php debug)

AppleScript to get control over off-screen windows

As I mentioned before, one of my Mac OS X annoyances is the fact that sometimes I manage to get application windows off the screen. I think this happens mostly when I switch from using two monitors to one. Anyhow, it’s a pain in the butt, because in OS X, you can only move a window by dragging its titlebar and you can only resize it using the lower-righthand corner. Thus, you can sometimes get windows in a position where they are mostly off-screen and you can’t move or resize them. Expose doesn’t work because it will let you select but not move or resize.

Well, in the previously mentioned post, someone named Hendrik commented and posted an AppleScript to move the frontmost app back to the top-left corner of the screen. Great, except that it didn’t work on my 10.4.9 system. I kept getting the AppleScript error “NSReceiverEvaluationScriptError: 4”. I searched around and tried a few suggestions like making sure that System Preferences | Universal Access | Enable access for assistive devices was enabled (which it was). No luck, so I tabled it for a while. Then today while cleaning out my email, I came across Hendrik’s comment again and decided to see if I could get it working.

After a bit of trial and error, I got it.

I’m no AppleScript expert, but I believe that the script had been failing, because when it tried to get the frontmost application, it was getting itself and then the script exited before it could receive the messages from itself. My solution was to add some code at the beginning of the script to hide the frontmost application (the script) so that when it queried again for the frontmost application, it would get the one that was in front before the script was launched.

Here’s the script:

tell application "System Events"
	tell (a reference to (first process whose frontmost is true))
		set visible to false
	end tell
end tell

tell application "System Events"
	set FrontApplication to ¬
		(get name of first process whose frontmost is true) as string
	--display dialog "FrontApplication = " & FrontApplication
		tell process FrontApplication
			set position of window 1 to {0, 22}
			--window 1 is always the frontmost window.
		end tell
	on error
		display dialog "Exception - FrontApplication = " & FrontApplication
	end try
end tell

If you don’t want to type, here’s a download: Reposition off-screen window.scpt