Occurence problem


#1

Hi,

My company just purchased your ICalendar component...it looks good...unfortunately I am having some problems with it.

At first i thought it was a licensing problem (it may still be)...but i explicitly used the entire path

anyway heres what happened:

Aspose.iCalendar.License license = new Aspose.iCalendar.License();

license.SetLicense("C:\\\\bin\\Debug\\Aspose.iCalendar.lic");

string rule = "DTSTART;TZID=California-Los_Angeles:20060101T120000RRULE:FREQ=MINUTELY;INTERVAL=1"

RecurrencePattern pattern = new RecurrencePattern(rule);

DateCollection dates = pattern.GenerateOccurrences(new DateTime(2005,1,1,12,0,0), new DateTime(2005, 1,1,12,10,0));

This works...but when i change the date to 2006

Aspose.iCalendar.License license = new Aspose.iCalendar.License();

license.SetLicense("C:\\\\bin\\Debug\\Aspose.iCalendar.lic");

string rule = "DTSTART;TZID=California-Los_Angeles:20060101T120000RRULE:FREQ=MINUTELY;INTERVAL=1"

RecurrencePattern pattern = new RecurrencePattern(rule);

DateCollection dates = pattern.GenerateOccurrences(new DateTime(2006,1,1,12,0,0), new DateTime(2006, 1,1,12,10,0));

it seems to run forever....is there a way to return a bool determining whether the license got set or not?

whats going on?

Scott


#2

ok this one is my fault...should have paid more attention to RFC 2445...

my rule was bad...I wanted to return the next occurence of a specific rule and I forgot to include the termination time for my rule...hence the reason why it ran forever...anyway here is my revised rule that works:

"DTSTART;TZID=California-Los_Angeles:20060101T120000RRULE:FREQ=MINUTELY;COUNT=1;INTERVAL=1"

btw is a carriage return line feed character.

Scott


#3

It works all fine for me. Cannot reproduce your problem.

1. Your first example should return 0 occurrences because the range of the dates in 2005 you pass into GenerateOccurrences does not overal with the pattern that starts in 2006.

2. Second example works fine. The result is 11 minutely occurrences. See my code below (of course I set the license before calling this).

[Test]

public void TestScott()

{

string rule = "DTSTART;TZID=California-Los_Angeles:20060101T120000\nRRULE:FREQ=MINUTELY;INTERVAL=1";

RecurrencePattern pattern = new RecurrencePattern(rule);

DateCollection dates = pattern.GenerateOccurrences(

new DateTime(2006, 1, 1, 12, 0, 0),

new DateTime(2006, 1, 1, 12, 10, 0));

Assert.AreEqual(11, dates.Count);

}

There is no way to check if the component is licenses or not. Partly because of the security reasons, partly because I don't see there could be a need for this in an application.

Set the license at application startup. You don't have to pass full path into SetLicense, it should find the license if you put it into the same folder as your assembly. If SetLicense cannot apply a license for some reason, it will throw.

Making the app to run forever with this pattern - I was not able to reproduce. It could appear to run forever if you specify very large date range in GenerateOccurrences for minutely or secondly pattern because it will be trying to generate hundreds of thousands of occurrences.


#4

ok this rule actually only returns the start date of when you call it...to return the next date after the start date the rule is :

"DTSTART;TZID=California-Los_Angeles:20060101T120000RRULE:FREQ=MINUTELY;COUNT=2;INTERVAL=1"

and make sure you use

DateCollection dates = pattern.GenerateOccurrences();

dates[0] = start time

dates[1] = next occurence

wanted to clear that up for everyone

Scott


#5

Thanks...yeah your right...i followed the instructions indicated on the site and it looks like the license is getting set...it was a problem with my rule..

Thanks again

Scott