<?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>Doug McInnes &#187; Los Angeles Times</title>
	<atom:link href="http://dougmcinnes.com/category/los-angeles-times/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougmcinnes.com</link>
	<description>Chuckle and Chortle</description>
	<lastBuildDate>Tue, 25 May 2010 07:52:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Javascript Love</title>
		<link>http://dougmcinnes.com/2008/11/13/javascript-love/</link>
		<comments>http://dougmcinnes.com/2008/11/13/javascript-love/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 07:17:55 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Los Angeles Times]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[InplaceEditor]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[preview]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[scriptaculous]]></category>

		<guid isPermaLink="false">http://dougmcinnes.com/?p=23</guid>
		<description><![CDATA[ 
 
 I&#8217;ve been a busy bee releasing stuff into the wild lately.  Most of them have been Ruby on Rails plugins but I&#8217;ve also been doing some Javascript work.  Here&#8217;s two tidbits that I developed at the Los Angeles Times.
Inplace_preview
Inplace_preview is the first.  It monkeypatches Scriptaculous&#8216; InPlaceEditor to give it [...]]]></description>
			<content:encoded><![CDATA[<p><script src="/wp-content/uploads/2008/11/prototype.js"></script> <script src="/wp-content/uploads/2008/11/effects.js"></script><br />
<script src="/wp-content/uploads/2008/11/controls.js"></script> <script src="/wp-content/uploads/2008/11/inplace_preview.js"></script><br />
<script src="/wp-content/uploads/2008/11/gallery_scroller.js"></script> I&#8217;ve been a busy bee releasing stuff into the wild lately.  Most of them have been Ruby on Rails plugins but I&#8217;ve also been doing some Javascript work.  Here&#8217;s two tidbits that I developed at the <a href="http://www.latimes.com/">Los Angeles Times</a>.</p>
<h4>Inplace_preview</h4>
<p><a href="http://github.com/latimes/inplace_preview/tree/master">Inplace_preview</a> is the first.  It monkeypatches <a href="http://script.aculo.us/">Scriptaculous</a>&#8216; <a href="http://github.com/madrobby/scriptaculous/wikis/ajax-inplaceeditor">InPlaceEditor</a> to give it a preview mode.  It also includes an ability to do an ajax call for rendering the preview.  It comes in handy when using an InPlaceEditor for editing HTML but with the ajax rendering anything would be possible.  </p>
<p>Here&#8217;s an example (if you save you&#8217;ll get a big-ol error since we don&#8217;t actually save here):</p>
<p><span id="preview-test" style="margin-left:15px;" title="Click to edit"><strong>Click Here to Edit&#8230;</strong></span> <script type="text/javascript"><!--
new Ajax.InPlaceEditor('preview-test', '/update', { rows: 15, previewLink: true, cols: 35, okText: 'Save', cancelText: ' Cancel'} )
// --></script></p>
<h4>Gallery_scroller</h4>
<p><a href="http://github.com/latimes/gallery_scroller/tree/master">Gallery_scroller</a> is small Javascript library for creating a scrolling gallery that we&#8217;re using on more projects then I expected.  It requires <a href="http://www.prototypejs.org/">Prototype</a> and <a href="http://script.aculo.us/">Scriptaculous</a> <a href="http://github.com/madrobby/scriptaculous/wikis/effects">effects.js</a> libraries.</p>
<p>Here&#8217;s an example:</p>
<div id="gst">
<style>
#gst div.gallery { height: 150px; padding-right:16px; text-align:left; float:left; margin-right:10px; }
#gst div.gallery img, li.highlight img { border:2px solid #d0d0c4; }
#gst div.gallery div { width: 140px; }
#gst #gallery_container { position:relative; padding:10px; height:150px; width:540px; }
#gst a.gallery_textlink { font-weight:bold; font-size:110%; }
#gst #gallery_mask { position:relative; height:180px; width:540px; overflow:hidden; clear:left; border:2px black solid; margin-top:10px;}
#gst #gallery_buttons { width:39px; margin-top:2ex; }
#gst #gallery_previous { width: 19px; height: 19px; float:left; background:url(/wp-content/uploads/2008/11/arrow-left-disabled.gif); border-right: 1px #ddd solid; }
#gst #gallery_next { width: 19px; height: 19px; float:right; background:url(/wp-content/uploads/2008/11/arrow-right-disabled.gif); }
#gst #gallery_previous.active { cursor:pointer; background:url(/wp-content/uploads/2008/11/arrow-left.gif); }
#gst #gallery_next.active { cursor:pointer; background:url(/wp-content/uploads/2008/11/arrow-right.gif); }
</style>
<div id="gallery_buttons">
  <span id="gallery_previous"></span><br />
  <span id="gallery_next"></span>
</div>
<div id="gallery_mask">
<div id="gallery_container">
<div id="gallery_2178" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=3041243&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/1037874128.jpg" alt="10-18 (AP) Democratic presidential nominee Sen. Barack Obama says his Republican opponent Sen. John McCain will give tax breaks to the wealthy, a group he says already make out like 'bandits,' some literally on Wall Street." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=3041243&amp;topVideoCatNo=71782">Barack Obama says John McCain will&#8230;</a></div>
</div>
<div id="gallery_2183" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=3042708&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/114494528.jpg" alt="10-19 (AP) Speaking in Fayetteville, North Carolina Sunday, Democratic presidential candidate Barack Obama said he was honored to hear the news that former Secretary of State Colin Powell was endorsing him for president." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=3042708&amp;topVideoCatNo=71782">Barack Obama praises Colin Powell</a></div>
</div>
<div id="gallery_1868" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2854101&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/138133817.jpg" alt="2854101_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2854101&amp;topVideoCatNo=71782">Barack Obama accepts the&#8230;</a></div>
</div>
<div id="gallery_1546" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2649745&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/199373581.jpg" alt="7-2 (CNN) Barack Obama is trying to prove that faith-based politics isn't reserved for Republicans. In fact, the Democrat now is taking a page from President Bush's playbook. Jessica Yellin has more on Obama's version of the president's faith-based initiative." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2649745&amp;topVideoCatNo=71782">Barack Obama&#8217;s faith-based&#8230;</a></div>
</div>
<div id="gallery_1817" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2837083&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/219916731.jpg" alt="8-25 (AP) Democratic presidential candidate Barack Obama was campaigning in Wisconsin Sunday, one day after announcing Delaware Senator Joseph Biden as his running-mate." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2837083&amp;topVideoCatNo=71782">Barack Obama campaigns in Wisconsin</a></div>
</div>
<div id="gallery_1321" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2560121&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/315428173.jpg" alt="6-5 (CNN) If you look at where the poll numbers were just last fall, Barack Obama's success is nothing short of amazing. So how did he beat the Clintons' formidable political machine? Brian Todd has the answer. " height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2560121&amp;topVideoCatNo=71782">What went right for Barack Obama</a></div>
</div>
<div id="gallery_1578" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2681117&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/404079547.jpg" alt="7-11 (CNN) Senator Barack Obama did something that critics say puts him closer to President Bush. It involves Obama's vote on legislation meant to help protect Americans, but that some people say puts Americans' telephone and e-mail privacy at risk. Now, some liberals are not happy with Obama. Ed Henry has details." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2681117&amp;topVideoCatNo=71782">Barack Obama criticized for&#8230;</a></div>
</div>
<div id="gallery_1845" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2849055&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/412984206.jpg" alt="2849055_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2849055&amp;topVideoCatNo=71782">Barack Obama officially becomes&#8230;</a></div>
</div>
<div id="gallery_1849" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2850109&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/436474808.jpg" alt="2850109_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2850109&amp;topVideoCatNo=71782">Barack Obama joins Joe Biden at&#8230;</a></div>
</div>
<div id="gallery_1850" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2848786&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/551163595.jpg" alt="8-27 (DNC) Barack Obama's name will appear on ballots across the nation in November. Delegates attending the Democratic National Convention in Denver have nominated Obama for president, the first black American to bare the presidential nomination of a major party." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2848786&amp;topVideoCatNo=71782">Democrats nominate Barack Obama</a></div>
</div>
<div id="gallery_1596" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2693319&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/621738199.jpg" alt="7-15 (CNN) Barack Obama tells the NAACP African Americans must take more responsibility for their own lives. Sabrina Fang has more from the White House." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2693319&amp;topVideoCatNo=71782">Barack Obama addresses the NAACP</a></div>
</div>
<div id="gallery_1597" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2692745&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/696565248.jpg" alt="7-15 (CNN) Senator Barack Obama continues his message of personal responsibility. The Democratic presidential candidate addressed the NAACP in Cincinnati." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2692745&amp;topVideoCatNo=71782">Barack Obama on personal&#8230;</a></div>
</div>
<div id="gallery_1860" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2852390&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/731932852.jpg" alt="2852390_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2852390&amp;topVideoCatNo=71782">Preparations underway for Barack&#8230;</a></div>
</div>
<div id="gallery_1871" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2854549&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/865386836.jpg" alt="2854549_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2854549&amp;topVideoCatNo=71782">Barack Obama promises tax cut if&#8230;</a></div>
</div>
<div id="gallery_1873" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2854526&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/107196.jpg" alt="2854526_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2854526&amp;topVideoCatNo=71782">Barack Obama accepts Democratic&#8230;</a></div>
</div>
<div id="gallery_1886" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2863331&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/34994920-31172605.jpg" alt="2863331_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2863331&amp;topVideoCatNo=71782">Barack Obama condemns rumors&#8230;</a></div>
</div>
<div id="gallery_1887" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2863387&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/35059740-31144425.jpg" alt="2863387_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2863387&amp;topVideoCatNo=71782">Barack Obama and John McCain urge&#8230;</a></div>
</div>
<div id="gallery_1680" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2742638&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/35256668-05135124.jpg" alt="7-29 (CNN) Breaking up is hard to do, especially if it's a presidential candidate you're breaking up with. They love him, they love him not. We're talking about the media and Barack Obama. Jeanne Moos reports that those in the press who follow him most closely aren't feeling all that close these days." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2742638&amp;topVideoCatNo=71782">Barack Obama&#8217;s relationship with&#8230;</a></div>
</div>
<div id="gallery_1175" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2477916&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/384707563.jpg" alt="2477916_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2477916&amp;topVideoCatNo=71782">Barack Obama</a></div>
</div>
<div id="gallery_1451" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/news/politics/la-ca-0622-presidents-pg,0,3704732.photogallery?track=rss"><img src="/wp-content/uploads/2008/11/40099116-17162042.jpg" alt="Barack Obama Photos" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/news/politics/la-ca-0622-presidents-pg,0,3704732.photogallery?track=rss">Before Barack Obama: Alternative&#8230;</a></div>
</div>
<div id="gallery_1470" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2615428&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/45171987.jpg" alt="2615428_vk" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2615428&amp;topVideoCatNo=71782">Barack Obama&#8217;s funding advantage&#8230;</a></div>
</div>
<div id="gallery_1486" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2621995&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/460582403.jpg" alt="6-24 (CNN) One of Senator Barack Obama's latest P.R. moves involves a look-alike presidential seal that definitely didn't get the official seal of approval. Jeanne Moos takes a look." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2621995&amp;topVideoCatNo=71782">Barack Obama&#8217;s seal controversy</a></div>
</div>
<div id="gallery_1487" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2621983&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/507846466.jpg" alt="6-24 (CNN) Once enemies, they're now joining forces. Democrats Barack Obama and Hillary Clinton are preparing for a rally in the aptly named Unity, New Hampshire. Candy Crowley has more." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2621983&amp;topVideoCatNo=71782">Barack Obama and Hillary Clinton&#8230;</a></div>
</div>
<div id="gallery_1490" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2622008&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/580571534.jpg" alt="6-24 (CNN) One of Senator Barack Obama's latest public relations moves involves a look-alike presidential seal that definitely didn't get the official seal of approval. Jeanne Moos takes a look." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2622008&amp;topVideoCatNo=71782">Barack Obama and Muslim voters</a></div>
</div>
<div id="gallery_1495" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2626176&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/795300114.jpg" alt="6/25 (CNN) Friday, two former primary rivals will come together for one cause, putting Senator Obama in the White House. Hillary Clinton and Barack Obama make their first joint campaign appearance Friday in Unity, New Hampshire. Today, Obama praised Senator Clinton and talked about what their hard-fought primary did to her political status." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2626176&amp;topVideoCatNo=71782">Barack Obama on Hillary Clinton</a></div>
</div>
<div id="gallery_1514" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/video/?clipId=2634673&amp;topVideoCatNo=71782"><img src="/wp-content/uploads/2008/11/861529769.jpg" alt="6-27 (CNN) Barack Obama says contrary to what some comedians are saying, he and actress Scarlett Johansson hardly know each other -- which makes their so-called &quot;break up&quot; most unusual. Jeanne Moos reports." height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/video/?clipId=2634673&amp;topVideoCatNo=71782">Barack Obama and Scarlett Johansson</a></div>
</div>
<div id="gallery_515" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/entertainment/news/la-et-popcandidates-pg,1,3609591.photogallery?track=rss"><img src="/wp-content/uploads/2008/11/867966830.jpg" alt="Barack Obama Photos" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/entertainment/news/la-et-popcandidates-pg,1,3609591.photogallery?track=rss">Pop culture candidates</a></div>
</div>
<div id="gallery_519" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/la-na-demdebate-pg,0,9946.photogallery?track=rss"><img src="/wp-content/uploads/2008/11/899943488.jpg" alt="Barack Obama Photos" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/la-na-demdebate-pg,0,9946.photogallery?track=rss">Democratic debate</a></div>
</div>
<div id="gallery_534" class="gallery_scroll_unit gallery"><a href="http://www.latimes.com/la-super_tuesday08_nation-pg,0,4952159.photogallery?track=rss"><img src="/wp-content/uploads/2008/11/906115334.jpg" alt="Barack Obama Photos" height="110" /></a> </p>
<div><a class="gallery_textlink" href="http://www.latimes.com/la-super_tuesday08_nation-pg,0,4952159.photogallery?track=rss">Super Tuesday: Nation</a></div>
</div>
</div>
</div>
<p><script type="text/javascript"><!--
  //<![CDATA[
new GalleryScroller('gallery_container', 'gallery_previous', 'gallery_next')
// --></script></div>
<p>The documentation on both of these goes into detail on how they work, so check out their <a href="http://github.com/latimes/inplace_preview/tree/master">github</a> <a href="http://github.com/latimes/gallery_scroller/tree/master">sites</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://dougmcinnes.com/2008/11/13/javascript-love/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Couple of Railsy Tidbits</title>
		<link>http://dougmcinnes.com/2008/11/10/couple-of-railsy-tidbits/</link>
		<comments>http://dougmcinnes.com/2008/11/10/couple-of-railsy-tidbits/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 19:30:43 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Los Angeles Times]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[HTTP Auth]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[subselection]]></category>
		<category><![CDATA[YAML]]></category>

		<guid isPermaLink="false">http://dougmcinnes.com/?p=19</guid>
		<description><![CDATA[I made a post on the Gem Install That blog detailing the simple_admin plugin which adds a simple authentication scheme to your Ruby on Rails application.  It stores usernames and passwords in a YAML file to make it extra easy.
Reid also posted on Gem Install That about another plugin we worked on, Subselector, which extends [...]]]></description>
			<content:encoded><![CDATA[<p>I made a post on the <a href="http://geminstallthat.wordpress.com/">Gem Install That</a> blog detailing the <a href="http://geminstallthat.wordpress.com/2008/11/07/simple_admin-met-a-pieman/">simple_admin plugin</a> which adds a simple authentication scheme to your Ruby on Rails application.  It stores usernames and passwords in a <a href="http://www.yaml.org/">YAML</a> file to make it extra easy.</p>
<p><a href="http://geminstallthat.wordpress.com/author/reidmix/">Reid</a> also posted on Gem Install That about another plugin we worked on, <a href="http://geminstallthat.wordpress.com/2008/11/01/subselector-moneypenny/">Subselector</a>, which extends ActiveRecord to give it subselection capibilities.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougmcinnes.com/2008/11/10/couple-of-railsy-tidbits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cached_resource</title>
		<link>http://dougmcinnes.com/2008/10/30/cached_resource/</link>
		<comments>http://dougmcinnes.com/2008/10/30/cached_resource/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 21:13:06 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Los Angeles Times]]></category>
		<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://dougmcinnes.com/?p=16</guid>
		<description><![CDATA[Another Ruby on Rails plugin that I&#8217;ve developed at the Los Angeles Times is cached_resource.
In a nutshell cached_resource automagically caches ActiveResource response objects in a memcached instance.  The plugin requires cache_fu for memcached configuration goodness.  See also: Kickin&#8217; ass with cache-fu.
The code for cached_resource is also up on GitHub along with a many other Los [...]]]></description>
			<content:encoded><![CDATA[<p>Another Ruby on Rails plugin that I&#8217;ve developed at the <a href="http://latimes.com/">Los Angeles Times</a> is <a href="http://github.com/latimes/cached_resource/tree/master">cached_resource</a>.</p>
<p>In a nutshell cached_resource automagically caches <a href="http://api.rubyonrails.org/classes/ActiveResource/Base.html">ActiveResource</a> response objects in a <a href="http://www.danga.com/memcached/">memcached</a> instance.  The plugin requires <a href="http://github.com/defunkt/cache_fu/tree/master">cache_fu</a> for memcached configuration goodness.  See also: <a href="http://errtheblog.com/posts/57-kickin-ass-w-cachefu">Kickin&#8217; ass with cache-fu</a>.</p>
<p>The code for cached_resource is also up on <a href="http://github.com/">GitHub</a> along with a many other Los Angeles Times plugins and other tidbits.  You can find it here: <a href="http://github.com/latimes/cached_resource/tree/master">http://github.com/latimes/cached_resource/tree/master</a></p>
<p>So, how do you get it to work?  After dropping the plugins in <strong>vendor/plugins</strong>, set up your cache_fu configuration then drop this single line in any of your ActiveResource models:</p>
<pre>class MyClass &lt; ActiveResource::Base
  <strong>cached_resource</strong>
end</pre>
<p>The cached_resource call also takes normal cache_fu options:</p>
<pre>class MyClass &lt; ActiveResource::Base
  <strong>cached_resource :ttl =&gt; 15.minutes</strong>
end</pre>
<p>So now every time you run a <strong>.find()</strong> on <strong>MyClass</strong> the results will be cached for the next time you do the same kind of find.  The cache key is the URI of the ActiveRecord generated REST query.</p>
<p>In addition, if you do <strong>MyClass.find(:all)</strong> or the like to get a list of resources, individual instances in the returned list will be cached separately and the list itself will be distilled down to IDs before it&#8217;s stuffed in its own cache bucket.  When pulled from the cache the list will be reconstituted by pulling the individual objects from the cache by ID or making additional ActiveResource queries to get objects that have fallen out for one reason or another. The upshot of this is you&#8217;ll have less of a chance of stale data between mixed finds.</p>
<p>The cached_resource plugin makes some assumptions about how your REST service is set up.  If the REST service you&#8217;re pointing to with ActiveResource are wacky, i.e. not conforming to exactly what ActiveResource expects its URLs to be, this plugin will probably not work for you.  That said, if you can do normal finds with IDs, like <strong>MyClass.find(123)</strong>, you&#8217;ll probably be fine.</p>
<p>This plugin was written before <a href="http://thewebfellas.com/blog/2008/6/9/rails-2-1-now-with-better-integrated-caching">memcached support was baked into Rails 2.1</a> so if anyone wants to fork and get it working please be my guest!  I&#8217;ll be happy to pull it back in <img src='http://dougmcinnes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Credit where credit is due: <a href="http://kleinptr.wordpress.com/">Josh Kleinpeter</a> originally came up with the cached_resource concept and Subba Rao helped to lay the groundwork.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougmcinnes.com/2008/10/30/cached_resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Craken</title>
		<link>http://dougmcinnes.com/2008/07/14/craken/</link>
		<comments>http://dougmcinnes.com/2008/07/14/craken/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 18:53:09 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Los Angeles Times]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[craken]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://dougmcinnes.com/?p=14</guid>
		<description><![CDATA[This is the first of hopefully many (a few?) Ruby on Rails plugins I&#8217;ve created as a developer for the Los Angeles Times.
This one is called Craken.  In a nutshell it manages and installs rake-centric cron jobs.  Coupled with Capistrano goodness it is the answer to your recurring task needs in Rails.
It&#8217;s up on GitHub: [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first of hopefully many (a few?) Ruby on Rails plugins I&#8217;ve created as a developer for the <a href="http://latimes.com">Los Angeles Times</a>.</p>
<p>This one is called Craken.  In a nutshell it manages and installs <a title="Simple ruby build program with capabilities similar to make. " href="http://rake.rubyforge.org/">rake</a>-centric <a title="Time-based scheduling service in Unix-like computer operating systems." href="http://en.wikipedia.org/wiki/Cron">cron</a> jobs.  Coupled with <a title="Tool for automating tasks on one or more remote servers." href="http://www.capify.org/">Capistrano</a> goodness it is the answer to your recurring task needs in Rails.</p>
<p>It&#8217;s up on <a title="new hotness" href="http://github.com/">GitHub</a>: <a href="http://github.com/latimes/craken/tree/master">http://github.com/latimes/craken/tree/master</a></p>
<p>Here&#8217;s the deal: with many web applications comes the need to do recurring tasks on the servers the application runs on.  These sorts of tasks can range from running backups, clearing caches, emailing notices and other such maintenance-y things.</p>
<p>Who manages these tasks?  Ideally the task code as well as configuration and timing should be kept with the source code of the application itself and not as part of some further set of scripts that reside in a dubious location in your source control.  This is what Craken does.</p>
<p>The tasks are defined as rake tasks within the application.  Craken itself is a rake task that sets up a crontab for defined tasks based on your current application configuration.  The plugin also includes a Capistrano recipe that runs the Craken rake task on remote servers making deployment a breeze.</p>
<p>Craken, by default, looks for recurring task definitions here:</p>
<pre>RAILS_ROOT/config/craken/crontab</pre>
<p>You can also define tasks for a particular machine by prefixing the machine name (separated with an underscore):</p>
<pre>RAILS_ROOT/config/craken/MyMachineName_crontab</pre>
<p>The file format is modeled after crontab:</p>
<pre>30 1 * * * thing:to_do</pre>
<p>In this case <em>thing:to_do</em> is a rake task.  It will run at 1:30 AM every morning (take a look at the <a href="http://unixnotes.wordpress.com/2006/04/14/cron-format-crontab/">crontab format</a> if this makes no sense).</p>
<p>The command to install the cron job locally:</p>
<pre>% rake craken:install</pre>
<p>If you&#8217;re using Capistrano for deployment (and you really should) a recipe is provided to run <em>craken:install</em> on remote machines.  Your Capistrano configuration needs to define a <strong>:cron</strong> role so the recipe knows which machines it should run the command on.</p>
<pre>% cap craken:install</pre>
<p>Ideally you can make craken:install part of your deployment configuration, <strong>:after_deploy</strong> would be a good place to put it.  Craken overwrites the existing configuration for the application on the machine so running it multiple times is not a problem.  Running multiple apps on the same machine or cron jobs placed by hand?  No worries, Craken delimits the lines it generates in crontab with comments and doesn&#8217;t disturb existing entries.</p>
<p>For more information about the plugin, peruse the <a href="http://github.com/latimes/craken/tree/master/README">README</a> file.</p>
<p>If you have any questions/comments/suggestions about Craken please leave a comment!</p>
<p>The name &#8220;Craken&#8221; generously suggested by <a href="http://gilesbowkett.blogspot.com/">Giles Bowkett</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougmcinnes.com/2008/07/14/craken/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
