<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Retina Technology Blog &#187; rubyrails</title>
	<atom:link href="http://www.retina.net/tech/category/rubyrails/feed" rel="self" type="application/rss+xml" />
	<link>http://www.retina.net/tech</link>
	<description>John Adams' views on emerging technologies, software engineering, and various hacks</description>
	<lastBuildDate>Tue, 06 Jul 2010 02:34:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9;John Adams </copyright>
		<managingEditor>jna@retina.net (John Adams)</managingEditor>
		<webMaster>jna@retina.net(John Adams)</webMaster>
		<category></category>
		<ttl>1440</ttl>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>John Adams' views on emerging technologies, software engineering, and various hacks</itunes:summary>
		<itunes:author>John Adams</itunes:author>
		<itunes:category text="Technology"/>
<itunes:category text="Technology">
  <itunes:category text="Tech News"/>
</itunes:category>
		<itunes:owner>
			<itunes:name>John Adams</itunes:name>
			<itunes:email>jna@retina.net</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://www.retina.net/tech/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://www.retina.net/tech/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>Retina Technology Blog</title>
			<link>http://www.retina.net/tech</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Unicorn Power</title>
		<link>http://www.retina.net/tech/unicorn-power.html</link>
		<comments>http://www.retina.net/tech/unicorn-power.html#comments</comments>
		<pubDate>Wed, 31 Mar 2010 01:25:51 +0000</pubDate>
		<dc:creator>John Adams</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[rubyrails]]></category>
		<category><![CDATA[software engineering]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.retina.net/tech/unicorn-power.html</guid>
		<description><![CDATA[Ben Sandofsky and I just put a new post on the Twitter Engineering blog about our transition to Unicorn. 
http://engineering.twitter.com/2010/03/unicorn-power.html
]]></description>
			<content:encoded><![CDATA[<p>Ben Sandofsky and I just put a new post on the Twitter Engineering blog about our transition to Unicorn. </p>
<p><a href="http://engineering.twitter.com/2010/03/unicorn-power.html">http://engineering.twitter.com/2010/03/unicorn-power.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.retina.net/tech/unicorn-power.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Photocasting to iPhoto with Ruby</title>
		<link>http://www.retina.net/tech/photocasting-to-iphoto-with-ruby.html</link>
		<comments>http://www.retina.net/tech/photocasting-to-iphoto-with-ruby.html#comments</comments>
		<pubDate>Thu, 01 Jan 2009 04:06:59 +0000</pubDate>
		<dc:creator>John Adams</dc:creator>
				<category><![CDATA[media]]></category>
		<category><![CDATA[rubyrails]]></category>
		<category><![CDATA[stuff]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.retina.net/tech/?p=177</guid>
		<description><![CDATA[Today we&#8217;re going to teach you how to deal with having too many computers. Moving media around is a living hell because iPhoto and iTunes assume that you only ever possess one library. Sure, you can play music and movies purchased in the store on multiple machines, but what about your own library? How do [...]]]></description>
			<content:encoded><![CDATA[<p>Today we&#8217;re going to teach you how to deal with having too many computers. Moving media around is a living hell because iPhoto and iTunes assume that you only ever possess one library. Sure, you can play music and movies purchased in the store on multiple machines, but what about your own library? How do you use that on multiple machines without moving things around?</p>
<p>At home I have a number of Macs, with one large machine (~1.5TB disk, 4 GB RAM) dedicated to digital photo editing. This machine houses a large volume of photos in it&#8217;s &#8220;Final Exports&#8221; folder. It&#8217;s not my main computer &#8211; my main computer is a MacBook Pro which travels with me nearly everywhere, and when I don&#8217;t have that, I have my iPhone.</p>
<p>I want my photos with me everywhere (or, at least, the last few hundred of them) so I can show people the last great event I went to, or that thing in the club that time. Here&#8217;s my solution.</p>
<p>1) Keep the photos on the large machine, where I edit photos in Adobe Lightroom and export them to the &#8220;Final Exports&#8221; folder.</p>
<p>2) Keep the laptop as the primary sync machine for the iPhone</p>
<p>3) Sync the iphone to the laptop, and retrieve the latest photos.</p>
<p>iPhoto 7 has a wonderful feature called Photocasting which will read lists of latest photos from the Internet (say, flickr, for example.) using a format that is very similar to RSS, but completely not compliant with current RSS standards.</p>
<p>The following Ruby script, and ERB template will turn a directory of directories into a pubsub feed for iphoto. You save your files in this form:</p>
<p>Final_Exports/dir1</p>
<p>Final_Exports/dir1/1.jpg</p>
<p>Final_Exports/dir1/2.jpg (and so on&#8230;)</p>
<p>Final_Exports/dir2</p>
<p>Final_Exports/dir&#8230;</p>
<p>Final_Exports/dirN (and so on&#8230;)</p>
<p>I use the scripts to generate RSS, and then put the RSS file somewhere on the Internet (the same directory with the photos works well, as my machines are internet accessible.) Running the script from cron once a day and syncing the phone, keeps you up to date.</p>
<p><strong>Scripts:</strong></p>
<p><a href="http://gw.retina.net/iphotorss/makeiphotorss.rb">makeiphotorss.rb</a></p>
<p><a href="http://gw.retina.net/iphotorss/makeiphotorss.erb">makeiphotorss.erb</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.retina.net/tech/photocasting-to-iphoto-with-ruby.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Autocomplete in rails 2.0</title>
		<link>http://www.retina.net/tech/autocomplete-in-rails-20.html</link>
		<comments>http://www.retina.net/tech/autocomplete-in-rails-20.html#comments</comments>
		<pubDate>Thu, 20 Mar 2008 09:08:23 +0000</pubDate>
		<dc:creator>John Adams</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[rubyrails]]></category>
		<category><![CDATA[software engineering]]></category>

		<guid isPermaLink="false">http://www.retina.net/tech/autocomplete-in-rails-20.html</guid>
		<description><![CDATA[There&#8217;s been some changes in the way that Rails 2.0 processes forms and form interaction with Ajax. Here&#8217;s a quick write-up on how to use auto completion in Rails 2.0 without a database connection.
In my case, I was parsing an Apache configuration file and displaying VirtualHost entries, but you can use this for just about anything [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been some changes in the way that Rails 2.0 processes forms and form interaction with Ajax. Here&#8217;s a quick write-up on how to use auto completion in Rails 2.0 without a database connection.</p>
<p>In my case, I was parsing an Apache configuration file and displaying VirtualHost entries, but you can use this for just about anything (of course, models work too if you&#8217;d like to go against the DB)</p>
<p>First, install the auto complete plugin. Rails 2.0 doesn&#8217;t have autocomplete in the core anymore, so you&#8217;ll have to create your project with the usual <strong>rails myproject</strong> syntax, and then enter that directory with <strong>cd myproject</strong>.</p>
<p>Type &#8220;script/plugin install auto_complete&#8221; to install the auto complete plugin.</p>
<p>Next, we create a simple class to hold our data. You could parse a file here (say, with File.open()), or pull data from other sources in the initialize function of this class. If you&#8217;ve got a model in the database, you can use that.</p>
<p>class Apacheconf</p>
<p>@names = []</p>
<p>def names<br />
@names<br />
end</p>
<p>def initialize<br />
# replace this code later with parsing code</p>
<p>@names = Array.new<br />
@names &lt;&lt; &#8220;alpha&#8221;<br />
@names &lt;&lt; &#8220;beta&#8221;<br />
@names &lt;&lt; &#8220;gamma&#8221;<br />
@names &lt;&lt; &#8220;delta&#8221;<br />
end</p>
<p>end</p>
<p>&#8230; then we add some code and CSS to our view for the affiliate/index method in app/views/affiliate/index.rhtml</p>
<p>&lt;html&gt;</p>
<p>&lt;head&gt;</p>
<p>&lt;%= javascript_include_tag :defaults %&gt;</p>
<p>&lt;style&gt;</p>
<p>div.auto_complete {<br />
  width: 300px; <br />
  background: #fff; <br />
} </p>
<p>div.auto_complete ul { <br />
  border: 1px solid #888; <br />
  margin: 0px; <br />
  padding: 0px; <br />
  width: 100%; <br />
  list-style-type: none; <br />
} </p>
<p>div.auto_complete ul li { <br />
  margin: 0px; <br />
  padding: 3px; <br />
} </p>
<p>div.auto_complete ul li.selected { <br />
  background-color: #ffb; <br />
} </p>
<p>div.auto_complete ul strong.highlight { <br />
  color: #800; <br />
  margin: 0px; <br />
  padding: 0px; <br />
} </p>
<p>&lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;% form_tag :action =&gt; &#8220;edit&#8221; do %&gt;<br />
&lt;p&gt;&lt;%= text_field &#8216;affiliate&#8217;, &#8216;name&#8217;, :autocomplete =&gt; &#8216;off&#8217; %&gt;&lt;/p&gt;<br />
&lt;div class=&#8221;auto_complete&#8221; id=&#8221;affiliate_name_auto_complete&#8221;&gt;&lt;/div&gt; <br />
&lt;%= auto_complete_field :affiliate_name,<br />
     :url =&gt; { :action=&gt;&#8217;autocomplete_affiliate_name&#8217; },<br />
     :tokens =&gt; &#8216;,&#8217; %&gt;<br />
    &lt;%= submit_tag %&gt;<br />
    &lt;% end %&gt;<br />
&lt;/body&gt;</p>
<p>&#8230; and then we insert a very small amount of code into the controler (in app/controllers/affiliate_controler.rb)  to handle the Ajax callback:</p>
<p>class AffiliateController &lt; ApplicationController<br />
  skip_before_filter :verify_authenticity_token, <img src='http://www.retina.net/tech/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly =&gt; [:autocomplete_affiliate_name]  </p>
<p>  def autocomplete_affiliate_name<br />
     # this code is called over and over again by Ajax<br />
     #<br />
     # the next line does a search through the array for terms starting with the <br />
     # specified parameters.</p>
<p>     @x = Apacheconf.new.names<br />
     @affiliates = @x.select { |v| v =~ /^#{params[:affiliate][:name]}/ }</p>
<p>     # don&#8217;t render the layout &#8211; we only want the partial to be rendered<br />
     render :layout=&gt;false <br />
  end</p>
<p>end</p>
<p> </p>
<p>The beauty of this that with the plugin installed, it takes very little work to get autocomplete working.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.retina.net/tech/autocomplete-in-rails-20.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
