Hi,
How would one update an WAComponent without using a timed update? An example would be a progress list, that gets updated by an long running process. Thank you, Mart-Mari _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
2006/8/16, Mart-Mari Breedt <[hidden email]>:
> Hi, > > How would one update an WAComponent without using a timed update? > > An example would be a progress list, that gets updated by an long > running process. > > Thank you, Ideally you would be able to use Comet for that. It would allow you to create events on the server and evaluate them in the client. Unfortunately it's not there yet. So either fix it yourself ;) or use polling (periodical). The overhead should not be that heavy if you only have a few users and comet would require an open http connection and periodical updates anyway. When the progress is done, inject a script that redirects to the next "page". Just remember to run the periodical updates in a new Process. Philippe _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Also there is server PUSH technology, search Google.
You can have an <ifarme> in your page, which updates from the server size, it renders full HTML page in each go. Just an option, if you don't want to mess with Javascript. -Dmitry. Philippe Marschall wrote: > 2006/8/16, Mart-Mari Breedt <[hidden email]>: > >> Hi, >> >> How would one update an WAComponent without using a timed update? >> >> An example would be a progress list, that gets updated by an long >> running process. >> >> Thank you, > > > Ideally you would be able to use Comet for that. It would allow you to > create events on the server and evaluate them in the client. > Unfortunately it's not there yet. > > So either fix it yourself ;) or use polling (periodical). The overhead > should not be that heavy if you only have a few users and comet would > require an open http connection and periodical updates anyway. > > When the progress is done, inject a script that redirects to the next > "page". > > Just remember to run the periodical updates in a new Process. > > Philippe > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Mart-Mari Breedt
Thanks Philippe,
I think fixing Comet is a little bit much for a relative newbie like myself to chew on :-), but I did try the periodical updates and I got the effect I desired. Was just wondering if there was another way to do this... About the script redirecting to the next page, do you maybe have an example of such a script? Or is there a way to stop the updates? I have this scenario now where the update just keeps on running even after no progress has been made on the client side. Thank you, Mart-Mari -----Original Message----- From: Philippe Marschall [mailto:[hidden email]] Sent: 17 Augustus 2006 01:30 nm To: The Squeak Enterprise Aubergines Server - general discussion. Subject: Re: [Seaside] Displaying progress on a web page 2006/8/16, Mart-Mari Breedt <[hidden email]>: > Hi, > > How would one update an WAComponent without using a timed update? > > An example would be a progress list, that gets updated by an long > running process. > > Thank you, Ideally you would be able to use Comet for that. It would allow you to create events on the server and evaluate them in the client. Unfortunately it's not there yet. So either fix it yourself ;) or use polling (periodical). The overhead should not be that heavy if you only have a few users and comet would require an open http connection and periodical updates anyway. When the progress is done, inject a script that redirects to the next "page". Just remember to run the periodical updates in a new Process. Philippe _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> About the script redirecting to the next page, do you maybe have an
> example of such a script? Or is there a way to stop the updates? I have > this scenario now where the update just keeps on running even after no > progress has been made on the client side. I'm not sure, maybe something like this html evaluator callback: [ self call: ProgresDoneComponent new ] maybe you need to wrap a #script: around it. Lukas? Philippe _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Mart-Mari Breedt
> -----Original Message-----
> From: [hidden email] > [mailto:[hidden email]] On Behalf > Of Mart-Mari Breedt > Sent: Thursday, August 17, 2006 4:38 AM > To: The Squeak Enterprise Aubergines Server - general discussion. > Subject: RE: [Seaside] Displaying progress on a web page > > Thanks Philippe, > > I think fixing Comet is a little bit much for a relative > newbie like myself to chew on :-), but I did try the > periodical updates and I got the effect I desired. Was just > wondering if there was another way to do this... > > About the script redirecting to the next page, do you maybe > have an example of such a script? Or is there a way to stop > the updates? I have this scenario now where the update just > keeps on running even after no progress has been made on the > client side. > > Thank you, > > Mart-Mari Try this, on your periodical, set a high decay rate, say 1000. This will stop the polling if the same answer comes back twice. Then in the render method, besides what you're already rendering, do something like this... r hiddenInput text: r nextId This will make each answer unique preventing the decay from kicking in. When you want to stop polling, stop rendering the hidden value, and polling will stop after the next hit. I've added a couple small extension methods to WATagBrush that I have yet to publish, but they seem to be working pretty well for me so far. I use polling to fork off a long running process on another thread, then poll for the result until it finishes or times out. No promises, but I'll share what I use for now. WATagBrush>>with: initialBlock waitMax: aDuration forWork: aBlock thenRender: aRenderBlock self attributeAt: #default put: initialBlock value. self with: initialBlock. self waitMax: aDuration forWork: aBlock thenRender: aRenderBlock WATagBrush>>waitMax: aDuration forWork: aBlock thenRender: aRenderBlock "poll for results, stop when found or timeout expires" | result | result := self forkWaitFor: aDuration longRunningProcess: aBlock. canvas script: ((canvas periodical) id: (self attributes at: #id); decay: 1000; asynchronous: true; evalScripts: true; frequency: 2; callback: [:r | (result at: #result) ifNil: [r text: (self attributeAt: #default). r hiddenInput text: r nextId] ifNotNil: [aRenderBlock value: r value: (result at: #result)]]) WATagBrush>>forkWaitFor: aDuration longRunningProcess: aBlock | startAt result | result := (Dictionary new) at: #result put: nil; yourself. startAt := DateAndTime now. [[[(result at: #result) isNil] whileTrue: [DateAndTime now - startAt > aDuration ifTrue: [Error signal: 'timeout']. (Delay forMilliseconds: 100) wait. result at: #result put: aBlock value]] on: Error do: [:error | result at: #result put: error messageText]] forkNamed: 'ajax async:'. ^result I use it like so... html div with:[html text: 'Searching...'] waitMax: 30 seconds forWork: [self getDataFromLongRunningProcess] thenRender:[:r :value | r text: value] _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Small correction,
I use it like so... html div with: 'Searching...' waitMax: 30 seconds forWork: [self getDataFromLongRunningProcess] thenRender:[:r :value | r text: value] I just noticed that with expects a string, not a block that can be rendered in. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Mart-Mari Breedt
Hi Ramon,
Thank you very much for your example. It was of great help. I used your tip about the hidden input with the unique id and the high decay rate and it worked great! Thank you, Mart-Mari -----Original Message----- From: Ramon Leon [mailto:[hidden email]] Sent: 17 Augustus 2006 05:49 nm To: 'The Squeak Enterprise Aubergines Server - general discussion.' Subject: RE: [Seaside] Displaying progress on a web page > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf > Of Mart-Mari Breedt > Sent: Thursday, August 17, 2006 4:38 AM > To: The Squeak Enterprise Aubergines Server - general discussion. > Subject: RE: [Seaside] Displaying progress on a web page > > Thanks Philippe, > > I think fixing Comet is a little bit much for a relative > newbie like myself to chew on :-), but I did try the > periodical updates and I got the effect I desired. Was just > wondering if there was another way to do this... > > About the script redirecting to the next page, do you maybe > have an example of such a script? Or is there a way to stop > the updates? I have this scenario now where the update just > keeps on running even after no progress has been made on the > client side. > > Thank you, > > Mart-Mari Try this, on your periodical, set a high decay rate, say 1000. This will stop the polling if the same answer comes back twice. Then in the render method, besides what you're already rendering, do something like this... r hiddenInput text: r nextId This will make each answer unique preventing the decay from kicking in. When you want to stop polling, stop rendering the hidden value, and polling will stop after the next hit. I've added a couple small extension methods to WATagBrush that I have yet to publish, but they seem to be working pretty well for me so far. I use polling to fork off a long running process on another thread, then poll for the result until it finishes or times out. No promises, but I'll share what I use for now. WATagBrush>>with: initialBlock waitMax: aDuration forWork: aBlock thenRender: aRenderBlock self attributeAt: #default put: initialBlock value. self with: initialBlock. self waitMax: aDuration forWork: aBlock thenRender: aRenderBlock WATagBrush>>waitMax: aDuration forWork: aBlock thenRender: aRenderBlock "poll for results, stop when found or timeout expires" | result | result := self forkWaitFor: aDuration longRunningProcess: aBlock. canvas script: ((canvas periodical) id: (self attributes at: #id); decay: 1000; asynchronous: true; evalScripts: true; frequency: 2; callback: [:r | (result at: #result) ifNil: [r text: (self attributeAt: #default). r hiddenInput text: r nextId] ifNotNil: [aRenderBlock value: r value: (result at: #result)]]) WATagBrush>>forkWaitFor: aDuration longRunningProcess: aBlock | startAt result | result := (Dictionary new) at: #result put: nil; yourself. startAt := DateAndTime now. [[[(result at: #result) isNil] whileTrue: [DateAndTime now - startAt > aDuration ifTrue: [Error signal: 'timeout']. (Delay forMilliseconds: 100) wait. result at: #result put: aBlock value]] on: Error do: [:error | result at: #result put: error messageText]] forkNamed: 'ajax async:'. ^result I use it like so... html div with:[html text: 'Searching...'] waitMax: 30 seconds forWork: [self getDataFromLongRunningProcess] thenRender:[:r :value | r text: value] _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |