Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

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


hi  can Variant archiving setTimout('.. capability be done without
using it? :-)
rebecca@gmail.com said the following on 5/17/2007 2:02 PM:

> hi  can Variant archiving setTimout('.. capability be done without
> using it? :-)

Could you try reposting that in some form of comprehensible English?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

> Could you try reposting that in some form of comprehensible English?

archiving = achieving     sooory
rebecca@gmail.com wrote in news:1179427611.981289.6840
@p77g2000hsh.googlegroups.com:

>> Could you try reposting that in some form of comprehensible English?

> archiving = achieving     sooory

still doesnt make sense
rebecca@gmail.com said the following on 5/17/2007 2:46 PM:

>> Could you try reposting that in some form of comprehensible English?

> archiving = achieving     sooory

Your doesn't question sense still make.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

> Your doesn't question sense still make.

I've got a super intergalactic problem, a very complex interface that
uses javascript setTimer to execute functions with 1, 5 or 10 second
delays.... without get into all the political issues, i just need a
simple, if not ad-hoc replacement for it, that gives me finite
control, to set delays that lead to running other functions();  can
this be done without messing up timing or CPU% overload? :-) thank you
for your braintime

I've got a super intergalactic problem, a very complex interface that
uses javascript setTimer to execute functions with 1, 5 or 10 second
delays.... without get into all the political issues, i just need a
simple, if not ad-hoc replacement for it, that gives me finite
control, to set delays that lead to running other functions();  can
this be done without messing up timing or CPU% overload? :-) thank you
for your braintime

----------------
MORE
----------------

btw, its a low-end ie browser interface, that has a quirk that render
use of javascript setTimer inoperable, very specifically, (everything
else Javascript seems to be ok), ..... changing aspects of what I have
to work in is never going to happen, so I just need something that can
act like setTimer for about a dozen places I need to change the
"engine" out, so to speak   i hope i am clearer about my problem and
can help me please with best solution!!

rebecca@gmail.com said:

The best solution is to use setTimeout or setInterval.

99.4% of people who insist that they can't use them for their
purposes turn out to not know what they're talking about.

Unfortunately for you, that puts the burden on you to convince
us that you really have a quirk that makes them unusable.

--

On May 17, 5:27 pm, Lee <REM0VElbspamt@cox.net> wrote:

Its a fixed group of people, not public, and I am not in a political
position in my job to change the fact setTimeout does not work,
therefore, evidence non-withstanding, I need to find a way as I
articulated before to ..... ?
On May 17, 6:22 pm, rebecca@gmail.com wrote:

BTW, I don't know where 99.4 % comes from, but technically are you
able to write something like this, or just conjuring up?
rebecca@gmail.com said:

I was being generous.  In my experience, I believe it's 100%.
In other words, it's very nearly certain that you can do what
you need with setTimeout(), but don't know how.

--

> I was being generous.  In my experience, I believe it's 100%.
> In other words, it's very nearly certain that you can do what
> you need with setTimeout(), but don't know how.

> --

Sorry Lee, you are, and for clarification, I cannot run/execute
setTimeout(), in a real pure technical sense, IE just ignores it.....
it might be a security issue, but I work in a real integrated legacy
environment, and really this is a particularly minor thing affecting
about half dozen problem areas in some new code I am integrating that
uses setTimeout().

<script>

var hold_timer=5000;milliseconds

do (pause in a 5 sec loop based on hold_timer) {

then runthis();

}

I know it is asinine , but for me, in a real special case it will be
immensely helpful.

Have a very pretty day.
</script>

rebecca@gmail.com said:

The most common mistake in using setTimeout() makes it appear
that it is being ignored.   What happens when you try this:

<html>
<body>
<script type="text/javascript">
  setTimeout("alert('hi')",3000);
</script>
</body>
</html>

--

On May 18, 9:47 am, rebecca@gmail.com wrote:

> > I was being generous.  In my experience, I believe it's 100%.
> > In other words, it's very nearly certain that you can do what
> > you need with setTimeout(), but don't know how.

> > --

> Sorry Lee, you are, and for clarification, I cannot run/execute
> setTimeout(), in a real pure technical sense, IE just ignores it.....
> it might be a security issue, but I work in a real integrated legacy
> environment, and really this is a particularly minor thing affecting
> about half dozen problem areas in some new code I am integrating that
> uses setTimeout().

Your users must have very old versions of IE. According to a Richard
Cornford post (link below) version 4 doesn't support function
references, it wants a string.

There is an interesting thread regarding it titled "small function
doesnt work in IE", link below.  Richard Cornford's answer is copied
below my signature, check for auto-wrapping (though I think Richard
was pretty thorough with manually wrapping it).

<URL:
http://groups.google.com.au/group/comp.lang.javascript/browse_frm/thr...

> <script>

> var hold_timer=5000;milliseconds

