Posted on 2006-05-15 09:56:00
Tags: ruby palmtogooglecalendar politics
Man, I have a lot of things on my mind!
So Prop 6 passed here in Austin (allowing the city to give health benefits to same-sex couples). I gotta say, it feels really good to finally win on a gay issue here in Texas. Yay!
djedi and I went to his brother's graduation in College Station Saturday morning. It was nice, although the ceremony itself was fairly boring (naturally) and it was fairly chilly inside. We went out to lunch afterwards and we got to meet his girlfriend, who was nice. I also took a toooon of pictures that I need to sort through at some point. A&M wasn't too scary - they say "Howdy" a lot (I could get used to that!), and there was some whooping, but it's all good. wonderjess graduates next weekend, so I'll be flying up to sunny (and hopefully not too cold!) Rochester on Friday.
So, going into the weekend the backend was written mostly (I could update my google calendar by running a ruby script from the command line), so I needed to put a web interface on top of it. This was tricky for a number of reasons.
First of all, the way I have to do authentication with Google right now, I have to ask for the user's Google username and password. They're working on a different way to do this, but for now this is what's required, so I wanted to make sure the page was using HTTPS to collect that information. I set up a certificate (that I signed myself - not worth paying $50 or whatever it costs to have someone else sign it) and after a few hiccups, got things working.
Then I started thinking about how this was actually going to work. The problem is that deleting and adding the entries will take at least 30 seconds, and sometimes much more, so I wanted an asynchronous way to do it. I had read some stuff about Comet, which is a bleeding edge application model. Basically, the idea is that the client opens a long lived connection to the server, and because of this the server can push back data whenever it wants (which isn't possible under normal HTTP). This sounded perfect, because I could connect to the server when the user pressed "Upload", and the server could send back progress updates while it was working, and have the client close the connection when it was done.
So, great. There are some problems. One is that web servers that aren't aware of a Comet-like approach don't scale this approach very well - having lots of connections open for a long time. That's OK for me, I'm not worried about too many people using this thing all at once :-) The other problem is that apparently it's hard to get working correctly. It was hard to find easy to understand examples that actually use this approach, and the one that I did find and understand relied on having the server basically return a text stream that gets progressively updated. I could not for the life of me make this happen correctly - it would wait until the whole thing was done, then display the whole stream, which obviously wouldn't work. I looked around for some other way to do this, and found a Mozilla/Firefox-only solution which was no good. So finally I threw up my hands and gave up on Comet for now. Maybe I'll take another look at it in the future.
So, I decided that the request to upload would finish quickly and return a session ID, and the client could call a script to get the status of that session every few seconds, which would simulate the same effect. This required some way to share session data across ruby processes, and CGI::Session turned out to be perfect for me - it by default stores session data in a file, so I can just read that file when I receive a request to get status.
I was also baffled for a while that I was receiving the file correctly, and processing it with pilot-datebook, but the resulting file in longtxt format wasn't showing up. After butting heads with the problem for a while, I realized that I was using Tempfile to generate a temporary filename, but it was deleting the file as well, so that was an easy fix.
So most of the hard problems have been solved - I still need to do the processing and integrate that with status reports (and abstract that part out so I can still use the command-line version), and I need to handle errors better (at all :-) ), but I'm very happy with where things are right now.
Apparently having the NSA intercept domestic phone calls was Dick Cheney's idea, and NSA lawyers were against it.
51% of people disapprove of the domestic spying.
Comment from djedi:
I wanted to post a comment I read from someone else in another blog on the issue of polls on domestic spying:
"The whole point of having civil liberties is that they are not supposed to
be subject to a majority veto. Hobbes may not have believed in natural
rights, but our founders did. And their opponents, the anti-Federalists,
were even more zealous about restraining the powers of the federal
superstate, which is why they forced the Federalists to write the Bill of
Rights directly into the Constitution.
It defeats the purpose of having a 4th Amendment if its validity is entirely dependent on breaking 50% in the latest poll. It would be nice to have "the people" on our side in this debate, and obviously a lot of them are, even if Doherty's plurality still prefers Leviathan's crushing embrace. But some things are wrong just because they're wrong -- not because a temporary majority (or even a permanent one) thinks they're wrong...
What the government is doing is illegal and unamerican, and that would still be true if the polls showed 99% support..."
Comment from fairydust1:
I am in awe of your coding ability! I think it's great that you are tackling the Palm/GCalendar issue. I am your biggest fan of the project, I think. *grin*
*hug* have a great day!
Comment from wonderjess:
hey! unfortunately, rochester will probably not be sunny. hopefully it will not rain. however, we have both a "bad weather plan" and a "vile weather plan," and if it rains but not hails/lightning/dangerous, there will probably be free ponchos. :)
also, weather/packing wise, you'll want pants. short sleeve shirts are probably fine for during the day (low sixties mostly), but bring a sweater because the rain makes it cool down to the 50s/40s.
can't wait to see you! I got you a present today. hehe.
Comment from gregstoll:
Heh, neat! Can't wait to see you too!
This backup was done by LJBackup.