<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>George Schneeloch</title>
    <link>http://www.georgeschneeloch.com/blog</link>
    <description></description>
    <pubDate>Tue, 20 Aug 2013 13:41:54 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Migrating to Maps v2 for Android</title>
      <link>http://www.georgeschneeloch.com/blog/2013/01/27/migrating-to-maps-v2-for-android</link>
      <pubDate>Sun, 27 Jan 2013 17:55:53 EST</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>kCE9xVSGGCu1FDSaJM_UETZ21Rc=</guid>
      <description>Migrating to Maps v2 for Android</description>
      <content:encoded><![CDATA[<p>In December Google released a new version of their <a href="https://developers.google.com/maps/documentation/android/">Maps API</a>. It's a complete rewrite but generally an improvement. I've been working on integrating it with BostonBusMap and it looks like I can leave my app mostly unchanged, with a few minor exceptions. My overall impression is, it's less customizable but things generally need less customization so it sort of balances out.</p>
<p>The major change for me is how markers are handled. In the old API you could provide a Drawable for a marker, which might change state depending on if it was selected. Popups didn't exist so I used <a href="https://github.com/jgilfelt/android-mapviewballoons">android-mapviewballoons</a>. The new marker classes take bitmaps (or other resources) which don't change every time <code>draw()</code> is called. The new Maps are drawn in a 3D environment and I guess they couldn't provide this flexibility. Same goes with the new popups, which <a href="http://stackoverflow.com/questions/14475059/custom-infowindow-in-google-map-android-v2">aren't live Views</a> and <a href="http://stackoverflow.com/questions/13861210/open-url-from-marker-android-google-maps-v2">don't handle clicks</a> on a part of the whole popup.</p>
<p>These aren't deal breakers though. On the plus side, I got to remove RouteOverlay and BusOverlay, whose functionality is now mostly handled in the Maps library. Maps are now cached better than they were before which should reduce bandwidth needs for people. There is a prohibition on navigation-style apps, which doesn't really affect BostonBusMap.</p>
<p>The migration work is nearly done and it boils down to:</p>
<ul>
<li>switching libraries and API Keys</li>
<li>changing BusDrawable, which drew an arrow in the direction of the bus, to be a bunch of static bus icons instead</li>
<li>using old popup balloon layout xml in new popup views, and removing the rest of android-mapviewballoons</li>
<li>learning about and using fragments. Installing the Support Fragments library, using SupportMapFragment instead of MapActivity</li>
<li>Replacing the links in the popup with a popup menu which is triggered on clicking the popup window</li>
<li>Replacing references to overlays with MapManager, a class which wraps around GoogleMap and keeps track of Markers and shapes (route lines)</li>
<li>Minor changes to listen for taps or to move the camera to a new location</li>
<li>Remove references to MyLocationOverlay, deal with GoogleMap directly instead</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Projects</title>
      <link>http://www.georgeschneeloch.com/blog/2013/01/27/projects</link>
      <pubDate>Sun, 27 Jan 2013 17:42:51 EST</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>TuB8fLS0FuXFTLGwKipA99NO2dY=</guid>
      <description>Projects</description>
      <content:encoded><![CDATA[<p>Two projects my former coworkers made that are pretty neat and worth looking at:</p>
<ul>
<li><a href="http://github.com/skermes/review">Code review tool</a> written using Sinatra and haml. It allows you to annotate diffs against git branches which are then shared with other people involved in the code review. You just double click on the area you want to leave a comment, write something in the annotation box, then send the URL for the review to the other people involved for them to look at.</li>
<li><a href="http://github.com/babbaco/watson">Watson</a>, a chatbot for <a href="http://www.campfirenow.com">Campfire</a>. It provides an easy interface to run things like deployment scripts, which are also logged and broadcast to everybody because it's done in the chatroom. There is a plugin API which makes it easy to extend for whatever purpose</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Concurrency in BostonBusMap</title>
      <link>http://www.georgeschneeloch.com/blog/2012/10/09/concurrency-in-bostonbusmap</link>
      <pubDate>Tue, 09 Oct 2012 12:57:15 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>n8W5Mn-2Kjh2xQjKOwl4oGXr2g4=</guid>
      <description>Concurrency in BostonBusMap</description>
      <content:encoded><![CDATA[<p>I've been going through BostonBusMap over the past week replacing certain pieces of code with code that uses <a href="http://code.google.com/p/guava-libraries/">Google Guava</a>. It's mostly an incremental improvement, but every little bit helps. In particular I like that many of their data structures forbid null values, and in particular I like the Immutables.</p>
<p>I've been reading through <a href="http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601">Java Concurrency in Practice</a> to refresh on what that's supposed to look like. BostonBusMap, like most Android apps, uses a UI thread and one or more background threads. It's not complicated but it's been enough to cause problems in the past. Usually I just fix the pieces that cause a problem. When the database was throwing an exception regarding multiple concurrent accesses, I synchronized the methods. When a View was complaining about being accessed from the background thread, I fixed that specific problem. One thing I like about the book is that it sticks to a pattern, emphasizing documentation. I like the <code>@GuardedBy</code> attribute that indicates what needs synchronization, and on what lock.</p>
<p>Concurrency is not documented in the app at all, mostly because I'm the only one working on it and it seemed obvious at the time what threads would use which methods. I went through the code to overhaul it a bit, using ImmutableMaps, Sets, and Lists to guarantee that certain objects could be used by multiple threads on a read-only basis. Synchronization is easy enough when implementing a class but I've often updated certain pieces of code later on without updating synchronization, making it unreliable. I'm currently trying to confine explicit synchronization to database access and small, well defined objects.</p>
<p>I've also been making an effort to reduce the debugging stage of adding new features. It's generally pretty time consuming and less fun than implementation. Part of it is being more aware when I'm adding the feature, and another part is structuring the code to reduce possible errors. Guava discourages <code>null</code> in general. I used to like <code>null</code> because it produces the error immediately, where an empty container would cause similar code to silently continue. I guess it depends on what the rest of the code is supposed to do. Maybe it would be better to assert a non-zero length?</p>]]></content:encoded>
    </item>
    <item>
      <title>Sorting Music</title>
      <link>http://www.georgeschneeloch.com/blog/2012/10/03/sorting-music</link>
      <pubDate>Wed, 03 Oct 2012 15:41:17 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>V_59ci3JJHujkK7IRyWhY6c7Lbc=</guid>
      <description>Sorting Music</description>
      <content:encoded><![CDATA[<p>The more and more I think about it, alphabetical order doesn't make much sense for digital storage. It's a system meant for human eyes, which divides a collection into 26 buckets (depending on language and other symbols), and then 26 sub-buckets for the second letter, and so on, until you reach a group which is easy to browse one after another. <a href="http://en.wikipedia.org/wiki/Alphabetical_order">The Wikipedia article</a> on the subject discusses various other issues like the word 'the', spaces, and abbreviations.</p>
<p>Generally when people talk about it regarding computers, they compare each character numerically, which are usually laid out in alphabetical order in Unicode and ASCII. It doesn't have a strong rationalle but it's consistent and generally good enough for displaying the list to people.</p>
<p>I've been thinking about this mostly in regard to music stores, where the CDs and records are sorted by artist title. Many online music services cluster artists by similarity, but there's no obvious way to order multiple dimensions into a single consistent ordering. At the <a href="http://mahout.apache.org">Mahout</a> talk I went to a little while ago Ted Dunning mentioned projecting multiple dimensions to a single dimension using a <a href="https://www.google.com/search?sourceid=chrome&amp;client=ubuntu&amp;channel=cs&amp;ie=UTF-8&amp;q=random+projection+mapping#hl=en&amp;safe=off&amp;client=ubuntu&amp;hs=SHC&amp;channel=cs&amp;sclient=psy-ab&amp;q=random+projection+dimensionality+reduction&amp;oq=random+projection+dimen&amp;gs_l=serp.3.0.0j0i30l2j0i8i30.5879.6489.0.7796.5.5.0.0.0.0.216.542.3j1j1.5.0.les%3B..0.0...1c.1.Z7VSa-gIDM8&amp;pbx=1&amp;bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&amp;fp=9abb5b05aa09b6fc&amp;biw=1301&amp;bih=682">random projection</a> which worked well enough for clustering purposes. It doesn't need to be a perfectly consistent sort. It would be awesome if certain sections of a music store corresponded to clusters, where people could browse in person and know they are looking at artists that generally match their tastes. Or they could head to the other side of the store and look at something completely different. That would give physical music stores a clear value over online websites where browsing is less natural and most things are represented as lists.</p>]]></content:encoded>
    </item>
    <item>
      <title>receipt-schema</title>
      <link>http://www.georgeschneeloch.com/blog/2012/09/22/receipt-schema</link>
      <pubDate>Sat, 22 Sep 2012 13:30:47 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>pcEMYIIMSl7dZWm3OiOGYd4UPOk=</guid>
      <description>receipt-schema</description>
      <content:encoded><![CDATA[<p>I had this idea a while ago for a schema for restaurant (or similar) receipts. There's a lot of hassle in splitting the check, and even existing bill splitting apps require a lot of manual work. I started a repository with a sample Android app, located <a href="http://github.com/bostonbusmap/receipt-reader">here</a>. The basic idea is that there would be a QR code on receipts which would contain a URL, something like receipt://data_here, or maybe something http based so people without the app could view it on their phones.</p>
<p>All receipt data would need to be encoded in the URL. I guess I could do something internet based but for now I'm working with the challenge of doing it without that. The <a href="http://en.wikipedia.org/wiki/QR_code">QR code</a> should be small in order to be easily read from the bottom of a receipt, which has been a challenge. I had figured that it wouldn't be a problem given how little data is in a receipt, but the limit is actually really small. Maybe there could be a hybrid method, where the really imporant information is in the URL, and less important information is downloaded if available.</p>
<p>The schema basically stores the important pieces of the receipt data, like the title and price of each item, as well as the restaurant name and address. Layout is currently not defined, but I suppose you could encode that in the QR code as well. That's an interesting challenge too, creating a super tiny layout markup language capable of fitting neatly in a URL argument. I'm currently harcoding a printf-style string in the app and displaying all text in one giant textbox.</p>
<p>Of course the real challenge is in getting restaurants or cash register software companies to adopt a schema, some of who still use pen and paper. But the software part is an interesting challenge, so I figured why not.</p>]]></content:encoded>
    </item>
    <item>
      <title>Replicator 2</title>
      <link>http://www.georgeschneeloch.com/blog/2012/09/20/replicator-2</link>
      <pubDate>Thu, 20 Sep 2012 16:34:01 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>ahzL8DykY1_yerzeoq1U8PyNvRw=</guid>
      <description>Replicator 2</description>
      <content:encoded><![CDATA[<p>I'm a little disappointed by the decision by <a href="http://www.makerbot.com">Makerbot</a> to go closed source in their new software <a href="http://www.makerbot.com/makerware">Makerware</a> and hardware. I have hacked around with <a href="http://replicato.rg">Replicatorg</a> and I'm not sure I'll get the opportunity to do that with Makerware (although I understand that Replicatorg was in desperate need of replacement.) It's also disheartening to see a company work with its community base and then turn its back. I don't really understand the reason for keeping Makerware closed given that their product is hardware and that Makerware will not be worth much without it.</p>
<p>On the other hand, if Makerbot were always a closed source company, would anyone care about this decision? I suppose not, but the community is incredibly important for a company like that which works with something experimental. Maybe it doesn't matter if the hardware is "open". Most hardware isn't. But where will they draw the line? Sealing off components in an attempt to prevent cloning? Requiring some sort of NDA to those that do want to tinker with the hardware? Will add-ons need licensing? I'm also curious what the Makerbot developers program will require. Will I be able to write a plugin for Makerware which also works for a competing piece of software? Maybe those questions will be answered favorably, but in any case there is a lack of trust between the community and the company.</p>]]></content:encoded>
    </item>
    <item>
      <title>Familiarity index</title>
      <link>http://www.georgeschneeloch.com/blog/2012/09/18/similarity-index</link>
      <pubDate>Tue, 18 Sep 2012 02:18:31 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>tx9aSmDejGaBv-eCTYPZ8bwBWzc=</guid>
      <description>Familiarity index</description>
      <content:encoded><![CDATA[<p>I've been playing with the Echo's Nest plugin I wrote, and I wanted to see what would happen when I set <code>familiarity</code> to be between 0% and 10%. I'm kind of interested in seeing what's incredibly wildly different from the Evens, but here's the list I got:</p>
<ul>
<li>Ferdinand</li>
<li>Rem</li>
<li>The New Order</li>
<li>Don't Know</li>
<li>Papa</li>
<li>Kean</li>
<li>1994</li>
<li>The Journey</li>
<li>214</li>
<li>Beach Boyz</li>
<li>Techno</li>
<li>202</li>
<li>207</li>
<li>???</li>
<li>...</li>
<li>Japanese</li>
<li>Mp3</li>
<li>Uncle</li>
<li>aaaaa</li>
<li>Musa</li>
<li>02</li>
<li>Desconocido</li>
<li>26west</li>
<li>201</li>
<li>Race The Fray</li>
<li>Unbekannt</li>
<li>Unknown Artists</li>
<li>artist</li>
<li>Santana &amp; Everlast</li>
<li>03</li>
<li>Spektor</li>
<li>..</li>
<li>Janet</li>
<li>Unknown Artist</li>
<li>moZart</li>
<li>HendriX</li>
<li>Presley</li>
<li>Rock&amp;roll</li>
<li>\????- </li>
<li>Surfer Rosa</li>
<li>W.A.Mozart</li>
<li>Bob Morley</li>
<li>Kurt Masur</li>
<li>Minem</li>
<li>Police &amp; Thieves</li>
<li>C++</li>
<li>Daft</li>
<li>Jlo</li>
<li>Pac</li>
<li>Alicia K</li>
<li>Caira</li>
<li>The Stokes</li>
<li>Michael J.</li>
<li>Zac Grooms</li>
<li>Lil John</li>
<li>
<h1 id="9">9</h1>
</li>
<li>Parklife</li>
<li>Soundtrack for the Motion Picture</li>
<li>Bep</li>
<li>
<h1 id="1-defender">1 Defender</h1>
</li>
<li>The +</li>
<li>Νικόλας Άσιμος</li>
<li>Joe Jonas</li>
<li>redrobot</li>
<li>NadaMucho Presents</li>
<li>Chrome Band</li>
<li>Red Hot</li>
<li>Oliver W. Tuthill Jr.</li>
<li>Almost There Records - Various Artists</li>
<li>J. Cash</li>
<li>
<h1 id="1-twilight-movie-songs">1 Twilight Movie Songs</h1>
</li>
<li>
<h1 id="2-staten-island-johnny">2 Staten Island Johnny</h1>
</li>
<li>Lyn-Z</li>
<li>
<h1 id="1-crush">1 Crush</h1>
</li>
<li>Jimmy Deveney</li>
<li>EA.Rock</li>
<li>Manson</li>
<li>BuyBack Band</li>
<li>Ralph Wall-Greg Mertz</li>
<li>Aeolian Music Works</li>
<li>Varous Artists</li>
<li>Ivor Thomas</li>
<li>Jefferson Paine</li>
<li>Just B &amp; Friends</li>
<li>Arthur Livingston</li>
<li>Jonah James</li>
<li>J Cash</li>
<li>Douglas Lee Saum / William Butler Yeats</li>
<li>Violet Femmes (Various Artists)</li>
<li>Pair Of Noids</li>
<li>Strip 77</li>
<li>Rojo</li>
<li>Lorraine Devon Wilke</li>
<li>The Mighty Keepers</li>
<li>Rik Slave</li>
<li>Yocahuna</li>
<li>Michel Brazeau</li>
<li>
<h1 id="2-clubhouse-boys">2 Clubhouse Boys</h1>
</li>
<li>
<h1 id="1-childrens-learning-tool">1 Childrens Learning Tool</h1>
</li>
<li>Justin Goode</li>
</ul>
<p>'The Violet Femmes (Various Artists)' is so close, I guess it just got lost in the shuffle. None of these artists actually show up in my library, which isn't too surprising. The only artist I've seen which exists in my library is Alarm Will Sound, which shows up with a 20% familiarity rating compared against Jawbreaker. </p>]]></content:encoded>
    </item>
    <item>
      <title>Effective Java</title>
      <link>http://www.georgeschneeloch.com/blog/2012/09/17/effective-java</link>
      <pubDate>Mon, 17 Sep 2012 12:27:45 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>qvjdn4NJf7PVmLn3OVgCx1Q6Io4=</guid>
      <description>Effective Java</description>
      <content:encoded><![CDATA[<p>I finished reading through Effective Java last week. I kept seeing references to it on StackOverflow, referring to specific items of note, so I decided to check it out. It has a lot of information that I knew already but it's satisfying to be confirmed on those things. There's also a lot which describes bad habits I've gotten myself into working on my own bus app, where I don't have anyone else to nag me about bad style.</p>
<p>The book is also written from a perspective where interfaces need to be very carefully designed, else certain guarantees are made that can't be taken back. Most of my work regarding interfaces was internal, where we had full ability to rewrite badly designed ones. That's especially true with my bus app. There is lots of interesting writing about leaking implementation details through Serialization, toString, clone, or other default behaviors which get overlooked. There are plenty of examples of design gone wrong inside the Java framework which the book pulls from, which really illustrates the point. I also like its ability to spell out which features are worth using and what should be avoided, which reminds me of Javascript: The Good Parts. </p>
<p>Looking through all the items, I think I'm most guilty of focusing more on optimization than I should. The fact that I'm coding for Android makes performance (especially memory usage) important, but it's a mindset I should avoid for the most part. A list of common offenses:</p>
<ul>
<li>Item 30: Use enums instead of int constants. I remember in the Android performance guidelines that <code>Enum</code>s were pretty expensive, but thinking about it now I can't picture how an instantiation for each Enum type would hurt performance.</li>
<li>Item 38: Check parameters for validity</li>
<li>Item 39: Make defensive copies when needed. This is another thing I avoid for misguided performance reasons</li>
<li>Item 40: Design method signatures carefully</li>
<li>Item 43: Return empty arrays or collections, not nulls</li>
<li>Item 50: Avoid strings where other types are more appropriate</li>
<li>Item 52: Refer to objects by their interfaces</li>
</ul>
<p>... and pretty much everything to do with checked exceptions. </p>]]></content:encoded>
    </item>
    <item>
      <title>Ops for Linux</title>
      <link>http://www.georgeschneeloch.com/blog/2012/09/13/ops-for-linux</link>
      <pubDate>Thu, 13 Sep 2012 17:16:38 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>7kOFVx4hLzGggUkW2GlwpfNX7Fk=</guid>
      <description>Ops for Linux</description>
      <content:encoded><![CDATA[<p>Ops is a tool used to hack a specific kind of CVS disposable camcorder to be reusable. I don't remember how I learned about it but eventually I created a Linux port and it was added to the <a href="http://sourceforge.net/projects/saturntools/">official SourceForge page</a>. It's pretty much obsolete now that cheap digital cameras are so ubiquitous, which is especially funny given that the iPhone came out only a year or two later.</p>
<p>One thing that continually impresses me about computer science is how pretty much nothing is off limits, if you have the time and energy to find a solution. The amount of reverse engineering and insight that went into that project was astonishing. I learned so much with that project, how USB and cameras work at a low level and why people make the decisions they do when releasing a project. The <a href="http://camerahacks.10.forumer.com">camera hacking forums</a> contain most of this conversation, most of it dating to 2006 or so.</p>
<p>These cameras were very similar to a commercially available camera which cost $99, but this camera was something like $10 because it was supposed to be disposable. (Later a slightly more expensive camcorder version was released.) There was a software authentication mechanism to prevent people from plugging in these disposable cameras, but it responded to a password of all zeros. The cameras had a proprietary-looking interface, but its wires were a direct mapping to USB. The socket fit neatly with PalmPilot cradles, which made the interface easy to solder together (although I managed to damage my laptop with a shorted connection.)</p>
<p>After this vulnerability was discovered, they fixed the hole in the authentication system, but another was quickly found. I think they booted it into some kind of reset mode, similar to how you root many Android phones. After a little while someone accidentally posted the authentication algorithm on a public FTP, lawsuits were threatened, etc. In the meantime people did some pretty interesting things with these cheap cameras, like using them in <a href="http://www.suruda.com/balloon_stills/flights.htm">high altitude balloons</a>.</p>
<p>From a code perspective I wrote it in C because that's what I knew back then and I didn't think to do it in Python. In hindsight I probably should have piggybacked on the Windows C++ implementation, to make it easier to keep feature parity. I also wish I knew about <a href="glade.gnome.org">Glade</a>, which would have made things much prettier. Some extra work was contributed by other people to fix endian issues for non-i386 platforms.</p>]]></content:encoded>
    </item>
    <item>
      <title>Echo's Nest plugin for Rhythmbox</title>
      <link>http://www.georgeschneeloch.com/blog/2012/09/11/rhythmbox</link>
      <pubDate>Tue, 11 Sep 2012 13:16:01 EDT</pubDate>
      <category><![CDATA[uncategorized]]></category>
      <guid>yAJV0wvF4mgoqzYUjYm5HZnjXU8=</guid>
      <description>Echo's Nest plugin for Rhythmbox</description>
      <content:encoded><![CDATA[<p>I wrote a <a href="http://www.echonest.com">Echo's Nest</a> plugin for <a href="http://www.rhythmbox.org">Rhythmbox</a>! It's <a href="http://github.com/bostonbusmap/rhythmbox-echonest">hosted on github</a>. It was a pain sometimes. I've <a href="http://www.georgeschneeloch.com/blog/2012/08/07/productivity">written before</a> about how Rhythmbox is a pain to work with. The basic issues here were sparse documentation and broken features, although I shouldn't really complain too hard about something that people contribute to in their spare time.</p>
<p>I've been meaning to work with Echo's Nest for a little while. I first heard about the Davis square company when reading about them <a href="http://thephoenix.com/boston/music/119592-echo-nest-is-ready-to-fly/">in the Phoenix</a>, and then again when reading about <a href="http://boston.musichackday.org">Boston's Music Hack day</a>. They have a large database of information about artists and songs, and their API provides easy (and free, for noncommercial use) access to things like artist similarity. They also have <a href="http://echoprint.me">Echoprint</a>, a music fingerprinting C++ library similar in idea to <a href="http://shazam.com">Shazam</a>, although currently in beta.</p>
<p>The plugin basically looks up information about the currently playing artist, gets similar artists, matches them to music you have in your library, and populates a similar artists playlist. I started by googling "echo nest rhythmbox" to see what else was there. I found <a href="https://github.com/tylerwilliams/rhythmbox-en-recommender">this plugin</a> but it didn't work for me, probably due to API changes within Rhythmbox. I also wanted to do something that operated more or less independently once you got it going. And I figured it would be a good experience to do something that was all my own. I also looked at the Last FM plugins on the Rhythmbox plugins page, specifically looking at <a href="https://github.com/asermax/lastfm_queue">this one</a>, which I borrowed a lot of code from. The official plugins in <code>/usr/lib/rhythmbox/plugins</code> were also very helpful, especially the Magnatune one.</p>
<p>There's an interesting balance between writing new code and borrowing existing code. I usually borrow to get started, because I like the gratification of getting started quickly, and because I'm better at iterating over code than creating new code from scratch if I'm unfamiliar with it. Since this plugin is open source I felt perfectly fine with that.</p>
<p>My first iteration was a plugin which printed out the currently playing song to the debug log. This wasn't too difficult once I got through some activation/deactiviation issues.</p>
<p>The next iteration was to make a playlist and show the currently playing song in it. In Rhythmbox this is done by implementing <code>RB.BrowserSource</code>. It has a <code>RhythmDBQueryModel</code> which holds a list of <code>RhythmDBEntry</code>s for each song. I struggled for a little while trying to figure out how to create a <code>RhythmDBEntry</code> from scratch, but then I realized that the current song is provided as a <code>RhythmDBEntry</code> so I could just use that variable. It would make sense to make this difficult to create from scratch since these entries on the playlist correspond to actual songs, which could be a artist, song title, and location on a file system, or something more complicated like an internet radio stream.</p>
<p>In the next (and current) iteration I wanted to contact Echo's Nest, get a list of songs, match them with the library on my laptop, and populate the playlist with them. The most frustrating part of this was <a href="http://stackoverflow.com/questions/12133250/how-do-i-query-for-data-in-rhythmbox">a bug with querying for songs</a>, which somehow affected my laptop even though it's a 64-bit laptop. Other examples showed people using <code>db.query_new()</code> but that function was removed for some reason. Even <code>GLib.PtrArray</code> didn't have much documentation associated with it, or why someone would want to use it to replace <code>db.query_new()</code>, to hold query results. I found that <a href="http://wiki.uwcs.co.uk/Rhythmbox/PodcastPlugin">many query functions aren't supported in Python due to variable length arguments</a>, which might explain why the documentation is so sparse for <code>do_full_query_parsed</code>. I worked around this eventually by iterating over the library myself, but this took a decent chunk of time, roughly the same amount of time as it took to get the rest of this working.</p>
<p>The other hurdle was contacting Echo's Nest. The API is pretty simple and I elected to just craft the URL myself instead of using <a href="http://github.com/echonest/pyechonest">pyechonest</a>. <a href="https://live.gnome.org/RhythmboxPlugins/WritingGuide">The plugin writing guide</a> recommends that people use asynchronous communication whenever doing anything that could take time, like network communication. They recommend two ways of doing it, using <a href="http://en.wikipedia.org/wiki/GIO_(GNOME)">GIO</a> or their <code>Loader</code> class, which uses <code>GIO</code> underneath. I got an error message when using either method, "The specified location is not supported", which didn't make much sense since it was a plain old http url. Currently it just uses <code>urllib2</code> to do it synchronously, eventually I'll switch to <a href="http://www.twistedmatrix.com">Twisted</a> to do it correctly.</p>
<p>So far I'm pretty happy with it. It does tend to get stuck in certain ways though. I currently ask for 100 similar artists, but there's no guarantee that the artists exist in my own library, especially if my library is small, or if a certain artist is overrepresented. Currently I just set it on shuffle mode to pick randomly from the given playlist, but I could weigh it to increase the chance of switching to a different artist each time. It would also be nice to have a similar feature on a song by song level, but I'm not sure the Echo Nest API provides anything for that.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
