status note for scripts that run a long time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lars knut

    #1

    status note for scripts that run a long time

    Hi,
    I got some script, that depending on the parameters it gets can take
    20min or so to finish execution. When running the script for these
    20min one sees nothing but a white page, which is somewhat bad, as the
    user think's something is wrong. So I wonder if there's a way to tell
    the user, that the script is still running and he's got to wait.

    Any suggestions?


    Thanks a lot in advance.
    Lars
  • Alvaro G Vicario

    #2
    Re: status note for scripts that run a long time

    *** lars knut wrote/escribió (25 Mar 2004 02:17:35 -0800):[color=blue]
    > So I wonder if there's a way to tell the user, that the script is still
    > running and he's got to wait.[/color]

    In this situation, I normally use "echo"'s:

    echo "Processing row #" . $row_nr;

    Or maybe

    if($row_nr % 100 == 0){
    echo "Processing row #" . $row_nr;
    }



    --
    --
    -- Álvaro G. Vicario - Burgos, Spain --

    Comment

    • Kevin Thorpe

      #3
      Re: status note for scripts that run a long time

      Alvaro G Vicario wrote:
      [color=blue]
      > *** lars knut wrote/escribió (25 Mar 2004 02:17:35 -0800):
      >[color=green]
      >>So I wonder if there's a way to tell the user, that the script is still
      >>running and he's got to wait.[/color]
      >
      >
      > In this situation, I normally use "echo"'s:
      >
      > echo "Processing row #" . $row_nr;[/color]

      I've tried that but Apache caches the php output and it all appears
      together at the end. Is there any way to force buffering off?

      Comment

      • Guillaume Brocker

        #4
        Re: status note for scripts that run a long time

        Kevin Thorpe wrote:[color=blue]
        > Alvaro G Vicario wrote:
        >[color=green]
        >> *** lars knut wrote/escribió (25 Mar 2004 02:17:35 -0800):
        >>[color=darkred]
        >>> So I wonder if there's a way to tell the user, that the script is still
        >>> running and he's got to wait.[/color]
        >>
        >>
        >>
        >> In this situation, I normally use "echo"'s:
        >>
        >> echo "Processing row #" . $row_nr;[/color]
        >
        >
        > I've tried that but Apache caches the php output and it all appears
        > together at the end. Is there any way to force buffering off?[/color]

        Well, apache is doing some caching, but PHP too. To send the output
        buffer of PHP, use *flush*. I'm using this in some of my scripts to send
        to the browser the output produced by shell scripts while they are
        running and it works fine.

        --
        Guillaume Brocker

        Comment

        • lars knut

          #5
          Re: status note for scripts that run a long time

          Hi,
          I tried the flush() version. However it's not quite what I want. I
          thought there would be a way which would allow me to show the user
          that he's got to wait by means of a text like "Please wait..." and
          when showing the results get rid of that text.
          When I use flush instead, some part of the website already shows and
          some part does not, which leads the user to assume, that there'S been
          an error.

          Does anybody have an idea how to handle that?

          Thanks a lot
          Lars

          Comment

          • Pedro Graca

            #6
            Re: status note for scripts that run a long time

            lars knut wrote:[color=blue]
            > I thought there would be a way which would allow me to show the user
            > that he's got to wait by means of a text like "Please wait..." and
            > when showing the results get rid of that text.[/color]
            [color=blue]
            > Does anybody have an idea how to handle that?[/color]

            Your clients do not mind having a browser window open for 20 minutes
            with the words "Please wait ..."? !!! I would!


            Anyway ...

            I think JavaScript may be a way to do that

            <OT trolling="I don't know JavaScript">

            send a <p id="pleasewait" >Please wait...</p>
            flush (maybe send a few spaces to fill browser cache)
            process for 20 minutes
            send javascript to turn "pleasewait " paragraph invisible/hidden

            </OT>

            --
            USENET would be a better place if everybody read: : mail address :
            http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
            http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
            http://www.expita.com/nomime.html : to 10K bytes :

            Comment

            • lawrence

              #7
              Re: status note for scripts that run a long time

              lars.knut@gmx.n et (lars knut) wrote in message news:<dd87977b. 0403250837.79e8 b0d8@posting.go ogle.com>...[color=blue]
              > Hi,
              > I tried the flush() version. However it's not quite what I want. I
              > thought there would be a way which would allow me to show the user
              > that he's got to wait by means of a text like "Please wait..." and
              > when showing the results get rid of that text.
              > When I use flush instead, some part of the website already shows and
              > some part does not, which leads the user to assume, that there'S been
              > an error.
              >
              > Does anybody have an idea how to handle that?[/color]


              This is one of the reasons that HTML sucks so bad as a user interface.
              Could you do a simple front end in Flash or Java? It could be just a
              little box that says "Please wait", then disappears when the PHP
              script is done.

              Comment

              • lars knut

                #8
                Re: status note for scripts that run a long time

                Thank you for your answer.[color=blue]
                > Your clients do not mind having a browser window open for 20 minutes
                > with the words "Please wait ..."? !!! I would![/color]
                They don't mind, as they know that processing some hundred thousand
                database entries and doing some complex calculations takes a lot of
                time and usually should be done with a datawarehouse system, which
                they don't want to pay for.

                Anyway...[color=blue]
                > <OT trolling="I don't know JavaScript">
                >
                > send a <p id="pleasewait" >Please wait...</p>
                > flush (maybe send a few spaces to fill browser cache)
                > process for 20 minutes
                > send javascript to turn "pleasewait " paragraph invisible/hidden
                >
                > </OT>[/color]
                Intersting idea! Do you know how I could trigger the turn invisible
                part? Because I haven't. :-(

                Thanks
                Lars

                Comment

                • lars knut

                  #9
                  Re: status note for scripts that run a long time

                  Thanks for your answer.
                  [color=blue]
                  > This is one of the reasons that HTML sucks so bad as a user interface.
                  > Could you do a simple front end in Flash or Java? It could be just a
                  > little box that says "Please wait", then disappears when the PHP
                  > script is done.[/color]

                  Do you know what I could use as an event-hanlder to tell flash or
                  java, that it should disappear, as the php is done?

                  Thanks
                  Lars

                  Comment

                  Working...