How to prevent GUI blocking? - user-interface

I have a timer that ticks every 3 seconds.
If the timer found something a messagebox will show.
Then the timer should wait 30 seconds, before he show again the messagebox (the user of course must have time to react).
How can I handle this?
I tried a Thread.Sleep(30000), but the GUI blocks of course.
My other Idea is a second timer that will be activated after the first ticks and reactivate the first timer in the tick-method.
So: t1 tick -> msg box -> after click -> t2 enable (30 sec tick) -> t2 tick, enable t1
But I think thats not a good idea, is there a better way?

Depends on the Language.
In any case you have to create a second Thread that does the waiting and checking.
In case of .NET you might want to look into the "BackgroundWorker"

Use System.Windows.Forms.Timer

Related

JMeter Webdriver waittime issue

I have a scenario where I need to click on a button in the Web page which will do a process. Once I click on this button "process in progress" message will appear. I am waiting for this message to disappear from the web page for the next action.
This process will take time between 30 to 150 secs which I don't have control.So I have given a wait time of 180 secs in the sampler. The issue is some time the process will complete in 30 secs and webdriver will wait for 180 secs to complete for the next action. In this case application will log out because inactive user settings.
How to handle this situation?
You can use ExpectedConditions.presenceOfElementLocated combined with WebDriverWait.
It would wait at max 150s but if element is available before it doesn't wait that much:
var wait = new pkg.WebDriverWait(WDS.browser, 150);
wait.until(pkg.ExpectedConditions.presenceOfElementLocated(
pkg.By.cssSelector('ul.suggestions')))
See full details here:
https://jmeter-plugins.org/wiki/WebDriverSampler/
You can go for ExpectedConditions.invisibilityOfElementLocated(By) function which can be used via Explicit Wait so WebDriver will poll the DOM until the element disappears with the maximum of 150 seconds, default polling interval is 500 milliseconds, however it can be adjusted as required.
Example code would be something like:
var wait = new WebDriverWait(WDS.browser, 150)
wait.pollingEvery(1, java.util.concurrent.TimeUnit.SECONDS)
org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[contains(text('process in progress')]"))
More information: The WebDriver Sampler: Your Top 10 Questions Answered

Excel Power Query - Sleep or Wait Command to Wait on API Rate Limit

In Excel Power Query (PQ) 2016, is there such a function that can insert a "SLEEP 15 seconds" before proceeding? Not a pause, but a sleep function.
Problem:
I wrote a function in PQ to query: https://westus.api.cognitive.microsoft.com/text/analytics/v2.0. That function works fine, as designed.
I have a worksheet with 10K tweets that I want to pass to that function. When I do, it gets to ~60 or so complete and I get an ERROR line in PQ. A look at Fiddler says this:
message=Rate limit is exceeded. Try again in 11 seconds. statusCode=429
I think if I insert a SLEEP 5 second (equivalent) command into the PQ function, it won't do this.
Help & thanks.
You want Function.InvokeAfter
Function.InvokeAfter(function as function, delay as duration) as any
Here's an example:
= Function.InvokeAfter( () => 2 + 2, #duration(0,0,0,5))
Returns 4 after waiting 5 seconds.
To answer a question you didn't ask yet, if you're going to execute the exact same Web.Contents call a second time, you may need to use the
[IsRetry = true]
option of Web.Contents to indicate you actually want to run the web request again..

event and transaction in vhdl(timing diagram)

I tried to solve the problem, but I got a different table than the table that xilinx shows. I attatched both my answer and real answer. Xilinx shows that "out" is 'U' until 36ns, after 36ns, it is '1'. Can anyone help me about why the "out" graphics is not assigned any value before 36ns?(I think it should be assigned first at 20 ns).
my answer
question
This turned out to be a really good question. I initially thought you had done something wrong when simulating, but then I ran my own simulation and got the same result.
It turns out that the a <= b after x assignment uses something called the "inertial time model" by default. In this mode scheduled events will be cancelled if b changes again before x time has passed. The purpose is to filter pulses shorter than the specified delay. In your case this is what the simulator will do:
At t=0, out is scheduled to change to 1 at t=20.
At t=12, tem1 or tem2 changes to 0. The scheduled change at t=20 is cancelled and a new change to 0 is scheduled at t=32.
At t=16, tem1 or tem2 changes back to 1. Again the scheduled change is cancelled and a new change is scheduled at t=36.
After this tem1 or tem2 remains at 1, so the change at t=36 is executed and out finally changes from U.
You can change to the "transport delay model" using out <= transport tem1 or tem2 after 20 ns; In this case your drawn waveform will match with simulation.

Sliding window over an interval on Esper

How do I achieve the same effect of Spark Streaming sliding window, which runs at X sliding interval over the last Y window length.
Looking at Esper, it should be win:time and win:time_batch, where win:time >= win:time_batch.
I managed to solve this problem in less customizable but easier way (at least for me), by using win:time with OUTPUT EVERY x
SELECT value
FROM Entry.win:time(10 sec)
OUTPUT EVERY 5 sec
Works as I intended - every 5 seconds I get results from the last 10 seconds.
In esper the equivalent is to declare a context.
create context BucketOf10Sec start #now end after 10 seconds;
context BucketOf10Sec select sum(price) from MyEvent;

How to create a resetable timer?

On the MIT App Inventor (similar but not the same to Scratch), I need to create a timer that can be reset when an action happens to complete an App. But, I have been unable to find a way to make a resetable timer. Is there a way using this piece of software? This is a link to the App Inventor.
The first 4 blocks are the codes for when the player interacts/clicks one of the 4 colored boxes.
The last block is the code outside of the 4 .Click blocks.
Btw. there is a lot of redundancy in your blocks, see Enis' tips here how to simplify this...
If you want to reset the clock, just set Clock.TimerEnabled = false and then set
Clock.TimerEnabled = true again and the clock will restart
see also the following example blocks (let's assume, you have a clock component and the timer interval is 10 seconds)
in the example I reset the clock after 5 seconds and as you can see, the clock starts from the beginning...
You can download the test project from here

Resources