> do (pause in a 5 sec loop based on hold_timer) {

Javascript doesn't have a pause function.  You must use either
setTimeout or setInterval.

--
Rob

Erwin Moller wrote in message

<3ebbb857$0$49100$e4fe5@news.xs4all.nl>...
<snip>

>..., it is solved now I guess.

Hopefully, but your proposed solution used the javascript pseudo
protocol which is not something that the regulars on this group ever
recommend (with the possible exception of Lee's pop-up window timing
solution application of it). The group's FAQ (section 4.24) advises
against its use in general terms and DU recently proposed that the FAQ
entry's wording should be modified to go provide some explanation of
the
many undesirable and often browser type, versions and/or operating
system dependent side effects of its use.

One of its (many) problems is that to the browser it represents
navigation, putting the current page into a waiting state in which the
browser stops performing resource hungry tasks. The most obvious
manifestation of which is that animated GIFs stop playing, but other
facilities also disappear with its first invocation.

Mac IE 5 suffers really badly from side effects of the use of the
javascript pseudo protocol, but it seems to have some undesirable
effects on every browser.

<snip>

>I use Konquerer 3.0.3-14, so I can test it if you want.
>But.... I always pass a string (with a function)
>to the setTimeout....

The string argument versions is more widely supported but most of the
modern browsers will accept function references as the first argument.
The string argument version must invoke the eval function in order to
execute the code in the string, which would be slower than invoking a
function by reference. Also, Avant Go and possibly other small,
embedded
browsers do not have the resources to implement the eval function and
so
they cannot use the string argument version. I don't know whether they
support the function reference version or just don't implement a
setTimeout function at all (it is extremely hard to get documentation
on
most embedded browsers).

>I do not know how to create a reference to a function.

Given a function:-

function myFunction(){
    ...

}

- the identifier - myFunction - is a function reference. That is, it
is
a property of the global object that holds a reference to the function
object that was created when the function definition above was
interpreted.

When calling the function as - myFunciton(); - the brackets '()' might
best be viewed as an operator (a function execution operator) that
operates on the function referred to by the value in the property  -
myFunction - . So, if you can append '()' (possibly with arguments) to
an identifier and execute a function, then that identifier _is_ a
reference to a function (a function object in JavaScript).

As the properties that refer to functions contain references to
function
objects the references can be copied:-

var copyOfFuncRef = myFunciton;

- leaves both properties - myFunction - and - copyOfFuncRef - holding
references to the same function object. And that function object can
now
be called as - copyOfFuncRef() - .

>But if you post a sample I'll be happy to test it for you.

The reason for my interest is that I am aiming at maximum efficiency
(the function reference version) and maximum compatibility (fall-back
to
the string argument version if that is all that is available) and I
want
to do this without having to go through a battery of tests like the
ones
I will post below.

I have noticed that if IE 4 or Opera 5 are passed a function reference
as the first argument to setTimeout (which they do not support) they
type convert it into a string. To do the type conversion they call the
function's toString method. toString is defined on the
Function.prototype but if the function object in question is provided
with its own toString method it will override the method on the
prototype.

My plan is to provide any functions that are passed as references to
setTimeout with toString methods that will return a string that would
call the function anyway. All of the (20 odd) browsers/versions that I
have accept the function reference argument except IE 4 an Opera 5 and
those two happily type-convert the function reference to a string
using
its toString method.

I have not been able to test with Konquerer 3. If it accepts function
reference arguments my plan can go ahead, if it will type-convert the
reference with the function's toString method I am still in business.
If
it only accepts string arguments and will not type convert a function
reference then I will have to adopt testing and code branching
strategy
instead (much more code).

It may seem wasteful to provide any function that is to be used with
setTimeout with an additional toString method but that can be done for
just one setTimeout-setting function as I described in the thread with
the subject 'closures, what are they good for?'.

The following HTML should test setTimout and setInterval and alert the
results about half a second after the onload event. The alert should
say
if each function supports function reference arguments, string
arguments
and, if only string arguments, whether Konquerer is willing to type
convert function references into strings.

(sorry it is not shorter but I may as well find out once and for all.
I
should have handled the line wrapping (at 72 characters) so that the
page can just be cut-n-pasted from your newsreader.)

<html>
<head>
 <title>setTimeout tests</title>
<script type="text/javascript">
var setTmExists = (typeof window.setTimeout != 'undefined');
var setInExists = (typeof window.setInterval != 'undefined');
var setTmString = false;
var setTmString2 = false;
var setTmFunc = false;
var setInString = false;
var setInString2 = false;
var setInFunc = false;
var testTimer,testTimer2;

function testSetTm(){
    setTmFunc = true;
    setTimeout('setTmString = true;', 1);

}

testSetTm.toString = function(){
    return 'setTmString = true;';

}

function testSetIn(){
    clearInterval(testTimer);
    setInFunc = true;
    testTimer = setInterval(
                  'setInString = true;clearInterval(testTimer);', 1);

}

testSetIn.toString = function(){
    return 'setInString = true;clearInterval(testTimer);';

}

if(setTmExists){
    setTimeout('setTmString2 = true;', 1);
    setTimeout(testSetTm, 1);

}

if(setInExists){
    testTimer2 = setInterval(
              'setInString2 = true;clearInterval(testTimer2);', 1);
    testTimer = setInterval(testSetIn, 1);

}

function checkTest(){
    var st = 'The window.setTimeout function '+
                         (setTmExists?'exists':'does not exist')+'\n';
    if(setTmExists){
      st += '\tstring arguments are '+
       (setTmString?'':'not ')+'supported\n\tfunction arguments are '+
                  ((setTmFunc||setTmString2)?'':'not ')+'supported\n';
      if((!setTmFunc)&&(!setTmString)&&(setTmString2)){
        st +=
        '\tfunction arguments are not type-converted by setTimeout\n';
      }
    }
    st += '\nThe window.setInterval function '+
                         (setInExists?'exists':'does not exist')+'\n';
    if(setInExists){
      st += '\tstring arguments are '+
       (setInString?'':'not ')+'supported\n\tfunction arguments are '+
                  ((setInFunc||setInString2)?'':'not ')+'supported\n';
      if((!setInFunc)&&(!setInString)&&(setInString2)){
        st +=
       '\tfunction arguments are not type-converted by setInterval\n';
      }
    }
    alert(st);

}

checkTest.toString = function(){
    return 'checkTest();';

}

</script>
</head>
<body onload="setTimeout('checkTest()', 400);">
<p>setTimeout tests.
</p>
</body>
</html>

Thanks,

Richard.

RobG said the following on 5/17/2007 9:22 PM:

Except that Google Groups screwed your signature by removing the space
in it. Does Google Groups still blow it up if you double space it?
<dash><dash><space><space> or does it just automatically remove any line
ending spaces?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

<sniiiipporinie>

None of these thoughtful examples worked, mainly because they use
setTimeout to achieve delay. Can some other weird out of box thinking
achieve reliable delay/then do ()function step?

Thank you a million ways.

rebecca@gmail.com wrote:
> <sniiiipporinie>

> None of these thoughtful examples worked, mainly because they use
> setTimeout to achieve delay. Can some other weird out of box thinking
> achieve reliable delay/then do ()function step?

What version of Internet Explorer are you using?

--
-Lost
Remove the extra words to reply by e-mail.  Don't e-mail me.  I am
kidding.  No I am not.

On May 17, 8:59 pm, -Lost <maventheextrawo@techie.com> wrote:

> rebecca@gmail.com wrote:
> > <sniiiipporinie>

> > None of these thoughtful examples worked, mainly because they use
> > setTimeout to achieve delay. Can some other weird out of box thinking
> > achieve reliable delay/then do ()function step?

> What version of Internet Explorer are you using?

> --
> -Lost
> Remove the extra words to reply by e-mail.  Don't e-mail me.  I am
> kidding.  No I am not.

Under fixed 6.0 basic js standards minimum   thx!!

rebecca@gmail.com wrote:
> On May 17, 8:59 pm, -Lost <maventheextrawo@techie.com> wrote:
>> rebecca@gmail.com wrote:
>>> <sniiiipporinie>
>>> None of these thoughtful examples worked, mainly because they use
>>> setTimeout to achieve delay. Can some other weird out of box thinking
>>> achieve reliable delay/then do ()function step?
>> What version of Internet Explorer are you using?

> Under fixed 6.0 basic js standards minimum   thx!!

Um, my Internet Explorer 6 runs setTimeout() just fine.

Can you show us the page where this is failing?

Did you ever try Lee's example, just to see if a very simple call worked?

The more of an attempt you make, the better solution others can provide.

--
-Lost
Remove the extra words to reply by e-mail.  Don't e-mail me.  I am
kidding.  No I am not.

On May 17, 10:04 pm, -Lost <maventheextrawo@techie.com> wrote:

Lost, just seperating the theory from the request, can such
theoretical delay to execute functions, be created without expressly
using the command setTimeout()?

Alright, separating both theory and logic:

1.  Setup a never ending loop that checks if Date returns a value at or
beyond the length of your "delay."
2.  Use setInterval once by immediately clearing it after a certain
amount of executions.  1, in this case.

--
-Lost
Remove the extra words to reply by e-mail.  Don't e-mail me.  I am
kidding.  No I am not.

On May 17, 10:44 pm, -Lost <maventheextrawo@techie.com> wrote:

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?
On May 18, 1:32 pm, rebecca@gmail.com wrote:

Yes, using setInterval. Where setTimout runs once, setInterval runs
regularly at the interval you set.  So you could put commands to be
run in a queue (say using an object to store them), then have
setInterval wake up at say 5 second intervals , execute whatever is in
the queue (or not if a particular item's time isn't up yet), then
remove executed functions from the queue.

This strategy is employed by those who wish to construct their own
system of calling multiple handlers for an event and don't trust
browsers to run them in the right sequence, or who want to
conditionally execute some handlers based on the outcome of other
handlers.  Most javascript libraries include some kind of queue
management.

There is no other way to run a command at some specified time or
interval or to insert a pause/wait/sleep in a running function.

--
Rob

rebecca@gmail.com 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?

--

On May 17, 11:58 pm, Lee <REM0VElbspamt@cox.net> wrote:

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.
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc