Re: [Proto-Scripty] Re: Progressive update messages from single request

2009-12-13 Thread Alex McAuley
Joe.

Certainly in winblows the output buffering may not work due to the modules 
and the way memory is managed in winblows differs to *nix.

I have tested it on CentOs, Debian, BSD, HP UNIX,Solaris and it works fine 
but not tested it on Wamp...


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: joe t. thooke...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Sunday, December 13, 2009 12:49 AM
Subject: [Proto-Scripty] Re: Progressive update messages from single request


My crude-imentary tests are on my Win7 laptop using Wamp, which means
mod_deflate. Work server is Cent, but i don't know whether it's got
any compression modules enabled (i've tried with the admin, he
slacks).
-joe t.


On Dec 12, 4:17 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Joe.

 Are you using ob_gz_handler(); or mod_defalte / mod_gzip ?

 Also is it a winblows or *nix server

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: joe t. thooke...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Saturday, December 12, 2009 2:24 AM
 Subject: [Proto-Scripty] Re: Progressive update messages from single 
 request

 Alex,
 Thanks for the sample. i must be missing a piece somewhere 
 though...http://pastie.org/739926

 From that single Ajax.Request, the client delays, and after the PHP is
 done running, i get the complete output in one block. What i'd
 anticipated was that in each loop, the flush() would somehow send that
 output to the client where it could be used, then the next loop's
 flush would send another output to the client...

 If i'm understanding it, Ajax is a single-request-single-response. i
 can't output the current step a process is in as it happens. i can
 accumulate them, as your model shows, and dump that out as a log, of
 sorts. But in order to monitor progress of one request's processing on
 the server, a series of follow-ups have to get feedback which the
 original is providing on the side (as T.J. recommended).

 Unless i'm missing something, which would be great if you could help
 me fill that in. :)
 -joe t.

 On Dec 11, 3:29 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  in your ajax request file

  ?php
  ini_set('output_buffering',0); // make sure the output_buffering 
  directive
  is not set high
  ob_start(); // before anything is echoed to the screen

  for($i=0;$i10;$i++)
  {
  echo('liPrinting Line '.$i.'/li');
  ob_flush();
  flush();

  sleep(1); // sleep for one second

  }

  ?
  this will output a line every second for 10 seconds

  Hope this helps

  P.S if you use ob_gz_handler this may not work (untested using it)

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: joe t. thooke...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, December 11, 2009 1:00 AM
  Subject: [Proto-Scripty] Re: Progressive update messages from single
  request

  david:
  The buffer/flush path seems to be where this solution is heading.
  Don't ask me why, but iframes rub me the wrong way. With the evolving
  needs for more streamlined connections, iframes feel like soggy
  bandaids to me. Given they have a place where nothing else seems to
  work (Ajax-ish file uploads), but i'd prefer to steer away from them
  in this case if i can.

  TJ:
  That seems like a fairly solid idea. Same general concept of having a
  second request object checking in on progress that the server reports
  back, it just gets it from a relatively more reliable source (instead
  of $_SESSION).

  Alex:
  Could you elaborate a bit, or point me to where i can follow up on
  that? i'm intrigued, but i'm not deeply familiar with using the output
  buffer effectively.

  Thanks for the replies!
  -joe t.

  On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
   I noticed you were using PHP on the server side ... you can also use
   output
   buffering to achieve this in one request

   Alex Mcauleyhttp://www.thevacancymarket.com

   - Original Message -
   From: T.J. Crowder t...@crowdersoftware.com
   To: Prototype  script.aculo.us
   prototype-scriptaculous@googlegroups.com
   Sent: Thursday, December 10, 2009 8:38 AM
   Subject: [Proto-Scripty] Re: Progressive update messages from single
   request

   Hi Joe,

   It seems to me the simple way to do this is have the first request
   initiate a process on the server that keeps running when the request
   completes; the request returns an indicator of the current status and
   an identifier for the action.

   Your subsequent requests supply the identifer, which allows the 
   server-
   side page to check the progress of the ongoing work matching that ID
   and report back the (new) status.

   People use things like this for showing progress bars for file uploads
   without using Flash, that kind of thing.

   HTH

Re: [Proto-Scripty] Re: Progressive update messages from single request

2009-12-12 Thread Alex McAuley
Joe.

