I'm trying to programatically change the start and end dates when the Scheduler's save event is fired.
I'm using moment.js to do the manipulation. This is working for the start value, but it won't update end
This is what I'm doing:
var start = moment(e.event.start).hours(6).minutes(30).seconds(0),
end = start.clone().add(8, 'hours');
if (e.event.isAllDay) {
e.event.set('start', start.toDate() );
e.event.set('end', end.toDate() );
}
This sets the start time of all day events to 06:30:00, but the end time isn't updated and is always 00:00:00
Any ideas why I can't set the end time in this way?
Related
I have a requirement where I need to create 2 million data for past 3 months from April till July. Based on calculation I need to create 2,222 data every Day. I have a Insert Statement, where I need to pass time Stamp which is perfectly working fine. If I use time shift function for example..__timeShift(yyyy-MM-dd HH:mm:ss:SSS,now,-PT2H,,)} it successfully insert the data, but once 2222 loop is complete I don't want to wait for 24 hr based on timeshift..once loop is complete, it should take the next date and again start the loop, can someone help me how to solve the problem
You can iterate each day for the past 3 months using any suitable JSR223 Test Element and the following Groovy code:
def format = 'yyyy-MM-dd HH:mm:ss:SSS'
def now = new Date()
use(groovy.time.TimeCategory) {
def april = now - 3.month
april.upto(now) {
def minus2hours = it - 2.hour
println(minus2hours.format(format))
1.upto(2222) {
//here will be your current loop
}
}
}
Demo:
More information:
Groovy TimeCategory
Creating and Testing Dates in JMeter - Learn How
Currently i making a med schedule which fires a local notification everyday at the time your med is due, so far i have got it working for the first day but it will not fire again unless the user clicks on the notification.
else if (Device.RuntimePlatform == Device.iOS)
{
App.BadgeCount = App.BadgeCount + 1;
CrossNotifications.Current.Badge = App.BadgeCount;
Random rnd = new Random();
string stringid = rnd.Next(1, 1000000000).ToString();
stringid = CrossNotifications.Current.Send(usermedid, "Please take " + dosage + " of " + medname, "ding", ms);
Debug.WriteLine("Notification saved" + stringid);
Is there any way to add in my code a way to set the notification to repeat daily at that exact time without having to click on the notification ? Would be best to revert to using UILocalNotifications and using the repeat interval ?
Any help appreciated .. Thanks
From what I can see in the ACR source it can only schedule something through tje calendar, so yes, then you will need a manual action to schedule the next one. Also, I think there is a limit to how many notifications you can schedule in the future.
You are mentioning UILocalNotifications, not that this API is deprecated as of iOS 10. You probably want to use the replacement: UNNotificationRequest. Looking at that API, there is a function to schedule notifications with an interval and the option to let them repeat for each interval. In native code this looks like this:
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: (30*60), repeats: false)
That is probably what you are after. So now you need to either find a plugin that supports this, or write something yourself
We are storing small documents in ES that represent a sequence of events for an object. Each event has a date/time stamp. We need to analyze the time between events for all objects over a period of time.
For example, imagine these event json documents:
{ "object":"one", "event":"start", "datetime":"2016-02-09 11:23:01" }
{ "object":"one", "event":"stop", "datetime":"2016-02-09 11:25:01" }
{ "object":"two", "event":"start", "datetime":"2016-01-02 11:23:01" }
{ "object":"two", "event":"stop", "datetime":"2016-01-02 11:24:01" }
What we would want to get out of this is a histogram plotting the two resulting time stamp deltas (from start to stop): 2 minutes / 120 seconds for object one and 1 minute / 60 seconds for object two.
Ultimately we want to monitor the time between start and stop events but it requires that we calculate the time between those events then aggregate them or provide them to the Kibana UI to be aggregated / plotted. Ideally we would like to feed the results directly to Kibana so we can avoid creating any custom UI.
Thanks in advance for any ideas or suggestions.
Since you're open to use Logstash, there's a way to do it using the aggregate filter
Note that this is a community plugin that needs to be installed first. (i.e. it doesn't ship with Logstash by default)
The main idea of the aggregate filter is to merge two "related" log lines. You can configure the plugin so it knows what "related" means. In your case, "related" means that both events must share the same object name (i.e. one or two) and then that the first event has its event field with the start value and the second event has its event field with the stop value.
When the filter encounters the start event, it stores the datetime field of that event in an internal map. When it encounters the stop event, it computes the time difference between the two datetimes and stores the duration in seconds in the new duration field.
input {
...
}
filter {
...other filters
if [event] == "start" {
aggregate {
task_id => "%{object}"
code => "map['start'] = event['datetime']"
map_action => "create"
}
} else if [event] == "stop" {
aggregate {
task_id => "%{object}"
code => "map['duration'] = event['datetime'] - map['start']"
end_of_task => true
timeout => 120
}
}
}
output {
elasticsearch {
...
}
}
Note that you can adjust the timeout value (here 120 seconds) to better suit your needs. When the timeout has elapsed and no stop event has happened yet, the existing start event will be ditched.
We have a set of processes that need to be performed. Some are done daily, some weekly and some monthly. There is a deadline set up for each process before which it should be completed. We need to send a reminder to the team in the following way.
If the process runs daily and needs to be completed before a particular time, then a reminder should be sent 2 hours before that
If it runs weekly on a particular day then a reminder should be sent at 10AM IST of that particular day
If the process runs monthly and needs to be completed before a particular day, then a reminder should be sent just a day before the end date.
How can I create a VB script for the above task?
The Reminder class doesn't provide any property or method for changing the time. But you may create an appointment item on your calendar for each event (it can be a recurrent item) and set the reminder for the item. The ReminderMinutesBeforeStart property of the AppointmentItem class returns an integer indicating the number of minutes the reminder should occur prior to the start of the appointment. The ReminderSet property allows to set a Boolean value that is True if a reminder has been set for this item. For example:
Sub AddAppointment()
Dim apti As Outlook.AppointmentItem
Set apti = Application.CreateItem(olAppointmentItem)
apti.Subject = "Car Servicing"
apti.Start = DateAdd("n", 16, Now)
apti.End = DateAdd("n", 60, apti.Start)
apti.ReminderSet = True
apti.ReminderMinutesBeforeStart = 60
apti.Save
End Sub
I have a date picker where the user simply chooses a date then a Dynamic Action is suppose to send an alert if the user clicks tomorrow(sysdate+1).
The Datepicker term is the simple layout.
The Dynamic Action-->
Name: Valid Date
Event: Change
Selection type: Item(s)
Item(s): datepicker_name
Condition: equal to
Value: sysdate+1
When I run the program and click any day on the calendar, no alert comes up. I thought the problem was the format. The Dynamic Action sees the date as "DD/MM/YYYY" while the Datepickers output is "DD-Mon-YY" so it could not compare them. Apples and Oranges. But I played around with the format to make it all the same but still no progress.
Thanks again for your time and help!
As #ScottWe mentions: you're trying to apply PLSQL logic in HTML/javascript. The 'When - Condition' is evaluated at runtime and thus you can't use PLSQL there.
The date arithmetic is a bit annoying in javascript though, so if you're a unfamiliar with it, here is a way you can perform your check (which is, is the entered date tomorrow or not).
Taking my clues from these:
Date difference in Javascript (ignoring time of day)
JavaScript how to get tomorrows date in format dd-mm-yy
Add this function to the page's javascript section for global variables and functions:
function isTomorrow(pDateItem){
function getTomorrow(){
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
return tomorrow;
};
function cutTime(pDate){
return new Date(pDate.getFullYear(), pDate.getMonth(), pDate.getDate());
};
// check if pDateItem leads to a selection
// check if it is a datepicker
// check if a date has been selected
if ( $(pDateItem).length
&& $(pDateItem).data("datepicker")
&& $(pDateItem).datepicker("getDate") !== null
)
{
var tomorrow = getTomorrow();
var check = $(pDateItem).datepicker("getDate");
var one = cutTime(check);
var two = cutTime(tomorrow);
return one.getDate() === two.getDate();
};
return false;
}
Then in your Dynamic action 'When' condition, use a javascript expression with this code:
isTomorrow(this.triggeringElement)
Then the corresponding True Actions will only fire when the date is set to tomorrow.