timer

How to avoid use of timer when using TThread to communicate with UI thread

I have a TThread which receives and sends to a device on a COM port. After I read the data, I want to activate the GUI (not in the same thread) using Synchronize(function name). However, when I call the GUI's form function to perform a button click, I get an access violation. I checked to see if the form's value is null and it is not, si...

Is there a better way to block a C# timer when interacting with the user?

I am using a System.Windows.Forms.Timer component on an application's main form which checks every minute for updates on a database. However, there are a number of possible interactions with the user, such as modal dialogs being thrown for certain operations. In general, I don't want this timer to fire when the user is "busy" or while an...

Calling a public method on windows service

I have a timer in a windows service (.NET C#). I need to be able to change the elapsed value from an external program. If the timer is currently running, I need to be able to shorten the time elapsed value from an external program. I was thinking of having a public method in the service that would change the timer elapsed value and r...

Periodic tasks inside WCF service hosted in IIS

We would like to have some periodic actions executed by our WCF service hosted in IIS. What is the best way to do this...Creating a timer doesn't look as a good solution. Creating a windows service that would behave as some kind of a heart beat looks like a problem solution, but it still doesn't smell good. What approach will be a good s...

Timers In C#, when the timer start ticking?

My question is when the timer is start ticking. Let's take for example, timer that configured to tick every second and I start my program on hh:mm:ss:ms = 22:40:34.50. The tick will start on round sec? Start on 17:40:35.00 or it's start on the exact time? So the first tick will be on 17:40:35.50 and the next one on 17:40:36.50. What ac...

Decrement at Regular Intervals in Java

I'm writing an application in Java, but need to know how to subtract from a variable once every second. What's the easiest way to do this? Thanks! ...

Automatically Loading At App Start

[Cocoa/Objective-C] I adapted a timer routine (for current time) from this site (and it works great - thanks). It's currently attached to a button. My question is: How do I make it start when my app starts up (and not use a button) (in other languages, I'd simply put the action listener or timer in the Form)...? Thank for any help on...

jQuery ajax and running timers

Im building an automatic refreshing comment section for my website using jQuery .load. So I am using a javascript 'setTimeout' timer to check for new comments. But after doing some stuff like changing comment pages or deleting (all using ajax), a few old timers keep running, even though I used clearTimeout before loading new ajax conten...

How to run a timer in an separate thread?

I have a loop like below for(int i = 0; i < 10; i++) { // some long time processing } I want to create a timer, which would check if one processing runs more than 5 minutes. If one processing runs more than 5 minutes, it would stop current processing then start another processing. Is it possible to make another thread to monitor...

How to send a push Notification every x minutes?

Hey, how is it possible to push a notification to a device, every x minutes? Thanks in advance ...

Timer access Class Field

Hi all Is there any possible way to access the field - str in the Class Program and the variable num - in the main function? class Program { string str = "This is a string"; static void Main(string[] args) { int num = 100; Debug.WriteLine(Thread.CurrentThread.ManagedThreadId); var timer = new System....

mysql random value change

I have a database in mysql with 1 table composed by 5 fields. Two of these fields are FLOAT and generated by RAND function; now i want to change these values each x time, for example numeric values have to change every 0.01 s to simulate a financial market. Is there a method to do this thing? Thanks ...

SQL repeat events by timer

I want that a column of my database, composed by float random numbers, change every x seconds determined by a timer. I read about Schedule Tasks Events but i can't work it. Please help ...

Better boost asio deadline_timer example

I'm after a better example of the boost::asio::deadline_timer The examples given will always time out and call the close method. I tried calling cancel() on a timer but that causes the function passed into async_wait to be called immediately. Whats the correct way working with timers in a async tcp client? ...

How is the thread-pool handled when using System.Timer objects in multiple threads?

Ok, I know an object of System.Timer executed in the thread-pool, rather than in the UI thread. I also know that the System.Timer is thread-safe. Say I have a collection of System.Timer objects. I can have all of them run and (unless i'm mistaken) they'll actually execute in the thread-pool. Say I instead create a collection of thre...

NSInvocationOperation Memory Problems on iPhone

Hi, I've been experiencing memory problems (the app will run for a couple of iterations, then receive low memory warning and finally be terminated) while working with NSInvocationOperation in a method called repeatedly by a NSTimer. The method will be called every 1/4 of a second and I've narrowed down the source of the problem to the ...

Delay start of jQuery rotators, one second apart from each other

I have three rotators on the front page and I'd like them to start 1 second after each other. $(document).ready(function(){ $('#rot_top').cycle({ speed: 500, timeout: 2000 }); $('#rot_mid').cycle({ speed: 500, timeout: 2000 }); $('#rot_btm').cycle({ speed: 500, timeout: 2000 }); }); after the initial start - th...

Java: Timer and thread it creates

Hey. I have this question: I have a timer. With scheduleAtFixedRate it creates a new Timer task. In that timer task there is certain code, which may take a while to complete. How can I make sure that Timer won't create new task when the previous one didn't complete yet? Thanks ...

PerformSelector Monotouch Threading

Using this statement calls the selector immediately instead of 6 seconds from now. this.PerformSelector(myStartWaitForSoundSelector, null, 6.0f); Does anyone know how to get this to work with a delay? I am using thread.Sleep(6000) in the function that gets called, but the entire app locks up for six seconds. Thanks ...

A little misunderstanding timers in python

Hi guys, can somebody tell me how to use this class timers from python in my code more than one time. import MOD class timer: def __init__(self, seconds): self.start(seconds) def start(self, seconds): self.startTime = MOD.secCounter() self.expirationTime = self.startTime + seconds if seconds...