timer

How to implement countdown timer class in TDD?

I'm learning to do TDD in practice in small project. I want to create a countdown timer class, how to implement it in TDD(Red, Green, Refactor), and it has the delegate callback as well. ...

Need events to execute on timer events, metronome precision.

I setup a timer to call an event in my application. The problme is the event execution is being skewed by other windows operations. Ex. openning and window, loading a webpage. I need the event to excute exactly on time, every time. When i first set up the app, used a sound file, like a metronome to listen to the even firing, in a stead...

Objective C / iPhone: How to add a timer to let the text update?

I want to write an application that allow user to count down the time. The time will be displayed using label. I want to update the label every second, how can I do it? or which API is suitable for me to do this? thz in advance. ...

C# timer won't tick

hi, i have a strange problem... I've been going out of my mind for the past couple of hours... the timer i put in my winform code (from the toolbar) won't tick... I have timers on a couple of forms in my program, they all work fine... I try to do exactly the same it this it won't tick... I select it, drag it on to a form, enable it, se...

C# How can I trigger an event at a specific time of day?

Hello everybody. I'm working on a program that will need to delete a folder (and then re-instantiate it) at a certain hour of the day, and this hour will be given by the user. The hour will most likely be during the night, because that's when nobody is accessing the folder (it's outside working hours). Is there a way to trigger that ev...

How to update JLabel in Swing?

I am trying to use Swing Timer and I wanted to start from a very simple program. I have a window with text: "You have n seconds", where n changes from 10 to 0 every second. I know how to generate a window with text. And I understand how Timer works (it starts an action periodically). But I cannot figure out how to combing this two thing...

Why Timer does not work if we do not generate a window?

Here is the code: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.Timer; public class TimerSample { public static void main(String args[]) { new JFrame().setVisible(true); ActionListener actionListener = new ActionListener() { public void actionPerf...

Can it be done in a more elegant way with the Swing Timer?

Bellow is the code for the simplest GUI countdown. Can the same be done in a shorter and more elegant way with the usage of the Swing timer? import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class CountdownNew { static JLabel label; // Method which defines the appearance of the wi...

jquery - resetting timer

Hi, im using a plugin to do something ever 10 secs: function status_updates(){ $("p").everyTime(1000,function(i) { if(i==10){ alert("foo"); // something here }else{ $(this).html(i); } }); } status_updates(); where it says something here I need to add something to...

jquery - deciding whether a user is "away"

hi, im doing a little test to check whether the user is "away" (unactive) or not; function away_status(){ $("#away_stat_update").everyTime(1000, function(i) { var number = Number($(this).html()); if( number == 20 ) { // set user as away alert( "user away" ); } if( number > 20...

Problem with waitable timers in Windows (timeSetEvent and CreateTimerQueueTimer)

I need high-resolution (more accurate than 1 millisecond) timing in my application. The waitable timers in Windows are (or can be made) accurate to the millisecond, but if I need a precise periodicity of, say, 35.7142857141 milliseconds, even a waitable timer with a 36 ms period will drift out of sync quickly. My "solution" to this pro...

Timer\Counter in C for rate calculation?

Need a running (moving, rolling) average algorithm to calculate the 5-minute average bits that are passed in. All I have to work with is an accumulative value for the bits that are passed in. For example: I start with 0 bits, 5 minutes later, I have 10 bits, so my average is 10 bits. 5 minutes later, I have 15 bits, so now my averag...

C# Sleep for 500 milliseconds

Could you please tell me how do I go about pausing my program for 500 milliseconds and then continue? I read Thread.Sleep(500) is not good as it holds up the GUI thread. Using a timer it fires a callback ... I just want to wait 500ms and then continue to the next statement. Please advise. EDIT: I need to display a status bar message...

java timer on current instance

import java.util.Scanner; import java.util.Timer; import java.util.TimerTask; public class Boggle { Board board; Player player; Timer timer; boolean active; static Scanner in = new Scanner(System.in); public Boggle() { board = new Board(4); timer = new Timer(); } public void newGame() ...

Create an incrementing timer in seconds in 00:00 format?

I want to create an incrementing second timer like a stopwatch. So I want to be able to display the seconds and minutes incrementing in the format 00:01... Google only brings up 24 hour clock examples, I was wondering could anyone get me started with an example or tutorial of what I want to do? Edit: Here is what I have using the Chr...

Flash - current time plus 30 minutes

hey all, im really new to flash, how do i go about creating a variable which will get the current date and time and add 30 minutes to it ? thanks ...

jQuery counter to count up to a target number

I'm trying to find out if anyone knows about an already existing jQuery plugin that will count up to a target number at a specified speed. For example, take a look at Google's number of MB of free storage on the Gmail homepage, under the heading that reads "Lots of space". It has a starting number in a <span> tag, and slowly counts upwa...

Scheduled task with windows services and system.timer.timer

Hi i want implement a windows services scheduled task. I already created windows service. In a service i have implemented a timer.The timer is initialized at class interval. The timers interval is set in the start method of service and also it is enabled in the start method of the service. After timers elapsed event is fire i have done s...

C# Running several tasks at different intervals

A design question: I'd like to build a Windows service that executes different commands at different intervals. For simplicity's sake, let's say I want to run some batch files. The input it gets is a list of files and the intervals at which to execute. For example: a.bat - 4 minutes b.bat - 1 minute c.bat - 1 minute d.bat - 2 minutes I...

Random loading swf files into main swf with countdown timer

ok guys a question, can this be done or has it already been done, or can someone point me in the right direction (be aware i an a total newbie with action script) i have a main swf movie about 600px x 400 px what i want is this to run for say 30 seconds, then i want a countdown timer in the bottom corner for say 10 seconds, after this ...