<?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>HARVEST Time Tracking and Invoicing Blog &#187; Code</title>
	<atom:link href="http://www.getharvest.com/blog/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.getharvest.com/blog</link>
	<description>Time is money.  Track it wisely.</description>
	<lastBuildDate>Thu, 09 Sep 2010 15:52:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How To Generate Excel Files with Ruby</title>
		<link>http://www.getharvest.com/blog/2010/08/how-to-generate-excel-files-with-ruby/</link>
		<comments>http://www.getharvest.com/blog/2010/08/how-to-generate-excel-files-with-ruby/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 18:06:42 +0000</pubDate>
		<dc:creator>Dee Zsombor</dc:creator>
				<category><![CDATA[Behind-the-Scenes]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=3422</guid>
		<description><![CDATA[While Harvest provides powerful reports sometimes nothing beats having all of your data in a spreadsheet.  Unfortunately, the defacto spreadsheet tool (Excel) has some tricky file formats, making programatic export more difficult than it should be. We recently made improvements to how we handle Excel exports in Harvest, and I&#8217;d like to share a few [...]]]></description>
			<content:encoded><![CDATA[<p>While Harvest provides powerful reports sometimes nothing beats having all of your data in a spreadsheet.  Unfortunately, the defacto spreadsheet tool (Excel) has some tricky file formats, making programatic export more difficult than it should be. We recently made improvements to how we handle Excel exports in <a href="http://www.getharvest.com">Harvest</a>, and I&#8217;d like to share a few options for exporting spreadsheets with Ruby.</p>
<p><span id="more-3422"></span></p>
<p>Perhaps the simplest way is to export Comma Separated Value (CSV) and let the Excel process these. Generating CSV files is generally fast, the format is well known but not trouble free. If you only export simple ASCII characters, Excel will work fine, but drop one non-English character in and Excel gets confused. Excel cannot select the encoding, so if you want to export UNICODE data (such as when you&#8217;re working in non-English languages) using CSV files with Excel won&#8217;t do. Sure all other spreadsheet programs can import UTF8 encoded CSV files, some of these programs are free (<a href="http://www.openoffice.org/">OpenOffice</a>) so if you have the option of ignoring Excel CSV will do.</p>
<p>Next is using TSV files (Tab Separated Values), these solve the UNICODE problem but the user must remember to explicitly convert to native Excel format and this is not what they usually do with spreadsheets. Clearly, we must produce native Excel files, and this means either XLS (format used up till Office 2003 included) or the new XLSX documents based on the controversial OpenXML. The older format is undocumented but many hours of reverse engineering has been spent on it and there are quite a few libraries out there. For Ruby the most notable is <a href="http://rubyforge.org/projects/spreadsheet">Spreadsheet</a>.</p>
<p>XLS &amp; Spreadsheet has some drawbacks. First it has a column limit of 256 and 64K on the number of rows. Generally you will break down a lot sooner when exporting large number of rows as Spreadsheet is very slow to construct the global string table. See all strings in an XLS file are stored in a global string table then the row data merely refers to string by the index in the table. A nice optimization trick that makes opening XLS files significantly faster, but it also makes writes slow. Constructing the string table takes time and with the particular implementation Spreadsheet consumes a lot of memory as it keeps the entire document in memory all rows included, then upon save it constructs a Hash of all strings in the document. In short <a href="http://rubyforge.org/projects/spreadsheet">Spreadsheet</a> is a great library for parsing and constucting decorated documents but breaks down above 20k rows.</p>
<p>We have implemented an <a href="http://github.com/harvesthq/simple_xlsx_writer">XLSX generator</a> to get Excel exports in Harvest. Unlike XLS the format is documented, albeit the thousands of pages of documentation provides only marginal help. However, it does support another string storage model, where all values are stored inline. This makes file generation faster while&#8217;st opening such documents for the first time will be somewhat slower. The resulting export will be about the same size since XLSX is basically a zip file of other xml documents. To use, first you need to install the gem:</p>
<pre><code>  $gem install simple_xlsx_writer</code></pre>
<p>Creating OpenXML files is fairly straight forward:</p>
<pre>  <code>require 'rubygems'
  require 'simple_xlsx'

  SimpleXlsx::Serializer.new("test.xlsx") do |doc|
    doc.add_sheet("People") do |sheet|
      sheet.add_row(%w{DoB Name Occupation})
      sheet.add_row([Date.parse("July 31, 1912"),
                     "Milton Friedman",
                     "Economist / Statistician"])
    end
  end</code></pre>
<p>The gem will recognize a few basic ruby data types and generate cells of the right type. There is no other support for formating the document as in different colors, font styles etc just raw output compatible with the following programs:</p>
<ul>
<li>Open Office 3.2 (Linux, Mac, Windows)</li>
<li>Neo Office 3.2 (Mac)</li>
<li>Microsoft Office 2007 (Windows)</li>
<li>Microsoft Office 2010 (Windows)</li>
<li>Microsoft Office 2008 for Mac (versions 12.2.5 or above)</li>
<li>Microsoft Excel Viewer (Windows)</li>
</ul>
<p>One notable exception from this list is Numbers from iWork &#8216;09 as it does not yet support documents in the inline string storage model. Apple may fix this eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2010/08/how-to-generate-excel-files-with-ruby/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Harvested, a New Ruby API wrapper</title>
		<link>http://www.getharvest.com/blog/2010/04/harvested-a-new-ruby-api-wrapper/</link>
		<comments>http://www.getharvest.com/blog/2010/04/harvested-a-new-ruby-api-wrapper/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 14:00:55 +0000</pubDate>
		<dc:creator>Karen Schoellkopf</dc:creator>
				<category><![CDATA[Add-ons]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=2864</guid>
		<description><![CDATA[For you developers out there, Harvest   user Zach Moazeni has released a Harvested,   which is a new Ruby API wrapper.
We&#8217;re delighted to see the  creative and imaginative ways our  customers are making Harvest work for  them, please let us know if you  have created a Harvest integration [...]]]></description>
			<content:encoded><![CDATA[<p>For you developers out there, Harvest   user <a href="http://simplechatter.com/">Zach Moazeni</a> has released a <a href="http://simplechatter.com/2010/04/harvested-a-new-ruby-api-wrapper/">Harvested</a>,   which is a new Ruby API wrapper.</p>
<p>We&#8217;re delighted to see the  creative and imaginative ways our  customers are making Harvest work for  them, please let us know if you  have created a Harvest integration  you&#8217;d like to share!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2010/04/harvested-a-new-ruby-api-wrapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Harvest Supports Ruby Summer of Code</title>
		<link>http://www.getharvest.com/blog/2010/04/harvest-supports-ruby-summer-of-code/</link>
		<comments>http://www.getharvest.com/blog/2010/04/harvest-supports-ruby-summer-of-code/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 19:55:02 +0000</pubDate>
		<dc:creator>Barry Hess</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Fun Stuff]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=2887</guid>
		<description><![CDATA[
Harvest was built from the ground up with Ruby on Rails, a powerful framework for building web apps. Rails has been part of daily activity here since back when we worked on client projects right alongside of Harvest. As an OSS project, Rails needs contributions of all sorts to continue evolving. The latest program to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2902" title="Ruby Summer Of Code" src="http://www.getharvest.com/blog/wp-content/uploads/2010/04/Ruby-Summer-Of-Code.jpg" alt="" width="500" height="78" /></p>
<p>Harvest was built from the ground up with <a href="http://rubyonrails.org/">Ruby on Rails</a>, a powerful framework for building web apps. Rails has been part of daily activity here since back when we worked on client projects right alongside of Harvest. As an <a href="http://en.wikipedia.org/wiki/Open-source_software">OSS</a> project, Rails needs contributions of all sorts to continue evolving. The latest program to help push Rails forward is <a href="http://rubysoc.org/">Ruby Summer of Code</a>.</p>
<p>The Ruby Summer of Code program is designed to help fund student development of Ruby and/or Rails projects in the summer of 2010. Accepted students will be matched up with accepted mentors and will have two months to complete their summer projects.  Harvest is proud to support this inspired endeavor, and the future of Ruby development.</p>
<p>The student application window is from April 5th to April 23rd, so that means <a href="http://rubysoc.org/students">the deadline is just a week away</a>.  If you are (or know of a) student with an idea for a great Ruby project, get your application in now!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2010/04/harvest-supports-ruby-summer-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Co-op, Twitter, and Motivation with Cobot</title>
		<link>http://www.getharvest.com/blog/2010/03/co-op-twitter-and-motivation-with-cobot/</link>
		<comments>http://www.getharvest.com/blog/2010/03/co-op-twitter-and-motivation-with-cobot/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:00:30 +0000</pubDate>
		<dc:creator>Barry Hess</dc:creator>
				<category><![CDATA[Co-op]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=2681</guid>
		<description><![CDATA[We are pretty active on Twitter. It&#8217;s a great way to get quick messages out as we release new features. We love to hear what you have to say about Harvest, good or bad.
It would not be particularly efficient for everyone on the team to watch the flow of tweets about Harvest. So, for those [...]]]></description>
			<content:encoded><![CDATA[<p>We are pretty active on <a href="http://twitter.com/harvest/favorites">Twitter</a>. It&#8217;s a great way to get quick messages out as we release new features. We love to hear what you have to say about Harvest, good or bad.</p>
<p>It would not be particularly efficient for everyone on the team to watch the flow of tweets about Harvest. So, for those of us who have the task of watching Twitter, we like to favorite interesting tweets about Harvest, and we also like to share them with the rest of the team. This is a perfect task for automation by <a href="http://www.getharvest.com/blog/2010/02/introducing-cobot-system-messaging-for-co-op/">Cobot</a>, your friendly Co-op robot.</p>
<p>We created a Ruby script that runs every 30 minutes looking for the latest favorited tweets on our Harvest Twitter account. It also looks at the Harvest stream to pull in anything we&#8217;ve said on Twitter. These tweets get inserted into our Co-op stream and provide a nice bit of motivation from our wonderful customers.</p>
<p>If you are curious to see the script, it can be found on <a href="http://gist.github.com/322815">GitHub</a>. And here it is in action:</p>
<p><a href="http://www.getharvest.com/blog/wp-content/uploads/2010/03/cobot_twitter.jpg"><img class="alignnone size-full wp-image-2680" title="Co-op and Twitter, friends at last" src="http://www.getharvest.com/blog/wp-content/uploads/2010/03/cobot_twitter.jpg" alt="Co-op with Twitter inline" width="498" height="253" /></a></p>
<p>Enjoy using Cobot to enhance your Co-op workstreams, we’re excited to know if you find this feature useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2010/03/co-op-twitter-and-motivation-with-cobot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Cobot: System Messaging for Co-op</title>
		<link>http://www.getharvest.com/blog/2010/02/introducing-cobot-system-messaging-for-co-op/</link>
		<comments>http://www.getharvest.com/blog/2010/02/introducing-cobot-system-messaging-for-co-op/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:16:36 +0000</pubDate>
		<dc:creator>Barry Hess</dc:creator>
				<category><![CDATA[Co-op]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Product Announcements]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=2554</guid>
		<description><![CDATA[The Harvest Team communicates with Co-op all day, every day. It is the visual heartbeat of our team, as we share failures, successes and silliness from our work days and our lives. While this heartbeat is strong, it also has an obvious arrhythmia: no system status messages.
For the past couple weeks we have been refining [...]]]></description>
			<content:encoded><![CDATA[<p>The Harvest Team communicates with <a href="http://coopapp.com">Co-op</a> all day, every day. It is the visual heartbeat of our team, as we share failures, successes and silliness from our work days and our lives. While this heartbeat is strong, it also has an obvious arrhythmia: no system status messages.</p>
<p>For the past couple weeks we have been refining an API technique to programmatically add system status, and anything else, to a Co-op workstream. We are pleased with the results, and would like to introduce you to Cobot:</p>
<p><a href="http://www.getharvest.com/blog/wp-content/uploads/2010/02/cobot.jpg"><img class="alignnone size-full wp-image-2555" title="Cobot" src="http://www.getharvest.com/blog/wp-content/uploads/2010/02/cobot.jpg" alt="Cobot - The Harvest Co-op Robot" width="498" height="45" /></a></p>
<p>Cobot posts may be created via the <a href="http://coopapp.com/api/statuses">Co-op API</a>.</p>
<p>Along for the ride are a couple of new formatting features now enabled for Co-op statuses. First, statuses now accept <code>&lt;br /&gt;</code> tags to force new lines, which is essential for posting things like deployment of multiple code commits.</p>
<p>Co-op also now supports code pastes. If you paste anything in your Co-op message box with two or more new lines, the code paste view will take effect:</p>
<p><a href="http://www.getharvest.com/blog/wp-content/uploads/2010/02/fry_wtfjs.jpg"><img class="alignnone size-full wp-image-2557" title="Fry WTFjs" src="http://www.getharvest.com/blog/wp-content/uploads/2010/02/fry_wtfjs.jpg" alt="Philip J. Fry WTFjs" width="498" height="109" /></a></p>
<p>Feel free to share what kinds of system messages you will be looking to bring into your Co-op workstreams, we&#8217;re excited to know if you find this feature useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2010/02/introducing-cobot-system-messaging-for-co-op/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Server Management Made Simpler</title>
		<link>http://www.getharvest.com/blog/2010/01/how-do-you-manage-lots-of-servers-easily/</link>
		<comments>http://www.getharvest.com/blog/2010/01/how-do-you-manage-lots-of-servers-easily/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 17:43:27 +0000</pubDate>
		<dc:creator>Warwick Poole</dc:creator>
				<category><![CDATA[Behind-the-Scenes]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=2251</guid>
		<description><![CDATA[Many people assume that under the hood there are mystical unicorns and magical elves powering Harvest, but the reality is that we simply use regular servers in a datacenter to bring our applications to you. No elves involved. Anyone who has ever had to look after more than a few servers knows that getting all [...]]]></description>
			<content:encoded><![CDATA[<p>Many people assume that under the hood there are mystical unicorns and magical elves powering <a href="http://www.getharvest.com">Harvest</a>, but the reality is that we simply use regular servers in a datacenter to bring our applications to you. No elves involved. Anyone who has ever had to look after more than a few servers knows that getting all the servers into line is a bit like herding cats, and can be time consuming. It&#8217;s always important to know exactly what state your server configurations are in, and usually very important to know that all servers are in the same configuration state at all times.</p>
<p>It&#8217;s no secret that many of the fine folks who work on Harvest are <a href="http://www.ruby-lang.org/">Ruby </a>experts (and thus quite easy on the eye). So when looking around at tools we could use to make our servers simpler to manage, we decided to try <a href="http://www.opscode.com/chef/">Chef</a>. If you are not familiar with Chef, it comes from the folks at <a href="http://www.opscode.com/">Opscode</a> and is a powerful tool to manage server configurations, and perform common system administration tasks on a set of servers. Chef is written in Ruby and allows you to accomplish a fair amount of your system administration tasks by writing Ruby <a href="http://wiki.opscode.com/display/chef/Recipes">recipes</a> to execute on remote servers. Chef makes system administration a bit more like application programming, in a sense.</p>
<p>While we work on getting Chef into daily use, and indeed while we improve our systems platform in general, we plan to share some of our experiences with Harvest users and readers of this blog. You can read up on some of the details of <a href="http://warwickp.com/2009/12/configuration-management-with-chef-on-debian-part-1/">how we got Chef up and running quickly</a>, a little look at <a href="http://warwickp.com/2010/01/configuration-management-with-chef-on-debian-part-2/">how a Chef cookbook, recipe and role work together</a> and we plan to bring you some more details in future posts. We&#8217;d love to hear from any Harvest users who are using Chef, or doing interesting systems or server management work (and invoicing clients via Harvest, naturally). What systems projects have you been working on?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2010/01/how-do-you-manage-lots-of-servers-easily/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Fix Dropdown Problems on Internet Explorer</title>
		<link>http://www.getharvest.com/blog/2009/12/dropdown-problems-on-internet-explorer/</link>
		<comments>http://www.getharvest.com/blog/2009/12/dropdown-problems-on-internet-explorer/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 06:58:35 +0000</pubDate>
		<dc:creator>Doug Fales</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=2101</guid>
		<description><![CDATA[Lately we found ourselves caught in some nasty dropdown problems. Some of our customers who use Internet Explorer were unable to to read their full project and task names on the new timesheet. Apparently it&#8217;s a browser bug specific to Microsoft&#8217;s Internet Explorer. All you need to do is Google &#8220;IE select box problem&#8221; and you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Lately we found ourselves caught in some nasty dropdown problems. Some of our customers who use Internet Explorer were unable to to read their full project and task names on the new timesheet. Apparently it&#8217;s a browser bug specific to Microsoft&#8217;s Internet Explorer. All you need to do is Google &#8220;IE select box problem&#8221; and you&#8217;ll see the legions of disgruntled developers this control has left in its wake.  What follows is a recounting of our experience and our solution.</p>
<p><strong>The Problem</strong></p>
<p>Before the timesheet redesign, we did not specify a width on the Project and Task dropdowns.  For some users with really long project/task names, this meant their select boxes would extend past the right edge of their browser window.</p>
<p>The logical fix is to constrain the width of these select boxes. Well-behaved browsers have no problem with this approach. Internet Explorer, however, interprets a width on the select tag very literally.  The select box and all of the options are limited to the specified width, regardless of whether this truncates 90% of the option text.  For our users with long project/task names, this made the dropdown practically useless.</p>
<p><img class="size-full wp-image-2161" src="http://www.getharvest.com/blog/wp-content/uploads/2009/12/ie_select.gif" alt="ie_select" width="500" height="270" /></p>
<p><strong>The Solution</strong></p>
<p>As with many of IE&#8217;s problems,  there are several workarounds out there, and unfortunately none of them are perfect.  We looked at three common approaches for solving this problem before we settled on the one we&#8217;re using now.</p>
<ol>
<li><a title="Mouseover Fix" href="http://www.hedgerwow.com/360/dhtml/ui_select_with_fixed_width/demo.php">Dynamically re-size the dropdown on mouseover</a>.  The main problem with this approach is that (like anything triggered on mouse-over) the user experience can be very disruptive and seem &#8220;jumpy&#8221;.</li>
<li>Custom select box, made from unordered lists and complex event handling.  Scott Darby&#8217;s <a href="http://www.scottdarby.com/plugins/stylish-select/0.3/">stylish-select plugin for jQuery</a> is a great example of this.  We gave this one a shot, but the custom select box does not retain browser&#8217;s default behavior with select, such as tabbing and using key stroke to jump to a certain selection.</li>
<li>What ended up saving the day was <a title="Doug Boude's Select Box Fix" href="http://www.dougboude.com/blog/1/2008/05/Viewing-Option-Text-in-IE7-thats-Wider-than-the-Select-List.cfm">this idea from Doug Boude</a>.  It is surprisingly simple: re-size the select box on click, and set <code>overflow: hidden</code> on a containing div.  The hidden overflow will prevent the select from interfering with other controls to the right, while still allowing the full options to be displayed below.</li>
</ol>
<p>Doug&#8217;s original solution required you to know the full width of your select box. Ours would need to compute this dynamically, so we wrote a simple Prototype.js class to encapsulate the event handling and to calculate the width of the select box.  You can <a title="Wide Select Box for IE7/8" href="http://www.getharvest.com/blog/wp-content/uploads/2009/12/select_box_demo.html">check out a demo of the solution with code </a>and some notes on how to use it for your problematic select boxes.  Disclaimer: this solution works best in IE7 and IE8.  We do not recommend using it in IE6.</p>
<p>Hope you find this useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2009/12/dropdown-problems-on-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FutureRuby: A Programming Conference with Breadth</title>
		<link>http://www.getharvest.com/blog/2009/07/futureruby-a-programming-conference-with-breadth/</link>
		<comments>http://www.getharvest.com/blog/2009/07/futureruby-a-programming-conference-with-breadth/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 19:26:19 +0000</pubDate>
		<dc:creator>Barry Hess</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=966</guid>
		<description><![CDATA[Just over a week ago I attended FutureRuby in Toronto, Ontario, Canada. From the single track of talks to the significant-other program to the unique post-conference parties, I have never participated in a better conference. I was especially pleased that four talks were being presented by Harvest customers.
The breadth of discussion at FutureRuby was incredible. [...]]]></description>
			<content:encoded><![CDATA[<p>Just over a week ago I attended <a href="http://futureruby.com/">FutureRuby</a> in Toronto, Ontario, Canada. From the single track of talks to the <a href="http://futureruby.com/comrade-program/">significant-other program</a> to the unique post-conference parties, I have never participated in a better conference. I was especially pleased that four talks were being presented by Harvest customers.</p>
<p>The breadth of discussion at FutureRuby was incredible. If you are able to find a similarly <a href="http://futureruby.com/panels/">diverse field of talks</a> in a conference remotely near your area of expertise, I highly recommend it. You will be surprised to find how easily you can relate disparate topics to your career.</p>
<p>A quick rundown of presentations by Harvest customers after the jump.</p>
<p><span id="more-966"></span></p>
<p>FutureRuby was kicked off with a slide-free presentation by Nathaniel Talbott, of <a href="http://terralien.com/">Terralien</a>. Talbott waxed  philosophical and political in his call to <a href="http://blog.talbott.ws/articles/2009/7/15/owning-the-means-of-production">owning the means of production</a>. Nathaniel&#8217;s talk is an interesting read for any entrepreneurs out there.</p>
<p><a href="http://nitobi.com">Nitobi</a> was well represented by Brian LeRoux, Rob Ellis, and Brock Whitten. Their talk was on building device-neutral mobile applications using <a href="http://phonegap.com/">PhoneGap</a>, a project in which Nitobi is heavily involved. PhoneGap is an extremely exciting project that should lead to more apps being built across the mobile space.</p>
<p>Dr Nic Williams made a 30-hour trek from Australia to present on the second day of FutureRuby. His talk about <a href="http://drnicwilliams.com/2009/07/13/futureruby-talk-living-with-1000-open-source-projects/">managing OSS overload</a> was full of humor and utility. Dr Nic represents <a href="http://mocra.com/">Mocra</a>. It is plain to see Mocra will continue to be a force in the Rails and iPhone development worlds.</p>
<p>FutureRuby is the first conference I&#8217;ve attended that has steamrolled to the finish line, with the final five talks getting progressively better. Jonathan Dahl rocked his talk about programming and minimalism. Dahl provided a quick lesson on the changing form of literature and music throughout history. That he was able to relate literature and music to useful tips on programming made his talk really sing. Dahl runs Phronos, which has <a href="http://www.phronos.com/#projects">several intriguing projects</a> to its name.</p>
<p>I met many other Harvest customers at FutureRuby. It was great to meet you all! <a href="http://www.infoq.com/">InfoQ</a> recorded the FutureRuby talks. Look for them online over the next few months.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2009/07/futureruby-a-programming-conference-with-breadth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Denial of Service patch breaks BigDecimal to_f method</title>
		<link>http://www.getharvest.com/blog/2009/06/ruby-denial-of-service-patch-breaks-bigdecimal-to_f-method/</link>
		<comments>http://www.getharvest.com/blog/2009/06/ruby-denial-of-service-patch-breaks-bigdecimal-to_f-method/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 19:36:56 +0000</pubDate>
		<dc:creator>Barry Hess</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=845</guid>
		<description><![CDATA[Harvest is built on the Ruby on Rails web framework, as such we constantly monitor for security issues with the framework and the language itself. A Ruby Denial of Service (DoS) vulnerability was announced almost 24 hours ago. The security of Harvest accounts is our top priority. All Harvest services were upgraded quickly to close [...]]]></description>
			<content:encoded><![CDATA[<p>Harvest is built on the <a href="http://rubyonrails.org/">Ruby on Rails</a> web framework, as such we constantly monitor for security issues with the framework and the language itself. A Ruby Denial of Service (DoS) vulnerability was <a href="http://www.ruby-lang.org/en/news/2009/06/09/dos-vulnerability-in-bigdecimal/">announced almost 24 hours ago</a>. The security of Harvest accounts is our top priority. All Harvest services were upgraded quickly to close this security hole.</p>
<p>Dee Zsombor, one of the Harvest&#8217;s prime hackers, uncovered further issues with the fixed Ruby version 1.8.7, which is patch level 173. This upgrade includes a flawed <code>BigDecimal#to_f</code> coercion method:</p>
<pre>
BigDecimal("10.03").to_f
=> 10.3
</pre>
<p>We are fairly confident Harvest users are not interested in this bizzaro-world version of rounding.</p>
<p>If you are running a Rails application and you have applied the Ruby 1.8.7 DoS patch, we&#8217;ve got the fix for you. Place the following hack in your <code>environment.rb</code> file (or an initializer if you prefer):</p>
<pre>
if BigDecimal("10.03").to_f != 10.03
 class BigDecimal
   def to_f
     self.to_s.to_f
   end
 end
end
</pre>
<p>If your interpreter is broken like ours was, this will cure what ails it. Big thanks to Dee for writing up this fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2009/06/ruby-denial-of-service-patch-breaks-bigdecimal-to_f-method/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Be Defensive When Developing Against the Twitter API</title>
		<link>http://www.getharvest.com/blog/2009/03/be-defensive-when-developing-against-the-twitter-api/</link>
		<comments>http://www.getharvest.com/blog/2009/03/be-defensive-when-developing-against-the-twitter-api/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 19:22:27 +0000</pubDate>
		<dc:creator>Barry Hess</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Product Announcements]]></category>

		<guid isPermaLink="false">http://www.getharvest.com/blog/?p=370</guid>
		<description><![CDATA[Our humble apologies for yesterday&#8217;s hiccup, which saw thousands of Twitter expense and time entries duplicated in Harvest accounts which were linked to Twitter. We most regret the thousands of emails we delivered to your inboxes. The good news is that all duplicate entries have been rolled back and things are back in order.
Our code [...]]]></description>
			<content:encoded><![CDATA[<p>Our humble apologies for yesterday&#8217;s hiccup, which saw thousands of Twitter expense and time entries duplicated in Harvest accounts which were linked to Twitter. We most regret the thousands of emails we delivered to your inboxes. The good news is that all duplicate entries have been rolled back and things are back in order.</p>
<p>Our code depended on Twitter&#8217;s API to filter out direct messages that had already been processed by Harvest. As of yesterday afternoon, we no longer depend on Twitter&#8217;s filtering options. Going forward, this type of failure in Twitter&#8217;s API will not impact Harvest users.</p>
<p>For those who are technical and curious, we&#8217;ve decided to get into the details a bit and let you know how it happened, and how we&#8217;re preventing it from happening in the future.</p>
<p><span id="more-370"></span></p>
<p>We allow <a title="Harvest Twitter integration" href="http://www.getharvest.com/labs/twitter">communication between Harvest and Twitter</a> via direct messages to the <a title="Harvest on Twitter" href="http://twitter.com/harvest">Harvest Twitter account</a>.</p>
<p>Every few minutes, a job retrieves the latest direct messages from Twitter and processes all new ones. Each direct message has an ID associated with it. These ID&#8217;s always grow larger over time, so newer direct messages will always have an increasingly higher ID. We keep track of the greatest ID we have retrieved upon every execution.</p>
<p>The <a title="Twitter API - get direct messages" href="http://apiwiki.twitter.com/REST+API+Documentation#DirectMessageMethods">Twitter direct message call</a> allows us to pass in a &#8220;since ID,&#8221; which basically says &#8220;give us all direct messages greater than the ID we provide&#8221;. We pass along the ID we have stored in our database. Twitter than responds with only the latest and greatest direct messages for processing; messages we have never processed before.</p>
<p>Further, Twitter will only return 20 direct messages at a time. To get the next 20, you must pass a page parameter to the Twitter call. We &#8220;smartly&#8221; planned for the eventuality that we would be getting &gt; 20 direct messages every few minutes. Basically we looped, making a series of calls to the next page and the next page until the number of direct messages returned from Twitter was &lt; 20. Once we received &lt; 20 direct messages, we knew we had reached the finish line and we were out of pages to retrieve.</p>
<p>Yesterday, around 1 PM EDT, the &#8220;since ID&#8221; filtering offered by Twitter quit working. So instead of receiving 1 or 2 direct messages from our call to Twitter, we received 20. The looping kicked in, going back in time to get 20 more and 20 more. We were only limited by Twitter&#8217;s API throttle as to how far back our job would look for direct messages. With each direct message processed came a new entry in Harvest and a confirmation email.</p>
<p>Every few minutes this would happen again.</p>
<p>We rewrote our job to no longer bother with the since ID. All the looping is still in there, but now we break the loop once the gathered direct messages include the since ID. Then, we filter out all direct messages whose ID is &lt;= to the most recent ID that we had processed. Basically, we&#8217;re recreating the since ID logic on our side.</p>
<p>The takeaway is to err on the side of defensive programming when coding against an API. <a href="http://en.wikipedia.org/wiki/Trust,_but_Verify">Trust, but verify</a>. While it is not possible to pick up the slack in every situation, if there is something you can accomplish simply on your side of the interaction, it&#8217;s probably best to trade a more coding for a simpler, less brittle call to the API you are working with.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getharvest.com/blog/2009/03/be-defensive-when-developing-against-the-twitter-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