Are you using ob_gz_handler(); or mod_defalte / mod_gzip ?

Also is  it a winblows or *nix server

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: joe t. thooke...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Saturday, December 12, 2009 2:24 AM
Subject: [Proto-Scripty] Re: Progressive update messages from single request


Alex,
Thanks for the sample. i must be missing a piece somewhere though...
http://pastie.org/739926

From that single Ajax.Request, the client delays, and after the PHP is
done running, i get the complete output in one block. What i'd
anticipated was that in each loop, the flush() would somehow send that
output to the client where it could be used, then the next loop's
flush would send another output to the client...

If i'm understanding it, Ajax is a single-request-single-response. i
can't output the current step a process is in as it happens. i can
accumulate them, as your model shows, and dump that out as a log, of
sorts. But in order to monitor progress of one request's processing on
the server, a series of follow-ups have to get feedback which the
original is providing on the side (as T.J. recommended).

Unless i'm missing something, which would be great if you could help
me fill that in. :)
-joe t.


On Dec 11, 3:29 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 in your ajax request file

 ?php
 ini_set('output_buffering',0); // make sure the output_buffering directive
 is not set high
 ob_start(); // before anything is echoed to the screen

 for($i=0;$i10;$i++)
 {
 echo('liPrinting Line '.$i.'/li');
 ob_flush();
 flush();

 sleep(1); // sleep for one second

 }

 ?
 this will output a line every second for 10 seconds

 Hope this helps

 P.S if you use ob_gz_handler this may not work (untested using it)

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: joe t. thooke...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Friday, December 11, 2009 1:00 AM
 Subject: [Proto-Scripty] Re: Progressive update messages from single 
 request

 david:
 The buffer/flush path seems to be where this solution is heading.
 Don't ask me why, but iframes rub me the wrong way. With the evolving
 needs for more streamlined connections, iframes feel like soggy
 bandaids to me. Given they have a place where nothing else seems to
 work (Ajax-ish file uploads), but i'd prefer to steer away from them
 in this case if i can.

 TJ:
 That seems like a fairly solid idea. Same general concept of having a
 second request object checking in on progress that the server reports
 back, it just gets it from a relatively more reliable source (instead
 of $_SESSION).

 Alex:
 Could you elaborate a bit, or point me to where i can follow up on
 that? i'm intrigued, but i'm not deeply familiar with using the output
 buffer effectively.

 Thanks for the replies!
 -joe t.

 On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  I noticed you were using PHP on the server side ... you can also use
  output
  buffering to achieve this in one request

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: T.J. Crowder t...@crowdersoftware.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Thursday, December 10, 2009 8:38 AM
  Subject: [Proto-Scripty] Re: Progressive update messages from single
  request

  Hi Joe,

  It seems to me the simple way to do this is have the first request
  initiate a process on the server that keeps running when the request
  completes; the request returns an indicator of the current status and
  an identifier for the action.

  Your subsequent requests supply the identifer, which allows the server-
  side page to check the progress of the ongoing work matching that ID
  and report back the (new) status.

  People use things like this for showing progress bars for file uploads
  without using Flash, that kind of thing.

  HTH,
  --
  T.J. Crowder
  Independent Software Consultant
  tj / crowder software / comwww.crowdersoftware.com

  On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote:
   i think i've seen examples of this, but can't recall where, and could
   use some guidance.

   Obviously it's easy to handle a 1:1 Request/Response

   How can i do a true 1:many process? For instance:
   Client takes a single action which requires the server to perform 3
   tasks:
   * Query database
   * Generate PDF
   * Generate email, attach PDF, and send

   How can i respond to the client as EACH task is accomplished without
   ending the request chain?
   Looking up your data . . . (time-based dots as delay indicator)
   Creating PDF . . .
   Email sent (or failed, as the case may be)

   Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
   point me in the right direction (which include samples), i'd be
   grateful.

   Thanks

[Proto-Scripty] Re: Progressive update messages from single request

2009-12-12 Thread joe t.
My crude-imentary tests are on my Win7 laptop using Wamp, which means
mod_deflate. Work server is Cent, but i don't know whether it's got
any compression modules enabled (i've tried with the admin, he
slacks).
-joe t.


