SharePoint. How to run timerjob every 90 minutes - sharepoint

I have a web.config setting like IntervalInMinutes. I would like to use the setting value to create my SPSchedule instance and run my job. The interval should be set in minutes.
I know how to use SPMinuteSchedule and run the job every 0 < n < 60 minute or how to use SPHourSchedule and run the job every 0 < n < 24 hours, But what if I want to have 90 or 2000 minutes interval as the setting value?
So, the question is: what should I do to run the job with the minutes interval 0 < n < 100000?
Thank you.

It's not a very robust solution, but I think you'll have to use an appropriate number of the SPDailySchedule objects.
In case of the 90 minutes interval it is:
24 h / 1.5 h = 16

Related

Age in seconds calculator

I want to make a calculator that calculates someones age in seconds and all the programs that do that only get the days. Can someone help me please?
This sounds more like an algorithm problem. What you would want though is to just keep breaking years into smaller units so for example.
1 year = 365.25 days -> 1 day = 24 hours -> 1 hour = 60 minutes -> 1 minute = 60 seconds
This should be relatively easy to implement in code.

Nested/Multiple IF functions in excel, how can I?

I am trying to implement an excel spreadsheet to keep track of my working hours.
I am entitled to unpaid breaks at my work, however these vary depending on the length of shift as follows.
0 - 3.75 hours = 0 min break
4 - 5.75 hours = 15 min break
6 - 7.75 hours = 30 min break
8 - 8.75 hours = 45 min break
9 - 11.75 hours = 90 min break
I would like to calculate my working hours minus breaks in excel.
I think I need to use if statement similar to the following (taking E2 as my hours):
=if(E2<=3.75, E2, if(4<=E2<=5.75, E2-30, if(6<=E2...etc...
But it never seems to work, can someone help me get this working???
Thanks.
You may try this:
=IF(E2<=3.75,0,IF(AND(E2>=4,E2<=5.75),15,IF(AND(E2>=6,E2<=7.75),30,IF(AND(E2>=8,E2<=8.75),45,IF(AND(E2>=9,E2<=11.75),90,"")))))
EDIT : 1
=IF(E2<=3.75,E2,IF(AND(E2>=4,E2<=5.75),(E2*1440-15)/1440,IF(AND(E2>=6,E2<=7.75),(E2*1440-30)/1440,IF(AND(E2>=8,E2<=8.75),(E2*1440-45)/1440,IF(AND(E2>=9,E2<=11.75),(E2*1440-90)/1440,"")))))
EDIT : 2
=IF(E2<=3.75,E2,IF(AND(E2>=4,E2<=5.75),E2-0.25,IF(AND(E2>=6,E2<=7.75),E2-0.5,IF(AND(E2>=8,E2<=8.75),E2-0.75,IF(AND(E2>=9,E2<=11.75),E2-1.5,"")))))
See image for reference.

How to display 1 hour 46 minutes in MS Excel cell where both the number count of hours and minutes comes from calculation?

Suppose I sleep for 7 hours and 36 minutes. I have a sleeping threshold of 5 hours and 54 minutes. If I sleep more than threshold time, I get the time difference and If i sleep less than or equal to my sleeping threshold, i get the output as 'You slept Good". To do so, I scaled zero to 60 minutes of actual time to 0 to 1 on a decimal scale, this way 7 hours 36 minutes comes as 7.6 and 5 hours 54 minutes comes as 5.9.
Now, I take their difference which comes out to be 1.7 i.e. I slept extra for 1 hour and 0.7 minutes on 0to1 scale (which equals 1 hour 42 minutes on actual time scale).
So, I used TRUNC function to display 1 h (i.e ! hour); however I can't get my mind working as to how I can display 42 minutes in the same cell.
i.e. my output should be 1h 42 min
This should work:
=IF(B2+C2/60>5.9,LEFT(B2+C2/60-5.9)& "hr "&ROUND(((B2+C2/60-5.9)-VALUE(LEFT(B2+C2/60-5.9)))*60,0)&"min","You slept good")
However, you wouldn't be able to do further calculations, as it is a text.
Also assumes you will not oversleep by more than 10 hrs :)

How to calculate Pacing time in load runner

I have to run 100 iterations with 50 users. The total duration of the test is 1 hour. 1 user can do 2 iterations and the number of transactions in the script is 6.
How to calculate pacing time?
Example:
1000 Users, 10000 Full Iterations per hour
10,000/1,000 = 10 iterations per user per hour
3600 seconds per hour /10 iterations per user per hour = one iteration every 360 seconds ( six minutes ) on average
The random algorithm in LoadRunner is based upon the C rand() function, which is approximately (but not exactly ) uniform for large datasets. So, I take the average pacing interval from the start of one iteration to the next and then adjust it by plus/minus 20%.
So, your 360 ( 0:06:00 ) second pacing becomes a range from 288 seconds (0:04:48) to 432 seconds (0:07:12 ).
You would run these calculations for each business process you want to stage
For think time look to your production logs for information on the range of users from page X to Page X+1. This is easily achievable since each top level page refers to the REFERER, or previous page that it came from. A comparison of the timestamps grouped by client IP can provide that range you need for think times.
Always Apply Little's Law for calculate Pacing, ThinkTime, No.of VUsers
From Little's Law: No of VUsers= Throughput*(Responce_Time + Think_Time)
Expl.
Throughput= Total No of Transactions/Time in Seconds
, Pacing= (Response_Time + Think_Time)
From Your Requirements-
Total No of iterations 100 and 1 iteration have 6 transactions, So total no of transactions = 600
Throughput for 1 Minute is: 600/60 = 10
, Throughput for 1 Sec is: 0.16
According to formula 50 = 0.16*(Pacing)
Pacing = 312.5 seconds
To achieve 100 Iterations in 1 Hour you have to set pacing 312.5 seconds, Make sure Pacing = Response_time + Think_Time.
Pacing is the 'inter-iteration' gap and it is used to control the rate of iterations during the test. If the goal for 1 user is to complete 2 iterations per hour, that results into a Pacing of 1800sec (little's law mentioned above) . Now as long as the summation of resp times of those 6 transactions and think time between them is less than 1800s, you will be able to achieve the desired rate.
NOTE: iteration is not equal to transaction, unless the iteration has just one transaction. Refer this to get a pictorial understanding
https://theperformanceengineer.com/2013/09/11/loadrunner-how-to-calculate-transaction-per-second-tps/
Pacing is the wait time between iterations so i'm agree with #CyberNinja, in your use case pacing is 1800s because it's the max duration of your script that achieve your goal : produce 100 iterations with 50 users in a hour.
Pacing is not Response_time + Think_Time!
According to Little's Law :
No. of Concurrent Users(N) =
Throughput or TPS(X) * [
Response Time (RT) + Think Time (TT) + Pacing (P)
]
Here RT+TT is Script Execution Time SET which you can calculate by running script once and adding up all the RT of transactions and all think times.
Assume SET to be 60 seconds.
As per your question
total transactions in 1 hr =
100(Iterations) *
50(Users) *
2(Each User Iteration) *
6(No. of Transactions)
= 60000 Transactions/hr
Converting it to TPS = 60000/3600 = 16.66
Now Putting all values in Little's Law:
50 = 16.66 (60 - Pacing)
Pacing = 60 - 50/16.66
Pacing = 57 secs (approx).

Updating a Duration Field by Plugin

Has anyone had to update a Duraton field from within a plugin?
On the UI it is fairly intelligent, you can type
5 minutes
7 //defaults to minutes
3 hours
And it will workout what you need.
Assuming the field is called new_foo, what value should I assign? Int?
var e = new Entity("new_bar");
e.Attributes("new_foo", 5);//5 minutes?
Double?
var e = new Entity("new_bar");
e.Attributes("new_foo", 5.00);//5 minutes?
Other ideas?
Duration is a format for the Whole Number type, so by code you need to set an Int32 value (in this case not negative or it will throw an exception)
The value is always considered in minutes, so if you want to put 3 hours you need to set the field value to 180 (60 minutes x 3 hours), 1 day is 1440 (60 minutes x 24 hours) and so on.
By interface you can set using decimals, but it's always a representation of an integer value (for example 1.5 hours equals 90 minutes)

Resources