Search Results

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

Page 3/65 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • C# timer won't tick

    - by Andrej
    hi, i have a strange problem... I've been going out of my mind for the past couple of hours... the timer i put in my winform code (from the toolbar) won't tick... I have timers on a couple of forms in my program, they all work fine... I try to do exactly the same it this it won't tick... I select it, drag it on to a form, enable it, set interval and handle the tick event... and nothing happens... i even tried putting random code like messagebox.show in the tick event just to see if anything happens, and nothing!!! as I said, a have a couple of more timer in my program (on other forms, not in the one i'm trying to put this timer) and they all work fine... any suggestions? thanks in advance!

    Read the article

  • Javascript timer in parent window is cancelled on child window close

    - by Tom Carter
    I have a user UserControl on a web page. There is a javascript timer started by the control on the client that causes a web service to be called every few seconds. If the user clicks on the control a new browser window is opened (with window.open() ) to show a different page. Note the onclick returns false so there is no postback to the page. The page displayed in the second window also has a timer that operates in the same way as the first (calls a WebService at intervals). Upto this point everything is fine - each of the timers continue to run in their respective window. However, when I close the second window (either by clicking on the cross of the window or by calling self.close() ) the timer in the first stops. I've no idea why. Is there some relationship between the opener and opened window that I'm missing ?

    Read the article

  • powerpoint macro timer

    - by mustafabattal
    Hi, I have to complete a timer on powerpoint, it countsdown for a specificed amount of time when a shape on particular slide is clicked. I heard macros could be a way to do this, but I have very little knowledge about them. With my research I was able to add a macro and pop out a message box when a shape is clicked*. How can I implement a timer with this? VB syntax is pretty unfamiliar to me. What happens after timer finishes is another question though. *with macro in module: sub hello_world() MsgBox( 'hello world!') end sub

    Read the article

  • Objective C: App freezes when using a timer

    - by Chris
    It took me hours to figure out how to implement a timer into my program, but when it runs, the app doesn't load completely as it did before the timer. In my main.m: int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; OutLauncher *theLauncher = [[OutLauncher alloc] init]; NSTimer *theTimer = [theLauncher getTimer]; [theTimer retain]; [[NSRunLoop currentRunLoop] addTimer: theTimer forMode: NSDefaultRunLoopMode]; [[NSRunLoop currentRunLoop] run]; [pool release]; return 0; } The file OutLauncher is being imported into that, which looks like this: - (void)doStuff { NSLog( @"Doing Stuff"); } - (NSTimer *)getTimer{ NSTimer *theTimer; theTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(doStuff) userInfo:nil repeats:YES]; return [theTimer autorelease]; } The timer works, the console updates every second with the phrase "doing stuff" but the rest of the program just won't load. It will if I comment out the code I added to int main though

    Read the article

  • Callback Timer function in C++

    - by user3596609
    I am trying to implement a callback timer function in C++ which should do a callback after a timeout. I am listening on a socket and then waiting for messages on it. so if I have something like getMessages() and I want to pass the timer function in it as an argument. So how can it be implemented that after the receive of a message, the timer is started and the callback happens if there is a timeout before the next messages arrives. I am new to callback functions. Any help is greatly appreciated. Thanks!

    Read the article

  • Android Timer update UI between multiple tasks

    - by Rilcon42
    I have tried multiple ways to have a single persistent timer update the ui in multiple activities, and nothing seems to work. I have tried an AsyncTask, a Handler, and a CountDownTimer. The code below does not execute the first Log.i statement.... Is there a better way to start the timer (which must be called from another class) in Main (which is the only persistent class)? public static void MainLawTimer() { MainActivity.lawTimer = new CountDownTimer(MainActivity.timeLeft, 1000) { public void onTick(long millisUntilFinished) { Log.i("aaa","Timer running. Time left: "+MainActivity.timeLeft); MainActivity.timeLeft--; if(MainActivity.timeLeft<=0) { //do stuff } else { //call method in another class } }

    Read the article

  • Random loading swf files into main swf with countdown timer

    - by Plugger
    ok guys a question, can this be done or has it already been done, or can someone point me in the right direction (be aware i an a total newbie with action script) i have a main swf movie about 600px x 400 px what i want is this to run for say 30 seconds, then i want a countdown timer in the bottom corner for say 10 seconds, after this i want it to randomly load another swf file over the top of the original, and then the timer repeats for 10 seconds and repates the random loading of another swf file over the top etc, etc, etc so whats the best way around this

    Read the article

  • Timer Job from a SPWeb

    - by Faiz
    Hi, I guess starting a timer job from within the code required Farm admin credetials. However, i need to start a timer job from a web part that will be used in any site. Now when i try to start the job it gives me access denied error and obviously so as app pool identity is not farm admin. Any ideas on how to resolve this issue? Thanks,

    Read the article

  • java timer for game

    - by user261002
    I have created a game in java and now I just need to add a timer that allow the user to play under 60s. I have searched on internet and found the timer for swing and util packages. could you please just give me a method to be able to use it in my game???

    Read the article

  • How to implement a timer callback that executes in the same execution context

    - by Waldorf
    Some programming environments like C++ builder have timer components with a callback function which executes in the same execution contexts as where the timer object is created. I was wondering how to do something similar in plain c++ with threading. Or are there any other ways to have a callback which is periodically called to perform some task and runs in the same execution context as the calling thread?

    Read the article

  • C# inaccurate timer?

    - by Ivan
    Hi there, I'm developing an application and I need to get the current date from a server (it differs from the machine's date). I receive the date from the server and with a simple Split I create a new DateTime: globalVars.fec = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(infoHour[0]), int.Parse(infoHour[1]), int.Parse(infoHour[2])); globalVars is a class and fec is a public static variable so that I can access it anywhere in the application (bad coding I know...). Now I need to have a timer checking if that date is equal to some dates I have stored in a List and if it is equal I just call a function. List<DateTime> fechas = new List<DateTime>(); Before having to obtain the date from a server I was using computer's date, so to check if the dates matched I was using this: private void timerDatesMatch_Tick(object sender, EventArgs e) { DateTime tick = DateTime.Now; foreach (DateTime dt in fechas) { if (dt == tick) { //blahblah } } } Now I have the date from the server so DateTime.Now can't be used here. Instead I have created a new timer with Interval=1000 and on tick I'm adding 1 second to globalVars.fec using: globalVars.fec = globalVars.fec.AddSeconds(1); But the clock isn't accurate and every 30 mins the clock loses about 30 seconds. Is there another way of doing what I'm trying to do? I've thought about using threading.timer instead but I need to have access to other threads and non-static functions. Thanks in advance, Ivan

    Read the article

  • C# unaccurate timer?

    - by Ivan
    Hi there, I'm developing an application and I need to get the current date from a server (it differs from the machine's date). I receive the date from the server and with a simple Split I create a new DateTime: globalVars.fec = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(infoHour[0]), int.Parse(infoHour[1]), int.Parse(infoHour[2])); globalVars is a class and fec is a public static variable so that I can access it anywhere in the application (bad coding I know...). Now I need to have a timer checking if that date is equal to some dates I have stored in a List and if it is equal I just call a function. List<DateTime> fechas = new List<DateTime>(); Before having to obtain the date from a server I was using computer's date, so to check if the dates matched I was using this: private void timerDatesMatch_Tick(object sender, EventArgs e) { DateTime tick = DateTime.Now; foreach (DateTime dt in fechas) { if (dt == tick) { //blahblah } } } Now I have the date from the server so DateTime.Now can't be used here. Instead I have created a new timer with Interval=1000 and on tick I'm adding 1 second to globalVars.fec using: globalVars.fec = globalVars.fec.AddSeconds(1); But the clock isn't accurate and every 30 mins the clock loses about 30 seconds. Is there another way of doing what I'm trying to do? I've thought about using threading.timer instead but I need to have access to other threads and non-static functions. Thanks in advance, Ivan

    Read the article

  • Change NSTimer interval for repeating timer.

    - by user300713
    Hi, I am running a mainLoop in Cocoa using an NSTimer set up like this: mainLoopTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/fps target:self selector:@selector(mainloop) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:mainLoopTimer forMode:NSEventTrackingRunLoopMode]; At Program startup I set the timeInterval to 0.0 so that the mainloop runs as fast as possible. Anyways, I would like to provide a function to set the framerate(and thus the time interval of the timer) to a specific value at runtime. Unfortunately as far as I know that means that I have to reinitialize the timer since Cocoa does not provide a function like "setTimerInterval" This is what I tried: - (void)setFrameRate:(float)aFps { NSLog(@"setFrameRate"); [mainLoopTimer invalidate]; mainLoopTimer = nil; mainLoopTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/aFps target:self selector:@selector(mainloop) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:mainLoopTimer forMode:NSEventTrackingRunLoopMode]; } but this throws the following error and stops the mainloop: 2010-06-09 11:14:15.868 myTarget[7313:a0f] setFrameRate 2010-06-09 11:14:15.868 myTarget[7313:a0f] * __NSAutoreleaseNoPool(): Object 0x40cd80 of class __NSCFDate autoreleased with no pool in place - just leaking 2010-06-09 11:14:15.869 myTarget[7313:a0f] * __NSAutoreleaseNoPool(): Object 0x40e700 of class NSCFTimer autoreleased with no pool in place - just leaking 0.614628 I also tried to recreate the timer using the "retain" keyword, but that didn't change anything. Any ideas about how to dynamically change the interval of an NSTimer at runtime? Thanks!

    Read the article

  • Timer Service in ejb 3.1 - schedule calling timeout problem

    - by Greg
    Hi Guys, I have created simple example with @Singleton, @Schedule and @Timeout annotations to try if they would solve my problem. The scenario is this: EJB calls 'check' function every 5 secconds, and if certain conditions are met it will create single action timer that would invoke some long running process in asynchronous fashion. (it's sort of queue implementation type of thing). It then continues to check, but as long as long running process is there it won't start another one. Below is the code I came up with, but this solution does not work, because it looks like asynchronous call I'm making is in fact blocking my @Schedule method. @Singleton @Startup public class GenerationQueue { private Logger logger = Logger.getLogger(GenerationQueue.class.getName()); private List<String> queue = new ArrayList<String>(); private boolean available = true; @Resource TimerService timerService; @Schedule(persistent=true, minute="*", second="*/5", hour="*") public void checkQueueState() { logger.log(Level.INFO,"Queue state check: "+available+" size: "+queue.size()+", "+new Date()); if (available) { timerService.createSingleActionTimer(new Date(), new TimerConfig(null, false)); } } @Timeout private void generateReport(Timer timer) { logger.info("!!--timeout invoked here "+new Date()); available = false; try { Thread.sleep(1000*60*2); // something that lasts for a bit } catch (Exception e) {} available = true; logger.info("New report generation complete"); } What am I missing here or should I try different aproach? Any ideas most welcome :) Testing with Glassfish 3.0.1 latest build - forgot to mention

    Read the article

  • How to do timer with Nios II assembly?

    - by Nick Rosencrantz
    I've got an assignment in a computer engineering course that I don't fully understand since it is so large. Anyway I started coding the parts of it and it seems we should make code for some sort of timer. I've started put together the subroutine for snaptime but I'm not sure what I want: .equ timer, 0x920 .global snaptime .text .align 2 snaptime: movia r8,timer # basadressen till timern stw r0,12(r8) # sparar 0 till snapl movi r9,0b0110 # spara 6 i r9 stw r9,16(r8) # spara r9 movi ... ? andi r10,r10,0xFFFF The manual for Nios II assembly is here and the C code for what I'm trying to do is: #define TIMER_1_BASE ((volatile unsigned int*) 0x920) int snaptime (void) { int snaphight; int snaplow; int snap; TIMER_1_BASE[4]=0; snaphigh = TIMER_1_BASE[5] & 0xffffff; snaplow = TIMER_1_BASE[4] & 0xffffff; snap = snaphigh*65536+snaplow; return (snap); } Perhaps you can inspect the C which should be properly defined and see how I make it with assembly since the spec says it should be assembly.

    Read the article

  • how the get estimated output in timer

    - by ratty
    i have working with twp timer,the code below using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace example { public partial class Form1 : Form { int i = 0; int j = 0; public Form1() { InitializeComponent(); timer1.Interval = 3000; } private void button1_Click(object sender, EventArgs e) { timer1.Enabled = true; } private void timer1_Tick(object sender, EventArgs e) { i++; timer2.Enabled = true; if (i < 3) time1(i); else timer1.Enabled = false; } private void timer2_Tick(object sender, EventArgs e) { j++; timer2.Interval = timer1.Interval / 5; if (j < 5) time2(j); else timer2.Enabled = false; } private void time1(int i) { MessageBox.Show(i.ToString(), "First Timer"); } private void time2(int j) { MessageBox.Show(j.ToString(), "SecondTimer"); } } } when running this program it gives output like this firsttimer:1 secondTimer:1 secondTimer:2 secondTimer:3 secondTimer:4 firsttimer:2 in message box but when debugging debug cannot move that order.after finisheg the secondtimer:2 it gose back to first timer. but i need to go for how i am output get i need for this in another application. why it occurs

    Read the article

  • System.Threading.Timer won't trigger

    - by mijatovic
    Hello guys, I am new here... I have one question, if somebody can help me. It is about timers (System.Threading.Timer). I want to break inevitable recursion: I have two columns in datarow and they are mutually dependant (price_without_VAT and price_with_VAT). Setting one of them will definitely cause StackOverflowException. So here's the idea: bool flag = true; void Reset(object state) { flag = true; } Now, wrap the method for changing value of one of the columns: { if(flag) { flag = false; System.Threading.Timer tmr = new System.Threading.Timer(new System.Threading.TimerCallback(Reset), null, 10, System.Threading.Timeout.Infinite); datarow.other_column = value; } } datarow.other_column.value line will immediately trigger the above method, but there will be no recursion because flag is false. In 10 ms flag should be back to true, and everything is back to normal. Now, when i follow the code in DEBUGGER, everything works fine, but when I start app NORMALLY Reset function simply will not trigger, flag is stuck to false forever and everything false apart. I play around with due_time parameter but nothing seems to help. Any ideas?

    Read the article

  • Behaviour of System.Timer when Interval property changed

    - by lowlyintern
    I have a System.Timer setup to trigger an event every day at 2AM. If the process the timer starts fails then I want the timer to be reset to run every 15 minutes until the process completes succesfully. // this is how the timer is set up. // this is working correctly. double startTime = milliseconds_of_hour_to_start. Timer = new System.Timers.Timer( startTime); Here is the code to reset the timer on success or failure of the event handler. NOTE the timer is not being stopped, just the Interval property is being reset. if (ProcessSuccess) { Timer.Interval = TimeSpan.FromHours(24).TotalMilliseconds; } else { Timer.Interval = TimeSpan.FromMinutes(15).TotalMilliseconds; } My question is this, if the process fails say 4 times, then succeeds will the Timer now be running at around 3AM? i.e. after failing will the original start time of 2AM be advanced by 15 minutes?

    Read the article

  • Why Timer does not work if we do not generate a window?

    - by Roman
    Here is the code: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.Timer; public class TimerSample { public static void main(String args[]) { new JFrame().setVisible(true); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println("Hello World Timer"); } }; Timer timer = new Timer(500, actionListener); timer.start(); } } It generates a window and then periodically prints "Hello World Timer" in the terminal (Command Prompt). If I comment this line new JFrame().setVisible(true); the application do not print anything to the command line. Why?

    Read the article

  • WCF, Timer Jobs, Web Service which is better ???

    - by kannan.ambadi
    I am working with a Web application, based on Asp.Net 3.5 and WSS 3.0 platform. Recenlty i've got a task as follows. Import bank statement using FTX - Desktop application and parse those statements into database in every 24 hours ie. i need to download bank statement with the help of a desktop application(which i can call by batch file). Then i have to go through each statement(text file) and convert those data into our database for future reference. As far as i know, .Net provides the following options to implement such a functionality. SharePoint Timer Jobs Web Services WCF Windows Services I would like to go for SharePoint Timer Jobs, but there are some plans to move whole application to Asp.net platform. I am interested with WCF since i haven't much experience with WCF applications, but not in a position to take final decision :) Which is the most suitable way for this kind of task? Please suggest.

    Read the article

  • Please Critique Code (Java, Java2D, javax.swing.Timer)

    - by Trizicus
    Learn by practice right? Please critique and suggest anything! Thanks :) import java.awt.EventQueue; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JFrame; public class MainWindow { public static void main(String[] args) { new MainWindow(); } JFrame frame; GraphicsPanel gp = new GraphicsPanel(); MainWindow() { EventQueue.invokeLater(new Runnable() { public void run() { frame = new JFrame("Graphics Practice"); frame.setSize(680, 420); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gp.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} }); gp.addMouseMotionListener(new MouseMotionListener() { public void mouseDragged(MouseEvent e) {} public void mouseMoved(MouseEvent e) {} }); frame.add(gp); } }); } } GraphicsPanel: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JPanel; import javax.swing.Timer; public class GraphicsPanel extends JPanel { Test t; Timer test; GraphicsPanel() { t = new Test(); setLayout(new BorderLayout()); add(t, BorderLayout.CENTER); test = new Timer(17, new Gameloop(this)); test.start(); } class Gameloop implements ActionListener { GraphicsPanel gp; Gameloop(GraphicsPanel gp) { this.gp = gp; } public void actionPerformed(ActionEvent e) { try { t.incX(); gp.repaint(); } catch (Exception ez) { } } } } Test: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JComponent; public class Test extends JComponent { Toolkit tk; Image img; int x, y; Test() { tk = Toolkit.getDefaultToolkit(); img = tk.getImage(getClass().getResource("images.jpg")); this.setPreferredSize(new Dimension(15, 15)); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(Color.red); g2d.drawString("x: " + x, 350, 50); g2d.drawImage(img, x, 80, null); g2d.dispose(); } public void incX() { x++; } }

    Read the article

  • ejb timer service vs cron

    - by darko petreski
    Hi Ejb timer service can start some process in desired time intervals. Also we can do the same thing with cron (min 1 minute) interval. But doing it with cron we have more power on controlling, monitoring and changing the intervals. Also we can restart if needed the cron very easily by command line. Also we can add or remove lines in the cron transparently. What are the advantages of using ejb timer services over calling the ejbs from cron ? (several lines of code in the cron classes are not a problem) Regards.

    Read the article

  • Timer does not stop in android

    - by RBADS
    I made an application in android and used timer like this.. try { CountDownTimer start1 = new CountDownTimer(20000, 1000) { public void onTick(long millisUntilFinished) { TextView timeShow = (TextView)findViewById(R.id.showTime); timeShow.setText(" "+" 00:" +millisUntilFinished / 1000); } But my problem is i don't know how to stop timer. Any idea? I already tried: quitApplication.setOnClickListener(new OnClickListener() { public void onClick(View v) { start1.cancel(); Intent i = new Intent(v.getContext(), startGame.class); startActivity(i); // TODO Auto-generated method stub } });

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >