caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] HTTP-server written in ocaml
@ 2003-06-11 10:02 Jurjen Stellingwerff
  2003-06-11 15:07 ` Ken Rose
  0 siblings, 1 reply; 9+ messages in thread
From: Jurjen Stellingwerff @ 2003-06-11 10:02 UTC (permalink / raw)
  To: caml-list

Hello all,

In the past few months I have written a web-server in ocaml. This
resulted in a module library and a stand-alone web-server. This server
has an internal scripting language that is basically just html with
extra tags (like <loop> ... </loop> and <when test="a=3"> ... </when>)
Yes I know... yet another scripting language.

But there is hope... this server is also usable as a module so if you
want to web enable your own application feel free to grab this
project...

The code should be stable (I have some remaining worries about SSL) and
I hope to get some feedback on it... please send in all your
encouragements, flames, patches and enhancement request.

More info on: http://camlserv.sf.net

Jurjen Stellingwerff


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
  2003-06-11 10:02 [Caml-list] HTTP-server written in ocaml Jurjen Stellingwerff
@ 2003-06-11 15:07 ` Ken Rose
  2003-06-11 16:02   ` Jurjen Stellingwerff
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ken Rose @ 2003-06-11 15:07 UTC (permalink / raw)
  To: Jurjen Stellingwerff; +Cc: caml-list

Jurjen Stellingwerff wrote:

> More info on: http://camlserv.sf.net

Looks interesting.  I'm not able to download it from sourceforge,
though.  When I try to select a mirror, it just redisplays the "select a
mirror" page.  It's not just your page, though.  I had the same problem
elsewhere on sourceforge, yesterday.

Anybody have an idea what's going on?

Thanks

 - ken

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
  2003-06-11 15:07 ` Ken Rose
@ 2003-06-11 16:02   ` Jurjen Stellingwerff
  2003-06-11 16:07   ` Jurjen Stellingwerff
  2003-06-11 16:54   ` Owen Gunden
  2 siblings, 0 replies; 9+ messages in thread
From: Jurjen Stellingwerff @ 2003-06-11 16:02 UTC (permalink / raw)
  To: caml-list

On Wed, 2003-06-11 at 17:07, Ken Rose wrote:
> Looks interesting.  I'm not able to download it from sourceforge,
> though.  When I try to select a mirror, it just redisplays the "select a
> mirror" page.  It's not just your page, though.  I had the same problem
> elsewhere on sourceforge, yesterday.
> 
> Anybody have an idea what's going on?
> 
> Thanks
> 
>  - ken

It looks like they are switching mirrors the last few days. It looks
like at least umn(US) and belnet (BE) have my files correctly but
twtelecom (US) seems late (and gives an error on download).

Maybe it just takes time.

One week ago my preferred mirror was deleted from the list and that gave
errors and an almost impossible situation to change till I decided to
drop all the cookies from sourceforge and select a new mirror.

Jurjen

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
  2003-06-11 15:07 ` Ken Rose
  2003-06-11 16:02   ` Jurjen Stellingwerff
@ 2003-06-11 16:07   ` Jurjen Stellingwerff
  2003-06-11 16:54   ` Owen Gunden
  2 siblings, 0 replies; 9+ messages in thread
From: Jurjen Stellingwerff @ 2003-06-11 16:07 UTC (permalink / raw)
  To: caml-list

On Wed, 2003-06-11 at 17:07, Ken Rose wrote:
> Looks interesting.  I'm not able to download it from sourceforge,
> though.  When I try to select a mirror, it just redisplays the "select a
> mirror" page.  It's not just your page, though.  I had the same problem
> elsewhere on sourceforge, yesterday.
> 
> Anybody have an idea what's going on?
> 
> Thanks
> 
>  - ken

It looks like they are switching mirrors the last few days. It looks
like at least umn(US) and belnet (BE) have my files correctly but
twtelecom (US) seems late (and gives an error on download).

Maybe it just takes time.

One week ago my preferred mirror was deleted from the list and that gave
errors and an almost impossible situation to change till I decided to
drop all the cookies from sourceforge and select a new mirror.

Jurjen


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
  2003-06-11 15:07 ` Ken Rose
  2003-06-11 16:02   ` Jurjen Stellingwerff
  2003-06-11 16:07   ` Jurjen Stellingwerff
@ 2003-06-11 16:54   ` Owen Gunden
  2003-06-11 18:28     ` Ken Rose
  2 siblings, 1 reply; 9+ messages in thread
From: Owen Gunden @ 2003-06-11 16:54 UTC (permalink / raw)
  To: caml-list

On Wed, Jun 11, 2003 at 08:07:39AM -0700, Ken Rose wrote:
> Looks interesting.  I'm not able to download it from sourceforge,
> though.  When I try to select a mirror, it just redisplays the "select a
> mirror" page.  It's not just your page, though.  I had the same problem
> elsewhere on sourceforge, yesterday.

Instead of clicking on the download links, try scrolling down and selecting
one of the radio buttons under "select preferred mirror."  Seems to work.