On Dec 12, 4:17 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Joe.

 Are you using ob_gz_handler(); or mod_defalte / mod_gzip ?

 Also is  it a winblows or *nix server

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: joe t. thooke...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Saturday, December 12, 2009 2:24 AM
 Subject: [Proto-Scripty] Re: Progressive update messages from single request

 Alex,
 Thanks for the sample. i must be missing a piece somewhere 
 though...http://pastie.org/739926

 From that single Ajax.Request, the client delays, and after the PHP is
 done running, i get the complete output in one block. What i'd
 anticipated was that in each loop, the flush() would somehow send that
 output to the client where it could be used, then the next loop's
 flush would send another output to the client...

 If i'm understanding it, Ajax is a single-request-single-response. i
 can't output the current step a process is in as it happens. i can
 accumulate them, as your model shows, and dump that out as a log, of
 sorts. But in order to monitor progress of one request's processing on
 the server, a series of follow-ups have to get feedback which the
 original is providing on the side (as T.J. recommended).

 Unless i'm missing something, which would be great if you could help
 me fill that in. :)
 -joe t.

 On Dec 11, 3:29 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  in your ajax request file

  ?php
  ini_set('output_buffering',0); // make sure the output_buffering directive
  is not set high
  ob_start(); // before anything is echoed to the screen

  for($i=0;$i10;$i++)
  {
  echo('liPrinting Line '.$i.'/li');
  ob_flush();
  flush();

  sleep(1); // sleep for one second

  }

  ?
  this will output a line every second for 10 seconds

  Hope this helps

  P.S if you use ob_gz_handler this may not work (untested using it)

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: joe t. thooke...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, December 11, 2009 1:00 AM
  Subject: [Proto-Scripty] Re: Progressive update messages from single
  request

  david:
  The buffer/flush path seems to be where this solution is heading.
  Don't ask me why, but iframes rub me the wrong way. With the evolving
  needs for more streamlined connections, iframes feel like soggy
  bandaids to me. Given they have a place where nothing else seems to
  work (Ajax-ish file uploads), but i'd prefer to steer away from them
  in this case if i can.

  TJ:
  That seems like a fairly solid idea. Same general concept of having a
  second request object checking in on progress that the server reports
  back, it just gets it from a relatively more reliable source (instead
  of $_SESSION).

  Alex:
  Could you elaborate a bit, or point me to where i can follow up on
  that? i'm intrigued, but i'm not deeply familiar with using the output
  buffer effectively.

  Thanks for the replies!
  -joe t.

  On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
   I noticed you were using PHP on the server side ... you can also use
   output
   buffering to achieve this in one request

   Alex Mcauleyhttp://www.thevacancymarket.com

   - Original Message -
   From: T.J. Crowder t...@crowdersoftware.com
   To: Prototype  script.aculo.us
   prototype-scriptaculous@googlegroups.com
   Sent: Thursday, December 10, 2009 8:38 AM
   Subject: [Proto-Scripty] Re: Progressive update messages from single
   request

   Hi Joe,

   It seems to me the simple way to do this is have the first request
   initiate a process on the server that keeps running when the request
   completes; the request returns an indicator of the current status and
   an identifier for the action.

   Your subsequent requests supply the identifer, which allows the server-
   side page to check the progress of the ongoing work matching that ID
   and report back the (new) status.

   People use things like this for showing progress bars for file uploads
   without using Flash, that kind of thing.

   HTH,
   --
   T.J. Crowder
   Independent Software Consultant
   tj / crowder software / comwww.crowdersoftware.com

   On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote:
i think i've seen examples of this, but can't recall where, and could
use some guidance.

Obviously it's easy to handle a 1:1 Request/Response

How can i do a true 1:many process? For instance:
Client takes a single action which requires the server to perform 3
tasks:
* Query database
* Generate PDF
* Generate email, attach PDF, and send

How can i

Re: [Proto-Scripty] Re: Progressive update messages from single request

2009-12-11 Thread Alex McAuley
in your ajax request file

?php
ini_set('output_buffering',0); // make sure the output_buffering directive 
is not set high
ob_start(); // before anything is echoed to the screen

for($i=0;$i10;$i++)
{
echo('liPrinting Line '.$i.'/li');
ob_flush();
flush();

sleep(1); //  sleep for one second
}

?
this will output a line every second for 10 seconds

Hope this helps

P.S if you use ob_gz_handler this may not work (untested using it)


