Re: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-27 Thread Alex McAuley
I'll dig out the testbed that i made for it as it was a long time ago now 
that i did it and i cant remeber if i wrapped it in a periodicalupdater or 
an AjaxPeriodicalUpdater...

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "Eric" 
To: "Prototype & script.aculo.us" 
Sent: Friday, November 27, 2009 3:48 PM
Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request


> >And next, because an array is much more flexible than variables. you
>
> I am sorry David, but I don't agree with you on this :o)
>
> An object variable is ways more flexible than an array. Especially if
> you add some methods to its prototype to fit your needs.
>
> And it is probably overkill in this case, where an incremented int
> would do it unless you actually need the result objects of every
> previous requests (which is not the same thing than "need to be
> executed after every previous requests" which is the need expressed by
> maalek).
>
> Alex: That's weird, but I was thinking the xhr object was stored in
> the closure of the Ajax.Request object, and garbage collected after
> the last callback was called (unless you store a reference to this
> object in another variable of course).
> It seems I am obviously wrong here I guess I'll have to have a
> look in the source again :o)
>
>>var request=new Ajax.Periodical...({});
>>
>>request=null;
>
> If you nullify the Periodical thingy, will it continue to be called?
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to 
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>
> 

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-27 Thread Eric
>And next, because an array is much more flexible than variables. you

I am sorry David, but I don't agree with you on this :o)

An object variable is ways more flexible than an array. Especially if
you add some methods to its prototype to fit your needs.

And it is probably overkill in this case, where an incremented int
would do it unless you actually need the result objects of every
previous requests (which is not the same thing than "need to be
executed after every previous requests" which is the need expressed by
maalek).

Alex: That's weird, but I was thinking the xhr object was stored in
the closure of the Ajax.Request object, and garbage collected after
the last callback was called (unless you store a reference to this
object in another variable of course).
It seems I am obviously wrong here I guess I'll have to have a
look in the source again :o)

>var request=new Ajax.Periodical...({});
>
>request=null;

If you nullify the Periodical thingy, will it continue to be called?

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-24 Thread Matt Foster
I'd recommend taking a look at my Ajax Service Queue approach, such
that all requests go through the service object, and in the subclass
for the queue's case won't send the next request until its predecessor
has returned.  It needs to be updated for 1.6 but the idea is on the
wall for you to look at...

Most pertinently is the "onFinish" event which would work perfectly
for your circumstance.

http://positionabsolute.net/blog/2007/04/ajax-request-queue.php



