From: Pascal Costanza
Subject: Web application
Date: 
Message-ID: <5unebdF1ivs7fU1@mid.individual.net>
Hi,

I'd like to write a web application in Common Lisp that showcases some 
features of ContextL. I have already experimented a bit with 
Hunchentoot, and have been successful so far.

However, what I need is a way to trigger updates of a web page from the 
server side, so that it can reflect state changes. I guess I need 
something like Ajax for that, or so.

Can somebody recommend what libraries are good for that, and share some 
experiences wrt things to watch out for? Also comments on what to avoid 
would be useful.

Hunchentoot is not a strict requirement. (I'd prefer not to use 
something based on continuations, but I can if I must... ;)


Thanks a lot in advance,
Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/

From: vanekl
Subject: Re: Web application
Date: 
Message-ID: <4c73e462-7686-4356-93cf-91c26f9eebb2@m34g2000hsf.googlegroups.com>
I'd start here,
http://cometdaily.com/2007/12/11/the-future-of-comet-part-1-comet-today/
--
VEGETARIAN:  An Indian word meaning "lousy hunter"
From: Sohail Somani
Subject: Re: Web application
Date: 
Message-ID: <Sizhj.1851$yQ1.1630@edtnps89>
On Thu, 10 Jan 2008 16:17:11 -0800, vanekl wrote:

> I'd start here,
> http://cometdaily.com/2007/12/11/the-future-of-comet-part-1-comet-today/

Comet is nice and buzzy and stuff, but straight XMLHttpRequest or the 
Dojo toolkit is enough for a demo. 

Servers that speak the Comet protocols don't seem to exist in the Lisp 
world anyway.

-- 
Sohail Somani
http://uint32t.blogspot.com
From: K Livingston
Subject: Re: Web application
Date: 
Message-ID: <7db5c9d9-a202-4e95-9b58-718669169666@q39g2000hsf.googlegroups.com>
On Jan 10, 2:43 pm, Pascal Costanza <····@p-cos.net> wrote:
> However, what I need is a way to trigger updates of a web page from the
> server side, so that it can reflect state changes. I guess I need
> something like Ajax for that, or so.
>
> Can somebody recommend what libraries are good for that, and share some
> experiences wrt things to watch out for? Also comments on what to avoid
> would be useful.

With anything AJAX a library (for the client) is pretty much a must
(unless you like fiddling with little pieces of minutia in
javascript), because there's a fair amount of boilerplate needed for
just one request, and for added fun, the boilerplate changes slightly
from browser to browser.

There are several good ones out there, but right now I am really happy
with <a href="http://jquery.com/">jQuery</a>.  jQuery makes
javascripting so much easier, and the plug-in model for functionality
is very nice.  jQuery does Ajax out of the box, and can support most
of what you need, and can get as simple as this:

<a href="http://docs.jquery.com/Ajax/load#urldatacallback">Ajax/load</
a> the example there shows one line of code which will find the DOM
element with the ID "links", make an Ajax request to get new content
from the server, and put it in that DOM element.

Any good library should give you something close, but this seems to me
to be the simplest and also a well supported way to go.

I've even tried rolling my own Ajax code, a while ago, before I knew
about jQuery.  And jQuery has all the features I thought I wanted,
simpler, and tons of support testing across browsers etc.


That may or may not have been a tangent, because the question was also
about lisp libraries for supporting this kind of thing.  I don't have
any experience with lisp libraries for writing javascript or
simplifying the Ajax.  For the kind of Ajax I do, I don't really see
the need.  I use Allegroserve to produce my pages, and write the (what
little) javascript I need right into them.  Although, I am finding the
escaping of quotes and things, along with formatting to be a bit of a
pain, so I might (very soon) start exploring some alternatives, like
ParenScript.  Or just make a reader macro to escape all my quotes for
me -- although that won't help with the formatting in emacs.
From: Robert Uhl
Subject: Re: Web application
Date: 
Message-ID: <m38x2wnvsf.fsf@latakia.dyndns.org>
K Livingston <······················@gmail.com> writes:
>
> That may or may not have been a tangent, because the question was also
> about lisp libraries for supporting this kind of thing.  I don't have
> any experience with lisp libraries for writing javascript or
> simplifying the Ajax.  For the kind of Ajax I do, I don't really see
> the need.  I use Allegroserve to produce my pages, and write the (what
> little) javascript I need right into them.  Although, I am finding the
> escaping of quotes and things, along with formatting to be a bit of a
> pain, so I might (very soon) start exploring some alternatives, like
> ParenScript.  Or just make a reader macro to escape all my quotes for
> me -- although that won't help with the formatting in emacs.

As a first step, consider moving the JavaScript into its own files.
It's faster to load, and you can use javascript-mode to edit them, _and_
you don't have to worry about funky quoting.

