HTTP servers implemented using Clean

Paul de Mast demast.pjf@hsbrabant.nl
Wed, 6 Sep 2000 12:06:50 +0200


Hi,
 
Actually I do not have experience in using Clean as a http server (maybe
Martin Wierich who created the tcp/ip library can tell you moer about this),
but I do use Clean to describe HTML documents. You are absolutely correct
that Clean is excellent for synthesizing HTML code. I have been
experimenting a little with Clean to synthesize HTML code (I did not yet use
it to generate javascipts). Any functional language will probably be
excellent for describing a HTML document (see the HTML libraries of Erik
Meijer and Andy Gill) The advantage of Clean over Haskell for synthesizing
HTML code is that Clean Strings are not lists of characters but efficiently
implemented using unboxed arrays, so if you need to output a lot of HTML
Clean is perfect. I used an application that generated a lot of HTML
documents and although it was fast, it used a lot of heap due to string
concatenations. Thanks to an optimization by Diederik van Arkel (the person
who created the Clean IDE) a new version is also efficient in heap space
using String copying. The application I used generated a lot of HTML
documents (about 12 MB of HTML code desibing tables spread over 1200 files
was generated in about 30 seconds. Publishing however these documents using
Frontpage was a pain and took a long time.) for our intraweb to show
timetable information to students and teachers. A java applet was used a
navigator to select the correct file.

Because the number of documents that I wanted to publish was just growing to
large. I needed a more flexible approach. My latest attempt is to use a
Clean program as a HTML server. A php scipt is used as a navigator and calls
the Clean program and gives the Clean application the selected parameters
(which teacher, or group, which week, what information do you want to see)
as command line parameters. The Clean program then reads a database and
generated the asked HTML document (a table). The Clean program outputs the
HTML to console and this is what the client gets. I had some trouble in
giving the information back, because Clean opens a new console to output a
program result and you need the program result in the same console. Martin
Wierich fixed this problem. If you want to use Clean as a HTML server you
might need his fix. You can see the first versions in working:
http://hioweb.ftn.hsbrabant.nl/hioweb/index.htm It seems that using a php
script some time overhead is introduced: the Clean applications takes no
noticible time to start up, read a database and generate a HTML document.

Select rooster (meaning timetable information).
- groep means a Class of students
- docent means teacher
- lokalen means classrooms or practical facilities
- tentamen means examinations
- the different colours you see in the table means the kind of lesson:
lecture, different kinds of practical, examination

The tables do not yet contain crosslinks so that you can easily follow links
to module information or the timetable of a selected item, but the old
version did and I will introduce them again.

If you are interested I can send you the program, but I'm still working on
some documentation.

Paul de Mast

> -----Oorspronkelijk bericht-----
> Van: Isabelle [mailto:isabelle.todescato@libertysurf.fr]
> Verzonden: woensdag 6 september 2000 4:23
> Aan: clean-list@cs.kun.nl
> Onderwerp: HTTP servers implemented using Clean
> 
> 
> Dear Clean users,
> 
> I am lucky enough to work in a distributed computing 
> environment, and am
> currently evaluating Clean for the new software projects of 
> my company.
> 
> As Clean is excellent at synthesizing - for instance HTML+JavaScript -
> code and is equipped in its IOObjectLibrary with a neat TCP 
> interface, I
> am contemplating using Clean in order to experiment with the 
> use of the
> http protocol to implement remote clients for some computation server.
> 
> I would be very glad to know if someone is already 
> experienced with that
> kind of things, and if such is the case, to be able to obtain some
> sample code.
>  Thank you for dedicating some of your time reading and 
> answering this.
>                                                               
>     Fabien
>