I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...
I just saw the presentation of Mr. Eric Florenzano at Pycon 2010, and he talks about a side project he did on facebook using django.
ReplyDeleteFrom PYCON 2010:
If you've been using Django for any
amount of time, you've probably
learned some pretty standard practices
on how to use it. This talk aims to
shatter those conceptions and teach
you alternative ways that you could
use Django.
These alternate ways
come broadly in two varieties: Using
parts of Django outside of it, and
choosing alternatives to what Django
offers. If you haven't done either of
these things before, it may seem
tricky or difficult. In fact, it may
not be.
This talk will walk you
through the process and talk about
what to expect if your project just
doesn't seem to "fit the mold".
I recommend you check out his blog and the presentation.
Blog: http://www.eflorenzano.com/
Presentation: http://blip.tv/file/3261337
More Resources:
How to build a Facebook app in Django
Example Facebook application in Django
Two-Faced Django Part 1: Building a
project that exists simultaniously
on Facebook and the web
Two-Faced Django Part 2: Models and Django Testing
Two-Faced Django Part 3: Newforms
Two-Faced Django Part 4: The Webapp
Python Sdk is rather badly maintained.
ReplyDeleteThink you best option is Django Facebook:
https://github.com/tschellenbach/Django-facebook
Basic tutorial
http://www.mellowmorning.com/2011/06/23/django-facebook-2-0-integrating-facebook/
Info:
ReplyDeletehere, here and here + pyFacebook.
If you just want to get started, check out Fandjango on github. Its a simple middleware layer that adds a facebook_user attribute to the request object when the user is logged in, and sets it to None when they are not logged in. It also has an easy way to call the Graph API with the users' credentials.
ReplyDeleteNote: It only works on Facebook Apps. Websites using facebook connect use a slightly different protocol.
Also note: Any library that references 'pyfacebook' is using the old FB API and you should avoid that. The new one that uses the Graph API is python-sdk. You shouldn't use python-sdk either since its deprecated - thanks @pydanny. I haven't researched it, but facebook-sdk looks actively maintained.
This tutorial teaches you to create a simple django based application on facebook. It also includes references to more resources.
ReplyDelete