Alex Mcauley
http://www.thevacancymarket.com


- Original Message - 
From: joe t. thooke...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Friday, December 11, 2009 1:00 AM
Subject: [Proto-Scripty] Re: Progressive update messages from single request


david:
The buffer/flush path seems to be where this solution is heading.
Don't ask me why, but iframes rub me the wrong way. With the evolving
needs for more streamlined connections, iframes feel like soggy
bandaids to me. Given they have a place where nothing else seems to
work (Ajax-ish file uploads), but i'd prefer to steer away from them
in this case if i can.

TJ:
That seems like a fairly solid idea. Same general concept of having a
second request object checking in on progress that the server reports
back, it just gets it from a relatively more reliable source (instead
of $_SESSION).

Alex:
Could you elaborate a bit, or point me to where i can follow up on
that? i'm intrigued, but i'm not deeply familiar with using the output
buffer effectively.

Thanks for the replies!
-joe t.


On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 I noticed you were using PHP on the server side ... you can also use 
 output
 buffering to achieve this in one request

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: T.J. Crowder t...@crowdersoftware.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Thursday, December 10, 2009 8:38 AM
 Subject: [Proto-Scripty] Re: Progressive update messages from single 
 request

 Hi Joe,

 It seems to me the simple way to do this is have the first request
 initiate a process on the server that keeps running when the request
 completes; the request returns an indicator of the current status and
 an identifier for the action.

 Your subsequent requests supply the identifer, which allows the server-
 side page to check the progress of the ongoing work matching that ID
 and report back the (new) status.

 People use things like this for showing progress bars for file uploads
 without using Flash, that kind of thing.

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote:
  i think i've seen examples of this, but can't recall where, and could
  use some guidance.

  Obviously it's easy to handle a 1:1 Request/Response

  How can i do a true 1:many process? For instance:
  Client takes a single action which requires the server to perform 3
  tasks:
  * Query database
  * Generate PDF
  * Generate email, attach PDF, and send

  How can i respond to the client as EACH task is accomplished without
  ending the request chain?
  Looking up your data . . . (time-based dots as delay indicator)
  Creating PDF . . .
  Email sent (or failed, as the case may be)

  Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
  point me in the right direction (which include samples), i'd be
  grateful.

  Thanks.
  -joe t.

 --

 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=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.



--

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: Progressive update messages from single request

2009-12-11 Thread joe t.
Alex,
Thanks for the sample. i must be missing a piece somewhere though...
http://pastie.org/739926

From that single Ajax.Request, the client delays, and after the PHP is
done running, i get the complete output in one block. What i'd
anticipated was that in each loop, the flush() would somehow send that
output to the client where it could be used, then the next loop's
flush would send another output to the client...

If i'm understanding it, Ajax is a single-request-single-response. i
can't output the current step a process is in as it happens. i can
accumulate them, as your model shows, and dump that out as a log, of
sorts. But in order to monitor progress of one request's processing on
the server, a series of follow-ups have to get feedback which the
original is providing on the side (as T.J. recommended).

Unless i'm missing something, which would be great if you could help
me fill that in. :)
-joe t.


