<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>My name is Joel</title>
	
	<link>http://joeloliveira.com</link>
	<description>I work on the web making stuff I like. I live in Boston(-ish) with my wife and our English Bulldog.</description>
	<lastBuildDate>Sun, 09 Oct 2011 19:47:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/JoelOliveira" /><feedburner:info uri="joeloliveira" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>JoelOliveira</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>RIP Steve Jobs, the Icon</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/oxZ8kmvW5rc/</link>
		<comments>http://joeloliveira.com/2011/10/06/rip-steve-jobs/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 18:15:47 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://joeloliveira.com/?p=907</guid>
		<description><![CDATA[I started writing this over at Hacker News and figured I would re-post it here. I, just now, walked into my home office after a trip to my doctor for a check-up &#8230; a check-up I&#8217;d been putting off for 2 years or so. The timing is impeccable with what happened yesterday in Mr. Jobs&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>I started writing this over at Hacker News and figured I would re-post it here.</p>
<p>I, just now, walked into my home office after a trip to my doctor for a check-up &#8230; a check-up I&#8217;d been putting off for 2 years or so.  The timing is impeccable with what happened yesterday in Mr. Jobs&#8217; passing.  Health and my personal well-being have never been more important to me than it is now.  I have lost a little over 50 pounds in the last 6 months because, well, I couldn&#8217;t ignore my health problems any longer.  It got to be increasingly important that I pay attention.</p>
<p>Other than the weight, what else have I lost?  My sister, Anna.  She was 36 years old.  Anna died from a pulmonary embolism while she was getting ready to go to work as an ICU nurse.  Ironically, she was a nurse who rarely (if ever) saw a doctor and ended up passing away because she didn&#8217;t know she was prone to easy blood clotting.  I miss her tremendously, as a human being and a true beautiful spirit, more than I can write here.  She was way way greater than the sum of her parts.</p>
<p>If that type of profound loss is not a wake up call, I don&#8217;t know what is.</p>
<p>Why will I miss Steve Jobs, the icon &#8212; a man that I&#8217;ve never met?  Not the iphones and macbooks and ipads that I&#8217;ve bought and enjoyed immensely &#8211; but <a href="http://www.youtube.com/watch?v=D1R-jKKp3NA" target="_blank">the lesson that tomorrow is no sure thing and to live today as if it&#8217;s not</a>.  This particular lesson is what I&#8217;ll always remember about this man.  He helped us get all of this wonderful STUFF, purchased with money, but the journey that got Apple there is entirely without a price tag.  So no, I won&#8217;t miss Steve Jobs, &#8220;the man&#8221; like I&#8217;ll miss Anna.  I will remember his legacy for what it provided me &#8211; the reminder to always stay foolish, always stay hungry.</p>
<p>While reflecting on things related to loss I&#8217;ve learned how important it is to hug your family members &#8211; tell them how much you love them.  Next, tell them to literally take care of themselves &#8211; both physically and spiritually.  You and I want them around, and happy, for as long as possible.</p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/oxZ8kmvW5rc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2011/10/06/rip-steve-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2011/10/06/rip-steve-jobs/</feedburner:origLink></item>
		<item>
		<title>The ampersand &amp; a killer Sass feature</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/-NuDLF23jcw/</link>
		<comments>http://joeloliveira.com/2011/06/28/the-ampersand-a-killer-sass-feature/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 03:55:47 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Sass]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://joeloliveira.com/?p=892</guid>
		<description><![CDATA[Earlier tonight Adam Stacoviak posted something on his blog about the killer feature that is the ampersand in the Sass CSS meta-language. Go read it immediately. Go. I&#8217;ll wait here. So &#8211; to boil this down &#8230; the &#8220;&#038;&#8221; tells sass to pull the entire parent selector into where you place this beautiful little ampersand. [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier tonight <a href="http://twitter.com/adamstac">Adam Stacoviak</a> posted <a href="http://adamstacoviak.com/posts/referencing-parent-selectors/" >something on his blog</a> about the killer feature that is the ampersand in the Sass CSS meta-language.  Go read it immediately.  Go.  I&#8217;ll wait here.</p>
<p>So &#8211; to boil this down &#8230; the <em>&#8220;&#038;&#8221;</em> tells sass to pull the entire parent selector into where you place this beautiful little ampersand.  The perfect use case that allowed me to dip my toes into this was with something like psuedo selectors for anchor tags.  Example: </p>
<script src="https://gist.github.com/1052807.js?file=ampersand-to-start.css"></script><p>Simple enough, right?  Pretty awesome.  As Adam noted in his blog post though, the <em>&#038;</em> doesn&#8217;t belong solely at the beginning of your nested selector &#8211; you can tack it on at the end of that nested selector for further customization.  Let&#8217;s say the example I have above needs a special edge-case for a particular page, or page state &#8212; like what if I&#8217;m logged in as an admin?  Maybe our page(s) have a new &#8220;admin&#8221; class added to our body tag? We could go the route of adding something after our scss block specifying this edge case.</p>
<script src="https://gist.github.com/1052807.js?file=ampersand-can-go-wherever-pt1.css"></script><p>But why?  Why bump this down below as almost an afterthought?  Shouldn&#8217;t we have that grouped inside within the context of the anchor tag?  We can do that with the magical ampersand:</p>
<script src="https://gist.github.com/1052807.js?file=ampersand-can-go-anywhere-pt2.css"></script><p>Pay attention to where that ampersand is.  &#8220;Pre-pend this <em>body.admin</em> right before <strong>all</strong> of the parent selectors in this nested group&#8221;.</p>
<p>Now. Here&#8217;s where I hope to stress just how money this is.  Because it is.</p>
<p>Have you used <a href="http://www.modernizr.com/">Modernizr</a>?  What about the <a href="http://code.google.com/apis/webfonts/docs/webfont_loader.html">google web-font loader</a>?  At the very least you&#8217;ve used <a href="http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/">the trick from HTML5 Boilerplate to target versions of IE with some well-placed conditional comments</a>?   What do all of these have in common?  They all dynamically, in one form or another, add classes to the root html class.  In Modernizr&#8217;s case it tells you what features you can hook into within your CSS.  In Google&#8217;s web-font loader it will update some classes in <html> to tell us if and when our typefaces <em>are loading</em> or <em>have loaded</em>.    This is where that ampersand has made things easier for me.</p>
<p>A perfect real world example to consider is when I was working on starting to integrate <a href="http://www.fontsquirrel.com/fonts/Quicksand">Quicksand</a>, a free font from FontSquirrel, with Google&#8217;s Web-font loader, into the very much in-progress <a href="http://www.designsponge.com/">Design*Sponge</a> redesign. I fell into a trap where I ended up tacking selectors onto a tragically long list for two states of the font &#8211; NOT loaded, and loaded.  Not familiar? Let me explain.  </p>
<p>The element that needed styling to use Quicksand was always set to <em>visibility: hidden</em>.  Once the font(s) finished loading the html would end up with the .wf-active class, allowing us to then show the font(s) with  <em>visibility: visible</em>.  This is all to combat <a href="http://paulirish.com/2009/fighting-the-font-face-fout/">FOUT (&#8220;flash of unstyled text&#8221;)</a>.  The tragedy was how I chose to tackle this at first &#8211; I had that previously mentioned LONG list of selectors, comma separated, that kept getting new elements whenever a new piece of text needed &#8220;QuicksandLight&#8221;.  Poor decision.  That CSS got unruly and terribly difficult to manage.  I had sass partials containing beautifully compartmentalized and scoped selectors &#8230;</p>
<p><img alt="no, it&#039;s not okay" src="http://s3.amazonaws.com/kym-assets/entries/icons/original/000/005/627/untitled.JPG" title="not ok"  width="205" height="179" class="alignright" style="clear: left" /> </p>
<p>&#8230; and then this giant blob of garbage saying &#8220;these are hidden&#8221; &#8230; &#8220;until they get .wf-active&#8221; in the html tag.   </p>
<p>Not ok.  This needed to be dealt with.  These edge-cases needed to show up right after the &#8220;normal&#8221; base selectors, not in a disparate location somewhere else in the CSS.  I determined that the best solution would be to wrap these fonts and the associated states in mixins that could be used across our scss files.  Here&#8217;s what I came up with: </p>
<script src="https://gist.github.com/1052807.js?file=quicksand-mixin.css"></script><p>At first glance it doesn&#8217;t look like such a big deal, but when you consider there are hundreds of elements on the site getting this font-face applied to it, it ends up turning into a chore mostly consisting of a <strong>lot</strong> of copy and paste.  Really study that gist &#8211; when that clicked, it was magic. </p>
<p>As a bonus, consider this &#8211; originally I didn&#8217;t realize I needed to target IE as I did in the final resulting mixin.  The site launched without <em>.msie.wf-loading</em> and <em>.msie.wf-inactive</em> in there.  Without that treatment the fonts were not showing up in IE7 and IE8.  Terrible.  After a little research I ended up adding those two into the mixin and all was good in the world.  No global search.  No copy and paste needed.   Run into that problem without using something like Sass, just plain vanilla css, and tell me you&#8217;re not annoyed.  I promise you &#8211; you&#8217;re annoyed.</p>
<p>That&#8217;s but one example using the Google font-loader.  Using this in conjunction with the conditionally set IE-related classes, or a CSS3 feature like &#8220;borderimage&#8221; (which I used the hell out of for Design*Sponge), has been a god-send.  Keeping everything tidy inside the scope of our nested selectors keeps things manageable and easy to find.  There&#8217;s no need to go searching for similar selectors across your CSS file &#8211; because it&#8217;s right <em>there</em>,  <em>right next</em> to your normal, base selector.</p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/-NuDLF23jcw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2011/06/28/the-ampersand-a-killer-sass-feature/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2011/06/28/the-ampersand-a-killer-sass-feature/</feedburner:origLink></item>
		<item>
		<title>Slides available for Railsconf 2011</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/JltPpeyCOyY/</link>
		<comments>http://joeloliveira.com/2011/05/18/slides-available-for-railsconf-2011/#comments</comments>
		<pubDate>Wed, 18 May 2011 16:38:54 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://joeloliveira.com/?p=881</guid>
		<description><![CDATA[Take a look fast because I&#8217;m sure some (not all) of these won&#8217;t last long. More are on the way as I comb through the twitter stream of speakers providing links. Zach Holman &#8211; Double-Shipping Software for Profit &#8211; http://zachholman.com/talk/2011/railsconf Jeff Casimir &#8211; Fat Models Aren’t Enough &#8211; http://dl.dropbox.com/u/69001/Fat%20Models%20Aren%27t%20Enough%20-%20RailsConf.pdf Matt Parker &#8211; Readme Driven Development [...]]]></description>
			<content:encoded><![CDATA[<p>Take a look fast because I&#8217;m sure some (not all) of these won&#8217;t last long.  More are on the way as I comb through the twitter stream of speakers providing links.</p>
<p>Zach Holman &#8211; Double-Shipping Software for Profit &#8211; http://zachholman.com/talk/2011/railsconf<br />
Jeff Casimir &#8211; Fat Models Aren’t Enough &#8211; http://dl.dropbox.com/u/69001/Fat%20Models%20Aren%27t%20Enough%20-%20RailsConf.pdf<br />
Matt Parker &#8211; Readme Driven Development &#8211; http://www.slideshare.net/moonmaster9000/readme-driven-development<br />
John Nunemaker &#8211; Why You Should Never Use an ORM &#8211; http://speakerdeck.com/u/jnunemaker/p/why-you-should-never-use-an-orm<br />
John Athayde and Bruce Williams  &#8211; Building Bulletproof Views &#8211; http://assets.en.oreilly.com/1/event/59/Building%20Bulletproof%20Views%20Presentation.pdf<br />
Derek Collison &#8211; Cloud Foundry – The Rails Developer’s Perspective &#8211; http://assets.en.oreilly.com/1/event/59/Cloud%20Foundry%20%E2%80%93%20The%20Rails%20Developer%E2%80%99s%20Perspective%20Presentation.pdf<br />
Nick Gauthier &#8211; KnowSQL: Database Tricks To Make Your Life Easier &#8211; http://knowsql.heroku.com/<br />
Clinton R. Nixon &#8211; Upgrading Legacy Rails Applications to Rails 3 &#8211; http://assets.en.oreilly.com/1/event/59/Upgrading%20Legacy%20Rails%20Applications%20to%20Rails%203%20Presentation.pdf<br />
Mikel Lindsaar &#8211; Keeping Rails on the Tracks &#8211; http://www.slideshare.net/raasdnil/keeping-rails-on-the-tracks<br />
Adam Keys &#8211; Mixing a Persistence Cocktail &#8211; http://speakerdeck.com/u/therealadam/p/mixing-a-persistence-cocktail-1<br />
Hiro Asari &#8211; 20 Productivity Tips<br />
  pdf http://dl.dropbox.com/u/1788208/ProductivityTips.pdf<br />
  keynote http://bit.ly/mqlGxi<br />
Matteo Latini &#8211; Building Bulletproof Views &#8211; http://therailsview.com/building-bulletproof-views-rc2011.pdf<br />
Bryan Liles &#8211; Active Support &#8211; http://smartic.us/doodads/presentations/railsconf2011/#1</p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/JltPpeyCOyY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2011/05/18/slides-available-for-railsconf-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2011/05/18/slides-available-for-railsconf-2011/</feedburner:origLink></item>
		<item>
		<title>Slides available from Railsconf 2011</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/IFec-vQslmA/</link>
		<comments>http://joeloliveira.com/2011/05/17/slides-available-from-railsconf-2011/#comments</comments>
		<pubDate>Tue, 17 May 2011 23:27:38 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://joeloliveira.com/?p=882</guid>
		<description><![CDATA[Get a look fast &#8211; I have a feeling some of these might not exist at these URL&#8217;s for all that long (especially the PDF&#8217;s) Zach Holman &#8211; Double-Shipping Software for Profit Jeff Casimir &#8211; Fat Models Aren’t Enough Matt Parker &#8211; Readme Driven Development John Nunemaker &#8211; Why You Should Never Use an ORM [...]]]></description>
			<content:encoded><![CDATA[<p>Get a look fast &#8211; I have a feeling some of these might not exist at these URL&#8217;s for all that long (especially the PDF&#8217;s)</p>
<ul>
<li><a href="http://zachholman.com/talk/2011/railsconf">Zach Holman &#8211; Double-Shipping Software for Profit</a></li>
<li><a href="http://dl.dropbox.com/u/69001/Fat%20Models%20Aren%27t%20Enough%20-%20RailsConf.pdf">Jeff Casimir &#8211; Fat Models Aren’t Enough</a></li>
<li><a href="http://www.slideshare.net/moonmaster9000/readme-driven-development">Matt Parker &#8211; Readme Driven Development</a></li>
<li><a href="http://speakerdeck.com/u/jnunemaker/p/why-you-should-never-use-an-orm">John Nunemaker &#8211; Why You Should Never Use an ORM</a></li>
<li><a href="http://assets.en.oreilly.com/1/event/59/Building%20Bulletproof%20Views%20Presentation.pdf">John Athayde and Bruce Williams  &#8211; Building Bulletproof Views</a></li>
<li><a href="http://assets.en.oreilly.com/1/event/59/Cloud%20Foundry%20%E2%80%93%20The%20Rails%20Developer%E2%80%99s%20Perspective%20Presentation.pdf">Derek Collison &#8211; Cloud Foundry – The Rails Developer’s Perspective</a></li>
<li><a href="http://knowsql.heroku.com/">Nick Gauthier &#8211; KnowSQL: Database Tricks To Make Your Life Easier</a></li>
<li><a href="http://assets.en.oreilly.com/1/event/59/Upgrading%20Legacy%20Rails%20Applications%20to%20Rails%203%20Presentation.pdf">Clinton R. Nixon &#8211; Upgrading Legacy Rails Applications to Rails 3</a></li>
<li><a href="http://www.slideshare.net/raasdnil/keeping-rails-on-the-tracks">Mikel Lindsaar &#8211; Keeping Rails on the Tracks</a></li>
<li><a href="http://speakerdeck.com/u/therealadam/p/mixing-a-persistence-cocktail-1">Adam Keys &#8211; Mixing a Persistence Cocktail</a></li>
<li><a href="http://dl.dropbox.com/u/1788208/ProductivityTips.pdf">Hiro Asari &#8211; 20 Productivity Tips (pdf)</a> <a href="http://bit.ly/mqlGxi">(and keynote)</a></li>
<li><a href="http://smartic.us/doodads/presentations/railsconf2011/#1">Bryan Liles &#8211; Active Support</a></li>
<li><a href="https://github.com/coderoshi/holy-grail-dbs">Eric Redmond &#8211; The Holy Grail of Databases</a></li>
</ul>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/IFec-vQslmA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2011/05/17/slides-available-from-railsconf-2011/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2011/05/17/slides-available-from-railsconf-2011/</feedburner:origLink></item>
		<item>
		<title>Visualizing the difference between references_many and embeds_many in mongoid.</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/2tC1n3dL7dg/</link>
		<comments>http://joeloliveira.com/2010/10/23/visualizing-the-difference-between-references_many-and-embeds_many-in-mongoid/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 15:17:57 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://joeloliveira.com/?p=873</guid>
		<description><![CDATA[This one gave me fits for a little bit not too long ago, and crept up on the mongoid list the other day. One of the greatest things about mongo in what it does is the idea of embedding documents into other documents &#8211; at times removing the need for relations where it makes sense. [...]]]></description>
			<content:encoded><![CDATA[<p><em>This one gave me fits for a little bit not too long ago, <a  href="http://groups.google.com/group/mongoid/browse_thread/thread/6e21edf44293f12">and crept up on the mongoid list the other day</a>.</em></p>
<p>One of the greatest things about mongo in what it does is the idea of embedding documents into other documents &#8211; at times removing the need for relations where it makes sense.  The classic example being Blog posts and comments within that post.  Why not just shove the comments directly inside of the blog posts&#8217; documents?  It&#8217;s faster and makes sense &#8211; these are just documents right?  So let&#8217;s treat them as such.</p>
<p>But on occasion the need for relations remains.  On a toy app I&#8217;ve begun rewriting to use Rails3 and Mongo (Mongoid, specifically) I ran into a conceptual road-block that I&#8217;ve seen creep up on occasion between the other (relative) newbies like myself &#8211; how the relations are stored between Mongoid objects.   I needed a relational association instead of just embedding (why? the size limit for collections probably would have bitten me in the ass in the future).   But after following the conventions in the documentation and inspecting how things ended up in the database I realized I had a few things twisted. </p>
<p>I think part of it, at least for me, is the <strong>idea</strong> of embedding gets in the way of how you perceive this getting stored within the mongo document(s).   Take <a href="http://mongoid.org/docs/associations/">the example at the mongoid documentation</a> under &#8220;Relational Associations&#8221; </p>
<p><code><br />
class Person<br />
  include Mongoid::Document<br />
  references_many :prescriptions<br />
end</p>
<p>class Prescription<br />
  include Mongoid::Document<br />
  referenced_in :person<br />
end<br />
</code></p>
<p>When I look at that &#8211; I think that the <em>Person</em> would collect the references to <em>Prescription</em>, perhaps in a :prescriptions array.  Such is not the case. Instead the Prescription objects contain a single reference to its &#8220;parent&#8221; object &#8211; Person.  Below is a comparison of what you might think, versus how it&#8217;s actually stored in the database</p>
<p><code><br />
john = Person.create<br />
prescription = Prescription.create<br />
john.prescriptions << prescription<br />
john.save<br />
</code></p>
<p>How you might perceive this is being stored<br />
<code><br />
# john =><br />
# {<br />
# 	"_id" : ObjectId("4cc2f0bac0b37e9c17000001"),<br />
# 	"_type" : "Person",<br />
#	"prescriptions" : [ ObjectId("4cc2f0bac0b37e9c17000002") ]<br />
# 	"created_at" : "Sat Oct 23 2010 10:27:06 GMT-0400 (EDT)"<br />
# }</p>
<p># prescription =><br />
# {<br />
# 	"_id" : ObjectId("4cc2f0bac0b37e9c17000002"),<br />
# 	"_type" : "Prescription",<br />
# 	"created_at" : "Sat Oct 23 2010 10:27:06 GMT-0400 (EDT)"<br />
# }<br />
</code></p>
<p>Versus what this is actually doing<br />
<code><br />
# john =><br />
# {<br />
# 	"_id" : ObjectId("4cc2f0bac0b37e9c17000001"),<br />
# 	"_type" : "Person",<br />
# 	"created_at" : "Sat Oct 23 2010 10:27:06 GMT-0400 (EDT)"<br />
# }<br />
#<br />
# prescription =><br />
# {<br />
# 	"_id" : ObjectId("4cc2f0bac0b37e9c17000002"),<br />
# 	"_type" : "Prescription",<br />
# 	"created_at" : "Sat Oct 23 2010 10:27:06 GMT-0400 (EDT)",<br />
# 	"person_id" : ObjectId("4cc2f0bac0b37e9c17000001")<br />
# }<br />
</code></p>
<p>I realize this follows the same old ActiveRecord conventions of the parent ID being stored in the children objects, but when you develop that big ole&#8217; crush on, and get married to, the idea of mongo&#8217;s embedded documents &#8211; it&#8217;s difficult to switch gears!</p>
<p><em>If any information is misrepresented or factually incorrect please leave a comment and let me know!</em></p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/2tC1n3dL7dg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2010/10/23/visualizing-the-difference-between-references_many-and-embeds_many-in-mongoid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2010/10/23/visualizing-the-difference-between-references_many-and-embeds_many-in-mongoid/</feedburner:origLink></item>
		<item>
		<title>Rack::Tidy and Devise in the Rack Middleware Stack</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/Cp5q7g8KJ4Q/</link>
		<comments>http://joeloliveira.com/2010/09/25/racktidy-and-devise-in-the-rack-middleware-stack/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 15:28:22 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://joeloliveira.com/?p=866</guid>
		<description><![CDATA[After quite a bit of digging around, and a little help from mr. Jose Valim at Plataformatec, I realized that the combination of the Devise authentication gem, along with Rack-Tidy, aren&#8217;t quite so friendly with each other. The main culprit here, I would say is the Tidy gem. Why? Because the essence of its existence [...]]]></description>
			<content:encoded><![CDATA[<p>After quite a bit of digging around, and a little help from mr. <a href="http://github.com/josevalim">Jose Valim</a> at <a href="http://plataformatec.com.br/">Plataformatec</a>, I realized that the combination of the <a href="http://github.com/plataformatec/devise">Devise</a> authentication gem, along with <a href="http://github.com/webficient/rack-tidy">Rack-Tidy</a>, aren&#8217;t quite so friendly with each other.  The main culprit here, I would say is the Tidy gem.  Why?  Because the essence of its existence is to re-arrange the markup handed back from the app-server.  So some things get lost in the shuffle during all that house-cleaning (please, correct me if I&#8217;m wrong).</p>
<p>I had a hunch that with a little musical chairs in the middleware stack, we could find a solution that would allow all pieces to live harmoniously.  Luckily, I was right.  The trick is to make sure Tidy is inserted into the stack before ActionDispatch::Flash (<em>because Rack::Tidy was killing the flash messages returned from Devise/Warden</em>) and before Warden::Manager (<em>the rack authentication layer beneath Devise</em>).  The resulting stack, for me, looks like so (important bits in bold):</p>
<p><code>use ActionDispatch::Static<br />
use Rack::Lock<br />
use ActiveSupport::Cache::Strategy::LocalCache<br />
use Rack::Runtime<br />
use Rails::Rack::Logger<br />
use ActionDispatch::ShowExceptions<br />
use ActionDispatch::RemoteIp<br />
use Rack::Sendfile<br />
use ActionDispatch::Callbacks<br />
use ActionDispatch::Cookies<br />
use ActionDispatch::Session::CookieStore<br />
use ActionDispatch::ParamsParser<br />
use Rack::MethodOverride<br />
use ActionDispatch::Head<br />
use ActionDispatch::BestStandardsSupport<br />
<strong>use Rack::Tidy<br />
use ActionDispatch::Flash<br />
use Warden::Manager</strong><br />
use Sass::Plugin::Rack<br />
run MyApp::Application.routes</code></p>
<p>And is accomplished with this code instead the app initialization process (application.rb):</p>
<p><code>config.middleware.delete ActionDispatch::Flash   # remove from current position<br />
config.middleware.insert_before Warden::Manager, ActionDispatch::Flash # add it right back in before Warden<br />
config.middleware.insert_before ActionDispatch::Flash, Rack::Tidy, 'indent-spaces' => 2 # finally, add in Rack:Tidy before ActionDispatch::Flash.</code></p>
<p>The resulting stack looks like it&#8217;s working quite well for now.</p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/Cp5q7g8KJ4Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2010/09/25/racktidy-and-devise-in-the-rack-middleware-stack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2010/09/25/racktidy-and-devise-in-the-rack-middleware-stack/</feedburner:origLink></item>
		<item>
		<title>What this freelancing lifestyle is missing</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/Dm20XzfH7Bk/</link>
		<comments>http://joeloliveira.com/2010/07/28/what-this-freelancing-lifestyle-is-missing/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 19:24:01 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://joeloliveira.com/?p=835</guid>
		<description><![CDATA[In a word &#8211; &#8220;Feedback&#8221;. Plain and simple. It&#8217;s a given that while we work with our customers and clients we get some feedback along the way &#8211; &#8220;This is good&#8221;, &#8220;This needs to move over here&#8221;, &#8220;Make this red&#8221;, etc. That sort of feedback, however, is a little superficial in the grand scheme of [...]]]></description>
			<content:encoded><![CDATA[<p>In a word &#8211; &#8220;Feedback&#8221;.  Plain and simple.</p>
<p>It&#8217;s a given that while we work with our customers and clients we get some feedback along the way &#8211; &#8220;This is good&#8221;,  &#8220;This needs to move over here&#8221;, &#8220;Make this red&#8221;, etc.   That sort of feedback, however, is a little superficial in the grand scheme of things and not quite the feedback we&#8217;re in need of most.   The feedback I&#8217;ve been missing for the past few years is the piece of the traditional employee-employer (&#8220;working for the man&#8221;) relationship.  We might bitch and moan about it when we&#8217;re there within that context, but to be frank &#8211; the annual review is crucial.  How else are we to know what we need to improve on?  </p>
<p>As a freelancer &#8211; these constructs no longer exist if we don&#8217;t want them to.  Which is nice to begin with.  <em>We&#8217;re free! Right?!</em>  Right.   But, over time the novelty and the doubt will creep in and you&#8217;ll be left wondering &#8211; &#8220;What is it that I could do better?&#8221;.  I&#8217;ve found myself longing for this feedback as of late and, while it&#8217;s a little scary and my <a href="http://sethgodin.typepad.com/seths_blog/2010/01/quieting-the-lizard-brain.html">lizard brain</a> is wailing like a banshee, I&#8217;m pulling the trigger.   </p>
<p>I&#8217;ll be asking my clients upon project completion just what it is that I did well on, and what I done poorly or could use some work.  To some it might be counter-intuitive &#8211; &#8220;They hired you, right?  They had to have confidence.&#8221; &#8211; but I&#8217;m more interested and excited to know for sure.  No gray area.  No guessing.  No assumptions.   Running a business is just that &#8211; it&#8217;s business.  There&#8217;s nothing personal about this.   Tell me how my business can be <strong>better</strong>.</p>
<p>I&#8217;m sure a good number of my fellow freelancers have been doing this for months (years) and wondering what&#8217;s taken me so long.  I really wish I had an answer for that, but I don&#8217;t.  Would those of you who have been doing this have any suggestions?  Are there any questions you&#8217;ve asked that get the most constructive and helpful reaction?</p>
<p><small>Continuing on this theme, but a different post for another day, is feedback from a different slice of our professional life &#8211; our peers.    <em>To be continued &#8230;</em></small></p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/Dm20XzfH7Bk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2010/07/28/what-this-freelancing-lifestyle-is-missing/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2010/07/28/what-this-freelancing-lifestyle-is-missing/</feedburner:origLink></item>
		<item>
		<title>Debugging in Cucumber</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/XOLRSKMcq7I/</link>
		<comments>http://joeloliveira.com/2010/07/17/debugging-in-cucumber/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 22:49:47 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.joeloliveira.com/?p=830</guid>
		<description><![CDATA[As a relative newb&#8217; to cucumber I realize there&#8217;s a lot to get caught up on. The one thing I do know is that there&#8217;s a lot that I don&#8217;t know. Having said that, when I run into a barrier or an issue and I want to dig into the source to figure things out, [...]]]></description>
			<content:encoded><![CDATA[<p>As a relative newb&#8217; to <a href="http://cukes.info">cucumber</a> I realize there&#8217;s a lot to get caught up on.  The one thing I <strong>do</strong> know is that there&#8217;s a lot that I don&#8217;t know.   Having said that, when I run into a barrier or an issue and I want to dig into the source to figure things out, what do you do?</p>
<p>You break out <em>ruby-debug</em>, of course.</p>
<p>Add <em>require &#8216;ruby-debug&#8217;</em> to features/support/env.rb and throw a breakpoint into your step definitions.</p>
<p>That&#8217;s all well and good, and it works just fine.  But what do you look for while you&#8217;re in there?   I spent the better part of an evening looking for how I could sniff around the html source cucumber was testing against and couldn&#8217;t find it.  Lots of searching for how to pear into @response and @request &#8211; which end up being nil as far as I can see.  </p>
<p>I had no idea.</p>
<p>Until I read <a href="http://theled.co.uk/blog/archive/2010/07/17/how-we-added-automated-html-validation-to-our-web-development-process/" target="_blank">this post from the LoED</a> on how to test your source&#8217;s validity.  In there was the answer:</p>
<p><em>page.body</em></p>
<p>Eureka!</p>
<p>Baby steps.  I&#8217;ll figure this all out yet.</p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/XOLRSKMcq7I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2010/07/17/debugging-in-cucumber/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2010/07/17/debugging-in-cucumber/</feedburner:origLink></item>
		<item>
		<title>rvm, ree, nginx and phusion passenger</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/ZOi_CAa4wzI/</link>
		<comments>http://joeloliveira.com/2010/03/12/rvm-ree-nginx-and-phusion-passenger/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 18:08:13 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.joeloliveira.com/?p=816</guid>
		<description><![CDATA[A production web / application server that I maintain has been around for mostly wordpress and static sites we host for some of our clients. Soon, however, the need for some Rails-based client sites will be popping up for us over there. Traditionally the set-up for those apps have been in clients&#8217; own hosting environments, [...]]]></description>
			<content:encoded><![CDATA[<p>A production web / application server that I maintain has been around for mostly wordpress and static sites we host for some of our clients.  Soon, however, the need for some Rails-based client sites will be popping up for us over there.  Traditionally the set-up for those apps have been in clients&#8217; own hosting environments, or were apps I hosted in a dedicated app-server slice of my own.   So, the need crept up, and now I&#8217;m left planning for now, and the future.  And what is that future, you might ask (ok, probably not)?  Rails 3, of course.    </p>
<p>The baseline reference implementation  for Rails 3, as I know it, is 1.8.7, but has been tested to work with Ruby 1.9, and also functions properly with Phusion&#8217;s Ruby Enterprise Edition (henceforth known as REE).   To say that Ruby is in a transition phase is an understatement.   The community has been hard at work trying to get gems, frameworks, their associated plugins, etc, to work with all of the new shiny ruby-based toys.   In order to accurately test, the RVM project has stepped up as the solution for testing and developing across multiple Ruby interpreters.    </p>
<p>New server setup, quickly moving innovation, growth and change &#8230; all of these point me in one direction &#8211; drinking the RVM kool-aid and getting right into it.  But not without a few hiccups.   Here are my steps in getting things rolling with rvm, nginx, ree and passenger.</p>
<p><strong>Note:</strong> Don&#8217;t install nginx at first thinking that passenger will end up being installed as a plugin, or module.  I wasted some time in doing that.  When you go through the process of installing passenger it&#8217;ll ask to compile and re-install nginx.  So we&#8217;ll get to that eventually.</p>
<p>To get everything compiling as I wanted I had to install a handful of obvious, and not-so-obvious, packages and libraries.  To wit: </p>
<blockquote><p>sudo apt-get install ruby-full build-essential curl libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev libgcrypt11 libgcrypt11-dev bison libreadline5-dev</p></blockquote>
<p><small>Your mileage may vary.</small></p>
<p>Also, the irony doesn&#8217;t escape me that we needed to install ruby, &#8220;ruby-full&#8221;, in order to install a bunch of other rubies.  But hey, whatever.</p>
<p><strong>Install rvm</strong>.  It&#8217;s as easy as <a href="http://rvm.beginrescueend.com/rvm/install/">following the instructions at the RVM site</a>.  I chose to go the gem route.  Follow the instructions as are given and things will be fine.  The only hiccups I had involved some libraries that are taken care of in the above package installs.</p>
<p><strong>Install the versions of ruby you&#8217;d like</strong>.  <em>rvm install 1.8.6,1.8.7-head,ree,1.9.1</em></p>
<p>According to fellow boston.rb&#8217;ist @<a href="http://twitter.com/techiferous">techiferous</a> we use 1.8.7-head, because</p>
<blockquote><p><a href="http://twitter.com/techiferous/status/8751925362">#</a> Rails 3 needs Ruby 1.8.7. Use rvm to manage Ruby versions. Do &#8220;rvm ruby-1.8.7-head&#8221; NOT ruby-1.8.7-p249 (broken gems).</p></blockquote>
<p>After some time compiling and wrangling everything together you should have a handful of different rubies at your disposal.  Please visit the rvm site for examples, use cases and general information.  It&#8217;s worth your time.  </p>
<p>At this point I switched to ruby-ree in preparation of the passenger and nginx install.  <em>rvm ree</em>.  A quick <em>ruby &#8211;version</em> now tells us that we&#8217;re running <em>ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0&#215;6770, Ruby Enterprise Edition 2010.01</em>. </p>
<p><strong>Install Passenger and Nginx</strong>.  <em>gem install passenger &#038;&#038; rvmsudo passenger-install-nginx-module</em> will get you started.  Here&#8217;s where the install of Nginx goes down, as noted in the text after you run the command: </p>
<blockquote><p>Nginx doesn&#8217;t support loadable modules such as some other web servers do,<br />
so in order to install Nginx with Passenger support, it must be recompiled.</p></blockquote>
<p>I chose to customize my own install and selected the second option.   Do whatever you&#8217;re most comfortable with.  I prefer to have my compiled source in /opt/local, but again, it&#8217;s all a matter of preference.   After some more compiling, we were all done and have a newly compiled install of Nginx, with Passenger, Utilizing the REE ruby interpreter.</p>
<p>Last but not least, go thank <a href="http://twitter.com/wayneeseguin">Wayne Seguin</a> for the work on RVM.  Amazing work!</p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/ZOi_CAa4wzI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2010/03/12/rvm-ree-nginx-and-phusion-passenger/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2010/03/12/rvm-ree-nginx-and-phusion-passenger/</feedburner:origLink></item>
		<item>
		<title>From the Ruby Noob Dept: Issue(s) with accepts_nested_attributes_for</title>
		<link>http://feedproxy.google.com/~r/JoelOliveira/~3/EG0fzbefS6E/</link>
		<comments>http://joeloliveira.com/2010/02/27/from-the-ruby-noob-dept-accepts_nested_attributes_for-issues/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 23:03:25 +0000</pubDate>
		<dc:creator>Joel</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.joeloliveira.com/?p=810</guid>
		<description><![CDATA[Finally took some time to jump in and refactor some nested forms at Thredded using Rails 2.3&#8242;s accepts_nested_attributes_for. Thanks to Ryan Bates&#8217; screencasts on the topic it was fairly easy. A little code cleanup and everything worked as it should &#8230; other than one thing. Can&#8217;t mass-assign these protected attributes Noticed that error in my [...]]]></description>
			<content:encoded><![CDATA[<p>Finally took some time to jump in and refactor some nested forms at <a href="http://thredded.com">Thredded</a> using Rails 2.3&#8242;s accepts_nested_attributes_for.  Thanks to <a href="http://railscasts.com/episodes?search=nested+forms">Ryan Bates&#8217; screencasts</a> on the topic it was fairly easy.  A little code cleanup and everything worked as it should &#8230; other than <em>one thing</em>.</p>
<p><strong>Can&#8217;t mass-assign these protected attributes</strong></p>
<p>Noticed that error in my development logfiles after a particular form wasn&#8217;t being saved.   A User class had some protected, and some not, attributes and until I added the Profile attributes to it, the nested form submitting a User and it&#8217;s associated Profile record would not save.</p>
<pre class="prettyprint lang-ruby">
class User < ActiveRecord::Base
  has_one  :profile
  accepts_nested_attributes_for :profile
  attr_accessible :login, :email, :password, :password_confirmation
  # ...
end</pre><p>Needed just the Profile attributes set as accessible and ready for mass assignment</p>
<pre class="prettyprint lang-ruby">
class User < ActiveRecord::Base
  has_one  :profile
  accepts_nested_attributes_for :profile
  attr_accessible :login, :email, :password, :password_confirmation, :profile_attributes
  # ...
end</pre><p>Another case where you need to know at all times where and if properties of your classes are locked down or not.</p>
<img src="http://feeds.feedburner.com/~r/JoelOliveira/~4/EG0fzbefS6E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://joeloliveira.com/2010/02/27/from-the-ruby-noob-dept-accepts_nested_attributes_for-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://joeloliveira.com/2010/02/27/from-the-ruby-noob-dept-accepts_nested_attributes_for-issues/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.431 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-02-05 14:17:08 -->

