FAQ Database Discussion Community


How accurate is python's threading.Timer over extremely long intervals (days)?

python,multithreading,timer
I have a server application that needs to schedule functions to be called at various times during the week, with a desired accuracy of plus or minus 15 seconds, let's say. threading.Timer is the simplest solution, but I'm concerned about accuracy when using intervals of several hundred thousand seconds. Everything...

using the timer in C# for periodic check events? [closed]

c#,timer
Dear brothers I'm a new comer and I am using XML as database and I want to retrieve the method that fetches data to my label control at every 10 seconds using Timer control in C#. For Instance The method which retrieves the data and The timer control is: private...

How to set a timer to an ActionListener

java,timer
I have created a slot machine game. In my slot machine game I have a button that will generate three random images when it is pressed. I want this button to generate three random images 5 seconds after it is pressed. Here is my code for the button and its...

A newbie and the timer module that doesn't compile

c++,timer,arduino
I'm totally new to C/C++. I've done some higher languages like Java and C# but that's something else I must say. I'm trying to build a timer module for the Arduino so that I can easily queue work that has to be executed after a certain amount of time without...

How do I unhook an lambda event handler inside the lamda method?

c#,timer,eventhandler
So I looked on SO and found how to unhook anonymous event handlers and that is no problem. But the problem I have is how to unhook the event handler inside the instance of the event handler itself. For example I have a timer: System.Timers.Timer aTimer = new System.Timers.Timer(); System.Timers.ElapsedEventHandler...

how to create a timer for counting reservation time in asp.net?

asp.net,timer
I've created a hotel room reservation website . Assume that a person who wants to reserve a room has 30 mins time to do that and after 30 mins the site would stop the reservation session for him ; and during this reservation he would pass several web page for...

How could I wait 5 seconds before displaying the next tooltip here? [duplicate]

c#,winforms,timer
This question already has an answer here: How to asynchronously wait for x seconds and execute something then? 6 answers I believe I've followed most guidelines here, so hopefully this question isn't out of place. For starters, I've Googled already, but honestly have no idea what to Google in...

Potential race condition in the timer class?

java,multithreading,timer,thread-safety
I have written a timer which will measure the performance of a particular code in any multithreaded application. In the below timer, it will also populate the map with how many calls took x milliseconds. I will use this map as part of my histogram to do further analysis, like...

Start task using calendar object where just the second is set

java,multithreading,timer
Using below code, I'm attempting to start a thread when the second part of the time reaches 0 - ie when the next minute starts. public class Sched { public static void main(String args[]) { Calendar calStart = Calendar.getInstance(TimeZone.getTimeZone("GMT+1")); calStart.set(Calendar.SECOND, 0); ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(new Sched().new RC(), calStart.getTime().getTime(), 3,...

Javascript timer - You generated the link “X seconds ago”

javascript,html5,timer
How can I make a text display "You generated the link "X seconds ago" after you generate a link. It's part of a website for file-hosting. I've tried googling, but haven't come to anything that answers my questions. I'm not even sure if it is Javascript (I'm just assuming!)...

Using TimerTask and Timer with Widget AppWidgetProvider

android,timer,widget,timertask,appwidgetprovider
I'm creating a clock widget using Android. I've tested the clock and the logic seems fine, but I need to get it to update every minute. I set the updatePeriodMillis to 60000 in my XML but Android limits this to 30 minutes, so it only updates every half hour. I...

BPMN event-based gateway with conditional flow

timer,bpmn,camunda,event-gateway
I am trying to model an event-based gateway that waits for several messages, and optionally for a timer. Before using this in a real model I tried it in a unit test, and it seems in the camunda engine the condition is completely ignored. Now I'm wondering if this is...

What happens if a calculation within a Timer Tick, takes longer than the Tick length?

c#,winforms,timer
In a C# System.Windows.Forms.Timer, what would happen if the code within the timer tick took longer to calculate than the tick length? For example, in the code below, what would happen if updating the label took longer than the interval of the tick (1 second)? private void timerProgress_Tick( object sender,...

Mouse input problems in java