-- 
Robert Uhl <http://public.xdi.org/=ruhl>
The Earth is degenerating these days.  Bribery and corruption abound.
Children no longer mind their parents, every man wants to write a book,
and it is evident that the end of the world is fast approaching.
                           --Assyrian stone tablet, c. 2800 B.C.
From: K Livingston
Subject: Re: Web application
Date: 
Message-ID: <bef2e0aa-fce1-47cd-940b-df3b98b63e69@v4g2000hsf.googlegroups.com>
On Jan 11, 10:58 am, Robert Uhl <·········@NOSPAMgmail.com> wrote:
> As a first step, consider moving the JavaScript into its own files.
> It's faster to load, and you can use javascript-mode to edit them, _and_
> you don't have to worry about funky quoting.

That would be great to have javascript mode or the equivalent
available.  Although, using other files for dynamically generated
content can be tricky or sometimes not possible.  For example if I
have to attach jQuery behavior to a dynamically ID'ed DOM node, then
I'll probably need to also dynamically generate the javascript to do
that.  (unless it's part of some class that I can otherwise identify
with a more general selector)  But yes the bulk of my java script
lives in it's own files.


back to the OP and your comments above this, I agree completely.
There's really no push for HTTP.  It's all polling.  (you could build
something like a java applet to stay in constant/immediate contact
with your server, but that's not worth the pain and support if you
don't care about a second or two of latency in you app using Ajax
polling (which is asynchronous anyway, so depending on what it is,
users will never even know))

I was also thinking about the HTTP redirect/refresh headers like you
suggested for people without a current bowser.  I used to do that a
lot.  It worked nicely before the world of the asynchronous javascript
request (AJAX).  I'm not sure exactly what Pascal's application is,
but it sounds like it's for developers or other technically savvy
people, right?  I think it's safe to assume they are using at least IE
6 or a version or two back of Mozilla, in which case you are fine
going the Ajax only route.  (I guess it's not that hard to do both,
and have the javascript knock out the HTTP refresh-headers, if you
have Ajax available, but really, I don't think it's even worth that
effort.)

In which case it can get as simple as a two liner on your HTML, with
jQuery, or looks like the Prototype library mentioned makes it pretty
simple, Google has their GWT, etc.  A line or two to register the Ajax
check every NN seconds, and one to actually do it and swap the results
into your DOM.

