question about Timers @ stuff............

R

rebeccatre

(e-mail address removed) said:







It would be irresponsible to show you how to code a loop that
consumes the entire CPU until you've at least shown that you've
been attempting to use the proper methods correctly.

If you can't figure out how to code a loop that compares the
time, I certainly don't believe you've been able to figure
out the correct way to use setTimeout() and/or setInterval().

Did you try running my example code?

--

Sorry but to clarify, I cannot use setTimeout, not because of syntax
dysfunction or I am not a perfect novice at Javascript, it just is
what it is --- separating the politics from my request, it would be
great if someone could show me a example using whatever technique to
delay execution of functions I specify, such as delay 5 seconds then
execute green(); or alert('hey'); !:) Hogging down the system or
causing the Alert box telling me the computer is tilting (consuming
the entire CPU) as you say, is not what I want.
 
L

Lee

(e-mail address removed) said:
Sorry but to clarify, I cannot use setTimeout, not because of syntax
dysfunction or I am not a perfect novice at Javascript, it just is
what it is

That's not good enough. If you want help, you have to cooperate.
Why can't you use setTimeout()?

If you don't want help, just continue to say that "it just is what it is".


--
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
oglegroups.com>, Thu, 17 May 2007 20:53:54, (e-mail address removed) posted:
1. is better, as setInterval seems to not function too, so we are left
with comparing system dates.... can you super plz. show starting
example, that shall execute alert('green'); after declared input wait
of 5 seconds?

Take a copy of my small Web page <URL:http://www.merlyn.demon.co.uk/js-
alarm.htm>, put it on your system, and see whether it works there.

There is one problem, apart from the obvious, likely to occur with a
loop-wait; it can be fixed with a unary +.

The FAQ, alas, lacks the word "unary", especially in 4.21.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
R

rebeccatre

(e-mail address removed) said:


That's not good enough. If you want help, you have to cooperate.
Why can't you use setTimeout()?

If you don't want help, just continue to say that "it just is what it is".

--

Unfortunately the parser interpreter in a ultra-secure class, though
maybe 1990s technologies, does not like execution of javascript.
maybe it was a legacy programmer who wrote it in the mainframe, but
without divulging further, anything too detailed classified i would
hope to find some hopefully innovative thinking solution to a timer,
but not using the obvious command Javascript intended for such
purpose :)
 
V

VK

Unfortunately the parser interpreter in a ultra-secure class, though
maybe 1990s technologies, does not like execution of javascript.

If so then why are you worrying about any Javascript issues at all -
plus making others being worried about it? :) Either Javascript is
allowed to be executed in the target UAs or not. In the first case use
Javascript language in the proper way as it was already shown in this
thread. In the second case look for another media for the task (C++,
Java etc.). As simple as that.

It is circa the same as with the memory management. Either you can
live with the automated garbage collection and then use Javascript or
Java; or the manual memory management is a must for you to sleep well:
then use C++. Always use the right tool for the job - and the right NG
to ask for help.
i would
hope to find some hopefully innovative thinking solution to a timer,
but not using the obvious command Javascript intended for such
purpose :)

There is not such way, so see above. Javascript operates on IRQ basis
over setTimeout / clearTimeout commands. The only other alternative is
in "long loops", but they are not usable for several reasons:
1) they effectively hang up the system by taking ~100% of resources
2) any Javascript engine has pass control flow limit to prevent
endless loops - so instead of delays you'll often get system alert
with the proposal to break script execution on the page.

It is not a solution of your problem really. From the other side
saying that "the problem has no solutions with the given arguments" is
still a useful solution ;-) It means that you can stop wasting paper
for calculations and start trying with another set of arguments.
 
R

rebeccatre

If so then why are you worrying about any Javascript issues at all -
plus making others being worried about it? :) Either Javascript is
allowed to be executed in the target UAs or not. In the first case use
Javascript language in the proper way as it was already shown in this
thread. In the second case look for another media for the task (C++,
Java etc.). As simple as that.

It is circa the same as with the memory management. Either you can
live with the automated garbage collection and then use Javascript or
Java; or the manual memory management is a must for you to sleep well:
then use C++. Always use the right tool for the job - and the right NG
to ask for help.


There is not such way, so see above. Javascript operates on IRQ basis
over setTimeout / clearTimeout commands. The only other alternative is
in "long loops", but they are not usable for several reasons:
1) they effectively hang up the system by taking ~100% of resources
2) any Javascript engine has pass control flow limit to prevent
endless loops - so instead of delays you'll often get system alert
with the proposal to break script execution on the page.

