<?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>Nate Miller &#187; Technology</title>
	<atom:link href="http://www.natemiller.org/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.natemiller.org</link>
	<description>Waxing poetic about the internet</description>
	<lastBuildDate>Fri, 19 Mar 2010 22:07:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Art of Abstraction</title>
		<link>http://www.natemiller.org/2010/03/19/the-art-of-abstraction/</link>
		<comments>http://www.natemiller.org/2010/03/19/the-art-of-abstraction/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 22:07:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.natemiller.org/?p=120</guid>
		<description><![CDATA[Think for a moment about the word &#8216;abstract&#8217; and its definition. When you think of an object, like a table for sake of example, what image comes to your mind? Most certainly, your image is different from mine. My mental image of a table looks a lot like the dinner table I sat at while [...]]]></description>
			<content:encoded><![CDATA[<p>Think for a moment about the word &#8216;abstract&#8217; and its <a href="http://www.merriam-webster.com/dictionary/abstract" target="_blank">definition</a>. When you think of an object, like a table for sake of example, what image comes to your mind? Most certainly, your image is different from mine. My mental image of a table looks a lot like the dinner table I sat at while growing up, while your table may look like the one sitting in your dining room. Yet I can use the word &#8216;table&#8217; in a conversation and you will instantly know what I&#8217;m referencing without knowing exactly what my version of a table looks like. We take this mental feat for granted every day as it allows us to communicate easily without getting bogged down into details.</p>
<p>Why am I so interested in abstraction? As I grow older, my experiences shape my own personal perspective about various activities, processes, etc. My perspective is really an abstraction &#8211; a view of reality as I see it. Being able to abstract a process or object allows me to do complex things like design a website or write software. Similarly, personal abstractions grant me the ability to see common links between seemingly disparate processes, like graphic design and software design. On the surface, graphic and software design seem very dissimilar, but the processes which lead to good software are the same that lead to good design.</p>
<p>Successful graphic design requires the ability to break an object into its components. As a designer, I need to prioritize the messages in my work and build common threads which unite them into a single object (a website, a poster, etc). These common threads can be elements like color, logo, typography, and any number of similar choices. When each of these elements are combined by a skilled designer, great work happens. Imagine the last time you saw graphic design that really moved you. Did it make you want to purchase something? Did it make you think fondly of the company responsible for producing the work? Did you share this work with others and if so, did they feel the same way?</p>
<p>In today&#8217;s socially-connected world, we are constantly barraged with things that other people think are cool. When a large group of people react in a similar way to a single input &#8211; like a music video or a tv commercial &#8211; these people share a common abstraction. While everyone&#8217;s personal interpretation may be different, the aggregate of all interpretations can often be quite similar. This abstract entity &#8211; which cannot be held or quantified &#8211; can be as simple as a positive impression of a company. When shared across a large group of people, this abstraction becomes quite powerful. This is brand. But it&#8217;s also good design, productive software, and great music.</p>
<p>No matter what type of <em>thing</em> you are trying to create, the ultimate success of that thing is comprised of the many little creative choices determining the final finished work. When these little pieces are all skillfully connected, we allow our audience to successfully abstract meaning from our work. The production of a website, for instance, can easily include thousands of minute decisions which may impede a positive impression from our audience. The graphic appearance of website can be phenomenal, but if it is not easy to use, the audience is less likely to derive a positive impression. This is the art of abstraction &#8211; creating greater meaning from thousands of tiny moving pieces which often seem trivial when viewed on a smaller scale.</p>
<p>Abstraction ain&#8217;t easy &#8211; it&#8217;s actually quite difficult. As an endeavor, abstraction requires removing oneself from the smaller task at hand to visualize the end product. It&#8217;s so simple to get bogged down in the details of a process, but our biggest successes often come when we&#8217;re able to objectively look at the whole and adjust our behavior accordingly. This is perhaps why many psychologists have suggested that imagining oneself succeed can greatly increase the probability of success.</p>
<p>The next time you run into a problem with no apparent solution, try and remove yourself from the process and focus on the end goal. There&#8217;s always a way &#8211; it just depends on your <span style="text-decoration: line-through;">perspective</span> abstraction.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2010/03/19/the-art-of-abstraction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PulseCheck: A Simple Tool for Monitoring Server Uptime</title>
		<link>http://www.natemiller.org/2010/03/06/pulsecheck-a-simple-tool-for-monitoring-server-uptime/</link>
		<comments>http://www.natemiller.org/2010/03/06/pulsecheck-a-simple-tool-for-monitoring-server-uptime/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 21:56:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.natemiller.org/?p=114</guid>
		<description><![CDATA[I really hate flying. Flying has 2 major drawbacks: one, it requires uncomfortable sitting in close quarters (note: I&#8217;m 6&#8242;3), and second, it almost never has internet. On long flights, I do what any other geek would &#8211; I end up programming. Quite often, bored and internet-less programming turns into solving some problem which has [...]]]></description>
			<content:encoded><![CDATA[<p>I really hate flying. Flying has 2 major drawbacks: one, it requires uncomfortable sitting in close quarters (note: I&#8217;m 6&#8242;3), and second, it almost never has internet. On long flights, I do what any other geek would &#8211; I end up programming. Quite often, bored and internet-less programming turns into solving some problem which has been solved many times before. This was one of those problems.</p>
<p>I needed a quick script which could rip through a list of hundreds of urls and evaluate each url for an expected &#8216;200&#8242; response value indicating that the website was &#8216;ok.&#8217; If something other than a 200 was returned, I wanted to know about it. Performance speed was not a concern.</p>
<p>The solution was a dead simple Ruby program. Using a single .txt file, you can define all the people who need to receive notification, and all the URLs that need to be checked. You can easily automate the process by running the script as a cron task. That solved my problem and killed some time.</p>
<p><a href="http://github.com/nate63179/PulseCheck">PulseCheck on GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2010/03/06/pulsecheck-a-simple-tool-for-monitoring-server-uptime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sync a database with Capistrano</title>
		<link>http://www.natemiller.org/2009/10/11/sync-a-remote-database-to-local-with-capistrano/</link>
		<comments>http://www.natemiller.org/2009/10/11/sync-a-remote-database-to-local-with-capistrano/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 08:53:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.natemiller.org/?p=78</guid>
		<description><![CDATA[A quick capistrano task for synchronizing a remote database to your local development environment]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick capistrano task for synchronizing a remote database to your local development environment:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:application</span>, <span style="color:#996600;">&quot;appname&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:application_path</span>, <span style="color:#996600;">&quot;/home/someurl/apps&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:user</span>, <span style="color:#996600;">&quot;appuser&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:password</span>, <span style="color:#996600;">&quot;***********&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:use_sudo</span>, <span style="color:#0000FF; font-weight:bold;">false</span>
&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:production_database</span>,<span style="color:#996600;">'mydb_production'</span>
set <span style="color:#ff3333; font-weight:bold;">:production_dbhost</span>, <span style="color:#996600;">'localhost'</span>
set <span style="color:#ff3333; font-weight:bold;">:dbuser</span>, <span style="color:#996600;">'dbadmin'</span>
set <span style="color:#ff3333; font-weight:bold;">:dbpass</span>, <span style="color:#996600;">'************'</span>
&nbsp;
desc <span style="color:#996600;">&quot;Synchronizes remote database to local development database&quot;</span>
task <span style="color:#ff3333; font-weight:bold;">:sync_to_local</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:web</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    sql_out = <span style="color:#996600;">&quot;#{environment_database}.sql&quot;</span>
    run <span style="color:#996600;">&quot;mysqldump --user #{dbuser} --password=#{dbpass} #{environment_database} &gt; #{sql_out}&quot;</span>
    <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;sftp #{user}@mywebserver.com:#{sql_out} /tmp/#{sql_out}&quot;</span>
    run <span style="color:#996600;">&quot;rm #{sql_out}&quot;</span>
    <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;mysql -u #{dbuser} --password=#{dbpass} somedatabase_development &lt; /tmp/#{sql_out}&quot;</span>
    <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;rm /tmp/#{sql_out}&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2009/10/11/sync-a-remote-database-to-local-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Painless db backups in Rails</title>
		<link>http://www.natemiller.org/2009/10/10/create-a-database-backup-with-rails/</link>
		<comments>http://www.natemiller.org/2009/10/10/create-a-database-backup-with-rails/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 08:00:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://dev.natemiller.org/?p=3</guid>
		<description><![CDATA[A simple way to automate the generation of a MySQL database backup.]]></description>
			<content:encoded><![CDATA[<p>Quite often in Rails projects, I need some way to backup the contents of database quickly. The script below is an easy way to backup the database of your current environment using the database.yml file already set up in your Rails project. Feel free to modify the below script to do your bidding.</p>
<p>/script/backup_db:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'/../config/boot'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'erb'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'yaml'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">unless</span> config = <span style="color:#CC00FF; font-weight:bold;">YAML</span>::<span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">ERB</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">IO</span>.<span style="color:#9900CC;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span>RAILS_ROOT <span style="color:#006600; font-weight:bold;">+</span>
<span style="color:#996600;">&quot;/config/database.yml&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#91;</span>RAILS_ENV<span style="color:#006600; font-weight:bold;">&#93;</span>
   abort <span style="color:#996600;">&quot;No database found for environment '#{RAILS_ENV}'&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
db_out_path = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>RAILS_ROOT, <span style="color:#996600;">'tmp'</span>, <span style="color:#996600;">&quot;dbdump_#{RAILS_ENV}.sql&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;mysqldump -u #{config['username']} --password=#{config['password']}
 #{config['database']} &gt;; #{db_out_path}&quot;</span></pre></div></div>

<p>To run your backup, just execute this from your rails root:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">script<span style="color:#006600; font-weight:bold;">/</span>backup_db RAILS_ENV=production</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2009/10/10/create-a-database-backup-with-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated image sharpening</title>
		<link>http://www.natemiller.org/2009/02/28/automated-image-sharpening/</link>
		<comments>http://www.natemiller.org/2009/02/28/automated-image-sharpening/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 18:41:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://dev.natemiller.org/?p=28</guid>
		<description><![CDATA[An easy way to automate image sharpening for photos uploaded into Ruby on Rails. This article discusses how to set up Paperclip and ImageMagick to unsharpen your photos automatically.]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p>Working in an agency setting, where the crispness and clarity of your images is extremely important, writing web systems that automatically generate thumbnails can be problematic. When resizing images downwards, as is often the case in thumbnail generation, pixel values are approximated from their original size. These approximations can result in thumbnail images which are blurry and difficult to read. The bigger the change in pixel size, the more dramatic the effect. So if you resize a 900&#215;900px image into 120&#215;120, you will see a major difference in clarity.</p>
<p>Photoshop has several methods for dealing with these approximations when resizing images &#8211; namely the Bicubic Sharpening interpolation method and the Unsharp filter. Both of these methods help improve image quality when resizing downwards.</p>
<p>The best way to see what I&#8217;m describing is through example:</p>
<div id="attachment_38" class="wp-caption alignnone" style="width: 455px"><img class="size-full wp-image-38" title="sharpening_example" src="http://www.natemiller.org/wp-content/uploads/2009/10/sharpening_example.jpg" alt="Example of image sharpening in action" width="445" height="263" /><p class="wp-caption-text">Example of image sharpening in action</p></div>
<p>If we rely on out-of-the-box image resizing methods typically available, we usually end up with thumbnails that look like the upper right photo: blurry and unclear. However, we can easily have our applications automatically apply an unsharpening mask when we generate thumbnails. For instance a common image library used in online applications is ImageMagick &#8211; which has all sorts of features which can help our images maintain quality at smaller sizes.</p>
<p>In a recent project, I was tasked with creating a portfolio system which would be used to showcase work. The requirements were that the system should upload an image file and automatically generate several sizes of thumbnails to be used throughout the website. However, the thumbnails need to have the same crispness of their original full-size counterparts.</p>
<h2>The Solution</h2>
<p>The solution is in fact amazingly simple. Here are some quick assumptions:</p>
<ul>
<li>The platform where we&#8217;re running our web app has &#8220;ImageMagick&#8221;:http://www.imagemagick.org/script/index.php installed</li>
<li> We&#8217;re using the &#8220;Papercilp&#8221;:http://www.thoughtbot.com/projects/paperclip plugin to handle uploading and thumbnail processing</li>
</ul>
<p>Here&#8217;s the code we place at the top of our model which will be responsible for accepting uploaded photos:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Project <span style="color:#006600; font-weight:bold;">&amp;</span>lt; <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
   has_attached_file <span style="color:#ff3333; font-weight:bold;">:hero_shot</span>,
     <span style="color:#ff3333; font-weight:bold;">:styles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:large</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;500x500&quot;</span>,
     <span style="color:#ff3333; font-weight:bold;">:medium</span> <span style="color:#006600; font-weight:bold;">=&gt;</span>; <span style="color:#996600;">&quot;300x300&amp;gt;&quot;</span>,
     <span style="color:#ff3333; font-weight:bold;">:thumb</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;100x100&amp;gt;&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
     <span style="color:#ff3333; font-weight:bold;">:convert_options</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:all</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;-unsharp 0.3x0.3+5+0&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>With the above declaration in our model, Paperclip will create 3 thumbnails in 3 different sizes. The :convert_options hash is where we define how the photo will be processed and is responsible for performing the unsharpening. Passing the :convert_options hash allows us to specify specific instructions to ImageMagick &#8211; just like if we were using the ImageMagick library from the command line. Let&#8217;s take a look at the code which provides the unsharpening:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">-</span>unsharp 0.3x0.3<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">+</span><span style="color:#006666;">0</span></pre></div></div>

<p>So where did we come up with this strange looking command? Essentially this is the same as executing &#8220;convert -unsharp 0.3&#215;0.3+5+0 IMAGE.jpg NEW_IMAGE.jpg&#8221; from the command line. The :convert_options hash is basically a list of parameters that Paperclip will be passing to the ImageMagick &#8220;convert&#8221; command. The command above is telling ImageMagick to unsharpen each of our photos. If you want a more detailed explanation, please see <a href="http://redskiesatnight.com/2005/04/06/sharpening-using-image-magick/">this great blog post</a> about fine-tuning this command. As is shown here, this command is performing an unsharp mask of a radius of 0.3 pixels, with an amount of 5.0 applied to it (in relation to the Photoshop effect, this is equivalent to an amount value of 500% at 0.3 pixel radius).</p>
<p>That&#8217;s it &#8211; now when we upload a photo, Paperclip will automatically resize and unsharpen our photos. The result is thumbnail photos which are more clear and truer to the original image.</p>
<h3>Resources</h3>
<ul>
<li><a href="http://www.thoughtbot.com/projects/paperclip">Paperclip plugin/gem</a></li>
<li><a href="http://railscasts.com/episodes/134-paperclip">Railscasts &#8211; Paperclip</a></li>
<li><a href="http://redskiesatnight.com/2005/04/06/sharpening-using-image-magick/">Unsharpening with ImageMagick</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2009/02/28/automated-image-sharpening/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Server</title>
		<link>http://www.natemiller.org/2009/02/23/new-server/</link>
		<comments>http://www.natemiller.org/2009/02/23/new-server/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 19:00:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.natemiller.org/?p=55</guid>
		<description><![CDATA[My blog, music server, linux playground, etc&#8230;, was down for a period of several months due to some hardware that finally gave up the fight. I&#8217;m proud to be back online with a new, and much more powerful, server that I received from my good friends at Metro Hi Speed. Having nothing bad to say [...]]]></description>
			<content:encoded><![CDATA[<p>My blog, music server, linux playground, etc&#8230;, was down for a period of several months due to some hardware that finally gave up the fight. I&#8217;m proud to be back online with a new, and much more powerful, server that I received from my good friends at <a href="http://www.metrofax.com">Metro Hi Speed</a>. Having nothing bad to say about Ubuntu or other linux based alternatives out there, I decided to rebuild on top of CentOS 5- if for nor other reason than boredom and my need to tinker. In the process of becoming better accustomed with the <del>frustration</del> charm of the world outside of debian, I&#8217;ve come to love my new machine. Let&#8217;s hope this one lasts longer than its predecessor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2009/02/23/new-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 Reasons to Use Rails</title>
		<link>http://www.natemiller.org/2009/02/22/5-reasons-to-use-rails/</link>
		<comments>http://www.natemiller.org/2009/02/22/5-reasons-to-use-rails/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 18:48:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.natemiller.org/?p=49</guid>
		<description><![CDATA[One axiom overheard constantly throughout the blogs and forums of the internet&#8217;s technorati, is &#8220;use the right tool for the job.&#8221; Generally this nugget is brought up in conversations questioning whether one should use framework A or framework B, language C or language D, etc&#8230; Invariably, people get pissed, comments get ridiculous, and &#8220;that guy&#8221;:http://www.geekitude.com/Pictures/Linucon2004/Ex45TronUpCloseRot.jpg [...]]]></description>
			<content:encoded><![CDATA[<p>One axiom overheard constantly throughout the blogs and forums of the internet&#8217;s technorati, is &#8220;use the right tool for the job.&#8221; Generally this nugget is brought up in conversations questioning whether one should use framework A or framework B, language C or language D, etc&#8230; Invariably, people get pissed, comments get ridiculous, and &#8220;that guy&#8221;:http://www.geekitude.com/Pictures/Linucon2004/Ex45TronUpCloseRot.jpg eventually shows up to tell everyone that they&#8217;re retards for not using Lisp. This is not one of those articles. Having spent too much of my life reading those posts, trying to decipher if tool A is right for feature-that-needs-to-go-live-next-week-or-else-you&#8217;ll-be-replaced-by-10-indian-programmers, I&#8217;ve decided to write up some reasons why you just may want to consider to start using Rails.</p>
<p>Before going much further, I should state that I enjoy programming just about anything and in about any language. A good weekend for me almost always includes compilation of source code and a strong beer–the order and frequency of the two being highly dependent on the preceding 5 days. But take my opinions with a grain of salt. These opinions are from a geek working in the ad world where development cycles are extremely tiny and our requirement list is often very different from software development studios.</p>
<h3>1. Rails deployment are now almost as easy as PHP deployments</h3>
<p>It used to be that Rails&#8217; biggest hurdle was deployment. Having set up many mongrel-based deployment schemes, I can understand why Rails scared away a lot of people. However, with stability of &#8220;Phusion Passenger&#8221;:http://www.modrails.com/, setting up a Rails app is now just as trivial as PHP. If you&#8217;re worried about stability, it may be worth it to know there are a handful of large websites now using Passenger, including &#8220;Shopify&#8221;:http://www.shopify.com and even &#8220;NY Times&#8221;:http://www.nytimes.com. We deploy all of our Rails sites through Passenger and have not had one major problem yet.</p>
<h3>2. Test like a pro</h3>
<p>If you enjoy working within the MVC paradigm and you feel guilty about writing code before you write a test, Rails provides a wealth of features proven in the .NET and Java enterprise landscape, and adapts them to the flexible Ruby language. Test and Behavior driven development approaches are easy to follow in Rails.</p>
<h3>3. You want easy object relational mapping</h3>
<p>ActiveRecord is a thing of beauty. Does it work for every possible situation? Nope, but it gets you pretty darn close. The first time I made a database query in Rails, my jaw dropped.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">User.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#996600;">'created_at &amp;lt; ?'</span>, <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span> <span style="color:#006600; font-weight:bold;">-</span> 1.<span style="color:#9900CC;">days</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Even if you haven&#8217;t used Rails before, what that tiny command does is probably pretty obvious. While ActiveRecord is not an excuse for any developer to forget SQL entirely, it helps us with the low hanging fruit in our systems and lets us spend more time where we should really be using our brains.</p>
<h3>4. You&#8217;re really tired of FTP</h3>
<p>I have a confession &#8211; you don&#8217;t need to use Rails to take advantage of automated deployments with the amazing &#8220;Capistrano&#8221;:http://www.capify.org/ tool. Launching new deployments of client websites is now as easy as executing the following command from the command line:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">cap production deploy</pre></div></div>

<p>This line, after some configuration of course, will completely deploy my application from a repository, run any database migrations, reset my daemons, and keep a copy of the last version in case something is botched. Rolling back is easy:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">cap production deploy:rollback</pre></div></div>

<p>Boom! I&#8217;m right back to the last version before the client even saw the nasty 500 error header on their contact page. Whew! (Not that this ever happens of course&#8230;eh-hem).</p>
<h3>5. You want easier maintainability</h3>
<p>There is no such thing as a sealed class in Ruby. That means if I don&#8217;t like Ruby&#8217;s String class, I can easily rewrite it to suit my needs (otherwise known as *monkey-patching*) at any time throughout a program&#8217;s execution. This is both very dangerous and a very awesome for some fairly obvious reasons. If we have interoperability between 2 different software libraries, we can easily patch the deficiencies ourselves while keeping the original libraries intact. If you don&#8217;t like how Rails handles error messages, you can easily override the offending method or patch the functionality how you see fit.</p>
<p>Is this approach to software development raising some red flags? It should, but there&#8217;s a way to make ourselves feel better. With a strong system of unit tests in place, we give ourselves an easy way to assure that functionality remains unchanged when software updates roll out, or requirements of a component change. While the dynamic aspects of Ruby can cause us some serious headaches if we abuse this power, we can save ourselves significant work by writing small patches instead of modifying many different source files.</p>
<h2>Conclusion</h2>
<p>I talked about a lot of different things, and admittedly, didn&#8217;t go into a lot of depth. But if you&#8217;re curious about what it&#8217;s like to develop in Rails, check out some of the things I&#8217;ve pointed out above. For me, these 5 points have made Rails my preferred web platform of choice for small to medium-sized, database driven websites.5</p>
]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2009/02/22/5-reasons-to-use-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating your own streaming music server</title>
		<link>http://www.natemiller.org/2008/09/16/creating-your-own-streaming-music-server/</link>
		<comments>http://www.natemiller.org/2008/09/16/creating-your-own-streaming-music-server/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 19:02:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.natemiller.org/?p=59</guid>
		<description><![CDATA[A little while ago I had an extra computer who&#8217;d been put out to pasture. This machine, while great in its time, felt the inevitable constraints of Moore&#8217;s Law and was forced to be removed from even semi-serious use. So instead of taking old Betty out to the glue factory, I turned it into a [...]]]></description>
			<content:encoded><![CDATA[<p>A little while ago I had an extra computer who&#8217;d been put out to pasture. This machine, while great in its time, felt the inevitable constraints of Moore&#8217;s Law and was forced to be removed from even semi-serious use. So instead of taking old Betty out to the glue factory, I turned it into a custom music server which allows me to stream my music library from anywhere with an internet connection.</p>
<p><a href="http://www.slimdevices.com/su_downloads.html">Slimserver</a> is an open source music server which allows you to do this with very little fuss or configuration. Now I can stream music from natemiller.org in my neighborhood coffee shop or at work.</p>
<h3>Gotchas</h3>
<p>Just like anything worth doing, it requires a little leg work to get off the ground (depending on your server&#8217;s platform and your network configuration). Also, I&#8217;ve found that it doesn&#8217;t always play nicely with Apple encoded music files (mp4&#8217;s) which run rampant in today&#8217;s age of electronics. But if you&#8217;re handy with the command line and some conversion tools, you&#8217;ll be able to fix this relatively easily.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2008/09/16/creating-your-own-streaming-music-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Flash sites scroll vertically</title>
		<link>http://www.natemiller.org/2008/09/10/making-flash-sites-scroll-vertically/</link>
		<comments>http://www.natemiller.org/2008/09/10/making-flash-sites-scroll-vertically/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 19:06:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.natemiller.org/?p=64</guid>
		<description><![CDATA[One of the things that has always bugged me about developing full-flash websites, is the way that Flash sometimes makes it difficult to implement behavior that users rely upon for a good experience. Things like deeplinking, context menus, mouse-wheel scrolling, are all possible &#8211; but at a cost to developer time. One such issue which [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that has always bugged me about developing full-flash websites, is the way that Flash sometimes makes it difficult to implement behavior that users rely upon for a good experience. Things like deeplinking, context menus, mouse-wheel scrolling, are all possible &#8211; but at a cost to developer time. One such issue which I found particular irritating was the fact that Flash websites set at 100% width and height suffer from visibility issues when the end user&#8217;s monitor or window is set at a smaller setting. The easy solution is to set your containing html element at a fixed height, but that doesn&#8217;t always work &#8211; especially if you have dynamic .swf content loaded into your shell .swf at different times. Also, if you&#8217;re trying to scale a background image or other elements, this doesn&#8217;t really work. My purpose was to create a solution which would allow a full flash website vertically scroll with the use of the standard browser scrollbar, <a href="http://www.natemiller.org/examples/flash_vertical_scrolling/index.html" target="_blank">like this</a>. I discovered this technique while developing a <a href="http://www.theleasingstudio.com" target="_blank">recent project that had several sections of expanding content</a>.</p>
<h2>Our Requirements</h2>
<p>To accomplish browser based scrolling in Flash, I surmised the following as benchmarks for success:</p>
<ul>
<li> Devise way to control page height _dynamically_ through my Flash website&#8217;s shell .swf</li>
<li>Provide a method for any .swf file loaded into the shell to resize the HTML window at will (e.g. user clicks on accordian element in child movie, the page height will adjust accordingly)</li>
<li>Show HTML scrollbars any time a user&#8217;s browser window dropped below the defined minimum for that page</li>
<li>Hide HTML scrollbars and act like a normal full-flash website once the user&#8217;s minimum height requirement has been met</li>
</ul>
<p>Our assumptions:</p>
<ul>
<li> Accepted browsers are the usual suspects: IE6+, Firefox 2+, Safari 2+</li>
<li> It works with Flash 9 (it&#8217;ll work in 8, too)</li>
</ul>
<p>h2. How it works</p>
<p>To make our solution, there are a couple key ingredients we need:</p>
<ul>
<li>Simple Javascript function which will handle events in the Flash file</li>
<li> Resize logic in the Flash movie which will react to window resizing</li>
<li> A commonly used JavaScript library called Prototype (but many others would work, too) to help access page properties</li>
</ul>
<p>Starting off, we&#8217;ll set up our Flash movie and make sure that our movie is set to scale properly. For this example, we&#8217;re using top left stage registration, but you can use whatever you&#8217;d like. The code below are small sections of the complete code base which can be downloaded here: <a href="http://www.natemiller.org/examples/flash_vertical_scrolling/source.zip">source files</a>.</p>
<pre class="actionscript">import flash.external.ExternalInterface;

public function Shell(){
   stage.scaleMode = StageScaleMode.NO_SCALE;
   stage.align = StageAlign.TOP_LEFT;
   stage.addEventListener(Event.RESIZE, onResize);
}</pre>
<p>Once we know that this is in place, we can next write our resize logic, which will execute each time the Flash movie is resized<br />
Actionscript 3</p>
<pre class="actionscript">
/**
* Handles screen resize
*/
private function onResize(e:Event = null) : void {
        // This function simply sets the
        // height and width of the background to stage
	resizeScreen(); 

	// Tell the outside world that the screen size has changed
	if(ExternalInterface.available) {
		ExternalInterface.call("onFlashResize", minHeight);
	}
} // end onResize</pre>
<p>What&#8217;s going on here is that we&#8217;re simply saying &#8220;If Javascript is available, make an outside call to the Javascript function called _onFlashResize_&#8221;. We also pass it a variable called _minHeight_ which allows us to define the minimum height allowed by our Flash application. So if users on a 500px tall screen view our movie which has set a 600px minimum height, there will be an HTML scroll bar allowing users to view the rest of the content.</p>
<p>Now let&#8217;s take a look at the Javascript which will make this all possible:<br />
Javascript</p>
<pre class="actionscript">/**
* Called when the Flash has been resized. Triggered by the Flash movie
*/
function onFlashResize(height) {
	var newHeight = Math.max(height, document.viewport.getHeight());
	$('wrapper').setStyle({height: height + 'px'});
}</pre>
<p>With this function, we find out the highest of these two values: our movie&#8217;s minimum height and the total height of the user&#8217;s browser. Using the largest of these two values, we set the Flash container div (called _wrapper_) to this new height. This ensures that if the user&#8217;s browser window goes below the minimum height, the browser&#8217;s scroll bars will appear.</p>
<p>What&#8217;s cool about this trick is that it makes it extremely easy to create multi-paged Flash movies that react to user interaction without having to rely on Flash based navigation techniques that many people dislike. For instance, this technique can be used in an accordian menu to easily display content and resize the page accordingly. The end result is an experience which is more like other websites and doesn&#8217;t require your users to learn an additional way of accessing content.</p>
<h4>&#8220;Download Source&#8221;:http://www.natemiller.org/examples/flash_vertical_scrolling/source.zip</h4>
]]></content:encoded>
			<wfw:commentRss>http://www.natemiller.org/2008/09/10/making-flash-sites-scroll-vertically/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

