timer

Detecting Idle time in a C# WinForms without Application.Idle

Hi, I have a strange issue that I'm not too sure on how to fix or address. I'm writing a mini text editor style application - RichTextBox editor. I need to do some complex parsing after the Selection changes - updating position, selection text and various other bits about the context of the text around the area. As it takes a bit of p...

(jQuery) javascript setTimeout clearTimeout

Hi I try to make a page to go to the startpage after eg. 10sec of inactivity (user not clicking anywhere). I use jQuery for the rest but the set/clear in my test function are pure javascript. In my frustation I ended up with something like this function that I hoped I could call on any click on the page. The timer starts fine, but is n...

C#: Why am I still getting an RCW error when exiting my application?

To be specific, the error is: An attempt has been made to free an RCW that is in use. The RCW is in use on the active thread or another thread. Attempting to free an in-use RCW can cause corruption or data loss. The application in question is a small applet that displays the current clock speed of the CPU as a system tray icon. I...

The best way to refresh my .aspx site with a Timer in C#?

I have a default.aspx page that needs to be refresh every 10 sec. My solution so far is a javascript function, but it only works in Firefox and not IE. I'm looking for a way to handle the refresh mecanism in the default.aspx.cs page instead, with some sort of Timer. Any good simple sugestions/hints or solutions out there that can lea...

jQuery timer, ajax, and "nice time"

So for this is what I've got: $(document).ready(function () { $("#div p").load("/update/temp.php"); function addOne() { var number = parseInt($("#div p").html()); return number + 1; } setInterval(function () { $("#div p").text(addOne()); }, 1000); setInterval(function () { $("#geupdate p").load("/update/temp.php");} ,10000); }); So th...

Problem with thread after SCREEN_OFF in Android

I’m doing an application that listens to the android.intent.action.SCREEN_OFF in a Service (if that matter) and then it is supposed to wait a few seconds and launch an action, I’ve tried a timer schedule method, thread and handler postDelay method but all of them seems to fail, they are never executed on a device, it seems like it’s bein...

Android Stop Counter and Destroy Media Player

I am working on an app that beeps every second. When I hit the home button I want it to close the program and stop beeping. Right now it closes the program but continues to beep. What am I doing wrong? if ((keyCode == KeyEvent.KEYCODE_HOME)) { isdone = true; mp.release(); counter.cancel(); finish...

My timer code is failing when IAR is configured to do max optimization

I have used timer A in MSP430 with high compiler optimization, but found that my timer code is failing when high compiler optimization used. When none optimization is used code works fine. This code is used to achieve 1 ms timer tick. timeOutCNT is increamented in interrupt. Following is the code //Disable interrupt and clear CCR0 ...

Timer a usage in msp430 in high compiler optimization mode

Hi, I have used timer A in MSP430 with high compiler optimization, but found that my timer code is failing when high compiler optimization used. When none optimization is used code works fine. This code is used to achieve 1 ms timer tick. timeOutCNT is increamented in interrupt. Following is the code, //Disable interrupt an...

How do I limit how often keys can be pressed on a jQuery slider?

Hello, I've made a slider that uses the left and right arrow keys to move the slide but when pressed to quickly it will bug a little and I was wondering if it's possible to limit the amount of presses in say a second. You can see it here: [link removed] $('#slider-nav div').click(function() { $('#slider-nav div').removeClass('select...

javascript countdown timer with cookies

I have a countdown timer that will show a target amount to be fundraised like USD1000000 and slowly count backwards to zero over a period of days. I got this snippet: $(function() { var cnt = 75000000; var count = setInterval(function() { if (cnt > 0) { $('#target').html("<s...

How are timed html forms, like the kind you encounter when doing online tests, properly coded using PHP, MySQL, HTML, CSS and JavaScript?

In other words, what technology would take care of doing the time tracking? Would it be the JavaScript? I don't see being able to keep track of such things with PHP. Here's what I need to accomplish: I need to have a long form spanning many web page reloads because it is pretty much an online test where each page load displays a new q...

Hot python input loop

I'd like to have something similar to the following pseudo code: while input is not None and timer < 5: input = getChar() timer = time.time() - start if timer >= 5: print "took too long" else: print input Anyway to do this without threading? I would like an input method that returns whatever has been entered since the...

Why do Asp.net timers/updatepanels leak memory in Chrome and can it be fixed/worked around?

I have built a suite of internal websites for our company to manage some of our processes. I have been noticing that these pages have massive memory leaks that cause the pages to be using well over 150mb of memory, which is ridiculous for a webpage that consists of a single form and a GridView that is displaying 7-10 rows of data at a t...

Timer (System.Threading) thread safety

Does anyone know if this code would be thread safe, or do I have to use lock when calling timer2.Change? Timer timer1 = new Timer(timerCallback1); Timer timer2 = new Timer(timerCallback2); timer1.Change(5000, 5000); timer2.Change(3000, 3000); public void timerCallback1(object state) { timer1.Change(Timeout.Infinite, Timeout.Infinit...

Question About Timers And Variable Intervals

The point of this timer is to execute some code whenever it's midnight. So basically, the first interval will be between Now and midnight and all intervals following that will be 24hours. Now that's all well and good, but I was wondering how this timer business works. Is the MyTimer.Interval recalculated each time the timer resets? S...

How to change a JLabel's text in a loop without switching so fast the user can't see it?

I want to create a simple clock using Java. The code is so simple that I will give an example: for(int i=0;i<=60;i++) jLabel11.setText( Integer.toString(i) ); The problem is while I'm running my program the result didn't show each update in sequence. It show only the 60 digit immediately, without showing the change from 1 to 2 to 3...

How to use timer in a thread

Hi, I would like to send email notifications to users of my project exactly at 8 a.m, Here we are using a thread to send emails to the user. I would like to send some emails exactly at 8 A.M. How can I execute that perticular logic in this Thread. Please help me. ...

Qt - QTimeEdit as a timer viewer

I have a QTimeEdit which I want to set to some value and the each second I want to decrease by 1 the value that shows the QTimeEdit. So when it will be 0, the I want to have a QMeesageBox that says "Your time is off.". Can I some how do this with QTimeEdit interface, or I should use QTimer? ...

Pass arguments to a delayed function with Haxe

Hi everyone, do you know if there is an easy way to pass some arguments to a function called via haxe.Timer.delay(func, delay); By "easy" I mean without creating any custom timer. Thanks. ...