Owen

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
  2003-06-11 16:54   ` Owen Gunden
@ 2003-06-11 18:28     ` Ken Rose
  0 siblings, 0 replies; 9+ messages in thread
From: Ken Rose @ 2003-06-11 18:28 UTC (permalink / raw)
  To: Owen Gunden; +Cc: caml-list

Owen Gunden wrote:
> 
> On Wed, Jun 11, 2003 at 08:07:39AM -0700, Ken Rose wrote:
> > Looks interesting.  I'm not able to download it from sourceforge,
> > though.  When I try to select a mirror, it just redisplays the "select a
> > mirror" page.  It's not just your page, though.  I had the same problem
> > elsewhere on sourceforge, yesterday.
> 
> Instead of clicking on the download links, try scrolling down and selecting
> one of the radio buttons under "select preferred mirror."  Seems to work.

That did it.  Thanks

 - ken

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
@ 2003-06-13 13:45 Benjamin Geer
  0 siblings, 0 replies; 9+ messages in thread
From: Benjamin Geer @ 2003-06-13 13:45 UTC (permalink / raw)
  To: caml-list

Jurjen Stellingwerff wrote:
> More info on: http://camlserv.sf.net

I've worked on several web application frameworks and templating systems 
(in languages other than Caml).  After a brief look at Camlserv, I have 
a few suggestions.

1. A templating system can be useful for generating many things besides 
HTML.  For example, I've used templating systems to generate email 
(automated replies), SQL, other sorts of program source code, 
configuration files, etc.  Therefore, if you want to provide a 
templating system, I'd recommend making it a general-purpose one, not 
tied to the HTTP server or to HTML.

Two examples of such a system (in Java) are Velocity:

    http://jakarta.apache.org/velocity

and FreeMarker (I was the original author):

    http://www.freemarker.org

2. A templating system, when used to generate web pages, should have a 
syntax which web designers will find easy to use.  The XML-like syntax 
you propose is, in my view, rather cumbersome.  Many web designers are 
familiar with JavaScript, whose syntax is more concise and readable. 
Here again, I'd recommend looking at Velocity's syntax.  Your 
conditional syntax looks like this:

    <when test="user_is_logged_in">
        ....
    <else>
        ....
    </when>

Try reading that out loud: "When test equals user is logged in...".  It 
doesn't sound like what it means.  Web designers will find this confusing.

Now compare the syntax for a conditional in Velocity:

    #if ($user_is_logged_in)
       ...
    #else
       ...
    #end

If you read that out loud, you get: "If user is logged in...".  It 
sounds like what it means.

