timer

System.Timers.Timer/Threading.Timer vs Thread with WhileLoop + Thread.Sleep For Periodic Tasks

In my application I have to send periodic heartbeats to a "brother" application. Is this better accomplished with System.Timers.Timer/Threading.Timer or Using a Thread with a while loop and a Thread.Sleep? The heartbeat interval is 1 second. while(!exit) { //do work Thread.Sleep(1000); } or myTimer.Start( () => { ...

Simple Android Binary Text Clock

Hello, I want to create a simple android binary clock but my application crashes. I use 6 textview fields: 3 for the decimal and 3 for the binary representation of the current time (HH:mm:ss). Here's the code: import java.text.SimpleDateFormat; import java.util.Calendar; import android.app.Activity; import android.os.Bundle; import an...

Timer in java ,time difference problem

I want to create a timer for my app. The sample code is shown below. When the method datetwo() is called the same time in milliseconds is shown as there in the main method. Please help me out with this import java.util.Date; import java.util.Timer; public class TimerChe { Timer timer; static Date date = new Date(); static D...

Using Timer only once

Hi, I want to use a timer only once, at 1 second after the initialization of my main form. I thought the following would have a message box saying "Hello World" just once, but actually a new message box says "Hello World" every one second. Why so? I had put t.Stop() in the tick event. Also, do I need to dispose the timer somehow to avo...

inaccurate .NET timer?

I'm developing an application and I need to get the current date from a server (it differs from the machine's date). I receive the date from the server and with a simple Split I create a new DateTime: globalVars.fec = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(infoHour[0]), int.Parse(infoHour[1]), in...

Scheduling a task on python

I want to run a program that runs a function every 4 hours. What is the least consuming way to do so? ...

Browser popup blocker blocking jasper reports generated from flex

Hi all, I have a flex application that uses navigateToURL() to call a servlet. The servlet in turn generates a JasperReport and then uses exportReport() to show the report in a new browser tab. Now, my problem is this. I want to generate multiple reports at once, each opening in its own tab. It all works fine except that in Firefox the...

ejb timer service vs cron

Hi Ejb timer service can start some process in desired time intervals. Also we can do the same thing with cron (min 1 minute) interval. But doing it with cron we have more power on controlling, monitoring and changing the intervals. Also we can restart if needed the cron very easily by command line. Also we can add or remove lines i...

How would I go about implementing a stopwatch with different speeds?

Ideally I would like to have something similar to the Stopwatch class but with an extra property called Speed which would determine how quickly the timer changes minutes. I am not quite sure how I would go about implementing this. Edit Since people don't quite seem to understand why I want to do this. Consider playing a soccer game, or...

Are timers supported by Windows Native API?

Do Windows Native API support Timers? I am aware that POSIX implementations on Windows support timer, but I am interested in Windows SDK APIs. ...

Need a Java based interruptible timer thread

I have a Main Program which is running a script on the target device(smart phone) and in a while loop waiting for stdout messages. However in this particular case, some of the heartbeat messages on the stdout could be spaced almost 45secs to a 1minute apart. something like: stream = device.runProgram(RESTORE_LOGS, new String[] {}); str...

asp.net/jquery - Countdown timer not working

Here is the full code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head runat="server"> <title></title> ...

System.Threading.Timer keep reference to it.

According to [http://msdn.microsoft.com/en-us/library/system.threading.timer.aspx][1] you need to keep a reference to a System.Threading.Timer to prevent it from being disposed. I've got a method like this: private void Delay(Action action, Int32 ms) { if (ms <= 0) { action(); } System.T...

PyQt:How to Place Progressbar in Splash Form

Guys any one can please help me in doing this -> I need to place a progress bar (QProgressbar) in a QSplashScreen . How can i do this in design?..can i really implement it? Using pyqt3 ...

What happens with timer tick after wake up from stand-by?

My C#-programm has a windows.forms.timer that fires all 24h for a background task. During a day I put my Vista 64bit several times in stand-by mode (never switch it off). It seems that after wake-up the timer is sort of reset. ...

Dispatcher Timer Problem

I am trying to make a game in silverlight that also has widgets in it. To do this I am using a dispatcher timer running a game loop that updates graphics etc. In this I have a variable that has to be accessed by both by the constantly running game loop and UI event code. At first look it seemed that the gameloop had its own local copy...

Correct way to do timer function in Python

Hi. I have a GUI application that needs to do something simple in the background (update a wx python progress bar, but that doesn't really matter). I see that there is a threading.timer class.. but there seems to be no way to make it repeat. So if I use the timer, I end up having to make a new thread on every single execution... like : ...

Date sensitive redirect

I found a similar question unanswered here but I wanted to throw it out there again to see if anyone has any solution for this. I have a site that needs to display a different home page depending on the date and time. I know this could be done manually by manipulating the .htaccess at appropriate times but because of a myriad of logist...

Incremental Timer

I'm currently using a Timer and TimerTask to perform some work every 30 seconds. My problem is that after each time I do this work I want to increment the interval time of the Timer. So for example it starts off with 30 seconds between the timer firing but I want to add 10 seconds to the interval then so that the next time the Timer ta...

Simple reminder for Android

I'm trying to make a simple timer. package com.anta40.reminder; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.os.Bundle; import android.widget.RadioGroup; import android.widget.TabHost; import android.widget.TextView; import android.widget.RadioGroup.OnCheckedChangeListener; import and...