I got out of the car, and then helped her out. I was a bit nervous as we walked towards the restaurant, arm in arm. She reached her arm around me, edging her hand close to my inner left breast pocket. Uh oh! I stiffened my arm and blocked a potential revelation on her part. Safe for now (so I thought, anyway).
We walked into the restaurant and took a booth. It was New Year's Day, and not really that full. I had wanted a more significant location, but my first choice place was closed that day... drat! After some idle chat and ordering our meal, I figured it was now or never... or at least now or some other day. I wanted to do it now, so I took out my phone.
"I found this really cool Will and Grace app!" Her Christmas present was the Will and Grace box set. She was a big fan, so I figured a Will and Grace app would be interesting to her.
"Check it out, it's pretty cool. Click through that splash screen." I reached down into my inner coat pocket and grabbed the box. I opened it and waited.
She clicked through, selected a season and episode. She hit the item to play the episode, and after a brief pause, "Can't Take My Eyes Off You" from the Jersey Boys musical started playing. That's our special song, so I figured it was a good pick. I pulled up the box and held it out as she looked at a graphic with a couple hearts with the words "Will you marry me?"
Each moment that passed after that was stretched out like an eternity. She finally looked up and simply said "yes." That's it! I'm now engaged. She's the most wonderful woman in the world, and now I get to share my life with her.
Now that you know how it went down, let me tell you what went wrong. I settled on the day a few weeks before, while I was at my parent's house for Christmas vacation. I realized my Android phone would be the perfect way for me to pop the question... I could write a customized little app just for her! Google images proved useful for the "Will you marry me" graphic. It was a snap to rip our song from my CD musical recording. The hardest part was gathering all the content for all the Will and Grace episodes. Episode names was all I needed, but I had to take them from IMDB and convert them into Java strings. It was time consuming, but once all the content was set up, the Java app itself was a snap.
I guess that was what went well. The blunders came closer to the day. First came when I was asking her for dinner on the first. "Let's have dinner New Year's Day to ring in the new year!" Whoops. Very bad choice of words, especially since we picked the ring together... she knew it was coming, just not when. Why the hell did I say THAT??? She was of course suspicious, but I assured her it was just for dinner... I totally hadn't meant to give her a hint so early, but what's done is done.
We decided on the perfect place for dinner. Our 6 month anniversary had been at a nice fondu place. Perfect! I called them up, hoping to make a reservation, but alas! They are closed on the first! I expressed my disappointment to her... perhaps too emphatically. We agreed on another place. Not ideal, but I was determined to do this on the first.
New Year's Eve was at her parent's place. It was a lot of fun, and we were all packed to head over to Sacramento, which was our destination. I spilled some drink or something on my pants and all I had to spare was my nice clothes prepared for dinner. She suggested I change, and when she saw I only had nice clothes, she looked at me odd "we are dressing up for dinner?" I gave an excuse that it was New Year's... while wishing I had planned this a little better. All my effort went into the program to propose, why hadn't I worked out these details a little better? I'm not exactly good at thinking ahead and planning things well. If I could do it all over again, you can bet I would figure it out a lot better, but in the end it's the marriage that excites me more than the proposal.
With all those hints, she knew it was coming. In fact, she confessed she was reaching around while we were walking in because she wanted to test my inner pocket for the box. Sneaky! She saw me fiddling under the table when I passed her the phone, and thought "this is it." Thankfully, my application fooled her enough to second guess her inclination, so I salvaged a bit of a surprise.
I'm almost embarrassed to post to the world how unromantic my proposal was, but I think all the blunders made it memorable in it's own right... and it's very much me. I focused on the part I liked most, the programming, and assumed the rest would just go smoothly... because... you know, I had wrote a PROGRAM to PROPOSE! ON MY PHONE! I'm now just excited to become a part of her wonderful family, and know that I can spend the rest of my life trying to make her as happy as she makes me.
Saturday, October 31, 2009
Wednesday, October 21, 2009
Quick Lesson from DevDays
Ok, so I went to Stack Overflow DevDays in San Francisco this last Monday, and it was a lot of fun. I went with a friend from work, and we both walked away happy, stickers in hand.
I took some notes, and I would like to share what I thought of all the speakers and their presentations, but we'll save that for another day... if I actually end up writing it (post a comment if you are interested, and hopefully that will push me to write it up).
What I want to talk about is a small bit I learned from one of the presenters. If you don't know me, I'm a big Linux fan, I heart Google, I have an Android G1, I love open source and Ruby and Rails, and Microsoft is practically the devil. Given that, you might find it interesting that the thing that struck me most... enough to actually write about it... came from Microsoft. That's right, it came from the near-devil. Well, it came from Scott Hanselman, who was a pretty good speaker.
Scott talked about Microsoft .NET MVC. It seems like a relatively cool product, if you can bear to be in the Microsoft world, and if you can bear to deal with such a clunky language as C#. Ok, I gotta give props that C# is a decent language... for a statically typed language... but the platform restrictions (excluding Mono), and it not being nearly as awesome as Ruby, will keep me from ever dealing with it again (I worked in C# professionally for a few years). Yes, .NET provides access to a fleet of languages, but C# is still their flagship. Anyway, from the discussion, MVC seems like it does a decent job at mimicking Rails, though it still didn't seem nearly as elegant.
That was a long lead-up for a simple point I extracted from the Big M... <%: value %>. That's it. I have wished the default of scriptlets was to sanitize html output for a long time, and I'm pretty sure Jeff Atwood had a post on it at one point. That tag, if I understood Scott right, differs from <%= value %> in that it will sanitize the output automatically.
On the train ride back to the south bay, I set it upon myself to implement this auto sanitization in Rails for my current side project. Initially I thought I could do something like:
But alas, that doesn't work. Ruby won't let you define ":" as a method... it throws a syntax error... drat!
So, I figured, maybe I could monkeypatch the ERB handling so that <%: value %> works as I want, so I looked around the Rails source for how ERB compiles the views. It didn't take long to find erb.rb, which deals with the compilation. I inspected it for a bit, and toyed with some ways to deal with the problem, and ultimately came up with:
If the above code is cryptic for you, it basically overrides the initialize method (which is the constructor method for all you non-Rubyists) and uses a regex to replace all of the new sanitizing scriptlets with what would actually work to sanitize it. So, <%: value %> gets transformed to <%= h( value ) %>. I can't vouch for the performance (because I haven't done any performance testing), but it works.
Put the above snippet wherever you put your monkeypatches that you want run once. I have mine in a monkeypatches.rb file set to load after Rails has initialized (so it runs just once, at startup time).
Go forth in sanitized goodness.
I took some notes, and I would like to share what I thought of all the speakers and their presentations, but we'll save that for another day... if I actually end up writing it (post a comment if you are interested, and hopefully that will push me to write it up).
What I want to talk about is a small bit I learned from one of the presenters. If you don't know me, I'm a big Linux fan, I heart Google, I have an Android G1, I love open source and Ruby and Rails, and Microsoft is practically the devil. Given that, you might find it interesting that the thing that struck me most... enough to actually write about it... came from Microsoft. That's right, it came from the near-devil. Well, it came from Scott Hanselman, who was a pretty good speaker.
Scott talked about Microsoft .NET MVC. It seems like a relatively cool product, if you can bear to be in the Microsoft world, and if you can bear to deal with such a clunky language as C#. Ok, I gotta give props that C# is a decent language... for a statically typed language... but the platform restrictions (excluding Mono), and it not being nearly as awesome as Ruby, will keep me from ever dealing with it again (I worked in C# professionally for a few years). Yes, .NET provides access to a fleet of languages, but C# is still their flagship. Anyway, from the discussion, MVC seems like it does a decent job at mimicking Rails, though it still didn't seem nearly as elegant.
That was a long lead-up for a simple point I extracted from the Big M... <%: value %>. That's it. I have wished the default of scriptlets was to sanitize html output for a long time, and I'm pretty sure Jeff Atwood had a post on it at one point. That tag, if I understood Scott right, differs from <%= value %> in that it will sanitize the output automatically.
On the train ride back to the south bay, I set it upon myself to implement this auto sanitization in Rails for my current side project. Initially I thought I could do something like:
def :(arg)
h arg
end
But alas, that doesn't work. Ruby won't let you define ":" as a method... it throws a syntax error... drat!
So, I figured, maybe I could monkeypatch the ERB handling so that <%: value %> works as I want, so I looked around the Rails source for how ERB compiles the views. It didn't take long to find erb.rb, which deals with the compilation. I inspected it for a bit, and toyed with some ways to deal with the problem, and ultimately came up with:
class ERB::Compiler::Scanner
alias_method :initialize_without_sanitize, :initialize
def initialize_with_sanitize(src, trim_mode, percent)
initialize_without_sanitize src, trim_mode, percent
@src.gsub! /<%:(.*?)%>/, "<%= h(\\1) %>"
end
alias_method :initialize, :initialize_with_sanitize
end
If the above code is cryptic for you, it basically overrides the initialize method (which is the constructor method for all you non-Rubyists) and uses a regex to replace all of the new sanitizing scriptlets with what would actually work to sanitize it. So, <%: value %> gets transformed to <%= h( value ) %>. I can't vouch for the performance (because I haven't done any performance testing), but it works.
Put the above snippet wherever you put your monkeypatches that you want run once. I have mine in a monkeypatches.rb file set to load after Rails has initialized (so it runs just once, at startup time).
Go forth in sanitized goodness.
Subscribe to:
Posts (Atom)