473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Timer Method

if I would like to do count using Hexidecimal by increasing one ever 2
seconds what what do I do. Is there a way to have a method or function fire
every two seconds?
Dec 19 '05 #1
6 1238
NEWS wrote on 19 dec 2005 in comp.lang.javascript:
if I would like to do count using Hexidecimal
Hexadecimal is a string format of a number.

counting is done by number.
by increasing one ever 2
seconds what what do I do. Is there a way to have a method or function
fire every two seconds?


setInterval('myFunction()',2000)
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 19 '05 #2
VK

Evertjan. wrote:
Hexadecimal is a string format of a number.

counting is done by number.


Not exactly true. Hexadecimal is a number as any other but unlike
decimal (which is default format for script) hexadecimal or octal
literal values have to be prefixed so interpreter would know what is it
dealing with.

So for the OP's task it could be:

<script>
var count = 0x790; // decimal 2000 - 2 sec startup
var delta = 0x790; // decimal 2000 - interval increase

function init() {
setTimeout('f()', count);
}

function f() {
count+= 0x790;
setTimeout('f()',count);
}

Dec 19 '05 #3

"VK" <sc**********@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...

Evertjan. wrote:
Hexadecimal is a string format of a number.

counting is done by number.


Not exactly true. Hexadecimal is a number as any other but unlike
decimal (which is default format for script) hexadecimal or octal
literal values have to be prefixed so interpreter would know what is it
dealing with.

So for the OP's task it could be:

<script>
var count = 0x790; // decimal 2000 - 2 sec startup
var delta = 0x790; // decimal 2000 - interval increase

function init() {
setTimeout('f()', count);
}

function f() {
count+= 0x790;
setTimeout('f()',count);
}


Got it working thanks
Dec 19 '05 #4
JRS: In article <IPCpf.12573$wg4.9013@edtnps84>, dated Mon, 19 Dec 2005
18:18:16 local, seen in news:comp.lang.javascript, NEWS
<an******@nospam.com> posted :
if I would like to do count using Hexidecimal by increasing one ever 2
seconds what what do I do. Is there a way to have a method or function fire
every two seconds?


Yes, read the newsgroup FAQ; all of it, then S.4.20 again.

You should count in type Number, and use .toString(16) for Hex. You may
need to add leading zeroes; in that case you can either program your own
Hex conversion, or use Stretch in S.4.6.

<FAQENTRY> How about a setInterval example, perhaps with clearInterval ?

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Dec 19 '05 #5

VK wrote:
var count = 0x790; // decimal 2000 - 2 sec startup
var delta = 0x790; // decimal 2000 - interval increase


0x790 hex is 1936 in decimal.
0x7D0 hex is 2000 in decimal.

But I suppose 64ms is trivial.

Dec 20 '05 #6
VK

web.dev wrote:
VK wrote:
var count = 0x790; // decimal 2000 - 2 sec startup
var delta = 0x790; // decimal 2000 - interval increase


0x790 hex is 1936 in decimal.
0x7D0 hex is 2000 in decimal.


Yep - somewhere somehow I misculced/mistyped. Thank you for correcting.

Dec 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Geoff | last post by:
Hey.. I'm having problems with stopping this timer from outside the 'runTimer()' class.. i have no problems calling 'cancel()' from inside the run() method but I want to be able to stop the Timer...
2
by: andrewcw | last post by:
I am trying to do a windows service with C#. I am using as a base the VB.NET article in VS, but I thing the WITHEVENTS timer notation is a delegate. Can anyone provide sample code & anh hints. ...
3
by: Peter Johnsson | last post by:
How come the eventhandler for the timer's elapsed time event is called over and over again, even though the AutoReset property is set to false, if you assign a new value to the timer objects...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
3
by: jam | last post by:
Dear all, I am wrtiing a console application and doing some test on timer, the below is my sample code I got from some site, but I cannot make it work... Error is 'System.Timers.Timer' does not...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
7
by: LBT | last post by:
I have a window service written using VB.NET. This window service will scan folders for file and grab the file content to be inserted to SQL Server on file detection. There are altogether 18...
8
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have...
5
by: Ronin | last post by:
I need a little help trying to figure out the last piece of this puzzle. I've got a form with an associated toolbox that will allow a user to drag a control off the toolbox and drop it onto the...
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.