<?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>Mike&#039;s burogu</title>
	<atom:link href="http://www.bsodmike.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bsodmike.com</link>
	<description>The blog of Michael de Silva (bsodmike)</description>
	<lastBuildDate>Fri, 20 Jan 2012 11:37:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Moved to http://www.mwdesilva.com</title>
		<link>http://www.bsodmike.com/2012/01/20/moved-to-httpwww-mwdesilva-com/</link>
		<comments>http://www.bsodmike.com/2012/01/20/moved-to-httpwww-mwdesilva-com/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 11:36:43 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[The Blog]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=699</guid>
		<description><![CDATA[I&#8217;ve completed setting up my new blog at http://www.mwdesilva.com I will maintain this for about a year and look to decommission this and the domain will be set to redirect to mwdesilva.com.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve completed setting up my new blog at</p>

<h1><a href="http://www.mwdesilva.com">http://www.mwdesilva.com</a></h1>

<p>I will maintain this for about a year and look to decommission this and the domain will be set to redirect to mwdesilva.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2012/01/20/moved-to-httpwww-mwdesilva-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shifting meh-blog to Linode&#8230;</title>
		<link>http://www.bsodmike.com/2011/11/14/shifting-meh-blog-to-linode/</link>
		<comments>http://www.bsodmike.com/2011/11/14/shifting-meh-blog-to-linode/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 20:17:52 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[The Blog]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=688</guid>
		<description><![CDATA[Been pondering this one over as WordPress is definitely not cutting it for me anymore, so I&#8217;m hoping to shift the blog to a rails powered one my linode sometime this weekend &#8212; only if I get around to it. If not, I&#8217;ll probably continue paying for the second hosting plan (just the blog) and [...]]]></description>
			<content:encoded><![CDATA[<p>Been pondering this one over as WordPress is definitely not cutting it for me anymore, so I&#8217;m hoping to shift the blog to <del datetime="2011-11-14T02:18:18+00:00">a rails powered one</del> my linode sometime this weekend &mdash; only if I get around to it.  If not, I&#8217;ll probably continue paying for the second hosting plan (just the blog) and ponder this transition during the following year.</p>

<p>Of course, I&#8217;m currently debating the merits of going with a full blown Rails app (and all the overhead that entails) to perhaps going with something simpler, say <a href="https://github.com/mojombo/jekyll">Jekyll</a> or <a href="https://github.com/imathis/octopress">Octopress</a>.  There&#8217;s a reason that most professional Rubyists seem to prefer the minimalist-approach, not to mention the pure awesomeness of &#8216;blogging&#8217; via Git.</p>

<p>In short, it&#8217;ll happen, when it happens.  Until then, don&#8217;t hold your breath!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/11/14/shifting-meh-blog-to-linode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nature Taking a Byte Out of Technology</title>
		<link>http://www.bsodmike.com/2011/11/07/nature-taking-a-byte-out-of-technology/</link>
		<comments>http://www.bsodmike.com/2011/11/07/nature-taking-a-byte-out-of-technology/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 09:43:30 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Gadgets and Tech]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=686</guid>
		<description><![CDATA[This is the second time in 2011, when nature has reminded us of its divine power. The Fukushima Daiichi nuclear incident in Japan earlier this year, affected much of the NAND RAM supplies in the region impacting the likes of Sony and even Apple. Right now, we learn about the flooding in Thailand and its [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second time in 2011, when nature has reminded us of its divine power.  The Fukushima Daiichi nuclear incident in Japan earlier this year, affected much of the NAND RAM supplies in the region impacting the likes of Sony and even Apple.</p>

<p>Right now, we learn about the <a href="http://www.theverge.com/2011/11/5/2540403/thailand-flood-disaster">flooding in Thailand</a> and its potential effects on HDD supplies.  Prices are being pushed upwards as a result.</p>

<p>I wonder, although sincerely hope not, if the next global crisis will be a result of multi-regional devastation in Asia.  Oh, I hope not&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/11/07/nature-taking-a-byte-out-of-technology/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.1: Starting the Week on Sunday, as in the Middle East</title>
		<link>http://www.bsodmike.com/2011/10/22/rails-3-1-starting-the-week-on-sunday-as-in-the-middle-east/</link>
		<comments>http://www.bsodmike.com/2011/10/22/rails-3-1-starting-the-week-on-sunday-as-in-the-middle-east/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 21:14:18 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=684</guid>
		<description><![CDATA[Was rather interesting to find out that &#8216;Monday&#8217; is hardcoded into Rails as the start of the week, so working around this involved creating a custom initialiser that reopened two classes as follows: &#8230;and here&#8217;s the proof 12345678pry&#40;main&#41;&#62; Time.now.traditional_beginning_of_week =&#62; 2011-10-16 00:00:00 +0300 pry&#40;main&#41;&#62; Time.now.traditional_end_of_week =&#62; 2011-10-22 23:59:59 +0300 pry&#40;main&#41;&#62; Time.now.traditional_beginning_of_week.strftime&#40;'%e %A, %B %Y'&#41; =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Was rather interesting to find out that &#8216;Monday&#8217; is hardcoded into Rails as the start of the week, so working around this involved creating a custom initialiser that reopened two classes as follows:</p>

<script src="https://gist.github.com/1304980.js?file=middle_east_week.rb"></script>

<p>&#8230;and here&#8217;s the proof</p>

<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pry<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">traditional_beginning_of_week</span><br />
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">2011</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">16</span> 00:00:00 <span style="color:#006600; font-weight:bold;">+</span>0300<br />
pry<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">traditional_end_of_week</span><br />
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">2011</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">22</span> <span style="color:#006666;">23</span>:<span style="color:#006666;">59</span>:<span style="color:#006666;">59</span> <span style="color:#006600; font-weight:bold;">+</span>0300<br />
pry<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">traditional_beginning_of_week</span>.<span style="color:#9900CC;">strftime</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'%e %A, %B %Y'</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;16 Sunday, October 2011&quot;</span><br />
pry<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">traditional_end_of_week</span>.<span style="color:#9900CC;">strftime</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'%e %A, %B %Y'</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;22 Saturday, October 2011&quot;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/10/22/rails-3-1-starting-the-week-on-sunday-as-in-the-middle-east/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>URI Obfuscation in Rails</title>
		<link>http://www.bsodmike.com/2011/10/21/uri-obfuscation-in-rails/</link>
		<comments>http://www.bsodmike.com/2011/10/21/uri-obfuscation-in-rails/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 20:06:43 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=680</guid>
		<description><![CDATA[Was toying with my local yarddoc server and was perusing Paperclip&#8217;s rdoc and happend across an interesting note on URI obfuscation. John has indeed taken a very interesting approach and I&#8217;m looking forward to applying this to my custom S3 to API tool.]]></description>
			<content:encoded><![CDATA[<p>Was toying with my local yarddoc server and was perusing Paperclip&#8217;s rdoc and happend across an <a href="https://github.com/thoughtbot/paperclip/pull/416">interesting note on URI obfuscation</a>.  John has indeed taken a very interesting approach and I&#8217;m looking forward to applying this to my custom S3 to API tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/10/21/uri-obfuscation-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.1: Plupload POST to Controller Causes Devise Session Logout (CSRF Protection Bypass)</title>
		<link>http://www.bsodmike.com/2011/10/19/rails-3-1-plupload-post-to-controller-causes-devise-session-logout-csrf-protection-bypass/</link>
		<comments>http://www.bsodmike.com/2011/10/19/rails-3-1-plupload-post-to-controller-causes-devise-session-logout-csrf-protection-bypass/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 18:16:41 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=677</guid>
		<description><![CDATA[Another interesting morning thanks to CSRF protecting kicking in when an upload with Plupload would POST to a controller&#8217;s action and subsequent reloads or visits to any parts caused Devise to log me out. This StackOverflow discussion and a blast from the past hinted in the right direction as for the issue. Thanks to Rene [...]]]></description>
			<content:encoded><![CDATA[<p>Another interesting morning thanks to CSRF protecting kicking in when an upload with Plupload would POST to a controller&#8217;s action and subsequent reloads or visits to any parts caused Devise to log me out.</p>

<p>This <a href="http://stackoverflow.com/questions/5049672/devise-session-immediately-expiring-on-js-call-ajax">StackOverflow discussion</a> and a <a href="http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails">blast from the past</a> hinted in the right direction as for the issue.</p>

<p>Thanks to Rene (<a href="https://github.com/rvanlieshout">rvanlieshout</a>) though the solution was far simpler.  Rather than passing the <strong>csrf_token</strong> via the HTTP header, I passed it in the POST params hash by leveraging Plupload&#8217;s <strong>multipart_params</strong> option</p>

<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">multipart_params<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>authenticity_token<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>

<p>and passed via the BeforeUpload event where &#8216;up&#8217; is the Uploader instance</p>

<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">up.<span style="color: #660066;">settings</span>.<span style="color: #660066;">multipart_params</span>.<span style="color: #660066;">authenticity_token</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;%=j @token.to_s &nbsp;%&gt;'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/10/19/rails-3-1-plupload-post-to-controller-causes-devise-session-logout-csrf-protection-bypass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.1: Bypassing Same-Origin Policy by Proxying JSON Request via Apache2 (mod_proxy)</title>
		<link>http://www.bsodmike.com/2011/10/19/rails-3-1-bypassing-same-origin-policy-by-proxying-json-request-via-apache2-mod_proxy/</link>
		<comments>http://www.bsodmike.com/2011/10/19/rails-3-1-bypassing-same-origin-policy-by-proxying-json-request-via-apache2-mod_proxy/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 17:52:05 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Linux and Mac]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=670</guid>
		<description><![CDATA[Few days ago I started looking at tackling the challenge of finding a viable solution to large online uploads and integrating them into an existing Rails powered site. Since a 5 GB limit on each video was acceptable, I decided to leverage Amazon S3 as the storage solution and the route I ended up taking [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago I started looking at tackling the challenge of finding a viable solution to large online uploads and integrating them into an existing Rails powered site. Since a <del datetime="2011-11-13T20:24:20+00:00">5 GB limit</del> on each video was acceptable, I decided to leverage Amazon S3 as the storage solution and the route I ended up taking has resulted in creating a Rails app that essentially handles the upload to S3 and provides an API to those uploaded assets.</p>

<p>I liked the idea of using an HTML5 based upload mechanism, especially due to the clean approach taken in <a href="http://www.getharvest.com/blog/2011/02/easy-rails-asset-handling-with-html5-and-s3/">this article by Matt Beale</a>.</p>

<p>However, once I had completed all the cool parts of getting the API to work, I dropped Devise in authenticate admin login &mdash; as well as leverage its :token_authenticatable module in the future for authenticated API access.  For the sake of this article, the host app was hosted at <strong>www.bar.org</strong>, and the uploader app at <strong>foo.bar.org</strong>.  The <a href="https://developer.mozilla.org/en/Same_origin_policy_for_JavaScript">Same-Origin Policy for Javascript</a> dictates failure for such access.  Trying to connect raised</p>

<blockquote>XMLHttpRequest cannot load http://foo.bar.org/api/v1/videos.json. Origin null is not allowed by Access-Control-Allow-Origin.</blockquote>

<p>You can read more about the <a href="http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin">specifics on StackOverflow</a> &mdash; my options were therefore limited to JSONP or proxying my JSON request through Apache itself!  Rather than having to deal with a lot more JS, I decided to take the far more straightforward approach by proxying the request via <strong>/videos</strong> and all this required was and update to the virtual host config by adding</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ProxyRequests Off<br />
<br />
<span style="color: #000000; font-weight: bold;">&lt;</span>Proxy <span style="color: #000000; font-weight: bold;">*&gt;</span><br />
Order Allow,Deny<br />
Allow from all<br />
<span style="color: #000000; font-weight: bold;">&lt;/</span>Proxy<span style="color: #000000; font-weight: bold;">&gt;</span><br />
<br />
ProxyPass <span style="color: #000000; font-weight: bold;">/</span>videos http:<span style="color: #000000; font-weight: bold;">//</span>foo.bar.org<span style="color: #000000; font-weight: bold;">/</span>api<span style="color: #000000; font-weight: bold;">/</span>v1<span style="color: #000000; font-weight: bold;">/</span>videos.json</div></td></tr></tbody></table></div>

<p>Huge <strong>Thanks</strong> to David Workman (workmad3) and Josh Rendek (namidark) for being orsum and their superb advice!</p>

<p><strong>ERRATA:</strong> The 5 GB limit is for a single PUT to S3, but it supports up to 1 TB per file.  RTFM, yes, I should have!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/10/19/rails-3-1-bypassing-same-origin-policy-by-proxying-json-request-via-apache2-mod_proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pushing to Multiple Git Repositories Simultaneously</title>
		<link>http://www.bsodmike.com/2011/10/17/pushing-to-multiple-git-repositories-simultaneously/</link>
		<comments>http://www.bsodmike.com/2011/10/17/pushing-to-multiple-git-repositories-simultaneously/#comments</comments>
		<pubDate>Sun, 16 Oct 2011 21:20:10 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Linux and Mac]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=671</guid>
		<description><![CDATA[Setup your .git/config file with the following entry, and add as many repeating url entries for all the repos that will be updated simultaneously: 1234&#91;remote &#34;all&#34;&#93; &#160; # http://jeetworks.org/node/22 &#160; url = git@github.com:core_app &#160; url = git@bitbucket.org:bsodmike/core_app.git 1git push all --dry-run -v You want to be careful if attempting git push all &#8211;all &#8211;dry-run -v [...]]]></description>
			<content:encoded><![CDATA[<p>Setup your <strong>.git/config</strong> file with the following entry, and add as many repeating url entries for <a href="http://jeetworks.org/node/22">all the repos that will be updated simultaneously</a>:</p>

<div class="codecolorer-container yaml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="yaml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span class="br0">&#91;</span>remote &quot;all&quot;<span class="br0">&#93;</span><br />
&nbsp; # http://jeetworks.org/node/<span style="">22</span><br />
&nbsp; url = git@github.com:core_app<br />
&nbsp; url = git@bitbucket.org:bsodmike/core_app.git</div></td></tr></tbody></table></div>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">git</span> push all <span style="color: #660033;">--dry-run</span> <span style="color: #660033;">-v</span></div></td></tr></tbody></table></div>

<p>You want to be careful if attempting <strong>git push all &#8211;all &#8211;dry-run -v</strong> as this will create new branches for all local branches not present in your remotes.  Thankfully I ran a dry-run so although it seemed like I had gone and spawned a tone of branches, it was <em>just</em> a dry-run.</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">git</span> push all <span style="color: #660033;">--all</span> <span style="color: #660033;">--dry-run</span> <span style="color: #660033;">-v</span><br />
Pushing to <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>github.com:core_app<br />
To <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>github.com:core_app<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>new branch<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; &nbsp; &nbsp;datetime_massage_exp -<span style="color: #000000; font-weight: bold;">&gt;</span> datetime_massage_exp<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>new branch<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; &nbsp; &nbsp;jquery_attempt -<span style="color: #000000; font-weight: bold;">&gt;</span> jquery_attempt<br />
Pushing to <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>bitbucket.org:bsodmike<span style="color: #000000; font-weight: bold;">/</span>core_app.git<br />
To <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>bitbucket.org:bsodmike<span style="color: #000000; font-weight: bold;">/</span>core_app.git<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>new branch<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; &nbsp; &nbsp;datetime_massage_exp -<span style="color: #000000; font-weight: bold;">&gt;</span> datetime_massage_exp<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>new branch<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; &nbsp; &nbsp;development -<span style="color: #000000; font-weight: bold;">&gt;</span> development<br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>new branch<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; &nbsp; &nbsp;jquery_attempt -<span style="color: #000000; font-weight: bold;">&gt;</span> jquery_attempt</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/10/17/pushing-to-multiple-git-repositories-simultaneously/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails: Create a User Profile on Registration with Devise</title>
		<link>http://www.bsodmike.com/2011/09/30/rails-create-a-user-profile-on-registration-with-devise/</link>
		<comments>http://www.bsodmike.com/2011/09/30/rails-create-a-user-profile-on-registration-with-devise/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 12:10:01 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=666</guid>
		<description><![CDATA[The trick to the above was just discussed on StackOverflow. You will have to of course override the default registration controller and flesh your own and setup the new action as follows 1234567891011121314151617181920= simple_form_for&#40;resource, :as =&#62; resource_name, :url =&#62; registration_path&#40;resource_name&#41;&#41; do &#124;f&#124; &#160; &#160; = devise_error_messages! &#160; &#160; = f.input :username, &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>The trick to the above was<a href="http://stackoverflow.com/questions/7608532/create-a-user-profile-upon-registration-add-profile-form-fields-to-devise-registr/7608622"> just discussed on StackOverflow</a>.  You will have to of course override the default registration controller and flesh your own and setup the <strong>new</strong> action as follows</p>

<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">= simple_form_for<span style="color:#006600; font-weight:bold;">&#40;</span>resource, <span style="color:#ff3333; font-weight:bold;">:as</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> resource_name, <span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> registration_path<span style="color:#006600; font-weight:bold;">&#40;</span>resource_name<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span><br />
<br />
&nbsp; &nbsp; = devise_error_messages!<br />
<br />
&nbsp; &nbsp; = f.<span style="color:#9900CC;">input</span> <span style="color:#ff3333; font-weight:bold;">:username</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:label</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Username'</span><br />
&nbsp; &nbsp; = f.<span style="color:#9900CC;">input</span> <span style="color:#ff3333; font-weight:bold;">:email</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:label</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Email'</span><br />
&nbsp; &nbsp; = f.<span style="color:#9900CC;">input</span> <span style="color:#ff3333; font-weight:bold;">:password</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:label</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Password'</span><br />
&nbsp; &nbsp; = f.<span style="color:#9900CC;">input</span> <span style="color:#ff3333; font-weight:bold;">:password_confirmation</span>, &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:label</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Password confirm'</span><br />
<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">//</span> make a new profile <span style="color:#9966CC; font-weight:bold;">in</span> memory<br />
&nbsp; &nbsp; = resource.<span style="color:#9900CC;">build_profile</span><br />
<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">//</span> start fields <span style="color:#9966CC; font-weight:bold;">for</span> profile<br />
&nbsp; &nbsp; = f.<span style="color:#9900CC;">fields_for</span> <span style="color:#ff3333; font-weight:bold;">:profile</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; = f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:bod_day</span><br />
&nbsp; &nbsp; &nbsp; = f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:bod_day</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">//</span> <span style="color:#9966CC; font-weight:bold;">end</span> fields <span style="color:#9966CC; font-weight:bold;">for</span> profile<br />
<br />
<br />
&nbsp; &nbsp; = f.<span style="color:#9900CC;">button</span> <span style="color:#ff3333; font-weight:bold;">:submit</span>, t<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:submit</span>, <span style="color:#ff3333; font-weight:bold;">:scope</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:register</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></td></tr></tbody></table></div>

<p>As with <strong>accepts_nested_attributes_for :profile</strong> in the <strong>User</strong> model, one would also include <strong>attr_accessible &#8230;, :profile_attributes</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/09/30/rails-create-a-user-profile-on-registration-with-devise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails to_json or as_json?</title>
		<link>http://www.bsodmike.com/2011/09/30/rails-to_json-or-as_json/</link>
		<comments>http://www.bsodmike.com/2011/09/30/rails-to_json-or-as_json/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 18:51:07 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bsodmike.com/?p=663</guid>
		<description><![CDATA[Thanks to Jonathan Julian&#8217;s fantastic post on the subject, here&#8217;s some code that I used today in a project. I set about defining an instance method as_json in the model I was interested in, in this case Employee 123&#160; def as_json&#40;options=&#123;&#125;&#41; &#160; &#160; &#123; :id =&#62; self.id, :name =&#62; self.name, :title =&#62; self.title, :email =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/">Jonathan Julian&#8217;s fantastic post</a> on the subject, here&#8217;s some code that I used today in a project.  I set about defining an instance method <strong>as_json</strong> in the model I was interested in, in this case <strong>Employee</strong></p>

<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> as_json<span style="color:#006600; font-weight:bold;">&#40;</span>options=<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">id</span>, <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">name</span>, <span style="color:#ff3333; font-weight:bold;">:title</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">title</span>, <span style="color:#ff3333; font-weight:bold;">:email</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">email</span>, <span style="color:#ff3333; font-weight:bold;">:phone</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">phone</span>, <span style="color:#ff3333; font-weight:bold;">:image</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">image</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>

<p>and in the controller</p>

<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">class</span> EmployeesController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> index<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@employees</span> = Employee.<span style="color:#9900CC;">all</span><br />
&nbsp; &nbsp; respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">json</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:json</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@employees</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>

<p>Visiting &#8216;/employees.json&#8217; yields the expected JSON</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;id&quot;</span>:<span style="color: #000000;">1</span>,<span style="color: #ff0000;">&quot;name&quot;</span>:<span style="color: #ff0000;">&quot;John Doe&quot;</span>,<span style="color: #ff0000;">&quot;title&quot;</span>:<span style="color: #ff0000;">&quot;Prof.&quot;</span>,<span style="color: #ff0000;">&quot;email&quot;</span>:<span style="color: #ff0000;">&quot;john@foo.com&quot;</span>,<span style="color: #ff0000;">&quot;phone&quot;</span>:<span style="color: #ff0000;">&quot;21343245252343&quot;</span>,<span style="color: #ff0000;">&quot;image&quot;</span>:<span style="color: #ff0000;">&quot;john.jpg&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></div></td></tr></tbody></table></div>

<p><strong><em>Update</em></strong>:  You can also pass details from your controller to <strong>as_json</strong> as follows:</p>

<div class="codecolorer-container ruby default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">json</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> render <span style="color:#ff3333; font-weight:bold;">:json</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@employees</span>.<span style="color:#9900CC;">as_json</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:fax</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;23423545&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div></td></tr></tbody></table></div>

<p>You can then access this in the <strong>as_json</strong> method via <strong>options[:fax]</strong> and update the JSON object tree response as you wish.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsodmike.com/2011/09/30/rails-to_json-or-as_json/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

