<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><description>The dev blog for Justin Duewel-Zahniser’s Chapbook poetry sharing web app project.  I’m going to post random stuff here that’s too big for the dev list and hopefully get conversations going with testers/users.


var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-186280-7");
pageTracker._initData();
pageTracker._trackPageview();
</description><title>Chapbook Dev Blog</title><generator>Tumblr (3.0; @chapbook)</generator><link>http://chapbook.tumblr.com/</link><item><title>Search Form and Some UI</title><description>&lt;p&gt;&lt;a href="http://poetry.heroku.com"&gt;Chapbook&lt;/a&gt; now has a proper search form which you can drop down from the top menu.  it also introduces a *gasp* new color.  I also spruced up the Favorites page just a tiny bit, as it was very, very rudimentary.  The next target is chapbook organization and then the river, and then I will try to get some beta people to opine on the functionality and usefulness.&lt;/p&gt;
&lt;p&gt;I must also not get too distracted by other ideas.&lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/37478018</link><guid>http://chapbook.tumblr.com/post/37478018</guid><pubDate>Sat, 07 Jun 2008 01:44:03 -0400</pubDate></item><item><title>Rails Issue w/ Highlight and Excerpt TextHelper Methods</title><description>&lt;p&gt;Here’s a weekend Rails discovery that I meant to post about yesterday.  I was working on the search support in &lt;a href="http://poetry.heroku.com"&gt;Chapbook&lt;/a&gt; using Ferret and was referencing the &lt;a href="http://www.railsenvy.com/2007/2/19/acts-as-ferret-tutorial"&gt;Acts_as_Ferret Tutorial from Rails Envy&lt;/a&gt;.  I jumped down to section on Highlighting because I wanted to introduce highlighting in to the result set for ease of use.  Here’s what I read:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The requirement to do this, however, is that you &lt;b&gt;must have your search fields stored&lt;/b&gt; as I showed above.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;So, what was shown above?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you take a look inside one of your search indexes right now, believe it or not, you would not see your data. By default acts_as_ferret does not store your data in a recoverable form, it just indexes it. &lt;/p&gt; &lt;p&gt;“What if my data is small and I want to store it in the index?” I hear you ask. &lt;/p&gt; &lt;p&gt;Good question grasshopper. If your data is small, or you only really care about one field of information, you can get a speed bonus by storing the data in the index itself. &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note the bit about &lt;b&gt;your data being small&lt;/b&gt;. I’m really uncomfortable with altering how my data is stored to a format which appears to imply danger down the road related to data size in exchange for search highlighting.  There was no information about what the scale limitation or long-term effects would be, but I was nervous about doing this just for highlighting.&lt;/p&gt;
&lt;p&gt;Rails has some TextHelper methods called “highlight” and “excerpt” which provide pretty much what you might guess by the name.  So I decided to try these out as an alternative which would not involve indexing or data growth dangers.&lt;/p&gt;
&lt;p&gt;I ran in to a problem.  If I searched for “dog” and looked at the result set I would see “&lt;b&gt;dog&lt;/b&gt;ged” in the highlighting.  Not good.  So I took a look at the source in the Rails API:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;71:       def highlight(text, phrases, highlighter = '&lt;b&gt;\1&lt;/b&gt;')&lt;br/&gt;72:         if text.blank? || phrases.blank?&lt;br/&gt;73:           text&lt;br/&gt;74:         else&lt;br/&gt;75:           match = Array(phrases).map { |p| Regexp.escape(p) }.join('|')&lt;br/&gt;76:           text.gsub(/(#{match})/i, highlighter)&lt;br/&gt;77:         end&lt;br/&gt;78:       end&lt;/pre&gt;
&lt;pre&gt;101:       def excerpt(text, phrase, radius = 100, excerpt_string = "...")&lt;br/&gt;102:         if text.nil? || phrase.nil? then return end&lt;br/&gt;103:         phrase = Regexp.escape(phrase)&lt;br/&gt;104: &lt;br/&gt;105:         if found_pos = text.chars =~ /(#{phrase})/i&lt;br/&gt;106:           start_pos = [ found_pos - radius, 0 ].max&lt;br/&gt;107:           end_pos   = [ found_pos + phrase.chars.length + radius, text.chars.length ].min&lt;br/&gt;108: &lt;br/&gt;109:           prefix  = start_pos &gt; 0 ? excerpt_string : ""&lt;br/&gt;110:           postfix = end_pos 111: &lt;br/&gt;112:           prefix + text.chars[start_pos..end_pos].strip + postfix&lt;br/&gt;113:         else&lt;br/&gt;114:           nil&lt;br/&gt;115:         end&lt;br/&gt;116:       end &lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Look at those regular expressions.  Look again.  Hm.  They’re too simple.  If fact, they won’t highlight correctly on full words and they won’t highlight or excerpt correctly in the case of punctuation following a word (e.g. “… the dog.”).  Ew.&lt;/p&gt;
&lt;p&gt;But that’s a solvable problem.  I’m not sure of the most Railsy way to solve the problem, but I created alternate helpers in my poem helper which upgrade the regexps to be a bit smarter.  I wonder if I should submit these, or go ahead and override the methods in my app.  Not sure what else I might break or whether someone would reject my changes because the lack of rigor around the matching is desirable for some use.  Anyway, here’s the code.&lt;/p&gt;
&lt;blockquote&gt;module PoemsHelper  def search_excerpt(text, phrase, radius = 100, excerpt_string = “…”)    if text.nil? || phrase.nil? then return end    phrase = Regexp.escape(phrase)        if found_pos = text.chars =~ /(\W+#{phrase}\W+)/i      start_pos = [ found_pos - radius, 0 ].max      end_pos   = [ found_pos + phrase.chars.length + radius, text.chars.length ].min            prefix  = start_pos &gt; 0 ? excerpt_string : “”      postfix = end_pos \1’)    if text.blank? || phrases.blank?      text    else      match = Array(phrases).map { |p| Regexp.escape(p) }.join(‘|’)      text.gsub(/(\W+#{match}\W+)/i, highlighter)    end  endend&lt;/blockquote&gt;Pretty much just some \W+s thrown in there and it works great.  And I didn’t have to change my indexes.  Using “search_*” feels dirty, though.</description><link>http://chapbook.tumblr.com/post/36212292</link><guid>http://chapbook.tumblr.com/post/36212292</guid><pubDate>Tue, 27 May 2008 10:39:00 -0400</pubDate></item><item><title>Comments Feed</title><description>&lt;p&gt;Phew, long time.  Busy at work.&lt;/p&gt;
&lt;p&gt;The poem pages now parse out the Disqus comments feed and set it up for auto-discovery in the browser.  So, you now have easier access to subscribe to comments on any poem. &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/35852522</link><guid>http://chapbook.tumblr.com/post/35852522</guid><pubDate>Fri, 23 May 2008 21:14:11 -0400</pubDate></item><item><title>OpenID Improvements</title><description>&lt;p&gt;Okay, one quick refactoring later.  The site is now based on OpenID rather than locked-in accounts.  So, you use an OpenID, you get logged in, a blank account is created for you and you must add a name before proceeding.  That’s pretty much the deal.  The login page now has some guidance on OpenID for anyone not familiar.&lt;/p&gt;
&lt;p&gt;You can also add a backup OpenID (or 20).  I will have those authenticate, but for now they just are made available to the account and so aren’t authenticated until you try to use them to login.&lt;/p&gt;
&lt;p&gt;Also, congrats to the Heroku team for getting a big round of funding.  I can’t wait to see what they do with the money.  I’m sure it will be awesome.&lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/34271254</link><guid>http://chapbook.tumblr.com/post/34271254</guid><pubDate>Fri, 09 May 2008 17:12:58 -0400</pubDate></item><item><title>OpenID Support</title><description>&lt;p&gt;I’ve added in OpenID support.  You can now create an account/login using OpenID and/or Clickpass.&lt;/p&gt;
&lt;p&gt;There are, however, some oddities.  Clickpass doesn’t appear to provide nickname or email when it authenticates a user so if you login by OpenID you can’t use an existing account.  Long term, this won’t be a problem because my plan is to move to purely OpenID-based authentication, use what data the provider will give and ask you to fill in the rest.  That way, I won’t be generating a bunch of proprietary, chapbook-only user accounts.&lt;/p&gt;
&lt;p&gt;I’ll probably also stop accepting file upload avatars and go web-based instead, encouraging the use of Gravatars. &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/34067930</link><guid>http://chapbook.tumblr.com/post/34067930</guid><pubDate>Wed, 07 May 2008 22:01:53 -0400</pubDate></item><item><title>RSS for Search</title><description>&lt;p&gt;You can now perform a keyword search using the URL format &lt;a href="http://poetry.heroku.com/search/waterfall"&gt;http://poetry.heroku.com/search/waterfall&lt;/a&gt; and subscribe to the feed from the result set (or be optimistic and add .rss after the terms to get the feed straight away).&lt;/p&gt;
&lt;p&gt;Hoping to get some time this evening to build a search form. &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/34020280</link><guid>http://chapbook.tumblr.com/post/34020280</guid><pubDate>Wed, 07 May 2008 12:36:37 -0400</pubDate></item><item><title>Revisions RSS and Search</title><description>&lt;p&gt;RSS for revisions and search are now working (miracle occurred?).  I need to build a search form, but for now the syntax is &lt;a href="http://poetry.heroku.com/search/"&gt;http://poetry.heroku.com/search/&lt;/a&gt;[terms] with the usual ferret OR and other modifiers being applicable. &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/33051167</link><guid>http://chapbook.tumblr.com/post/33051167</guid><pubDate>Sun, 27 Apr 2008 20:03:19 -0400</pubDate></item><item><title>FOAF Added (why?)</title><description>&lt;p&gt;Thanks to &lt;a href="http://blog.crowdvine.com/2007/11/04/implementing-foaf-in-rails/"&gt;CrowdVine Blog » Blog Archive » Implementing FOAF in Rails&lt;/a&gt;, I was able to easily implement Friend of a Friend (FOAF - an RDF spec for semantic web stuff) quite easily on Chapbook.  So, now your profile is more semantical.&lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32967653</link><guid>http://chapbook.tumblr.com/post/32967653</guid><pubDate>Sat, 26 Apr 2008 20:00:00 -0400</pubDate></item><item><title>Most RSS Now Working</title><description>&lt;p&gt;With the exception of user’s activity log (aka, “the river”), revisions to poems and comments on poems, all RSS is now operational.  I’ll try to polish the rest off this weekend.  Disqus has an RSS link for comments on poems, but I’m in the process of figuring out how to make it auto-discoverable.  The rest just requires me to write more code.&lt;/p&gt;
&lt;p&gt;The river may have to wait until beta, since it will be easier to test, design and validate if there’s a lot of activity (or, more than my own). &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32964174</link><guid>http://chapbook.tumblr.com/post/32964174</guid><pubDate>Sat, 26 Apr 2008 18:58:38 -0400</pubDate></item><item><title>A Poem About The Internet</title><description>&lt;p&gt;&lt;a href="http://kfan.tumblr.com/post/32839718"&gt;kfan&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;Do not stop to think or edit&lt;br/&gt;You must be the first who said it.&lt;/blockquote&gt;  &lt;p&gt;Nice.&lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32938081</link><guid>http://chapbook.tumblr.com/post/32938081</guid><pubDate>Sat, 26 Apr 2008 11:31:49 -0400</pubDate></item><item><title>RSS is Next</title><description>&lt;p&gt;I think RSS will be next.  I did some paper prototyping for work the last few days and need a break from UI stuff.  I’ll try to get feeds up for poem revisions, chapbooks and see if Disqus facilitates comments as well (probably). &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32937727</link><guid>http://chapbook.tumblr.com/post/32937727</guid><pubDate>Sat, 26 Apr 2008 11:27:41 -0400</pubDate></item><item><title>More Sky Pie</title><description>&lt;p&gt;One of my other goals with Chapbook (aside from encouraging people to write more and better poetry) is to reward users by helping them find a publication outlet.  This is a really under-refined thought, but in general I know that the process of finding and applying to publications is a bit onerous and probably could be done better on the Internet.&lt;/p&gt;
&lt;p&gt;I added that to the dev page.   Meanwhile, I’m having trouble getting feedback on the Heroku list on how to use search, so that continues to languish.  Maybe tonight, as a goal, I will bang out RSS support.&lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32334212</link><guid>http://chapbook.tumblr.com/post/32334212</guid><pubDate>Sun, 20 Apr 2008 13:23:58 -0400</pubDate></item><item><title>Re-Design Progresses Reasonably</title><description>&lt;p&gt;I’m happier with the layout.  I’m only wondering now if I shouldn’t use a brigher shade of blue.  I don’t know if I so much need more color as I just need the page to be less drab.&lt;/p&gt;
&lt;p&gt;The new size of the poem text is much better.  I also ditched my custom comment code for Disqus integration.  My own comment code wasn’t bad, but there’s more value in me spending time on poetry-related things.  &lt;a href="http://www.disqus.com"&gt;Disqus &lt;/a&gt;provides threading, reputation, email subscriptions and more that I don’t have to rebuild in yet another way.&lt;/p&gt;
&lt;p&gt;The big outstanding items are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Search (waiting on Heroku)&lt;/li&gt;
&lt;li&gt;RSS&lt;/li&gt;
&lt;li&gt;Chapbook upgrades - this has the least love because it’s the newest model&lt;/li&gt;
&lt;/ul&gt;I’m also now debating Clickpass integration to support OpenID.  I can’t see a downside to supporting OpenID, although I don’t think it lets me shift my account code elsewhere, since I still need to maintain a local copy of the profile and keep passwords, etc. </description><link>http://chapbook.tumblr.com/post/32201210</link><guid>http://chapbook.tumblr.com/post/32201210</guid><pubDate>Fri, 18 Apr 2008 21:50:24 -0400</pubDate></item><item><title>Re-Design in Progress</title><description>&lt;p&gt;I couldn’t hold out.  I’m not adding more color, but I am adding more shading.  I’m trying to make better use of screen space and improve the response to font scaling.  I will also make the actual poem text much larger.&lt;/p&gt;
&lt;p&gt;So far, I’m happier with the layout than I was before.  I need to paper out a few more existing screens, fix them, and then paper out the chapbook organize UI. &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32103828</link><guid>http://chapbook.tumblr.com/post/32103828</guid><pubDate>Thu, 17 Apr 2008 23:09:10 -0400</pubDate></item><item><title>Re-Design Imminent?</title><description>&lt;p&gt;Not sure what to do with it yet, but I’m not happy with the placeholder design.  You might say, well, it’s a placeholder design.  It bugs me nonetheless and the best way to get back to coding is to stop the design from bugging me.&lt;/p&gt;
&lt;p&gt;So, I think I might do some paper prototyping.  Here are the principles that I’m going to try to work from:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Text of a poem should be significantly more prominent than all other aspects of the page.&lt;/li&gt;
&lt;li&gt; Two-color is getting old.&lt;/li&gt;
&lt;li&gt;I sort of feel like giving up vertical space for poem text to nav elements is a bad idea.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://chapbook.tumblr.com/post/32089347</link><guid>http://chapbook.tumblr.com/post/32089347</guid><pubDate>Thu, 17 Apr 2008 19:09:51 -0400</pubDate></item><item><title>Chapbook - Write and Share Poetry</title><description>&lt;a href="http://poetry.heroku.com/"&gt;Chapbook - Write and Share Poetry&lt;/a&gt;</description><link>http://chapbook.tumblr.com/post/32087870</link><guid>http://chapbook.tumblr.com/post/32087870</guid><pubDate>Thu, 17 Apr 2008 18:54:09 -0400</pubDate></item><item><title>Do you care about tag clouds?</title><description>&lt;p&gt;I’ve been increasingly wondering if the tag cloud in Chapbook is at all relevant.  Tags, certainly, because people should be able to classify poems according to user-generated schemes.  But, are you really going to look at a pile of tags and go find poems to read based on those?&lt;/p&gt;
&lt;p&gt;Maybe.  But, I’ve never used the Flickr tag cloud and I do fine.  I mostly look at “top photos” and photos from friends or find photos via relationships or tags from other photos and not from a cold start.  Tag clouds add a nice discovery aspect, intellectually, but I don’t know how much they’ll be used.&lt;/p&gt;
&lt;p&gt;I can always leave tag clouds in and take them out if no one uses them.  One of my goals, though, is as little clutter as I can get away with because any given written piece should be the most prominent text on the screen.  Flickr doesn’t have this challenge as much because large photos inherently stand out.&lt;/p&gt;
&lt;p&gt;Okay, back to my day job.  That was good curry. &lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32064568</link><guid>http://chapbook.tumblr.com/post/32064568</guid><pubDate>Thu, 17 Apr 2008 13:03:16 -0400</pubDate></item><item><title>Introduction: Chapbook is a web app I’m building in response to the shittiness of current...</title><description>&lt;p&gt;Introduction: &lt;a href="http://poetry.heroku.com"&gt;Chapbook&lt;/a&gt; is a web app I’m building in response to the shittiness of current Facebook poetry apps.  Originally, it was going to be a Facebook app, but now I think it might be independent (with API for integration).&lt;/p&gt;

&lt;p&gt;Anyway, the point is to build a site which let’s people revise, share and collect poetry.  A good poetry site should make it easier to care about other people’s poetry and should participate in the writing and learning process itself.&lt;/p&gt;

&lt;p&gt;That’s pretty much the mission.&lt;/p&gt;

&lt;p&gt;I have $0 in funding.  I have no monetization plans, really.  I like poetry.&lt;/p&gt;</description><link>http://chapbook.tumblr.com/post/32048180</link><guid>http://chapbook.tumblr.com/post/32048180</guid><pubDate>Thu, 17 Apr 2008 10:16:31 -0400</pubDate></item></channel></rss>
