How do you specify an exception in an iCal feed? - c#

I am working on creating an iCal feed for our application. Things are going well. I have everything working except exceptions. For example when you schedule a recurring event and need to cancel a day, I am using the EXDATE tag in the feed and that is working fine for removing a scheduled occurrence.
The issues is if you have a recurring event that starts today # 2pm and recurrs 5 times. In our application the user can change any one of those weeks to start # 3pm if needed. How to I specify that in the iCal feed?
I have been looking at the documentation, but must be missing something...
Thanks a bunch!!

Drowsy is on the right track.
The UID's MUST match so that the adjusment is recognised as
belonging to the original event.
The Recurrence Id matches it to the instance of the recurring sequence that is being modified.
This is because of course one might be changing the date and time
as well as other changes and one doesn't want the original
instance there generated by the recurring spec, as well as the
modification.
And yes finally the sequence id must be there so
that one knows the sequence or layer of modifications in case
there are several.
For example - here's a dump of what google calendar generates if you modify a recurring event.
BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20140325T084000
DTEND;TZID=Australia/Sydney:20140325T101000
DTSTAMP:20140327T060506Z
UID:vu2d4gjdj4mpfuvas53qi32s7k#google.com
RECURRENCE-ID;TZID=Australia/Sydney:20140325T083000
CREATED:20131216T033331Z
DESCRIPTION:
LAST-MODIFIED:20140327T060215Z
LOCATION:
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:test Event
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20140128T083000
DTEND;TZID=Australia/Sydney:20140128T100000
RRULE:FREQ=WEEKLY;UNTIL=20141208T213000Z;BYDAY=TU
DTSTAMP:20140327T060506Z
UID:vu2d4gjdj4mpfuvas53qi32s7k#google.com
CREATED:20131216T033331Z
DESCRIPTION:
LAST-MODIFIED:20140222T101012Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Test event
TRANSP:OPAQUE
END:VEVENT

I believe as long as you generate a record with a RECURRENCE-ID based on the original time, and using the original UID you should be able to set the DTSTART and DTEND values for a single instance. You would need to increment the SEQUENCE too. That should trigger updates on client software.

Related

Reading specific message from EventHub

I am wanting to read a specific message from an EventHub.
I'm using the EventHubConsumerClient and the ReadEventsFromPartitionAsync using a partitionId, and Offset I have.
client.ReadEventsFromPartitionAsync(partitionId, EventPosition.FromOffset(offset), cancellationSource.Token);
The issue I have is, that despite the Offset and Partition ID being correct, I'm not getting the messages I expect back.
Context
I working on something to validate that messages are being properly processed in a distributed system.
Source Event Hub -> Processor Function -> Destination Event Hubs.
I read both ends (hubs) and validate messages arrive where they should, if they don't, look up the message from the Source Event Hub, (by partitionId and offset matching against a message ID).
It is the messages I'm looking up that don't appear to have message IDs or offset IDs I expect.
UPDATE:
I was mistaken in my recall of the defaults for EventPosition and referenced docs for the wrong SDK package below. By default, EventPosition.FromOffset is inclusive. (src)
The creation pattern in the question would include the event at the provided offset. If you're not seeing the event returned, then the offset would seem to be incorrect.
Original Answer (incorrect):
The EventPosition that you're building is non-inclusive and will not include the event at that offset, but rather start at the next available event. Using the following overload should target the event that you're looking for:
EventPosition.FromOffset(offset, true)
It looks as if the summary in the docs doesn't do a great job of calling attention to the default; I'll take a follow-up to make that more clear.
The issue was due to the incorrect offsets being provided from the AZ Function binding metadata.
Using a batch of one - correct.
Using a batch of more than one, completely wrong offsets, sequences etc.
Updated the eventhubs package (preview..) and it works fine :/

Firebase Custom Parameters with the Firebase Event

