wait

How to block UI for some seconds in android?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 07:27:40
问题 How can i block UI from all interactions for some seconds by user in Android? I would like to know, how to do this with some delay timing like wait(5000); 回答1: You can override dispatchTouchEvent and stop the call to super.dispatchTouchEvent(ev); Any touch event will have to go through this method before it is handled. Set a boolean that you control and use it in the method to determine whether you wish to block control. private boolean stopUserInteractions = false; public boolean

How does one use the wait() function when forking multiple processes?

纵然是瞬间 提交于 2019-12-06 06:34:01
Learning to use the fork() command and how to pipe data between a parent and it's children. I am currently trying to write a simple program to test how the fork and pipe functions work. My problem seems to be the correct use/placement of the wait function. I want the parent to wait for both of its children to finish processing. Here is the code I have so far: int main(void) { int n, fd1[2], fd2[2]; pid_t pid; char line[100]; if (pipe(fd1) < 0 || pipe(fd2) < 0) { printf("Pipe error\n"); return 1; } // create the first child pid = fork(); if (pid < 0) printf("Fork Error\n"); else if (pid == 0) /

python to wait for shell command to complete

南笙酒味 提交于 2019-12-06 04:31:05
问题 I am running script to unrar some files and the remove the rar files afterwards. I am doing this by running the command through shell. I have tried several different ways to make the script wait until it's done unpacking the files, but it still goes ahead and deletes the file before they are done being used. I have tried the code below, which is a no go. I have tried to see if i could get the wait() to work, but also no luck. Any ideas? running python 2.7 EDIT: I want the script to run the

jQuery fading/dimming other list elements when one is hovered over, I'm 90% there..?

∥☆過路亽.° 提交于 2019-12-06 04:28:43
I have an unordered list, which has maybe 30 items. When one of these items are hovered over, the rest of the list items fade to 30% and the hovered item stays at 100%; when you move away from the list, they all fade back up to 100% and I have managed this. My problems arises when you move from item to item, the other list items fade back up to 100% and then back down to 30%. I want them to stay at 30% unless the user moves away from the whole list. I use the hoverIntent plugin on each list item. I also used jQuery to add a class to the current list item, so I could then fade the rest and

How to efficiently wait for CTS or DSR of RS232 in Linux?

梦想与她 提交于 2019-12-06 03:56:32
问题 Currently, I'm reading the CTS and DSR signals of a serial port in the following way: bool get_cts(int fd) { int s; ioctl(fd, TIOCMGET, &s); return (s & TIOCM_CTS) != 0; } Now I'd like to wait until get_cts() returns true. A simple loop isn't the best solution I think (as it's extremely resource-intensive). void wait_cts(int fd) { while(1) { if(get_cts(fd)) { return; } } } Is there any better solution using C or C++ on Linux? (I cannot use any hardware flow control as I don't need the serial

Selenium - don't wait until all elements are presented

余生颓废 提交于 2019-12-06 03:33:23
Selenium by default is waiting for all elements to be loaded. Is there any way for waiting for a specific element and then to proceed on? On my test, selenium is waiting with the wait() function for a page to be loaded. sometimes, some images couldn't be loaded from a remote server, while all others element on the page loaded successfully. How can I ask Selenium to ignore waiting all elements except a specific one? Selenium works on a copy of the page's source so it try to wait until the DOM represents what will be the page's full source. For this to work correctly selenium is bases on the

Wait for all jobs of a user to finish before submitting subsequent jobs to a PBS cluster

谁说胖子不能爱 提交于 2019-12-06 02:44:48
问题 I am trying to adjust some bash scripts to make them run on a (pbs) cluster. The individual tasks are performed by several script thats are started by a main script. So far this main scripts starts multiple scripts in background (by appending & ) making them run in parallel on one multi core machine. I want to substitute these calls by qsub s to distribute load accross the cluster nodes. However, some jobs depend on others to be finished before they can start. So far, this was achieved by

WebDriver Wait '.until(ExpectedConditions.elementToBeClickable' only works when i add Thread.sleep(500) to the Code?

ε祈祈猫儿з 提交于 2019-12-06 02:14:31
I'm trying to click on a button which is visible on a page by using webdriver wait but webdriver is only able to click on the button once I add a Thread.sleep to the code. I have also checked the button to see whether its visible (True) before I execute my code and it in turn returns = true . //Button Visiblity check: List<WebElement> signOutList = driver.findElements(.xpath(".//*[starts-with(@id,'fulfillment-time-type-section-')]/div[2]//button")); Assert.assertTrue(signOutList.size() > 0); //The code below Doesn't click on the button By timeDropdownButton = By.xpath(".//*[starts-with(@id,

How to run a fixed number of processes in a loop?

别等时光非礼了梦想. 提交于 2019-12-05 22:51:13
I have a script like this: #!/bin/bash for i=1 to 200000 do create input file run ./java done I need to run a number (8 or 16) of processes (java) at the same time and I don't know how. I know that wait could help but it should be running 8 processes all the time and not wait for the first 8 to finish before starting the other 8. bash 4.3 added a useful new flag to the wait command, -n , which causes wait to block until any single background job, not just the members of a given subset (or all), to complete. #!/bin/bash cores=8 # or 16, or whatever for ((i=1; i <= 200000; i++)) do # create

What if Implicit and Explicit wait, both are used in Framework [duplicate]

梦想与她 提交于 2019-12-05 22:10:40
This question already has an answer here: Combining implicit wait and explicit wait together results in unexpected wait times 2 answers I understand both waits and use of it. But one thing that I could not figure out is : If I put implicit wait for 5 seconds at top and then use explicit wait for an element. Then how selenium will behave. Tried but could not get satisfactory answer on net. Abhinav Kumar Singh First understand the concepts of Explicit and Implicit wait Implicit Wait: An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element