<?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>Nuclear Rooster &#187; stupid tricks</title>
	<atom:link href="http://dev.nuclearrooster.com/category/stupid-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.nuclearrooster.com</link>
	<description></description>
	<lastBuildDate>Mon, 19 Jul 2010 03:48:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simple Rails Uploader</title>
		<link>http://dev.nuclearrooster.com/2008/04/10/simple-rails-uploader/</link>
		<comments>http://dev.nuclearrooster.com/2008/04/10/simple-rails-uploader/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 16:26:27 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Ruby/Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[stupid tricks]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=34</guid>
		<description><![CDATA[Simple Rails Uploader I was recently trying to implement an upload to Amazon S3, and it wasn't working. I couldn't tell if it was the Flex front end, or the S3 backend, or what, so I decided to Wear my ruby slippers to work, or rather my Rails slippers (so comfy and I just like [...]]]></description>
			<content:encoded><![CDATA[<h3>Simple Rails Uploader</h3>
<p>I was recently <a href="http://dev.nuclearrooster.com/2008/04/05/uploading-with-a-filereference-from-flex-3-on-os-x/">trying to implement an upload </a>to Amazon S3, and it wasn't working.  I couldn't tell if it was the Flex front end, or the S3 backend, or what, so I decided to <a href="http://whytheluckystiff.net/articles/wearingRubySlippersToWork.html">Wear my ruby slippers to work</a>, or rather my Rails slippers (so comfy and I just like them so much).</p>
<p>About 15 minutes and 15 lines of code later, I had a rails app running locally which accepted the upload from Flex and logged all the request parameters. I found the <a href="http://manuals.rubyonrails.com/read/chapter/77">Simplest upload that could possibly work</a> in the Rails Cookbook, and a <a href="http://wiki.rubyonrails.org/rails/pages/HowtoUploadFiles">Rails wiki page</a> to that purpose.  In the Rails Cookbook, note that you should use <code>params['file']</code> rather than the oldschool <code>@params['file']</code>.</p>
<p>To get a simple Rails (> 2.0) app for testing the uploads, try this</p>
<pre>
rails uploader
cd uploader
script/generate controller upload
</pre>
<p>Paste in some code from the Simplest Upload Possible article above.</p>
<pre class="brush: ruby;">
class UploadController &lt; ApplicationController
  def save_file
    logger.info(params.insect)

    if request.get?
    render :text =&gt; 'Please Upoad file'
    else
      # Use &quot;wb&quot; mode on windows.
      File.open(&quot;#{RAILS_ROOT}/public/files/#{Time.now.to_i}.jpg&quot;, &quot;w&quot;) do |f|
        f.write(params['file'].read)
      end
    render :text =&gt; 'Done'
    end
  end
end
</pre>
<p>Now, in Flex, have your FileReference upload to your server, and make sure to use the right field name.</p>
<p>[ActionScript]<br />
var urlRequest:URLRequest = new URLRequest("http://127.0.0.1:3000/upload/save_file");<br />
urlRequest.method = URLRequestMethod.POST;<br />
file.upload(urlRequest, "file");<br />
[/ActionScript]</p>
<p>Tails your logs, and look for the output.  One step closer.</p>
<p>I might try to clean up a simple uploader app and thow it up (blaagh) here.  Any interest?</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2008/04/10/simple-rails-uploader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Give your terminal greeting message a little ascii love</title>
		<link>http://dev.nuclearrooster.com/2008/04/03/give-your-terminal-greeting-message-a-little-ascii-love/</link>
		<comments>http://dev.nuclearrooster.com/2008/04/03/give-your-terminal-greeting-message-a-little-ascii-love/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 04:09:52 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[linux / os x]]></category>
		<category><![CDATA[stupid tricks]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=30</guid>
		<description><![CDATA[The /etc/motd file is displayed every time a terminal in open. I think 'motd' stands for message-of-the-day. It doesn't really matter. What does matter, is that /etc/motd + asciiart = more productive &#038; happy lifestyle. Think of it as a quality of life kinda deal. Anyway, check out any of the many text-to-ascii-art sites, including [...]]]></description>
			<content:encoded><![CDATA[<p>The /etc/motd file is displayed every time a terminal in open.  I think 'motd' stands for message-of-the-day.  It doesn't really matter.  What does matter, is that /etc/motd + asciiart = more productive &#038; happy lifestyle.  Think of it as a quality of life kinda deal.  Anyway, check out any of the many text-to-ascii-art sites, including this German gem, and create a sweet greeting.  </p>
<p>OS X comes with a to-the-point but not terribly inspiring "Welcome to Darwin!"  Spice that up a little.</p>
<p>Note that in addition to a message, maybe a little ascii dude is all you need.</p>
<pre>
            (peace out)
    _     _  /
  o' \,=./ `o
    (o o)
ooO--(_)--Ooo
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2008/04/03/give-your-terminal-greeting-message-a-little-ascii-love/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
