Using QueryPerformanceCounter at Intervals in VB.NET - windows

I was wondering if I could somehow get some guidance on using QueryPerformanceCounter/Frequency on performing a task at every interval in VB.NET. Let's say for example every 6 micro-second.
I was thinking maybe find the time now and do a mod on 6us, but there would lead to precision issues?
Thanks everyone.

You could create a "timer-class" that stores the previous time and interval. Then create a method like Update(). In that method you check the current time of something like a stopwatch and compare it with the previous time and the interval. If you are to early just sleep the rest of the time. Thats princip of games are working.

Related

How to track duration of request in TIBCO BusinessWorks 6

I want to send telemetry data of my BusinessWorks 6 flow to Azure's Application Insights. They provide a java library that is easy enough to use but it requires me to fill in certain data by myself.
Specifically I need to enter the duration of the request. While this should be easy enough to calculate I can't figure out where I can find the timestamp of the initiation of the process or any other timestamps for that matter.
My current approach is to assign the current timestamp to a variable in the start of the flow. Then at the end I use that value to calculate the duration. While it does work it results in duration times much lower then what Postman produces for instance.
Does anyone know of a simpler way I can determine the duration of a request?
So far i understood you want to track the duration of a request served by a businessworks process.
Afaik no easy way to find that as a variable inside the process context.
If you only like to track performance of your processes with application insights and don't need any correlation of the data processed, the process execution statistics might be thing to take a look:
https://docs.tibco.com/pub/activematrix_businessworks/6.4.1/doc/html/GUID-B07A14A8-83DF-43E4-B73D-F942103FAA1E.html

Scheduling a task run

I have a script that must run at a certain hour for the amount of time I specify.
I'm looking at the clockwork gem (https://github.com/tomykaira/clockwork) which seems to be the closest piece of software I might eventually use to accomplish this, unfortunately it doesn't seem to give the ability to set a duration (start at 3PM stop 5PM), meaning I have to split the feature in 2, starting the script is going to be clockwork's job, stopping it is in the script itself with a custom solution.
Very suboptimal and messy.
How does people do this in Ruby? TIA
There is great gem called whenever for same job. With it you can set exact time for your task, like:
every 1.day, :at => '4:30 am' do
runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
end
But you'll have to have two stages, one for starting one for stopping your job, which seems to be more natural than job which kills itself at some time by my opinion.
Somewhat janky, but there is another solution. I'm not sure what you are using to host your app, but on Heroku you can set up a scheduler to run every 10 minutes, on the hour, or daily. Then inside the method that the scheduler calls, you can determine the current time. Say you only want to run it between 3pm and 5pm, you would just wrap your code inside an if statement that verifies the current time is between 3pm and 5pm (watch out for time conversions with UTC).
Hope this helps.

Recurring Toasts with Windows 8.1 Store Apps build with JS

I've been trying to create notifications that happen on a weekly basis - for example, every monday at 8am.
I've tried to use a recurring toast for this - http://msdn.microsoft.com/en-us/library/windows/apps/hh465417.aspx - but realized that the recurrence parameters are more designed for a snooze functionality, with a maximum delay of 60 minutes, and a maximum repeat for 3 times.
Is there a suggested workaround for this?
Is there a best practice for such a use case?
Thanks!
You're right that the recurrence on scheduled toasts is designed for snooze. Unfortunately, the API doesn't provide a way to show the same toast multiple times on a fixed schedule.
You'll need to manually create a ScheduledToastNotification each time you want it to be shown. In your example, you might create and schedule out a toast a week for each Monday at 8 AM.

Get Cycle Time Using Okuma API

Control: Okuma OSP-P200L
Machine: LB3000
API: 1.15.0.0
I need to get the cycle time for a part program in an Okuma Lathe using the THINC API. The help file mentions a cycle complete method:
public bool CycleComplete(
MachineSideEnum enMachineSide )
But I'm not finding any way to detect a cycle start.
Any ideas?
Another possible approach is to use the CmachingReport.GetMachiningReports method. It returns an ArrayList of the CMachining class which has a property called OperatingTime. This is a cumulative timer representing actual time from start to finish each time the program is run.
You can calculate the average cycle time for a particular program by dividing the OperatingTime by the NumberOfWork property. Doing it this way would give you some flexibility in case the app isn't running or you don't want to poll.
Like AppFzx said, you'd have to poll.
Have user start the application, then start their part program.
Your application will need to poll GetProgramRunningState() (not faster than 100ms interval!) to see when the part program starts.
Then poll CycleComplete() to see when it finishes.
On that thread though, events are an interesting idea for future API releases...

How to change the resolution time calculation in JIRA?

Is it possible to change the resolution time calculation to start not with the issue creation time, but rather with the time when an issue was transferred into a certain state?
The use case is as follows - We use a kanban-ish development method, where we create most issues/featues/stories in a backlog upfront; thus, this kills the usefulness of the resolution time gadget. In our case, the lead/resolution time should rather be calculated using the time where an issue has been pulled to the selected issues.
As this calculation is the basis for multiple gadgets, maybe it could be changed per gadget in order to avoid unforeseen issues with other gadgets?
There is a service level management tool SLAdiator (http://sladiator.com) which calculates resolution / reaction times based on the duration that ticket has spent in a certain status (or statuses). You can view these tickets online as well as get reports.

Resources