It is not a solution of your problem really. From the other side
saying that "the problem has no solutions with the given arguments" is
still a useful solution ;-) It means that you can stop wasting paper
for calculations and start trying with another set of arguments.

Thank you, but rather than you continuing anymore deeply hypothetical
guesses at what I should do, solving my problem is welcomed at the top
of my good list............., I think Lost and others have the right
idea, but it would be great to this working demonstration. Thanks a
million! :)
 
R

rebeccatre

Thank you, but rather than you continuing anymore deeply hypothetical
guesses at what I should do, solving my problem is welcomed at the top
of my good list............., I think Lost and others have the right
idea, but it would be great to this working demonstration. Thanks a
million! :)

Wait a minute, are some of you saying, there is no functional way to
run timed events without using setTimeout or its companion, without
boss hogging the CPU? Can a throttle be devised? One big virtual
THANK YOU for someone who can devise this so I can change out the oil
on this rig. THANKS! **-**
 
L

Lee

(e-mail address removed) said:
Wait a minute, are some of you saying, there is no functional way to
run timed events without using setTimeout or its companion, without
boss hogging the CPU? Can a throttle be devised? One big virtual
THANK YOU for someone who can devise this so I can change out the oil
on this rig. THANKS! **-**

Web browsers are event driven. The way you get a delay in an event
driven system is to schedule a task to be executed after a specified
amount of time. That's what setTimeout and setInterval do. The only
alternative is to repetitively capture some other event and check each
time to see if the proper amount of time has elapsed. For example,
you might ask the user to click the mouse repeatedly until you tell
them to stop. Most other types of events are likely to interfere
with whatever real work you're waiting for.


--
 
V

VK

Wait a minute, are some of you saying, there is no functional way to
run timed events without using setTimeout or its companion

Bingo!
You know, sis, your previous reply made me almost sure that you are
just trolling for some unknown fun ("- It cannot be done this way
because of ... - OK, so how can it be done this way?" and so). Now I
see that you just did not bother to read my post to the end at the
first time.

Just to fix the progress :)

It is not possible.
Ce n'est pas possible.
Es ist nicht möglich.
Это невозможно.
glbPossibility === false


P.S. There is a subtle case with Javascript engine used as a stay-
alone environment, out of any host objects - like say with Mozilla's
Rhino or SpiderMonkey. In such case I can imagine a C++ or Java
program using thread management tools of these languages like sleep()
command to invoke Javascript functions in the specified period of
time. From the practical point of view it has zero importance, but out
of pure sport here is a possibility to avoid Javascript native timing
tools.
 
R

rebeccatre

Bingo!
You know, sis, your previous reply made me almost sure that you are
just trolling for some unknown fun ("- It cannot be done this way
because of ... - OK, so how can it be done this way?" and so). Now I
see that you just did not bother to read my post to the end at the
first time.

Just to fix the progress :)

It is not possible.
Ce n'est pas possible.
Es ist nicht möglich.
Это невозможно.
glbPossibility === false

P.S. There is a subtle case with Javascript engine used as a stay-
alone environment, out of any host objects - like say with Mozilla's
Rhino or SpiderMonkey. In such case I can imagine a C++ or Java
program using thread management tools of these languages like sleep()
command to invoke Javascript functions in the specified period of
time. From the practical point of view it has zero importance, but out
of pure sport here is a possibility to avoid Javascript native timing
tools.

yes you are right there are known ways to do it expect for no ways
 
R

rebeccatre

Bingo!
You know, sis, your previous reply made me almost sure that you are
just trolling for some unknown fun ("- It cannot be done this way
because of ... - OK, so how can it be done this way?" and so). Now I
see that you just did not bother to read my post to the end at the
first time.

Just to fix the progress :)

It is not possible.
Ce n'est pas possible.
Es ist nicht möglich.
Это невозможно.
glbPossibility === false

P.S. There is a subtle case with Javascript engine used as a stay-
alone environment, out of any host objects - like say with Mozilla's
Rhino or SpiderMonkey. In such case I can imagine a C++ or Java
program using thread management tools of these languages like sleep()
command to invoke Javascript functions in the specified period of
time. From the practical point of view it has zero importance, but out
of pure sport here is a possibility to avoid Javascript native timing
tools.

Your words are bravado and convincing sounding to you, but Considering
the other hypothetical responses I think it is possible to create a
setTimeout alternative using javascript to execute functions() with a
delay, *without* using setTimeout, and some hybrid. Maybe you have
not considered all the options, and attempted to do anything
scientific. You hypothetically suggest maybe it can be done in some
environent, but I would say that is hypothetical as your are. I think
you are more or less don't have a solid rational view, tested working
something -- anything. Set up to the plate and try helping, not
convincing yourself and others your h.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top