<?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; OS X</title>
	<atom:link href="http://dev.nuclearrooster.com/category/os-x/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>Web-enable your OS X Documents folder</title>
		<link>http://dev.nuclearrooster.com/2010/05/09/web-enable-your-os-x-documents-folder/</link>
		<comments>http://dev.nuclearrooster.com/2010/05/09/web-enable-your-os-x-documents-folder/#comments</comments>
		<pubDate>Sun, 09 May 2010 22:48:39 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=402</guid>
		<description><![CDATA[Working with web technologies, you can't (or shouldn't) avoid HTML, PHP and JavaScript.  Apple provides the default webserver serving files from /Library/WebServer/Documents, and your user vhost under ~/Sites, but I don't find either very convenient.  I keep all of the projects under ~/Documents, and I want to be able to view those files in a browser as well.]]></description>
			<content:encoded><![CDATA[<h3>What?</h3>
<p>Give apache access to your Documents folder, so you can view your documents in a browser.</p>
<h3>Why?</h3>
<p>Working with web technologies, you can't (or shouldn't) avoid HTML, PHP and JavaScript.  Apple provides the default webserver serving files from /Library/WebServer/Documents, and your user vhost under ~/Sites, but I don't find either very convenient.  I keep all of the projects under ~/Documents, and I want to be able to view those files in a browser as well.</p>
<p>Some of this could be done through a browser over file://, but I find it easier to set it up this way.  Additionally, when developing Flash/Flex apps, the security sandbox model can necessitate using HTTP.</p>
<h3>How?</h3>
<p>First, create a virtual host file with the configuration details at /private/etc/apache2/extra/documents_vhost.conf.  Replace USERNAME with your username.  I chose port 1234, because it is easy to remember, but you can replace that with a port of your choosing.</p>
<pre class="brush: xml;">
&lt;VirtualHost 127.0.0.1:1234&gt;
    DocumentRoot &quot;/Users/USERNAME/Documents&quot;
    ServerName 127.0.0.1
	&lt;Directory &quot;/Users/USERNAME/Documents&quot;&gt;
	    Options Indexes FollowSymLinks MultiViews
	    AllowOverride All
	    Order allow,deny
	    Allow from all
	&lt;/Directory&gt;
&lt;/VirtualHost&gt;
</pre>
<p>Edit the main apache configuration file, /private/etc/apache2/httpd.conf.  Add the following to the bottom.</p>
<pre class="brush: plain;">
# Tell apache to listen to requests on this port
Listen 1234
# Include the vhost details
Include /private/etc/apache2/extra/documents_vhost.conf
</pre>
<p>Lastly, you have to change the permissions of your Documents folder so that it has read and execute permissions, required by Apache to read from it.  </p>
<pre class="brush: bash;">
chmod 711 ~/Documents
</pre>
<p>Restart apache</p>
<pre class="brush: bash;">
sudo /usr/sbin/apachectl graceful
</pre>
<p>and visit your Documents folder in your browser at <a href="http://127.0.0.1:1234/">http://127.0.0.1:1234/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2010/05/09/web-enable-your-os-x-documents-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Subversion SCPlugin with an untrusted SSL certificate</title>
		<link>http://dev.nuclearrooster.com/2009/05/06/using-subversion-scplugin-with-an-untrusted-ssl-certificate/</link>
		<comments>http://dev.nuclearrooster.com/2009/05/06/using-subversion-scplugin-with-an-untrusted-ssl-certificate/#comments</comments>
		<pubDate>Thu, 07 May 2009 01:13:20 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[SCPlugin]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[svn gui]]></category>
		<category><![CDATA[tigris]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=99</guid>
		<description><![CDATA[SCPlugin adds handy subversion tools to your OS X context menu. Its great for PM's, designers, moms (really? no) or anybody else who doesn't grok dot grok dot com the efficiency of the command line. Or, at least, its great until you install it and it doesn't work for a... well it just doesn't work, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://scplugin.tigris.org/">SCPlugin</a> adds handy subversion tools to your OS X context menu.  Its great for PM's, designers, moms (really? no) or anybody else who doesn't grok dot grok dot com the efficiency of the command line.</p>
<p>Or, at least, its great until you install it and it doesn't work for a... well it just doesn't work, something about "PROPFIND  Server certificate verification failed: issuer is not trusted".  Ok, granted I didn't update the self-signed SSL in a year, but its perfectly secure, and I'm not going to pay for this.</p>
<p>This little trick will get you going:</p>
<pre class="brush: bash;">
nick$ svn info https://my.repo.com/path_to_repo
Error validating server certificate for 'https://my.repo.com:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: my.repo.com
 - Valid: from Thu, 07 May 2009 08:23:36 GMT until Wed, 01 Feb 2012 08:23:36 GMT
 - Issuer: dev, Somebody
 - Fingerprint: 7d:ac:37:52:fe:e9:3f:df:c7:1f:b4:cd:5d:d6:58:0c:29:62:92:4c
(R)eject, accept (t)emporarily or accept (p)ermanently? p
</pre>
<p>That helps, but also run that for root, which I think is what SCPlugin is using at some level:</p>
<pre class="brush: bash;">
nick$ sudo svn info https://my.repo.com/path_to_repo
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2009/05/06/using-subversion-scplugin-with-an-untrusted-ssl-certificate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rake task with arguments</title>
		<link>http://dev.nuclearrooster.com/2009/01/05/rake-task-with-arguments/</link>
		<comments>http://dev.nuclearrooster.com/2009/01/05/rake-task-with-arguments/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 01:26:43 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Ruby/Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux / os x]]></category>
		<category><![CDATA[Rake]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=75</guid>
		<description><![CDATA[I couldn't find a short, concise example of a rake task with arguments, so I decided to write one up for the world to see. Firstly, the ability to add arguments was added somewhere along the line, so you might as well make sure you have a recent version of Rake: nicks-computer:~ nick$ sudo gem [...]]]></description>
			<content:encoded><![CDATA[<p>I couldn't find a short, concise example of a rake task with arguments, so I decided to write one up for the world to see.  </p>
<p>Firstly, the ability to add arguments was added somewhere along the line, so you might as well make sure you have a recent version of Rake:</p>
<pre class="brush: plain;">
nicks-computer:~ nick$ sudo gem install rake
Password:
Successfully installed rake-0.8.3
1 gem installed
Installing ri documentation for rake-0.8.3...
Installing RDoc documentation for rake-0.8.3...
</pre>
<p>Great.  Now, lets dig in to an example rake file.  You can put this in a file name 'Rakefile' anywhere you like, or in RAILS_ROOT/lib/tasks/some_file.rake if you are rails-ish.</p>
<pre class="brush: ruby;">
desc &quot;An example task that uses a single argument&quot;
task :example_with_argument, :arg1 do |t, args|
  puts &quot;Running 'example_with_argument' with '#{args.arg1}' as the argument&quot;
end

desc &quot;An example task that uses multiple arguments&quot;
task :example_with_multiple_arguments, :arg1, :arg2 do |t, args|
  puts &quot;Running 'example_with_argument' with '#{args.arg1}' and '#{args.arg2}' as the arguments&quot;
end

desc &quot;An example task that uses multiple arguments, and has defaults&quot;
task :example_with_multiple_arguments_and_defaults, :arg1, :arg2 do |t, args|
  args.with_defaults(:arg1 =&gt; 'default_arg1', :arg2 =&gt; 'default_arg2')
  puts &quot;Running 'example_with_argument' with '#{args.arg1}' and '#{args.arg2}' as the arguments&quot;
end
</pre>
<p>Now, for how to run them.  Without specifying arguments, the defaults (or an empty string if no defaults are specified) will be used:</p>
<pre class="brush: plain;">
nicks-computer:~ nick$ rake example_with_multiple_arguments_and_defaults
(in /Users/nick)
Running 'example_with_argument' with 'default_arg1' and 'default_arg2' as the arguments
</pre>
<pre class="brush: plain;">
nicks-computer:~ nick$ rake example_with_multiple_arguments_and_defaults[myarg1, myarg2]
(in /Users/nick)
Running 'example_with_argument' with 'myarg1' and 'myarg2' as the arguments
</pre>
<p>TaDa!</p>
<p>UPDATE:</p>
<p>Rake a a great tool, and widely used, but there are some new tools that surpass rake in some areas.  For example check out <a href="http://yehudakatz.com/2008/05/12/by-thors-hammer/">Thor</a> and how <a href="http://www.opscode.com/">OpsCode<a/> uses it with their <a href="http://wiki.opscode.com/display/chef/Knife">Knife</a> tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2009/01/05/rake-task-with-arguments/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Uploading to S3 with a FileReference from Flex 3 on OS X</title>
		<link>http://dev.nuclearrooster.com/2008/04/05/uploading-with-a-filereference-from-flex-3-on-os-x/</link>
		<comments>http://dev.nuclearrooster.com/2008/04/05/uploading-with-a-filereference-from-flex-3-on-os-x/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 19:23:14 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Ruby/Rails]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=33</guid>
		<description><![CDATA[After working on a fairly simple upload from Flex to Amazon S3, a co-worker claimed it was "done". Ok. Then I tried uploading from from my mac. No dice. So this simple upload went from being "done" to "a significant OS X pain." Here are some of the things that helped. After much googling, Wiresharking, [...]]]></description>
			<content:encoded><![CDATA[<p>After working on a fairly simple upload from Flex to Amazon S3, a co-worker claimed it was "done". Ok.  Then I tried uploading from from my mac.  No dice. So this simple upload went from being "done" to "a significant OS X pain."  Here are some of the things that helped.</p>
<p>After much googling, Wiresharking, and general debuggation, a co-worker found <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/HTTPPOSTFlash.html">this Amazon S3 doc</a>, which notes:</p>
<blockquote><p>
Some versions of the Adobe Flash Player do not properly handle HTTP responses that have an empty body. To configure POST to return a response that does not have an empty body, set success_action_status to 201. When set, Amazon S3 returns an XML document with a 201 status code. For information on the content of the XML document, see ???. For information on form fields, see HTML Form Fields.
</p></blockquote>
<p>Interesting. And small; it is a tiny message, almost a footnote, on some Amazon page. I wish Adobe could get their docs together.  I particularly like "Some versions" and "???".  Anyway, lesson learned, or at least we have something to try.</p>
<h3>The S3/Flash interactions need a little massaging</h3>
<p>It seems like the OS X Flash runtime (9.0.115.0) requires a non-empty server response from its POST.  Amazon S3 conveniently has an additional parameter, <code>success_action_status</code> which can be set to "201" to have S3 respond to the post with a <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">201 CREATED response code</a>.  If you are uploading to Apache or IIS, you could have the same problem.  Try to check the header response for your POST, and see it is is a) empty, or b) not a 201.</p>
<p>On S3, you can modify your upload policy to return the correct response.  Your policy should look something like this:</p>
<pre>
{
    'expiration': '2008-12-31T12:00:00.000Z',
    'conditions': [
        {'bucket': 'my_test_bucket'},
        {'key': 'test1.jpg'},
        ['starts-with', '$Filename', ''],
        ['eq', '$success_action_status', '201']
    ]
}
</pre>
<p>Note that the <code>success_action_status</code> is not an object property, but an [Operator, Operand, Operand] array.</p>
<p>Problem Solved?  Not quite: still not uploads.</p>
<h3>S3 Upload Example</h3>
<p>Someone at AWS posted a helpful <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1092">Flex -> S3 example</a>, or actually examples.  One Flex project creates and signs a policy, and the other uploads a file using the generated policy.  And whats more, they both work.  Also, took a look at the code to make sure it wasn't sending my AWS key/password off to some email! Ha. I think it was also posted by an AWS employee, so that is reassuring.</p>
<h3>#2038 FileIOError </h3>
<p>I kept getting a #2038 FileIOError on my mac.  Bummer. Taking a closer look at the working AWS example, I saw a funny comment.  Not funny roflcopter, but funny smelly bug-fixy.</p>
<pre>

            /*
             * FileReference.upload likes to send cryptic IOErrors when it doesn't get a status code that it likes.
             * If we already got an error HTTP status code, don't propagate this event since the HTTPStatusEvent
             * event handler dispatches an IOErrorEvent.
             */
</pre>
<p>As it turns out, I could NOT stop these #2038 FIleIOErrors.  They just kept coming. But, as the example code reminded me, if you are getting a successful server response, the file is already up there.  Sure enough, the file was there.</p>
<p>So you can pretty much ignore the FileIOError, although you should handle it, and just ignore it if you have a successful HTTP response, something like this:</p>
<pre>
        private function onIOError(event:IOErrorEvent):void
        {
            if(!recievedSuccessfulHTTPresponse)
            {
                this.dispatchEvent(event);
            }
        }
</pre>
<p>You get the idea.  Ok. Handle but ignore FileIOErrors. Done? Almost. Single uploads work, but I get an  "Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error" when doing multiple uploads, via a FileReferenceList.  Marvelous.  This turned out to be even more of a pain.  It wasn't anything to do with <a href="http://www.judahfrangipane.com/blog/?p=115">the server side upload script</a> as my google searches might have me believe.</p>
<p>After brainstorming with a co-worker, we came to a pretty good guess: Garbage Collection.  Maybe the FileReference was going out of scope before the IOError could be handled, or some such.  PC/OS X differences in the runtime could have different GC implementations.  Worth a shot.  I changed my event listeners from "weak" to "strong" references.  Shahooya.  Multiple file upload city. </p>
<h3>Other fixes</h3>
<p>Make sure you have a publicly accessable crossdomain policy on the server you are uploading to.</p>
<p>Also, S3 scales well but adds extra complexity. You might try uploading to somewhere else, like a simple rails uploader.</p>
<p>Hope that helps.  Also, please comment.  In fact, today only, every commenter gets a free XBox.  You know, its just a little lonely out here in the cloud sometimes.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2008/04/05/uploading-with-a-filereference-from-flex-3-on-os-x/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
