Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 2:42 PM, David Mintz wrote: > > > > >> >> >> I don't think your code is quite right. To validate polling code, >> just add "sleep(2)" to your php code, and set the updateInterval to 1 >> second. If it doesn't work under these conditions, then the code is >> not quite rig

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Daniel Convissor
Hola David: On Wed, Mar 04, 2009 at 10:49:01AM -0500, David Mintz wrote: > I've got users working collaboratively all day long on a set of database > records. The view in front of them is frequently stale. There are many ways to do this, as this thread shows. The best option depends on exactly

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 2:42 PM, David Mintz wrote: > > > > > In any case, the updateInterval is currently 5000 milliseconds. I just want > to make sure their snapshot never gets more than five minutes old. > Ouch, did I say 5000 when I meant 30 ? -- David Mintz http://davidmintz.org/ Th

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 2:53 PM, Jesse Callaway wrote: > On Wed, Mar 4, 2009 at 1:07 PM, David Mintz wrote: > > > > On Wed, Mar 4, 2009 at 12:17 PM, John Campbell > wrote: > >> > >> >> Use AJAX instead to refresh just the part of the page that needs > >> >> refreshing. If it's a fair chunk of in

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Jesse Callaway
On Wed, Mar 4, 2009 at 1:07 PM, David Mintz wrote: > > On Wed, Mar 4, 2009 at 12:17 PM, John Campbell wrote: >> >> >> Use AJAX instead to refresh just the part of the page that needs >> >> refreshing. If it's a fair chunk of information, you set a "version" >> >> on the server so the AJAX call ju

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 1:30 PM, John Campbell wrote: > On Wed, Mar 4, 2009 at 12:48 PM, David Mintz wrote: > > // on load > > > > window.updater = window.setInterval(submitForm,updateInterval); > > > > // and... > > > > submitForm = function(){ > > > > $('searchForm').request({ > > > onCre

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread John Campbell
On Wed, Mar 4, 2009 at 12:48 PM, David Mintz wrote: > // on load > > window.updater = window.setInterval(submitForm,updateInterval); > > // and... > > submitForm = function(){ > > $('searchForm').request({ > > onCreate:function(response){$('formSubmit').value="Processin

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Allen Shaw
David Mintz wrote: The users are looking at a set of database rows. The table does have last-modified and creation-datetime columns. Saving the current set's maximum last-update and/or created value in the client, and then checking against the server by running an Ajax request to a server-sid

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 12:45 PM, Rolan Yang wrote: > John Campbell wrote: > >> On Wed, Mar 4, 2009 at 12:10 PM, David Mintz >> wrote: >> The problem is with intervals, is that if someone's connection flakes >> out for a minute or two, you end up doing tons of ajax calls that all >> overlap caus

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Allen Shaw
David Mintz wrote: I have a page where I *think* I am doing that albeit in a roundabout way. When the document loads initially I set the timer. When the xhr completes, my xhr callback resets the timer. Yes, that's what I was thinking (and what I'm doing). If the connection fails, the xhr ca

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 12:17 PM, John Campbell wrote: > >> Use AJAX instead to refresh just the part of the page that needs > >> refreshing. If it's a fair chunk of information, you set a "version" > >> on the server so the AJAX call just checks the current version vs it's > >> version. If it's d

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 12:26 PM, John Campbell wrote: > On Wed, Mar 4, 2009 at 12:10 PM, David Mintz wrote: > > > > On Wed, Mar 4, 2009 at 12:01 PM, David Mintz > wrote: > >>> > >> Thanks for the tip, but... why is this so? > >> > > > > Cancel that, I think > > > http://blog.paulbonser.com/2007

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Rolan Yang
John Campbell wrote: On Wed, Mar 4, 2009 at 12:10 PM, David Mintz wrote: The problem is with intervals, is that if someone's connection flakes out for a minute or two, you end up doing tons of ajax calls that all overlap causing wacky behavior. The point of tail recursion is to wait for the

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Ajai Khattri
On Wed, 4 Mar 2009, David Mintz wrote: > I've got users working collaboratively all day long on a set of database > records. The view in front of them is frequently stale. A common old Web 1.0 > approach to solve this was to reload the page automatically every n seconds > with a meta refresh. Nowa

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread John Campbell
On Wed, Mar 4, 2009 at 12:10 PM, David Mintz wrote: > > On Wed, Mar 4, 2009 at 12:01 PM, David Mintz wrote: >>> >> Thanks for the tip, but... why is this so? >> > > Cancel that, I think > http://blog.paulbonser.com/2007/11/18/extending-javascript-tail-recursion/ > is trying to help me out on this

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Jesse Callaway
On Wed, Mar 4, 2009 at 11:53 AM, David Mintz wrote: > > > On Wed, Mar 4, 2009 at 11:34 AM, Brent Baisley wrote: >> >> Use AJAX instead to refresh just the part of the page that needs >> refreshing. If it's a fair chunk of information, you set a "version" >> on the server so the AJAX call just che

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread John Campbell
On Wed, Mar 4, 2009 at 11:53 AM, David Mintz wrote: > > > On Wed, Mar 4, 2009 at 11:34 AM, Brent Baisley wrote: >> >> Use AJAX instead to refresh just the part of the page that needs >> refreshing. If it's a fair chunk of information, you set a "version" >> on the server so the AJAX call just che

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 12:01 PM, David Mintz wrote: > Writing an ajax polling loop is really quite simple... just make sure >> you use tail recursion, rather than an interval. I have made that >> mistake in the past, and it hurts. >> > > > Thanks for the tip, but... why is this so? > > Cance

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 11:50 AM, John Campbell wrote: > I use AJAX polling loops to check if the data is actually stale, and > then do something about it. Again, sorry for being dense but I am not sure I understand how this checking should be performed. I can imagine possibilities, some of wh

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
On Wed, Mar 4, 2009 at 11:34 AM, Brent Baisley wrote: > Use AJAX instead to refresh just the part of the page that needs > refreshing. If it's a fair chunk of information, you set a "version" > on the server so the AJAX call just checks the current version vs it's > version. If it's different, th

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Michael B Allen
On Wed, Mar 4, 2009 at 10:49 AM, David Mintz wrote: > > I've got users working collaboratively all day long on a set of database > records. The view in front of them is frequently stale. A common old Web 1.0 > approach to solve this was to reload the page automatically every n seconds > with a met

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread John Campbell
I use AJAX polling loops to check if the data is actually stale, and then do something about it. It can be complicated as auto updating the sections of the page that have changed, and then doing the "yellow-fade". If you don't want to get fancy, you could just show a dialogue that let's the user

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Jake McGraw
On Wed, Mar 4, 2009 at 10:49 AM, David Mintz wrote: > > I've got users working collaboratively all day long on a set of database > records. The view in front of them is frequently stale. A common old Web 1.0 > approach to solve this was to reload the page automatically every n seconds > with a met

Re: [nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread Brent Baisley
Use AJAX instead to refresh just the part of the page that needs refreshing. If it's a fair chunk of information, you set a "version" on the server so the AJAX call just checks the current version vs it's version. If it's different, then you refresh the content. If it's not different, no need to re

[nyphp-talk] the stale V in MVC web apps

2009-03-04 Thread David Mintz
I've got users working collaboratively all day long on a set of database records. The view in front of them is frequently stale. A common old Web 1.0 approach to solve this was to reload the page automatically every n seconds with a meta refresh. Nowadays we have xhr. Either way, my concern is as t