<?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/"
	>

<channel>
	<title>Free Range</title>
	<atom:link href="http://blogs.osuosl.org/kreneskyp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.osuosl.org/kreneskyp</link>
	<description>Developed in open source communities.</description>
	<pubDate>Mon, 21 Sep 2009 18:04:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pydra 0.5 Released</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/09/21/pydra-05-released/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/09/21/pydra-05-released/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 18:04:27 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Dev Front Page]]></category>

		<category><![CDATA[Distributed Computing]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Pydra]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=379</guid>
		<description><![CDATA[This marks the first beta release of Pydra, a distributed computing framework for python.  While most core features are implemented, at least partially, there are many open tickets in the tracker for bugs and improved features.  While this is not a stable release we felt the project was far enough along that there should be [...]]]></description>
			<content:encoded><![CDATA[<p>This marks the first beta release of <a title="Pydra - Distributed Computing Framework" href="http://pydra-project.osuosl.org">Pydra</a>, a distributed computing framework for python.  While most core features are implemented, at least partially, there are many open tickets in the tracker for bugs and improved features.  While this is not a stable release we felt the project was far enough along that there should be an installable package out there for people to experiment with. The coming months will bring more stability and features as we transition to a scheduled release cycle.</p>
<p>Many thanks to Jakub Gustak, Yin Qiu, and <a href="http://almirkaric.com/">Almir Karic</a> who have contributed code vital to this release.</p>
<p><span id="more-379"></span></p>
<h3>Major Features</h3>
<ul>
<li> Task API with:
<ul>
<li><a title="Pydra - Tasks API" href="http://pydra-project.osuosl.org/wiki/tasks">Basic building blocks</a> which can be combined to build complex, reusable Tasks.  Base classes include a basic task and containers for sequential work, parallel work, and MapReduce.</li>
<li> <a title="Pydra - Datasources" href="http://pydra-project.osuosl.org/wiki/tasks/datasources">Datasource API</a> for managing connections and input efficiently.</li>
<li><a title="Pydra - Task Forms" href="http://pydra-project.osuosl.org/wiki/tasks/forms">Forms</a> for defining, processing, and validating data.</li>
<li> <a title="Pydra - Task Packages" href="http://pydra-project.osuosl.org/wiki/tasks#TaskPackages">Task Packaging</a> system for packaging tasks, supporting files, and libraries</li>
</ul>
</li>
</ul>
<ul>
<li><a title="Pydra - Task Synchronization" href="http://pydra-project.osuosl.org/wiki/cluster/task_synchronization">Synchronization System</a> to automatically version and deploying Tasks Packages to the cluster.</li>
<li> <a title="Pydra - Scheduling System" href="http://pydra-project.osuosl.org/wiki/cluster/scheduler">Scheduling System</a> to track and run tasks.</li>
<li> <a title="Pydra - Task History Screenshot" href="http://pydra-project.osuosl.org/attachment/wiki/screenshots/pydra_task_history.png">Task History</a> recorded for debugging and future profiling components.</li>
<li> <a title="Pydra - User Interface Screenshots" href="http://pydra-project.osuosl.org/wiki/screenshots">Web Frontend</a> for managing and running tasks.</li>
<li> <a title="Pydra - Controller API" href="http://pydra-project.osuosl.org/wiki/cluster/controller">Controller API</a> for controlling Pydra from within other programs via REST.  This includes a client object to simplify dealing with Pydra&#8217;s strict authentication system.</li>
<li> <a title="Pydra - Security" href="http://pydra-project.osuosl.org/wiki/security">Security</a> for all connections within the cluster.</li>
<li> <a title="Pydra - Module System" href="http://pydra-project.osuosl.org/wiki/cluster/modules">Module System</a> for enabling or disabling features.</li>
</ul>
<h3>Feedback</h3>
<p>We welcome and encourage <a title="Pydra - Mailling lists" href="http://pydra-project.osuosl.org/wiki/maillists">feedback</a>, whether your love Pydra or Hate it.  We want to shape this project to make it more useful for people, and for it to be easier to use.  If something doesn&#8217;t work well we <strong>want</strong> to know.  If you have a great idea that isn&#8217;t on <a title="Pydra - Open Tickets" href="http://pydra-project.osuosl.org/report/2">our roadmap</a>, we&#8217;ll determine out how to fit it in.</p>
<h3>Download</h3>
<p><a title="Pydra - Distributed Computing Framework" href="http://pydra-project.osuosl.org/releases">Pydra 0.5</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/09/21/pydra-05-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pydra Status Update July &#8216;09</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/07/20/pydra-status-update-july-09/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/07/20/pydra-status-update-july-09/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 21:20:22 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Distributed Computing]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Pydra]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=347</guid>
		<description><![CDATA[We&#8217;ve been working on Pydra for more about 6 months now and we&#8217;ve come a long way.  So where is the project?  Pydra is moving closer to a stable release, but there&#8217;s a lot to finish.  We still expect to have something usable, by most people, by the end of the summer.
There [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been working on <a title="Pydra Project Website" href="http://pydra-project.osuosl.org">Pydra</a> for more about 6 months now and we&#8217;ve come a long way.  So where is the project?  Pydra is moving closer to a stable release, but there&#8217;s a lot to finish.  We still expect to have something usable, by most people, by the end of the summer.</p>
<p>There are no releases yet but we&#8217;re getting ready to use it in production:</p>
<ul>
<li> We&#8217;re close to deploying Pydra with the <a title="Protein Geometry Database" href="http://pgd.osuosl.org/">Protein Geometry Project</a>.  I&#8217;ve been working bugs out of Pydra while implementing their protein data import tool.  The main issues are related to the protein parser rather than Pydra itself.</li>
<li>I&#8217;ve also deployed a <a title="Pydra Cluster" href="http://blogs.osuosl.org/kreneskyp/files/2009/07/pydra-cluster.png">small cluster</a> of a few blades and other random desktop machines we had lying around.  We&#8217;re throwing it at the <a title="Engine Yard Contest" href="http://www.engineyard.com/blog/2009/programming-contest-win-iphone-3gs-2k-cloud-credit/">Engine Yard Contest</a> just to try out Pydra.  The trial attempts have been good, but this was more about kicking the tires on Pydra than winning the contest.</li>
</ul>
<h3><span id="more-347"></span></h3>
<h3>You&#8217;re using it but, why are there no releases yet?</h3>
<p>I&#8217;m a big fan of &#8220;release early, release often&#8221; but the project still needs have a certain degree of usability.   There&#8217;s still missing features that will dramatically affect how easy Pydra is to deploy and use.  Sure you can get by without them but it may require a bit of hacking and manual setup to deal with.  The type of person who can make use of Pydra right now isn&#8217;t phased by checking out directly from a <a title="Pydra Git Repository" href="http://trac.osuosl.org/git/?p=pydra.git">git repository</a>.</p>
<h3>Whats being worked on right now?</h3>
<p>We&#8217;re updating the project on a regular basis to get it ready for an initial release.  Here are the highlights:</p>
<h4>Module System</h4>
<p>I&#8217;m refactoring the core of pydra to use a <a title="Module API" href="http://pydra-project.osuosl.org/wiki/cluster/modules">module system</a>.  Modules will be loosely coupled using the observer pattern.  It will allow us greater flexibility with our components and make it easier to implement features such as replication.  It will also allow us to make functionality modular or optional.</p>
<p>The module system is intended to allow long term growth of the project.  It wasn&#8217;t in the original plan because the core isn&#8217;t overly complicated right now.  I&#8217;m implementing modules now, to prevent a jumbled mess of code a year or more down the road.</p>
<h4>Scheduler</h4>
<p>The task scheduler handles assigning work to workers in the cluster.  The new task scheduler will fix quite a few bugs in our current scheduler and make it easier to extend.</p>
<h4>Datasources</h4>
<p>We&#8217;re designing  an abstract datasource API that will abstract interactions with storage systems.  Datasources will simplify distribution of connection information along with your tasks.  Datasources will reduce the amount of setup you have to do on a Node before you can run a task on it.  They will also make it easier to slice your data into pieces that can be distributed amongst Pydra Nodes.</p>
<h3>Want to know more, or better yet hack on Pydra?</h3>
<p>I&#8217;ll be at OSCON all week.  Follow me on twitter, <a title="Follow me on twitter" href="http://twitter.com/kreneskyp">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/07/20/pydra-status-update-july-09/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Irssi Notifications Via XMPP</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/06/02/irssi-notifications-via-xmpp/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/06/02/irssi-notifications-via-xmpp/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 14:12:43 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=315</guid>
		<description><![CDATA[Myself and most others at the OSL use screen+irssi to keep our irssi sessions alive and move between locations and computers.  The problem is that we don&#8221;t receive notifications of private messages or highlighted messages (messages directed to us in a channel, or keywords) on our remote machines.  The solution I came up with was [...]]]></description>
			<content:encoded><![CDATA[<p>Myself and most others at the OSL use <a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fquadpoint.org%2Farticles%2Firssi&amp;ei=OjElSpyrE5DGswO2iuicBg&amp;usg=AFQjCNHIl_A5ixzFCXs5PsRj12TR1YIX4w&amp;sig2=Lw7JmGnzfkDhaQiNuhZpyg">screen+irssi</a> to keep our irssi sessions alive and move between locations and computers.  The problem is that we don&#8221;t receive notifications of private messages or highlighted messages (messages directed to us in a channel, or keywords) on our remote machines.  The solution I came up with was to send the notifications over <a href="http://xmpp.org/about/">XMPP</a> to a jabber server which both the irssi client and notification system could connect to.</p>
<p><span id="more-315"></span></p>
<p>I was able to get <a href="http://axman6.homeip.net/blog/growl-net-full-documentation.html">growl-net.pl</a> and <a href="http://www.mumbles-project.org/">mumbles</a> to work using the <a href="http://growl.info/">growl</a> protocol.  It had two major flaws, we couldn&#8217;t automatically detect the IP for our laptop and it wouldn&#8217;t work behind a NAT.  Greg Lund-Chaix and myself hacked on different schemes for tunneling IPs using ssh reverse tunneling, and nc to deal with the fact that growl is UDP only.  We had some minor successes but the connections using nc would disconnect frequently.</p>
<p>The tunneling just wouldnt work and was too fragile so I changed plans and worked on using XMPP instead.  Sending messages via XMPP would not require tunneling at all even if you are behind a NAT.  To accomplish this I rewrote growl-net.pl into jabber-notify.pl and hacked up a quick python program that listens for jabber messages and forwards them on to libnotify (via pynotify), the standard notification library for ubuntu.</p>
<h3>Install Jabber-Notify.pl</h3>
<ol>
<li>Install Net:Jabber - <span style="color: #ffcc99"> <em>sudo cpan -i Net:Jabber</em></span></li>
<li>Download <a href="http://staff.osuosl.org/~peter/myfiles/jabber-notify.pl">jabber-notify.pl</a></li>
<li>Deploy it to <span style="color: #ffcc99"><em>.irssi/scripts</em></span> on the server you run irssi on</li>
<li>Load script <em><span style="color: #ffcc99">/load jabber-notify.pl</span> </em><span style="color: #ff0000">(You&#8217;ll get an error unless your jabber server is localhost</span><em>)<br />
</em></li>
<li>Configure settings using<span style="color: #ffcc99"> <em>/set (option) (value)</em></span>
<ul>
<li><strong>xmpp_notify_server -</strong> jabber server to send messages to</li>
<li><strong>xmpp_notify_user -</strong> jabber account to send message from</li>
<li><strong>xmpp_notify_pass -</strong> password for the sending user</li>
<li><strong>xmpp_notify_recv -</strong> jabber account which will receive the messages.  This can be the same as the sender.</li>
<li><strong>xmpp_show_privmsg -</strong> notify about private messages</li>
<li><strong>xmpp_show_hilight -</strong> notify when your name is highlighted</li>
<li><strong>xmpp_show_notify -</strong> notify when someone on your away list joins or leaves</li>
</ul>
</li>
<li>reload script with new settings <span style="color: #ffcc99"><em>/load jabber-notify.pl</em></span></li>
<li>Test using <span style="color: #ffcc99"><em>/xn-test</em></span></li>
</ol>
<h3>Install Jumbles.py</h3>
<ol>
<li><a href="http://xmpppy.sourceforge.net/"></a></li>
<li>Download <a href="http://staff.osuosl.org/~peter/myfiles/jumbles.tar.gz">jumbles.py</a></li>
<li>Edit jumbles.py to set your values
<ul>
<li><strong>JABBER_HOST -</strong> Hostname/IP for the jabber server</li>
<li><strong>JABBER_PORT -</strong> Port for the jabber server.  Default is 5222, 5223 for ssl/tls</li>
<li><strong>JABBER_USER -</strong> User to receive messages</li>
<li><strong>JABBER_PASS -</strong> Password for user</li>
</ul>
</li>
<li>start jumbles.py</li>
</ol>
<h3>Some Notes</h3>
<ul>
<li>Jumbles is only going to receive limited support by me for the near future.  While i&#8217;d like to add things like a tray icon, settings menu, and better reconnection logic, i just don&#8217;t have time right now.  If you&#8217;re interested in any of these things feel free to contribute.</li>
<li>Jumbles was hacked together fairly quickly from xmppy example code.  Its name is a reference to this and mumbles which i was trying to emulate.</li>
<li>The Sound used for notification is from open office, and can be channged on line 27</li>
<li>If you dislike sound you can comment out line 75</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/06/02/irssi-notifications-via-xmpp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hackathon @ Open Source Bridge</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/05/08/hackathon-open-source-bridge/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/05/08/hackathon-open-source-bridge/#comments</comments>
		<pubDate>Fri, 08 May 2009 20:26:41 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Dev Front Page]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=289</guid>
		<description><![CDATA[The Open Source Lab is organizing a Hackathon (code sprint) at the Open Source Bridge conference, June 17-19th at the Oregon Convention Center in Portland.  We&#8217;re bringing people together to help out Sunlight Lab&#8217;s Fifty States Project.  If you&#8217;re interested in helping promote government openness and transparency, this is your chance.

What
Part of the non-partisan Sunlight [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://osuosl.org">Open Source Lab</a> is organizing a Hackathon (code sprint) at the <a href="http://opensourcebridge.org">Open Source Bridge</a> conference, June 17-19th at the Oregon Convention Center in Portland.  We&#8217;re bringing people together to help out <a href="http://sunlightlabs.org">Sunlight Lab</a>&#8217;s <a href="http://www.sunlightlabs.com/blog/2009/02/26/fifty-state-project/">Fifty States Project</a>.  If you&#8217;re interested in helping promote government openness and transparency, this is your chance.</p>
<p><span id="more-289"></span></p>
<h3>What</h3>
<p>Part of the non-partisan <a href="http://Sunlightfoundation.com">Sunlight Foundation</a>, Sunlight Labs is an open source development team that builds technology to make government more transparent and accountable.  They have been building the Fifty States Project with the help of volunteers around the country.  The project aims to provide parsers and an API for legislative data from each of the fifty state governments in the U.S.  This is a local version of their already successful <a href="http://opencongress.org">OpenCongress.org</a> which provides the same data from the federal government.</p>
<h3>Where</h3>
<p>The hackathon will take place at the Open Source Bridge conference. <strong></strong>Open Source Bridge is a new conference for developers working with open source technologies and for people interested in learning the open source way.  It is an entirely volunteer organized conference.  Open Source Bridge is providing a <a href="http://opensourcebridge.org/2009/03/open-source-conference-prerequisite-1-space-for-hacking/">Hacker Lounge</a>, providing a great environment to hack in 24 hours a day during the conference.</p>
<p>The hacker lounge is located at the <a href="http://www.hilton.com/en/hi/groups/personalized/PDXPHHH-OSB-20090610/index.jhtml">Hilton Portland &amp; Executive Tower</a></p>
<pre>      921 SW Sixth Avenue
      Portland, Oregon</pre>
<h3>When</h3>
<p>The hacker lounge opens at 9am on june 17th and is open round the clock until 12am june 19th.</p>
<ul>
<li><strong>Project Intro:</strong> Anytime between 3pm - 8pm June 17th</li>
<li><strong>Coding</strong>: any time till the end of the conference</li>
</ul>
<h3>Who</h3>
<p>We&#8217;re looking for any programmers of any level, interested in promoting openness and transparency in government. No prior experience with the project is needed, but feel free to check out the <a href="http://wiki.sunlightlabs.com/index.php/State_Legislation_Page">project wiki</a>.  Fifty States is written in python but other languages are welcome as well.</p>
<h3>RSVP</h3>
<p>If you&#8217;re interested in attending RSVP at <a href="http://upcoming.yahoo.com/event/2677280">Upcoming</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/05/08/hackathon-open-source-bridge/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Summer Of Code 2009</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/04/20/google-summer-of-code-2009/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/04/20/google-summer-of-code-2009/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 19:20:29 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Dev Front Page]]></category>

		<category><![CDATA[Distributed Computing]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Summer of Code]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=263</guid>
		<description><![CDATA[Google is going to pay students $4,500 to work on some of the coolest open source projects. The OSU OSL is a organization for Google Summer of Code 2009.  After reviewing some great proposals we&#8217;ve made our selections.  Here are the students and the projects they proposed.







Pydra
Pydra is a distributed computing or cluster computing framework [...]]]></description>
			<content:encoded><![CDATA[<p>Google is going to pay students $4,500 to work on some of the <a href="http://socghop.appspot.com/program/accepted_orgs/google/gsoc2009">coolest open source projects</a>. The OSU OSL is a organization for <a href="http://code.google.com/soc/">Google Summer of Code 2009</a>.  After reviewing some great proposals we&#8217;ve made our selections.  Here are the students and the projects they proposed.</p>
<p><a href="http://code.google.com/images/2009socwithlogo.gif"></a></p>
<div class="mceTemp mceIEcenter">
<dl>
<dt><a href="http://blogs.osuosl.org/kreneskyp/files/2009/04/2009socwithlogo.gif"><img class="size-full wp-image-277" src="http://blogs.osuosl.org/kreneskyp/files/2009/04/2009socwithlogo.gif" alt="Google Summer of Code 2009" width="300" height="200" /></a></dt>
</dl>
</div>
<p><span id="more-263"></span></p>
<h3>Pydra</h3>
<p><a href="http://pydra-project.osuosl.org/">Pydra</a> is a distributed computing or cluster computing framework for Python.  Pydra seeks to provide a framework that is easy to deploy, manage, use.  This is on top of providing standard features such as fault tolerance.  There are two students working on Pydra for Summer of Code 2009.</p>
<h4>MapReduce</h4>
<p>Jakub Łukasz Gustak is a 5th year student of graduate studies at Wrocław University of Technology (Poland), Computer Science major. Recently interested in concurrent, parallel and distributed programming and languages. Also interested in programming languages design and its expressiveness. His master thesis is addressing problems of parallel and distributed computation (title: Parallelization in Scheme language).</p>
<p>Jakub&#8217;s project is to implement MapReduce support for Pydra.  <a href="http://labs.google.com/papers/mapreduce.html">MapReduce</a> is a concept for simplifying parallel computing jobs.  Jakub will also be implementing input/output helpers, improved WorkUnit Slicing, and other features.</p>
<h4>Task Scheduler and Management</h4>
<p>Yin Qiu is a first year master student from Nanjing University, China, majoring in software engineering. He interned at IBM China Development Lab for 6 months, and at Microsoft Research Asia for another 4 months. He has over 5 years of experience in Java and 2 years of experience in Python. In 2007.  Yin is passionate about building distributed systems.</p>
<p>Yin&#8217;s project is to implement a Task Scheduler for assigning workunits to workers and managing workers within a Pydra cluster.  He will also be implementing and improving management for task objects.</p>
<h3>Unify</h3>
<p>Luis Arajo has been a Gentoo developer since the beginning of 2005 , being part of the Haskell and Scheme team. He also cooperates with many packages inside the dev-lang/ category and is the current leader of the Gentoo-GUIs sub-project. Luis also<br />
successfully participated on the Google Summer of Code of 2007 developing a graphical framework for the Gentoo project, and in Google Summer of Code of 2008 designing and implementing the Unify project.</p>
<p>Luis will be continuing his work on the Unify Project.   Unify is a tool for creating packages across different distribution formats (deb , rpm, solaris packages) using standard portage Gentoo ebuilds as the specification for building the packages.  Luis will be continuing work on features and improving the usability of the application.</p>
<h3>Android IRC</h3>
<p>Tianyi Gao is a first-year college student with a 3.94 GPA, triple majoring in Computer Science, Software Engineering, and Mathematics at Rose-Hulman Institute of Technology in Terre Haute, Indiana, and hopefully graduating in three years with the class of 2011. He&#8217;s been programming for six years, with three years of Java experience</p>
<p>Tianyi will be implementing an IRC client for the Android mobile operating system.  Our IRC client will differ from existing IRC clients for android in that it will utilize a proxy service to keep connections alive even when the client is not running.  This model will allow connections to be maintained but preseve battery life by only using data connections while the application is in the foreground.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/04/20/google-summer-of-code-2009/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Category Plugin For Wordpress</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/04/06/category-plugin-for-wordpress/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/04/06/category-plugin-for-wordpress/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 21:48:37 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=247</guid>
		<description><![CDATA[I&#8217;ve been working on the layout for the new Open Source Lab Blogs  site, and came across a problem.  We wanted our front page to be an aggregation of our individual blogs.  It was easy to get the articles aggregated using RSS feeds and FeedWordPress Plugin.  It even sorted our articles into categories very [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on the layout for the new <a href="http://blogs.osuosl.org">Open Source Lab Blogs </a> site, and came across a problem.  We wanted our front page to be an aggregation of our individual blogs.  It was easy to get the articles aggregated using RSS feeds and <a href="http://projects.radgeek.com/feedwordpress/">FeedWordPress Plugin</a>.  It even sorted our articles into categories very nicely, but wasn&#8217;t compatible with other category listing plugins. We wanted the article linking back to the source blog, an option provided by FeedWordPress.</p>
<p>I built a category plugin that uses the built in query &amp; display functions to list all posts from a category.  It should be compatible with any other plugin that modifies the links for articles.</p>
<p><span id="more-247"></span></p>
<h3>Building the Plugin</h3>
<p>After doing some research I found the <strong>query_posts()</strong> function.  This function allows you to query any wordpress articles and then use the standard functions, such as <strong>have_posts()</strong>, <strong>the_post()</strong>, and <strong>the_title()</strong>, to output the articles.  50ish lines of code to generate a sql statement could be reduced to this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat='</span><span style="color: #339933;">.</span><span style="color: #000088;">$atts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;amp;posts_per_page='</span><span style="color: #339933;">.</span><span style="color: #000088;">$atts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>and since it uses the same functions for outputing the articles, it works with other plugins like FeedWordPress</p>
<h3>Plugin Properties</h3>
<ul>
<li><strong>id</strong> - id for the category to display</li>
<li><strong>title</strong> - title to display at the beginning of the list, default to &#8220;category posts&#8221;</li>
<li><strong>count</strong> - how many articles to display, defaults to 5</li>
<li><strong>href</strong> - optionally turn title into a link to this url</li>
<li><strong>class</strong> - optionally set the class attribute, can be multiple classes, defaults to &#8220;cat_list&#8221;</li>
</ul>
<h3>download</h3>
<p>Here is the plugin: <a href="http://staff.osuosl.org/~peter/wordpress/categories.tar.gz">categories.tar.gz</a></p>
<p>it is free to use and modify.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/04/06/category-plugin-for-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introducing RepresentMe</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/03/30/introducing-representme/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/03/30/introducing-representme/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 17:19:23 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[RepresentMe]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[social media]]></category>

		<category><![CDATA[facebook]]></category>

		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=189</guid>
		<description><![CDATA[SunlightLabs is holding a content called Apps For America to produce new applications that increase government transparency, openness, and accountability.  RepresentMe is my entry into the contest.
What
RepresentMe (Repme.org) focuses on how well your  representatives and senators represent you.  It takes your opinions on  bills and issues and compares them to how your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sunlightlabs.org">SunlightLabs</a> is holding a content called <a href="http://sunlightlabs.org/appsforamerica">Apps For America</a> to produce new applications that increase government transparency, openness, and accountability. <a title="RepresentMe - repme.org" href="http://repme.org"> RepresentMe</a> is my entry into the contest.</p>
<h3>What</h3>
<p>RepresentMe (<a title="RepresentMe - repme.org" href="http://repme.org">Repme.org</a>) focuses on how well your  representatives and senators represent you.  It takes your opinions on  bills and issues and compares them to how your elected officials voted.   It applies statistics, accounting for how strongly you feel about  specific issues and bills.  The end result is a detailed breakdown of  how well you are being represented.<br />
<span id="more-189"></span><br />
Repme.org is meant to compliment <a href="http://opencongress.org">OpenCongress.org</a>, a sunlight  foundation sponsored project.  OpenCongress.org is a great site for  learning about legislation passing through congress.  It gives you a  very detailed view of <span class="moz-txt-underscore"><em>everything</em></span> happening in congress.  What it doesn&#8217;t have is a detailed rating system for elected officials.</p>
<h3>Why</h3>
<p>Your House Represenative and Senators are the only three people in  congress you get to vote for.  Getting information on what these three  people are doing should be quick, easy, and detailed.  For this reason  I&#8217;ve focused on things directly relevant to the user and their  representation. My hope is to affect people opinions, positively and negatively.  To expose how well people are represented and on what issues.  Voters will then know what to applaud them for, and which areas need improvement.</p>
<h3>How</h3>
<p>RepresentMe uses a user driven weighting system to factor in personal preferences and the subtleties of politics.  Some issues are more important to one person, than another.  Sometimes people feel more strongly for or against a bill.  RepresentMe does it&#8217;s best to capture this providing a more accurate view of user preferences.</p>
<h4>Votes</h4>
<p>RepresentMe collects user votes on a scale from <strong><span style="color: #ff0000">-100%</span></strong> to <strong><span style="color: #339966">+100%</span></strong> and compares that to the lawmaker vote which can only be <span style="color: #339966"><strong>Aye</strong> </span>(<strong><span style="color: #339966">+100%</span></strong>) or <strong><span style="color: #ff0000">Nay</span></strong> (<strong><span style="color: #ff0000">-100%</span></strong>).  Presents, and No Votes are also treated as Nays, because these are just a political move that results in the same thing.  The two votes are compared to create a match percentage.</p>
<p>Lawmakers only get to vote in absolutes, but RepresentMe users get to vote the intensity of their support or opossal.  This is where the user element comes into play.  A RepresentMe user can vote things like &#8220;I wanted TARP to pass, but I couldn&#8217;t fully support it&#8221;.</p>
<h4>Issues</h4>
<p>Users can select the issues most important to them and rate their relative importance.  These ratings are used to group and weight the results.  This allows users to adjust issues to have a bigger or smaller impact on the overall rating.</p>
<h4>Ratings</h4>
<p>Personal ratings for each user and their lawmakers are calculated.  The ratings are a weighted average derived from their vote matches and issues.  Aggregate ratings for lawmakers are also provided.  All ratings include a details of where the numbers came from.</p>
<h3>Sharing Data</h3>
<p>My hope is that RepresentMe will produce a set of useful data. I don&#8217;t want the data to just remain on repme.org, I want it to be used wherever possible. Sharing the data can bring about conversation and ultimately change. To that end I&#8217;ve provided several ways to share data from RepresentMe.</p>
<h4>Facebook</h4>
<p>Facebook has 175 million active users around the world, Its one of the most popular social media websites in the U.S. The RepresentMe Facebook Application allows you to share data from RepresentMe by automatically publishing your votes to your Facebook Status, and allows you to add your lawmaker ratings to your profile page.</p>
<p>Learn more about the application <a title="RepresentMe - Facebook Application" href="http://repme.org/facebook/about">here</a></p>
<h4>Widgets</h4>
<p>A widget is a portable chunk of code that can be installed and executed within any separate HTML-based web page. By providing widgets, owners of other websites can display a small portion of your website, in theirs.  RepresentMe provides an initial set of six widgets and a Generic Widget Builder to make it simpler to add <em>new</em> widgets</p>
<p>View the widgets <a title="RepresentMe - repme.org" href="http://repme.org/widgets/">here</a></p>
<h4>XML</h4>
<p>An XML feed is provided for every lawmaker. This can be used by developers who want tighter integration within their own applications.</p>
<p>View an example feed <a title="RepresentMe - example xml feed" href="http://repme.org/lawmaker/xml/300100">here</a></p>
<h3>Future Plans</h3>
<p>The road doesn&#8217;t end here.  There are future plans to improve the calculations RepresentMe can produce.  The ratings system is a fairly simple one as far as statistics go.  I feel fairly confident with user&#8217;s personal ratings but aggregate ratings need more studying.  A single user casting votes inherently weights itself correctly.  Different users won&#8217;t weight their votes the same way and that needs to be accounted for.  More data is needed to determine how to properly adjust the aggregate lawmaker ratings to account for different user voting patterns.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/03/30/introducing-representme/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Distributed Computing With Pydra</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/03/29/distributed-computing-with-pydra/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/03/29/distributed-computing-with-pydra/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 19:12:46 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Distributed Computing]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[cluster]]></category>

		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=215</guid>
		<description><![CDATA[Pydra is a distributed computing or cluster computing framework for Python.  Pydra seeks to provide a solution that is easier to deploy, manage, use than existing projects.  This is on top of providing standard features such as fault tolerance.
Pydra was born out of a necessity.  Other projects being developed by the Open Source Lab required [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pydra-project.osuosl.org">Pydra</a> is a distributed computing or cluster computing framework for Python.  Pydra seeks to provide a solution that is easier to deploy, manage, use than existing projects.  This is on top of providing standard features such as fault tolerance.</p>
<p>Pydra was born out of a necessity.  Other projects being developed by the <a title="Oregon State University - Open Source Lab" href="http://osuosl.org">Open Source Lab</a> required a large amount of processing.  Rather than implementing parallelism specific to our application, we chose to build a generic distributed computing framework with the features missing in other solutions.  We see Pydra as a useful tool for future projects at the lab.</p>
<p><span id="more-215"></span></p>
<h3>Management and Security First</h3>
<p>A cluster is an inherently unstable and insecure application.  As more hardware is added, the chance for failure increases.  A distributed computing cluster is by definition provides remote code execution.  For these reasons management and <a title="Pydra - Security information" href="http://pydra-project.osuosl.org/wiki/security">security</a> were top priorities from the very beginning.  There are several solutions for parallel computing within python, but none include these features.</p>
<p>Pydra will provide a management interface to control every aspect of the cluster.  It will allow you to configure the cluster, monitor its health, and in some cases recover from failures.  It will also allow you to manage the task queue, and track task progress.  Some of these features have already been implemented, the rest are high up on the roadmap.</p>
<p>Security within Pydra extends beyond a simple password.  Even when hashed,  a password offers little security.  Sniffing the hashed password is all that is required to bypass the authentication.  Instead Pydra uses encryption key pairs within a handshake to ensure connections within the cluster are extremely secure.  Even if an intruder is able to view traffic within the cluster, they will be unable to obtain login credentials.</p>
<h3>Job Oriented Programming</h3>
<p>Pydra uses a Job or <a title="Pydra - About Tasks" href="http://pydra-project.osuosl.org/wiki/tasks">Task oriented programming model</a>.  users can <a title="Pydra - How to write tasks" href="http://pydra-project.osuosl.org/wiki/tasks_writing">write tasks</a> that logically encompass any task they need to perform with a predefined set of base classes and containers.  The base classes include the ability to write both sequential and parallel processes as Tasks, and any combination therein.</p>
<p>A MapReduce base class will also be included by 1.0.  The task framework is a more generic form of MapReduce and this style of task can be written already.  The MapReduce base class will just simplify the process.</p>
<h3>Technologies</h3>
<p>Pydra makes use of other APIs where possible.  I&#8217;d like development to be as abstracted from underlying technologies as much as possible.  We&#8217;d like to use the best tool for the job, and that may change over time.  RPC and distributed computing is a hot topic right now and there are some relatively new projects such as the recent multiprocessing module added in python 2.6.</p>
<ul>
<li><strong>Python 2.5</strong> is used for now, until dependencies are upgraded to python 2.6/3.0.  We are watching the time-lines closely.</li>
</ul>
<ul>
<li><strong>Twisted </strong>is used for all of the Remote Procedure Calls (RPC) and networking.  Twisted was chosen because it is a mature, well written API that has good cross platform support.  It also was works well for fault tolerance and security.</li>
</ul>
<ul>
<li><strong>Django</strong> is used for the management interface as well as Object Relational Mapping(ORM) tool.</li>
</ul>
<h3>RoadMap</h3>
<p>Pydra is still in its infancy, though much of the application has at least basic functionality.  Clusters can be configured and tasks run on them, but there is still a lot of work to do.  The task tracker contains a more detailed <a href="http://pydra-project.osuosl.org/roadmap">roadmap</a> and <a href="http://pydra-project.osuosl.org/report/2">version release</a> plan.</p>
<p>I would like to have a usable beta by the end of the summer and a 1.0 release in late fall / early December.  Its ambitious but we&#8217;ll hopefully have a summer of code student working on the project, potentially a student intern, and myself.  We&#8217;d love to have anyone from the community help out.  Contact <a href="mailto:peter(at)osuosl.org">peter(at)osuosl.org</a> if you are interested in the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/03/29/distributed-computing-with-pydra/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Building A Generic Widget Builder</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/03/25/building-a-generic-widget-builder/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/03/25/building-a-generic-widget-builder/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 01:39:07 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[RepresentMe]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=179</guid>
		<description><![CDATA[If your website generates useful data a great way to propagate it is by providing widgets.  A widget is a portable chunk of code that can be installed and executed within any separate HTML-based web page.  By providing widgets, owners of other websites can display a small portion of your website, in theirs.
Building [...]]]></description>
			<content:encoded><![CDATA[<p>If your website generates useful data a great way to propagate it is by providing widgets.  A widget is a portable chunk of code that can be installed and executed within any separate HTML-based web page.  By providing widgets, owners of other websites can display a small portion of your website, in theirs.</p>
<p>Building widgets is very easy, but building a widget editor and preview tool for each widget can be time consuming.  I wanted to build <em>at least</em> a half dozen widgets for <a title="RepresentMe - repme.org" href="http://repme.org">RepresentMe</a> so I came up with a Generic Widget Builder.  This tool will allow you to easily add new widgets each with their own editor and preview, requiring very little code.</p>
<p><span id="more-179"></span></p>
<h3>Overview</h3>
<p>This example will use the Lawkmakers By Zipcode widget.  It accepts a zipcode and displays the lawmakers for that zipcode.</p>
<h3>Step 1 - BuilderForm</h3>
<p>The <strong>BuilderForm</strong> is a Django Form that contains some common fields that most widgets will want, such as color and background.  Fields you add to the form will automatically be added to the preview page.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> repme_widgets.<span style="color: black;">builder</span>.<span style="color: black;">forms</span> <span style="color: #ff7700;font-weight:bold;">import</span> WidgetFormBase
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> LawmakersWidgetForm<span style="color: black;">&#40;</span>WidgetFormBase<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Form for a single lawmaker with a single issue
    &quot;&quot;&quot;</span>
    zipcode     = forms.<span style="color: black;">CharField</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<h3>Step 2 - Builder Tempate</h3>
<p>The builder template is a django template used to render the javascript or html code that will display the widget.  By defining it as a template we can take input from a form and give the user both the code neccesary for their customized widget, and a preview</p>
<pre>&lt;script type="text/javascript"&gt;
repme_host_url = "{{host}}";
repme_zipcode = "{{zipcode}}";
repme_frame_height = "340";
repme_frame_width = "220";
repme_bgcolor = "{{background_color}}";
repme_textcolor = "{{text_color}}";
repme_bordercolor = "{{border_color}}";
&lt;/script&gt;
&lt;script type="text/javascript" src="http://{{host}}/widgets/js/lawmakers.js"&gt;
&lt;/script&gt;</pre>
<p>Some values are not included in the form:</p>
<p><strong>Host</strong> - this comes from the settings file, this is required because the code must include an absolute url including hostname.</p>
<p><strong>Height/Width</strong> - The height and width for a widget is often fixed so we haven&#8217;t included it in the form.</p>
<h3>Step 3 - URL Handler For This Widget&#8217;s Builder</h3>
<p>All widget&#8217;s built with the Generic Widget Builder use the same handler, passing the form class and widget template as parameters.  These values will be used to customize the preview page to your widget.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> repme_widgets.<span style="color: black;">forms</span> <span style="color: #ff7700;font-weight:bold;">import</span> LawmakersWidgetForm
&nbsp;
<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^builder/lawmakers/$'</span>, builder, <span style="color: black;">&#123;</span><span style="color: #483d8b;">'form_class'</span>:LawmakersWidgetForm, <span style="color: #483d8b;">'widget_template'</span>:<span style="color: #483d8b;">'widgets/builder/lawmakers.html'</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>,</pre></div></div>

<h3>Step 4 - Rendering The Widget</h3>
<p>There are a few ways to build a widget.  They all result in an Iframe that loads a small portion of your website.  You can either call an Iframe directory, passing in your properties or use javascript to write the iframe to the document.  RepresentMe uses the latter because the code the users must cut-n-paste is simpler and easier to read or modify outside the builder.</p>
<p>Here is the javascript loader:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> fHeight <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">repme_frame_height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">navigator</span>.<span style="color: #660066;">userAgent</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;MSIE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
fHeight <span style="color: #339933;">=</span> fHeight <span style="color: #339933;">+</span> <span style="color: #CC0000;">7</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&amp;lt;iframe name=&quot;repme_lawmaker&quot; width=&quot;'</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">repme_frame_width</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot; height=&quot;'</span> <span style="color: #339933;">+</span> fHeight <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; scrolling=&quot;auto&quot; frameborder=&quot;0&quot; style=&quot;border-style: solid; border-width: 1px; border-color:'</span> <span style="color: #339933;">+</span> window.<span style="color: #660066;">repme_bordercolor</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">';&quot; allowtransparency=&quot;true&quot; hspace=&quot;0&quot; vspace=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; src=&quot;http://'</span> <span style="color: #339933;">+</span> window.<span style="color: #660066;">repme_host_url</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'/widgets/lawmakers/?zip='</span> <span style="color: #339933;">+</span> window.<span style="color: #660066;">repme_zipcode</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;amp;color='</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">repme_textcolor</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&amp;amp;bg_color='</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">repme_bgcolor</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot;&amp;gt;&amp;lt;/iframe&amp;gt;'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>The view called by this widget is just another django view, except its output is a much smaller window.</p>
<h3>Wrap Up</h3>
<p>You should now be able to easily build an editor and preview tool for your widget.  <a href="http://repme.org/widgets/builder/lawmakers/">Here</a> is the widget I discussed in action.  The rest of the widgets for RepresentMe are <a href="http://repme.org/widgets/">here</a>.</p>
<p><strong>RepresentMe</strong> is released under GPLv3, feel free to reuse the Generic Widget Builder with your site.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/03/25/building-a-generic-widget-builder/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Connecting A Web Application To Facebook (part 2)</title>
		<link>http://blogs.osuosl.org/kreneskyp/2009/03/24/connecting-a-web-application-to-facebook-part-2/</link>
		<comments>http://blogs.osuosl.org/kreneskyp/2009/03/24/connecting-a-web-application-to-facebook-part-2/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:17:27 +0000</pubDate>
		<dc:creator>peter</dc:creator>
		
		<category><![CDATA[RepresentMe]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[social media]]></category>

		<category><![CDATA[facebook]]></category>

		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blogs.osuosl.org/kreneskyp/?p=125</guid>
		<description><![CDATA[Facebook, Twitter, and other social media websites, also called the new media, are becoming a major part of our culture.  Facebook alone has 175 million active users.  They are a means to reach broad audiences and build enthousiasm.
This tutorial is part 2 of a series that will focus on connecting your existing web [...]]]></description>
			<content:encoded><![CDATA[<p>Facebook, Twitter, and other social media websites, also called the new media, are becoming a major part of our culture.  Facebook alone has 175 million active users.  They are a means to reach broad audiences and build enthousiasm.</p>
<p>This tutorial is part 2 of a series that will focus on connecting your existing web application to Facebook.  In <a title="Connecting A Web Application To Facebook (part 1)" href="http://blogs.osuosl.org/kreneskyp/2009/03/24/connecting-a-web-application-to-facebook-part-1/" target="_self">part 1</a> we connected your website to a Facebook app.  In this post I’ll show you how to update a users status and profile.  I’ll be using examples from <a title="RepresentMe - repme.org" href="http://repme.org" target="_blank">RepresentMe</a> a project built for the Apps For America contest.  This is a standalone webapp that leverages Facebook to deliver its message to a wider audience.</p>
<p><span id="more-125"></span></p>
<h3>Things you can update</h3>
<p>Once you have an account linked to a Facebook <strong>uid</strong> you can send several different forms of updates:</p>
<ul>
<li><strong>Status</strong> - This is short message telling what the Facebook User is doing.  It is shown at the top of their profile and wall, and in their friends wall.  It is the primary way that Facebook Users share information.</li>
<li><strong>Profile</strong> - A User can add a small box from each application to their profile.  This is displayed to anyone who visits their profile.</li>
<li><strong>News Feed</strong> - This is similar to the status but allows you to include more formatting and a few basic html tags.  Facebook has phased out the infinite sessions that this requires.  At some point they may enable this again.</li>
</ul>
<h3>Publishing Status Updates</h3>
<p>Publishing status updates from your app is a great way to let users show off what they do to their friends.  RepresentMe publishes user&#8217;s votes to their status.  We include a link back to the bill in question.  Any of their friends will be able to see these messages and get involved too.</p>
<h4>Step 1 - Authorize Updates</h4>
<p>Before you can publish status updates the user must grant your application permission to publish them.  This is done by including a FBML tag in your canvas template.</p>
<p>&lt;fb:prompt-permission perms=&#8221;status_update&#8221;&gt;<br />
    Grant permission for RepresentMe to update your status<br />
&lt;fb:prompt-permission perms=&#8221;status_update&#8221;&gt;</p>
<p>This tag will generate a link in the page that will take the user through the process to approve or deny the request.</p>
<h4>Step 2 - Initialize Facebook Object</h4>
<p>Once your app is granted permission you can start updating the status.   <strong>RepresentMe</strong> uses a script running in a cron job, more about that later. Since this is running outside Django the first thing the script needs to do is initialize the facebook object</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#initialize facebook</span>
fb = facebook.<span style="color: black;">Facebook</span><span style="color: black;">&#40;</span>FACEBOOK_API_KEY, FACEBOOK_SECRET_KEY<span style="color: black;">&#41;</span></pre></div></div>

<h4>Step 3 - Update Statuses!</h4>
<p>Now we&#8217;ll iterate over all of our link objects.  We&#8217;ll check for permission, then update their status</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> link <span style="color: #ff7700;font-weight:bold;">in</span> FacebookLink.<span style="color: black;">objects</span>.<span style="color: #008000;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    uid = link.<span style="color: black;">facebook_id</span>
    <span style="color: #008000;">str</span> = <span style="color: #483d8b;">'I updated your status!'</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> fb.<span style="color: black;">users</span>.<span style="color: black;">hasAppPermission</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'status_update'</span>, uid<span style="color: black;">&#41;</span>:
        fb.<span style="color: black;">users</span>.<span style="color: black;">setStatus</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span>, <span style="color: #008000;">False</span>, <span style="color: #008000;">True</span>, uid=uid<span style="color: black;">&#41;</span></pre></div></div>

<h4>Step 4 - Don&#8217;t Spam</h4>
<p>Facebook has guidelines for how often an application can update a User&#8217;s status.  They limit applications to 10 updates per day.  This is why our updates run as a script rather triggered directly by user actions.  <strong>RepresentMe</strong> only updates Users&#8217; statuses every 30 minutes with the last vote they placed. Rather than running the cron job every 30 minutes you can include a timestamp in your FacebookLink model to track updates.  This allows updates to propagate soon after a user action, and spreads out the requests to Facebook.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># get all links that have not been updated in the past 30 minutes</span>
delta = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">timedelta</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">30</span><span style="color: black;">&#41;</span>
past_timeout = <span style="color: #dc143c;">datetime</span>.<span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> + delta
q = Q<span style="color: black;">&#40;</span>feed_update_time__gt=past_timeout<span style="color: black;">&#41;</span> | Q<span style="color: black;">&#40;</span>feed_update_time=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
links = FacebookLink.<span style="color: black;">objects</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>q<span style="color: black;">&#41;</span></pre></div></div>

<h3>Updating Profiles</h3>
<p>Users can add a box from any application to their profile.  This box can be displayed in either the wall, or the boxes tab.  The differences are that the wall is more prominent, and the wall is much smaller (184&#215;250px).</p>
<h4>Step 1 - Set the profile content</h4>
<p>The profile content is cached FBML or HTML and cannot contain Iframes.  You should create a view or function that generates the content.  <strong>RepresentMe</strong> is reusing the view handler for the <a title="Lawmakers by zipcode" href="http://repme.org/widgets/builder/lawmakers/" target="_blank">Lawmakers By Zipcode</a> widget with a template resized to fit within the wall profile.  We&#8217;ll call the view using Httplib2 and set the profile content to the result.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> update_profile<span style="color: black;">&#40;</span>fb, link<span style="color: black;">&#41;</span>:
    <span style="color: #808080; font-style: italic;"># get zipcode from profile</span>
    <span style="color: #dc143c;">profile</span> = link.<span style="color: #dc143c;">user</span>.<span style="color: black;">get_profile</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #008000;">zip</span> = <span style="color: #dc143c;">profile</span>.<span style="color: black;">zipcode</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># get content</span>
    conn = httplib2.<span style="color: black;">Http</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    url = <span style="color: #483d8b;">'http://repme.org/facebook/profile/?zip=%s'</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">zip</span>
    response, html = conn.<span style="color: black;">request</span><span style="color: black;">&#40;</span>url, <span style="color: #483d8b;">'get'</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># set content for wall (profile_main) and boxes (profile)</span>
    uid = link.<span style="color: black;">facebook_id</span>
    fb.<span style="color: #dc143c;">profile</span>.<span style="color: black;">setFBML</span><span style="color: black;">&#40;</span>uid=uid, profile_main=<span style="color: #66cc66;">&lt;</span>/code<span style="color: #66cc66;">&gt;&lt;</span>code<span style="color: #66cc66;">&gt;</span>html, <span style="color: #dc143c;">profile</span>=html<span style="color: black;">&#41;</span></pre></div></div>

<p>This example updates both profile boxes at the same time.  Its optional to update both but this function will clear the cache on any box that isn&#8217;t included.  The user can select the box appear in either the wall or boxes tab, so its best to update the cache for both at the same time.</p>
<h4>Step 2 - Add Section Button</h4>
<p>Users must manually add your application to their profile.  This authorization is granted using a FBML tag.  Note this button will not be displayed untill you have set content in their profile<br />
&lt;fb:add-section-button section=&#8221;profile&#8221; /&gt;</p>
<h4>Step 3 - Adding When The User Installs You Application</h4>
<p>The <strong>add section button</strong> only appears after you have set content for the user to add.  Facebook recommends that you do not set the profile FBML until you have enough data to display.  In our case <strong>RepresentMe</strong> has likely already collected that data.  We&#8217;ll set the profile FBML as soon as the user links their account.  This way the user will immediately see the <strong>add section button</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">@facebook.<span style="color: black;">require_add</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> authorize<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
...
  <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">user</span>.<span style="color: black;">is_active</span>:
      <span style="color: #808080; font-style: italic;"># successful login, save facebook info!</span>
      link = FacebookLink<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      link.<span style="color: #dc143c;">user</span> = <span style="color: #dc143c;">user</span>
      link.<span style="color: black;">facebook_id</span> = request.<span style="color: black;">facebook</span>.<span style="color: black;">uid</span>
      link.<span style="color: black;">facebook_session</span> = request.<span style="color: black;">facebook</span>.<span style="color: black;">session_key</span>
      link.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
      <span style="color: #808080; font-style: italic;"># update their profile fbml so its ready,</span>
      <span style="color: #808080; font-style: italic;"># incase they add the app to the profile right away</span>
      fb = facebook.<span style="color: black;">Facebook</span><span style="color: black;">&#40;</span>FACEBOOK_API_KEY, FACEBOOK_SECRET_KEY<span style="color: black;">&#41;</span>
      update_profile<span style="color: black;">&#40;</span>link, fb<span style="color: black;">&#41;</span></pre></div></div>

<h4>Step 4 - Script To Keep Profile Up To Date</h4>
<p>Your application should keep the profile FBML cache up to date.  <strong>RepresentMe</strong> uses a simple script in a cron job.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># get all links - this should only run every 30 mins</span>
fb = facebook.<span style="color: black;">Facebook</span><span style="color: black;">&#40;</span>FACEBOOK_API_KEY, FACEBOOK_SECRET_KEY<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> link <span style="color: #ff7700;font-weight:bold;">in</span> FacebookLink.<span style="color: black;">objects</span>.<span style="color: #008000;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
update_profile<span style="color: black;">&#40;</span>fb, link<span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blogs.osuosl.org/kreneskyp/2009/03/24/connecting-a-web-application-to-facebook-part-2/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
