I've created a function to calculate time difference between current time and time recorded as StartTime. All calculations are perfect but my "StopWatch" won't update every second. Is there a way of updating it, so it can display every second elapsed since start point?
Window refreshing script isn't an option really.
Short answer: no.
There is nothing in Filemaker that will happen as a result of merely time passing - except for a script paused for a duration or installed on a timer.
To show a live, ticking clock, your best option would be to use a web viewer - see an example file here: http://fmforums.com/forums/topic/71934-calculating-elapsed-time-realtime/?do=findComment&comment=340205
Related
Is there any way one can know the time remaining until Anylogic model completes it's execution in real time using traceln.
I am trying to trigger an anylogic model jar file using vba & want to show a progress bar displaying the Progress of experiment & time remaining until model execution is completed.
I think you want to know the real time that the model execution will take and us that to show a progress bar.
Felipe showed how to calculate the simulation time based on starttime and endtime set in the sim experiment and the current simulation time.
I don't think there is an easy way to do what you want. based on trial and error you could insert some traceln inside your model and use that to time the progress bar. Though it would change based on your inputs. Even the progress bars you see on microsoft apps / installations are not too accurate so thats never easy.
double remaingTimeSeconds=getEngine().getStopTime(SECOND)-time(SECOND);
traceln(remaingTimeSeconds);
in a more general way, if your model doesnt start at t=0, then you can do the following to get the remaing progress:
double totalSimTimeSeconds=getEngine().getStopTime(SECOND)-getEngine().getStartTime(SECOND);
double timeSinceStartSeconds=time(SECOND)-getEngine().getStartTime(SECOND);
double remaingingTimeSeconds=totalSimTimeSeconds-timeSinceStartSeconds;
double fractionRemaining=remaingingTimeSeconds/totalSimTimeSeconds;
traceln(fractionRemaining*100+"%");
I am building a dashboard for my System Dynamics model on Any Logic. I want to create a button that runs the model for 12 time units using getEngine().step() code. The method runs the model for only one time step of the simulation but I need 12 time units which is 1200 times the step. I was wondering if there any way to run the model for 12 time units and then pause it.
Also I want to start the model on a pause mode. I mean after clicking the Run button.
UPDATE: I found an answer to my second question. I created an event and set the following action to happen at time 12. getEngine().pause();
create an event (from the agent palette)
Make the event happen after 12 time units (seconds, minutes or whatever you have)
Add this code to the event:
pauseSimulation();
I have a spreadsheet that acquires some table data using the IMPORTHTML function, and for the first two days I was using it (refreshing twice daily) things were going fine. As of this morning, it is absolutely crawling. Went from taking ~15 seconds to load 30 rows to taking ~10 minutes. Can somebody lend aid on this?
Example formula:
=IMPORTHTML(
"http://www.muthead.com/16/players/prices/1508-markus-wheaton/playstation-4","table",2
)
As mentioned, the first couple of days it was able to refresh and process a list of 30 without any pauses. Now I get the 'Executing script' message for about ten minutes before it begins to do anything, and I haven't touched the source code since origin. I'm not sure what contributes to the performance of the IMPORTHTML statement...
I've run into similar loading issues when using IMPORTHTML, IMPORTDATA, etc. The best solution I've found is to write a trigger that will edit your formula so it is forced to refresh every hour or so.
Open up the script editor and put this in. Change 'A1' with the cell your IMPORTHTML function is in, and change foo to the URL you're trying to import.
function refreshData() {
var range = SpreadsheetApp.getActiveSpreadsheet().getRange('A1');
range.clear();
range.setFormula('=IMPORTHTML(foo)');
}
Then go to Edit > Current Project Trigger > Add Trigger, and set a refresh interval.
Hope this helps.
To get a bunch of new reports to run I changed the system date on my JasperReports Server. After I changed it back, the normally-scheduled reports did not run because the "next run time" is evidently calculated statically based on the previous run.
How can I force the quartz scheduler to recalculate the next run time?
This is what I ended up doing: for each scheduled report, edit the scheduled report and change the execution time by some small amount (say a minute). Then, click Next Next Next until you are done editing. This apparently forces the scheduler to recalculate; however, it is horribly time-consuming! If you do not change the execution time it will not recalculate the next run time.
Good luck.
What i want to do is record the time of when a button has been pressed. All these times will be stored in an array. The program will then run through the array and look at the time values and then highlight the button states at those particular times during playback.
Hopefully this makes sense, whats the best way to do this?! Thanks in advance.
------------------ MORE DETAIL ------------------
the first thing that came up on my mind was... 'ah ha, timestamp', but then looking into the documentation, in a certain section in the timestamp page somewhere in the paragraph it states the following:
....You should not use it to determine the exact time at which the event occurred but should instead compare it to the timestamp of another acceleration event to determine the elapsed time between the events....
this is not great.. as i am assuming that it will not be accurate when it comes to playback of highlighting the buttons at the exact times of when the user had actually pressed them during record.
Please let me know of what i should use and do.
The -[UIEvent timestamp] property will be the most accurate representation of when the touch actually occurred. If you use CFAbsoluteTimeGetCurrent() or the UNIX time() functions you will get the current time the moment function is called, not when the event actually occurred (which will be sometime earlier).
You can use CFAbsoluteTimeGetCurrent() to get the current time expressed as the number of seconds (as a double value, so fractional seconds will be there) since January 1, 2001 00:00:00 GMT.
Hence, you should record the value of CFAbsoluteTimeGetCurrent() at some point when your app starts, and then record its value every time a button is pressed. Then, by subtracting the time the app started from the time the button was pressed gives you the number of seconds the button was pressed since the app started. You can then play back the button presses at a later time by taking that time delta and adding it to the time when playback started.