java,swing,timer,mouse
Edit: I have an application that uses a swing Timer to control when an action listener interface fires. The mouse logic works but occasionally will not detect a click. Below is my commented code. public class Board extends JPanel implements MouseListener, MouseMotionListener, ActionListener { private MainMenu mainMenu = new MainMenu();...

glitches when using time overflow interrupt

c,timer,interrupt,avr,attiny
I have some trouble with, I guess, the overflow interrupt (used to increase resolution on 8-bit timer from 16µs/step to 1µs/step) in my CODE. It seems like the overflow interrupt triggers while the program is in the if-statements in my main loop and thereby screws thigns up! if(pInt == 1)...

Stop clock on pause button

actionscript-3,timer
I have a "clock" counting down the time of the game (from 9 seconds to 0 seconds). I have a button that pauses the game, so I want to freeze de clock and when I click to play, the game continuos from that second that I frozen. But I don't...

Delphi and sleep function

delphi,timer,sleep
I am having some issues regarding the sleep function. I have my application which executes an external command with some options: str := 'C:\BERN52\MENU\menu.exe C:\BERN52\GPS\PAN\DAILY.INP C:\GPSUSER52\WORK\MENUAUX_DAILY.INP'; WinExec(Pansichar(str), SW_Shownormal); After that when this process is finished I should kill it and continue with another things. I did the following: Sleep(60000*StrToInt(Form1.Edit11.Text)); winexec('taskkill...

waiting for x hours before executing a function using timer does not work

c#,timer
I want to wait for x hours before executing some code in C#. i thought using a timer would be a good idea. (using thread.sleep does not seem right). But it just does not work. i am using the following code: static void Main(string[] args) { System.Timers.Timer timer = new...

Catching exception from timer

python,exception,timer,watchdog
I am trying to create a watchdog class, that will throw an exception after specified time: from threading import Timer from time import sleep class watchdog(): def _timeout(self): #raise self raise TypeError def __init__(self): self.t = Timer(1, self._timeout) def start(self): self.t.start() try: w = watchdog() w.start() sleep(2) except TypeError, e:...

Java's TimerTask run() function not called when calling trait function inside

java,scala,timer,timertask,trait
I have the following code: trait IntervalUpdate { val updateInterval: Long def onUpdateTask(): Unit val timer: Timer = new Timer() val timerTask = new TimerTask { override def run(): Unit = onUpdateTask() } timer.scheduleAtFixedRate(timerTask, updateInterval, updateInterval) } I mix this trait into some classes and override the onUpdateTask method. The...

timer that calls every n milliseconds a function without .after or threading

python,timer,tkinter
I need a timer that calls a function every n milliseconds. This should not be in a endloss loop (while true) or something like that import threading def printit(): threading.Timer(5.0, printit).start() print "Hello, World!" Or def printit(): root.after(100,printit()) As I have a GUI that should be able to interact. So...

Stop angular $timeout timer after hitting back button

javascript,angularjs,timer,settimeout,back
In my Angular app, I have Page 1, and Page 2. Page 1 is basically the home page with a button linking to Page 2. Page 1 has an angular app called Page1App and a controller called Page1Ctrl. Page 2 has an angular app called Page2App and a controller called...

Jquery: countdown should not be reset when it goes to next page

javascript,jquery,timer
Let us assume, In the home page, countdown is going to start may be from 2min 59sec, after 1min i have moved from home page to next page, here the countdown should show 1min 59sec right ?, but in my case it goes to again 2min 59sec. I have been...

Javacsript counter works only once

javascript,timer
I have a jsfiddle here - http://jsfiddle.net/5z2vu47a/ It's a simple timer that should change text that taken from and array The timer only works once. Why does the timer not contiue to work. var name_arr = ['learn', 'product', 'buying', 'selling', 'marketing', 'managing', ]; var counter = 0; function names(){ alert(counter);...

how to fix error 1009 in as3

actionscript-3,timer,typeerror
hi i have been searhing the net for hours and have not found a solution to my problem and i have no idea how to fix it as i am only new to flash so if you know anything that might help me just comment below please all help is...

How to get the Winform program run time?

c#,winforms,timer,quartz.net
I am using quartz.net to close the machine in supermarket,when at 22:00.Trigger the shutdown event: public void Execute(IJobExecutionContext context) { logger.Info("shutdown....."); try { StatusHelper.ShutdownComputerImpl(MachineOperType.Shutdown); } catch (Exception e) { logger.Error("Shutdown computer encount an error", e); } } But the quartz.net will trigger the job when first time run!!!! So I...

Timer flash to show something at the right time

actionscript-3,flash,video,timer
I want to make a timer that will show text at my panelText (dynamic text box) at specific time, actually I have a video that I want to have subtitles, and I want to use timer, my video is 3 minutes and 37 second long, and I have script that...

jBPM 6.2.0 send recurring Task reminder after 1 day time interval if the task is not complete

events,timer,signals,task,jbpm
I am new to jBPM. I am working on jBPM version 6.2.0. I want to perform following tasks. Send reminder email to user / group. Remind the user again after 1 business day if the task is not yet complete. Continue to send reminder everyday untill the task is done....

C# ListBox not showing added items when added from DispatcherTimer.Tick

c#,wpf,binding,timer,listbox
This looks like a weird behaviour to me and since I do not like to blame anyone else than myself I spent hours by trying to fix this - but I do not understand this at all: I just noticed that the problem occures in a method called by a...

Is there a way to use a UIButton for text in a countdown timer?

ios,objective-c,timer,uibutton,uilabel
I'm a new in iOS Development and I am writing an app that has a countdown timer. I want the user to be able to tap on the time to set it so I used a UIButton as that seemed the easiest thing. I've seen questions on this site about...

How to check if a response packet is received within a particular time limit?

java,timer,timertask,datagram
Suppose a client sends server a request. The server responds with an ACK. However, if the server does not respond within two seconds, the code terminates. socket.receive(ack); is a blocking call. However, I assumed that if I disconnected the socket in timer task, this blocking call will be ignored now...

Issues with long running Handlers, Timers, and Tasks?

java,android,timer,android-handler
I've seen a number of questions using the Handler or Timer implementations in Android apps to delay an update to the UI thread. Most of these seem to be short - a few seconds at most. Are there issues with using a 24 hour delay for a task? How does...

Run a javascript timer only once on aspx page

javascript,html,asp.net,timer
I have a function in my Site.Master page that displays a popup after 30 sec. But each time I load a subpage the timer statrs over and pops up again after the 30 sec. I need it to display once, the whole time they are visiting the website. here is...

Countdown timer goes into negative number (00:00:00)

c#,timer
I made a simple countdown timer but the timer goes into negative -1 : 59 : 59 when i input 0 : 0 : 0 on the textboxes. i tried to input 0 : 0 : 1 and the timer stopped at 0 : 0 : 0 and the messagebox...

I Would like to add pause button to my countdown timer in angularjs

javascript,angularjs,timer
$scope.countdown = function () { countdownStop = $timeout(function () { if ($scope.counter == 0) { $scope.stop(); $scope.completeRound(); } else { $scope.counter--; $scope.countdown(); } }, 1000); }; $scope.stop = function () { $timeout.cancel(countdownStop); } here i can able to stop and start but now i would like to add pause button...

Not sure how to put timer into my keylistener code

java,swing,timer,keylistener
basically, I have a keylistener code (I am aware of keybindings thank you but I don't need that for my project), and it will re-size the window frame based on what you press. However, when you hold down w, it goes like this w [pause] wwwwwwww and it's noticeable whenever...

ACTION_TIME_CHANGED Intent, can we set this to trigger based on a “set time”?

android,unity3d,timer,broadcastreceiver
Just a quick question about this, for the android platform, I was directed to this link from another question.. Is there a way to detect when the user has changed the clock time on their device? If the player changes their system time, this event would trigger. I would only...

WPF DispatcherTimer doesn't keep time when resumed

c#,wpf,timer
When you set in a DispatcherTimer the property IsEnabled to false, it is supposed that the timer keeps its state in the background or instead it is stopped and reset? In the following example, with a timer interval of 5s, if you run the application and if you click the...

How can I stop the timer?

ios,swift,timer,sprite-kit
I just started to learn how to program games for Apple and i've been searching how to stop a timer. In the following code i have i want to stop the timer i made but I'm having trouble how to stop it. i have no clue. Please help me! Thank...

How can I make this timer() work as I want?

java,swing,timer,colors,jframe
I am having a bit of trouble with the code before. It is doing what I want, but I can only call the method once, if I call it more than that it won't work, essentially it only works once. So right now this ballG is an object. It starts...

AS3 How to Set Up A Max Time Count Up

actionscript-3,flash,timer,timeout
I have the following count up code, but am not sure how I would be able to include an if else statement to have the count-up stop at 15 seconds for example. Here is the code: var timer:Timer = new Timer(100); timer.start(); timer.addEventListener(TimerEvent.TIMER, timerTickHandler); var timerCount:int = 0; function timerTickHandler(Event:TimerEvent):void{...

C# How to notify other classes with a single timer?

c#,timer,delegates
I am trying to make a global timer where everything that needs to be notified after certain time has passed. For instance, in a game, there would be buffs and attack cool down timers and item cool down and much more. Managing them separately is fine, but how would I...

timer with delay, reset and restart? jQuery

javascript,jquery,timer
So I basically have a timer which counts 1 number every 4 seconds. It stops when it hits 10. Q: How do i make it so that the timer stops at 10 for a couple of seconds, then starts counting again at 1? var i = 8; setInterval( increment, 4000);...

c# implementing a timer [closed]

c#,timer
I was struggling with implementation of a timer more than i should so i have decided to post a question here. This is my class: public static class CurrentPoint { public static Single X { get; set; } public static Single Y { get; set; } public static Single Z...

Have an button reset and start a countdown timer

javascript,php,jquery,timer
I am trying to begin a countdown timer when a button is clicked. I have searched and found a few different items, but nothing that seems to function. I have different buttons throughout the domain that will set different times (IE: 120 seconds, 60 seconds, etc). The display is in...

How to delay a jquery event that isn't an animation? [duplicate]

javascript,jquery,timer,delay
This question already has an answer here: jQuery: Can I call delay() between addClass() and such? 5 answers I have a jquery event that I want to occur only after a certain amount of time. Apparently, delay only works with animation events. Is there an alternative to delay I...

How many threads (timers) can I launch using System.Threading.Timer from one thread?

c#,multithreading,timer
I am in C# .NET 3.5. It seems, that by registering more than 10 System.Threading.Timers from same thread causes the first ones to die off somehow... Can't believe it though. If that was true, I'd be more than shocked. Here is the line, where I start a timer, each time...

Backgroundworker to stop work after specified time

c#,multithreading,timer,backgroundworker,stopwatch
I have went over dozens of question and tutorial but ended up with nothing so I hope to get help of you guys. I have a BW, doing some heavy work (rading up services, saving them into a file). BW is initialized at run time, and fired up with button...

How to use time delay in MobileFirst adapters

timer,delay,mobilefirst,mobilefirst-adapters
Has anyone tried introducing Delay/timer into the MobileFirst Platform Foundation adapters? is there anyway to introduce specific amount of delay? I tried setTimeout() but that doesn't work because of window object will not available in Adapter.js...

Set a timer in R to execute a program

r,timer
I have a program to execute per 15 seconds, how can I achieve this, the program is as followed: print_test<-function{ cat("hello world") } ...

NSTimer selector keeps getting called even in the background

ios,timer,background
So, I have an NSTimer that is set to call a selector every second: timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(TimerSelector:) userInfo:nil repeats:YES ]; This is all fine, but ever since I updated to iOS 8, I've noticed that this selector keeps getting called even after the application goes to the...

How can i make the lose label to appear once the timer hits zero?

ios,swift,timer,sprite-kit
I'm a beginner in coding and I need help in the following code. I'm trying to make the "You Lose!" label appear after the timer hits zero, but when I try to do it; it doesn't show anything. Please help me! class Game: SKScene { let Ball = SKSpriteNode(imageNamed: "Red.png")...

Why Timer has no properties, how to get it's interval after initialization?

c#,.net,multithreading,timer,windows-services
I'm using a System.Threading.Timer in my windows service for nightly import routines. It looks every minute into the database for new files to be imported. Now, since the service runs all day long, i want to change it so that it runs at night every minute and at day every...

Update a Label with a Swing Timer

java,swing,timer,jlabel
I'm having some trouble with this piece of code. I'm starting a timer with a random number, and I want to update a JLabel with the countdown, every second. But I haven't figured out how to do so, since the only listener the timer triggers is at the end of...

Calculating average and percentiles from a histogram map?

java,multithreading,timer,thread-safety,concurrenthashmap
I have written a timer which will measure the performance of a particular code in any multithreaded application. In the below timer, it will also populate the map with how many calls took x milliseconds. I will use this map as part of my histogram to do further analysis, like...

Auto-repeating count down timer in ReactiveCocoa

ios,objective-c,timer,reactive-cocoa
I'm new to ReactiveCocoa and there is a problem I couldn't yet find a way to solve. I have a network request in my app which returns data to be encoded in a QR code that will be valid for only 30 seconds. The network request returns a RACSignal and...

Timer not resuming after game loosing focus

java,timer,libgdx
I have a recurring task. I schedule it in the standard way (Timer is the libgdx one: com.badlogic.gdx.utils.Timer): Timer.schedule(myTask, 2, 2); When the user wants to pause the game, I call: Timer.instance().stop(); to pause the execution of the task. When the user resumes the game I call: Timer.instance().start(); This works...

Using a timer to alter the alpha for object for a few seconds?

java,android,timer
I'm an android newbie so need the simplest code example here, I have a Layout where upon an OnClick, I want to set the alpha to 0.50 for 2 seconds before it navigates me to another page (kind of like a button shade effect). LinearLayout ChangeThisLayoutAlpha = (LinearLayout) findViewById(R.id.ThisLayout); ChangeThisLayoutAlpha.setAlpha((float)...

Why udelay and ndelay is not accurate in linux kernel?

timer,linux-kernel,linux-device-driver,delay
I make a function like this trace_printk("111111"); udelay(4000); trace_printk("222222"); and the log shows it's 4.01 ms , it'OK But when i call like this trace_printk("111111"); ndelay(10000); ndelay(10000); ndelay(10000); ndelay(10000); .... ....//totally 400 ndelay calls trace_printk("222222"); the log will shows 4.7 ms. It's not acceptable. Why the error of ndelay is...

How to use swing timer?

java,swing,timer,actionlistener
I'm trying to write a program that draws a new square every second. This is my code for my JPannel class. I have two other classes but I beleive they are irrelivant to my question. One has the main method where it creates an object of the other class that...

Problems animating a countdown in swift sprite kit

ios,swift,animation,timer,sprite-kit
I am trying to add a countdown to my app and I'm having problems animating this. The look I'm going for is something similar to the iPad countdown shown below, with the red bar increasing as the clock counts down. Initially I created an image atlas with an individual image...

Two ISR with the same timer AVR

timer,interrupt,avr
I'd like to know if it's possible to use 2 different ISR (e.g. ICP input capture and timer overflow) in AVR microcontrollers

AS3 - reset delay on Timer

actionscript-3,flash,timer
I have a private Timer object in an AS3 Class called _countDownTimer. When the class is instantiated, I also initialize the Timer once like so with some arbitrary delay _countDownTimer =new Timer(10000, 1); _countDownTimer.addEventListener(TimerEvent.TIMER, onCue,false,0,true); The problem is I need to change the delay time every time the Timer runs....

HTML/CSS Countdown Timer

javascript,jquery,html,css,timer
I have a html page which takes hour and minute inputs for exams. - In another html or css document I would like to essentially run a countdown timer of HH:MM. i.e. if input was 1 hour and 10 min it would countdown from 01:10 to 00:00. I am assuming...

Schedule to run a method at periodic time in java

java,methods,timer,scheduler,runnable
I have to schedule a method to be executed when starting and periodically thereafter at intervals of 1 minute. For that I have done this: public void init(){ loadConfig(); //method which needs to be executed periodically Timer scheduler = new Timer(); scheduler.scheduleAtFixedRate(loadConfig(),60000,60000); } This is giving an error and it...

ImageView setBackgroundRessource not update even with inflate

android,gridview,view,timer,adapter
I'm trying to update an imageView from a gridview with a border, for doing this I have this xml file which works : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#158CDB" /> </shape> </item> <item android:left="3dp" android:right="3dp" android:top="3dp" android:bottom="3dp"> <shape android:shape="rectangle"> <solid android:color="#FFFFFF" /> </shape>...

How to add a timer to a function - IOS Swift

ios,function,swift,timer
Say I had a function, any function, that I wanted to run for only three seconds and then never run again. How would I do this? Would I use NSTimer? Thank you for your help.

Calling Stop Timer in Timer.Tick

c#,timer,.net-4.5
I call myTimer.Stop(); in the middle of the myTimer_Tick method. Before asking this question, I read this question: Stop timer in the middle of the tick; but my question is something quit different: I think if call myTimer.Stop() or myTimer.Enable = false , the Tick method will run to the...

How to create Stop watch

javascript,jquery,ajax,timer
I have an Ajax call. Something like this: $(document).on('submit', '#formPropiedades', function(event) { event.preventDefault(); var content = {}, url = "http://www.xxxxyzzz.com/xxx/yyy/web/ajax.php"; $("#dialog1").dialog("open"); var posting = $.post(url, { im_core: 'saveAllAdds', idFeed: <?php echo $_POST['idFeed'] ?>, pais: <?php echo $pais1?> }).done(function(data) { if (data == 1) $(".overlay-bg1").html("Suces...."); else $(".overlay-bg1").html(data); }); <?php } ?>...

Timed while loop not terminating [duplicate]

java,timer,while-loop,timertask
This question already has an answer here: Loop doesn't see changed value without a print statement 1 answer Running this code, I would expect it to increment the test variable for 5 seconds and then finish. import java.util.Timer; import java.util.TimerTask; public class Test { private static boolean running; public...

Disposing a timer inside a ViewModel, upon closing the main window

c#,wpf,mvvm,timer,mvvm-light
Currently in my application, I have a RelayCommand which calls an action which starts a Timer. I have a separate command which the calls the Dispose() method to get rid of/release the timer. This all sits in the ViewModel counterpart of the project. Using the MVVM pattern, how would I...

Javascript implementing multiple countdown timers in a table

javascript,html,timer
I have tried to create multiple countdown timers in a table that will rely on variables to set its time left. Currently there are no results output to the page and I'm not sure why. Ideally, this should display 4 countdown timers var table; table = ("<table>"); for (i =...

Matlab - Trouble using multiple timers

matlab,timer
Hi I am writing a program on matlab which uses multiple timers. Each timer calls a different function. I have t = timer('Period', 0.1,... 'StartDelay',1,... 'ExecutionMode', 'fixedRate',... 'TimerFcn',@moverobots)... t1 = timer('Period', 0.1,... 'StartDelay',1,... 'ExecutionMode', 'fixedRate',... 'TimerFcn',@moveintruder)... t2 = timer('Period', 0.1,... 'StartDelay',1,... 'ExecutionMode', 'fixedRate',... 'TimerFcn',@moveintruderout)... start(t); start(t1); start(t2); My problem is...

Unable to get the timer working

timer,atmega
I have written simple timer program for Atmega328 in normal mode. But I am unable to flash the LED if I compile the code in Atmel Studio 6.2. But same code works perfect if I compile in arduino IDE. I have given the code for Arduino as well as Atmel...

how to pause timer in another activity in android

android,timer,tabs
I have a tabActivity public class MainActivity extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Resources ressources = getResources(); TabHost tabHost = getTabHost(); // Android tab Intent intentAndroid = new Intent().setClass(getApplicationContext(), AndroidActivity.class); TabSpec tabSpecAndroid = tabHost .newTabSpec("Android") .setIndicator("android", ressources.getDrawable( R.drawable.icon_android_config )).setContent(intentAndroid); //...

Using the Timer Class with Selenium & C#

c#,selenium,visual-studio-2013,timer
I am using Selenium to login to a webpage and get to what would be that site's "homepage." In most cases I use a call to: IWebDriver driver = new FirefoxDriver; driver is declared much earlier, but I have it here for reference. diver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(<insert time here>); Normally, this will be...

C# Timer refuses to stop ticking

c#,multithreading,timer
I have been scratching my head all day on this one and it is infuriating me, is there any obvious problems with this that I do not know about ? Here is the code: private Timer _timer = null; private EventHandler ev = null; private void startAnimatingPicStatus() { Console.WriteLine(" |...

countdown timer on a quiz android app

android,timer
I am trying to make a simple quiz for practicing. I have problem adding a countdown timer. It works fine if no question is answered, but when I answer a question (even if it is correct or wrong), the timer doesn't reset. I saw on developer.android.com that there is the...

Stopwatch To Write Results To A TextFile

c#,asp.net,timer
Using a stopwatch() in an ASP.NET .aspx.cs page. I am trying to measure performance and am not sure how to do such with a web form. I'd like to have the start() event fire when the procedure opens and the stop() event fire once the last line of code is...

Timeout.InfiniteTimespan in .Net 4.0?

c#,.net,timer,.net-4.0,.net-4.5
I actually do know that Timeout.InfiniteTimespan does not exist in .NET 4.0. Noticed, there's also Timeout.Infinite which does exist in .NET 4.0 I am calling those two methods: // the Change-Method public bool Change( TimeSpan dueTime, TimeSpan period ) // the Constructor of Timer public Timer( TimerCallback callback, Object state,...

JS - clearTimeout vs. delete

javascript,timer
I am using a timer to call a function after 1 minute. var timer = setTimeout(function() { console.log("timer trigger"); }, 10000); clearTimeout(timer); clears the timer and delete timer; returns false. Why delete is not working with timers?...

System.Threading callback does not seem that accurate

c#,timer
My application receives instructions from my client. On each instruction I want to execute code from the received timestamp + 10 seconds. To test the accuracy of my code I mocked up this simple console test: static DateTime d1 = DateTime.Now; static Timer _timer = null; static void Main(string[] args)...

Comparing current date time(live) with file last modified

java,file,date,timer
I want my program output such that, whenever it receives a text file from a client, It will print "A new file has been received!". The text files will be store in C:/Users/%UserProfile%/Desktop/ad. The code below is to check whether a new text file has been received into the directory....

Java timer to integrate into my code (Java)

java,swing,timer,greenfoot
So, basically, I have to make a timer that goes on for thirty seconds. I've done that. I also have a grid that needs to be displayed while the timer is running. I also have that. My problem is, the grid is only displayed when the timer is not running,...

Show paused Timer value in Label

c#,winforms,timer
I've created a C# windows form application that uses a timer to clear the input boxes every 5 minutes. There is a label called lblTime that displays the amount of time elapsed at any given point while the application is open. I would like to be able to disable or...

Use Scheduler to execute/access task from Servlet

java,servlets,timer,cron4j
What I would like to do: If a user on my web application (tomcat, java) performs an action and 1 week passes before he performs it again, I would like to send him an email. For example, someone performs a "like" on jan 1, 2015 then performs another "like" on...

how to stop timer with another function javascript

javascript,html,timer,timing
So I have this code function timer() { setTimeout(function(){alert("Out of time")}, 3000); //Alerts "Out of time" after 3000 milliseconds } function resetTime() { timer(); //this is not right, i thought it would override the first function but it just adds another timer as well which is not what I want...

javaFX : How to periodically load information from db and show it on a Label?

database,timer,javafx
I want to execute a method periodically, this method get informations from database it show it into a label, I tried the following code : Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { //update information miseAjour(); } }, 0, 2000); when i run the main...

How to open a modal pop up after timer runs out?

javascript,timer,popup
I am a beginner in javascript & writing js code for a web application but stuck at one point. I have a web page with a timer for 5 seconds and after the timer runs out I expect a modal to popup. I have written the code here. I just...

Is there any way to disable a windows.form.timer inside a Task?

c#,timer,thread-safety,task
Is there any way to disable a windows.form.timer inside a task? here is an example code that I have. private void timer1_Tick(object sender, EventArgs e) { Task.Factory.StartNew( () => {runTask();} ); } private void runTask() { //Process here.... timer1.enabled = false; MessageBox.Show(timer1.Enabled.ToString()); } When I run the program the value...

How can I access a timer variable cerated in a Watch Extension app in the parent iOS app?

ios,swift,timer,countdown
I have built a Watchkit application in Swift that includes a timer (countdown from 25 minutes by seconds) and I want to be able to display that countdown in the iOS app. The problem is, the method that updates the timer is in the Apple Watch app, and I have...

Changing Background Color when a countdown timer is activated

javascript,jquery,html,css,timer
So I'm trying to figure out how to change the background color of a page after a countdown timer has been activated. For example I have code below that displays a 5:00 timer that begins counting after selecting the "Start" Button. When you press "Stop" the timer obviously stops, and...

Java swing Timer loop slows down

java,swing,timer
So, I'm trying to create a small game using Swing in Java. The game loop I created uses a javax.swing Timer. This timer (normally) calls a loop every 5ms. Timer tm = new Timer(5, this); tm.start(); @Override public void actionPerformed(ActionEvent e) { game.tick(); repaint(); revalidate(); } My code can be...

Best practice for scehduled background task Android

android,service,timer,background,scheduled-tasks
I am creating a notification app, which will alert user after they set a reminder notification. My current implementation logic is: Create a Service, which starts running in background when user opens their app. In onCreate() method of service, I am implementing a Timer task which will repeat after 5000ms...

Timers in javascript don't want to stop counting sometimes

javascript,jquery,timer,clearinterval
I have 3 timers in javascript and I created buttons to control their flow (switch them). However (only!) sometimes they don't want to stop. Where can be the problem? Too much timers? I was testing it on Google Chrome. So, most important parts of my code: //to insert infos function...

Circular timer sgv html js css, when making it bigger, the lines don't match up to the size

javascript,html,css,svg,timer
I have a circular timer done with js, css and html using svg. When i make the timer bigger, the lines don't match up with the timer so there is always a gap in the circular timer. How do i make the line that is drawn bigger to complete a...

How can I make my own timer without standard library?

c++,loops,timer
Is there some specific number of iterations, that I could make using a for loop, so that it exactly takes 1 second for the loop to be executed completely? For example the following code took 0.125s on my machine to execute: #include <iostream> #include <cmath> using namespace std; int main(){...

Pass self class parameter python

python,timer
Here is definition of my class full of static functions. I want to use all of them in "sendLog" function which call himself with time interval (10 sec here). When I run this interpreter tells me "TypeError: sendLog() takes at least 5 arguments (0 given)" But it if I enter...

Application freezes when I try to draw on a JPanel

java,swing,timer,jpanel,paintcomponent
I have two JPanels: public class FirstPanel extends JPanel public class SecondPanel extends JPanel implements Listener FirstPanel.addListener(SecondPanel) SecondPanel.setPanel(FirstPanel) Listener is an interface that has a single method update(). The SecondPanel has a middleLeftPanel where I want to place the FirstPanel: DesignUtils.addComponentAndConstraints(middleLeftPanel, FirstPanel, DesignUtils.createGridBagConstraint(0, 0, 1, 1, 1, 1, 0, 0,...

How to make the timer tickle each second and make it jump when video is forwarded or rewinded?

javascript,jquery,html5,timer,html5-video
I am trying to make a timer which indirectly syncs with the video. When starttimer is clicked, it should starts my timer and tickle each second. Here is the process: 1. Start the video 2. At a certain time in video, click to start the timer 3. Timer starts from...