<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Benjamin Golub's blog &#187; Python</title>
	<atom:link href="http://old.benjamingolub.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://old.benjamingolub.com</link>
	<description>Benjamin Golub's blog</description>
	<lastBuildDate>Tue, 02 Dec 2008 15:27:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>My First Callcast</title>
		<link>http://old.benjamingolub.com/2008/06/04/my-first-callcast/</link>
		<comments>http://old.benjamingolub.com/2008/06/04/my-first-callcast/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 19:38:04 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[callcast]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[fftogo]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[rssmeme]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/?p=169</guid>
		<description><![CDATA[Check it out.  Thanks Kevin!
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.howiworkdaily.com/post/2008/jun/3/discussion-with-benjamin-golub/">Check it out</a>.  Thanks Kevin!</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/06/04/my-first-callcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>friendfeed.py Patch for use on Google App Engine</title>
		<link>http://old.benjamingolub.com/2008/05/29/friendfeedpy-patch-for-use-on-google-app-engine/</link>
		<comments>http://old.benjamingolub.com/2008/05/29/friendfeedpy-patch-for-use-on-google-app-engine/#comments</comments>
		<pubDate>Thu, 29 May 2008 18:29:36 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[friendfeed]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/?p=163</guid>
		<description><![CDATA[Ask and ye shall receive.  Attached is a patch for using friendfeed.py on Google App Engine.  You need to also have demjson available.  Google App Engine does not allow use of many C modules (like cjson) and both json and simplejson will throw decoding errors from time to time. demjson is slow but won&#8217;t throw [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://benjamingolub.disqus.com/google_app_engine_first_impressions/#comment-550635">Ask</a> and ye shall receive.  <a href="/wordpress/wp-content/uploads/2008/05/friendfeedpy_appengine.diff">Attached is a patch for using friendfeed.py on Google App Engine</a>.  You need to also have <a href="http://deron.meranda.us/python/demjson/">demjson</a> available.  Google App Engine does not allow use of many C modules (like cjson) and both json and simplejson will throw decoding errors from time to time. demjson is slow but won&#8217;t throw errors around (I really wish we could use cjson; it&#8217;s so much faster).</p>
<p>Basically the differences are:</p>
<ol>
<li>Use urlfetch instead of urllib2</li>
<li>Use Django&#8217;s urlencode which will work with unicode (<a href="http://friendfeed.com/e/d6da68bd-70ea-4f26-9e85-26e536d79abb">letting you comment/share in languages like Chinese</a>)</li>
<li>Use demjson instead of cjson (which cannot be used on Google App Engine), simplejson, or json (which both throw decoding errors from time to time)</li>
</ol>
<p>Enjoy!</p>
<p>Update:</p>
<p>You don&#8217;t need to use demjson anymore; simplejson will work just fine.  I just got an email from <a href="http://friendfeed.com/sanjeev">Sanjeev</a> saying that they fixed the issue (&#8217;\x&#8217; is not valid JSON).  This makes things even easier because simplejson is included in Django <code>(from django.utils import simplejson</code>) which is included in Google App Engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/05/29/friendfeedpy-patch-for-use-on-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Tweet 2 Tweet</title>
		<link>http://old.benjamingolub.com/2008/05/18/tweet-2-tweet/</link>
		<comments>http://old.benjamingolub.com/2008/05/18/tweet-2-tweet/#comments</comments>
		<pubDate>Mon, 19 May 2008 00:21:12 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[app engine]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[summize]]></category>
		<category><![CDATA[Tweet 2 Tweet]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/?p=159</guid>
		<description><![CDATA[Announcing my latest (tiny) project: Tweet 2 Tweet.
You know when you see someone&#8217;s Twitter update with an @ reply in it to someone you don&#8217;t know and are completely confused about the topic?  Tweet 2 Tweet is an effort to solve that.  You can put both of their names into Tweet 2 Tweet and see [...]]]></description>
			<content:encoded><![CDATA[<p>Announcing my latest (tiny) project: <a href="http://www.tweet2tweet.com/">Tweet 2 Tweet</a>.</p>
<p>You know when you see someone&#8217;s Twitter update with an @ reply in it to someone you don&#8217;t know and are completely confused about the topic?  Tweet 2 Tweet is an effort to solve that.  You can put both of their names into Tweet 2 Tweet and see their conversation on one page much like Facebook&#8217;s &#8220;Wall-to-Wall&#8221; feature.</p>
<p>It&#8217;s just a dumb, fun project.  Nothing made to be a big splash; just something I&#8217;ve been meaning to do.  It uses <a href="http://www.djangoproject.com/">Django</a> + <a href="http://appengine.google.com/">App Engine</a> + <a href="http://summize.com/">Summize</a> to power it.  Django mainly for the templates, App Engine so my server doesn&#8217;t get anymore overloaded, and Summize so I don&#8217;t even need a database.</p>
<p>Plus it was an excuse to whip out my old algorithms book so I could implement a <a href="http://en.wikipedia.org/wiki/Quick_Sort">quicksort</a>.</p>
<p>Thanks to everyone who&#8217;s covered it already; I&#8217;ll be making minor improvements from time to time.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/05/18/tweet-2-tweet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FriendFeed Stats &#8211; FriendFeed API + Open Source</title>
		<link>http://old.benjamingolub.com/2008/04/01/friendfeed-stats-friendfeed-api-open-source/</link>
		<comments>http://old.benjamingolub.com/2008/04/01/friendfeed-stats-friendfeed-api-open-source/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 23:19:09 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[friendfeed]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/?p=115</guid>
		<description><![CDATA[I really dropped the ball on writing a blog post about this one but better late than never!
On March 21st Bret Taylor (one of the FriendFeed founders) asked if I&#8217;d like to provide feedback for the then upcoming FriendFeed API.  I was very interested in getting my hands on it and stoked that I was [...]]]></description>
			<content:encoded><![CDATA[<p>I really dropped the ball on writing a blog post about this one but better late than never!</p>
<p>On March 21st <a href="http://friendfeed.com/bret">Bret Taylor</a> (one of the <a href="http://friendfeed.com/">FriendFeed</a> founders) asked if I&#8217;d like to provide feedback for the then upcoming <a href="http://friendfeed.com/api/">FriendFeed API</a>.  I was very interested in getting my hands on it and stoked that I was one of the people he thought of when searching for feedback.  Over the weekend I tinkered with the API, provided feedback (you can thank me for having comment/like/discussion and search feeds in the API), and built the first FriendFeed application: <a href="http://www.friendfeedstats.com/">FriendFeed Stats</a>.</p>
<p>On March 25th I <a href="http://friendfeed.com/e/54460a9a-2dec-4883-a4a3-6cbd707882b5">launched FriendFeed Stats</a> simultaneously with the release of the FriendFeed API.  Soon I <a href="https://launchpad.net/friendfeedstats">open sourced the Django application that drives FriendFeed Stats</a> so everyone could see how simple it is to work with the FriendFeed API.</p>
<p>Many thanks to Bret and the rest of the FriendFeed team for delivering an awesome service.  I hope to see many more interesting FriendFeed applications soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/04/01/friendfeed-stats-friendfeed-api-open-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSSmeme &#8211; Now With Search Feeds</title>
		<link>http://old.benjamingolub.com/2008/02/06/rssmeme-now-with-search-feeds/</link>
		<comments>http://old.benjamingolub.com/2008/02/06/rssmeme-now-with-search-feeds/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 23:51:57 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[readburner]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[rssmeme]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/2008/02/06/rssmeme-now-with-search-feeds/</guid>
		<description><![CDATA[Ask and ye shall receive.  David Rothman asked for search and RSS feeds for searches for ReadBurner; so I added them to RSSmeme.  Searches are basic: I split up your terms, search for them case insensitively in story titles, and &#8220;or&#8221; the results all together sorted by post date.  Your browser should auto-detect the feed [...]]]></description>
			<content:encoded><![CDATA[<p>Ask and ye shall receive.  David Rothman <a href="http://davidrothman.net/2008/01/30/hacking-readburner-urls/">asked for search and RSS feeds for searches</a> for <a href="http://www.readburner.com/">ReadBurner</a>; so I added them to <a href="http://www.rssmeme.com/">RSSmeme</a>.  Searches are basic: I split up your terms, search for them case insensitively in story titles, and &#8220;or&#8221; the results all together sorted by post date.  Your browser should auto-detect the feed for that search which will be formated in a url like this:</p>
<blockquote><p><a href="http://www.rssmeme.com/feeds/search/yahoo/google/microsoft/">http://www.rssmeme.com/feeds/search/yahoo/google/microsoft/</a></p></blockquote>
<p>Tada!</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/02/06/rssmeme-now-with-search-feeds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSSmeme &#8211; Look out ReadBurner!</title>
		<link>http://old.benjamingolub.com/2008/02/06/rssmeme-look-out-readburner/</link>
		<comments>http://old.benjamingolub.com/2008/02/06/rssmeme-look-out-readburner/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 18:33:30 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[readburner]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[rssmeme]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/2008/02/06/rssmeme-look-out-readburner/</guid>
		<description><![CDATA[Look out ReadBurner; RSSmeme is coming for you!  I registered rssmeme.com yesterday and launched the site today.  It was a test for me to see how good/fast of a Django developer I am.  It isn&#8217;t 100% done yet; but most of the functionality is there.
Why another one of these sites?  Because it was fun to [...]]]></description>
			<content:encoded><![CDATA[<p>Look out <a href="http://www.readburner.com/">ReadBurner</a>; <a href="http://www.rssmeme.com/">RSSmeme</a> is coming for you!  I registered rssmeme.com yesterday and launched the site today.  It was a test for me to see how good/fast of a Django developer I am.  It isn&#8217;t 100% done yet; but most of the functionality is there.</p>
<p>Why another one of these sites?  Because it was fun to make and competition is good.  I have things that ReadBurner doesn&#8217;t and ReadBurner has things that I don&#8217;t.  I think that eventually both of us will be better because of this.</p>
<p>How did I get so much data in less than 24 hours?  I got all the feeds by screen scraping ReadBurner (sorry if this offends you).  My update script parses through 50 feeds per minute; I&#8217;m not sure how fast ReadBurner is.</p>
<p>It isn&#8217;t the fastest site I&#8217;ve ever made; so please be gentle!  The caching is not so great yet.</p>
<p>If you have any requests please let me know.  I&#8217;ve kept things very simple so it&#8217;s easy for me to add new features at any time. I&#8217;m not sold on the color pallet yet either.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/02/06/rssmeme-look-out-readburner/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Beautiful Paginator with Django Custom Filters</title>
		<link>http://old.benjamingolub.com/2008/02/01/beautiful-paginator-with-django-custom-filters/</link>
		<comments>http://old.benjamingolub.com/2008/02/01/beautiful-paginator-with-django-custom-filters/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 14:41:40 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dearlazyweb]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/2008/02/01/beautiful-paginator-with-django-custom-filters/</guid>
		<description><![CDATA[Here is an example; scroll down to see the paginator.
Django&#8217;s generic views already have awesome support for pagination.  But they don&#8217;t give you a great way of providing a good paginator; that is up to you to create.
They give you an array (page_range) in your templates that you can loop over to display a nice [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dearlazy.com/m/?page=4">Here is an example</a>; scroll down to see the paginator.</p>
<p>Django&#8217;s generic views already have awesome support for pagination.  But they don&#8217;t give you a great way of providing a good paginator; that is up to you to create.</p>
<p>They give you an array (page_range) in your templates that you can loop over to display a nice paginator but when the database gets full, do you really want to display every single page?  Google shows you 10 pages to start, and bumps that up to 20 later.  Flickr shows you some and then has a &#8220;&#8230;&#8221; with a final link to the last few.  I wanted to do something similar.</p>
<p>My first attempt involved looping over page_range and checking if each page was within 2 from the current page.  This worked alright, but I realized that once page_range grew to hundreds of pages I&#8217;d start seeing some slow down.</p>
<p>So instead I wrote a custom filter that will shrink page_range down to 2 pages before and 2 pages after the current page.  <a href="http://benjamingolub.com/2007/10/06/django-custom-template-filters/">Refer to this post on how to make a custom filter</a>.  Here is the code:</p>
<blockquote>
<pre>@register.filter
def shrink(value, arg):
    left = arg - 3
    right = arg + 2
    if left &lt; 0:
        left = 0
        right = 5
    if right &gt; len(value):
        right = len(value) + 1
        left = right - 6
        if left &lt; 0:
            left = 0
    return value[left:right]</pre>
</blockquote>
<p>I&#8217;m sure someone can come up with a better way of doing that but it works very well for me.  Basically, if you pass in value of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and an arg of 5 then it will return [3, 4, 5, 6, 7].  If you pass in 10 then it will return [6, 7, 8, 9, 10].  It will always give you an array containing at most 5 items and will try it&#8217;s hardest to center on the page you pass into it.</p>
<p>Spruce up the templates a bit by adding some padding to the links (so they are easier to click on), separating the First/Last/Next/Previous links from the numbers,  and don&#8217;t display unnecessary links and you&#8217;ve got one beautiful paginator.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/02/01/beautiful-paginator-with-django-custom-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing Dear LazyWeb, a Twitter app!</title>
		<link>http://old.benjamingolub.com/2008/01/28/announcing-dear-lazyweb-a-twitter-app/</link>
		<comments>http://old.benjamingolub.com/2008/01/28/announcing-dear-lazyweb-a-twitter-app/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 13:17:29 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dearlazyweb]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/2008/01/28/announcing-dear-lazyweb-a-twitter-app/</guid>
		<description><![CDATA[I&#8217;m proud to announce my latest project: Dear LazyWeb.  When somebody asks a question to nobody in particular on the internet they are calling for help from the LazyWeb.  There used to be a website where you could post your questions but it has been shut down.
Building applications on top of Twitter is all the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m proud to announce my latest project: <a href="http://dearlazy.com">Dear LazyWeb</a>.  When somebody asks a question to nobody in particular on the internet they are calling for help from the LazyWeb.  There used to be a <a href="http://www.lazyweb.org/">website</a> where you could post your questions but it has been shut down.</p>
<p>Building applications on top of <a href="http://twitter.com">Twitter</a> is <a href="http://www.tweetgift.com">all</a> <a href="http://plusplusbot.com/">the</a> <a href="http://foamee.com">rage</a> <a href="http://politweets.com/">these</a> <a href="http://twittertale.com/">days</a>.  It&#8217;s easy, convenient, and provides mobility; perfect for asking the LazyWeb.   Plus, people already use Twitter to ask the LazyWeb; but nobody is doing anything with all of that data. Enter <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a>.</p>
<p>First follow <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a>; <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will follow you back in return.  Then send <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> a question.  You can do this through an @reply or a direct message:</p>
<blockquote><p>@dearlazyweb What type of bear is best?</p></blockquote>
<p><a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will respond (via a direct message) with a url.  That url will lead you to a page with your question plus instructions on how to answer it.  Someone else might know the answer so they would respond:</p>
<blockquote><p> @dearlazyweb answer 1 Black</p></blockquote>
<p>This time <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will respond to you with a link to the answer.  Where did that number 1 come from? The page for each question contains instructions for answering it (it also happens to be the same ID as the Twitter message that created the question).  Now you know, black bears are best!  Someone else might disagree:</p>
<blockquote><p> @dearlazyweb a 1 Wrong, brown bears are better</p></blockquote>
<p>Again, <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will send you a direct message with a link to the answer.  Great, but doesn&#8217;t Twitter already provide this sort of communication?  Yes, but only those following you will be able to see your question and it won&#8217;t let you be anonymous.  Anyone can visit Dear LazyWeb to view questions so anyone can answer your question.  Plus, all direct messages sent to <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> are <strong>displayed anonymously</strong>.  So if you wanted to know the answer to a touchy subject:</p>
<blockquote><p>d dearlazyweb Who are you going to vote for?</p></blockquote>
<p><a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will again give you a url; but this time there will be nothing at that url linking it to your Twitter account.  If someone responds to it publicly:</p>
<blockquote><p>@dearlazyweb a 2 Isn&#8217;t it a little early to be deciding?</p></blockquote>
<p><a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will still direct message you with a link to that answer.  <strong>Only</strong> <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> knows that you created the question and it <strong>promises</strong> never to tell.  Answers can also be sent anonymously:</p>
<blockquote><p>d dearlazyweb a 2 Obama!</p></blockquote>
<p><a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will direct message you with a link to this answer; only it will not contain any reference to the answerers Twitter screen name.</p>
<p>What if you want to shut <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> up?  You know the answer to your question; now it&#8217;s time to complete it:</p>
<blockquote><p>@dearlazyweb complete 1</p></blockquote>
<p>Done, you won&#8217;t hear a peep from <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> about that question ever again.  Even if someone else answers it; <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> won&#8217;t disturb you.</p>
<p>What if you would like to help someone out?</p>
<blockquote><p>@dearlazyweb random</p></blockquote>
<p>And <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> will send you a random, uncompleted question.  Help some poor lost soul out.</p>
<p>So, please, check out the <a href="http://dearlazy.com">site</a> and the <a href="http://twitter.com/dearlazyweb/">bot</a>.  The <a href="http://dearlazy.com">site</a> is full of extra information: it keeps track of how many questions and answers you&#8217;ve given and will even give you RSS feeds for individual questions.  <strong>Be sure to follow</strong> <a href="http://twitter.com/dearlazyweb/">dearlazyweb</a> or you won&#8217;t be able to receive any direct message.</p>
<p><strong>Any feedback at all is appreciated</strong>.  I&#8217;m definitely not done developing the site or the bot so please let me know what you like or hate about either!</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2008/01/28/announcing-dear-lazyweb-a-twitter-app/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>BeautifulSoup: Last.fm Artist Image</title>
		<link>http://old.benjamingolub.com/2007/11/07/beautifulsoup-lastfm-artist-image/</link>
		<comments>http://old.benjamingolub.com/2007/11/07/beautifulsoup-lastfm-artist-image/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 13:03:57 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[beautifulsoup]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Last.fm]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[screen scrape]]></category>
		<category><![CDATA[Stream]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/2007/11/07/beautifulsoup-lastfm-artist-image/</guid>
		<description><![CDATA[A coworker had been working with Last.fm and libnotify to send him a notification when a friend listens to a song so that he can decide if he&#8217;d be interested in listening to it.  To grab the artist&#8217;s image he used a complex regular expression that was prone to error.  I thought it [...]]]></description>
			<content:encoded><![CDATA[<p>A coworker had been working with Last.fm and libnotify to send him a notification when a friend listens to a song so that he can decide if he&#8217;d be interested in listening to it.  To grab the artist&#8217;s image he used a complex regular expression that was prone to error.  I thought it was a neat idea so I decided to implement for my stream.  <a href="http://stream.benjamingolub.com/source/lastfm/">The result can be found here</a>.</p>
<p>My implementation is a one liner:</p>
<blockquote><p><code>event.image = soup.find('div', {'class': 'imgHolder'}).find('img').get('src')</code></p></blockquote>
<p>Basically that says &#8220;find the div that has a class imgHolder, find the image inside of that div, and get me the link to the image&#8221;.  <a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a> makes things like this extremely easy.  I highly recommend using it whenever you need to screen scrape.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2007/11/07/beautifulsoup-lastfm-artist-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pop Secrets Updated</title>
		<link>http://old.benjamingolub.com/2007/11/06/pop-secrets-updated/</link>
		<comments>http://old.benjamingolub.com/2007/11/06/pop-secrets-updated/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 00:57:47 +0000</pubDate>
		<dc:creator>Benjamin Golub</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[beautifulsoup]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[pop secrets]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[universal feed parser]]></category>

		<guid isPermaLink="false">http://benjamingolub.com/2007/11/06/pop-secrets-updated/</guid>
		<description><![CDATA[I wrote the original script for Pop Secrets over a year ago.  Back then I was just getting into Python and was woefully ignorant.  Using Universal Feed Parser I simply gobbled up all the content from a number of celebrity gossip blogs and spitted them out sorted by date onto a page.  [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote the original script for <a href="http://www.pop-secrets.com">Pop Secrets</a> over a year ago.  Back then I was just getting into Python and was woefully ignorant.  Using <a href="http://feedparser.org/">Universal Feed Parser</a> I simply gobbled up all the content from a number of celebrity gossip blogs and spitted them out sorted by date onto a page.  It was a complete hack; 129 lines of Python that was a complete mix of presentation, data, and logic.  Despite all of that it still attracted a steady flow of about 250 unique visitors a month.  Not bad but nobody was clicking on the Google ads and because the site consisted of a single static file I basically got 1 page view per visit.</p>
<p>Yesterday I rewrote Pop Secrets using <a href="http://www.djangoproject.com/">Django</a>, it took me a total of about 2 hours to finish and most of that was template design; Django is really that fast.  From the outside the site looks the same except I&#8217;ve added pagination (3 posts per page) and you can view posts from a single source or tag.  Internally I&#8217;m doing a lot more magic.  I use <a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a> to extract images from a post.  This allows me to strip all the html from the content (don&#8217;t trust anything on the Internet!) but still keep the images (which is the main reason people visit these sites).  Tags allow you to view all stories, across all sites, specific to a certain topic (<a href="http://www.pop-secrets.com/tag/britney-spears/">Britney Spears</a> for instance).</p>
<p>My logs show that people like the new version.  I&#8217;ve gotten as many unique visitors in 1 day as I used to get in 1 month. People are making use of the tag and single source views.  I&#8217;ve got an average of 18 page views per visit; people love clicking that &#8220;Next Page&#8221; button.  I&#8217;m entertaining the idea of adding commenting; but I&#8217;m not sure people would use it since the gossip blogs already provide that feature.</p>
<p>If you came here from Pop Secrets: let me know what you think of it and if there is anything I can do to make it better for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://old.benjamingolub.com/2007/11/06/pop-secrets-updated/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