On Nov 24, 8:30 am, "Alex McAuley" 
wrote:
> Yes...
>
> Objects and thier properties are built and stored in memory (how else would
> they get built) - the CPU does the calculations and outputs the opcode to
> the browser (which reads from memory) what it needs to do with the object
> (In very simple terms)... So it stands to reason that if you dont remove the
> Object from memory it will just add to the memory bracket.
>
> To test...
>
> Build a test page with a periodical ajax request and (on winblows) watch the
> RAM that for instance firefox uses in the task manager go up and up and up.
>
> Then close the whole browser (so it starts clean again) and assign the
> periodical updater to a variable
>
> var request=new Ajax.Periodical...({});
>
> request=null;
>
> And watch the difference between what happend in the first test and the
> second...
>
> In the second test the browser frees up 60-80% of the memory that it used to
> make/process the request by nulling the object back to a null byte
>
> If you look on TJ's proto scripty wikidot my results are there and the code
> that accompanies it.
>
> I assumed it was common knowledge that people garbage collected ajax
> requests... Its not just prototypejs but every ajax style library that does
> not garbage collect these requests
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> - Original Message -----
> From: "david" 
> To: "Prototype & script.aculo.us" 
> Sent: Tuesday, November 24, 2009 11:54 AM
> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> Yes your right Alex, but the case of maalek did not mention such
> numbers of request.
> I think in his case using one array is better than using a lot (~14
> differents variables).
>
> btw, I'm interrest in "In fact the actal request stays in memory
> unless you null the object" and after reflexion, that is logical, but
> is it normal ??
>
> --
> david
>
> On 24 nov, 09:37, "Alex McAuley" 
> wrote:
> > Arrays are stored in memory, they are not a cookie so they do not get
> > stored
> > on the client machine .. (and you yourself say that even if it was its not
> > cross browser)
>
> > To test .. Do 100 requests with large responses and save them all into an
> > array and see how much memory the web browser is eating each time you do
> > one...
>
> > In fact the actal request stays in memory unless you null the object - i
> > wrote a post on this in TJ's proto scripty wiki which has test cases to
> > prove it.
>
> > I dont see any reason ever to save the response of multiple requests in an
> > object that is saved in memory of the client's browser  what happens
> > if
> > they are on an iPhone or somehting with not alot of memory ?
>
> > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > - Original Message -
> > From: "david" 
> > To: "Prototype & script.aculo.us"
> > 
> > Sent: Tuesday, November 24, 2009 7:24 AM
> > Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> > > I'm sorry Alex, but I definitely not agree with you !
> > > First because there is existing method to cache the Ajax request and
> > > they use local object to save the result (we have now some new way to
> > > save locally a variable but it's not cross-browser).
>
> > > And next, because an array is much more flexible than variables. you
> > > could access each element independantly and have the length method (In
> > > our exemple, to know how much elements have been saved). And if each
> > > request should have a specific position in the array, length is no
> > > more working, but Prototype have sugaristic method that help you
> > > playing with Array the way you need.
>
> > > But there is I think plenty way to do this.
>
> > > --
> > > david
>
> > > On 23 nov, 23:44, "Alex McAuley" 
> > > wrote:
> > >> It would polute the variable and seriously eat RAM to save every result
> > >> response in an array, i wo

Re: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-24 Thread Alex McAuley
Yes...

Objects and thier properties are built and stored in memory (how else would 
they get built) - the CPU does the calculations and outputs the opcode to 
the browser (which reads from memory) what it needs to do with the object 
(In very simple terms)... So it stands to reason that if you dont remove the 
Object from memory it will just add to the memory bracket.

To test...

Build a test page with a periodical ajax request and (on winblows) watch the 
RAM that for instance firefox uses in the task manager go up and up and up.

Then close the whole browser (so it starts clean again) and assign the 
periodical updater to a variable

var request=new Ajax.Periodical...({});

request=null;

And watch the difference between what happend in the first test and the 
second...

In the second test the browser frees up 60-80% of the memory that it used to 
make/process the request by nulling the object back to a null byte

If you look on TJ's proto scripty wikidot my results are there and the code 
that accompanies it.

I assumed it was common knowledge that people garbage collected ajax 
requests... Its not just prototypejs but every ajax style library that does 
not garbage collect these requests


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "david" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, November 24, 2009 11:54 AM
Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request


Yes your right Alex, but the case of maalek did not mention such
numbers of request.
I think in his case using one array is better than using a lot (~14
differents variables).

btw, I'm interrest in "In fact the actal request stays in memory
unless you null the object" and after reflexion, that is logical, but
is it normal ??

--
david

On 24 nov, 09:37, "Alex McAuley" 
wrote:
> Arrays are stored in memory, they are not a cookie so they do not get 
> stored
> on the client machine .. (and you yourself say that even if it was its not
> cross browser)
>
> To test .. Do 100 requests with large responses and save them all into an
> array and see how much memory the web browser is eating each time you do
> one...
>
> In fact the actal request stays in memory unless you null the object - i
> wrote a post on this in TJ's proto scripty wiki which has test cases to
> prove it.
>
> I dont see any reason ever to save the response of multiple requests in an
> object that is saved in memory of the client's browser  what happens 
> if
> they are on an iPhone or somehting with not alot of memory ?
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> - Original Message -
> From: "david" 
> To: "Prototype & script.aculo.us" 
> 
> Sent: Tuesday, November 24, 2009 7:24 AM
> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> > I'm sorry Alex, but I definitely not agree with you !
> > First because there is existing method to cache the Ajax request and
> > they use local object to save the result (we have now some new way to
> > save locally a variable but it's not cross-browser).
>
> > And next, because an array is much more flexible than variables. you
> > could access each element independantly and have the length method (In
> > our exemple, to know how much elements have been saved). And if each
> > request should have a specific position in the array, length is no
> > more working, but Prototype have sugaristic method that help you
> > playing with Array the way you need.
>
> > But there is I think plenty way to do this.
>
> > --
> > david
>
> > On 23 nov, 23:44, "Alex McAuley" 
> > wrote:
> >> It would polute the variable and seriously eat RAM to save every result
> >> response in an array, i would highly recommend staying away from it..
>
> >> Alex Mcauleyhttp://www.thevacancymarket.com
>
> >> - Original Message -
> >> From: "david" 
> >> To: "Prototype & script.aculo.us"
> >> 
> >> Sent: Monday, November 23, 2009 8:00 PM
> >> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> >> > Hi all,
>
> >> > if you need to save all returned value, just save each request result
> >> > in an array.
> >> > Check the length of the result list to know when all request are
> >> > finished.
>
> >> > But we still turn around the same idea.
> >> > --
> >> > david
>
> >> > On 23 nov, 15:59, "Alex McAuley" 
> >> > wrote:
> >> >> The main problem is that due to the "ansynchronous" and the 

[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-24 Thread david
Yes your right Alex, but the case of maalek did not mention such
numbers of request.
I think in his case using one array is better than using a lot (~14
differents variables).

btw, I'm interrest in "In fact the actal request stays in memory
unless you null the object" and after reflexion, that is logical, but
is it normal ??

--
david

On 24 nov, 09:37, "Alex McAuley" 
wrote:
> Arrays are stored in memory, they are not a cookie so they do not get stored
> on the client machine .. (and  you yourself say that even if it was its not
> cross browser)
>
> To test .. Do 100 requests with large responses and save them all into an
> array and see how much memory the web browser is eating each time you do
> one...
>
> In fact the actal request stays in memory unless you null the object - i
> wrote a post on this in TJ's proto scripty wiki which has test cases to
> prove  it.
>
> I dont see any reason ever to save the response of multiple requests in an
> object that is saved in memory of the client's browser  what happens if
> they are on an iPhone or somehting with not alot of memory ?
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> - Original Message -
> From: "david" 
> To: "Prototype & script.aculo.us" 
> Sent: Tuesday, November 24, 2009 7:24 AM
> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> > I'm sorry Alex, but I definitely not agree with you !
> > First because there is existing method to cache the Ajax request and
> > they use local object to save the result (we have now some new way to
> > save locally a variable but it's not cross-browser).
>
> > And next, because an array is much more flexible than variables. you
> > could access each element independantly and have the length method (In
> > our exemple, to know how much elements have been saved). And if each
> > request should have a specific position in the array, length is no
> > more working, but Prototype have sugaristic method that help you
> > playing with Array the way you need.
>
> > But there is I think plenty way to do this.
>
> > --
> > david
>
> > On 23 nov, 23:44, "Alex McAuley" 
> > wrote:
> >> It would polute the variable and seriously eat RAM to save every result
> >> response in an array, i would highly recommend staying away from it..
>
> >> Alex Mcauleyhttp://www.thevacancymarket.com
>
> >> - Original Message -
> >> From: "david" 
> >> To: "Prototype & script.aculo.us"
> >> 
> >> Sent: Monday, November 23, 2009 8:00 PM
> >> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> >> > Hi all,
>
> >> > if you need to save all returned value, just save each request result
> >> > in an array.
> >> > Check the length of the result list to know when all request are
> >> > finished.
>
> >> > But we still turn around the same idea.
> >> > --
> >> > david
>
> >> > On 23 nov, 15:59, "Alex McAuley" 
> >> > wrote:
> >> >> The main problem is that due to the "ansynchronous" and the wait times
> >> >> /
> >> >> serverside processing times ... you never know which will finish first
> >> >> nd
> >> >> if
> >> >> the last request relies on the first one completing then its going to
> >> >> hard
> >> >> fail !!...
>
> >> >> Each one needs to set a variable to say its complete !
>
> >> >> Alex Mcauleyhttp://www.thevacancymarket.com
>
> >> >> - Original Message -
> >> >> From: "Eric" 
> >> >> To: "Prototype & script.aculo.us"
> >> >> 
> >> >> Sent: Monday, November 23, 2009 2:30 PM
> >> >> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> >> >> Hi,
>
> >> >> I'd launch all Ajax.Request except the last one with a onSuccess
> >> >> handler that:
> >> >> - set a flag
> >> >> - if all flags are set, launch the last Ajax.Request
>
> >> >> This way, you don't have to use timer, or loop calling yourself
> >> >> recursively.
>
> >> >> Eric
>
> >> >> NB: I didn't test it, but you may increment a counter instead of using
> >> >> many flags
>
> >> >> On 21 nov, 23:31, "T.J. Crowd

Re: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-24 Thread Alex McAuley
Arrays are stored in memory, they are not a cookie so they do not get stored 
on the client machine .. (and  you yourself say that even if it was its not 
cross browser)

To test .. Do 100 requests with large responses and save them all into an 
array and see how much memory the web browser is eating each time you do 
one...

In fact the actal request stays in memory unless you null the object - i 
wrote a post on this in TJ's proto scripty wiki which has test cases to 
prove  it.

I dont see any reason ever to save the response of multiple requests in an 
object that is saved in memory of the client's browser  what happens if 
they are on an iPhone or somehting with not alot of memory ?


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "david" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, November 24, 2009 7:24 AM
Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request


> I'm sorry Alex, but I definitely not agree with you !
> First because there is existing method to cache the Ajax request and
> they use local object to save the result (we have now some new way to
> save locally a variable but it's not cross-browser).
>
> And next, because an array is much more flexible than variables. you
> could access each element independantly and have the length method (In
> our exemple, to know how much elements have been saved). And if each
> request should have a specific position in the array, length is no
> more working, but Prototype have sugaristic method that help you
> playing with Array the way you need.
>
> But there is I think plenty way to do this.
>
> --
> david
>
>
> On 23 nov, 23:44, "Alex McAuley" 
> wrote:
>> It would polute the variable and seriously eat RAM to save every result
>> response in an array, i would highly recommend staying away from it..
>>
>> Alex Mcauleyhttp://www.thevacancymarket.com
>>
>> - Original Message -----
>> From: "david" 
>> To: "Prototype & script.aculo.us" 
>> 
>> Sent: Monday, November 23, 2009 8:00 PM
>> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>>
>> > Hi all,
>>
>> > if you need to save all returned value, just save each request result
>> > in an array.
>> > Check the length of the result list to know when all request are
>> > finished.
>>
>> > But we still turn around the same idea.
>> > --
>> > david
>>
>> > On 23 nov, 15:59, "Alex McAuley" 
>> > wrote:
>> >> The main problem is that due to the "ansynchronous" and the wait times 
>> >> /
>> >> serverside processing times ... you never know which will finish first 
>> >> nd
>> >> if
>> >> the last request relies on the first one completing then its going to
>> >> hard
>> >> fail !!...
>>
>> >> Each one needs to set a variable to say its complete !
>>
>> >> Alex Mcauleyhttp://www.thevacancymarket.com
>>
>> >> - Original Message -
>> >> From: "Eric" 
>> >> To: "Prototype & script.aculo.us"
>> >> 
>> >> Sent: Monday, November 23, 2009 2:30 PM
>> >> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>>
>> >> Hi,
>>
>> >> I'd launch all Ajax.Request except the last one with a onSuccess
>> >> handler that:
>> >> - set a flag
>> >> - if all flags are set, launch the last Ajax.Request
>>
>> >> This way, you don't have to use timer, or loop calling yourself
>> >> recursively.
>>
>> >> Eric
>>
>> >> NB: I didn't test it, but you may increment a counter instead of using
>> >> many flags
>>
>> >> On 21 nov, 23:31, "T.J. Crowder"  wrote:
>> >> > Hi,
>>
>> >> > > Synchronous is simple way but object create time increses x3. How
>> >> > > function use to wait until all object is ready ? setInterval ?
>>
>> >> > Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
>> >> > Function#defer / Function#delay. Have the code in question check its
>> >> > preconditions, and if they're not met, setTimeout/defer/delay 
>> >> > itself.
>> >> > --
>> >> > T.J. Crowder
>> >> > Independent Software Consultant
>> >> > tj / crowder software / comwww.crowdersoftware.com
&

[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-23 Thread david
I'm sorry Alex, but I definitely not agree with you !
First because there is existing method to cache the Ajax request and
they use local object to save the result (we have now some new way to
save locally a variable but it's not cross-browser).

And next, because an array is much more flexible than variables. you
could access each element independantly and have the length method (In
our exemple, to know how much elements have been saved). And if each
request should have a specific position in the array, length is no
more working, but Prototype have sugaristic method that help you
playing with Array the way you need.

But there is I think plenty way to do this.

--
david


On 23 nov, 23:44, "Alex McAuley" 
wrote:
> It would polute the variable and seriously eat RAM to save every result
> response in an array, i would highly recommend staying away from it..
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> - Original Message -
> From: "david" 
> To: "Prototype & script.aculo.us" 
> Sent: Monday, November 23, 2009 8:00 PM
> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> > Hi all,
>
> > if you need to save all returned value, just save each request result
> > in an array.
> > Check the length of the result list to know when all request are
> > finished.
>
> > But we still turn around the same idea.
> > --
> > david
>
> > On 23 nov, 15:59, "Alex McAuley" 
> > wrote:
> >> The main problem is that due to the "ansynchronous" and the wait times /
> >> serverside processing times ... you never know which will finish first nd
> >> if
> >> the last request relies on the first one completing then its going to
> >> hard
> >> fail !!...
>
> >> Each one needs to set a variable to say its complete !
>
> >> Alex Mcauleyhttp://www.thevacancymarket.com
>
> >> - Original Message -
> >> From: "Eric" 
> >> To: "Prototype & script.aculo.us"
> >> 
> >> Sent: Monday, November 23, 2009 2:30 PM
> >> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> >> Hi,
>
> >> I'd launch all Ajax.Request except the last one with a onSuccess
> >> handler that:
> >> - set a flag
> >> - if all flags are set, launch the last Ajax.Request
>
> >> This way, you don't have to use timer, or loop calling yourself
> >> recursively.
>
> >> Eric
>
> >> NB: I didn't test it, but you may increment a counter instead of using
> >> many flags
>
> >> On 21 nov, 23:31, "T.J. Crowder"  wrote:
> >> > Hi,
>
> >> > > Synchronous is simple way but object create time increses x3. How
> >> > > function use to wait until all object is ready ? setInterval ?
>
> >> > Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
> >> > Function#defer / Function#delay. Have the code in question check its
> >> > preconditions, and if they're not met, setTimeout/defer/delay itself.
> >> > --
> >> > T.J. Crowder
> >> > Independent Software Consultant
> >> > tj / crowder software / comwww.crowdersoftware.com
>
> >> > On Nov 21, 2:33 pm, maalek  wrote:
>
> >> > > Synchronous is simple way but object create time increses x3. How
> >> > > function use to wait until all object is ready ? setInterval ?
>
> >> > > maaalek
>
> >> > > On 21 Lis, 14:32, "Alex McAuley" 
> >> > > wrote:
>
> >> > > > Ask it to check a variable that is set as ready by all the others
> >> > > > ..
> >> > > > or make
> >> > > > it defer and be synchronous ..
>
> >> > > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> >> > > > - Original Message -
> >> > > > From: "maalek" 
> >> > > > To: "Prototype & script.aculo.us"
> >> > > > 
> >> > > > Sent: Saturday, November 21, 2009 12:59 PM
> >> > > > Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>
> >> > > > > Hello
>
> >> > > > > I have problem. When my page is load I build many objects (aprox
> >> > > > > 15)
> >> > > > > by Ajax.Request (asynchronous : true) but last object I can
> >> > > > > create
> &g

Re: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-23 Thread Alex McAuley
It would polute the variable and seriously eat RAM to save every result 
response in an array, i would highly recommend staying away from it..

Alex Mcauley
http://www.thevacancymarket.com


- Original Message - 
From: "david" 
To: "Prototype & script.aculo.us" 
Sent: Monday, November 23, 2009 8:00 PM
Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request


> Hi all,
>
> if you need to save all returned value, just save each request result
> in an array.
> Check the length of the result list to know when all request are
> finished.
>
> But we still turn around the same idea.
> --
> david
>
> On 23 nov, 15:59, "Alex McAuley" 
> wrote:
>> The main problem is that due to the "ansynchronous" and the wait times /
>> serverside processing times ... you never know which will finish first nd 
>> if
>> the last request relies on the first one completing then its going to 
>> hard
>> fail !!...
>>
>> Each one needs to set a variable to say its complete !
>>
>> Alex Mcauleyhttp://www.thevacancymarket.com
>>
>> ----- Original Message -
>> From: "Eric" 
>> To: "Prototype & script.aculo.us" 
>> 
>> Sent: Monday, November 23, 2009 2:30 PM
>> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>>
>> Hi,
>>
>> I'd launch all Ajax.Request except the last one with a onSuccess
>> handler that:
>> - set a flag
>> - if all flags are set, launch the last Ajax.Request
>>
>> This way, you don't have to use timer, or loop calling yourself
>> recursively.
>>
>> Eric
>>
>> NB: I didn't test it, but you may increment a counter instead of using
>> many flags
>>
>> On 21 nov, 23:31, "T.J. Crowder"  wrote:
>> > Hi,
>>
>> > > Synchronous is simple way but object create time increses x3. How
>> > > function use to wait until all object is ready ? setInterval ?
>>
>> > Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
>> > Function#defer / Function#delay. Have the code in question check its
>> > preconditions, and if they're not met, setTimeout/defer/delay itself.
>> > --
>> > T.J. Crowder
>> > Independent Software Consultant
>> > tj / crowder software / comwww.crowdersoftware.com
>>
>> > On Nov 21, 2:33 pm, maalek  wrote:
>>
>> > > Synchronous is simple way but object create time increses x3. How
>> > > function use to wait until all object is ready ? setInterval ?
>>
>> > > maaalek
>>
>> > > On 21 Lis, 14:32, "Alex McAuley" 
>> > > wrote:
>>
>> > > > Ask it to check a variable that is set as ready by all the others 
>> > > > ..
>> > > > or make
>> > > > it defer and be synchronous ..
>>
>> > > > Alex Mcauleyhttp://www.thevacancymarket.com
>>
>> > > > - Original Message -
>> > > > From: "maalek" 
>> > > > To: "Prototype & script.aculo.us"
>> > > > 
>> > > > Sent: Saturday, November 21, 2009 12:59 PM
>> > > > Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>>
>> > > > > Hello
>>
>> > > > > I have problem. When my page is load I build many objects (aprox 
>> > > > > 15)
>> > > > > by Ajax.Request (asynchronous : true) but last object I can 
>> > > > > create
>> > > > > when all previous object is ready. Any idea how do that ?
>>
>> > > > > maaalek
>>
>> > > > > --
>>
>> > > > > You received this message because you are subscribed to the 
>> > > > > Google
>> > > > > Groups
>> > > > > "Prototype & script.aculo.us" group.
>> > > > > To post to this group, send email to
>> > > > > prototype-scriptacul...@googlegroups.com.
>> > > > > To unsubscribe from this group, send email to
>> > > > > prototype-scriptaculous+unsubscr...@googlegroups.com.
>> > > > > For more options, visit this group at
>> > > > >http://groups.google.com/group/prototype-scriptaculous?hl=.
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Prototype & script.aculo.us" group.
>> To post to this group, send email to
>> prototype-scriptacul...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> prototype-scriptaculous+unsubscr...@googlegroups.com.
>> For more options, visit this group 
>> athttp://groups.google.com/group/prototype-scriptaculous?hl=.
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to 
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/prototype-scriptaculous?hl=.
>
>
> 

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-23 Thread david
Hi all,

if you need to save all returned value, just save each request result
in an array.
Check the length of the result list to know when all request are
finished.

But we still turn around the same idea.
--
david

On 23 nov, 15:59, "Alex McAuley" 
wrote:
> The main problem is that due to the "ansynchronous" and the wait times /
> serverside processing times ... you never know which will finish first nd if
> the last request relies on the first one completing then its going to hard
> fail !!...
>
> Each one needs to set a variable to say its complete !
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> - Original Message -
> From: "Eric" 
> To: "Prototype & script.aculo.us" 
> Sent: Monday, November 23, 2009 2:30 PM
> Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request
>
> Hi,
>
> I'd launch all Ajax.Request except the last one with a onSuccess
> handler that:
> - set a flag
> - if all flags are set, launch the last Ajax.Request
>
> This way, you don't have to use timer, or loop calling yourself
> recursively.
>
> Eric
>
> NB: I didn't test it, but you may increment a counter instead of using
> many flags
>
> On 21 nov, 23:31, "T.J. Crowder"  wrote:
> > Hi,
>
> > > Synchronous is simple way but object create time increses x3. How
> > > function use to wait until all object is ready ? setInterval ?
>
> > Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
> > Function#defer / Function#delay. Have the code in question check its
> > preconditions, and if they're not met, setTimeout/defer/delay itself.
> > --
> > T.J. Crowder
> > Independent Software Consultant
> > tj / crowder software / comwww.crowdersoftware.com
>
> > On Nov 21, 2:33 pm, maalek  wrote:
>
> > > Synchronous is simple way but object create time increses x3. How
> > > function use to wait until all object is ready ? setInterval ?
>
> > > maaalek
>
> > > On 21 Lis, 14:32, "Alex McAuley" 
> > > wrote:
>
> > > > Ask it to check a variable that is set as ready by all the others ..
> > > > or make
> > > > it defer and be synchronous ..
>
> > > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > > - Original Message -
> > > > From: "maalek" 
> > > > To: "Prototype & script.aculo.us"
> > > > 
> > > > Sent: Saturday, November 21, 2009 12:59 PM
> > > > Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>
> > > > > Hello
>
> > > > > I have problem. When my page is load I build many objects (aprox 15)
> > > > > by Ajax.Request (asynchronous : true) but last object I can create
> > > > > when all previous object is ready. Any idea how do that ?
>
> > > > > maaalek
>
> > > > > --
>
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups
> > > > > "Prototype & script.aculo.us" group.
> > > > > To post to this group, send email to
> > > > > prototype-scriptacul...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/prototype-scriptaculous?hl=.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




Re: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-23 Thread Alex McAuley
The main problem is that due to the "ansynchronous" and the wait times / 
serverside processing times ... you never know which will finish first nd if 
the last request relies on the first one completing then its going to hard 
fail !!...

Each one needs to set a variable to say its complete !



Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "Eric" 
To: "Prototype & script.aculo.us" 
Sent: Monday, November 23, 2009 2:30 PM
Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request


Hi,

I'd launch all Ajax.Request except the last one with a onSuccess
handler that:
- set a flag
- if all flags are set, launch the last Ajax.Request

This way, you don't have to use timer, or loop calling yourself
recursively.

Eric

NB: I didn't test it, but you may increment a counter instead of using
many flags



On 21 nov, 23:31, "T.J. Crowder"  wrote:
> Hi,
>
> > Synchronous is simple way but object create time increses x3. How
> > function use to wait until all object is ready ? setInterval ?
>
> Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
> Function#defer / Function#delay. Have the code in question check its
> preconditions, and if they're not met, setTimeout/defer/delay itself.
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Nov 21, 2:33 pm, maalek  wrote:
>
> > Synchronous is simple way but object create time increses x3. How
> > function use to wait until all object is ready ? setInterval ?
>
> > maaalek
>
> > On 21 Lis, 14:32, "Alex McAuley" 
> > wrote:
>
> > > Ask it to check a variable that is set as ready by all the others .. 
> > > or make
> > > it defer and be synchronous ..
>
> > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > - Original Message -
> > > From: "maalek" 
> > > To: "Prototype & script.aculo.us" 
> > > 
> > > Sent: Saturday, November 21, 2009 12:59 PM
> > > Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>
> > > > Hello
>
> > > > I have problem. When my page is load I build many objects (aprox 15)
> > > > by Ajax.Request (asynchronous : true) but last object I can create
> > > > when all previous object is ready. Any idea how do that ?
>
> > > > maaalek
>
> > > > --
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Prototype & script.aculo.us" group.
> > > > To post to this group, send email to
> > > > prototype-scriptacul...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/prototype-scriptaculous?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to 
prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.



--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-23 Thread Eric
Hi,

I'd launch all Ajax.Request except the last one with a onSuccess
handler that:
- set a flag
- if all flags are set, launch the last Ajax.Request

This way, you don't have to use timer, or loop calling yourself
recursively.

Eric

NB: I didn't test it, but you may increment a counter instead of using
many flags



On 21 nov, 23:31, "T.J. Crowder"  wrote:
> Hi,
>
> > Synchronous is simple way but object create time increses x3. How
> > function use to wait until all object is ready ? setInterval ?
>
> Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
> Function#defer / Function#delay. Have the code in question check its
> preconditions, and if they're not met, setTimeout/defer/delay itself.
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Nov 21, 2:33 pm, maalek  wrote:
>
> > Synchronous is simple way but object create time increses x3. How
> > function use to wait until all object is ready ? setInterval ?
>
> > maaalek
>
> > On 21 Lis, 14:32, "Alex McAuley" 
> > wrote:
>
> > > Ask it to check a variable that is set as ready by all the others .. or 
> > > make
> > > it defer and be synchronous ..
>
> > > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > > - Original Message -
> > > From: "maalek" 
> > > To: "Prototype & script.aculo.us" 
> > > 
> > > Sent: Saturday, November 21, 2009 12:59 PM
> > > Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>
> > > > Hello
>
> > > > I have problem. When my page is load I build many objects (aprox 15)
> > > > by Ajax.Request (asynchronous : true) but last object I can create
> > > > when all previous object is ready. Any idea how do that ?
>
> > > > maaalek
>
> > > > --
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Prototype & script.aculo.us" group.
> > > > To post to this group, send email to
> > > > prototype-scriptacul...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/prototype-scriptaculous?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-21 Thread T.J. Crowder
Hi,

> Synchronous is simple way but object create time increses x3. How
> function use to wait until all object is ready ? setInterval ?

Probably setTimeout, but yeah; or setTimeout's Prototype wrappers
Function#defer / Function#delay. Have the code in question check its
preconditions, and if they're not met, setTimeout/defer/delay itself.
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Nov 21, 2:33 pm, maalek  wrote:
> Synchronous is simple way but object create time increses x3. How
> function use to wait until all object is ready ? setInterval ?
>
> maaalek
>
> On 21 Lis, 14:32, "Alex McAuley" 
> wrote:
>
>
>
> > Ask it to check a variable that is set as ready by all the others .. or make
> > it defer and be synchronous ..
>
> > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > - Original Message -
> > From: "maalek" 
> > To: "Prototype & script.aculo.us" 
> > Sent: Saturday, November 21, 2009 12:59 PM
> > Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>
> > > Hello
>
> > > I have problem. When my page is load I build many objects (aprox 15)
> > > by Ajax.Request (asynchronous : true) but last object I can create
> > > when all previous object is ready. Any idea how do that ?
>
> > > maaalek
>
> > > --
>
> > > You received this message because you are subscribed to the Google Groups
> > > "Prototype & script.aculo.us" group.
> > > To post to this group, send email to
> > > prototype-scriptacul...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/prototype-scriptaculous?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




Re: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-21 Thread Alex McAuley
You need to set variables in the objects/ requests  and check them



Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "maalek" 
To: "Prototype & script.aculo.us" 
Sent: Saturday, November 21, 2009 2:33 PM
Subject: [Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request


> Synchronous is simple way but object create time increses x3. How
> function use to wait until all object is ready ? setInterval ?
>
> maaalek
>
> On 21 Lis, 14:32, "Alex McAuley" 
> wrote:
>> Ask it to check a variable that is set as ready by all the others .. or 
>> make
>> it defer and be synchronous ..
>>
>> Alex Mcauleyhttp://www.thevacancymarket.com
>>
>> - Original Message -
>> From: "maalek" 
>> To: "Prototype & script.aculo.us" 
>> 
>> Sent: Saturday, November 21, 2009 12:59 PM
>> Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>>
>> > Hello
>>
>> > I have problem. When my page is load I build many objects (aprox 15)
>> > by Ajax.Request (asynchronous : true) but last object I can create
>> > when all previous object is ready. Any idea how do that ?
>>
>> > maaalek
>>
>> > --
>>
>> > You received this message because you are subscribed to the Google 
>> > Groups
>> > "Prototype & script.aculo.us" group.
>> > To post to this group, send email to
>> > prototype-scriptacul...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > prototype-scriptaculous+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/prototype-scriptaculous?hl=.
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to 
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/prototype-scriptaculous?hl=.
>
>
> 

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.




[Proto-Scripty] Re: Sychronize many asynchronous Ajax.Request

2009-11-21 Thread maalek
Synchronous is simple way but object create time increses x3. How
function use to wait until all object is ready ? setInterval ?

maaalek

On 21 Lis, 14:32, "Alex McAuley" 
wrote:
> Ask it to check a variable that is set as ready by all the others .. or make
> it defer and be synchronous ..
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> - Original Message -
> From: "maalek" 
> To: "Prototype & script.aculo.us" 
> Sent: Saturday, November 21, 2009 12:59 PM
> Subject: [Proto-Scripty] Sychronize many asynchronous Ajax.Request
>
> > Hello
>
> > I have problem. When my page is load I build many objects (aprox 15)
> > by Ajax.Request (asynchronous : true) but last object I can create
> > when all previous object is ready. Any idea how do that ?
>
> > maaalek
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Prototype & script.aculo.us" group.
> > To post to this group, send email to
> > prototype-scriptacul...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/prototype-scriptaculous?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.