<?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>John Bafford &#187; open source</title>
	<atom:link href="http://bafford.com/tag/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://bafford.com</link>
	<description>coding in purple</description>
	<lastBuildDate>Sat, 03 Oct 2009 19:57:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Twitterslurp open source release</title>
		<link>http://bafford.com/2009/06/30/twitterslurp-open-source-release/</link>
		<comments>http://bafford.com/2009/06/30/twitterslurp-open-source-release/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 22:44:35 +0000</pubDate>
		<dc:creator>John Bafford</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitterslurp]]></category>

		<guid isPermaLink="false">http://bafford.com/?p=346</guid>
		<description><![CDATA[Last month, I wrote about Twitterslurp, the twitter searching tool I developed at The Bivings Group, which displays a constantly-updating stream of tweets, as well as a leaderboard and stats graphs. Today, we are very happy to release it as open source. You can download Twitterslurp from its Google Code project page at http://twitterslurp.googlecode.com/. Since [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bafford.com/2009/05/20/tracking-phptek-tweets-with-twitterslurp">Last month</a>, I wrote about Twitterslurp, the twitter searching tool I developed at <a href="http://www.bivings.com/">The Bivings Group</a>, which displays a constantly-updating stream of tweets, as well as a leaderboard and stats graphs.</p>
<p>Today, we are very happy to <a href="http://www.bivingsreport.com/2009/the-bivings-group-releases-twitterslurp-to-open-source-community/">release it as open source</a>. You can download Twitterslurp from its Google Code project page at <a href="http://twitterslurp.googlecode.com/"> http://twitterslurp.googlecode.com/</a>.</p>
<p>Since last month, I&#8217;ve made a lot of changes to improve the quality (and ease of configuration) of the Twitterslurp code. Twitterslurp&#8217;s error handling has been improved, and I added the ability to start and stop the tweet stream and show more than the most recent 20 tweets. Our graphics team also created a spiffy logo.</p>
<p>Yesterday and today, Twitterslurp has been driving a video wall of tweets at the <a href="http://www.personaldemocracy.com/twitter/">Personal Democracy Forum</a> conference in NYC. The conference, which just ended, had over 17,000 tweets in the last two days.</p>
<p>Previously, we ran test versions of Twitterslurp during mysqlconf and <a href="http://twitter.bivings.com/tek09/">php|tek</a>, and officially on behalf of the <a href="http://twitter.bivings.com/dpc/">Dutch PHP Conference</a>. Twitterslurp started as a project for a client to allow them to track tweets, and give members of their website rewards for tweeting with a particular hashtag.</p>
<p>We&#8217;ve also set up a copy of Twitterslurp <a href="http://twitter.bivings.com/twitterslurp/">tracking itself</a>.</p>
<p>We&#8217;d love for you to check out Twitterslurp, and we&#8217;re open to any and all feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://bafford.com/2009/06/30/twitterslurp-open-source-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aggregate Map Tools, Part 1: GlobalMapTiles</title>
		<link>http://bafford.com/2009/02/26/aggregate-map-tools-part-1-globalmaptiles/</link>
		<comments>http://bafford.com/2009/02/26/aggregate-map-tools-part-1-globalmaptiles/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 20:53:29 +0000</pubDate>
		<dc:creator>John Bafford</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://bafford.com/?p=184</guid>
		<description><![CDATA[My fourth open source release this week comes from work I&#8217;ve done for my employer, The Bivings Group. Today, we are releasing a set of code that assists with aggregating markers on a Google Map. Our clients wanted to be able to display markers on a map reflecting the locations of people who provided their [...]]]></description>
			<content:encoded><![CDATA[<p>My fourth open source release this week comes from work I&#8217;ve done for my employer, <a href="http://www.bivings.com/">The Bivings Group</a>. Today, we are releasing a set of code that assists with aggregating markers on a Google Map. Our clients wanted to be able to display markers on a map reflecting the locations of people who provided their location (city, state, zip, and in some cases, street address), but with tens of thousands of expected sign-ups, it&#8217;s not feasible to display all the points on the map at once.</p>
<p><span id="more-184"></span></p>
<p>One of the challenges with displaying a map with lots of markers is that if there are too many markers in one location, the placemarks themselves quickly become an unmanageable sea that obscures the map. In some cases, this is the desired effect, but in our case, we wanted to present a cleaner map that showed a single marker that provided an indication of the number of people present in an area. (Less markers also has the advantage of loading faster.) </p>
<p>One solution to this problem is, instead of showing all of the markers all at once, you can group all of the markers that are close together into one. But, how do you determine if two locations are &#8220;close together&#8221; so that you can do that aggregation?</p>
<h3>Geohash</h3>
<p>One way is to use a <a href="http://en.wikipedia.org/wiki/Geohash">geohash</a>, which takes a latitude and longitude coordinate and, using a hashing algorithm, mixes the two numbers together into a a string that represents the position. More accurately, it represents a box which contains the coordinate in question. For example, the coordinates of the TBG office (38.9193540 °N,  77.0705180 °W) is represented by the geohash <code>dqcjqjncwv2t9</code>. This string has an interesting property: as you remove characters from the string, you get a less accurate representation of the location &#8211; the box gets larger. With a list of addresses stored in geohash format, you can do a search for all of the addresses whose geohashes all start with the same characters.</p>
<p>However, because of the way geohashes are encoded, different geohashes have different shapes, there is some overlap between different geohashes, and in some cases, removing a character from a geohash can result in a larger shape on the map that doesn&#8217;t cover the entirety of the more specific geohash. As a result, we determined that they weren&#8217;t suitable for our needs: because of the overlap, it was possible for one location to appear to be in the space covered by multiple geohashes, thus potentially leading to unreliable counting.</p>
<h3>Quadtree</h3>
<p>Some further searching led me to <a href="http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/">maptiler.org</a>, which provided an alternate answer. Since the Earth is a sphere, it can be broken up into quadrants (corresponding to the four hemispheres: north west, north east, south west, and south east), which (with some stretching) are square. Each of those quadrants can be subdivided into subquadrants, and those into more subquadrants, each of which contains one quarter of the total area covered by the quadrant that contains it.</p>
<p>In fact, this is how Google Maps map tiles work. When zoomed all the way out, the entire earth is represented as a 256 x 256 pixel map tile image. Each larger zoom level contains four times the number of map tiles as the previous zoom level, with no overlap. At the maximum zoom level (20), the entire Earth is represented by 4<sup>19</sup> = 274,877,906,944 256 x 256 pixel images.</p>
<p>How does that help us? Well, if we number each of the quadrants (0 = NW, 1 = NE, 2 = SW, 3 = SE), and add a digit for each sub-quadrant we &#8220;zoom in&#8221; to, we get a string that represents a square on the map at a zoom level equivalent to the length of the string. For example, the coordinates of the TBG office can be represented as <code>0320100322312003121</code>. If we remove a character from the hash, it&#8217;s guaranteed that the larger space contains all the possible locations in the smaller space. There&#8217;s no overlap between hashes of the same length. This means we&#8217;re guaranteed the accurate counting we wanted. And we can very conveniently scale our searches of the database of addresses with the zoom level of the map window we&#8217;re viewing the results in.</p>
<h3>Pulling it all Together: GlobalMapTiles</h3>
<p>On the client&#8217;s map page, whenever the map position or zoom level changes, we send a few ajax queries to the web server with quadtree codes covering the map window. The server obligingly searches the database for the number of people in the area represented by the code, and returns a result list containing the number of people in the quadtree a level or two deeper. We then take the results, convert the quadtree code back into a coordinate on the map, and add a marker at its center.</p>
<p>As luck would have it, there&#8217;s a Python script, <code>globalmaptiles.py</code> on the maptiler.org page that handles the conversion from latitude and longitude to these quadtree coordinates. Although Python is a fine language (and some of the most fun code I&#8217;ve written has been in Python), we needed this code in PHP and JavaScript. But that&#8217;s ok. The code is almost entirely simple mathematical operations, and that&#8217;s very easy to port from Python to JavaScript and PHP. This port, plus some additions of my own to facilitate turning a quadtree string back into its bounding coordinates on the map is what we&#8217;re releasing today.</p>
<p>This is, of course, only half of the solution. We now have a system by which we can identify locations on the map which are nearby and aggregate them together, but we still need a way to pull that information out of the database and send it on-demand to the web browser to be displayed. That&#8217;s a more interesting problem (and solution). I&#8217;m still refining that code and adding additional functionality, and we&#8217;ll release that soon, when we&#8217;re satisfied with it.</p>
<p>As the original implementation was licensed with the X11 license, GlobalMapTiles is also licensed under the X11 license. For more details on how to use it, and to download, see the <a href="/software/aggregate-map-tools/">Aggregate Map Tools</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://bafford.com/2009/02/26/aggregate-map-tools-part-1-globalmaptiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Week of Open Source Releases: xarfs 0.2</title>
		<link>http://bafford.com/2009/02/25/week-of-open-source-releases-xarfs-02/</link>
		<comments>http://bafford.com/2009/02/25/week-of-open-source-releases-xarfs-02/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 17:42:32 +0000</pubDate>
		<dc:creator>John Bafford</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[fuse]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[macfuse]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[xar]]></category>
		<category><![CDATA[xarfs]]></category>

		<guid isPermaLink="false">http://bafford.com/?p=154</guid>
		<description><![CDATA[This week&#8217;s third piece of software is xarfs, a proof-of-concept MacFUSE-based filesystem that mounts xar archive files as a read-only filesystem. I wrote xarfs because I wanted an easy way to be able to inspect Mac OS X Installer package files, which as of Mac OS X 10.5, began to be xar archives. In particular, [...]]]></description>
			<content:encoded><![CDATA[<p>This week&#8217;s third piece of software is <a href="/software/xarfs/">xarfs</a>, a proof-of-concept <a href="http://code.google.com/p/macfuse/">MacFUSE</a>-based filesystem that mounts <a href="http://code.google.com/p/xar/">xar</a> archive files as a read-only filesystem.</p>
<p>I wrote xarfs because I wanted an easy way to be able to inspect Mac OS X Installer package files, which as of Mac OS X 10.5, began to be xar archives. In particular, I wanted to be able to <code>lsbom</code> the package manifest in order to see what files were being modified. (In retrospect, it probably would have been easier, though less satisfying, to have written a simple tool that extracts only the package manifest and lists its contents.)</p>
<p>Although xarfs provides easy access to view the contents of a xar archive, it has some pretty significant limitations. Besides having a rather clumsy user interface, and presenting only a read-only interface to xar files, it handles large files spectacularly poorly, decompressing them entirely into memory regardless of how much of the file is being accessed. (This is a limitation in the xar API.) It&#8217;s also written in Objective C using MacFUSE&#8217;s framework. This rather limits its portability; an implementation using the regular FUSE API would probably allow xarfs to work on Linux.</p>
<p>If anyone&#8217;s interested in this, it&#8217;s probably possible to resolve some of its deficiencies and make it a lot more useful. Let me know if you find it helpful.</p>
<p>xarfs is licensed under the three-clause BSD license. For more information, or to download, see the <a href="/software/xarfs/">xarfs page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bafford.com/2009/02/25/week-of-open-source-releases-xarfs-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Week of Open Source Releases: slow 1.0</title>
		<link>http://bafford.com/2009/02/24/week-of-open-source-releases-slow-10/</link>
		<comments>http://bafford.com/2009/02/24/week-of-open-source-releases-slow-10/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 18:30:40 +0000</pubDate>
		<dc:creator>John Bafford</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[slow]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://bafford.com/?p=80</guid>
		<description><![CDATA[The second piece of software I&#8217;m releasing this week is a unix command line tool called slow. Slow is a tool that makes it easy to cause another process to run slowly. Slow does this by taking advantage of two signals, SIGSTOP and SIGCONT, which respectively stop and re-start a unix process&#8217; execution. I&#8217;ve used [...]]]></description>
			<content:encoded><![CDATA[<p>The second piece of software I&#8217;m releasing this week is a unix command line tool called <a href="/software/slow/">slow</a>. Slow is a tool that makes it easy to cause another process to run slowly.</p>
<p>Slow does this by taking advantage of two signals, SIGSTOP and SIGCONT, which respectively stop and re-start a unix process&#8217; execution.</p>
<p>I&#8217;ve used this tool to prevent long-running cpu-bound processes from consuming an entire cpu to improve performance of other processes on the machine. I&#8217;ve also used it to slow part of a two-part data import process where temporary data files could be created much faster than they could be processed and removed, running the risk of low disk space conditions.</p>
<p>Slow is released under the GPL v3. For documentation, more information, and download links for slow and its source code, please see <a href="/software/slow/">slow&#8217;s web page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bafford.com/2009/02/24/week-of-open-source-releases-slow-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safari 4 beta and WebKit release analysis</title>
		<link>http://bafford.com/2009/02/24/safari-4-beta-and-webkit-release-analysis/</link>
		<comments>http://bafford.com/2009/02/24/safari-4-beta-and-webkit-release-analysis/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 17:20:27 +0000</pubDate>
		<dc:creator>John Bafford</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://bafford.com/?p=144</guid>
		<description><![CDATA[Earlier today, Apple released a beta version of Safari 4, with the version number 528.16. As is common knowledge, Safari is based on the open-source WebKit rendering engine, which releases nightly builds. For reference, the current WebKit version is 520.1+. Because WebKit is open source, using WebKit&#8217;s version history tracker, it&#8217;s possible to determine the [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today, Apple released a beta version of <a href="http://www.apple.com/safari/download/">Safari 4</a>, with the version number 528.16.</p>
<p>As is common knowledge, Safari is based on the open-source <a href="http://webkit.org/">WebKit</a> rendering engine, which releases <a href="http://nightly.webkit.org/">nightly builds</a>. For reference, the current WebKit version is 520.1+.</p>
<p>Because WebKit is open source, using WebKit&#8217;s <a href="http://trac.webkit.org/">version history tracker</a>, it&#8217;s possible to determine the following interesting information:</p>
<p>* The <a href="http://trac.webkit.org/browser/branches/Safari-6528">Safari-6528</a> branch was created on January 29th based on the state of the WebKit trunk at r40289, from January 27th.</p>
<p>* There have been 75 merges of code (presumably bug fixes) into the 6528 branch since then. The last of these merges was r41097 (merging r41091) on February 19.</p>
<p>* The release is tagged in WebKit svn as <a href="http://trac.webkit.org/changeset/41182">r41182</a>, the<a href="http://trac.webkit.org/browser/releases/Apple/Safari%204%20Public%20Beta?rev=41182">/releases/Apple/Safari 4 Public Beta</a> tag.</p>
<p>This means that the Safari 4 beta is based roughly on the state of WebKit as it was at the end of January, one month behind current development. Considering the importance of WebKit to Safari in general, and Mac OS X as a whole, a one month delay for QA purposes is probably pretty good.</p>
<p>Kudos to all of the people working on WebKit! Keep up the good work!</p>
]]></content:encoded>
			<wfw:commentRss>http://bafford.com/2009/02/24/safari-4-beta-and-webkit-release-analysis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Week of Open Source Releases: Unlockupd 1.0.2</title>
		<link>http://bafford.com/2009/02/23/week-of-open-source-releases-unlockupd-102/</link>
		<comments>http://bafford.com/2009/02/23/week-of-open-source-releases-unlockupd-102/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 17:24:12 +0000</pubDate>
		<dc:creator>John Bafford</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[unlockupd]]></category>

		<guid isPermaLink="false">http://bafford.com/?p=75</guid>
		<description><![CDATA[The first piece of software I&#8217;m releasing this week is an updated version of Unlockupd. Unlockupd is a Mac OS X daemon that works around a bug in lookupd, a system service which is required for proper operation of Mac OS X 10.0 &#8211; 10.4. If lookupd fails, the system quickly becomes unusable. Unlockupd periodically [...]]]></description>
			<content:encoded><![CDATA[<p>The first piece of software I&#8217;m releasing this week is an updated version of <a href="/software/unlockupd/">Unlockupd</a>. Unlockupd is a Mac OS X daemon that works around a bug in lookupd, a system service which is required for proper operation of Mac OS X 10.0 &#8211; 10.4. If lookupd fails, the system quickly becomes unusable. Unlockupd periodically checks lookupd’s status and forces it to restart should it fail.</p>
<p>Fortunately, the bug has been fixed in Mac OS X 10.5, which does not have a lookupd service, but it was present in Mac OS X 10.3 and 10.4.</p>
<p>Unlockupd was first released in 2004, and it really should have been released under an open source back then. Better late than never, though. At this point, it&#8217;s really more of an historical relic than a useful program, but hopefully someone will find some use with the code.</p>
<p>More information is available on  <a href="/software/unlockupd/">Unlockupd&#8217;s web page</a>, including download links for Unlockupd and its source code. Unlockupd is licensed under the GPL v3.</p>
]]></content:encoded>
			<wfw:commentRss>http://bafford.com/2009/02/23/week-of-open-source-releases-unlockupd-102/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Blog</title>
		<link>http://bafford.com/2009/02/22/new-blog/</link>
		<comments>http://bafford.com/2009/02/22/new-blog/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 21:06:06 +0000</pubDate>
		<dc:creator>John Bafford</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://bafford.com/?p=69</guid>
		<description><![CDATA[Hi! I&#8217;m John Bafford, and welcome to my website. Long overdue, this new website and blog are now live. I&#8217;ll be talking mostly about PHP and related technology — I&#8217;ve spent the last almost ten years writing PHP (and JavaScript) code, as well as a smattering of Perl, Python, and other languages, after many prior [...]]]></description>
			<content:encoded><![CDATA[<p>Hi! I&#8217;m John Bafford, and welcome to my website.</p>
<p>Long overdue, this new website and blog are now live. I&#8217;ll be talking mostly about PHP and related technology — I&#8217;ve spent the last almost ten years writing PHP (and JavaScript) code, as well as a smattering of Perl, Python, and other languages, after many prior years writing in C/C++. Expect some Mac talk as well, on occasion.</p>
<p>To &#8220;celebrate&#8221; the new website, throughout this week, I&#8217;ll be doing a number of (in some cases, very belated) open source releases of some software I&#8217;ve worked on over the years. There will be a somewhat Mac focus to some of these releases, but even it you don&#8217;t have a Mac, hopefully, you&#8217;ll still find them interesting enough to follow along, and I&#8217;ll get to the PHP-related content soon enough.</p>
<p>If you have questions or comments, feel free to comment here, or send me an email from the feedback form via the button at the bottom of the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://bafford.com/2009/02/22/new-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
