WF DelayActivity fires immediately? - sharepoint-2007

I have a Workflow I have created and deployed to a Sharepoint 2007 farm. When it runs against an item two delay activities I have created fire immediately.
I have setup a callback on the InitializeTimeoutDuration event. Through logs and debug output I can see that it is setting the delay to one hour. However, at the next SP timer job cycle (less than 5 minutes) the events proceeding the Delay activity fire off.
I'm lost here. Any help is greatly appreciated.
Update
Through some digging I was able to determine why this was firing off. Once the workflow started a record gets added to the ScheduledWorkItems table in the SP Content database. However, the "DeliveryDate" on the record is set to the current time while the "Created" date is set to one hour previous. However, the delay I'm using is 2 hours, so neither of these times make sense to me at all. Going to try hardcoding it....
Update 2
Even with a hardcoded duration the times are off. I hardcoded a 2 hour delay in and the "DeliveryDate" is now one hour in the future while the "Created" date is one hour in the past. So at least the difference between them is good.
Update
Well, that's embarrassing... found the problem. I'm posting it in here for others that may make mistakes like I do. First off, I was not correct in my UTC->local conversion. The times on the database were correct. What was not correct was how I was setting the TimeoutDuration:
// WRONG!
delayActivity.TimeoutDuration = new TimeSpan("1:00:00"); // one hour
what I should have been doing:
// RIGHT!
((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // one hour
once I made that change everything else seems to be fine.

Well, that's embarassing... found the problem. I'm posting it in here for others that may make mistakes like I do. First off, I was not correct in my UTC->local conversion. The times on the database were correct. What was not correct was how I was setting the TimeoutDuration:
// WRONG!
delayActivity.TimeoutDuration = new TimeSpan("1:00:00"); // one hour
what I should have been doing:
// RIGHT!
((DelayActivity)sender).TimeoutDuration = new TimeSpan("1:00:00"); // one hour
once I made that change everything else seems to be fine.

Related

rails fullCalendar, How can I show end time of a event but omit the title of the event?

I have checked a lot of related questions, but no one actually solve my problem.
I am now writing a rails app and use fullCalendar.
I am able to show events on my calendar, but with start time and the title of the event.
Actually these is end time for the even under the month view, and events longer than 30 mins under the week and day view. But no end time for the events of duration less than 30 minutes under view of week and day.
Besides, I hope not to show the title of the event. I find other answers says it will need to change the source file of fullcanlendar, I am wondering if there is any way to do it without changing the souce code of full calendar.
You may be looking for the eventRender callback:
http://fullcalendar.io/docs/event_rendering/eventRender/
With this, you can alter the event's html element however you need to.

EKAlarms with relativeOffset

I'm currently trying to write a method to compare EKAlarms to one another. The problem with this is between absoluteDate and relativeOffset. Comparing two alarms each with an absoluteDate is easy, but if one or both have a relativeOffset, you need to know what event they're relatively offset from. As per the documentation,
relativeOffset: The offset from the start of an event, at which the alarm fires.
Yet, I see no documentation on setting the trigger for a relativeOffset alarm. Can anyone help me figure out what I'm missing? How can I compare two EKAlarms with relativeOffsets?
Thanks for the help!
As you rightly say:
if one or both have a relativeOffset, you need to know what event they're relatively offset from
Quite so. But how can you possibly not know that? EKAlarms do not float around loose, falling from the sky like snowflakes. If not attached to an EKCalendarItem, a relative EKAlarm is meaningless; there is nothing to compare. If it is attached to an EKCalendarItem, then you clearly know that fact - otherwise, where would you have gotten the alarm from??? Either you just created the alarm, and are about to attach it to an EKCalendarItem yourself, or you have started with the EKCalendarItem and have looked at its alarms property, in which case you also know the EKCalendarItem's startDate and can calculate from there.

How to make left time count backward

Example is about groupon.com. As we know it say time left for certain products and counts every second. So I can do it with javascript but server side should I update it through Ajax all products left time attribute every second or how to update it in server without AJAX
Anybody knows?
1) Something should update my products timeLeft on server?
I can't find that something.
Only thing I can do is update them through ajax.
The easiest and best way to do count-downs is client-side. Trying to store and update that kind of information is a huge waste of time, space, and processing.
Basically, your database should have the ending time on it, and that will get sent to the client. Then the client will update every second using javascript:
var timeLeft = product.endTime - currentTime;
Then you can update timeLeft every second.

Realtime timer that counts down time for ruby on rails app

Im in the need on some advise for a realtime serverside timer that would countdown from say 100 seconds. Reason for serverside timer is no tampering.
currently use delayed job but problem its not realtime i could mimic a timer by creatind job every second, but dirty solution
need to display time in view by getting timer value with ajax call to method that returns servertime on page. Know how to do this just to give idea. reload timer would still countdown correctly even on reload page.
Anyone could advise to get a realtime counter in rails app serverside? I would want to create one or more independant timers i can get a value from in railsapp.
Why don't you just create the record you need, but add a "don't open before" DateTime field you can check to see if it's okay to show it?
This sort of thing is trivial to do, and you can set a timer on the client to count-down in JavaScript, then reload the page with the final data at the appropriate time. If someone is impatient and reloads early, you can compute the number of seconds remaining before it can be shown using simple math:
time_left_in_seconds = record.show_at.to_i - Time.now.to_i
Then all you have to do is show a JavaScript timer for that number of seconds, then trigger a page refresh.

RxSwift: Receive events immediately, unless the last event was processed within a certain interval

New to RxSwift / Reactivex. Basically what I'm trying to do is to make a server call whenever something happens, but make sure it's not done more often than every 10 seconds. Less often if possible.
For instance, whenever an event ("needs update") is generated I'd like to call the server immediately if more than 10 seconds have passed since my last call. If less time has passed I'd like to make the call on the 10 second mark from the last one. It doesn't matter how many events have been generated within these 10 seconds.
I looked at the description of throttle but it appears to starve if events happen very quickly, which isn't desirable.
How can I achieve this?
There's a proposed new operator for RxSwiftExt that would give you something you're looking for, I think. However, it doesn't exist yet. You might want to keep an eye on it, though.
https://github.com/RxSwiftCommunity/RxSwiftExt/issues/10

Resources