How do I manually restart a one shot Timer? - godot

I've added a one shot Timer and hooked up a function to listen for the timeout() signal. After some action occurs in my game, I want to restart the timer at its original Wait Time value.
I've tried resetting the timer to the Wait Time I set in the inspector like this:
$Timer.time_left = $Timer.wait_time
This results in an error:
Invalid set index 'time_left' (on base: 'Timer') with value of type 'float'.
How do I set the time back to its original Wait Time value in the inspector?

Looking at the documentation for Timer, it says that you can't set the time_left property and should instead use start:
Note: You cannot set this value. To change the timer's remaining time, use start.
Calling start without any parameters restarts the timer to its original Wait Time value:
$Timer.start()
The start method also takes in an optional time_sec parameter that could instead restart the timer to a new wait time:
$Timer.start(0.5)

Related

Java Card Applet trigger proactive CAT command in process method

I need to get the current time and reset the UICC in an APDU command processed in the process method of the Applet. I'm concerned about the statement in the uicc.toolkit.ProactiveHandlerSystem.getTheHandler() method:
The applet shall get the reference of the handler at its triggering, the beginning of
the processToolkit method.
I assume I will get a HANDLER_NOT_AVAILABLE ToolkitException when trying to get the handler anywhere else except the processToolkit method.
Has anyone experience with this?
What are the alternatives to get the time and execute the reset?
I could get the time in advance after the PROFILE DOWNLOAD event or in the last STATUS event before the process command is triggered. But this would mean to poll the time continuously even if the my APDU command is not called. I could wait for the next STATUS command and listen to it to execute the reset, but this would be a delay of 30 seconds.

Why Until loop ends earlier?

I am performing an until loop in logic app. In this loop I'm using a delay function to do the next loop. But if we manage the delay unit to hour, the loop will end in the second time. That means the loop will only executed twice!(Escalation variable is 72 and LoopCounter increments from 0) I want to know if it is a bug from logic app or I did some wrong settings.
Please see the settings as below.
This issue seems to be with 'Until Loop' timeout. To resolve this you can try the following ways:
It looks like this is due to a bug in the way we evaluate the timeout limit value in the until scope.
Remove the triggerBody{} from the limit.timeout property – i.e. make a it a static value
If you really need to make the timeout computation dependent on the payload of the trigger request, you may want to add the “triggerBody()” into the “expression” property of the “until” (this is because we parse the expression when loading dependencies before the action is run)
For example:
You can refer to Configure Logic App 'Until Loop' timeout dynamically, Iteration in Logic Apps terminates prematurely, Until Loop Dynamic Count Limit and Add the Delay-until action

JMeter timers not waits the time configured in sampler

I try to create a scenario that I put a user defined delay in my test.
In the start of the test I created JSR sampler and created a variable called
vertica_results_delay and put in it the value of 400000.
Than I crated a timer and put ${vertica_results_delay}, since I want the delay will be configured in the start of the test, the problem is that Jmeter ignores my value, and not wait.
If I used Use defined field and put vertica_results_delay = 4000 it worked, but than all the tests will get the same delay, I do not want to create hard coded delay. I want to enter all properties of the test in the start of the test using JSR.
String vertica_results_delay = "400000";
vars.put("vertica_results_delay", vertica_results_delay);
log.error("vertica_results_delay " + vertica_results_delay);
Check JMeter order of execution
Configuration elements
Pre-Processors
Timers
Sampler
Your sampler executed after Timer, you need to set it before,
Add JSR223 PreProcessor outside Thread Group with your code and the delay value will be set before Timer is executed.
Timer is a scoped element which is executed before each sampler so what happens in your case is that :
JSR223 Sampler is executed after Timer
See:
http://jmeter.apache.org/usermanual/test_plan.html#scoping_rules
http://jmeter.apache.org/usermanual/test_plan.html#executionorder
To fix your issue, set your timers in a setup Thread Group, or if you only want to set it from outside of JMeter, just use function __P
and pass values on command-line:
-Jkey=value

do something after a period of gui user inactivity tkinter

What is the general method for 'doing something' after a period of user inactivity in tkinter? In my case the 'do something' will be to go to the start screen (tk.frame) that is already instantiated.
The simplest solution I can think of looks something like this:
start a timer
set a binding on any key press or any button click to reset the timer
if the timer goes off, do something
Create a function to call when the user is inactive:
def user_is_inactive():
<your code here>
Create a function to reset the timer.
We want to be able to call it from an event or directly, so the event argument needs to be optional:
timer = None
def reset_timer(event=None):
global timer
# cancel the previous event
if timer is not None:
root.after_cancel(timer)
# create new timer
timer = root.after(10000, user_is_inactive)
Set up bindings to reset the timer
Using bind_all means that every widget can potentially handle these events:
root.bind_all('<Any-KeyPress>', reset_timer)
root.bind_all('<Any-ButtonPress>', reset_timer)
Start the timer
A good time to do this is right before calling mainloop.
reset_timer()
root.mainloop()
I will admit that I have no experience in this, but maybe a sort of watchdog timer could work? A timer would count up to your desired time, but anytime an element is activated it would reset the counter. This concept is used in micro-controllers a lot but I'm not sure how you would apply it to python.

How does the .Exist timeout work within QTP?

I've worked with the .Exist method quite a bit, but I recently moved to a new project (now using a WPF application) with QTP 11 (whereas previously I had QTP 10).
Now I'd like to check that a message does not exist by using object.Exist(2). Weirdly, I only get a result after ~23 seconds, instead of the 2 seconds I was expecting.
How does the timeout work? In previous projects, using object.Exist(2) would wait 2 seconds before determining that the object didn't exist. The QTP help file also says it should only wait for 2 seconds (the specified timeout parameter).
Now, it seems as though it's waiting for the Timeout Parameter (2 seconds) AND Object Synchronization Timeout (20 seconds).
Also, Smart Identification is disabled, so it shouldn't be waiting for that. Highlighting the object using the Object Repository instantly says the object doesn't exist.
Has the timeout behavior changed between QTP v10 and v11?
Why does it take so long to say an object doesn't exist?
The Exist method does not work for the last object only.
It works hierarchically - which means this method checks each parent object before checking the last one.
The timeout only works for the last object.
if you want to receive the answer immediately, I suggest you use the following code-
if WPFWindow("x").Exist(0) Then
if WPFWindow("x").WPFButton("y").Exist(0) Then
'action
End if
End if
Make sure you don't have "Smart Identification" enabled for the test object in the Object Repository. That can get in the way.
The additional time that you're encountering is the default timeout setting, which is set to 20 seconds by default. Any Wait or Exist timers will stack on top of the default timeout.
It can be changed in the test settings:
Test Settings > Run > Object synchronization timeout - set in seconds
or in the vbscript:
Setting("DefaultTimeout") = 4000 'set in milliseconds
Using DefaultTimeout function at the beginning of the driver script would be sufficient .
Setting("DefaultTimeout") = 10000 'set in milliseconds
If any object exceeds the timeout limit of 10 seconds as mentioned above then the object will fail to get captured and Run Results will show a failure
I would recommend going by with just the default timeout. Using .Exist(x) will use the mentioned time for each child.

Resources