sleep

Does Capybara require sleep to work?

六眼飞鱼酱① 提交于 2019-12-05 22:06:27
问题 Apparently, sleep or wait_until are not valid using recent versions of Capybara, according to the webpage updates. However, I have a set of tests that only work on fast machines if I add a sleep(1) call to the test. That is, a test that looks like: describe "dosimeters page" do before do click_link("Dosimeter Read History", :match=>:first) end ... becomes describe "dosimeters page" do before do unix_wait click_link("Dosimeter Read History", :match=>:first) end ... where I've defined unix_wait

Confusion over the Android Activity Lifecycle

让人想犯罪 __ 提交于 2019-12-05 20:52:42
I have an app which is one activity. Everything works as I would expect except when I put the phone (a Samsung Galaxy Ace running Gingerbread) to sleep with the button on the side. When I do this, the following are called (in this order): onPause, onStop, onDestroy, onCreate, onStart, onResume, onPause . This is without waking the phone up , it is still asleep - screen is off. Why is the activity killed completely and re-recreated? Even more bizarre, if the phone is then switched back on the following happens: onResume, onPause, onStop, onDestroyed, onCreate, onStart, onResume Even though it's

Improvements to this bash script to simulate “tail --follow”

回眸只為那壹抹淺笑 提交于 2019-12-05 19:34:09
I need to remote tail log files such that the tailing continues working even when the file is rolled over. My attempts to do so, started by directly using the tail command over ssh: ssh root@some-remote-host tail -1000f /some-directory/application.log | tee /c/local-directory/applicaiton.log That allows me to filter through /c/local-directory/applicaiton.log locally using Otroslogviewer (which was the original purpose of trying to tail the log file locally). The above stops tailing when the remote log file is rolled over (which happens at every 10MB). I do not have the access required to

Chrome Extension Desktop Notification Works On Sleep

可紊 提交于 2019-12-05 16:55:48
I made a Desktop Notification it shows a notification every 1 minute. After 10 second, closes itself. I gone for a lunch , then computer goes to sleep. When i was back i wake my computer then lots of notification starts. How can i handle that problem? I want if computer sleeps it shouldnt show notification. How can i control it? Background.js function show() { var notification = webkitNotifications.createHTMLNotification( 'notification.html' ); notification.show(); } // Conditionally initialize the options. if (!localStorage.isInitialized) { localStorage.isActivated = true; // The display

Linux: How to kill Sleep

你。 提交于 2019-12-05 16:11:46
More of a conceptual question. If I write a bash script that does something like control_c() { echo goodbye exit #$ } trap control_c SIGINT while true do sleep 10 #user wants to kill process here. done control+c won't exit when sleep 10 is running. Is it because linux sleep ignores SIGINT? Is there a way to circumvent this and have the user be able to cntrl+c out of a sleep? What you are describing is consistent with the interrupt signal going to only your bash script, not the process group. Your script gets the signal, but sleep does not, so your trap cannot execute until after sleep

perl background process

不想你离开。 提交于 2019-12-05 14:07:21
I am trying to run a background process in perl. I create a child process, which is used to call another perl script. I want to run few lines of code parallely with this child process. And after the child process is done.I want to print a line of code. Main script #!/usr/bin/perl $|=1; print "before the child process\n"; my $pid = fork(); if (defined $pid) { system("perl testing.pl"); } print "before wait command\n"; wait(); print "after 20 secs of waiting\n"; testing.pl #!/usr/bin/perl print "inside testing\n"; sleep(20); Expected output before the child process before wait command (should

Java Memory Behavior : Different with Thread.sleep

风格不统一 提交于 2019-12-05 13:59:28
I am trying to do some memory analysis using visualvm. I have written a basic code that runs an infinite loop to add objects to List. package home.always.learning.java; import java.util.ArrayList; import java.util.List; public class Heaper { private static List<PersonDetails> listObj = new ArrayList<PersonDetails>(); private static final String nameConst = "Tarun Trehan"; public static void main(String[] args)throws Exception{ personListCreation(); } public static void personListCreation() throws Exception { int i = 0; while(true) { System.out.println("Looping to create person list..."); i++;

Connecting to Bluetooth device fails in deep sleep

送分小仙女□ 提交于 2019-12-05 13:09:25
I'm attempting to connect to a paired bluetooth device every 25 seconds, scheduled through AlarmManager which triggers a WakefulBroadcastReceiver to start a service to do the connection. Once the device goes to sleep, everything works great for the first few hours, but it starts to fail after about 4-5 hours, when I assume the device goes into a deep sleep . I get a NullPointerException from ParcelFileDescriptor, stating the "FileDescriptor must not be null". I've tried searching this error, and have even gone through the code in ParcelFileDescriptor.java, but am at a dead end. I'm running

Robot.delay(int) versus Thread.sleep(long)

六眼飞鱼酱① 提交于 2019-12-05 11:51:41
I have a program whose only purpose is to drive a java.awt.Robot in an infinite loop until an exit condition is met. The robot performs a number of actions in quick succession, which require a standard UI delay between them. For this, I use java.awt.Robot.setAutoDelay(int ms) , which appears to be designed for precisely this purpose. At other times, however, I need to insert arbitrarily long delays for operations to complete. I appear to have a choice between using java.awt.Robot.delay(int ms) or java.lang.Thread.sleep(long ms) , and am curious what the differences between them are, and which

Does Thread.sleep throw if the thread was already interrupted?

删除回忆录丶 提交于 2019-12-05 11:46:35
Given a thread which was interrupted while it was not blocked (i.e. no InterruptedException was thrown), does that thread throw an InterruptedException when it later attempts to sleep? The documentation does not state this clearly: InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown. Yes, it does. The documentation perhaps isn't crystal clear on that point, but this is easy to both test (see the your own answer below, for example), and to see the canonical (HotSpot) implementation. Thread