John Fremlin's blog: Teepeedee2 released!

Posted 2009-05-24 08:30:00 GMT

Finally, I've got round to releasing my Common Lisp web application platform.

It is running this blog which has the rather unique feature that comments pop up immediately for everybody whenever anybody comments on an article.

It is faster than all(?) other web application frameworks. Please let me know if you can find a faster one! I gave a talk with benchmarks at the Tokyo Linux User Group.

The main code is at github.

git clone git://

[UPDATE — thanks for your input slashdot and for finding a bug for me triggered by lots of comments. I've patched it now . . .]

And here is the code that runs this blog

(defun tech-css ()
    ((".inherit" <input <a)
     :text-decoration "inherit" :color "inherit" 
     :background-color "inherit" 
     :font-size "inherit" :font-weight "inherit"
     :font-family "inherit" 
     :border "none" :padding "0 0 0 0" :margin "0 0 0 0")
    ((<body "h1.title")
      :margin "0 0 0 0"
      :padding "0 0 0 0")
      :font-family "georgia, serif"
      :font-weight "lighter"
      :color "black"
      :background-color "white")
    ("[onclick]" :cursor "pointer")
    (".blog-entry-post-comment [onclick]"
     :text-decoration "underline")
     :margin-top "3em")
     :margin-left "2em"
     :margin-right "2em")
    (".blog-entry-story, .blog-entry-comments"
     :font-size "1.3em"
     :x-column-width "30em"
     :x-column-gap "2em")
    (".blog-entry-story P + P"
     :text-indent "1em")
    (".blog-entry-story A"
     :text-decoration "underline")
    (".blog-entry-story P"
     :line-height "1.6em")
    ((<h1 <h2 <h3 <h4)
      :font-family "verdana, sans-serif"
      :font-weight "lighter"
      :font-stretch "narrower"
      :letter-spacing "0.09em"
     :margin-left "1em"
     :margin-right "1em")
    (<h2 :font-size "200%")
      :padding-top "1em"
      :text-align "right"
      :font-size "300%"
      :color "white"
      :background-color "rgb(76,6,81)")
    (".blog-entry-post-comment textarea" 
      :width "100%"
      :height "30em")
     :x-opacity 0.60
     :margin-right "16%"
     :text-align "right"
     :font-size "50%")
    (".time .author"
     :font-size "200%")
    (".blog-entry-post-comment [name=AUTHOR]" 
     :border-bottom "thin solid")))
(defsite *tech-blog-site*
    :dispatcher ""
    :page-body-start (lambda(title)
		       `(<div :class "header"				      
			      (<h1 :class "title" 
			      	      (<a :href "/" (output-raw-ml ,title)))))
    :page-head (lambda(title)
		   (<title (output-raw-ml ,title))
(defparameter *tech* 
   :link-base "/" 
   :comment-index-prefix "vii" 
   :name "John Fremlin's blog" :dir "...." 
   :static-base-url "/static-blog/" 
   :site *tech-blog-site*
   :admin-password-file "...."))
(defun read-in-blog ()
  (blog-read-in *tech*))
(in-package #:teepeedee2)
#.(when (find-package :swank)
    (push :tpd2-has-swank *features*)
(defun run-thread (name function)
  (with-preserve-specials (*trace-output* 
    (flet ((func ()
		 (funcall function))))
      (sb-thread:make-thread #'func :name name)
      (ccl:process-run-function name #'func))))
(loop for port in '(11111) do
      (let ((socket ( :port port)))
	socket 'tpd2.http::http-serve)))
(run-thread "read in blog" (lambda()
			      (loop do
				    (sleep 300))))
(run-thread "" (lambda()
	    (tpd2.datastore:datastore-use-file "datastore.log")

Comments should appear instantly for everyone now. I stupidly managed to break them.

I'm going to go through and weed out the test messages and restore the high quality contributions.

Posted 2009-05-26 04:30:55 GMT by John Fremlin

Annoyingly I seem to have broken the automatic comment popups for other people's comments.

I'll have a go at fixing it on my lunch break in an hour.

Posted 2009-05-26 02:12:25 GMT by John Fremlin

So how do I run it?

Progress so far.. on my Ubuntu 9.04.. install the following packages.. sbcl, cl-clfad (apt-get install... then the following seems load everything at put me in the usual LISP loop.

$ sbcl --load teepeedee2.asd

What next?

Posted 2009-05-26 01:08:41 GMT by Paul

As the commenter asked above, how does this square with your assertion below that automated garbage collection is rubbish?

Posted 2009-05-26 00:49:45 GMT by Curious

Beautiful work, and a great example to support using a functional language for another project I'm working on.

Elegant comment box design by the way.

Posted 2009-05-25 17:48:43 GMT by Bill Glover

Do you think you can match the might of of the slashdot effect? Lets see...

Posted 2009-05-25 17:45:12 GMT by CowboyNeal

Posting on a legendary thread.

Posted 2009-05-25 17:44:02 GMT by St. Paul

Just tried this on the new multi-threaded clisp (*features* :MT), but unfortunately clisp on cygwin has no epoll, so I had to give up. Please somebody try the new clisp on linux.

Posted 2009-07-24 11:11:33 GMT by Reini Urban

<script type="text/javascript">

alert("I am an alert box!");


Posted 2009-08-05 04:46:36 GMT by Anonymous

Oops, sorry guys, my test comments weren't showing up until I refreshed the entire page. I'll stop bother you now.

Posted 2009-08-09 17:50:33 GMT by Patrick

No they're not. Only the *first* comment I make after refreshing the page appears instantly.

Posted 2009-08-09 17:51:40 GMT by Patrick

well, now everything's working perfectly. I'll be dog.

Posted 2009-08-09 17:52:30 GMT by Patrick

OK, let's see this instant comment thing.

Posted 2009-09-19 10:46:09 GMT by Anonymous

Feel free to test the instantaneous nature of the comments!

Posted 2009-09-19 13:48:10 GMT by John Fremlin


Posted 2009-10-06 22:31:11 GMT by Anonymous

I love this, it's awesome!

Posted 2009-10-09 19:55:28 GMT by Henrik


Posted 2009-10-11 19:20:26 GMT by exedre

I dare you to display this!

Posted 2009-10-31 00:02:47 GMT by me

Leaving my mark on the world.. one tree at a time

Posted 2009-12-04 00:21:24 GMT by Anonymous

a great piece of software.

Posted 2010-01-19 15:53:06 GMT by Anonymous

Sounds interesting! (And I have to test the comment function. :-) By the way, do you store the IP addresses?)

Posted 2010-11-25 17:07:43 GMT by Anonymous from

Is this platform better than Hunchentoot?

Posted 2011-04-26 18:17:18 GMT by Anonymous from

Is there a similar framework in scheme?

Posted 2011-06-14 13:16:03 GMT by Anonymous from

One more time, then I'll check out the source code.

Posted 2012-02-24 16:46:18 GMT by Anonymous from

Cool looking idea. I hope to explore this area myself for my dissertation next year.

Posted 2012-04-17 12:10:28 GMT by Anonymous from

Does this still work?

Posted 2015-09-25 12:38:16 GMT by Anonymous from

Post a comment