Cheetah (http://www.cheetahtemplate.org), a Python-based templating 
system, has also adopted this syntax.

You might consider using a camlp4-like approach, to allow your template 
engine to use different syntaxes.

3. I notice that you have some syntax for connecting to a database.  It 
appears to be very MySQL-specific.  Also, your mechanism allows people 
to include SQL in their templates.  This is generally considered to be 
poor design.  Most web application frameworks follow the 
model-view-controller approach, in which templates contain *only* 
presentation logic (e.g. HTML, and any control structures needed for 
controlling the way data is presented).  A template gets data from a 
'model', which is simply a data structure provided by another module or 
program.  That data could come from a relational database, from files, 
from LDAP, or from anywhere else.  The 'controller' is a module which, 
given a request, decides which model and view should be used to handle 
the request.

This allows you to change the way the model is implemented without 
changing the presentation layer (the 'view').  It also means that 
templates are not cluttered with data access syntax (e.g. SQL); this 
makes life easier for web designers.

Most importantly, this approach allows for code reuse.  View components 
can be reused with many different models.  For example, you might create 
a general-purpose tabular HTML view, with typical features such as 
allowing the user to sort on any column by clicking on the column's 
heading.  This view could then be used with models containing data from 
many different sources, including databases.

Similarly, model components can be reused with many different views. 
You might have different versions of your web site for different users, 
e.g. a printable version, or a low-graphics version for disabled users. 
 More generally, a model describing a document could be rendered by an 
HTML view, a LaTeX view, a plain-text view, etc.

Hope this helps,
Benjamin

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
  2003-06-13 11:16 Benjamin Geer
@ 2003-06-13 13:06 ` Jurjen Stellingwerff
  0 siblings, 0 replies; 9+ messages in thread
From: Jurjen Stellingwerff @ 2003-06-13 13:06 UTC (permalink / raw)
  To: caml

On Fri, 2003-06-13 at 13:16, Benjamin Geer wrote:
> 1. A templating system can be useful for generating many things besides 
> HTML.  For example, I've used templating systems to generate email 
> (automated replies), SQL, other sorts of program source code, 
> configuration files, etc.  Therefore, if you want to provide a 
> templating system, I'd recommend making it a general-purpose one, not 
> tied to the HTTP server or to HTML.

I totally agree with this.. I have already wrote code that used
functions to automatically create script-files to convert photo's and
one to ftp a whole bunch of files.

The result of a <function name...> ... </function> can be wrote into a
file for general use. It may contain tags but doesn't have to.

>      #if ($user_is_logged_in)
>         ...
>      #else
>         ...
>      #end
To prevent people complaining about RSI I will write a internal
preprocessor that accepts this style of commands and converts them to my
tag language:
#if <expr>    will then become   <when test="<expr>">

> 3. I notice that you have some syntax for connecting to a database.  It 
> appears to be very MySQL-specific.  Also, your mechanism allows people 
> to include SQL in their templates.  This is generally considered to be 
> poor design.

When there is need I can easily write other database connections (ODBC,
postgress etc). Everything that accepts SQL code could be linked (also
those text-file SQL tools). My own favorite (MySQL) just was the first
one. And I will write others only on request, not out of boredom.

I know there are no inherent abstraction layers in my system but that is
also the charm of it. Everything is there... nothing is hidden away.
Internally this language is really quite simple and it works. I don't
need abstraction myself, and I don't want to compete with bigger
projects... it should just be an easy and fast tool.

> Hope this helps,
> Benjamin

Thank you for the remarks...

Jurjen


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] HTTP-server written in ocaml
@ 2003-06-13 11:16 Benjamin Geer
  2003-06-13 13:06 ` Jurjen Stellingwerff
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Geer @ 2003-06-13 11:16 UTC (permalink / raw)
  To: jurjen; +Cc: caml-list

Jurjen Stellingwerff wrote:
 > More info on: http://camlserv.sf.net

I've worked on several web application frameworks and templating systems 
(in languages other than Caml).  After a brief look at Camlserv, I have 
a few suggestions.

1. A templating system can be useful for generating many things besides 
HTML.  For example, I've used templating systems to generate email 
(automated replies), SQL, other sorts of program source code, 
configuration files, etc.  Therefore, if you want to provide a 
templating system, I'd recommend making it a general-purpose one, not 
tied to the HTTP server or to HTML.

Two examples of such a system (in Java) are Velocity:

     http://jakarta.apache.org/velocity

and FreeMarker (I was the original author):

     http://www.freemarker.org

2. A templating system, when used to generate web pages, should have a 
syntax which web designers will find easy to use.  The XML-like syntax 
you propose is, in my view, rather cumbersome.  Many web designers are 
familiar with JavaScript, whose syntax is more concise and readable. 
Here again, I'd recommend looking at Velocity's syntax.  Your 
conditional syntax looks like this:

     <when test="user_is_logged_in">
         ....
     <else>
         ....
     </when>

Try reading that out loud: "When test equals user is logged in...".  It 
doesn't sound like what it means.  Web designers will find this confusing.

Now compare the syntax for a conditional in Velocity:

     #if ($user_is_logged_in)
        ...
     #else
        ...
     #end

If you read that out loud, you get: "If user is logged in...".  It 
sounds like what it means.

Cheetah (http://www.cheetahtemplate.org), a Python-based templating 
system, has also adopted this syntax.

You might consider using a camlp4-like approach, to allow your template 
engine to use different syntaxes.

3. I notice that you have some syntax for connecting to a database.  It 
appears to be very MySQL-specific.  Also, your mechanism allows people 
to include SQL in their templates.  This is generally considered to be 
poor design.  Most web application frameworks follow the 
model-view-controller approach, in which templates contain *only* 
presentation logic (e.g. HTML, and any control structures needed for 
controlling the way data is presented).  A template gets data from a 
'model', which is simply a data structure provided by another module or 
program.  That data could come from a relational database, from files, 
from LDAP, or from anywhere else.  The 'controller' is a module which, 
given a request, decides which model and view should be used to handle 
the request.

This allows you to change the way the model is implemented without 
changing the presentation layer (the 'view').  It also means that 
templates are not cluttered with data access syntax (e.g. SQL); this 
makes life easier for web designers.

Most importantly, this approach allows for code reuse.  View components 
can be reused with many different models.  For example, you might create 
a general-purpose tabular HTML view, with typical features such as 
allowing the user to sort on any column by clicking on the column's 
heading.  This view could then be used with models containing data from 
many different sources, including databases.

Similarly, model components can be reused with many different views. 
You might have different versions of your web site for different users, 
e.g. a printable version, or a low-graphics version for disabled users. 
  More generally, a model describing a document could be rendered by an 
HTML view, a LaTeX view, a plain-text view, etc.

Hope this helps,
Benjamin



________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-06-13 13:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-11 10:02 [Caml-list] HTTP-server written in ocaml Jurjen Stellingwerff
2003-06-11 15:07 ` Ken Rose
2003-06-11 16:02   ` Jurjen Stellingwerff
2003-06-11 16:07   ` Jurjen Stellingwerff
2003-06-11 16:54   ` Owen Gunden
2003-06-11 18:28     ` Ken Rose
2003-06-13 11:16 Benjamin Geer
2003-06-13 13:06 ` Jurjen Stellingwerff
2003-06-13 13:45 Benjamin Geer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).