On the server side, you have a dynamic page (which is what the ajax
call from the client is requesting) that looks if the sate changed, if
no, it tells the client nothing (or maybe a suggestion of when to
check back in later), or just gives it all the content it already has
(a little heavy handed if it's a lot of content, simple if it's not).
If there is a change, then the server generates the web content same
as you do any other page and sends it.  Maybe there are libraries that
facilitate that, but for me it's just another dynamic web page, your
existing web server library of choice will do that just fine.  There's
really nothing you need server side to do "Ajax", if you can already
generate dynamic web pages.
From: Slobodan Blazeski
Subject: Re: Web application
Date: 
Message-ID: <6bfb0466-ab88-4dc8-a247-05963e4cfe87@k2g2000hse.googlegroups.com>
On Jan 10, 9:43 pm, Pascal Costanza <····@p-cos.net> wrote:
> Hi,
>
> I'd like to write a web application in Common Lisp that showcases some
> features of ContextL. I have already experimented a bit with
> Hunchentoot, and have been successful so far.
>
> However, what I need is a way to trigger updates of a web page from the
> server side, so that it can reflect state changes. I guess I need
> something like Ajax for that, or so.
>
> Can somebody recommend what libraries are good for that, and share some
> experiences wrt things to watch out for? Also comments on what to avoid
> would be useful.
>
> Hunchentoot is not a strict requirement. (I'd prefer not to use
> something based on continuations, but I can if I must... ;)
>
> Thanks a lot in advance,
> Pascal
>
> --
> 1st European Lisp Symposium (ELS'08)http://prog.vub.ac.be/~pcostanza/els08/
>
> My website:http://p-cos.net
> Common Lisp Document Repository:http://cdr.eurolisp.org
> Closer to MOP & ContextL:http://common-lisp.net/project/closer/

Considering my answer contains  lisp code that googlegroups doesn't
handle very well I put it on lisp paste http://paste.lisp.org/display/53998

cheers
Slobodan
From: Dimitre Liotev
Subject: Re: Web application
Date: 
Message-ID: <lYedndmZsf5OPhvanZ2dnUVZ_o6knZ2d@giganews.com>
Pascal Costanza <··@p-cos.net> writes:

> Hi,
>
> I'd like to write a web application in Common Lisp that showcases some
> features of ContextL. I have already experimented a bit with
> Hunchentoot, and have been successful so far.
>
> However, what I need is a way to trigger updates of a web page from the
> server side, so that it can reflect state changes. I guess I need
> something like Ajax for that, or so.

To do this you will have to make periodically calls from the browser to
the server. You can do this by using the XMLHttpRequest object in
JavaScript:

http://www.w3schools.com/dom/dom_http.asp

-- 
Dimitre Liotev
(format t "~{~a~}" (reverse '("et" "n" "in." "a" "zn" ·@" "l" "d")))
From: Sohail Somani
Subject: Re: Web application
Date: 
Message-ID: <szvhj.1809$yQ1.1336@edtnps89>
On Thu, 10 Jan 2008 21:43:25 +0100, Pascal Costanza wrote:

> However, what I need is a way to trigger updates of a web page from the
> server side, so that it can reflect state changes. I guess I need
> something like Ajax for that, or so.

I think the buzzword you seek is Comet. However, the easiest way is to 
use polling via Ajax which likely has more support in Lisp given it's 
relative maturity. If you use Parenscript, a sane Ajax library (in JS), 
and cl-who then the world is your oyster. This way, you write everything 
in CL which likely makes you happier than not.

Perhaps not the answer you are looking for, but hope it helps. I don't 
think you necessarily need anything with continuations.

-- 
Sohail Somani
http://uint32t.blogspot.com
From: Robert Uhl
Subject: Re: Web application
Date: 
Message-ID: <m3d4s8nvx7.fsf@latakia.dyndns.org>
Sohail Somani <······@taggedtype.net> writes:
>
> I think the buzzword you seek is Comet.

Hmmm...I wasn't aware of Comet.  Interesting technique.

-- 
Robert Uhl <http://public.xdi.org/=ruhl>
			 Death Before Dishonour
			   Beer Before Lunch
From: Pascal Costanza
Subject: Re: Web application
Date: 
Message-ID: <5up3ngF1iuh6oU1@mid.individual.net>
Sohail Somani wrote:
> On Thu, 10 Jan 2008 21:43:25 +0100, Pascal Costanza wrote:
> 
>> However, what I need is a way to trigger updates of a web page from the
>> server side, so that it can reflect state changes. I guess I need
>> something like Ajax for that, or so.
> 
> I think the buzzword you seek is Comet. However, the easiest way is to 
> use polling via Ajax which likely has more support in Lisp given it's 
> relative maturity. If you use Parenscript, a sane Ajax library (in JS), 
> and cl-who then the world is your oyster. This way, you write everything 
> in CL which likely makes you happier than not.

Hm, but that means that I could also use something like UCW or weblocks, 
and "just" have the web page periodically ask for the new state. It 
seems to me that the actions in weblocks would help here a lot. Am I on 
the right track here?

Thanks for all the feedback in the various responses.


Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Slobodan Blazeski
Subject: Re: Web application
Date: 
Message-ID: <c02854b5-4bc4-478c-ad55-a2191d9aa2a9@e25g2000prg.googlegroups.com>
On Jan 11, 12:54 pm, Pascal Costanza <····@p-cos.net> wrote:
> Sohail Somani wrote:
> > On Thu, 10 Jan 2008 21:43:25 +0100, Pascal Costanza wrote:
>
> >> However, what I need is a way to trigger updates of a web page from the
> >> server side, so that it can reflect state changes. I guess I need
> >> something like Ajax for that, or so.
>
> > I think the buzzword you seek is Comet. However, the easiest way is to
> > use polling via Ajax which likely has more support in Lisp given it's
> > relative maturity. If you use Parenscript, a sane Ajax library (in JS),
> > and cl-who then the world is your oyster. This way, you write everything
> > in CL which likely makes you happier than not.
>
> Hm, but that means that I could also use something like UCW or weblocks,
> and "just" have the web page periodically ask for the new state. It
> seems to me that the actions in weblocks would help here a lot. Am I on
> the right track here?
That could be done relatively easy via adding new widget to weblocks,
with some premade javascipt library as dependancy and let weblocks do
it's magic, your job is to write a common lisp code.
I hope you had a chance to see my examples in lisp.paste (server is
currently down) if you don't check it's google cache
http://216.239.59.104/search?q=cache:gt5_Zfr91PQJ:paste.lisp.org/display/53998+http://paste.lisp.org/display/53998&hl=en&strip=1
or below.

cheers
Slobodan

Mu lisp paste post, currently unaccessible :
I would rather use a weblocks widgets instead of going for low level
hacking of web applications.
Here's few ideas for demonstrating ContextL capabilities that would be
trivially implemented.
Weblocks has a dataform widget, it's job it's to render the slots of a
class specified as data, it works roughly as this : |#
(defclass address ()
  ((id)
   (street :reader street
           :initarg :street)
   (city :initarg :city)
   (state :reader state
          :type (or us-state null)
          :initarg :state)))

(make-instance 'dataform :data (make-instance 'address)) #|
An idea for web application using ContextL would go like this:
Sopose we plan to make an employment agency application so every
candidate will enter it's data by hmself: |#
(define-layered-class candidate ()
  ((name :initarg :name
         :accessor person-name
         :type 'string)
   (experience :initarg :experience
        :accessor experience)
        :type (or null integer))
   (state :initarg :state
          :accessor state
          :type (or us-state null))
   (recommendations :initarg :recommendations
          :accessor recommendations
          :type 'boolean)))
#|
But beside those atributes, every candidate will be given exam which
result will be entered by agency employees.  |#
(define-layered-class candidate
  :in-layer agency-layer ()
  ((exam :initarg :exam
    :layered-accessor exam)
    :type  (member :excellent :good :failed)))
#|
Now we only need to enable agency-layer  whenever our employee is
logged in.
Also weblocks widgets are classes, so you can you can specialise their
methods with ContextL via define-layered-method. For example you could
specify new widget that inherits from some of the prefabricated
weblocks widgets with (defwidget layered-dataform (dataform) ... and
than specify it's rendering or any other methods via define-layered-
method.
For example you can define different, render-widget-body in different
layers like: |#
(define-layered-method render-widget-body ;standard behaviour
  :in-layer agency-layer ((object layered-dataform))
  (apply #'render-dataform obj (dataform-data obj) args))

(define-layered-method render-widget-body
  ;preview of available candidates without their names
  :in-layer preview-layer ((object layered-dataform))
  (apply #'render-dataform obj (remove-name-slot (dataform-data obj))
args))
#|
etc. You could do a lot without low level hacking.

cheers
Slobodan |#
>
> Thanks for all the feedback in the various responses.
>
> Pascal
>
> --
> 1st European Lisp Symposium (ELS'08)http://prog.vub.ac.be/~pcostanza/els08/
>
> My website:http://p-cos.net
> Common Lisp Document Repository:http://cdr.eurolisp.org
> Closer to MOP & ContextL:http://common-lisp.net/project/closer/
From: ddd
Subject: Re: Web application
Date: 
Message-ID: <slrnfoetot.2m9.ddd@localhost.localdomain>
>> On Thu, 10 Jan 2008 21:43:25 +0100, Pascal Costanza wrote:
>> 
>>> However, what I need is a way to trigger updates of a web page from the
>>> server side, so that it can reflect state changes. I guess I need
>>> something like Ajax for that, or so.
>> 

If I remember alright, the web framework by M. Battyani allows this
through a hidden iframe update (uses apache).

If you go the javascript route, be careful about replay bugs (or
attacks) on your server.  By using javascript you give the
responibility for update to the client.  This may not be what you want.
From: Sohail Somani
Subject: Re: Web application
Date: 
Message-ID: <EYMhj.26863$fj2.11452@edtnps82>
On Fri, 11 Jan 2008 12:54:24 +0100, Pascal Costanza wrote:

> Hm, but that means that I could also use something like UCW or weblocks,
> and "just" have the web page periodically ask for the new state. It
> seems to me that the actions in weblocks would help here a lot. Am I on
> the right track here?
> 
> Thanks for all the feedback in the various responses.

I don't think Weblocks actions would help you in this case besides to 
make the code neat. You would still be responsible for polling via Ajax 
in whatever widget you write. You can always try a post to the Weblocks 
Google group http://groups.google.com/group/weblocks.

Anyway, do you really need the server to push changes to the browser?

-- 
Sohail Somani
http://uint32t.blogspot.com
From: Slava Akhmechet
Subject: Re: Web application
Date: 
Message-ID: <8763y0awts.fsf@gmail.com>
Pascal Costanza <··@p-cos.net> writes:

> Hm, but that means that I could also use something like UCW or
> weblocks, and "just" have the web page periodically ask for the new
> state. It seems to me that the actions in weblocks would help here a
> lot. Am I on the right track here?
The way Weblocks generally operates is that an AJAX request from the
client (usually triggerred by a user action) invokes a function on the
server that changes the state of some widget. I specialize (setf
slot-value) on widgets so that when the state is changed the widget is
automagically marked as dirty (you can of course mark widgets as dirty
manually, or turn the default behavior off). Once the action is over,
dirty widgets are rendered and sent back to the client. The client-side
bit of Weblocks written in JS grabs the updated widgets and updates
appropriate spots of the page. All of this is done by the framework, so
you don't have to touch any of this code.

It seems that to do what you want in Weblocks would require writing a
small JS function that periodically invokes an empty action via AJAX. If
anything has changed on the server, it will automatically propagate to
the client. If you decide to go for a polling model, this would be very
simple to do in Weblocks.

If you decide to go with a push model, I don't think Weblocks can
help. I didn't design it with push in mind. It might be easy to do, but
at this point it'll probably be more trouble than it's worth.

-- 
Regards,
Slava Akhmechet.
From: K Livingston
Subject: Re: Web application
Date: 
Message-ID: <eab3dac6-40b5-4dd8-98b3-6e0c9da2a160@l1g2000hsa.googlegroups.com>
I guess that prompts a consideration I wasn't thinking about
originally... how many independent pieces of state do you have per
page, and how are they interconnected.  I tend to have a few big
pieces that update, which are not necessary dependent on each other,
or I have a set of things that I load in asynchronously, for speed,
but once there, they are inert and don't update.  Therefor, I favor a
fairly direct approach, were I set up some kind of polling behavior as
appropriate for each piece.  If you have a lot of individual pieces of
state, that are inter-dependent on each other, then (if I understand
it correctly) something like Weblocks will give you some added
traction and ease.  (For example, things like context dependent
toolbars in an editor etc.)


On Jan 11, 3:14 pm, Slava Akhmechet <·········@gmail.com> wrote:
> The way Weblocks generally operates is that an AJAX request from the
> client (usually triggerred by a user action) invokes a function on the
> server that changes the state of some widget. I specialize (setf
> slot-value) on widgets so that when the state is changed the widget is
> automagically marked as dirty (you can of course mark widgets as dirty
> manually, or turn the default behavior off). Once the action is over,
> dirty widgets are rendered and sent back to the client. The client-side
> bit of Weblocks written in JS grabs the updated widgets and updates
> appropriate spots of the page. All of this is done by the framework, so
> you don't have to touch any of this code.
>
> It seems that to do what you want in Weblocks would require writing a
> small JS function that periodically invokes an empty action via AJAX. If
> anything has changed on the server, it will automatically propagate to
> the client. If you decide to go for a polling model, this would be very
> simple to do in Weblocks.
>
> If you decide to go with a push model, I don't think Weblocks can
> help. I didn't design it with push in mind. It might be easy to do, but
> at this point it'll probably be more trouble than it's worth.
>
> --
> Regards,
> Slava Akhmechet.
From: Slava Akhmechet
Subject: Re: Web application
Date: 
Message-ID: <871w8oas35.fsf@gmail.com>
K Livingston <······················@gmail.com> writes:

> Therefor, I favor a fairly direct approach, were I set up some kind of
> polling behavior as appropriate for each piece.
Hmm, why not just have a single poll loop and have the server only send
things that change? This approach always made sense to me as it involves
very simple client side support, and a server mechanism that keeps track
of dirty widgets. Simple and effective.

-- 
Regards,
Slava Akhmechet.
From: Sohail Somani
Subject: Re: Web application
Date: 
Message-ID: <FDUhj.2182$yQ1.2132@edtnps89>
On Fri, 11 Jan 2008 22:57:16 +0000, Slava Akhmechet wrote:

> K Livingston <······················@gmail.com> writes:
> 
>> Therefor, I favor a fairly direct approach, were I set up some kind of
>> polling behavior as appropriate for each piece.
> Hmm, why not just have a single poll loop and have the server only send
> things that change? This approach always made sense to me as it involves
> very simple client side support, and a server mechanism that keeps track
> of dirty widgets. Simple and effective.

Weblocks does exactly this so one should be able to set something like 
that up... My feeling is that it should be doable without touching the 
core of Weblocks, is that right?

-- 
Sohail Somani
http://uint32t.blogspot.com
From: Slava Akhmechet
Subject: Re: Web application
Date: 
Message-ID: <871w8npofn.fsf@gmail.com>
Sohail Somani <······@taggedtype.net> writes:

> Weblocks does exactly this so one should be able to set something like 
> that up... My feeling is that it should be doable without touching the 
> core of Weblocks, is that right?
Yeah, all that needs to be written is a JS function that periodically
sends a request to an empty action. Weblocks will do the rest.

-- 
Regards,
Slava Akhmechet.
From: Pascal Costanza
Subject: Re: Web application
Date: 
Message-ID: <5us5e5F1j8nhlU1@mid.individual.net>
Thanks a lot for all the feedback, that was extremely helpful. I now 
have a good idea which route to go - basically, Weblocks + Ajax-based 
polling.

Some responses to some questions:

Slobodan Blazeski wrote:
 > I hope you had a chance to see my examples in lisp.paste (server is
 > currently down) if you don't check it's google cache
 > 
http://216.239.59.104/search?q=cache:gt5_Zfr91PQJ:paste.lisp.org/display/53998+http://paste.lisp.org/display/53998&hl=en&strip=1

Yes, thanks for the feedback. (However, this is not quite what we want 
to do.)

Sohail Somani wrote:
 >
 > Anyway, do you really need the server to push changes to the browser?
 >

Yes. The server registers events that the client doesn't see, but the 
client needs to be informed about those events.

K Livingston wrote:
 > I'm not sure exactly what Pascal's application is,
 > but it sounds like it's for developers or other technically savvy
 > people, right?  I think it's safe to assume they are using at least IE
 > 6 or a version or two back of Mozilla, in which case you are fine
 > going the Ajax only route.

Yes, it's a feasibility demonstration, not immediately intended as a 
product. So Ajax looks perfectly ok here to make the point.

Slava Akhmechet wrote:
> Sohail Somani <······@taggedtype.net> writes:
> 
>> Weblocks does exactly this so one should be able to set something like 
>> that up... My feeling is that it should be doable without touching the 
>> core of Weblocks, is that right?
> Yeah, all that needs to be written is a JS function that periodically
> sends a request to an empty action. Weblocks will do the rest.

OK, this sounds like the simplest way to go. I have already downloaded 
Weblocks yesterday and taken a look at it, and it looks pretty cool. 
Thanks for confirming that this would work with an empty action, 
otherwise I would have been by next question. ;)

I just hope that the generated pages will also work on an iPhone - but I 
guess if that doesn't work out of the box, that it can be fixed...

··············@gmail.com wrote:
 > the ajax branch of UCW has an example that demonstrates exactly this:
 > it's a shared counter, if someone increments it, then all the other
 > browsers pointed to that page automatically update.

That's good to know, I'll take a look at it, especially to find out how 
to do the polling.


Thanks again to you all, and everyone else who responded.


Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Slava Akhmechet
Subject: Re: Web application
Date: 
Message-ID: <87zlvaqwbw.fsf@gmail.com>
Pascal Costanza <··@p-cos.net> writes:

> I just hope that the generated pages will also work on an iPhone - but
> I guess if that doesn't work out of the box, that it can be fixed...
Built-in widgets generate valid XHTML. JavaScript part and default CSS
was tested on Firefox, IE6/7, Opera, and Safari. If I were to take a
guess, I'd say that default CSS has the highest likelyhood of being
broken on the iPhone. Everything else should work fine.

If you have an iPhone you can check here: http://72.249.76.121/

-- 
Regards,
Slava Akhmechet.
From: vtail
Subject: Re: Web application
Date: 
Message-ID: <9c2afe5f-b0ee-4894-86e3-e72925bdfd3f@q39g2000hsf.googlegroups.com>
On Jan 12, 8:43 pm, Slava Akhmechet <·········@gmail.com> wrote:

> Built-in widgets generate valid XHTML. JavaScript part and default CSS
> was tested on Firefox, IE6/7, Opera, and Safari. If I were to take a
> guess, I'd say that default CSS has the highest likelyhood of being
> broken on theiPhone. Everything else should work fine.
>
> If you have an iPhone you can check here:http://72.249.76.121/

Well, formatting looks just fine, Main menu, Select and sort by
first/last name etc. works, but search doesn't work and neither do
add/delete buttons.
From: Pascal Costanza
Subject: Re: Web application
Date: 
Message-ID: <5uugjvF1jsp16U1@mid.individual.net>
Slava Akhmechet wrote:
> Pascal Costanza <··@p-cos.net> writes:
> 
>> I just hope that the generated pages will also work on an iPhone - but
>> I guess if that doesn't work out of the box, that it can be fixed...
> Built-in widgets generate valid XHTML. JavaScript part and default CSS
> was tested on Firefox, IE6/7, Opera, and Safari. If I were to take a
> guess, I'd say that default CSS has the highest likelyhood of being
> broken on the iPhone. Everything else should work fine.
> 
> If you have an iPhone you can check here: http://72.249.76.121/

I already did that, and some of the interactions don't work correctly - 
I can open a dialog to view an instance, I can even get into the 
modification mode, but I can't submit a modification.

Apple has documented the deviations of the iPhone version of Safari, 
especially wrt JavaScript compatibility. See 
https://developer.apple.com/iphone/devcenter/designingcontent.html - 
especially the section "Know What Safari Supports on iPhone".

Do you see anything obvious here?


Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Slava Akhmechet
Subject: Re: Web application
Date: 
Message-ID: <87r6glz9k8.fsf@gmail.com>
Pascal Costanza <··@p-cos.net> writes:

> Do you see anything obvious here?
Mouse-over events and hover styles immediately jump out - this should
impair the visual cues provided by datagrid for drilldown. This
shouldn't affect the functionality, though, and can be fixed by turning
off "mouseover" drilldown (in which case an "edit" link will be added to
each table row).

It isn't immediately obvious why submitting a form doesn't work. It may
be because a somewhat older version of Prototype JS framework is used
(it's used heavily for AJAX form submission). I tested this with iPhoney
simulator but it doesn't properly simulate the issue (it also doesn't
simulate the mouse-over bit functionality), so for now my hands are
tied. In any case, this shouldn't be very difficult to fix.

-- 
Regards,
Slava Akhmechet.
From: Pascal Costanza
Subject: Re: Web application
Date: 
Message-ID: <5v1tcpF1iq66qU1@mid.individual.net>
Slava Akhmechet wrote:
> Pascal Costanza <··@p-cos.net> writes:
> 
>> Do you see anything obvious here?
> Mouse-over events and hover styles immediately jump out - this should
> impair the visual cues provided by datagrid for drilldown. This
> shouldn't affect the functionality, though, and can be fixed by turning
> off "mouseover" drilldown (in which case an "edit" link will be added to
> each table row).
> 
> It isn't immediately obvious why submitting a form doesn't work. It may
> be because a somewhat older version of Prototype JS framework is used
> (it's used heavily for AJAX form submission). I tested this with iPhoney
> simulator but it doesn't properly simulate the issue (it also doesn't
> simulate the mouse-over bit functionality), so for now my hands are
> tied. In any case, this shouldn't be very difficult to fix.

OK, this is good to know. What I know by now gives me enough confidence 
to try Weblocks. I'll ask about details in the Weblocks mailing list 
when I encounter them (probably only in February).

Thanks a lot for your feedback,
Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: gavino
Subject: Re: Web application
Date: 
Message-ID: <4cd44f6a-8d82-4612-bfa2-951fe674c937@v46g2000hsv.googlegroups.com>
On Jan 14, 12:01 pm, Pascal Costanza <····@p-cos.net> wrote:
> Slava Akhmechet wrote:
> > Pascal Costanza <····@p-cos.net> writes:
>
> >> Do you see anything obvious here?
> > Mouse-over events and hover styles immediately jump out - this should
> > impair the visual cues provided by datagrid for drilldown. This
> > shouldn't affect the functionality, though, and can be fixed by turning
> > off "mouseover" drilldown (in which case an "edit" link will be added to
> > each table row).
>
> > It isn't immediately obvious why submitting a form doesn't work. It may
> > be because a somewhat older version of Prototype JS framework is used
> > (it's used heavily for AJAX form submission). I tested this with iPhoney
> > simulator but it doesn't properly simulate the issue (it also doesn't
> > simulate the mouse-over bit functionality), so for now my hands are
> > tied. In any case, this shouldn't be very difficult to fix.
>
> OK, this is good to know. What I know by now gives me enough confidence
> to try Weblocks. I'll ask about details in the Weblocks mailing list
> when I encounter them (probably only in February).
>
> Thanks a lot for your feedback,
> Pascal
>
> --
> 1st European Lisp Symposium (ELS'08)http://prog.vub.ac.be/~pcostanza/els08/
>
> My website:http://p-cos.net
> Common Lisp Document Repository:http://cdr.eurolisp.org
> Closer to MOP & ContextL:http://common-lisp.net/project/closer/

Rascal choke-ona-banana
From: ··············@gmail.com
Subject: Re: Web application
Date: 
Message-ID: <8b0dd289-eeee-4fc7-9f73-8e24920cef37@l1g2000hsa.googlegroups.com>
> However, what I need is a way to trigger updates of a web page from the
> server side, so that it can reflect state changes. I guess I need
> something like Ajax for that, or so.

Pascal,

the ajax branch of UCW has an example that demonstrates exactly this:
it's a shared counter, if someone increments it, then all the other
browsers pointed to that page automatically update.

unfortunately that part of UCW is not tested much, and the example is
bitrotten. the ajax stuff in UCW works so that there's a poller on the
client side and the server thread, based on the load, either falls
asleep until there's something to be sent down to the client, or
answers a delay to sleep before polling again. when the number of
connections is below a reasonable limit the update is instantaneous.

but be prepared that no matter if you use UCW or directly the metal,
you'll need to learn too much about too many confused kludges that are
around this thing people call web2...

- attila
From: Edi Weitz
Subject: Re: Web application
Date: 
Message-ID: <u7iig7vch.fsf@agharta.de>
On Thu, 10 Jan 2008 21:48:40 -0800 (PST), ··············@gmail.com wrote:

> but be prepared that no matter if you use UCW or directly the metal,
> you'll need to learn too much about too many confused kludges that
> are around this thing people call web2...

Nah, that's a waste of time.  We're already at "Web 3.0":

  http://franz.com/

Edi.

-- 

European Common Lisp Meeting, Amsterdam, April 19/20, 2008

  http://weitz.de/eclm2008/

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Sohail Somani
Subject: Re: Web application
Date: 
Message-ID: <ohEhj.26842$fj2.24710@edtnps82>
On Fri, 11 Jan 2008 07:02:54 +0100, Edi Weitz wrote:

> On Thu, 10 Jan 2008 21:48:40 -0800 (PST), ··············@gmail.com
> wrote:
> 
>> but be prepared that no matter if you use UCW or directly the metal,
>> you'll need to learn too much about too many confused kludges that are
>> around this thing people call web2...
> 
> Nah, that's a waste of time.  We're already at "Web 3.0":
> 
>   http://franz.com/

I thought that was a joke or a typo, but apparently not: 

  http://en.wikipedia.org/wiki/Web_3

-- 
Sohail Somani
http://uint32t.blogspot.com
From: Slobodan Blazeski
Subject: Re: Web application
Date: 
Message-ID: <10b4621c-6218-4c83-b449-3133ea228c2a@c23g2000hsa.googlegroups.com>
On Jan 11, 7:46 am, Sohail Somani <······@taggedtype.net> wrote:
> On Fri, 11 Jan 2008 07:02:54 +0100, Edi Weitz wrote:
> > On Thu, 10 Jan 2008 21:48:40 -0800 (PST), ··············@gmail.com
> > wrote:
>
> >> but be prepared that no matter if you use UCW or directly the metal,
> >> you'll need to learn too much about too many confused kludges that are
> >> around this thing people call web2...
>
> > Nah, that's a waste of time.  We're already at "Web 3.0":
>
> >  http://franz.com/
>
> I thought that was a joke or a typo, but apparently not:
>
>  http://en.wikipedia.org/wiki/Web_3

No, AllegroGraph rocks period, but is only available for Allegro. If
Franzers decide to sell it as portable product, lisp would have a
quick start at Web 3. It probably all depends, are the lispers using
other lisps willing to pay and would it hurt Allegro sales. Same for
AllegroCache.

cheers
Slobodan
>
> --
> Sohail Somanihttp://uint32t.blogspot.com
From: Michael Bohn
Subject: Re: Web application
Date: 
Message-ID: <47871bb8$0$25381$9b4e6d93@newsspool4.arcor-online.net>
Have a look at Prototype. It's a nice JavaScript library and it has a 
nice object system support.

http://prototypejs.org/api/ajax

And for fun with the GUI, try this:
http://script.aculo.us/




Michael

Pascal Costanza wrote:
> Hi,
> 
> I'd like to write a web application in Common Lisp that showcases some 
> features of ContextL. I have already experimented a bit with 
> Hunchentoot, and have been successful so far.
> 
> However, what I need is a way to trigger updates of a web page from the 
> server side, so that it can reflect state changes. I guess I need 
> something like Ajax for that, or so.
> 
> Can somebody recommend what libraries are good for that, and share some 
> experiences wrt things to watch out for? Also comments on what to avoid 
> would be useful.
> 
> Hunchentoot is not a strict requirement. (I'd prefer not to use 
> something based on continuations, but I can if I must... ;)
> 
> 
> Thanks a lot in advance,
> Pascal
> 
From: Robert Uhl
Subject: Re: Web application
Date: 
Message-ID: <m3hchknw3z.fsf@latakia.dyndns.org>
Pascal Costanza <··@p-cos.net> writes:
>
> However, what I need is a way to trigger updates of a web page from
> the server side, so that it can reflect state changes.

Well, you have to first figure out how you'd achieve that without any
web framework at all.  HTML is a client-driven protocol; the server
_can't_ push data to the client; it can only respond to the client's
pull.

You could ask the client to reload the page every N seconds, but
reloading an entire page would eat a lot of bandwidth, especially if one
a small part reloads.

Instead...

> I guess I need something like Ajax for that, or so.

You could use Ajax to monitor if the data has changed, and if it has to
change only that portion of the page.  Done right, this can be
reasonably elegant and fast.

In actual practise, you'll want to follow both approaches: by default
ask pages to reload regularly; then in JavaScript disable the
auto-reload and use AJAX instead.  This does the right thing: users with
older browsers, without JavaScript or with JavaScript disabled will get
the ordinary, bandwidth-intensive experience, while those with
JavaScript enabled will get a much nicer experience--but your site will
work for both.

> Can somebody recommend what libraries are good for that, and share
> some experiences wrt things to watch out for?

Parenscript, or just writing pure JavaScript.

-- 
Robert Uhl <http://public.xdi.org/=ruhl>
The cubic inch (1ci = 16.387cc) has been the traditional displacement
measurement of choice because 409 sounds better than 6702 in a song
(has there been a UK or European pop song about a sports car engine?).
                                                    --Peter Barrett
From: gavino
Subject: Re: Web application
Date: 
Message-ID: <2a319918-e780-4b5a-8a7e-9e3d3f641e0a@y5g2000hsf.googlegroups.com>
On Jan 10, 12:43 pm, Pascal Costanza <····@p-cos.net> wrote:
> Hi,
>
> I'd like to write a web application in Common Lisp that showcases some
> features of ContextL. I have already experimented a bit with
> Hunchentoot, and have been successful so far.
>
> However, what I need is a way to trigger updates of a web page from the
> server side, so that it can reflect state changes. I guess I need
> something like Ajax for that, or so.
>
> Can somebody recommend what libraries are good for that, and share some
> experiences wrt things to watch out for? Also comments on what to avoid
> would be useful.
>
> Hunchentoot is not a strict requirement. (I'd prefer not to use
> something based on continuations, but I can if I must... ;)
>
> Thanks a lot in advance,
> Pascal
>
> --
> 1st European Lisp Symposium (ELS'08)http://prog.vub.ac.be/~pcostanza/els08/
>
> My website:http://p-cos.net
> Common Lisp Document Repository:http://cdr.eurolisp.org
> Closer to MOP & ContextL:http://common-lisp.net/project/closer/
http://www.youtube.com/watch?v=Txj4mj5yom0