For my demexp server, I'm considering the development of a web
interface, accessible from a simple web browser. I have standard
requirements (html forms) as well as "advanced" ones (would like to
support AJAX-like things, navigation in tree data structures, etc.).
Which development frameworks are available to do such things in OCaml?
I'm looking for frameworks under a license compatible with GNU GPL.
Right now, I know about:
- WDialog
- XCaml
For low level stuff (basic CGI interface), there is also OCamlNet.
I've made some experiments with WDialog but I'm not entirely convinced
by its approach of separating interface description from event
handling code. Moreover it lacks some features that would be useful
for us : i18n support (even if, thanks to Gerd, a preliminary code is
available in CVS tree), advanced widgets (tree structures), AJAX
support, etc.
What other people are using to do web stuff? Is everybody using PHP? ;-)
Any recommandation on building such complex web interface with
available OCaml software?
Best regards,
david
PS : My current demexp server is an autonomous Unix daemon, written in
OCaml, accessible through ONC RPC calls over a TCP socket. Until know,
I have made a simple CGI that access the demexp server. But I'm
considering merging the server part with the web part. Has somebody
some knowledge on the design of web architecture and recommendation or
pointer to relevant litterature?
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
2006/6/25, Till Varoquaux <till.va...@gmail.com>:
> There is an ongoing project (which I'm part of) to make a web
> framework for cduce. You can check it out here:
> http://reglisse.ens.fr/ecduce/
> We (me for the ecduce part, the cduce team for cduce) would be more
> than happy to help you out.
Thank you for the pointer, even if, right now, I have some issue to
understand how an XML toolkit could help me design a dynamic web site.
BTW, the ECDuce pages lack a little description on the aim of the project.
> P.S. IMHO, although Cduce is a little rough around the edges, going
> back to php afterwards is about as painfull as moving back from Caml
> to C...
I'm already using CDuce to read/write XML files in my server. So I'm
suppose to already know it. ;-)
> P.P.S as for the ajax and toolkit abstraction you might want to have a
> look at openlaszlo http://www.openlaszlo.org/. An integration with an
> xml oriented should be quite easy to do...
Well... I've looked at OpenLazlo and I'm quite skeptical on such a
framework. Non-withstanding that OpenLazlo is aimed at Flash
environment and that DHTML support is apparently still under
development, I'm not really fond of technology targetting only
Javascript-only web browser. I would like to develop my web site for
both new and old browsers. Moreover, OpenLazlo servers are in Java,
and using XML has a programming language seems a bit silly to me.
Regarding my own (quite foggy) requirements, I would like to develop a
web site using a efficient language that I like (OCaml), but without
re-inventing the wheel, thus my search for an OCaml friendly web
framework. Until now, I've found technologies for developing such a
framework, but no real read-to-use framework (except maybe WDialog
which lacks support beyond basic HTML) like those[1] that can be found
for other languages (Java, PHP and Python).
Best wishes,
david
[1] http://en.wikipedia.org/wiki/List_of_web_application_frameworks
http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks
Till
P.S. IMHO, although Cduce is a little rough around the edges, going
back to php afterwards is about as painfull as moving back from Caml
to C...
P.P.S as for the ajax and toolkit abstraction you might want to have a
look at openlaszlo http://www.openlaszlo.org/. An integration with an
xml oriented should be quite easy to do...
_______________________________________________
David MENTRE wrote:
> For my demexp server, I'm considering the development of a web
> interface, accessible from a simple web browser. I have standard
> requirements (html forms) as well as "advanced" ones (would like to
> support AJAX-like things, navigation in tree data structures, etc.).
> Which development frameworks are available to do such things in OCaml?
> I'm looking for frameworks under a license compatible with GNU GPL.
>
> Right now, I know about:
> - WDialog
> - XCaml
There is also Ocsigen ( http://www.ocsigen.org/ ) which is a nice
extension of OCaml (i.e. modules + camlp4) to develop websites in a
functional style.
Cheers,
Samuel.
Another attempt of self promotion: Ex Nunc
(http://ex-nunc.sourceforge.net) is an application framework written
in pure OCaml that provides strongly-typed page parameters, automatic
session and form validation. Although a live demo is available here:
http://ex-nunc.sourceforge.net/cgi-bin/ex-nunc/demo.cgi
the framework is still young and not usable for commercial purposes
and the templates page compiler is still under construction. In any
case our plan is to complete the core project features and to arrive
to a usable release of Ex Nunc in November 2006. Our first goal is to
obtain a "better PHP", usable in everyday jobs; in the future
interesting features like strongly typed embedded SQL and a better
application server engine (based on the equeue library) are planned.
Since an official announcement is probably a bit premature in this
moment, if you have any question about Ex Nunc or, better, if you want
to join the development team or to subscribe the "free human beings
from PHP slavery" club, contact me.
Best regards,
Paolo Donadeo
--
Paolo Donadeo, Senior Software Engineer
Studio Associato 4Sigma
Email: p.do...@gmail.com
~
~
:wq
2006/6/29, Paolo Donadeo <p.do...@gmail.com>:
> Ex Nunc
> (http://ex-nunc.sourceforge.net) is an application framework written
> in pure OCaml that provides strongly-typed page parameters, automatic
> session and form validation. Although a live demo is available here:
Quite interesting.
> the framework is still young and not usable for commercial purposes
> and the templates page compiler is still under construction.
I always fear "templates page compiler", because most of the time
people tend to re-invent their own language rather than using existing
one, like OCaml. Is OCaml used as template language for Ex-nunc?
Could you show us the source code of the demo page?
> in the future
> interesting features like strongly typed embedded SQL and a better
Do you plan to use existing code on SQL frameworks?
> application server engine (based on the equeue library) are planned.
> moment, if you have any question about Ex Nunc or, better, if you want
> to join the development team or to subscribe the "free human beings
> from PHP slavery" club, contact me.
I don't want to join the development team but I'm certainly interested
to see if Ex-nunc fits my needs.
Best wishes,
david
I think you get it here:
http://ex-nunc.cvs.sourceforge.net/ex-nunc/ex-nunc/application_server/demo/
:)
p
--
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
> There is also Ocsigen ( http://www.ocsigen.org/ ) which is a nice
> extension of OCaml (i.e. modules + camlp4) to develop websites in a
> functional style.
I have been asked for more information about Ocsigen. Ocsigen is a research
project aiming at finding a more robust way to program Web sites, using
functional programming (continuations) and strong typing. It is not a new
language but a set of modules for Objective Caml and a web server.
Main features:
- Valid xhtml generation through static typing
- Typing of Web interaction (links, forms...)
- Automatic session handling
- Javascript generation (AJAX) (work in progress)
- typed database interaction (work in progress)
It allows to program web sites in a very concise and modular way, and makes
the maintenance of large web sites much easier compared to usual Web
programming tools.
Ocsigen was born in 2004 (even though the idea is older) and is now usable
(see for example www.ocsigen.org). The syntax is not completely fixed yet (as
we are experimenting with a lot of new ideas) but the development is very
active and we hope to publish version 1 before the end of the year.
Vincent Balat
PS: For other research projects in the same style, see for example WebSiCoLa,
Links, Hop, or Wash/CGI
2006/6/30, Pietro Abate <Pietro...@anu.edu.au>:
> I think you get it here:
> http://ex-nunc.cvs.sourceforge.net/ex-nunc/ex-nunc/application_server/demo/
Thank you for the pointer. It seems close to WDialog with the
additional benefit that (i) embedded language is OCaml and (ii) the
format of .xnunc files (templates?) are XHTML + <xnc> tags.
This raises additional questions:
- is i18n handled, on a per page or per context basis (one user uses
French pages while another one English ones)?
- is generated CGI compiled to native code?
Best wishes,
d.
2006/6/30, Vincent Balat <Vincen...@pps.jussieu.fr>:
> It is not a new
> language but a set of modules for Objective Caml and a web server.
Is there a specific reason to use a dedicated web server instead of a
standard one and standard interface (CGI, FastCGI, JServ, ...)?
Best wishes,
d.
We use our own web server to get more freedom than using Apache, and we are
happy with it. We may plan to make an implementation based on fastcgi or an
Apache module because a lot of users are asking this (mainly because they
trust Apache) but I am not convinced that it has a lot of advantages ... It
may not be difficult to do. Basically, an Apache module for Ocsigen would
just say : "for all request inside this directory, delegate the page
generation to Ocsigen".
Note that you can run Apache and Ocsigen on the same server using the "reve
rse
proxy" feature of Apache.
Wishes
Vincent
2006/6/30, Vincent Balat <Vincen...@pps.jussieu.fr>:
> I don't thing we can implement Ocsigen with CGI because our model is not "page
> based" (with Ocsigen, you program web site as a whole, like a usual caml
> program, you do not have a file for each URL).
Ok, thank you for the information. BTW, the font for code example on
the Tutorial page is very small, so small that it is hardly readable
(with Firefox 1.5 on Windows).
> We use our own web server to get more freedom than using Apache, and we are
> happy with it. We may plan to make an implementation based on fastcgi or an
> Apache module because a lot of users are asking this (mainly because they
> trust Apache)
Or because they want to use another web server (lighttpd) or beacuse
they want to integrate Ocsigen web site with another web site or
framework. People rarely start a web site from scratch.
> but I am not convinced that it has a lot of advantages ...
Apache is a very complex piece of software but with a lot of
capabilities, peer review and security updates. DIY-web-server just
can't match.
For me, being tied to your web server (or even Apache) is a very
strong disadvantage.
Why not use OCamlNet
(https://gps.dynxs.de/wwwsvn/trunk/code/?root=lib-ocamlnet2) as the
connectors on top of which you build your lib ? That would give you
the possibility to use CGI, FastCGI, AJP, SCGI, or an apache module
for free ! That will also help the community as the more people use
these connectors, the better and the more stable they will become.
My 0.02€,
ChriS
> I don't thing we can implement Ocsigen with CGI because our model is not "page
> based" (with Ocsigen, you program web site as a whole, like a usual caml
> program, you do not have a file for each URL). It may be possible with
> FastCGI (?).
I've written a small C program which "runs" a small script containing
instructions which environment variables to forward to a domain name
socket, using a very simple protocol. In my case, the reason was
reduced startup time (the application isn't written in Ocaml) and
clean separation of web server process and application (different UNIX
users). FastCGI could have done the same, I guess, but its license is
a bit obnoxious and I found it very hard to configure correctly when I
used it a couple of years ago. The downside with my approach is that
you need to take care of starting the service by some other means.
This small C program hasn't been published so far because I hope that
someone else has already published something similar. 8-/
> I always fear "templates page compiler", because most of the time
> people tend to re-invent their own language rather than using existing
> one, like OCaml. Is OCaml used as template language for Ex-nunc?
Please, trust me: I'm too lazy to reinvent anything :-)
Seriously, the template language is not intended to be a Touring
complete programming language, OCaml is enough for programming.
Instead, the markup in the "xnc" name space is used to encapsulate
some common issues in web programming, particularly the page parameter
mechanism. The markup will be expanded by the compiler in OCaml code
that does nothing but call pieces of the Ex Nunc framework.
I'm writing the page compiler to be as simple as possible, and to
demand as much as possible to the OCaml compiler: this ensures
robustness and minimizes bugs introduced by me in the tool chain.
> Do you plan to use existing code on SQL frameworks?
Well, I'm looking around and any suggestions are welcome. I'd like to
use something like PG'OCaml, by Richard Jones, but in this very moment
I can't tell how hard it will be to integrate that library into my
framework.
In general I try to use well known, supported and actively maintained
libraries, without patching anything. In this moment Ex Nunc can be
successfully built in a Debian stable box.
Best regards,
Paolo
--
Paolo Donadeo, Senior Software Engineer
Studio Associato 4Sigma
Email: p.do...@gmail.com
~
~
:wq
_______________________________________________
> I think you get it here:
> http://ex-nunc.cvs.sourceforge.net/ex-nunc/ex-nunc/application_server/demo/
No, that code is old, look at this instead:
http://ex-nunc.cvs.sourceforge.net/ex-nunc/ex-nunc/examples/demo/
In this directory you can find both the templates and the "compiled"
code. The .ml files have been written by hand by Alessandro Strada,
the other Ex Nunc developer. Ideally the compiler I'm writing will
take the .xnunc files as input and will produce the .ml files.
In any case, even if the demo directory is only "virtually" compiled,
you can actually run make to produce a working executable.
--
Paolo Donadeo, Senior Software Engineer
Studio Associato 4Sigma
Email: p.do...@gmail.com
~
~
:wq
_______________________________________________
> - is i18n handled, on a per page or per context basis (one user uses
> French pages while another one English ones)?
In this moment Ex Nunc doesn't support i18n, we are still in an early
stage. Obviously it's an important feature and it's in our TODO list.
> - is generated CGI compiled to native code?
You can compile the very same project with CGI or FastCGI support, in
bytecode or native code. We plan to support JServ too, since ocamlnet
supports it, but it's not a priority now.
--
Paolo Donadeo, Senior Software Engineer
Studio Associato 4Sigma
Email: p.do...@gmail.com
~
~
:wq
_______________________________________________
Christophe TROESTLER <Christophe...@umh.ac.be> writes:
> Why not use OCamlNet
> (https://gps.dynxs.de/wwwsvn/trunk/code/?root=lib-ocamlnet2) as the
> connectors on top of which you build your lib ?
OCamlNet is on my list, but before re-inventing a wheel, I wanted to
know about existing framework. It's always better to re-use exisitng
code.
Best wishes,
d.
--
GPG/PGP key: A3AD7A2A David MENTRE <dme...@linux-france.org>
5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A
In any case, if you depend only on the cgi services, OCamlNet allows
easy replacement of a connector by another. If you have some time,
I'll be happy that you try the "improved" interface available at
https://gps.dynxs.de/wwwsvn/trunk/code/src/netcgi/?root=lib-ocamlnet2
http://ocaml-cgi.sourceforge.net/netcgi/doc/
Cheers,
ChriS
I was more targetting the framework writers with that remark. IMHO it
would be nice that all frameworks use the same code to connect to a
web server. It allows that code to be much tested hence robust (which
is good for all projects relying on it) and improvements to OCamlNet
are readily available to all frameworks (e.g. concurrent connectors).
OcamlNet is already fairly complete, it even possesses a web server.
Cheers,
ChriS
It's reasonable to front a custom webserver like this with an instance
of Apache (using mod_proxy). That's basically the same architecture
as FastCGI, except you're using HTTP as the protocol between Apache
and custom webserver.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
_______________________________________________
Can you pass the ML code through the PG'OCaml camlp4 preprocessor?
That's all that is required.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
_______________________________________________
> In any case, if you depend only on the cgi services, OCamlNet allows
> easy replacement of a connector by another. If you have some time,
Thanks for the link.
> If you have some time
Time? :-)
Paolo
--
Paolo Donadeo, Senior Software Engineer
Studio Associato 4Sigma
Email: p.do...@gmail.com
~
~
:wq
_______________________________________________
> Can you pass the ML code through the PG'OCaml camlp4 preprocessor?
> That's all that is required.
Yes, I can, but the data base support of Ex Nunc will present at least
this two additional issues:
1) even if I consider MySQL a very poor DB, it's one of the most used
DBMS, so we can't simply ignore MySQL in the design;
2) I ignore how PG'OCaml works internally, but I suppose that the
connection with PostgreSQL is implemented in a synchronous way. This
can be OK for a first implementation, but since we want to use a
reactor, provided by Gerd Stolpmann's equeue, in the final application
server design DB connection will be handled asynchronously inside the
reactor. IMHO this issue is very important and more crucial than MySQL
compatibility.
Regards,
--
Paolo
Paolo Donadeo, Senior Software Engineer
Studio Associato 4Sigma
Email: p.do...@gmail.com
~
~
:wq
_______________________________________________
Interesting point. As far as I know, there is no db connector that can
be used in an asynchronous way. For a (commercial) software I am working
on the solution was to route all db requests over an additional rpc
daemon. This is a bit of work, but you get an absolutely non-blocking
component, and the additional cpu time spent for the extra network
connection is negligible.
Unfortunately, we still do not have a good database-independent
connector technology in O'Caml. In ocamldbi, important features are
missing that are needed for larger applications, e.g. access to error
codes. If we had such a technology, we could build a generic solution
for the "asynchronous problem".
Gerd
--
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
ge...@gerd-stolpmann.de http://www.gerd-stolpmann.de
Phone: +49-6151-153855 Fax: +49-6151-997714
Currently in Montain View, California, till July, 21.
------------------------------------------------------------
Does MySQL provide a 'DESCRIBE' command with strongly typed parameters
and results? That's the PostgreSQL feature which make PG'OCaml
fundamentally possible. Personally I despise MySQL after having lost
data through its poor design, but I take your point about popularity.
> 2) I ignore how PG'OCaml works internally, but I suppose that the
> connection with PostgreSQL is implemented in a synchronous way. This
> can be OK for a first implementation, but since we want to use a
> reactor, provided by Gerd Stolpmann's equeue, in the final application
> server design DB connection will be handled asynchronously inside the
> reactor. IMHO this issue is very important and more crucial than MySQL
> compatibility.
The PG'OCaml library is pure OCaml. It's very naively implemented -
it just opens a socket to the database and sends and receives commands
using the in/out_channel operators like output_string and input_-
binary_int. So it's totally synchronous, but could, with a bit of
effort, be written asynchronously. I generally prefer what Skaller
calls "control inversion" - where you write in a synchronous style but
using a bit of magic pixie dust the compiler turns it into
event-driven code. (For an example of this done in C, see
http://www.annexia.org/freeware/pthrlib).
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
_______________________________________________
I'm sure you know this but just for the sake of readers, ocamldbi and
PG'OCaml are completely separate and unrelated libraries.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
_______________________________________________
> Interesting point. As far as I know, there is no db connector that can
> be used in an asynchronous way.
Don't need it. Just use Felix programming language.
> Unfortunately, we still do not have a good database-independent
> connector technology in O'Caml. In ocamldbi, important features are
> missing that are needed for larger applications, e.g. access to error
> codes. If we had such a technology, we could build a generic solution
> for the "asynchronous problem".
The framework is already in place in Felix. We're only
handling sockets etc asynchronously at the moment but
there's no reason you couldn't add DB support.
The technology is built on top of C++ at the moment for
legacy code interoperability but the design should work
with an Ocaml target .. probably even more easily (since
it already has half the required technology such as closures).
The main negative is that at present Ocaml cannot
effectively multi-proccess threads, whereas C/C++ can.
However the performance impact isn't clear and I doubt
this is a problem unless you have 4+ core system.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
> The PG'OCaml library is pure OCaml. It's very naively implemented -
> it just opens a socket to the database and sends and receives commands
> using the in/out_channel operators like output_string and input_-
> binary_int. So it's totally synchronous, but could, with a bit of
> effort, be written asynchronously. I generally prefer what Skaller
> calls "control inversion" - where you write in a synchronous style but
> using a bit of magic pixie dust the compiler turns it into
> event-driven code. (For an example of this done in C, see
> http://www.annexia.org/freeware/pthrlib).
You can probably use Ocaml's Event library to control invert:
the main problem is it uses pthreads as the underlying
inversion technology, and therefore relies on the
underlying OS to context switch pthreads cheaply.
Using pthreads is a good option for a first approximation
proof-of-principle design of the client application -- the
main problem is most system don't provide any other seamless
'plugin' replacement for the pthread inversion technique,
so you have to write your own.
For database this should be relatively easy because
basically you're just inverting on sockets, and most OS
do provide asynchronous socket I/O (epoll, kqueue etc).
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
_______________________________________________