From jgrevich at gmail.com Fri Mar 12 16:01:42 2010 From: jgrevich at gmail.com (Justin James Grevich) Date: Fri, 12 Mar 2010 13:01:42 -0800 Subject: [iCalendar-devel] Writing calendar files to .ics with more than one event. Message-ID: <598F7FF6-BD70-47B2-8077-EFDCA736FBAA@gmail.com> Hi, I have a huge (2.2 MB) .ics file that I am trying to import into Google Calendar. Google suggests file sizes no greater than 1 MB. Unfortunately, it fails when I try to upload it in it's entirety or when I try to manually split it up into smaller chunks (6-800k). I have now looked into the iCalendar gem as a way to split up the .ics file into calendars by year (there are about 8000 events (8 years worth) ). Here is the code I used to create a .ics file for all 2010 events: http://pastie.org/867072. That fails with a "NoMethodError: Method Name: <=>"; here's the full backtrace: http://pastie.org/867074 I then modified my first script so that it will write each event as an individual .ics file thinking there was a corrupt event (aka. needle in the hay stack): http://pastie.org/867078 . Instead of finding the corrupt event, this worked just fine and produced a correct .ics for each event. BTW, Have we thought of adding methods to the gem for merging/splitting .ics files? That might be useful. After looking into the errors with the first script, I noticed it is caused whenever you try to do a .to_ical on a Calendar object with more than 1 event. Am I missing something here? Any help or suggestions will be greatly appreciated. Thanks, justin From norcalmtbracing at gmail.com Mon Mar 15 01:30:25 2010 From: norcalmtbracing at gmail.com (slashk) Date: Sun, 14 Mar 2010 22:30:25 -0700 Subject: [iCalendar-devel] icalender v1.1.2 causes error in to_ical with multiple events Message-ID: I upgraded my icalendar gem to version 1.1.2 this week (from v1.1.0) and I am now getting errors in my rails test (stable for over a year). Here is the error from my rails rake task: test_should_get_tag_calendar ERROR NoMethodError: Method Name: <=> icalendar (1.1.2) lib/icalendar/component.rb:419:in `method_missing' icalendar (1.1.2) lib/icalendar/component.rb:107:in `sort' icalendar (1.1.2) lib/icalendar/component.rb:107:in `to_ical' icalendar (1.1.2) lib/icalendar/component.rb:106:in `each' icalendar (1.1.2) lib/icalendar/component.rb:106:in `to_ical' icalendar (1.1.2) lib/icalendar/component.rb:122:in `print_component' icalendar (1.1.2) lib/icalendar/component.rb:104:in `to_ical' app/controllers/application_controller.rb:60:in `create_calendar' app/controllers/calendar_controller.rb:72:in `tags' app/controllers/calendar_controller.rb:70:in `tags' /test/functional/calendar_controller_test.rb:129:in `test_should_get_tag_calendar' The problem seems to have been introduced in github commit 29f8371b1cc8f057723bdafa11fecfe7210e1a82, where "sort" was added into the enumeration chain in line 107 of the component.rb file. I can reproduce this bug with this test in the icalendar source from github (git://github.com/sdague/icalendar.git) : def test_create_multiple_event_calendar # Create a fresh calendar cal = Calendar.new [1,2,3].each do |t| cal.event do self.dtend = "1997090#{t}T190000Z" self.summary = "This is summary #{t}" end end [1,2,3].each do |t| cal.todo do self.name = "test #{t} todo" end end cal.to_ical end You can also reproduce this bug by following the example in the README.rdoc file. I believe I am correctly using .to_ical here (at least that's how I been using it). when I add this test to test_calendar.rb, it results in: 1) Error: test_create_multiple_event_calendar(TestCalendar): NoMethodError: Method Name: <=> ./lib/icalendar/component.rb:423:in `method_missing' ./lib/icalendar/component.rb:111:in `sort' ./lib/icalendar/component.rb:111:in `to_ical' ./lib/icalendar/component.rb:110:in `each' ./lib/icalendar/component.rb:110:in `to_ical' ./lib/icalendar/component.rb:126:in `print_component' ./lib/icalendar/component.rb:108:in `to_ical' ./test/test_calendar.rb:43:in `test_create_multiple_event_calendar' My ruby-fu is weak, but I believe we need to add code to tell it to sort our component objects, something like: def <=>(other) self.properties['uid'] <=> other.properties['uid'] end in the Component class (maybe in lib/icalendar/component.rb ?). I'm not sure if uid actually applies to all components however. When I do try this, it fixes the multiple events but still errors on the multiple todos --- so maybe this is supposed to go somewhere else ? Any help ? P.S. I am using ruby 1.8.7 (2008-08-11 patchlevel 72) and the following gems: hoe (2.5.0, 2.3.3, 1.12.2) gemcutter (0.5.0, 0.4.1) rails (2.3.5, 2.3.4, 2.2.2, 2.1.2, 1.2.6) --- /k http://www.mtbcalendar.com http://norcalmtnbikeracing.blogspot.com norcalmtbracing at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at dague.net Mon Mar 15 08:41:03 2010 From: sean at dague.net (Sean Dague) Date: Mon, 15 Mar 2010 08:41:03 -0400 Subject: [iCalendar-devel] icalender v1.1.2 causes error in to_ical with multiple events In-Reply-To: References: Message-ID: <4B9E2ADF.3010700@dague.net> On 03/15/2010 01:30 AM, slashk wrote: > I upgraded my icalendar gem to version 1.1.2 this week (from v1.1.0) and > I am now getting errors in my rails test (stable for over a year). I was trying some things to get the tests to run correctly on multiple ruby verisons.... and I apparently failed pretty badly at it. Thanks for the new test, I just integrated and pushed a 1.1.3 which reverts the sorts. I'll look into your approach to do the sorts correctly later, because it would be nice to have items in the ical show up in a predictable order, instead of hash order, which is definitely different between 1.8.6 and 1.8.7. Please let me know if 1.1.3 works for you, -Sean -- __________________________________________________________________ Sean Dague Mid-Hudson Valley sean at dague dot net Linux Users Group http://dague.net http://mhvlug.org There is no silver bullet. Plus, werewolves make better neighbors than zombies, and they tend to keep the vampire population down. __________________________________________________________________ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 253 bytes Desc: OpenPGP digital signature URL: From norcalmtbracing at gmail.com Mon Mar 15 20:12:03 2010 From: norcalmtbracing at gmail.com (slashk) Date: Mon, 15 Mar 2010 17:12:03 -0700 Subject: [iCalendar-devel] icalender v1.1.2 causes error in to_ical with multiple events In-Reply-To: References: Message-ID: On Mar 15, 2010, at 5:49 AM, icalendar-devel-request at rubyforge.org wrote: > > Thanks for the new test, I just integrated and pushed a 1.1.3 which > reverts the sorts. Yep, v1.1.3 fixed it. Thanks From james at flocklocal.net Thu Mar 25 11:47:42 2010 From: james at flocklocal.net (James Baster) Date: Thu, 25 Mar 2010 15:47:42 +0000 Subject: [iCalendar-devel] Icalendar::UnknownPropertyMethod: Unknown property type: on Parsing a ical file Message-ID: <81fcdba51003250847k5e44acbcr81a582d6c561312c@mail.gmail.com> I downloaded the ics from http://www.thegreenerleithsocial.org/events/cleanup-the-cycle-path and tried to parse it in my rails app console: ?> cal_file = File.open("/tmp/Clean_up the Cycle Path-1.ics") => # >> cals = Icalendar.parse(cal_file) Icalendar::UnknownPropertyMethod: Unknown property type: website from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:183:in `parse_component' from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:132:in `parse_component' from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:102:in `parse' from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:17:in `parse' from (irb):15 This is with version 1.1.3. Any suggestions? Thanks very much, James From sean at dague.net Thu Mar 25 13:31:03 2010 From: sean at dague.net (Sean Dague) Date: Thu, 25 Mar 2010 13:31:03 -0400 Subject: [iCalendar-devel] Icalendar::UnknownPropertyMethod: Unknown property type: on Parsing a ical file In-Reply-To: <81fcdba51003250847k5e44acbcr81a582d6c561312c@mail.gmail.com> References: <81fcdba51003250847k5e44acbcr81a582d6c561312c@mail.gmail.com> Message-ID: <4BAB9DD7.3070107@dague.net> On 03/25/2010 11:47 AM, James Baster wrote: > I downloaded the ics from > http://www.thegreenerleithsocial.org/events/cleanup-the-cycle-path and > tried to parse it in my rails app console: > > ?> cal_file = File.open("/tmp/Clean_up the Cycle Path-1.ics") > => # >>> cals = Icalendar.parse(cal_file) > Icalendar::UnknownPropertyMethod: Unknown property type: website > from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:183:in > `parse_component' > from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:132:in > `parse_component' > from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:102:in `parse' > from ..../vendor/gems/icalendar-1.1.3/lib/icalendar/parser.rb:17:in `parse' > from (irb):15 > > This is with version 1.1.3. Any suggestions? When I run it through the ical validator, it's the same issue: http://severinghaus.org/projects/icv/?url=http%3A%2F%2Fwww.thegreenerleithsocial.org%2Fevents%2Fcleanup-the-cycle-path%2Fexport ical is very specific on what named properties you are allowed to have, and website isn't one of them. It needs to be X-WEBSITE or just stripped out of the content. -Sean -- __________________________________________________________________ Sean Dague Mid-Hudson Valley sean at dague dot net Linux Users Group http://dague.net http://mhvlug.org There is no silver bullet. Plus, werewolves make better neighbors than zombies, and they tend to keep the vampire population down. __________________________________________________________________ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 253 bytes Desc: OpenPGP digital signature URL: