Liquid 9

Django Developer Needed

Liquid 9 is looking for a senior developer who will become a critical member of our interactive team.

The developer position consists of two main responsibilities:

  • Build websites for clients using Django if possible?
  • Maintain client sites and our Linux servers

We use Django, Python, PHP (only when we have to), jQuery, and HTML5 to build our sites. We write clean, handcrafted semantic markup with a strong focus on usability.

Requirements

  • Django, Python, PHP, MySql, Git, Fabric, South, Facebook Graph API, Semantic HTML, JavaScript, Apache/Nginx, Linux Administration
  • Sample URL's or portfolio
  • 3+ years experience
  • Strong interest in current development trends
  • Organized, detail-oriented, able to multi-task
  • Able to work autonomously, without day-to-day project management guidance or deadline tracking
  • Must have an appreciation for design aesthetics and experience working with a design team.

A strong preference will be given to applicants open to filling the job in Kansas City, but Chicago will also be considered.

Send your resume to developer@liquid9.tv

Comments

Batch Geocoding Addresses Using Google Spreadsheets

After facing countless frustrations trying to find a way to geocode 300+ addresses to latitude and longitude coordinates for an upcoming project, I decided to investigate scripting Google Spreadsheets to handle the task.

The ImportData() solution that has been spread around is clever, but, unfortunately, Google limits spreadsheets to 50 or fewer ImportData() formulas per sheet. For situations where many more geocodes are needed, this won't work.

This is where I turned to Google Apps Script for the first time, and I've published a script in the script gallery called "Batch Geocode."

Here's how to use it.

First, open your Google Spreadsheet and select Tools -> Script Gallery. Search for "Batch Geocode," and click "Install."

After installation, you will need to close and re-open your spreadsheet. Upon re-opening, you will find a "Geocoder" menu added up top.

Prepare your data for geocoding. For my spreadsheet, I had to concatenate several fields first to get a valid location field.

uploads/blog/interactive/location_formula.jpg

After copying the formula down the spreadsheet, I had complete addresses ready for geocoding.

uploads/blog/interactive/filled_locations.jpg

Next, hightlight the addresses you want geocoded, and select "Geocode addresses" from the "Geocoder" menu.

uploads/blog/interactive/geocode_menu.jpg

You will be prompted for which columns you would like to overwrite with the latitude and longitude values, respectively. These should be two column letters, separated by a comma. If you would like to insert new columns for the data, leave this field blank. Press "OK."

uploads/blog/interactive/column_prompt.jpg

That's all there is to it. The script throttles the process to a maximum of 5 geocoding requests per second, to ease the burden on Google servers and avoid rate limits, so you may have to wait a bit.

uploads/blog/interactive/geocode_loading.jpg

However, you will be notified once the script has completed, and your latitude and longitude values will appear in the specified columns!

uploads/blog/interactive/geocode_complete.jpg

Until the script has been approved by Google for addition to the script gallery, the raw script can be downloaded here, and installed manually through your spreadsheet's script editor.

Comments

Obtaining a Permanent Facebook OAuth Access Token

In the same vein as my last post on obtaining a permanent Google session token, we also found a need for a permanent Facebook OAuth access token. In our case, we wanted to grab data from Facebook Insights for several pages on a scheduled cron without requiring the user to authenticate each time.

Here's how to pull it off.

First, create a new Facebook application if you haven't already, and construct the OAuth url. Determine which permissions your access token will need, and fill in the application ID. Ours looks like this:

https://graph.facebook.com/oauth/authorize?client_id=...&redirect_uri=http://liquid9.tv/&scope=read_insights,offline_access

There are two things to note about the above url. First, notice we specified redirect_uri as http://liquid9.tv/. The redirect_uri is the path to which the browser will be redirected after authentication. This can be almost anything, and we are only using it in our case so we can grab the code parameter from its querystring after redirection occurs. There is, however, one requirement for this path -- its domain must match the one specified in the "Site URL" and "Site Domain" values of your application's "Web Site" settings.

The second thing to note is the offline_access permission we appended to the scope. This is the key to a permanent Facebook access token. The offline_access permission removes the short expiration time from your access token and allows your application to make requests on behalf of the user at any time.

Copy the authentication url into your browser and authorize your application with Facebook. You will be redirected to a url that looks similar to this:

http://liquid9.tv/?code=...

The code parameter will be a very lengthy string of random characters. Copy this value and hang on to it for the construction of a new url. This url will turn the generated code into a valid access token for your application.

Fill in your application ID, application secret, redirect uri, and the code we just copied. Again, ours looks like this:

https://graph.facebook.com/oauth/access_token?client_id=...&client_secret=...&redirect_uri=http://liquid9.tv/&code=...

Open the url in your browser, and you should be presented a string with an access token parameter in it. The value after access_token= is the bit you will want to store for future requests, and it can be used indefinitely to authenticate your application with this user's session!

Once we have the token, how can it be used to make requests? In Python, we use Facebook's own python-sdk. Assuming we stored our access token in a setting called FB_ACCESS_TOKEN, we can use it in our application like so:

import facebook
from settings import FB_ACCESS_TOKEN

graph = facebook.GraphAPI(FB_ACCESS_TOKEN)
page = graph.get_object(...)
...

Read more about Facebook OAuth authentication here: http://developers.facebook.com/docs/authentication/

Comments