Online Book Reader

Home Category

Facebook Cookbook - Jay Goldman [41]

By Root 612 0
and set it as your memcached key:

perl_set $md5_uri '

sub {

use Digest::MD5 qw(md5 md5_hex md5_base64);

my $r = shift;

return md5_hex($r->uri);

}

';

server {

location / {

set $memcached_key $md5_uri;

...

}

}

If the cached item is not found in memcached, the request is passed on to your application server, which in turn should construct a response and send it to memcached so that Nginx can serve future requests directly.

It is a good practice to set a Time to Live (TTL) on the memcached record to avoid additional cache invalidations. Once the TTL timestamp expires, memcached will automatically return a 404 error, and the application server can repeat the pattern.

Standing on the Shoulders of Giants: Hosting with Amazon Web Services


Problem


I think my application could be a Top 10 app, so I want to make sure it has really solid hosting behind it that isn’t going to ruin my profitability.

Solution


If I told you that you could hire the engineers who built and run one of the top 20 websites in the world to provide your hosting, all at pennies per GB, would you say I was crazy or would you say, “Oh! You must mean Amazon Web Services, you clever (and handsome) man”? If you said the latter, then you probably don’t need me to tell you to build your stuff on their stuff and save yourself a lot of the green stuff (and from pulling out or graying a lot of the stuff on top of your head). Go there now: http://www.amazonaws.com.

Discussion


There are two whole recipes about getting set up on S3 and EC2 in and .Chapter 5: see Recipes

Integrating Drupal and Facebook


—James Walker (see his bio in Contributors)

Problem


I have an existing site built with Drupal (http://drupal.org/) and I’d like to create an associated Facebook application quickly and easily. It’s important to be able to reuse the existing content and user base for the new application.

Solution


Drupal for Facebook (http://drupal.org/project/fb) is an existing Drupal module with an associated FBML theme that can quickly and easily create one or more Facebook applications for an existing site.

Discussion


To begin, create your application on Facebook as you normally would, but leave the callback URL blank for now.

Next, download the Drupal for Facebook module from http://drupal.org/project/fb and install it per the included README.txt. The instructions here include downloading a copy of the Facebook PHP library and installing the associated FBML theme.

Once those steps are complete, it is time to enable some modules. The Facebook for Drupal package comes with several modules so that you can enable only the modules your application requires. A good starter set is “Facebook API,” “Facebook Application,” “Facebook Application Canvas Pages,” and “Facebook User Management.” Note, however, that there are modules for integrating things like the popular Views and Actions modules for Drupal.

Now we’re ready to create applications. Go to Create content→Facebook Application, and fill out the form with information about the application you already created, such as the API Key, secret, and the app ID. You can also specify controls around user account handling and landing pages for users.

When that form is submitted, Drupal will generate a full callback URL that you can then use in the application settings on Facebook. Drupal will also generate Post-Add and Post-Remove URLs as well.

Congratulations! Your Drupal site is now a Facebook application.

For more information and hints on additional features and configuration, see http://drupalforfacebook.org/ and the screencasts available at http://www.dave-cohen.com/node/2246.

App Design Process


Problem


I’m new to the whole idea of designing applications. What process should I follow?

Solution


Ever get that feeling like you’re standing on the edge of a massive cliff and way down below you stretches an infinite plane upon which you can see large and very violent armies massing? Maybe it’s just me. I tend to get that feeling whenever I’m overlooking what amounts

Return Main Page Previous Page Next Page

®Online Book Reader