Playing with the UCW examples


Posted in: (Lisp) by ikki , last update on: 2010-01-15 19:47:37.922362

UCW includes a couple of examples to show you some features and how to programming with ucw.

First some background. In src the examples live in the examples directory of your UCW sources:

ucw$ ll examples/
total 16K
drwxr-xr-x 4 jdoe jdoe 4.0K Sep 16 13:05 .
drwxr-xr-x 8 jdoe jdoe 4.0K Jan  1 14:21 ..
drwxr-xr-x 2 jdoe jdoe 4.0K Dec  1 09:37 src
drwxr-xr-x 4 jdoe jdoe 4.0K Sep 16 13:05 wwwroot

But today are loaded from the main ucw.asd:

grep examples *.asd

ucw.asd:(defsystem* :ucw.manual-examples
ucw.asd:(defsystem* :ucw.examples
ucw.asd:  ((:module :examples
ucw.asd:			  :components ((:file "examples")
ucw.asd:				       (:file "counter" :depends-on ("examples"))
ucw.asd:				       ;(:file "cache" :depends-on ("examples"))
ucw.asd:				       ;(:file "forms" :depends-on ("examples"))
ucw.asd:				       (:file "sum" :depends-on ("examples"))
ucw.asd:				       (:file "wiki" :depends-on ("examples")))))))

And now something more practical:

Load examples.

UCW-USER> (require :ucw.examples)

And start the Examples application:

UCW-USER> (start-example-server :port 8080)
...
15:34          UCW INFO    Spawned new worker thread #
15:34          UCW INFO    Spawned new worker thread #
15:34          UCW INFO    Started standard-server # with backend #

You just started the Examples application and make it available on the port 8080 of your localhost (to be true in all your interfaces: 0.0.0.0) so point your browser to http://localhost:8080 and you should see the Examples running :)

UCW examples
UCW examples

Now, you can play with them and/or check the code into examples/src/, have fun!.

Live demo:

Currently you can see the examples in action on the unknown_lamer site:
http://nm156.unknownlamer.org/ucw/