October Code Sprint Results


10.24.09 Posted in Courant News, Software Development, Yale Daily News by Max

Today Rob and I did a Courant News code sprint to get momen­tum build­ing again. I did some YDN work first and then worked on fin­ish­ing search func­tion­al­ity, while Rob focused on a new “head­ers” app that we’ve been brain­storm­ing for the past week.

Mul­ti­me­dia

Being both an early riser and three hours ahead by virtue of time zones, I started my day work­ing on some YDN tasks and left Courant for the after­noon. First order of busi­ness was fin­ish­ing the new mul­ti­me­dia land­ing page. We’ve been with­out that page since launch­ing on Courant at the begin­ning of the semes­ter, and the ver­sion before was barely func­tion­al­ity as it was. Zeke Miller, the new Online Edi­tor, was the dri­ving force for the design while brain­storm­ing and gath­er­ing feed­back from the rest of the Online desk. I’m very pleased with the results, but have opened a thread over at the CoPress forums to get feed­back from the wider col­lege news community.

Search

Next on the docket was fin­ish­ing the tran­si­tion from Sphinx to Haystack for the Courant News search sys­tem. Sphinx was very nice, but Haystack opens new doors and fits bet­ter with the Courant News project phi­los­o­phy; it allows for the use of mul­ti­ple search engine back­ends, so that sites can use what­ever is most appro­pri­ate for their situation.

For exam­ple, if a site can­not install a pow­er­ful Java sys­tem like Solr, then they can use the pure-Python Whoosh back­end (which is also nice for devel­op­ment use). In prac­tice, I ran into prob­lems while try­ing to use the Xapian (fast C++ engine) back­end and had to switch back to the resource-heavy Solr. Hope­fully as Haystack and its Xapian back­end mature the sit­u­a­tion will improve.

By the end of the after­noon, I had fin­ished imple­ment­ing it in Courant and had com­pleted the tem­plates for the YDN search sys­tem. Please feel free to explore. I’m espe­cially proud of the fil­ter­ing options, which allow­ing for fil­ter­ing of the query results by sec­tion, staff mem­bers, con­tent type (arti­cle, photo, video, etc.), and date range. It makes it very easy to find spe­cific con­tent that you are look­ing for, or even to just get a broader sense of how pop­u­lar a given topic is.

Solr’s rel­e­vancy engine is giv­ing dis­pro­por­tion­ate weight to pho­tos because they aren’t as long as arti­cles, which is not very desir­able. How­ever, I’m still a Solr new­bie and am try­ing to explore options for resolv­ing that issue. Once I fig­ure out how to do it with Solr, I’ll have to push the Haystack folks to expose any req­ui­site functionality.

Head­ers App

Rob’s big project, and his first major code con­tri­bu­tion in sev­eral months, was the imple­men­ta­tion of an app we’ve been design­ing for the past few days. He’s going to write a more in-depth post, so I won’t step on his toes too much and go too deeply into it right now; essen­tially, it allows you to vary the dis­play of your news site based on HTTP header val­ues, most impor­tantly User-Agent and Ref­erer [sic].

The biggest exam­ple is to show a dif­fer­ent set of tem­plates to vis­i­tors with mobile User-Agent strings by show­ing them .mobile tem­plates (using the File­Ex­ten­sion mid­dle­ware and ren­der() func­tion in Courant News). You can also define a cas­cade of exten­sions, so that you only have to cus­tomize cer­tain parts of your site if you want, and show the stan­dard .html ver­sion else­where; this could be inter­est­ing if you wanted to take advan­tage of new HTML5 func­tion­al­ity in browsers (User-Agents) that sup­port it, while not hav­ing to dupli­cate tem­plates on other pages (or if you want to cus­tomize only cer­tain pages on your mobile site for iPhone users).

It also lets you sim­ply set extra tem­plate con­text vari­ables, so that you can show spe­cial con­tent to peo­ple com­ing from cer­tain refer­rers (e.g., Face­book or Twit­ter). There are count­less uses for such func­tion­al­ity, I’ll let you come up with your own.

You can browse the head­ers app in our code repos­i­tory; it only requires a bit more work before we will declare it com­plete, hope­fully that will hap­pen in the next sev­eral days. When Rob writes his post, I’ll update with a link.

Con­clu­sion

Today was a pro­duc­tive day, with 9 com­mits to the Courant News repos­i­tory. Hope­fully the pace will keep up, and once these last few fea­tures are final­ized the path will be clear to begin work on Nando, which will be the real cor­ner­stone of the Courant News platform.



Leave a Reply