Search Results

Search found 1610 results on 65 pages for 'timer'.

Page 8/65 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • form update too expensive to be executed in Winform.Timer.Tick

    - by Abruzzo Forte e Gentile
    Hi all I have a WinForm drawing a chart from available data. I programmed it so that every 1 secong the Winform.Timer.Tick event calls a function that: will dequeue all data available will add new points on the chart Right now data to be plotted is really huge and it takes a lot of time to be executed so to update my form. Also Winform.Timer.Tick relies on WM_TIMER , so it executes in the same thread of the Form. Theses 2 things are making my form very UNresponsive. What can I do to solve this issue? I thought the following: moving away from usage of Winform.Timer and start using a System.Threading.Timer use the IsInvokeRequired pattern so I will rely on the .NET ThreadPool. Since I have lots of data, is this a good idea? I have fear that at some point also the ThreadPool will be too long or too big. Can you give me your suggestion about my issue? Thank you very much! AFG

    Read the article

  • Timer in windows service

    - by Markus
    Hi. I have an issue with System.Threading.Timer. I am scheduling some actions using a time in a windows service. The timer starts executing the callback after a specified dueTime period. The windows service starts up after reboot automatically. However, I have observed a strange thing after a system reboot- the callback method starts executing itself 3 or 4 minutes before the specified period. What might be the reason for such behavior? Here is the sample code: TimeSpan timeToWait = this.StartTime - DateTime.Now; Int64 msToSleep = (Int64)Math.Round(timeToWait.TotalMilliseconds); _timer = new Timer(callback_method, null, msToSleep, MinutesScheduledInterval * 60000); where _timer is a member variable, StartTime - the time when the timer should first fire.

    Read the article

  • Javascript timer that restarts on key up?

    - by Haroldo
    O, so i have a 'live search' ajax search, which currently runs an sql search (via ajax) on each key up. What i would prefer is to: run an sql search after a key has not been pressed for say 800 milliseconds . So i want to have a timer that is started on key up, if the timer reaches 800ms then the ajax is called, if a new keyup event occurs the timer is restarted how would i do this?

    Read the article

  • java timer and socket problem

    - by Guru
    Hi there, I'm trying to make a program which listens to the client input stream by using socket programming and timer but whenever timer executes.. it gets hanged Please help me out here is the code... private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: try { ServerUserName=jTextField1.getText(); ss=new ServerSocket(5000); jButton1.enable(false); jTextArea1.enable(true); jTextField2.enable(true); Timer t=new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { try { s=ss.accept(); InputStream is=s.getInputStream(); DataInputStream dis=new DataInputStream(is); jTextArea1.append(dis.readUTF()); } catch(IOException IOE) { } catch(Exception ex) { setLbl(ex.getMessage()); } } }); t.start(); } catch(IOException IOE) { } } Thanks in advance

    Read the article

  • iPhone adding a timer to an app

    - by Rob J
    How would I go about adding a simple 2 minute timer to my app in almost the exact same way that the clock app does? I just want the user to click start and have the timer start displaying the timer counting down from 2:00 and beep when it hits 0:00.

    Read the article

  • Start timer on web application start

    - by brainimus
    I would like to start a System.Threading.Timer in my application when it launches (maybe deploy is the correct word). I have seen that you can use Application_Start() but this is only fired once the first request comes to the application. I need the timer to start as soon as the application is running so that it can check for work to process even if a user is not interacting with the site. How can I get the application to start the timer once it is up and running?

    Read the article

  • Timer to find elapsed time in a function call in C

    - by Mohit Nanda
    I want to calculate time elapsed during a function call in C, to the precision of 1 nanosecond. Is there a timer function available in C to do it? If yes please provide a sample code-snippet. Pseudo code Timer.Start() foo(); Timer.Stop() Display time elapsed in execution of foo() Environment details: - using gcc 3.4 compiler on a RHEL machine

    Read the article

  • C# background worker and timer loop

    - by Mike
    This is my first attempt of a Timer, if someone could help me out where I am going wrong it would be awesome. I'm trying to use a while loop where if the timer hits 30 seconds try to loop it again. private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { System.Windows.Forms.Timer my_timer = new System.Windows.Forms.Timer(); my_timer = null; //int restartticker = 30000; while (true) { my_timer.Start(); if (my_timer.Equals(30000)) { watcherprocess1(); } my_timer = null; } } Object reference not set to an instance of an object. my_timer.Start();

    Read the article

  • one timer per thread using Qt

    - by Pourya
    Hi, I modified Qt's broadcast sender example so that it has ten threads and in each thread it starts a timer, but only timer of the first thread is triggered. How can I have one timer running for each thread?

    Read the article

  • javascript timer fires up on the first key press

    - by pedrag
    I have a html page with a timer in it. I'm starting the timer with the keypress event, but i want it to execute only for the first key. I'm using a variable to catch the total keys in an other function which there were pressed and i have something like that: if(totaAttempts==1) start the timer, but with this solution the timer starts correctly, but is stomps when a key is pressed again. Any better ideas? Thanks in advance function setTime() { if (totalAttempts == 1) { ++totalSeconds; secondsLabel.innerHTML = pad(totalSeconds % 60); minutesLabel.innerHTML = pad(parseInt(totalSeconds / 60)); } } function pad(val) { var valString = val + ""; if (valString.length < 2) { return "0" + valString; } else { return valString; } }

    Read the article

  • Timer (NSTimer) won't work...why?

    - by eco_bach
    Hi I have the following, can anyone familiar with NSTimer tell me why it isn't working?? I've tried various values for an interval but no luck. self.timer = [NSTimer scheduledTimerWithTimeInterval:.5 target:self selector:@selector(update:) userInfo:nil repeats:YES]; And then my selector method - (void)update:(NSTimer*)timer { //DOESN"T TRACE OUT! NSLog(@" update:theTimer and userInfo = %@",timer.userInfo); }

    Read the article

  • Stop a stopwatch

    - by James Morgan
    I have the following code in a JPanel class which is added to a another class (JFrame). What I'm trying to implement is some sort of a stopwatch program. startBtn.addActionListener(new startListener()); class startListener implements ActionListener { public void actionPerformed(ActionEvent e) { Timer time = new Timer(); time.scheduleAtFixedRate(new Stopwatch(), 1000, 1000); } } This is another class which basically the task. public class Stopwatch extends TimerTask { private final double start = System.currentTimeMillis(); public void run() { double curr = System.currentTimeMillis(); System.out.println((curr - start) / 1000); } } The timer works fine and this is definitely far from complete but I'm not sure how to code the stop button which should stop the timer. Any advice on this? BTW I'm using java.util.timer

    Read the article

  • How to prevent GUI blocking?

    - by Kovu
    Hi, I have a timer that ticks every 3 seconds. If the timer found something a messagebox will show. Then the timer should wait 30 seconds, before he show again the messagebox (the user of course must have time to react). How can I handle this? I tried a Thread.Sleep(30000), but the GUI blocks of course. My other Idea is a second timer that will be activated after the first ticks and reactivate the first timer in the tick-method. So: t1 tick - msg box - after click - t2 enable (30 sec tick) - t2 tick, enable t1 But I think thats not a good idea, is there a better way?

    Read the article

  • Go frame-by-frame through a movie with a precise timer

    - by Matchu
    Hello, world: I have a video I made for physics class, which I intend to use to measure just how long an event took to take place. I can find the start frame and end frame easily using VLC's frame-by-frame feature. However, VLC's timer seems only to be precise to a single second, giving me no more precise an answer than "5 seconds." Is there a way in VLC, or any other program, to identify at precisely what time a particular frame in a video takes place? I have easy access to Ubuntu and Windows, and acquire a Mac if need be. If precise timer is not available, what number frame I am on will also work, since I know the framerate.

    Read the article

  • Two timer applets in notification area

    - by 1passenger
    Hi, after installig Ubuntu 10.04 Remix I can see two timer applets in the notification area. When I click on the first one, I can see the current date and the menues "Open Calendar", "Set Time and Date". When I click on the second one, I can see a small calendar of the current month and a small world map with my defined locations. I just want to have only one timer to safe some space in the notification area. How to disable one of the two applets? To click "Remove from Panel" isn't possible in the Remix edition!

    Read the article

  • Classes, methods, and polymorphism in Python

    - by Morlock
    I made a module prototype for building complex timer schedules in python. The classe prototypes permit to have Timer objects, each with their waiting times, Repeat objects that group Timer and other Repeat objects, and a Schedule class, just for holding a whole construction or Timers and Repeat instances. The construction can be as complex as needed and needs to be flexible. Each of these three classes has a .run() method, permitting to go through the whole schedule. Whatever the Class, the .run() method either runs a timer, a repeat group for a certain number of iterations, or a schedule. Is this polymorphism-oriented approach sound or silly? What are other appropriate approaches I should consider to build such a versatile utility that permits to put all building blocks together in as complex a way as desired with simplicity? Thanks! Here is the module code: ##################### ## Importing modules from time import time, sleep ##################### ## Class definitions class Timer: """ Timer object with duration. """ def __init__(self, duration): self.duration = duration def run(self): print "Waiting for %i seconds" % self.duration wait(self.duration) chime() class Repeat: """ Repeat grouped objects for a certain number of repetitions. """ def __init__(self, objects=[], rep=1): self.rep = rep self.objects = objects def run(self): print "Repeating group for %i times" % self.rep for i in xrange(self.rep): for group in self.objects: group.run() class Schedule: """ Groups of timers and repetitions. Maybe redundant with class Repeat. """ def __init__(self, schedule=[]): self.schedule = schedule def run(self): for group in self.schedule: group.run() ######################## ## Function definitions def wait(duration): """ Wait a certain number of seconds. """ time_end = time() + float(duration) #uncoment for minutes# * 60 time_diff = time_end - time() while time_diff > 0: sleep(1) time_diff = time_end - time() def chime(): print "Ding!"

    Read the article

  • (jQuery) javascript setTimeout clearTimeout

    - by Tillebeck
    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 not reset on a click. If the function is called 5 times within the first 10 seconds, then 5 alerts will apear... no clearTimeout... function endAndStartTimer() { window.clearTimeout(timer); var timer; //var millisecBeforeRedirect = 10000; timer = window.setTimeout(function(){alert('Hello!');},10000); } Any one got some lines of code that will do the trick? - on any click stop, reset and start the timer. - When timer hits eg. 10sec do something. BR. Anders

    Read the article

  • Running code when all threads are finished processing.

    - by rich97
    Quick note: Java and Android noob here, I'm open to you telling me I'm stupid (as long as you tell me why.) I have an android application which requires me start multiple threads originating from various classes and only advance to the next activity once all threads have done their job. I also want to add a "failsafe" timeout in case one the the threads takes too long (HTTP request taking too long or something.) I searched Stack Overflow and found a post saying that I should create a class to keep a running total of open threads and then use a timer to poll for when all the threads are completed. I think I've created a working class to do this for me, it's untested as of yet but has no errors showing in eclipse. Is this a correct implementation? Are there any APIs that I should be made aware of (such as classes in the Java or Android APIs that could be used in place of the abstract classes at the bottom of the class?) package com.dmp.geofix.libs; import java.util.ArrayList; import java.util.Iterator; import java.util.Timer; import java.util.TimerTask; public class ThreadMonitor { private Timer timer = null; private TimerTask timerTask = null; private OnSuccess onSuccess = null; private OnError onError = null; private static ArrayList<Thread> threads; private final int POLL_OPEN_THREADS = 100; private final int TIMEOUT = 10000; public ThreadMonitor() { timerTask = new PollThreadsTask(); } public ThreadMonitor(OnSuccess s) { timerTask = new PollThreadsTask(); onSuccess = s; } public ThreadMonitor(OnError e) { timerTask = new PollThreadsTask(); onError = e; } public ThreadMonitor(OnSuccess s, OnError e) { timerTask = new PollThreadsTask(); onSuccess = s; onError = e; } public void start() { Iterator<Thread> i = threads.iterator(); while (i.hasNext()) { i.next().start(); } timer = new Timer(); timer.schedule(timerTask, 0, POLL_OPEN_THREADS); } public void finish() { Iterator<Thread> i = threads.iterator(); while (i.hasNext()) { i.next().interrupt(); } threads.clear(); timer.cancel(); } public void addThread(Thread t) { threads.add(t); } public void removeThread(Thread t) { threads.remove(t); t.interrupt(); } class PollThreadsTask extends TimerTask { private int timeElapsed = 0; @Override public void run() { timeElapsed += POLL_OPEN_THREADS; if (timeElapsed <= TIMEOUT) { if (threads.isEmpty() == false) { if (onSuccess != null) { onSuccess.run(); } } } else { if (onError != null) { onError.run(); } finish(); } } } public abstract class OnSuccess { public abstract void run(); } public abstract class OnError { public abstract void run(); } }

    Read the article

  • JQuery timer plugin on ASP.NET MVC Page button click

    - by Rita
    Hi I have an ASP.NET MVC Page with a button called "Start Live Meeting". When the User clicks on this button, it calls a controller method called "StartLiveMeeting" that returns a string. If the controller returns empty string, then i want the Timer to call the Controller method until it returns the string. I am using jquery.timer.js plugin ( http://plugins.jquery.com/files/jquery.timers-1.2.js.txt ) On the button click, the controller method is being called. But Timer is not initiating. I have specified 5sec to call the controller method. I appreciate your responses. Code on ASPX Page: //When "Start Meeting" button is clicked, if it doesn’t return empty string, Display that text and Stop Timer. Else call the Timer in every 5 sec and call the StartLiveMeeting Controller method. $("#btnStartMeeting").click(function() { var lM = loadLiveMeeting(); if (lM == "") { $("#btnStartMeeting").oneTime("5s", function() { }); } else { $("#btnStartMeeting").stopTime("hide"); } return false; }); function loadLiveMeeting() { $("#divConnectToLive").load('<%= Url.Action("StartLiveMeeting") %>', {}, function(responseText, status) { return responseText; }); } <asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="server"> <div id="divStartMeetingButton"><input id="btnStartMeeting" type="submit" value="Start Meeting" /> </div> <div id = "divConnectToLive"> <div id="loading" style="visibility:hidden"> <img src="../../img/MedInfo/ajax_Connecting.gif" alt="Loading..." /> </div> </div> Controller Method: [HttpPost] public string StartLiveMeeting() { int intCM_Id = ((CustomerMaster)Session["CurrentUser"]).CM_Id ; var activeMeetingReq = (from m in miEntity.MeetingRequest where m.CustomerMaster.CM_Id == intCM_Id && m.Active == true select m); if (activeMeetingReq.Count() > 0) { MeetingRequest meetingReq = activeMeetingReq.First(); return "<a href='" + meetingReq.URI + "'>" + "Connect to Live Meeting</a>"; } else { return ""; } }

    Read the article

  • Countdown timer using NSTimer in "0:00" format

    - by Joey Pennacchio
    I have been researching for days on how to do this and nobody has an answer. I am creating an app with 5 timers on the same view. I need to create a timer that counts down from "15:00" (minutes and seconds), and, another that counts down from "2:58" (minutes and seconds). The 15 minute timer should not repeat, but it should stop all other timers when it reaches "00:00." The "2:58" timer should repeat until the "15:00" or "Game Clock" reaches 0. Right now, I have scrapped almost all of my code and I'm working on the "2:58" repeating timer, or "rocketTimer." Does anyone know how to do this? Here is my code: #import <UIKit/UIKit.h> @interface FirstViewController : UIViewController { //Rocket Timer int totalSeconds; bool timerActive; NSTimer *rocketTimer; IBOutlet UILabel *rocketCount; int newTotalSeconds; int totalRocketSeconds; int minutes; int seconds; } - (IBAction)Start; @end and my .m #import "FirstViewController.h" @implementation FirstViewController - (NSString *)timeFormatted:(int)newTotalSeconds { int seconds = totalSeconds % 60; int minutes = (totalSeconds / 60) % 60; return [NSString stringWithFormat:@"%i:%02d"], minutes, seconds; } -(IBAction)Start { newTotalSeconds = 178; //for 2:58 newTotalSeconds = newTotalSeconds-1; rocketCount.text = [self timeFormatted:newTotalSeconds]; if(timerActive == NO){ timerActive = YES; newTotalSeconds = 178; [rocketTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerLoop) userInfo:nil repeats:YES]; } else{ timerActive = NO; [rocketTimer invalidate]; rocketTimer = nil; } } -(void)timerLoop:(id)sender { totalSeconds = totalSeconds-1; rocketCount.text = [self timeFormatted:totalSeconds]; } - (void)dealloc { [super dealloc]; [rocketTimer release]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. timerActive = NO; } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } @end

    Read the article

  • sorting a timer in matlab

    - by AP
    ok it seems like a simple problem, but i am having problem I have a timer for each data set which resets improperly and as a result my timing gets mixed. Any ideas to correct it? without losing any data. Example timer col ideally should be timer , mine reads 1 3 2 4 3 5 4 6 5 1 6 2 how do i change the colum 2 or make a new colum which reads like colum 1 without changing the order of ther rows which have data this is just a example as my file lengths are 86000 long , also i have missing timers which i do not want to miss , this imples no data for that period of time. thanks EDIT: I do not want to change the other columns. The coulm 1 is the gps counter and so it does not sync with the comp timer due to some other issues. I just want to change the row one such that it goes from high to low without effecting other rows. also take care of missing pts ( if i did not care for missing pts simple n=1: max would work.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >