Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #8729 > unrolled thread
| Started by | Gene Wirchenko <genew@ocis.net> |
|---|---|
| First post | 2011-11-30 15:10 -0800 |
| Last post | 2011-12-01 18:27 +0000 |
| Articles | 8 — 7 participants |
Back to article view | Back to comp.lang.javascript
Getting Intermediate Results Reported Right Away Gene Wirchenko <genew@ocis.net> - 2011-11-30 15:10 -0800
Re: Getting Intermediate Results Reported Right Away Andreas Bergmaier <andber93@web.de> - 2011-12-01 00:20 +0100
Re: Getting Intermediate Results Reported Right Away Tim Streater <timstreater@greenbee.net> - 2011-12-01 00:07 +0000
Re: Getting Intermediate Results Reported Right Away Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2011-12-01 15:55 +0100
Re: Getting Intermediate Results Reported Right Away Gene Wirchenko <genew@ocis.net> - 2011-12-01 12:09 -0800
Re: Getting Intermediate Results Reported Right Away Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-01 21:33 +0000
Re: Getting Intermediate Results Reported Right Away Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-02 00:12 +0100
Re: Getting Intermediate Results Reported Right Away Dr J R Stockton <reply1148@merlyn.demon.co.uk> - 2011-12-01 18:27 +0000
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2011-11-30 15:10 -0800 |
| Subject | Getting Intermediate Results Reported Right Away |
| Message-ID | <hmddd7litkuobgpjdpstl6hav6clkhr0bl@4ax.com> |
Dear JavaScripters:
I sometimes want to run something for quite some time. An
example is when I am checking system limits, but later, it could be
something such as processing transactions.
I could let it run blind, but especially when testing, that is
not a good idea. I could put alert()s in, but then I get interrupted
by them. I would like to be able to start whatever it is going and
watch (or not).
How can I simply have JavaScript report as it is executing? Like:
100 things done
200 things done
300 things done
...
Sincerely,
Gene Wirchenko
[toc] | [next] | [standalone]
| From | Andreas Bergmaier <andber93@web.de> |
|---|---|
| Date | 2011-12-01 00:20 +0100 |
| Message-ID | <jb6dnm$q0c$1@news.albasani.net> |
| In reply to | #8729 |
Gene Wirchenko schrieb: > I sometimes want to run something for quite some time. An > example is when I am checking system limits, but later, it could be > something such as processing transactions. > > I could let it run blind, but especially when testing, that is > not a good idea. I could put alert()s in, but then I get interrupted > by them. I would like to be able to start whatever it is going and > watch (or not). > > How can I simply have JavaScript report as it is executing? Like: > 100 things done > 200 things done > 300 things done > ... Have you ever tried console.log / console.debug? The debugger of your choice will be able to show these logs. But don't flood them, that might slow down your system! Another possiblity is to show a fixed-positioned element on your page (I guess you want test in Browser environment) to which you can append your logging messages. Bergi
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2011-12-01 00:07 +0000 |
| Message-ID | <timstreater-961764.00070501122011@news.individual.net> |
| In reply to | #8729 |
In article <hmddd7litkuobgpjdpstl6hav6clkhr0bl@4ax.com>, Gene Wirchenko <genew@ocis.net> wrote: > Dear JavaScripters: > > I sometimes want to run something for quite some time. An > example is when I am checking system limits, but later, it could be > something such as processing transactions. > > I could let it run blind, but especially when testing, that is > not a good idea. I could put alert()s in, but then I get interrupted > by them. I would like to be able to start whatever it is going and > watch (or not). > > How can I simply have JavaScript report as it is executing? Like: > 100 things done > 200 things done > 300 things done > ... In Safari, instead of using: alert (str); you can use: console.info (str); which puts in the the error console area (Develop -> Show error console). If you have that open you can watch the progress. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> |
|---|---|
| Date | 2011-12-01 15:55 +0100 |
| Message-ID | <s85fd75iab91hbafcesvf9vhj7pkkiurco@4ax.com> |
| In reply to | #8729 |
On Wed, 30 Nov 2011 15:10:23 -0800, Gene Wirchenko wrote: > I sometimes want to run something for quite some time. An >example is when I am checking system limits, but later, it could be >something such as processing transactions. > > I could let it run blind, but especially when testing, that is >not a good idea. I could put alert()s in, but then I get interrupted >by them. I would like to be able to start whatever it is going and >watch (or not). > > How can I simply have JavaScript report as it is executing? Like: > 100 things done > 200 things done > 300 things done > ... Gene, check http://winhlp.com/node/633 for some hints. You have to temporarily halt JavaScript processing to allow the browser to render your results to the DOM and then to the screen. The article shows ways of how to do that. Hans-Georg
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2011-12-01 12:09 -0800 |
| Message-ID | <0hnfd7true3b4fgg7ou7q8v42oegqbuspf@4ax.com> |
| In reply to | #8749 |
On Thu, 01 Dec 2011 15:55:31 +0100, Hans-Georg Michna
<hans-georgNoEmailPlease@michna.com> wrote:
>On Wed, 30 Nov 2011 15:10:23 -0800, Gene Wirchenko wrote:
>
>> I sometimes want to run something for quite some time. An
>>example is when I am checking system limits, but later, it could be
>>something such as processing transactions.
>>
>> I could let it run blind, but especially when testing, that is
>>not a good idea. I could put alert()s in, but then I get interrupted
>>by them. I would like to be able to start whatever it is going and
>>watch (or not).
>>
>> How can I simply have JavaScript report as it is executing? Like:
>> 100 things done
>> 200 things done
>> 300 things done
>> ...
>check http://winhlp.com/node/633 for some hints.
>
>You have to temporarily halt JavaScript processing to allow the
>browser to render your results to the DOM and then to the
>screen. The article shows ways of how to do that.
The way that I have found is to set a timeout and stop execution,
then continue execution after the timeout has expired. It does make
for odd-looking code.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2011-12-01 21:33 +0000 |
| Message-ID | <4ed7f2c4$0$29342$a8266bb1@newsreader.readnews.com> |
| In reply to | #8753 |
On Thu, 01 Dec 2011 12:09:10 -0800, Gene Wirchenko wrote:
> On Thu, 01 Dec 2011 15:55:31 +0100, Hans-Georg Michna
> <hans-georgNoEmailPlease@michna.com> wrote:
>
>>On Wed, 30 Nov 2011 15:10:23 -0800, Gene Wirchenko wrote:
>>
>>> I sometimes want to run something for quite some time. An
>>>example is when I am checking system limits, but later, it could be
>>>something such as processing transactions.
>>>
>>> I could let it run blind, but especially when testing, that is
>>>not a good idea. I could put alert()s in, but then I get interrupted
>>>by them. I would like to be able to start whatever it is going and
>>>watch (or not).
>>>
>>> How can I simply have JavaScript report as it is executing? Like:
>>> 100 things done
>>> 200 things done
>>> 300 things done
>>> ...
>
>>check http://winhlp.com/node/633 for some hints.
>>
>>You have to temporarily halt JavaScript processing to allow the browser
>>to render your results to the DOM and then to the screen. The article
>>shows ways of how to do that.
>
> The way that I have found is to set a timeout and stop execution,
> then continue execution after the timeout has expired. It does make for
> odd-looking code.
It depends on why you want periodic output.
When I'm trying stuff out in a browser environment, I might use alert
boxes for occasional outputs, or form elements for more non-interactive
output.
Appending lines of output to a textarea can be useful eg:
function printScreen(str) {
document.getElementById("id_of_textarea").value += str + "\n";
}
Rgds
Denis McMahon
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-12-02 00:12 +0100 |
| Message-ID | <3004724.SPkdTlGXAF@PointedEars.de> |
| In reply to | #8755 |
Denis McMahon wrote:
> When I'm trying stuff out in a browser environment, I might use alert
> boxes for occasional outputs, or form elements for more non-interactive
> output.
>
> Appending lines of output to a textarea can be useful eg:
>
> function printScreen(str) {
> document.getElementById("id_of_textarea").value += str + "\n";
> }
You would. *Any* fairly modern browser (even IE) has or can be augmented
with an error console that you can print to in various ways, so *none* of
those kluges are necessary anymore.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1148@merlyn.demon.co.uk> |
|---|---|
| Date | 2011-12-01 18:27 +0000 |
| Message-ID | <OuWMS7D1b81OFwJL@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #8729 |
In comp.lang.javascript message <hmddd7litkuobgpjdpstl6hav6clkhr0bl@4ax. com>, Wed, 30 Nov 2011 15:10:23, Gene Wirchenko <genew@ocis.net> posted: > I sometimes want to run something for quite some time. An >example is when I am checking system limits, but later, it could be >something such as processing transactions. > > I could let it run blind, but especially when testing, that is >not a good idea. I could put alert()s in, but then I get interrupted >by them. I would like to be able to start whatever it is going and >watch (or not). > > How can I simply have JavaScript report as it is executing? Like: > 100 things done > 200 things done > 300 things done Choose a browser in which window.status displays, or can be set to, an updating status line or part-line while code is running. IE8, Opera 11.52, Safari 5.1.1, for example. Test : for (J=0 ; J<1e6; J++) if (!(J%1e5)) window.status = J Choose a browser in which the screen, or a certain element, updates, or can be set to, a line while code is running. Testing is easy enough. You may cover more browsers by setting both of the above. TIEE. Run your code 100 things at a time, with the end of a block writing the status to something and starting the next block after a short timeout which will allow redraw. You have already been told how to do that. -- (c) John Stockton, nr London UK ?@merlyn.demon.co.uk IE8 FF8 Op11 Sf5 Cr15 news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>. <http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web