Facebook callback urls with Rails

Fellow Three Screen Games (the company that created FanGamb) co-founder, Robert Shedd, wrote a tutorial detailing how to safely update a database using the Facebook platform’s callback urls in a Rails app.

From ActiveRecord to Raw SQL

ActiveRecord is awesome. Its dynamic finder methods, scopes, and effortless joins make working with a database a snap. But there are always those times when writing raw sql makes more sense. In my case, I was joining across several tables, and then sorting by a value from the joined table. The problem was that my views were written to handle an ActiveRecord object, not a simple hash, which is what a find_by_sql query returns.

Before:

#controller:
@posts = Post.find(:all)
 
#view:
< % @posts.each do |post| %>
   < %= post.title %>
   < %= post.body %>
   < %= post.author %>
   < %= post.date %>
< % end %>

After:
Continue Reading »

Cron Jobs on Google App Engine

As a side project, I’ve been working on a mobile site to track my local bus system. I’ll have a more detailed post about that once it is a fully polished site. Essentially, the site parses some xml with longitude/latitude data and uses a maps api to display the location. All fairly simple, and it’s built on Google App Engine, which means it will be free/cheap to maintain.

I always wanted the app to be able to continually check the xml feeds, which are updated every minute, so I could store the data persistently and then use memcache to handle large spikes in traffic (hopefully my site will have this good problem). In order to do this, I needed to set up a cron job. Well I was in luck as Google recently added support for cron jobs, a feature not previously built in to App Engine. 

Continue Reading »

Social search is Twitter’s next killer app? It’s already Aardvark’s killer app

A fun game has been sweeping the Internets. No, it doesn’t involve answering 25 questions on Facebook. It is speculation about Twitter’s future as a profitable business. Advertising Age recently published an article with (well-sourced) speculation of their own:

Certainly there’s an AdWords-like business there, but, as [Todd] Chaffee [an Institutional Venture Partners general partner and a new Twitter backer] told us, Twitter has another “wild card.”

In the future, searches won’t only query what’s being said at the moment, but will go out to the Twitter audience in the form of a question, like a faster and less-filtered Yahoo Answers or Wiki Answers. Users would be able to tap the collective knowledge of the 6 million or so members of the Twitterverse.

“You put a question out to the global mind, and it comes back,” Mr. Chaffee explained. “Millions of people are contributing to the knowledge base. The engine is alive. You get feedback in real time from people, not just documents.”

This is essentially what Aardvark does. And a really good job of it, I might add. Around the same time that Twitter’s biggest goal was to stop crashing, the Aardvark team received $6 million in investment to refine social search. Right now, Aardvark routes its questions and answers between several channels: Google Chat, AIM, Windows Live Messenger, as well as good old e-mail. I posed this question to “assistant curator of birds” of Aardvark, Rob Spiro:

adelevie: @robsp can Vark work through Twitter the same way it works through GChat and e-mail?

His reply:

robsp: @adelevie yup, we’re definitely planning an aardvark-twitter integration, using Twitter as another communication channel… coming soon…

Would their two services compete? Could Twitter acquire Aardvark? We’ll just have to wait and see.

Aardvark has recently been ramping up activity, changing the name of their company from Mechanical Zoo to Aardvark, preparing to offer unlimited friend invites to current users, and launching a blog.

Better project template for Google App Engine

I’ve been playing around with Google App Engine quite a bit lately. Whenever I’d create a new project, I’d start by copying and pasting a folder called “new_project_template” which is included in the software developers kit. The template contains a bare-minimum hello world script. As I made more and more apps, I realized that I always added the same things to this folder before writing the actual “guts” of the code.

I always had to fix the indents, add some basic import statements, and include my favorite web scraping library, Beautiful Soup. So I created a template of my own and named it “better_project_template” (creative? I know). The folder has the Beautiful Soup module, base.html and index.html templates, as well as some useful shortcuts added to the main.py file. Anyone interested can download this folder here for their own use.

No one will know you’re using bit.ly

I’ve been a big fan of Bit.ly. The added utility it provides to link shortening is unmatched. It makes tinyurl.com look like the url shortener of simpletons. Using Bit.ly conveys that you are tech-savvy to a certain degree. But what if you want the benefits of Bit.ly, without looking pretentious? Use biturlly. It’s a simple tool I developed last week that takes a long url, shortens it through Bit.ly, then shortens the Bit.ly link through tinyurl. You’ll get the click tracking of Bit.ly with the humility of tinyurl.