I'm working on a Backpack bundle and I've hit a stumbling block. I can't get a date object into a plist. I need to read it into a nib to set the date on a datepicker to the current date and time, but I can't get any of the functions in the plist library to recognize it. Any idea what I'm doing wrong? I'd post code, but I've tried so many things it's hard to begin to describe it... I could just be slow.
Thanks, Brett
On Nov 15, 2006, at 6:05 PM, Brett Terpstra wrote:
I'm working on a Backpack bundle and I've hit a stumbling block. I can't get a date object into a plist. I need to read it into a nib to set the date on a datepicker to the current date and time, but I can't get any of the functions in the plist library to recognize it. Any idea what I'm doing wrong? I'd post code, but I've tried so many things it's hard to begin to describe it... I could just be slow.
Have a look at the GTDAlt bundle's date picker (The command is called Set Date if I recall correctly).
Thanks, Brett
Haris
So, if 185328000 is a cocoa representation of the current date, how do I get the time added in there? I honestly tried to figure this out and am stuck again...
I kind of understand this part:
def to_cocoa_date(date) ((date - Date.new(2001, 1, 1)+1)* 3600 * 24).to_i end
date = Date.today
But I don't know what formula to run on Time.now to get the same result.
Thanks, Brett
On Nov 15, 2006, at 5:38 PM, Charilaos Skiadas wrote:
On Nov 15, 2006, at 6:05 PM, Brett Terpstra wrote:
I'm working on a Backpack bundle and I've hit a stumbling block. I can't get a date object into a plist. I need to read it into a nib to set the date on a datepicker to the current date and time, but I can't get any of the functions in the plist library to recognize it. Any idea what I'm doing wrong? I'd post code, but I've tried so many things it's hard to begin to describe it... I could just be slow.
Have a look at the GTDAlt bundle's date picker (The command is called Set Date if I recall correctly).
Thanks, Brett
Haris
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
On Nov 15, 2006, at 8:21 PM, Brett Terpstra wrote:
So, if 185328000 is a cocoa representation of the current date, how do I get the time added in there? I honestly tried to figure this out and am stuck again...
Well, Cocoa naturally has the time there as well. It seems the value it expects is the number of seconds since January 1st, 2001, GMT. The surprising thing is that it instead returns a string representation of the date. Perhaps there is a way to get that answer is seconds as well, but I haven't been able to, hence all the weird regexps that follow.
I kind of understand this part:
def to_cocoa_date(date) ((date - Date.new(2001, 1, 1)+1)* 3600 * 24).to_i end
date = Date.today
But I don't know what formula to run on Time.now to get the same result.
Probably this should do it:
Time.new-Time.gm(2001, 1, 1, 0, 0, 0)
might need a bit of experimenting.
Haris
On Nov 15, 2006, at 8:21 PM, Charilaos Skiadas wrote:
Time.new-Time.gm(2001, 1, 1, 0, 0, 0)
Thanks, that should help. I'll let you know how it goes ;-).
I've got an interface working that lets you add, destroy and list reminders on your backpack[1] page using text mode or tm_dialog commands. I have a bastard version using the chronic ruby gem that's kind of fun (let's you enter date/time in human form) but probably not great for distribution. If anyone sees any potential for integrating Backpack into GTD(x) in any way, let me know, I've got the wrappers and libraries collected.
Brett
BTW, the reason I use Backpack is that I can have my reminders ring my phone with a text message, and my calendar events do the same with 30 minutes warning. I can also access all of my to-do's from the web on all of my machines. I've been meaning to explore GTD, but this is what I use for now. If there's already this kind of functionality in existing packages, then please forgive my ignorance.