Tech, Ramblings, and Intellectual Detritus

 

Is Google Bringing Orkut Back?

My old friend Orkut sent me an email yesterday, the first in a long time . . .

Loading mentions Retweet

Comments [0]

Use rails date_select without an activerecord model

I actually googled this and found a workable but ugly solution:

 
 ## view code
<%= date_select('range', 'start_date', :order => [:month, :day, :year])%>


## controller code
@start_date = Date.civil(params[:range][:"start_date(1i)"].to_i,params[:range][:"start_date(2i)"].to_i,params[:range][:"start_date(3i)"].to_i) 

I needed to include the hour and minute as well, and didn't want to cram more arguments into the Date.civil call (actually Time.zone.local), so I cleaned up the code a bit.

Hoping to leave the internet a little better for the next guy, I thought I'd post the code.

 
 ## view code
<%= datetime_select('range_start', 'date', :order => [:month, :day, :year, :hour,:minute]) %>


# controller code
@start_date = Time.zone.local(*params[:range_start].sort.map(&:last).map(&:to_i)) 

Loading mentions Retweet
Filed under  //   date   datetime_select   date_select   rails   ruby   select   time  

Comments [0]

Feynman on Knowing vs. Knowing the Name

Loading mentions Retweet

Comments [0]

How I Roll

credit:  http://bigeyedeer.wordpress.com/2008/07/15/this-cartoon-wrote-a-sweary-word-o...

Loading mentions Retweet

Comments [0]

Crappy TV Rant: Happy Town

I thought Happy Town had a decent chance of being entertaining

  "Executive producer Josh Appelbaum and others on the show are huge fans of the Twin Peaks"

  "Executive producer Scott Rosenberg says he's more a Stephen King fan."

  "So if you think it's too much like Twin Peaks, blame them. If you think it's not enough like Twin Peaks, blame me."

I love David Lynch films - Blue Velvet, Lost Highway, Mulholland Drive, and of course, Twin Peaks, are all surrealist classics.  He is a true artist in the film world, where you come away from his movies not with a literal understanding of the story, but with a visceral sense of being disturbed and intrigued.  His short films are not to be missed if you're a fan.
I also enjoy Stephen King stories.   I say stories because it's typically not the production that wins me over - the novels are uniformly better than the movies - The Shining, Misery, Christine, Kujo, - all great books and very decent movies.  His knack for writing terrifying stories that get at our deepest fears elevate him above other writers of the genre.

So with my expectations possibly set too high, Happy Town was fully disappointing - formulaic writing, overly produced, and all-around cheesy.  I want to know who to blame if it's too much like CSI.  It's unlikely I'll be back for a second episode, 20 minutes was more than enough.

 

Loading mentions Retweet
Filed under  //   David Lynch   Happy Town   Stephen King   TV   

Comments [0]

Facebook Connect Fail

Flash? Really? Funny given that Pandora was featured in the f8 keynote.

Loading mentions Retweet

Comments [0]

(not) Powered by Scala

Loading mentions Retweet

Comments [1]

The New Dashboard for Facebook Platform

Facebook has decided to do away with notifications - the little messages notifying you of things friends did on platform applications, or giving you updates on applications you have installed:

While some of these messages are more nuisance than value, users have the ability to block notifications from specific applications, and many applications depend on these notifications to enable continuity of user experience (chess is a good example - knowing when to play).

The Dashboard

Facebook decided that these notifications were too intrusive, or something like that, so they decided to replace them with something called the "Dashboard":   
The dashboard functions as a place to see notifications, grouped by application and limited to the most recent three displayed in the summary.  
This is fine.  Hell, it could even be considered an improvement.  

Getting Alpha and Beta Confused

But the problem is that Facebook nuked notifications while the Dashboard feature was still in alpha.  On launch day for the new feature, the Dashboard wasn't operational for many applications.  It was irresponsible of Facebook to annihilate notifications with the replacement feature in alpha, especially given that many applications critically depend on light-touch messaging in providing a decent user experience.

XML isn't Supposed to be Pretty, but WTF?

I'll sign off with a little sample of what's coming out of Facebook these days, an XML response to a Dashboard API call.  

Finding the data in the response is like playing "where's waldo?" with XML  (hint:   "Message Content", "http://url.net", "Text Content", "TimeStamp", "MessageID"). 

I also like how Facebook devs use "elt" repetitions to indicate nesting depth, I can just hear the conversation now:
    "did you mean the  response_elt or the response_elt_elt?"
     . . . "dammit, I said the response_elt_elt_elt"
<Dashboard_getNews_response list="true">
    <Dashboard_getNews_response_elt key="312266072840" list="true">
        <Dashboard_getNews_response_elt_elt key="image" />
        <Dashboard_getNews_response_elt_elt key="news" list="true">
            <Dashboard_getNews_response_elt_elt_elt list="true">
                <Dashboard_getNews_response_elt_elt_elt_elt key="message">
                      Message Content
                </Dashboard_getNews_response_elt_elt_elt_elt>
                <Dashboard_getNews_response_elt_elt_elt_elt key="action_link" list="true">
                    <Dashboard_getNews_response_elt_elt_elt_elt_elt key="href">
                        http://url.net
                    </Dashboard_getNews_response_elt_elt_elt_elt_elt>
                    <Dashboard_getNews_response_elt_elt_elt_elt_elt key="text">
                         Text Content goes here
                    </Dashboard_getNews_response_elt_elt_elt_elt_elt>
                </Dashboard_getNews_response_elt_elt_elt_elt>
            </Dashboard_getNews_response_elt_elt_elt>
        </Dashboard_getNews_response_elt_elt>
        <Dashboard_getNews_response_elt_elt key="time">
              TimeStamp
        </Dashboard_getNews_response_elt_elt>
        <Dashboard_getNews_response_elt_elt key="fbid">
              MessageID
        </Dashboard_getNews_response_elt_elt>
    </Dashboard_getNews_response_elt>
</Dashboard_getNews_response>

Loading mentions Retweet
Filed under  //   Dashboard API   Facebook   Facebook Platform  

Comments [0]

My Brief Stint as a Groupon User

learning again that you get what you pay for

Groupon

For those that are unfamiliar, Groupon is a collective buying site, similar to Woot and BuyWithMe.  Borrowing from the Wikipedia entry:

The Groupon works as an assurance contract using ThePoint's platform: if a certain number of people sign up for the offer, then the deal becomes available to all;  if the predetermined minimum is not met, no one gets the deal that day. This reduces risk for retailers, who can treat the coupons as quantity discounts as well as sales tools. Groupon makes money by getting a cut of the deal from the retailers

Sounds great, right?  Retailers build sales by offering a one-time discount, contingent on quanitty, and consumers get a good deal on some product or service, with Groupon taking a little cut.

Well, as with anything with even trivial complexity, the devil is in the details. 

My Experience

I was overdue for a dental exam, and my insurance doesn't exactly have stellar dental coverage, and i happened to be checking out Groupon when the deal of the day was for $60 exam/cleaning/xrays at a San Francisco dental office.   

Great! Right?

I bought into the deal, and actually waited about a month before booking my appointment.  Well, before trying to book my appointment.  When I called the office, I was greated not by the receptionist, but by this pre-recorded message:

The following information applies only to our Groupon.com patients that have not yet scheduled with us but who have already called or emailed our office.  We are currently repsonding to Groupon.com user calls and emails in the order in which they were received.  If you have already called or emailed to schedule your Groupon.com appointment, we ask that you be patient and please not call or email us again.

That's when I decided to run the numbers, something I probably should have done beforehand:

  • 585 Groupons issued 
  • 10 new patients/week (estimate)
  • 58 weeks before I get an appointment

Now I feel like an idiot, and simultaneously realize the brilliance of the Groupon model - they can make interest on the float of non-cashed groupons, which is huge for services that can't be consumed instantaneously.

I have to mention that a simple email to groupon and my money was quickly refunded, so I have no beef with Groupon.  The experience made me wonder though: how many vendors would be prepared for the massive Groupon demand spike?

A Quick Look at Some Recent Deals

Here are some of the recent vendors/deals and quantities issued for Groupon:

  • Indian Restaurant Discount - 2549
  • Admission to a Party - 1650
  • Food Festival Entrance - 216
  • Spa Session - 1734
  • Asian Restaurant Discount - 2111
  • Salon Haircut - 833
  • Massage - 998

Here are some of the discussions centered around the deals:

I’ve been trying to book an appointment online and it just says “No available times were found” for every date in January and February… Is that just because they are overwhelmed by the number of Groupons purchased?

They made me feel like it was my fault that they had too many people buy this (1700 people) so they just can’t handle the capacity, so they haven’t been able to get back to everyone.

I just called and found their phone number was disconnected, too.

Not all the comments were negative -- for goods/services that are typically provided in high volume, people seemed extremely happy with their Groupon experience.  For the time-intensive services, the user response was a bit more spotty. 

Concluding Notes

Again, my experience wasn't great, but getting a refund was no problem whatsoever.  It may take a little time for consumers and vendors to flesh out the best way to manage their respective Groupon experiences, but there seems to be a real benefit from getting consumers excited about buying together on the day's deal.  So I expect Groupon to be around for a while, continuing to incite mania-induced group purchasing of local goods and services. 

As a side note, am I the only person who wonders why a "Collective Action Engine" is necessary to drive the Groupon site?  It sounds a lot like business-speak for one line of code saying "don't issue deal until N customers have bought.  Maybe I'm missing something.

Loading mentions Retweet
Filed under  //   group-buy   groupon   startups   woot  

Comments [0]

Rails: Growing Pains With ActiveRecord

Rails, does it scale? 

That horse has been beaten to death, and there is ample evidence that it does scale with a little elbow grease where necessary.  

It's also commonly known that many of the rails convenience methods aren't terribly good at making complex queries.

What I've just realized, is that some of the seemingly simple operations are implemented with horrible efficiency (the current tech-lingo would be "non-performant" which makes me puke a little into my mouth when I write it). 

Today I found two big performance problems:

HABTM relation creation

Take the following:

You would expect that code to do a single insert for all the join entries.  In reality you get something like this, repeated for each bar:

bars_foos Columns (1.1ms) SHOW FIELDS FROM bars_foos SQL (0.6ms) INSERT INTO bars_foos (bar_id, foo_id) VALUES (100, 117200)

I hand coded sql to do the same thing, and found a 7x speedup:

 

HABTM relation deletion

This one should be a layup:

@foo.bars = []

but I was shocked to see this in my sql log:

 

I hand coded the trivial sql and got a 10x speedup:

 

In Conclusion

These aren't difficult or complex operations, and they're extremely common.

I looked into ar-extensions, but there doesn't seem to be any support for HABTM relation creation.

I guess for now these queries should be hand-coded once tables get to a certain size, but I'm still in minor disbelief.  Anyone with a better "Rails Way" to do this, please clue me in.

Loading mentions Retweet
Filed under  //   activerecord   habtm   rails   ruby-on-rails  

Comments [2]