timer

Is it possible in C/C++ in Linux to get informed when a specified date/time is reached?

丶灬走出姿态 提交于 2019-12-23 16:03:03
问题 Is it possible using standard C++ in Linux to get informed when a specified date/time is reached by the system time (assuming my process is up of course)? I could just set a timer to the time I need to wait, but what happens if the user changes the system time? Can I get informed by the system that the user changed the system time to reset my timers? 回答1: The Linux kernel has such system calls, although, they are not integrated into the libc API. You can create a timer, get a file descriptor

Timer just works if call MessageBox.Show()

廉价感情. 提交于 2019-12-23 15:51:19
问题 How is this possible? I have a timer that is called if have no network connection,as in method down: public void Foo() { for (int i = 0, count = MailList.CheckedItems.Count; i < count; i++) { /* Check for network available connection in computer public bool HasConnection() { return System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable(); } */ if (!net.HasConnection()) { SearchNetworkConnection.Start(); //start the timer } } } and The _Tick method of Timer : private void

extra argument userinfo in call

China☆狼群 提交于 2019-12-23 15:13:25
问题 Get the compile error message from xCode with Swift language: "extra argument userinfo in call". the question is how to use userInfo data from timer to argument "userInfo" in notification center. func onSetAudioWithTrackIndex(CurrentTrackIndex:Int, urlAudio: String){ ........ //try to pass currentTrackIndex data to timerfire playTimeClock = NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: "onSetPlayProgressTime:", userInfo: CurrentTrackIndex, repeats: true) } //Timerfire

How to make a simple countdown in minutes for swift iOS? [duplicate]

假如想象 提交于 2019-12-23 15:10:39
问题 This question already has answers here : How to create a circular progress indicator for a count down timer (2 answers) Closed 3 years ago . How do I code a simple timer countdown from MINUTES say for example 5 minute countdown? Like the timer that apple created. Is there a way to download and see the xcode project for apple apps? 回答1: Look into NSTimer as a simple way to do this. May not be the most accurate but is relatively simple. The NSTimer calls the function "update" every second

ScheduledExecutorService.scheduleAtFixedRate And Setting initialDelay To Date In The Past

眉间皱痕 提交于 2019-12-23 14:03:14
问题 I'm working on a scheduling system in Java that sends out reminders based on a startDate , endDate and occurrence (hourly, daily, weekly, monthly, Mondays, etc). Originally I was using Timer and TimerTask classes to schedule the reminders: Timer timer = new Timer(); timer.scheduleAtFixedRate(reminder, firstDate, period); I recently switched to ScheduledExecutorService so I could have more control on cancelling events. The ScheduledExecutorService is working well for recurring reminders,

ScheduledExecutorService.scheduleAtFixedRate And Setting initialDelay To Date In The Past

戏子无情 提交于 2019-12-23 14:02:55
问题 I'm working on a scheduling system in Java that sends out reminders based on a startDate , endDate and occurrence (hourly, daily, weekly, monthly, Mondays, etc). Originally I was using Timer and TimerTask classes to schedule the reminders: Timer timer = new Timer(); timer.scheduleAtFixedRate(reminder, firstDate, period); I recently switched to ScheduledExecutorService so I could have more control on cancelling events. The ScheduledExecutorService is working well for recurring reminders,

How to use timer in MATLAB to run a function at a fixed interval

半城伤御伤魂 提交于 2019-12-23 12:48:12
问题 I would like to run a function at 30 mins interval. Each time the function run, it will take a different input. Let's say I want to run this 100 times. The function is lookupweather and the input is location1, location2, location3,..., location100 I've tried: for a = 1:100 t = timer; t.StartDelay = 30*60*(a-1) t.TimerFcn = @(scr, event) run('lookupweather'); start(t) end The issue here is that I cannot find away to input the location information. If I tried something lookupweather(location1),

Trouble with timers and threads

て烟熏妆下的殇ゞ 提交于 2019-12-23 12:39:24
问题 I'm a learn-by-example C# coder who isn't very advanced, which is why this problem is completely stumping me regardless of the amount of information on the internet. I'm essentially creating a program that is, on a timer, repeatedly polling a website to get some information. During this process, a WebBrowser control is created to navigate to the information (needed for authentication). The program runs this series of events at startup, then using a System.Timers.Timer set to every 10 minutes

Removing the background of a frame animation in Android

主宰稳场 提交于 2019-12-23 12:33:00
问题 How can I remove the background of a frame animation (or set it to be transparent )? When I set the background colour in the xml layout file to be transparent, it turns up black when running it. When I setBackgroundColor(0); in the Java code I get the following exception : java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.graphics.drawable.AnimationDrawable /res/layout/dialog_loading.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns

Make countdown timer go from 10sec to 1sec

淺唱寂寞╮ 提交于 2019-12-23 11:48:28
问题 I have a CountDown timer that counts down from 10000ms to 0ms in increments of 1 second each to make a button clickable after 10 seconds. Although the timer is accurate and does what the code says, I would like to change the way the seconds are expressed but I don't know how. java: void startTimer() { cTimer = new CountDownTimer(10000, 1000) { public void onTick(long millisUntilFinished) { c.setText("Please wait " + millisUntilFinished/1000 + " seconds"); thx.setText(millisUntilFinished/1000