Sunday, December 7, 2008

[General] booklife

I often read many books at the same time and often will not read each book to its last page before switching to another book for various reasons. booklife is an interesting web application that helps one manage the books being read.

Jonathan Palardy announced booklife here.

Booklife allows you to add new books by searching Amazon and add books to lists of "heard of", "to buy", "ready", "in progress", "stalled", "done" and so on. You can edit the tag at later time.

Tuesday, November 11, 2008

[Computer] StumpWM: A Minimalist Window Manager

StumpWM is a window manager implemented entirely in Common Lisp. After using GNOME and then KDE for a very long time, I decided to try StumpWM.

Besides being affectionate to a window manager written in Common Lisp as I'm familiar with the language, there is one thing special about it. StumpWM depends on Emacs-like key combinations for what mainstream window managers use mouse and keys (and most Common Lisp programmers favor GNU Emacs as their editor of choice). That will be cryptic to the general computer users, but helps to prevent my baby from wreaking havoc when he plays on my laptop: It'll be very unlikely for him to get the correct key combinations by accident to move beyond the Tuxpaint window.

In Debian, it is easy to install, just

# apt-get install stump

and create a file ~/.stumpwmrc. My .stumpwmrc contains the following content to use sbcl:


(asdf:oos 'asdf:load-op 'swank)
(swank:create-server :dont-close t)

(load "/usr/share/common-lisp/source/stumpwm/contrib/battery.lisp")
(load "/usr/share/common-lisp/source/stumpwm/contrib/cpu.lisp")

If you are running X server, log out and log in to choose StumpWM as the window manager.

Below are some commands I find useful. 'C-x' means pressing both Control key and x key, as in GNU Emacs. Words after ';;' are my comments, and may be not accurate.

C-t c ;; run an X terminal
C-t e ;; run emacs or raise it if already running
C-t w ;; list windows
C-t ; ;; open a command prompt
C-t a ;; show time
C-t C-t ;; switch to other window
C-t s ;; side by side
C-t o ;; shift focus to the next frame
C-t [0-9] ;; switch to a numbered window
C-t ! ;; run a shell command
C-t Q ;; remove all frames but the current one and resize it to fit the screen
C-t " ;; show the window list and select one by moving up or down
C-t C-g ;; abort the current command
C-t t ;; sends a to the frame, e.g. for iceweasel to open a new tab
C-t C-h
C-t ? ;; help

The Stumpwm Experience showcases what you can do with StumpWM.

As a Emacs user, I also use "display-time" to display time on the mode line. For a laptop user you can use "display-battery-mode" if the contributed "battery.lisp" file is loaded.

StumpWM is highly configurable and it comes with an example configuration file. It has good documentation in man and Texinfo format. You can also view the Common Lisp source code as well.

The drawbacks of using StumpWM include:

It is not as robust as the mainstream window managers. Sometimes failures of applications may render it unusable. I have to manually kill X server via ssh from another computer and restart twice in the last 8 days.

There is a problem with copying and pasting across Emacs, KDE applications, GNOME applications and other X applications. In KDE there is klipper. In StumpWM I don't know what to do when such problem arises.

Wednesday, October 15, 2008

[Programming] Trying Clojure

Clojure is a new Lisp dialect created by Rich Hickey.

It is interesting to me because it runs on JVM with a large collection of Java libraries directly available to Clojure and keeps most of the best features of Lisp.

While Common Lisp supports functional programming, it supports other paradigms of programming quite well. Clojure only supports functional programming. It does not support object-oriented programming in the style of Common Lisp or Java. So it will be challenging to learn.

Its software transactional memory and immutable data structures make Clojure very powerful in concurrent programming.

You can find links at the official homepage to the tarballs, subversion repository, IRC channel and newsgroup. Besides the official homepage, the Clojure wikibook is also very helpful.

Clojure is under fast development and most users are using its subversion repository directly. Slime integration is a must if you are comfortable at using GNU Emacs. You should also be familiar with the Java library or have the API available to you, as Clojure depends on the Java platform for many functionalities.

The traditional REPL environment is a bliss to development and debug, but the error messages certainly need a lot of improvement to be helpful. You also need knowledge of the JAVA API and even Clojure implementation details to decipher such messages.

Sunday, July 20, 2008

[Computer] 101 days without rebooting my laptop

It's now 101 days since my last booting the laptop. It may be not surprising for a server to run continuously for several hundred days, but it is rare for a workstation. Windows users have the habit of shutting down the computer when they finish working with it and reboot it again the next time. Even though Windows 95 or 98 had the capability of hibernating, saving the running state to hard disk and resuming late, that method was rarely used, even with laptop users. No sure how many Windows XP or Vista users would keep hibernating their computers.

I'm a Debian GNU/Linux user and find it annoying to have to reboot the computer. The save-to-disk feature is great. Besides saving a few seconds rebooting, it also means I can resume work at wherever I stop last time. I don't have to relaunch some applications, reopen some files, and so on.

I've used the save-to-disk feature for quite some time. Except upgrading to new kernel versions, I don't have to reboot. On rare cases running Stell Bank Common Lisp may lead to memory swap that forced me unplug the power and thus reboot, but that's my own fault: my Common Lisp programs were not frugal with memory (trying to solve Project Euler problems) and my laptop was endowed with just 1 GB memory.

Keeping a desktop system running for so long does pose a grave test to the OS and the applications. For instance, I sometimes have to exit from GNU Emacs so that the system can hibernate successfully. After about three months running, I also noticed a bit performance hit when resuming. It takes more time switching applications after resuming than before. Konqueror and Kontact, in particular, will consume a lot of memory after running for so long. I guess 2 GB memory will eliminate the annoyance to a large extent. The delay is generally tolerable. If not, I can always exit and relaunch the specific application.

Thursday, June 12, 2008

[Computer] Revert back to KDE3 from KDE4.1 beta

After almost two weeks working with KDE 4.1beta, I decided to revert back to KDE3. There are certainly some problems to be expected for the beta release, including occasional crash of some applications. And I can make do with that.

The determinant is that I found myself often cannot use s2disk to save the current session for later resumption. That's very disheartening to me.I usually will not reboot my Debian GNU/Linux for months until I install a new kernel and want to run with it. That saves me a lot time rebooting the computer and bring all the applications up to their last state.

I'd keep using KDE 4.1beta if I reboot every day (if not each time I come to the front of my computer), as many users do.

Friday, June 6, 2008

[Computer] Seven days' experience with KDE4

Following Ana's howto I successfully upgraded to KDE 4.0.80 and have used it for 7 days now.

I was upgrading from Debian unstable. There were some conflicts preventing me from upgrading. I could only go ahead after some trial-and-errors. That is, trying to resolve the conflicts by manually adding package names to apt-get.

Overall, KDE4 is prettier than its predecessors. The best thing I find with KDE4 is the new package okular for viewing PDF and other format files. The review facility enables me to add highlight to some texts and comments. And those reviews can be copied to share with others or to be used on my other computers.

I've come across a few application crashes, and that's understandable as beta software. I'd say KDE 4 is quite usable and stable enough to me.

If you are interested in Okular, you can also just install Okular. That will remove package kdebase-bin-kde3. I'm not sure whether that will pose problems to me or not. So far I haven't rebooted or restarted KDE and everything seems fine.

Monday, April 21, 2008


Thanks to the upcoming Olympic Games, access to from within China seems to have been made possible again. From this change alone I do not support boycotting the Games.

Tuesday, January 8, 2008

blogpsot not accessible

What an unfortunate situation! I just created this blog and posted the first blog but the site cannot be accessible in Beijing. I can still post new blogs because the site is still acccessible, but this situation is really not so agreeable. Why the domain name is not accessible is beyond me. I just want to post some technical posts, anyway.

Monday, January 7, 2008

Project Euler

From Ingvar Matsson's Nov. 8, 2007 blog I learned about the Project Euler and started working on the problems. There are 176 problems this week and new problems are added every one or two weeks. The site is so popular that the host service provider cut off database access last weekend that forced the author eliminate more dynamic features.

I decided to use Common Lisp as the programming language of choice, though otherwise I've been using Objective Caml more often in the last five years.

So far I've solved 74 out of 176 problems (42%). I use SBCL and SLIME and I'd say Common Lisp and SBCL in particular is quite efficient at the task. Most of the solved problems take no more than a few seconds to finish at the interactive Read-Evaluate-Print-L oop environment.

I chose Common Lisp over Objective Caml mainly because Objective Caml does not provide automatic bignum support, which renders number crunching cumbersome.