I integrated Firebase for Unity, it worked well; but I have problems understanding custom parameters.
I am using Firebase' s level_up event(it is not related but works for my purpose) and I added custom parameters to it like:
Parameter(string levelfailedornot, int currentlevel)
So a parameter for level_up event looks like this:
Parameter("fail", 151)
I thought I could see which level failed how many times, which level is easier than others etc. The problem is that I can see this custom parameters with values in the "last 30 minutes activities"("fail 151 - 32 times reported" "success 3 - 3 times reported" etc.) at firebase analytics console but I can' t see them other than that panel. How can I achieve this? I added custom parameters reporting to the level_up event but they show only how many times "fail" or "success" reported.
Looks like you are logging events only in the debug/test mode.
For events to appear and stay in Firebase Dashboard, ensure all these steps mentioned in the Get Started guide for Unity are followed in same order.
Since currentLevel is int type parameter it is reported as int and levelfailedornot is String parameter reports "fail" or "pass". The screen for event would display all the parameters in view cards along with values received from various devices using your app.
The last 30 minutes activities are updated early, but it takes 6-7 hours before they are added to the long time analysis.
Also, the numeric parameters are only visible as Average and Sum, which are not helpful in your case. If you want to count custom parameter events, it has to be Text type.

Rest SeqNum after NY close from UK

I am running DropCopy session from UK.
The API wants me to Reset SeqNum after 5PM NY time. How can I specify this in my config? Please note my time will be London. Can I specify EST/EDT?
Also, I am confused by ResetSeqNumFlag=N. I long on and off hundreds of times per day. Yet, my SeqNum only gets reset once per day. As I have this set to N why does it reset even once?
If someone could explain the difference between starttime endtime and logon - I would be grateful. I think I want to ResetSeqNum at StartTime NOT Logon (as I logon repeatedly through the day). How do I config to just ResetSeqNum once at StartTime each day?
CONFIG
# default settings for sessions
[DEFAULT]
FileStorePath=D:\Production\LOGS\Hs_storeDROP
FileLogPath=D:\Production\LOGS\Hs_logDROP
ConnectionType=initiator
ReconnectInterval=1
SenderCompID=fixclient
# session definition
[SESSION]
# inherit FileStorePath, FileLogPath, ConnectionType, ReconnectInterval and SenderCompID from default
BeginString=FIX.4.2
TargetCompID=FIX-E-FEED
StartTime=01:00:00
EndTime=23:59:00
HeartBtInt=20
SocketConnectPort=xxxx
SocketConnectHost=xxxx
DataDictionary=D:\Production\FIX\HS_FIX42.xml
ValidateUserDefinedFields=N
ValidateFieldsHaveValues=N
UseDataDictionary=Y
ResetOnLogon=N
ResetSeqNumFlag=N
EncryptMethod=0
As mentioned in the documentation, there's a configuration setting for the session called "TimeZone":
Specifies time zone ID used for session schedule. Cannot be used with UseLocalTime. Supplied ID will be passed to TimeZoneInfo.FindSystemTimeZoneById. (See here for how to get a list of valid IDs on your system.)
Once you use that setting, you can just use times in the time zone you set, which can be EST or EDT depending on what you need.
To answer the second part of your question, in FIX sessions and connections are not the same thing. This page describes the difference well:
FIX Connection is comprised of three parts: logon, message exchange, and logout.
FIX Session is comprised of one or more FIX Connections, meaning that a FIX Session spans multiple logins.
Starting and ending a session is defined by resetting sequence numbers. Logging in and out doesn't change the session, it just starts and ends a connection to that session. This is what you describe wanting, and is already the normal behaviour for FIX. If you set ResetOnLogon=Y then you would reset sequence numbers each time you log in.

GetSystemTimeZones missing GMT Standard Time

I have been trying to use TimeZoneInfo.GetSystemTimeZones in .net4 to replace our old method which uses COM to call into some MFC code. However, I've had to revert to the COM method because GetSystemTimeZones doesn't return all time zones. Being based in the UK and not including GMT Standard Time in our list of options is a problem.
When I look in the registry, I find that GMT Standard Time has a Dynamic DST subkey with no rules defined. I downloaded the .net4 source code and, in TimeZoneInfo.cs, GetSystemTimeZones eventually calls TryCreateAdjustmentRules which appears to return false if the Dynamic DST key has no FirstEntry or LastEntry defined.
//
// loop over all of the "<time_zone_name>\Dynamic DST" hive entries
//
// read FirstEntry {MinValue - (year1, 12, 31)}
// read MiddleEntry {(yearN, 1, 1) - (yearN, 12, 31)}
// read LastEntry {(yearN, 1, 1) - MaxValue }
// read the FirstEntry and LastEntry key values (ex: "1980", "2038")
Int32 first = (Int32)dynamicKey.GetValue(c_firstEntryValue, -1, RegistryValueOptions.None);
Int32 last = (Int32)dynamicKey.GetValue(c_lastEntryValue, -1, RegistryValueOptions.None);
if (first == -1 || last == -1 || first > last) {
rules = null;
return false;
}
As TryCreateAdjustmentRules returns false, TryGetTimeZoneByRegistryKey throws an InvalidTimeZoneException which means GMT Standard Time doesn't get added into the time zone collection. I've tried deleting the empty Dynamic DST subkeys but something adds them back in again (probably Windows Update).
I've done alot of searching but haven't seen anyone else report this problem. I'm not sure whether there is a GetSystemTimeZones fix or whether I can stop the empty Dynamic DST subkey appearing in the first place. Any ideas?
I'm guessing this is just a registry issue.
Something similar is outlined here for WinXP / Server 2003 SP1.
Please see if the following helps:
http://blogs.technet.com/b/dst2007/archive/2007/03/06/missing-time-zones-in-registry.aspx
My guess is you could export the entire registry Key from another machine, and apply it to your problematic box(es).
It turns out that the problem is with our COM object and not with the .NET code. The code to read the registry should only be reading but it mistakenly calls RegCreateKey to optimise multiple calls to the same registry branch.
When the COM object is registered (with admin rights) because of a new version, it loads the time zones and creates Dynamic DST for the local time zone which in my case is GMT/UTC.
Administrators, I guess this question should be marked for deletion.
After looking it over your problem and even running the code you provided in the comments to print out a list of Time Zones I am not able to get GMT to show up on my system. I am running Windows 7 Professional and selecting GMT is just not an option. I know that doesn't solve your problem and you - like a lot of other people - sound like you really need to get this to work with GMT.
However if at all possible, if you see a way to use UTC then I would check out these links:
Windows 7 Lack of Support for GMT
Converting UTC to GMT
Just another possible answer to your problem, is there anyway you can create a wrapper around the UTC values to display GMT? I ask because this problem doesn't seem like it is going to go away anytime soon. Even if you get it to work now - in the future it might break again. If I come up with a method for this I will update my answer.

How should I update an iCal RRULE when moving an appointment?

I'm switching my app's calendar from Telerik Scheduler to jQuery fullcalendar. I'm storing recurring events in the db using iCal RRULEs.
The question is, when someone drags an event to a new date, how can I update the RRULE so each subsequent occurrence is bumped by the same time delta?
I've looked at DDay.iCal and I see the method
RecurrencePattern.IncrementDate(ref iCalDateTime dt, int Interval)
That sounds like what I'm looking for, but there are no details in the documentation.
Any suggestions?
Thanks so much,
Michael
RecurrencePattern.IncrementDate is not really meant to be used outside of the library itself. Perhaps I'll look into making it protected/private (if it can be done without breaking the overall functionality).
Generally, all you need to do is change the Start of the event by the delta you've determined (let's say 1 day, for example), and every recurrence in that event will also be changed by that amount.
If you don't want the entire event to be changed by the delta, but only a specific occurrence, then there's other ways to handle that.
Could you clarify perhaps with an example event, the delta you want to move it, and the expected result?

Categories

Resources