sleep

how to wakeup android phone from sleep?

霸气de小男生 提交于 2019-12-04 02:09:34
How to wakeup android phone from sleep (suspend to mem) programmably? I don't want to acquire any wakelock, which means the phone goes into "real" sleep with the cpu disabled. I guess I can use some kind of RTC (real time clock) mechanism? Does anyone have any examples? Thanks. In order to let the Activity wake up the device and not require a password/swipe, you only need to add a few flags. To get that, include to your code: this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED

CPU Utilization high for sleeping processes

可紊 提交于 2019-12-03 23:38:42
I have a process that appears to be deadlocked: # strace -p 5075 Process 5075 attached - interrupt to quit futex(0x419cf9d0, FUTEX_WAIT, 5095, NULL It is sitting on the "futex" system call, and seems to be indefinitely waiting on a lock. The process is shown to be consuming a large amount of CPU when "top" is run: # top -b -n 1 top - 23:13:18 up 113 days, 4:19, 1 user, load average: 1.69, 1.74, 1.72 Tasks: 269 total, 1 running, 268 sleeping, 0 stopped, 0 zombie Cpu(s): 8.1%us, 0.1%sy, 0.0%ni, 91.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 12165696k total, 3810476k used, 8355220k free, 29440k

Javascript sleep/delay/wait function

假如想象 提交于 2019-12-03 23:35:43
问题 Sorry if this question has already been asked here before, I could not find a suitable answer. I am wanting to create a JavaScript sleep/delay/wait function that I can call anywhere in the script, like jQuery's .delay() I am not able to use setTimeout, as I have a script that is generated by php, and so am not able to put it into two different functions, with the timeout in the middle. I need to create a function that allows me to do alert("time started"); sleep(4000); alert("time up"); I

Bash sleep in milliseconds

大憨熊 提交于 2019-12-03 22:57:36
I need a timer which will work with milliseconds. I tried to use sleep 0.1 command in script I see error message: syntax error: invalid arithmetic operator (error token is ".1") When I run sleep 0.1 in terminal it works fine. Please help me! EDIT: Sorry I have take an mistake: function timer { while [[ 0 -ne $SECS ]]; do echo "$SECS.." sleep 0.1 SECS=$[$SECS-0.1] done } Line sleep 0.1 was 5th and SECS=$[$SECS-0.1] was 6th. I just garbled lines. The problem was in 6th line, because bash can't work with float numbers. I changed my function as below: MS=1000 function timer { while [[ 0 -ne $MS ]]

Sleep() in Android Java

可紊 提交于 2019-12-03 22:26:31
I am following this tutorial to have a loading screen in my program. The tutorial says my activity should Sleep() using the Sleep() command, however it does not recognize Sleep() as a function and provides me with an error, asking if I would like to create a method called Sleep(). Here is the code sample: public class LoadingScreenActivity extends Activity { //Introduce an delay private final int WAIT_TIME = 2500; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); System.out.println("LoadingScreenActivity screen

Difference in usage of function sleep() and [[NSRunLoop currentRunLoop] runUntilDate]

岁酱吖の 提交于 2019-12-03 20:54:04
Please consider the following pieces of code: In the first one i call a function which creates an animation. i do that with a certain time interval: start:; [self animationMethod]; [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]]; //sleep(3); goto start; In the second one i create an animation - (void)animationMethod { CAKeyframeAnimation *myAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; CGMutablePathRef curvedPath = CGPathCreateMutable(); CGPathMoveToPoint(curvedPath, NULL, start.x, start.y); CGPathAddCurveToPoint(curvedPath, NULL, fcp.x,

How to sleep PHP(Laravel 5.2) in background

家住魔仙堡 提交于 2019-12-03 20:35:24
I have created an artisan command that I want to run immediately after a method called. But the command contains a sleep(); command. I want to run that artisan command in background because the method need to return immediately response to user. My sample code is a below: In route file Route::get('test', function(){ Artisan::queue('close:bidding', ['applicationId' => 1]); return 'called close:bidding'; }); In close:bidding command public function handle() { $appId = $this->argument('applicationId'); //following code line is making the problem sleep(1000 * 10); //close bidding after certain

iOS 8 Bug - OnUpdateReady never called again when device returns from sleep

跟風遠走 提交于 2019-12-03 15:38:18
When an iOS 8 device running a Web Application (i.e. launched from a shortcut on the Home Screen) returns from it's Sleep state all asynchronous web requests made fail to trigger the OnUpdateReady callback. The problem is quite easy to reproduce - simply put the two code files below on any web server and give it a try. Has anyone else run into this issue? If so is there any workarounds? I'm posting this to try to attract attention to this bug in iOS 8 that has essentially ruined all of my web applications - we've had to recommend to NOT upgrade beyond iOS 7. And yes, I've posted the problem on

Thread.sleep() Never Returns

妖精的绣舞 提交于 2019-12-03 15:06:21
问题 I am having an odd error with Thread.sleep() on Java. For some reason, when I call sleep on some machines, it never returns. I can't figure out what could be causing this behaviour. At first, I thgouth the error might be elsewhere in my code, so I made the simplest possible sleep test: public class SleepTest { public static void main (String [] args) { System.out.println ("Before sleep..."); try { Thread.sleep (100); } catch (InterruptedException e) { } System.out.println ("After sleep...");

how to sleep in c [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-03 14:03:06
Possible Duplicate: Why does printf not flush after the call unless a newline is in the format string? When I run something like for (i = 1; i <= 10; i++) { sleep(1); printf("."); } then what I would expect is one dot per second ten times. What I get is ten dots once after ten seconds. Why is that so, and how do I get the program to actually print one point (or do other things) each second (or different time interval)? The printf() is buffering the data, you can force it to flush that data with fflush(stdout) : for (i = 1; i<=10; i++) { sleep(1); printf("."); fflush(stdout); } 来源: https:/