On Dec 11, 3:29 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 in your ajax request file

 ?php
 ini_set('output_buffering',0); // make sure the output_buffering directive
 is not set high
 ob_start(); // before anything is echoed to the screen

 for($i=0;$i10;$i++)
 {
     echo('liPrinting Line '.$i.'/li');
     ob_flush();
     flush();

     sleep(1); //  sleep for one second

 }

 ?
 this will output a line every second for 10 seconds

 Hope this helps

 P.S if you use ob_gz_handler this may not work (untested using it)

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: joe t. thooke...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Friday, December 11, 2009 1:00 AM
 Subject: [Proto-Scripty] Re: Progressive update messages from single request

 david:
 The buffer/flush path seems to be where this solution is heading.
 Don't ask me why, but iframes rub me the wrong way. With the evolving
 needs for more streamlined connections, iframes feel like soggy
 bandaids to me. Given they have a place where nothing else seems to
 work (Ajax-ish file uploads), but i'd prefer to steer away from them
 in this case if i can.

 TJ:
 That seems like a fairly solid idea. Same general concept of having a
 second request object checking in on progress that the server reports
 back, it just gets it from a relatively more reliable source (instead
 of $_SESSION).

 Alex:
 Could you elaborate a bit, or point me to where i can follow up on
 that? i'm intrigued, but i'm not deeply familiar with using the output
 buffer effectively.

 Thanks for the replies!
 -joe t.

 On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  I noticed you were using PHP on the server side ... you can also use
  output
  buffering to achieve this in one request

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: T.J. Crowder t...@crowdersoftware.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Thursday, December 10, 2009 8:38 AM
  Subject: [Proto-Scripty] Re: Progressive update messages from single
  request

  Hi Joe,

  It seems to me the simple way to do this is have the first request
  initiate a process on the server that keeps running when the request
  completes; the request returns an indicator of the current status and
  an identifier for the action.

  Your subsequent requests supply the identifer, which allows the server-
  side page to check the progress of the ongoing work matching that ID
  and report back the (new) status.

  People use things like this for showing progress bars for file uploads
  without using Flash, that kind of thing.

  HTH,
  --
  T.J. Crowder
  Independent Software Consultant
  tj / crowder software / comwww.crowdersoftware.com

  On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote:
   i think i've seen examples of this, but can't recall where, and could
   use some guidance.

   Obviously it's easy to handle a 1:1 Request/Response

   How can i do a true 1:many process? For instance:
   Client takes a single action which requires the server to perform 3
   tasks:
   * Query database
   * Generate PDF
   * Generate email, attach PDF, and send

   How can i respond to the client as EACH task is accomplished without
   ending the request chain?
   Looking up your data . . . (time-based dots as delay indicator)
   Creating PDF . . .
   Email sent (or failed, as the case may be)

   Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
   point me in the right direction (which include samples), i'd be
   grateful.

   Thanks.
   -joe t.

  --

  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

[Proto-Scripty] Re: Progressive update messages from single request

2009-12-10 Thread david
Hi joe,

I think that what you try to do could not be handle with AJAX.request
().
In fact you'll receive control on a callback in the AJAX.request()
when the response is complete in the browser.

What you could do is a pure HTML solution:
create an iFrame inside your page, and set its location to the request
you made, next treat this request in server and use flush() function
to send a part of the response a

On 9 déc, 22:51, joe t. thooke...@gmail.com wrote:
 Thanks for the response Walter.

 i can see where you're going with that, but in those successively
 created new Ajax.Request calls, it's generating a new request to the
 server, which runs the server-side routine from the beginning, right?
 In my concept, the first call commands the server to run all three
 steps:

 Client Request 1 --
   Collect the data (send feedback to client) --
   Create the PDF (send feedback to client) --
   Attach to an email and send (send final feedback)
 End

 Where your structure more resembles:

 Client Request 1 --
   Collect data (send Feedback 1) --
   Client Request 2 --
     Create PDF (send Feedback 2) --
     Client Request 3 --
       Attach and email (send Feedback 3)
 End

 Am i correct? If so, that works only to the amount of detail i provide
 nested invocations of Ajax.Request to check/perform one specific
 detail of progress. Keep in mind this is only an example: what if i
 need feedback during the attachment process (attaching 1 of 100
 files)? For one, it would be nasty to nest that many Ajax.Request
 calls, and more importantly, that email object only exists within the
 request that creates and processes it. The second request to attach
 file 2 of 100 isn't working on the same email object (as i understand
 it).

 i did find one QA similar to this where it was suggested to use
 $_SESSION for the current progress message... The initial Request gets
 the server going on the task, and also creates a second Request that
 repeats (eg, Ajax.PeriodicalUpdater). That one does nothing more than
 check $_SESSION for the latest message (which gets updated by the task
 being performed). That feels slightly better to me, despite the
 potential traffic overhead for longer requests (hence the {decay}
 option, i suppose).

 Something for me to chew on, i suppose.

 Thanks again,
 -joe t.

 On Dec 9, 1:22 pm, Walter Lee Davis wa...@wdstudio.com wrote:

  I would do this with chained onSuccess handlers. Each one would  
  trigger a new request to a different endpoint, carrying some token to  
  identify the visitor.

  $('button').observe('click',function(evt){
          //do your lookup
          new Ajax.Request('lookup.php',{
                  parameters:{id:'?=$id?'},
                  onCreate:function(){
                          $('message').update('searching...');;
                  },
                  onSuccess:function(transport){
                          //make your pdf
                          $('message').update('making PDF...');;
                          new Ajax.Request('pdf.php',{
                                  parameters:{id:'?=$id?'},
                                  onCreate:..., //you get the idea
                                  onSuccess:...
                          });
                  }
          }};

  });

  Walter

  On Dec 9, 2009, at 11:11 AM, joe t. wrote:

   i think i've seen examples of this, but can't recall where, and could
   use some guidance.

   Obviously it's easy to handle a 1:1 Request/Response

   How can i do a true 1:many process? For instance:
   Client takes a single action which requires the server to perform 3
   tasks:
   * Query database
   * Generate PDF
   * Generate email, attach PDF, and send

   How can i respond to the client as EACH task is accomplished without
   ending the request chain?
   Looking up your data . . . (time-based dots as delay indicator)
   Creating PDF . . .
   Email sent (or failed, as the case may be)

   Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
   point me in the right direction (which include samples), i'd be
   grateful.

   Thanks.
   -joe t.

   --

   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-scriptaculous@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=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: Progressive update messages from single request

2009-12-10 Thread david
Hi again,
I'm having big finger this morning :))
so let's continue:

What you could do is a pure HTML solution:
create an iFrame inside your page, and set its location to the request
you made, next treat this request in the server and use flush()
function (in PHP)
to send a part of the response. This could be Looking up your data 
and at each server styep, just flush() a dot to indicate progression.
Then continue like this to indicate the progression inside the iFrame.

When finish, just remove the iFrame to indicate it's finished to the
user.

--
david


On 10 déc, 09:13, david david.brill...@gmail.com wrote:
 Hi joe,

 I think that what you try to do could not be handle with AJAX.request
 ().
 In fact you'll receive control on a callback in the AJAX.request()
 when the response is complete in the browser.

 What you could do is a pure HTML solution:
 create an iFrame inside your page, and set its location to the request
 you made, next treat this request in server and use flush() function
 to send a part of the response a

 On 9 déc, 22:51, joe t. thooke...@gmail.com wrote:

  Thanks for the response Walter.

  i can see where you're going with that, but in those successively
  created new Ajax.Request calls, it's generating a new request to the
  server, which runs the server-side routine from the beginning, right?
  In my concept, the first call commands the server to run all three
  steps:

  Client Request 1 --
    Collect the data (send feedback to client) --
    Create the PDF (send feedback to client) --
    Attach to an email and send (send final feedback)
  End

  Where your structure more resembles:

  Client Request 1 --
    Collect data (send Feedback 1) --
    Client Request 2 --
      Create PDF (send Feedback 2) --
      Client Request 3 --
        Attach and email (send Feedback 3)
  End

  Am i correct? If so, that works only to the amount of detail i provide
  nested invocations of Ajax.Request to check/perform one specific
  detail of progress. Keep in mind this is only an example: what if i
  need feedback during the attachment process (attaching 1 of 100
  files)? For one, it would be nasty to nest that many Ajax.Request
  calls, and more importantly, that email object only exists within the
  request that creates and processes it. The second request to attach
  file 2 of 100 isn't working on the same email object (as i understand
  it).

  i did find one QA similar to this where it was suggested to use
  $_SESSION for the current progress message... The initial Request gets
  the server going on the task, and also creates a second Request that
  repeats (eg, Ajax.PeriodicalUpdater). That one does nothing more than
  check $_SESSION for the latest message (which gets updated by the task
  being performed). That feels slightly better to me, despite the
  potential traffic overhead for longer requests (hence the {decay}
  option, i suppose).

  Something for me to chew on, i suppose.

  Thanks again,
  -joe t.

  On Dec 9, 1:22 pm, Walter Lee Davis wa...@wdstudio.com wrote:

   I would do this with chained onSuccess handlers. Each one would  
   trigger a new request to a different endpoint, carrying some token to  
   identify the visitor.

   $('button').observe('click',function(evt){
           //do your lookup
           new Ajax.Request('lookup.php',{
                   parameters:{id:'?=$id?'},
                   onCreate:function(){
                           $('message').update('searching...');;
                   },
                   onSuccess:function(transport){
                           //make your pdf
                           $('message').update('making PDF...');;
                           new Ajax.Request('pdf.php',{
                                   parameters:{id:'?=$id?'},
                                   onCreate:..., //you get the idea
                                   onSuccess:...
                           });
                   }
           }};

   });

   Walter

   On Dec 9, 2009, at 11:11 AM, joe t. wrote:

i think i've seen examples of this, but can't recall where, and could
use some guidance.

Obviously it's easy to handle a 1:1 Request/Response

How can i do a true 1:many process? For instance:
Client takes a single action which requires the server to perform 3
tasks:
* Query database
* Generate PDF
* Generate email, attach PDF, and send

How can i respond to the client as EACH task is accomplished without
ending the request chain?
Looking up your data . . . (time-based dots as delay indicator)
Creating PDF . . .
Email sent (or failed, as the case may be)

Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
point me in the right direction (which include samples), i'd be
grateful.

Thanks.
-joe t.

--

You received this message because you are subscribed to the Google  
Groups Prototype  script.aculo.us group.
To post to this group, send 

[Proto-Scripty] Re: Progressive update messages from single request

2009-12-10 Thread T.J. Crowder
Hi Joe,

It seems to me the simple way to do this is have the first request
initiate a process on the server that keeps running when the request
completes; the request returns an indicator of the current status and
an identifier for the action.

Your subsequent requests supply the identifer, which allows the server-
side page to check the progress of the ongoing work matching that ID
and report back the (new) status.

People use things like this for showing progress bars for file uploads
without using Flash, that kind of thing.

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote:
 i think i've seen examples of this, but can't recall where, and could
 use some guidance.

 Obviously it's easy to handle a 1:1 Request/Response

 How can i do a true 1:many process? For instance:
 Client takes a single action which requires the server to perform 3
 tasks:
 * Query database
 * Generate PDF
 * Generate email, attach PDF, and send

 How can i respond to the client as EACH task is accomplished without
 ending the request chain?
 Looking up your data . . . (time-based dots as delay indicator)
 Creating PDF . . .
 Email sent (or failed, as the case may be)

 Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
 point me in the right direction (which include samples), i'd be
 grateful.

 Thanks.
 -joe t.

--

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.




Re: [Proto-Scripty] Re: Progressive update messages from single request

2009-12-10 Thread Alex McAuley
I noticed you were using PHP on the server side ... you can also use output 
buffering to achieve this in one request


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: T.J. Crowder t...@crowdersoftware.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, December 10, 2009 8:38 AM
Subject: [Proto-Scripty] Re: Progressive update messages from single request


Hi Joe,

It seems to me the simple way to do this is have the first request
initiate a process on the server that keeps running when the request
completes; the request returns an indicator of the current status and
an identifier for the action.

Your subsequent requests supply the identifer, which allows the server-
side page to check the progress of the ongoing work matching that ID
and report back the (new) status.

People use things like this for showing progress bars for file uploads
without using Flash, that kind of thing.

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote:
 i think i've seen examples of this, but can't recall where, and could
 use some guidance.

 Obviously it's easy to handle a 1:1 Request/Response

 How can i do a true 1:many process? For instance:
 Client takes a single action which requires the server to perform 3
 tasks:
 * Query database
 * Generate PDF
 * Generate email, attach PDF, and send

 How can i respond to the client as EACH task is accomplished without
 ending the request chain?
 Looking up your data . . . (time-based dots as delay indicator)
 Creating PDF . . .
 Email sent (or failed, as the case may be)

 Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
 point me in the right direction (which include samples), i'd be
 grateful.

 Thanks.
 -joe t.

--

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: Progressive update messages from single request

2009-12-10 Thread joe t.
david:
The buffer/flush path seems to be where this solution is heading.
Don't ask me why, but iframes rub me the wrong way. With the evolving
needs for more streamlined connections, iframes feel like soggy
bandaids to me. Given they have a place where nothing else seems to
work (Ajax-ish file uploads), but i'd prefer to steer away from them
in this case if i can.

TJ:
That seems like a fairly solid idea. Same general concept of having a
second request object checking in on progress that the server reports
back, it just gets it from a relatively more reliable source (instead
of $_SESSION).

Alex:
Could you elaborate a bit, or point me to where i can follow up on
that? i'm intrigued, but i'm not deeply familiar with using the output
buffer effectively.

Thanks for the replies!
-joe t.


On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 I noticed you were using PHP on the server side ... you can also use output
 buffering to achieve this in one request

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: T.J. Crowder t...@crowdersoftware.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Thursday, December 10, 2009 8:38 AM
 Subject: [Proto-Scripty] Re: Progressive update messages from single request

 Hi Joe,

 It seems to me the simple way to do this is have the first request
 initiate a process on the server that keeps running when the request
 completes; the request returns an indicator of the current status and
 an identifier for the action.

 Your subsequent requests supply the identifer, which allows the server-
 side page to check the progress of the ongoing work matching that ID
 and report back the (new) status.

 People use things like this for showing progress bars for file uploads
 without using Flash, that kind of thing.

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote:
  i think i've seen examples of this, but can't recall where, and could
  use some guidance.

  Obviously it's easy to handle a 1:1 Request/Response

  How can i do a true 1:many process? For instance:
  Client takes a single action which requires the server to perform 3
  tasks:
  * Query database
  * Generate PDF
  * Generate email, attach PDF, and send

  How can i respond to the client as EACH task is accomplished without
  ending the request chain?
  Looking up your data . . . (time-based dots as delay indicator)
  Creating PDF . . .
  Email sent (or failed, as the case may be)

  Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
  point me in the right direction (which include samples), i'd be
  grateful.

  Thanks.
  -joe t.

 --

 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=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: Progressive update messages from single request

2009-12-09 Thread joe t.
Thanks for the response Walter.

i can see where you're going with that, but in those successively
created new Ajax.Request calls, it's generating a new request to the
server, which runs the server-side routine from the beginning, right?
In my concept, the first call commands the server to run all three
steps:

Client Request 1 --
  Collect the data (send feedback to client) --
  Create the PDF (send feedback to client) --
  Attach to an email and send (send final feedback)
End

Where your structure more resembles:

Client Request 1 --
  Collect data (send Feedback 1) --
  Client Request 2 --
Create PDF (send Feedback 2) --
Client Request 3 --
  Attach and email (send Feedback 3)
End

Am i correct? If so, that works only to the amount of detail i provide
nested invocations of Ajax.Request to check/perform one specific
detail of progress. Keep in mind this is only an example: what if i
need feedback during the attachment process (attaching 1 of 100
files)? For one, it would be nasty to nest that many Ajax.Request
calls, and more importantly, that email object only exists within the
request that creates and processes it. The second request to attach
file 2 of 100 isn't working on the same email object (as i understand
it).

i did find one QA similar to this where it was suggested to use
$_SESSION for the current progress message... The initial Request gets
the server going on the task, and also creates a second Request that
repeats (eg, Ajax.PeriodicalUpdater). That one does nothing more than
check $_SESSION for the latest message (which gets updated by the task
being performed). That feels slightly better to me, despite the
potential traffic overhead for longer requests (hence the {decay}
option, i suppose).

Something for me to chew on, i suppose.

Thanks again,
-joe t.


On Dec 9, 1:22 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 I would do this with chained onSuccess handlers. Each one would  
 trigger a new request to a different endpoint, carrying some token to  
 identify the visitor.

 $('button').observe('click',function(evt){
         //do your lookup
         new Ajax.Request('lookup.php',{
                 parameters:{id:'?=$id?'},
                 onCreate:function(){
                         $('message').update('searching...');;
                 },
                 onSuccess:function(transport){
                         //make your pdf
                         $('message').update('making PDF...');;
                         new Ajax.Request('pdf.php',{
                                 parameters:{id:'?=$id?'},
                                 onCreate:..., //you get the idea
                                 onSuccess:...
                         });
                 }
         }};

 });

 Walter

 On Dec 9, 2009, at 11:11 AM, joe t. wrote:

  i think i've seen examples of this, but can't recall where, and could
  use some guidance.

  Obviously it's easy to handle a 1:1 Request/Response

  How can i do a true 1:many process? For instance:
  Client takes a single action which requires the server to perform 3
  tasks:
  * Query database
  * Generate PDF
  * Generate email, attach PDF, and send

  How can i respond to the client as EACH task is accomplished without
  ending the request chain?
  Looking up your data . . . (time-based dots as delay indicator)
  Creating PDF . . .
  Email sent (or failed, as the case may be)

  Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
  point me in the right direction (which include samples), i'd be
  grateful.

  Thanks.
  -joe t.

  --

  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-scriptaculous@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=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.