timer

How do I asynchronously poll a file using a flash timer without blocking the UI?

I have a flex application that repeatedly polls a remote XML file to detect changes, but I've found that once the file hits a certain size, the poll blocks the UI and makes the page unresponsive for a short time. Is there any way to ensure that the call made to the server or the event from the flash.utils.Timer class runs asynchronousl...

Windows Service and Timers - Separate Processes?

What is the difference between having multiple Timers vs multiple Threads? I have a Windows service that runs in the background. There are about ten "Sites" in a database that get loaded on init. Each site gets initialized in its own Timer object, and then the Timer executes code on an interval for each site. The code executed is fro...

Run a function every X minutes - Python

Hello. I'm using Python and PyGTK. I'm interested in running a certain function, which gets data from a serial port and saves it, every several minutes. Currently, I'm using the sleep() function in the time library. In order to be able to do processing, I have my system set up like this: import time waittime = 300 # 5 minutes while(1)...

ASP.NET AJAX Modal Popup Extender Responding to Server Code on Timer

I have a modal popup extender tied to a asp:panel control that I want to show when the timer on an asp:updatepanel reloads executes the tick method. The tick method calls another method that checks for specific conditions and if all the conditions are met, I call: ClientScript.RegisterClientScriptBlock(this.GetType(), "key", "$find('mo...

How to I call a function at the same time on multiple iPhones?

I'm starting to use GameKit for a p2p project, and I want to call a function at the same time on both clients. Assuming their clocks aren't set to exactly the same time, how can I call NSTimer or whatever so my function is called at the same time on both clients? Thanks! ...

Timer events do not fire in a thread when using Server.MapPath

Hi, I have the following scenario with ASP.NET 2.0. I have declared an atlas:timer as follows in my .aspx page: <atlas:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="3000" Enabled="false"> </atlas:Timer> I also have a button on a form which when clicked launches a new System.Threading.Thr...

How to get time elapsed in milliseconds

Since performance of string concatenation is quite weak in VB6 I'm testing several StringBuilder implementations. To see how long they're running, I currently use the built-in Timer function which only gives me the number of seconds that have passed after midnight. Is there a way (I guess by importing a system function) to get somet...

C# Timer or Thread.Sleep

Hello, I am running a windows service and using a loop and Thread.Sleep to repeat a task, would it be better to use a timer method? If yes a code example would be great I am currently using this code to repeat int curMinute; int lastMinute = DateTime.Now.AddMinutes(-1).Minute; while (condition) { curMinute = DateTime.Now.Mi...

TimerService EJB 3

Hi, Related to TimerService, can I define two Timer instances and bind each timer to a specific (different) method annotated @Timeout in the same EJB? Thanks, Rod ...

Monitor the Date in Flex for a change

In Flex/ActionScript 3, is there a better way to monitor the date/time to determine if the date has changed to the next day by creating a timer that dispatches every minute? ...

Python clock function on FreeBSD

While testing Pythons time.clock() function on FreeBSD I've noticed it always returns the same value, around 0.156 The time.time() function works properly but I need a something with a slightly higher resolution. Does anyone the C function it's bound to and if there is an alternative high resolution timer? I'm not profiling so the Tim...

Java event handling

import java.awt.Color; import java.awt.Dimension; import javax.swing.JPanel; import javax.swing.Timer; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartMouseEvent; import org.jfree.chart.ChartMouseListener; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.entity.ChartEntit...

Windows batch file for renaming file at specified interval

I would like to write a windows batch file for the purpose of renaming a file every 25 seconds. I would also like the batch file to terminate after 300 seconds have passed. How would I go about doing this? Here is what I have thusfar. START RENAME test.g test.go SLEEP 25 RENAME test.go test.g GOTO START ...

Comparing Timer with DispatcherTimer

what is a difference between System.Windows.Forms.Timer() and System.Windows.Threading.DispatcherTimer() ? In which cases, we should use them? any best practices ? ...

C# How to raise PostBack on Timer.Tick event?

I use UpdatePanel with DataList element inside. I want to update the contents from DB every 10 secunds. I noticed that updating occures only after the postback. I did the code like <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" E...

Timers in Services

Hi all, we have recently added a new feature to our software - preview generation for documents that are uploaded and stored on the server. We did this the following way: The user uploads a document; Once the user opens the document information card, the preview for the recently uploaded document is issued (the info regarding the prev...

Capturing a time in milliseconds

The following piece of code is used to print the time in the logs: #define PRINTTIME() struct tm * tmptime; time_t tmpGetTime; time(&tmpGetTime); tmptime = localtime(&tmpGetTime); cout << tmptime->tm_mday << "/" <<tmptime->tm_mon+1 << "/" << 1900+tmptime->tm_year << " " << tmptime->tm_hour << ":" << tmptime->tm_min << ":" << tmptim...

What is the system effect of starting large quantities of timers in Java?

Hello, recently I have had to program some applications that require large amounts of timed tasks to occur. However, I'm afraid to create so many timers because I haven't been able to figure out how they are handled by Java. Is there a problem with starting large quantities of scheduled tasks? If so, what is the better alternative? ...

Will serial calls to Threading.Timer.Change() reset the timer's clock?

If I call Threading.Timer.Change() twice in a row, when will the thread next run? For example: myTimer.Change(5000, Timeout.Infinite); // Only 2 seconds pass. myTimer.Change(5000, Timeout.Infinite); After this, will the thread next run in 3 seconds or 5 seconds? I hope the answer is the latter, that the timer is reset with each call...

android timer

I need to display a time duration on a few of my Activities within the application. The timer starts when one of the Activity starts. Should I use service for the timer? is this the best way? or should I start thread from one of the Activity? ...