<?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/" version="2.0">

<channel>
	<title>code.causes.com</title>
	
	<link>http://code.causes.com</link>
	<description>Apply brainpower here.</description>
	<lastBuildDate>Fri, 12 Jun 2009 08:22:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/causescode" type="application/rss+xml" /><item>
		<title>Keeping Time</title>
		<link>http://code.causes.com/blog/keeping-time/</link>
		<comments>http://code.causes.com/blog/keeping-time/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 08:16:47 +0000</pubDate>
		<dc:creator>Kristján</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[back to the future]]></category>
		<category><![CDATA[hard bugs]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=116</guid>
		<description><![CDATA[As a drummer, keeping time is pretty simple.  Count to 4, rinse, repeat.  As a coder, not so much.  Time in the computer world is kept to at least second precision, and usually millisecond or further.  When you&#8217;re trying to do a whole lot of things with different systems just as [...]]]></description>
			<content:encoded><![CDATA[<p>As a drummer, keeping time is pretty simple.  Count to 4, rinse, repeat.  As a coder, not so much.  Time in the computer world is kept to at least second precision, and usually millisecond or further.  When you&#8217;re trying to do a whole lot of things with different systems just as quick as you can, this can yield unexpected results.</p>
<p>Let&#8217;s take a look at some simple code on our <code>Hamburger</code> model, which inherits from <code>ActiveRecord::Base</code> and has a <code>created_at</code> column.</p>
<pre>
>> whopper = Hamburger.create!(:cheese => true)
=> #&lt;Hamburger id: 1, cheese: true, created_at: "2009-06-12 07:44:48"&gt;
</pre>
<p>Cool, now we can eat.  Let&#8217;s load up another copy of this hamburger instance because company is coming and physics is no barrier.</p>
<pre>
>> whopperjr = Hamburger.find 1
=> #&lt;Hamburger id: 1, cheese: true, created_at: "2009-06-12 07:44:48"&gt;
</pre>
<p>Super.  Our cheese is safe, and we still know how old it is, which we can use in <code>should_i_eat_this?</code>  But something funny has happened. Let&#8217;s tinker a bit.</p>
<pre>
>> whopper.created_at == whopperjr.created_at
=> false
>> whopper.created_at &gt; whopperjr.created_at
=> true
</pre>
<p>Huh?  Now that&#8217;s weird.  Time is fooling around on me, and I don&#8217;t trust that my sandwich is edible anymore.  Let&#8217;s take a closer look.</p>
<pre>
>> whopper.created_at.to_f
=> 1244792688.91866
>> whopperjr.created_at.to_f
=> 1244792688.0
</pre>
<p>Now isn&#8217;t that something?  Here&#8217;s what&#8217;s going on, in slow motion*:</p>
<pre>
>> whopper = Hamburger.new
>> whopper.cheese = true
>> whopper.created_at = Time.now  # 1244792688.91866
>> whopper.save!
=> #&lt;Hamburger id: 1, cheese: true, created_at: "2009-06-12 07:44:48"&gt;
>> whopperjr = Hamburger.new
>> whopperjr.cheese = true
>> whopperjr.created_at = Time.parse("2009-06-12 07:44:48")  # 1244792688.0
=> #&lt;Hamburger id: 1, cheese: true, created_at: "2009-06-12 07:44:48"&gt;
</pre>
<p>Our <code>whopper</code> has been assigned a <code>Time</code> object that represents <i>right now</i>, including all the fractions of a second you could want.  Sadly, when the value is dumped into MySQL&#8217;s <code>datetime</code> column, the fractional portion is dropped on the floor.  When loaded back into memory, then, <code>whopperjr</code> has forgotten exactly when it was pulled off the grill, and has to run with the less accurate representation, leaving us with an object that was actually created <i>before</i> it was created!</p>
<p>Now if only Doc Brown had known this, he could have saved a lot of trouble from those Libyans.</p>
<p><small>*No, it&#8217;s not entirely accurate, ActiveRecord is using integers, not strings to talk to MySQL. Let&#8217;s call it isomorphic.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/keeping-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leaning into Distractibility</title>
		<link>http://code.causes.com/blog/leaning-into-distractibility/</link>
		<comments>http://code.causes.com/blog/leaning-into-distractibility/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 05:50:52 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[distraction]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=85</guid>
		<description><![CDATA[Some days, I&#8217;m able to focus for hours without distraction, getting my head completely into the problem I&#8217;m working on, and nothing short of the building collapsing will pull me out of it.
Other days, the slightest passing thought or noise distracts me, and I&#8217;m constantly checking my email, opening news sites or blogs in new [...]]]></description>
			<content:encoded><![CDATA[<p>Some days, I&#8217;m able to focus for hours without distraction, getting my head completely into the problem I&#8217;m working on, and nothing short of the building collapsing will pull me out of it.</p>
<p>Other days, the slightest passing thought or noise distracts me, and I&#8217;m constantly checking my email, opening news sites or blogs in new tabs, and getting up to get snacks or drinks.</p>
<p>Today was one of those distractible days.  After watching the inauguration in the morning, my mind was abuzz with thoughts about politics, the economy, the future&#8230; pretty much anything but work.</p>
<p>I&#8217;ve tried a few mechanisms for dealing with days like this, before finally landing on one that seems to work and results in me still getting things done.  I&#8217;ve tried to power through it, and work on exactly what I otherwise would have worked on, but distractions pop me out of my mental constructions, and I have difficulty solving big problems.  I&#8217;ve tried leaving work for some time to allow myself to be distracted, but this almost never results in a quick return to productivity.</p>
<p>The final approach, which I used today, is to take advantage of the distractibility to deal with all of the small niggling tasks that have been building up over time.  Tiny and annoying tasks lend themselves to distraction regardless of mood.   There is a natural breath after the completion of any task, so even when feeling focused, a series of small tasks lends itself to more interruption and wasted time than a single larger task.  When I&#8217;m in a distractible mood, I&#8217;m going to be wasting that time anyway, so its an ideal time to get rid of these annoyances without detracting from what I could be getting done.</p>
<p>So instead of making progress on my larger tasks, today I spent my time on a myriad of small tasks.  I investigated a number of reports from our support team, fixed a few bugs I found with that, refactored some controller logic for our <a href="http://apps.facebook.com/causes/birthdays/new">Birthday Cause</a> feature to make it easier to reorder pages in various flows, merged in a lingering branch of cleanup from our last fixit day, and made a number of other small tweaks, fixes, etc. </p>
<p>None of these was very big, none of them very interesting, but all needed to get done at some point.  By leaning into my distractibility instead of fighting with it, instead of a wasted day I&#8217;m going home with a list of things I no longer need to worry about.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/leaning-into-distractibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Campfire Makes Us More Productive</title>
		<link>http://code.causes.com/blog/campfire-makes-us-more-productive/</link>
		<comments>http://code.causes.com/blog/campfire-makes-us-more-productive/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 18:48:14 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=69</guid>
		<description><![CDATA[
Our whole engineering team uses Campfire to communicate. We have our git commits, our continuous integration testing (via CruiseControl), our deploy notices and our homegrown AI bot all in the room with us.
Whether one of our engineers is looking for a code review, some advice on a design decision or is logged in at 3am [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://code.causes.com/assets//campfire-is-productive-242x300.png" alt="Campfire is productive" title="Campfire is productive" width="242" height="300" class="alignright size-medium wp-image-76" /></p>
<p>Our whole engineering team uses <a href="http://campfirenow.com/">Campfire</a> to communicate. We have our git commits, our continuous integration testing (via <a href="http://cruisecontrolrb.thoughtworks.com/">CruiseControl</a>), our deploy notices and our homegrown AI bot all in the room with us.</p>
<p>Whether one of our engineers is looking for a code review, some advice on a design decision or is logged in at 3am to deal with a server failure, Campfire provides a single point of contact that makes our team&#8217;s communication smooth, immediate and persistent. We can search back in the chat&#8217;s history, browse logs of conversations we missed and easily find files and images that our teammates have shared.</p>
<p>We&#8217;ve had a few people say something to the effect of, &#8220;isn&#8217;t this just a re-implementation of <acronym title="Internet Relay Chat">IRC</acronym>?&#8221; To some extent, yes, it is a re-implementation of an instant chat mechanism. But Campfire&#8217;s strengths are in its universal accessibility (all you need is a web browser), its built-in transcript logging and searching, and its easy file and image sharing. This is one case where a commercial product found a niche in a market that was assumed to have already been satisfied.</p>
<p>If you&#8217;re using Campfire too, be sure to check out site-specific browsers like <a href="http://fluidapp.com/">Fluid</a> or <a href="http://propaneapp.com/">Propane</a> for Mac OS X, and <a href="http://labs.mozilla.com/2007/10/prism/">Prism</a> more generally. They can be a huge help, leaving your primary web browser for web browsing while you maintain a Campfire session on the side.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/campfire-makes-us-more-productive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Get An Awesome Job</title>
		<link>http://code.causes.com/blog/how-to-get-an-awesome-job/</link>
		<comments>http://code.causes.com/blog/how-to-get-an-awesome-job/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 19:33:10 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=43</guid>
		<description><![CDATA[A lot of people want to get an awesome job, but most of the advice out there is geared toward joining corporate bureaucracies and saving some repressed human resources manager from a frightful view of reality. There is something you can do, however: get a new awesome job.]]></description>
			<content:encoded><![CDATA[<p>A lot of people want to get an awesome job, but most of the advice out there is geared toward joining corporate bureaucracies and saving some repressed human resources manager from a frightful view of reality. Résumé templates, guidance counselors and the corporate ladder have conspired to make your career as boring and reproducible as possible. There is something you can do, however: get a new awesome job.</p>
<p>How might one go about that, you ask?</p>
<ol>
<li><strong>Be yourself.</strong> The single most important component of your career search is <em>you</em> and <em>your personality</em>. You will never be thoroughly happy with a job that doesn&#8217;t fit your personality, so the best way to ensure that you find a fit is to never be fake. No &#8220;Dear Sir/Madam&#8221;, no &#8220;I greatly appreciate your time&#8221;, no nonsense. Be polite, but be honest, direct and confident.</li>
<li><strong>Know what you want.</strong> &#8211; It&#8217;s crucial to decide what you want to pursue and stick with it, at least for a single round of job applications. A candidate who is direct and unambiguous is much more likely to get a quick response than one who is amorphous and uninspiring. Your mission when applying for a job is to be sure of what you want to do, for how much, for how long, and be memorable enough to achieve it.</li>
<li><strong>Make a clean, strong résumé.</strong> &#8211; You have <a href="http://www.randsinrepose.com/archives/2007/02/25/a_glimpse_and_a_hook.html">less than 30 seconds to make an impression</a> with your résumé. If you&#8217;re applying for a chemical engineering job, <em>don&#8217;t</em> include your position as Manager of Taco Bell on your résumé. Your résumé is your chance to sell yourself for the position you&#8217;re applying for, so it should reflect you in the best possible light for that specific position. Don&#8217;t lie, but omit things that are irrelevant. Keep it short (one page), keep it clean and make sure only the most important pieces of information remain.</li>
<li><strong>Know your mark.</strong> &#8211; Research the company and its products. If the products or services are publicly available, try them out and write up a quick critique. You don&#8217;t have to impress the company with your knowledge of their business, but you do need to <a href="http://www.randsinrepose.com/archives/2007/03/21/the_sanity_check.html">build up enough mental ammunition</a> to give you a fighting chance in any phone or on-site interviews. Further than that, you need to find out if this is really the type of place that you could be happy. Be vigilant about the details of your correspondences and conversations with the people who work there. Are they happy? Stressed? Candid? Are they <em>your kind of people</em>?</li>
<li><strong>Ask hard questions.</strong> &#8211; When you do get a chance to speak with an interviewer and they ask you if you have any questions, make sure you have at least one good one ready. You&#8217;re not trying to confuse or impress the interviewer; your goal is to dive deeper into the company than you&#8217;ve previously been able. Ask about their revenue stream, their typical process for handling product crises or their adherence to their company vision. The question should give the interviewer pause, but they should feel obligated to respond frankly. Don&#8217;t ask about benefits or vacation—those just make you sound needy and are always incidental and up for negotiation at a later date. Instead, focus on the internal parts of the company that are most crucial to its long-term sustainability as an awesome employer. <em>They are not doing you a favor by interviewing you</em>, so behave as if they should actually want to hire you for your brilliance.</li>
</ol>
<p>The gist of this seems like something that ought to be mostly common sense: be yourself, be good, be direct; but most people searching for a job are still busy taking résumé templating courses and filling out endless job applications for mindless corporations instead of finding the places that are actually worth working for. There are always jobs out there worth having—and don&#8217;t even <em>think</em> about protesting with an &#8220;in this economy&#8230;&#8221; cop-out; it just takes a bit of work to find them and show them your obvious genius.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/how-to-get-an-awesome-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Twinkies</title>
		<link>http://code.causes.com/blog/on-twinkies/</link>
		<comments>http://code.causes.com/blog/on-twinkies/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 19:00:51 +0000</pubDate>
		<dc:creator>Kristján</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=7</guid>
		<description><![CDATA[When Twinkies were originally invented in 1930, their filling was banana flavored. It switched to vanilla during World War II when there was a banana shortage. Come 2005, for the release of King Kong, they released a promotional batch of banana again.
Who knew?
]]></description>
			<content:encoded><![CDATA[<p>When Twinkies were originally invented in 1930, their filling was banana flavored. It switched to vanilla during World War II when there was a banana shortage. Come 2005, for the release of King Kong, they released a promotional batch of banana again.</p>
<p>Who knew?</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/on-twinkies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When First Place Should Lose</title>
		<link>http://code.causes.com/blog/when-first-place-should-lose/</link>
		<comments>http://code.causes.com/blog/when-first-place-should-lose/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 19:00:58 +0000</pubDate>
		<dc:creator>Kristján</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=8</guid>
		<description><![CDATA[A week ago, four causes were created with an interesting idea. Each of these people put themselves in the running to have their head shaved bald in support of the  American Cancer Society’s Shave to Save program...]]></description>
			<content:encoded><![CDATA[<style type="text/css">
table#shave td {     text-align: center;     padding: 0px 10px;  }
table#shave img {     border: 0px none;  }
table#shave a {     text-decoration: none;  }
</style>
<table id="shave" border="0">
<tbody>
<tr>
<td><a href="http://apps.facebook.com/causes/104691" target="_blank"><br />
<img src="http://s1.causes.com/photos/zJ/VC/7P/vz/5q/b1/Jt/SeM.jpg" alt="" /><br />
Steve Randa<br />
Shave to Save<br />
</a></td>
<td><a href="http://apps.facebook.com/causes/104697" target="_blank"><br />
<img src="http://s2.causes.com/photos/8u/ok/of/cW/Uk/Zv/ry/tuM.jpg" alt="" /><br />
Jason Gramke<br />
Shave to Save<br />
</a></td>
<td><a href="http://apps.facebook.com/causes/104699" target="_blank"><br />
<img src="http://s1.causes.com/photos/Iw/L5/K2/oD/ka/Ew/tO/riM.jpg" alt="" /><br />
Jason Fortune<br />
Shave to Save<br />
</a></td>
<td><a href="http://apps.facebook.com/causes/104700" target="_blank"><br />
<img src="http://s3.causes.com/photos/BK/SQ/TW/u2/mF/wX/tj/7AM.jpg" alt="" /><br />
Andy McGinnis<br />
Shave to Save<br />
</a></td>
</tr>
</tbody>
</table>
<p>A week ago, these four causes were created with an interesting idea. Each of these people put themselves in the running to have their head shaved bald in support of the  American Cancer Society’s Shave to Save program. The two of them who get the most votes will be put under the razor, and the fun part is how you cast a vote: with a dollar. Each dollar donated to your cause gets you closer to a smooth, shiny, hopefully-not-sunburnt scalp.</p>
<p>This creates a dynamic that you don’t see in typical fundraising runs. Rather than getting your friends to support you while you  walk/ jump rope/ juggle, you’re rallying your other friends to help you stick it to the ones involved in the competition. You activate four networks of people (though in this case there’s likely a lot of overlap) who can now feed off of each other in two ways:</p>
<ul>
<li>A Bidding War &#8211; If I convince my group of friends that it would be the most amusing to see Steve without hair, we’re all now interested in keeping his votes highest. And what does that mean? More donations to Steve’s cause. As other groups decide on other targets, we get into a classic bidding war, a concept that we otherwise haven’t seen yet in our application.</li>
<li>Anyone but Me! &#8211; If I’m picked as a target, on the assumption that I’d actually prefer to keep my hair, I need to keep myself out of first (and in this case also second) place. So as more and more donations come my way, I have to take it out on whoever&#8217;s closest behind me with donations of my own. When everyone follows this strategy, you get another positive feedback loop, and the karma katamari keeps on rolling.</li>
</ul>
<p>As of today, these causes have raised over $400 from just a few donors in only a week. Not bad at all, and if we were to work these ideas properly into the application somewhere, I have no doubt that we could get a solid donation machine running. And you know what I love most? We can employ game dynamics like this without concern for how people might try and play the system. So you used six different credit cards, created fake profiles and bribed people with pizza. What do I care? You just made the world a better place.</p>
<p>So kudos to Steve, Jason, and Andy for their clever strategy and support of the ACS. Thank you for making us a part of it and showing everyone else how Causes can make a difference, even among a small group of friends.</p>
<p>P.S. I hope you post pictures of your shaving party</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/when-first-place-should-lose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Activism and Social Networks</title>
		<link>http://code.causes.com/blog/activism-and-social-networks/</link>
		<comments>http://code.causes.com/blog/activism-and-social-networks/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 19:00:33 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=9</guid>
		<description><![CDATA[ One of our primary goals at Causes is to make it easier for anyone to become an activist. Why then, are we building Facebook and MySpace applications?
Activism is an inherently social endeavor: the decision to begin donating or volunteering is one that historically has flowed through networks of friends. The practice of grassroots organizing [...]]]></description>
			<content:encoded><![CDATA[<p> One of our primary goals at Causes is to make it easier for anyone to become an activist. Why then, are we building Facebook and MySpace applications?</p>
<p>Activism is an inherently social endeavor: the decision to begin donating or volunteering is one that historically has flowed through networks of friends. The practice of grassroots organizing is predicated on the idea of getting to know one person and having that person reach out through their friends. In fact, for most people, their entire engagement with a political campaign or nonprofit is through their friends and family.</p>
<p>There are many examples of this. Think of the grandmother making her first political donation ever to the Obama campaign because her grandson’s excitement inspires her; or the group of recent college grads helping Habitat for Humanity build a house as a social outing and a way to keep hanging out; or the parents who start conserving energy and reading about global warming because their daughter brings home a CFL (compact fluorescent lamp) from school. All of these are examples of social relationships leading to increased engagement and activism or contributions.</p>
<p>These relationships are exactly what social networks like Facebook and MySpace are trying to capture. They’re not trying to replace real-life social networks, but rather provide a virtual overlay on top of them that can be used to extend, facilitate, and enrich those relationships. Their success may be arguable, but the goal is clear: they want to grease the wheels of social interaction.</p>
<p>This social networking information provides us a window into these age-old friend networks and allows us to bring activism to the online sphere in a way that has not been done before. Because the underlying social relationships are the core of individual engagement and activism, the better we can understand and facilitate them going forward, the more successful we will be in engaging people on a large scale.</p>
<p>With this in mind, the decision to build social networking applications becomes more intuitive. We’re trying to help people motivate and recruit their friends to causes they care about, so we need to be in the places where friends are interacting and expressing themselves. Online, those places are the social networking sites.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/activism-and-social-networks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Myth of Long Hours</title>
		<link>http://code.causes.com/blog/the-myth-of-long-hours/</link>
		<comments>http://code.causes.com/blog/the-myth-of-long-hours/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 19:00:54 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=10</guid>
		<description><![CDATA[When I was studying Physics at UCSD, a number of my friends and I were fond of saying that we were in Physics because we were too lazy to be engineers. We asserted that we were doing more difficult work (as documented by the struggles of engineering students who occasionally joined our classes), but in [...]]]></description>
			<content:encoded><![CDATA[<p>When I was studying Physics at UCSD, a number of my friends and I were fond of saying that we were in Physics because we were too lazy to be engineers. We asserted that we were doing more difficult work (as documented by the struggles of engineering students who occasionally joined our classes), but in contrast to the all-night project sessions of my engineering roommates, I would solve problems during the day and go out dancing all night.</p>
<p>Working in the business world though, whether it be at a startup or for a larger organization, the tradeoffs are less obvious. There is no longer a simple dichotomy between working “lazier but smarter” or “harder but easier”. Instead, there seems to be a choice between “lazier but smarter” and “harder and smarter”. There’s a common thought process that follows this observation: “If you can get X units of work done in 6, why not get 1.5X units done in 9 hours?”</p>
<p>The issue with that line of reasoning is that productivity does not scale linearly. It may be that some people accomplish more work by stretching their hours, but it also depends on factors like the type of work, amount of sleep, and individual characteristics. This goes all the way back to the original Factory Acts in the United Kingdom at the beginning of the 1800s, when hours were reduced and conditions improved to better both the lives of the workers and the quality of their output. The pace for our modern working life was set by the struggle of many labor unions and workers’ strikes, including Henry Ford’s implementation the 8-hour workday in 1914, citing increased productivity and higher quality. More recently, David Heinemeier Hansson has written about this subject as it pertains specifically to startups and the software industry.</p>
<p>All said, the most important factor to consider when gauging productivity is personal performance. For example, I find that some of the times I am most productive are after taking some time away from working, either on vacation or even just a weekend. Despite the stereotype, Monday mornings are often one of my most productive times. On the other hand, while spending 12-14 hours in one day on a hackathon can be exhilarating, the next day I can barely focus at all. Others on our team and around the industry have other working schedules, going all the way into the wee hours of the morning, but no single schedule works for everyone.</p>
<p>In the end, productivity is a very personal thing and instead of there being one best approach (“lazier but smarter” or “harder and smarter”), you need to get to know your own rhythms and work to optimize those times. For some, it will be hacking on a project far into the night; for me, it’s letting that problem stew overnight, thinking about it on my train ride, getting myself a nice cup of tea, and attacking it first thing in the morning.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/the-myth-of-long-hours/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objects to Ruby code (rrepr)</title>
		<link>http://code.causes.com/blog/objects-to-ruby-code-rrepr/</link>
		<comments>http://code.causes.com/blog/objects-to-ruby-code-rrepr/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 19:00:58 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=11</guid>
		<description><![CDATA[Python has a useful function called repr, which takes an object and returns a string with valid Python code for reproducing that object.
Example:

>>> a = [1, 2, 3]
>>> repr(a)
'[1, 2, 3]'

Ruby, however, has no such function built in. After running into a couple of problems where we wished we could use repr (more on those [...]]]></description>
			<content:encoded><![CDATA[<p>Python has a useful function called <code>repr</code>, which takes an object and returns a string with valid Python code for reproducing that object.</p>
<p>Example:</p>
<pre class="sh_python">
>>> a = [1, 2, 3]
>>> repr(a)
'[1, 2, 3]'
</pre>
<p>Ruby, however, has no such function built in. After running into a couple of problems where we wished we could use <code>repr</code> (more on those later), we decided to roll our own.</p>
<p>We chose the name <code>rrepr</code> (Ruby repr) and started defining it as an instance method on classes of interest. In some cases this is very simple.</p>
<pre>
class String
  def rrepr; inspect end
end
</pre>
<p>In others it’s a little more complex.</p>
<pre>
class Hash
  def rrepr
    '{' + map{|k,v| k.rrepr + '=>' + v.rrepr}.join(', ') + '}'
  end
end
</pre>
<p>In the end though, all of the basic classes end up being pretty easy to define. What about more complex classes?</p>
<p>The general problem is very hard; Python’s <code>repr</code> only really works for basic types like strings and arrays. However, it turns out that in Rails, an extremely large percentage of the objects we care about are <code>ActiveRecord</code> objects, and for those the find method makes it dirt simple:</p>
<pre>
class ActiveRecord::Base
  def rrepr; "#{self.class.rrepr}.find(#{id.rrepr})" end
end
</pre>
<p>Its surprising how often this comes in handy. Stay tuned for some examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/objects-to-ruby-code-rrepr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improved printf debugging on Rails</title>
		<link>http://code.causes.com/blog/improved-printf-debugging-on-rails/</link>
		<comments>http://code.causes.com/blog/improved-printf-debugging-on-rails/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 19:00:08 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.causes.com/?p=12</guid>
		<description><![CDATA[Despite the power of formal debuggers, with their ability to peer into the depths of what is going on in your code, many of us still debug with what is sometimes called the “printf debugger”.
With the name coming from C, this practice of sprinkling printf (or moral equivalent) statements throughout your code can be used [...]]]></description>
			<content:encoded><![CDATA[<p>Despite the power of formal debuggers, with their ability to peer into the depths of what is going on in your code, many of us still debug with what is sometimes called the “printf debugger”.</p>
<p>With the name coming from C, this practice of sprinkling <code>printf</code> (or moral equivalent) statements throughout your code can be used to form a picture of what’s going on behind the scenes. While this approach doesn’t have the flexibility or panache of using a formal debugger, it’s intuitive, fast, and in most cases good enough.</p>
<p>When I first started coding for Rails, I translated my printf debugging into <code>puts</code> debugging with little difficulty. Unfortunately, this often left me digging through hundreds of lines of server logs, most of which were not useful for the problem I was trying to solve. Luckily, Jimmy had also encountered this problem and while pair programming one day I saw his simple and elegant solution. Throughout his code he had <code>putd</code> statements, which instead of writing to stdout and getting lost in the server logs, wrote debug statements to a separate file.</p>
<p>Now instead of digging through server logs when I’m debugging, I just have a console open running <code>tail -f tmp/debug.log</code> showing me exactly what I want to see. This simple insight often speeds up my debugging by a factor of five or ten. The implementation cost of this timesaver? 9 lines of code:</p>
<pre>
if ['development', 'test'].include?(ENV['RAILS_ENV'])
  DEVELOPMENT_DEBUG_LOG_FILE_NAME = "#{RAILS_ROOT}/tmp/debug.log"
  DEVELOPMENT_DEBUG_LOGGER = Logger.new(DEVELOPMENT_DEBUG_LOG_FILE_NAME)

  def putd(*args)
    DEVELOPMENT_DEBUG_LOGGER.info(*args)
  end
else
  def putd(*args); end
end
</pre>
<p>It still amazes me how much this tiny function has improved my productivity. It makes me wonder how many other small workflow modifications with disproportionate returns there are out there to discover. Any readers with special tools or tricks of their own? What do you use?</p>
]]></content:encoded>
			<wfw:commentRss>http://code.causes.com/blog/improved-printf-debugging-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
