<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <title>benlog.org - Blog</title>
  <id>tag:www.benlog.org,2008:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  
  <link href="http://www.benlog.org/" rel="alternate" type="text/html" />
  <updated>2008-06-29T19:46:50Z</updated>
  <link rel="self" href="http://feeds.feedburner.com/benlog_org" type="application/atom+xml" /><entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-06-29:1195</id>
    <published>2008-06-29T16:30:00Z</published>
    <updated>2008-06-29T19:46:50Z</updated>
    <category term="code" />
    <category term="merb" />
    <category term="ruby" />
    <link href="http://www.benlog.org/2008/6/29/bare-bones-date-picker-for-merb" rel="alternate" type="text/html" />
    <title>Bare bones date picker for Merb</title>
<content type="html">
            &lt;p&gt;I’ve been fooling around with &lt;a href="http://www.merbivore.com"&gt;Merb&lt;/a&gt; these past few months. Can’t say I’ve created anything of consequence, but along the way I’d written &lt;a href="http://snippets.dzone.com/posts/show/5709"&gt;this simple date picker&lt;/a&gt;, and thought I’d share it.&lt;/p&gt;


	&lt;p&gt;Used inside a form_for block, it creates 3 separate drop-downs for year, month, and day from a Time object.&lt;/p&gt;


	&lt;p&gt;Example:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;% form_for @person %&amp;gt;

  &amp;lt;%= date_control :birthdate, :label =&amp;gt; 'Birthdate %&amp;gt;

&amp;lt;% end %&amp;gt;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Note: This should be run against Merb 0.9.3.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=UonSMI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=UonSMI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=7UNTNI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=7UNTNI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=4fx55i"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=4fx55i" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/322667843" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F6%2F29%2Fbare-bones-date-picker-for-merb</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-05-26:1192</id>
    <published>2008-05-26T02:44:00Z</published>
    <updated>2008-05-27T03:09:02Z</updated>
    <category term="meshu" />
    <category term="oauth" />
    <category term="rack" />
    <category term="thin" />
    <link href="http://www.benlog.org/2008/5/26/quick-and-dirty-meshu-recap" rel="alternate" type="text/html" />
    <title>Quick and dirty meshU recap</title>
<content type="html">
            &lt;p&gt;&lt;img src="/assets/2008/3/30/meshu.gif" /&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.meshconference.com/meshu"&gt;meshU&lt;/a&gt;, the workshop-oriented sister conference of &lt;a href="http://www.meshconference.com"&gt;mesh&lt;/a&gt;, took place this past Tuesday in Toronto. It sold out a few days beforehand, but with only four presentation slots and an estimated ~200 attendees, it had the feeling of a very small and tight-knit conference, big names aside.&lt;/p&gt;


	&lt;h3&gt;Turning the tables&lt;/h3&gt;


	&lt;p&gt;Avi Bryant kicked off the development track with a talk on &lt;a href="http://meshconference.com/meshu/avi-bryant.php"&gt;relational database alternatives&lt;/a&gt;. Instead of getting too deep into the why, Avi focused on design considerations / best-practices when building an application on top of services like Amazon’s &lt;a href="http://www.amazon.com/SimpleDB-AWS-Service-Pricing/b?ie=UTF8&amp;amp;#38;node=342335011"&gt;&lt;span class="caps"&gt;SDB&lt;/span&gt;&lt;/a&gt;, Google’s &lt;a href="http://code.google.com/appengine/"&gt;AppEngine&lt;/a&gt;, and Microsoft’s forthcoming &lt;a href="http://www.microsoft.com/sql/dataservices/default.mspx"&gt;&lt;span class="caps"&gt;SSDS&lt;/span&gt;&lt;/a&gt; (now in beta). He finished off with a first look at &lt;a href="http://ruby.gemstone.com/"&gt;MagLev&lt;/a&gt;, a new Ruby VM (and Bryant / Gemstone joint), demonstrating two irb-like shells accessing the same global objects, complete with transactional support. Very curious stuff; more details on MagLev are to be revealed during Bryant’s &lt;a href="http://en.oreilly.com/rails2008/public/schedule/detail/4351"&gt;upcoming RailsConf talk&lt;/a&gt;.&lt;/p&gt;


	&lt;h3&gt;Managing great software teams&lt;/h3&gt;


	&lt;p&gt;Afterwards I snuck into Reg Braithewaite’s talk on &lt;a href="http://meshconference.com/meshu/reg-braithwaite.php"&gt;managing great software teams&lt;/a&gt;. I’ve been reading &lt;a href="http://weblog.raganwald.com/"&gt;Raganwald&lt;/a&gt; for the better part of two years, and I’ve generally enjoyed reading his management-type articles, so I was looking forward to hearing him speak in person – even with Daniel Burka of Digg/Pownce fame presenting next door. Unsurprisingly, Reg is as a good a speaker as he is a blogger, and it felt like management and developer-types alike enjoyed his assortment of management anti-patterns, golden rules, and hindsights. You can catch his slides &lt;a href="http://www.flickr.com/photos/raganwald/sets/72157605160498264/show/"&gt;here&lt;/a&gt;, but despite being aesthetically pleasing, they’re hard to appreciate on their own.&lt;/p&gt;


	&lt;h3&gt;Implementing OAuth&lt;/h3&gt;


	&lt;p&gt;After lunch, my co-worker Taavi and I took in &lt;a href="http://leahculver.com/"&gt;Leah Culver’s&lt;/a&gt; talk on &lt;a href="http://oauth.net/"&gt;OAuth&lt;/a&gt;, an open &lt;span class="caps"&gt;API&lt;/span&gt; authentication protocol. Her presentation was both introductory and yet very-technical, with fairly complex slides depicting a number of authentication interactions, complete with source code examples. With a dizzying number of token names and types, OAuth was perhaps the most complicated subject of the day, but Leah had a helpful hand; Flickr’s Cal Henderson, author and celebrity audience member, answered questions throughout (OAuth is largely based on the &lt;a href="http://www.flickr.com/services/api/auth.spec.html"&gt;Flickr authentication model&lt;/a&gt;).&lt;/p&gt;


	&lt;h3&gt;Thin and Rack&lt;/h3&gt;


	&lt;p&gt;Last, but not least, &lt;a href="http://macournoyer.wordpress.com/"&gt;Marc-Andre Cournoyer&lt;/a&gt; gave a development talk on &lt;a href="http://code.macournoyer.com/thin/"&gt;Thin&lt;/a&gt;, a speedy event-driven web server for &lt;a href="http://rack.rubyforge.org/"&gt;Ruby&lt;/a&gt;, and Rack, a web server interface and library. Marc-Andre coded up a couple of Rack/Thin examples while he presented, and I’m not sure what impressed me more: Thin, Rack, or Marc-Andre’s expert command of TextMate. It was a great presentation (with a hilarious introduction), so it’s a shame it was scheduled opposite Ryan Carson and John Resig, as the audience was minimal. Oh well;  this subject would be better suited for a [Ruby|Rails]Conf, anyways.&lt;/p&gt;


	&lt;p&gt;So that wraps things up. From all the feedback I’ve heard, &lt;a href="http://www.meshconference.com/meshu"&gt;meshU&lt;/a&gt; was a pretty big success, and all indications point to a repeat event next year. Thanks again to all the volunteers, organizers and sponsors* for making it happen.&lt;/p&gt;


	&lt;p&gt;&lt;i&gt;Disclosure note&lt;/i&gt;: FreshBooks is a sponsor of both Mesh Conference and meshU.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=pjPwAH"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=pjPwAH" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=OGfMIH"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=OGfMIH" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=8RtFTh"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=8RtFTh" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/298086559" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F5%2F26%2Fquick-and-dirty-meshu-recap</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-05-19:1189</id>
    <published>2008-05-19T14:48:00Z</published>
    <updated>2008-05-19T14:50:22Z</updated>
    <category term="drupalcamp" />
    <category term="meshu" />
    <category term="twitter" />
    <link href="http://www.benlog.org/2008/5/19/catch-me-on-twitter" rel="alternate" type="text/html" />
    <title>Catch me on Twitter, and other updates</title>
<content type="html">
            &lt;p&gt;So much for &lt;a href="http://www.benlog.org/2008/1/2/looking-back-at-2007"&gt;that New Year’s resolution&lt;/a&gt;. Since I began micro-blogging via Twitter after &lt;span class="caps"&gt;SXSW&lt;/span&gt;, finding inspiration for a full-blown blog post has been tough. So, if you’re curious what I’m up to, I recommend &lt;a href="http://www.twitter.com/bentlegen"&gt;following me there&lt;/a&gt;. If you’re looking for non-stop brilliant observations, however, be warned: my tweets are reserved exclusively for sarcastic retorts and lunchbox content reporting.&lt;/p&gt;


	&lt;h3&gt;What’s going on this week&lt;/h3&gt;


	&lt;p&gt;Switching gears, it’s looking like an interesting week here in Toronto. &lt;a href="http://www.meshconference.com/meshu"&gt;meshU&lt;/a&gt; kicks off Tuesday morning, which I’ll be attending along with the entire &lt;a href="http://www.freshbooks.com"&gt;FreshBooks&lt;/a&gt; technical crew. Panel-wise, I’ll probably be sticking to the ‘development’ track, which begins with a talk by Avi Bryant on relational database alternatives. After mesh, &lt;a href="http://2008.drupalcamptoronto.org/"&gt;DrupalCamp2&lt;/a&gt; takes place Friday and Saturday, which FreshBooks is also sponsoring.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=RUOLdH"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=RUOLdH" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=CEfElH"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=CEfElH" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=sPYwFh"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=sPYwFh" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/293547928" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F5%2F19%2Fcatch-me-on-twitter</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-03-30:1185</id>
    <published>2008-03-30T17:26:00Z</published>
    <updated>2008-03-30T17:28:18Z</updated>
    <category term="mesh" />
    <category term="torcamp" />
    <link href="http://www.benlog.org/2008/3/30/meshu-featuring-avi-bryant-leah-culver" rel="alternate" type="text/html" />
    <title>meshU featuring Avi Bryant, Leah Culver</title>
<content type="html">
            &lt;p&gt;&lt;img src="http://www.benlog.org/assets/2008/3/30/meshu.gif" /&gt;&lt;/p&gt;


	&lt;p&gt;Just a heads up that two of my fellow &lt;span class="caps"&gt;SXSW&lt;/span&gt; panelists, &lt;a href="http://www.dabbledb.com"&gt;Avi Bryant&lt;/a&gt; and &lt;a href="http://www.pownce.com"&gt;Leah Culver&lt;/a&gt;, will be making their way to Toronto to speak at &lt;a href="http://www.meshconference.com"&gt;Mesh Conference’s&lt;/a&gt; new sister-event, &lt;a href="http://www.meshconference.com/meshu"&gt;meshU&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;meshU is a one-day event taking place May 20th, composed of a series of best-practice and how-to workshops intended for developers/designers. Other confirmed speakers include jQuery creator &lt;a href="http://www.ejohn.org"&gt;John Resig&lt;/a&gt;, and Carsonified’s &lt;a href="http://www.carsonified.com"&gt;Ryan Carson&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;From the &lt;a href="http://www.meshconference.com/meshu"&gt;meshU site&lt;/a&gt;:&lt;/p&gt;


&lt;blockquote&gt;meshU is a one-day event that will be filled with small, focused workshops by those who have earned their stripes in the startup game; people who can talk knowledgeably about everything from interface design to using Amazon’s S3 distributed server network.&lt;/blockquote&gt;

	&lt;p&gt;&lt;i&gt;Disclosure note&lt;/i&gt;: &lt;a href="http://www.freshbooks.com"&gt;FreshBooks&lt;/a&gt; is an “in-kind sponsor” of Mesh Conference, and my boss &lt;a href="http://www.michaelmcderment.com/"&gt;Mike McDerment&lt;/a&gt; is one of it’s co-founders. Oh, and he totally put me up to this.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=cIg6HI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=cIg6HI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=nZxtFI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=nZxtFI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=pxG18i"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=pxG18i" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/260813194" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F3%2F30%2Fmeshu-featuring-avi-bryant-leah-culver</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-03-14:1181</id>
    <published>2008-03-14T04:01:00Z</published>
    <updated>2008-03-14T04:22:09Z</updated>
    <category term="hindsight" />
    <category term="sxsw" />
    <link href="http://www.benlog.org/2008/3/14/four-things-learned-at-sxsw" rel="alternate" type="text/html" />
    <title>Four things I learned at SXSW (the hard way)</title>
<content type="html">
            &lt;p&gt;&lt;img src="http://www.benlog.org/assets/2008/3/14/sxsw-logo.png" /&gt;
So, &lt;span class="caps"&gt;SXSW&lt;/span&gt; Interactive is good and over. &lt;a href="http://2008.sxsw.com/interactive/programming/panels_schedule/?action=show&amp;amp;#38;id=IAP060350"&gt;The panel&lt;/a&gt; went well (or so they tell me), I met &lt;a href="http://www.facebook.com"&gt;some&lt;/a&gt; &lt;a href="http://www.pownce.com"&gt;nice&lt;/a&gt; &lt;a href="http://www.dabbledb.com"&gt;folk&lt;/a&gt;, and drank some &lt;a href="http://www.independencebrewing.com/beer/austinamber.html"&gt;darn good beer&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Unfortunately, things weren’t completely rosy. I made a couple of critical errors which slightly marred an otherwise brilliant weekend:&lt;/p&gt;


	&lt;h3&gt;Don’t hand out the wrong business cards (as in, somebody else’s)&lt;/h3&gt;


	&lt;p&gt;&lt;span class="caps"&gt;SXSW&lt;/span&gt; is a &lt;a href="http://www.flickr.com/search/?q=sxsw%20business%20card&amp;amp;#38;w=all&amp;amp;#38;s=int"&gt;business card trading frenzy&lt;/a&gt;. So, a good idea is to make sure your business cards are your own. Mine weren’t.&lt;/p&gt;


	&lt;p&gt;I was sorting through my remaining business card supply half-way through the conference, and was horrified to notice that a handful were labeled “Kathy Donaghue”, a former &lt;a href="http://www.freshbooks.com"&gt;FreshBooks&lt;/a&gt; co-worker who’d left the team back in August. I guess our cards got mixed up some time ago, and I hadn’t bothered to check them before handing them out. So, if you’re back from &lt;span class="caps"&gt;SXSW&lt;/span&gt; and wondering who the heck Kathy is, look no further – it was me!&lt;/p&gt;


	&lt;h3&gt;MacBooks don’t have &lt;span class="caps"&gt;VGA&lt;/span&gt;-out&lt;/h3&gt;


	&lt;p&gt;Unlike 99% of my web-developer peers – I don’t presently own a laptop. So I borrowed my colleague Sunir’s MacBook for the trip. As a PC-user-4-life, it didn’t occur to me that MacBooks don’t have &lt;span class="caps"&gt;VGA&lt;/span&gt; out – you need &lt;a href="http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wo/StoreReentry.wo?productLearnMore=M9320G/A"&gt;a separate adapter&lt;/a&gt;. So, before my presentation, I actually borrowed a second laptop just to play the slides – a Dell PC running Windows Vista (!). My street cred dropped 50% instantly.&lt;/p&gt;


	&lt;h3&gt;Remember to introduce yourself during your own panel&lt;/h3&gt;


	&lt;p&gt;Yep – no joke. We were about 20 minutes through the panel before I’d realized that, during introductions, I’d completely forgotten to introduce myself, or FreshBooks. Months of organizing, planning, and slide-preparing and nobody even knew who I was. Bummer!&lt;/p&gt;


	&lt;p&gt;(If you’re reading this now, I was &lt;a href="http://www.flickr.com/photos/ksoderstrom/2327236677/"&gt;the guy on the right&lt;/a&gt;.)&lt;/p&gt;


	&lt;h3&gt;Bring a phone (that works)&lt;/h3&gt;


	&lt;p&gt;My mobile phone company, &lt;a href="http://www.virginmobile.ca"&gt;Virgin&lt;/a&gt;, doesn’t offer roaming. With no connection to the outside world, I was always tethered to someone who did. Not being able to find your friends, hand out your number, find the latest party, or Twitter, was a complete drag. Never again!&lt;/p&gt;


	&lt;p&gt;Anyways, all things considered, I had a great time, and let’s face it – these aren’t big deals. Still, next year, I’ll be way more prepared … maybe.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=3tZlWI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=3tZlWI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=Cw0yCI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=Cw0yCI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=ymOhPi"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=ymOhPi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/251160072" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F3%2F14%2Ffour-things-learned-at-sxsw</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-02-14:1174</id>
    <published>2008-02-14T02:57:00Z</published>
    <updated>2008-02-14T02:58:01Z</updated>
    <category term="barcamp" />
    <category term="sxsw" />
    <link href="http://www.benlog.org/2008/2/14/stopping-by-barcamp-austin" rel="alternate" type="text/html" />
    <title>Coming up: BarCamp Austin</title>
<content type="html">
            &lt;p&gt;&lt;img src="/assets/2008/2/14/barcamp-austin.jpg" /&gt;&lt;/p&gt;


	&lt;p&gt;Just a heads up that I’ll be attending &lt;a href="http://barcamp.org/BarCampAustinIII"&gt;BarCamp Austin 3&lt;/a&gt; with some of my &lt;a href="http://www.freshbooks.com"&gt;FreshBooks&lt;/a&gt; compatriots on March 7th. If the crowd’s willing, I’m hoping to get up and talk about my experiences building the &lt;a href="http://developers.freshbooks.com"&gt;FreshBooks &lt;span class="caps"&gt;API&lt;/span&gt;&lt;/a&gt;—what worked, what didn’t, that sort of thing.&lt;/p&gt;


	&lt;p&gt;Personally, I love BarCamp-style events over traditional conference fare. The openness, low cost, and great people you’ll find is tough to beat. &lt;a href="http://www.flickr.com/photos/kieranhuggins/516325146/"&gt;I had a great time last year&lt;/a&gt;  at BarCamp Toronto, and  I’m sure Austin will be no different, judging by the names on &lt;a href="http://barcamp.org/BarCampAustinIIIAttendees"&gt;this sign-up list&lt;/a&gt; (not to mention their awesome logo). Whether you’re a local or in town to catch &lt;span class="caps"&gt;SXSW&lt;/span&gt;, you should find the time to drop by.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=D47T7I"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=D47T7I" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=sZICrI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=sZICrI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=BnrEvi"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=BnrEvi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/234722470" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F2%2F14%2Fstopping-by-barcamp-austin</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-02-10:1171</id>
    <published>2008-02-10T18:06:00Z</published>
    <updated>2008-02-10T23:43:31Z</updated>
    <category term="dreamhost" />
    <link href="http://www.benlog.org/2008/2/10/dreamhost-mix-up-not-all-smiles" rel="alternate" type="text/html" />
    <title>Dreamhost mix-up not all smiles: delays, dollar fluxuation hurts refund</title>
<content type="html">
            &lt;p&gt;&lt;img title="Dreamhost" src="/assets/2008/2/10/dreamhost_logo.jpg" alt="Dreamhost" /&gt;&lt;/p&gt;


	&lt;p&gt;In case you missed it, &lt;a href="http://www.dreamhost.com"&gt;Dreamhost&lt;/a&gt;, the shared hosting provider,  &lt;a href="http://blog.dreamhost.com/2008/01/15/um-whoops/"&gt;mistakenly charged its customers nearly 7.5 million dollars&lt;/a&gt; on January 15th, 2008.&lt;/p&gt;


	&lt;p&gt;Well, I was one of those customers. I’ve had my Dreamhost account for years now, and they’ve always been swell for me, performance issues aside. I didn’t gripe about it because I was only charged around $52 on my credit card, not $200+ &lt;a href="http://blog.dreamhost.com/2008/01/15/um-whoops/?cp=1#comments"&gt;like some folks&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Anyways, after a few weeks, Dreamhost’s refund appeared on my credit card statement. Unfortunately, there were a few inconsistencies.&lt;/p&gt;


	&lt;p&gt;Here’s the mistaken charges (2 of them) appearing on January 17th, followed by a single credit four days later. Notice the amount – it’s a full dollar less.&lt;/p&gt;


	&lt;p&gt;&lt;img src="/assets/2008/2/10/dreamhost-1.jpg" /&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;Then on January 31st, a final credit, presumably for the 2nd mistaken charge, is over two dollars short:&lt;/p&gt;


	&lt;p&gt;&lt;img src="/assets/2008/2/10/dreamhost-3.jpg" /&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;I’m going to assume that Dreamhost knows what it’s doing, and has attempted to refund me the proper amount—in &lt;span class="caps"&gt;USD&lt;/span&gt;. But the &lt;a href="http://www.bankofcanada.ca/en/rates/exchform.html"&gt;Canadian dollar has been fluctuating&lt;/a&gt;, such that the exchange rate has shifted by 3 cents between January 15th and the 31st. The numbers don’t work out perfectly (I don’t know what my credit card charged me for the exchange, nor do I know the exact moment the charges/debits went through), but they’re somewhat in line.&lt;/p&gt;


	&lt;p&gt;Long story short, so we’re only talking a couple of bucks, and I’m not too bothered by it. But at the same time, it kind of stinks to be out $3 because of somebody’s “fat finger”.&lt;/p&gt;


	&lt;p&gt;Anyways, I’m sending an e-mail to Dreamhost and hopefully they’ll sort it out.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=SkP2FI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=SkP2FI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=eOK1vI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=eOK1vI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=a1WAJi"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=a1WAJi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/232724956" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F2%2F10%2Fdreamhost-mix-up-not-all-smiles</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-01-24:1142</id>
    <published>2008-01-24T04:48:00Z</published>
    <updated>2008-01-24T06:03:55Z</updated>
    <category term="goodtimes" />
    <category term="php" />
    <link href="http://www.benlog.org/2008/1/24/php-be-careful-with-global-constants" rel="alternate" type="text/html" />
    <title>PHP: Be careful with global constants</title>
<content type="html">
            &lt;p&gt;Did you know that &lt;a href="http://ca3.php.net/constants"&gt;global constants&lt;/a&gt;, when &lt;b&gt;undefined&lt;/b&gt;, evaluate to a string containing the constant name? Talk about a mouthful – here’s an example repurposed from the &lt;span class="caps"&gt;PHP&lt;/span&gt; docs:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;?php
define("CONSTANT", "Hello world.");
echo CONSTANT; // outputs "Hello world." 
echo Constant; // outputs "Constant" and issues a notice.
?&amp;gt;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Depending on your programming background, this probably isn’t what you had in mind. Not me at least – all the languages I’ve ever dealt with fail when attempting to evaluate undefined constants.&lt;/p&gt;


	&lt;p&gt;That means that if you’re not careful, an undefined constant can cause bugs like this:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;if ($user_level &amp;lt; ADMIN_LVL) { // Typo! Should be ADMIN_LEVEL
   // always evaluated
}&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;I’ve also seen permutations of the following:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;define('DEBUG_MODE', true);

if (DEBUG) { // Yes, another typo
  // always executed -- aside: should use if_defined
}&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;There’s a couple defensive measures you can take. One, use an &lt;a href="http://ca.php.net/error-reporting"&gt;error reporting level&lt;/a&gt; of E_STRICT or E_ALL during development, which will emit a warning in the case above—if it’s evaluated. Better yet, stick to &lt;a href="http://php.mirrors.ilisys.com.au/manual/en/language.oop5.constants.php"&gt;class constants&lt;/a&gt;. Undefined class constants throw good old fashioned errors, just like Ruby, Python, et al.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;class Consts {
  const ADMIN_LEVEL = 5;
}

// Later that day ...

if ($user_level &amp;lt; Consts::ADMIN_LVL) { // Here's that typo again
  // throws an error
}&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Fail-fast"&gt;Failing fast&lt;/a&gt; like this could be the difference between having a bug reported to you immediately by your users, or having a bug reported to you 3 months later when errors pop-up in your database. Don’t know you guys, but I’ll take the first one.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=mnksjI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=mnksjI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=Utn8yI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=Utn8yI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=7mTSKi"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=7mTSKi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/222070804" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F1%2F24%2Fphp-be-careful-with-global-constants</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2008-01-02:1126</id>
    <published>2008-01-02T04:17:00Z</published>
    <updated>2008-01-02T06:58:04Z</updated>
    <category term="personal" />
    <link href="http://www.benlog.org/2008/1/2/looking-back-at-2007" rel="alternate" type="text/html" />
    <title>Looking back at 2007</title>
<content type="html">
            &lt;p&gt;As far as accomplishments go, 2007 has been a good year. I joined &lt;a href="http://www.freshbooks.com"&gt;FreshBooks&lt;/a&gt; in April (it’s been great), had &lt;a href="http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0000718;jsessionid=0FE16C3FB27498000F8A3B0481E96AA2"&gt;my first academic paper&lt;/a&gt; published in August, and was chosen to participate in next year’s &lt;a href="http://2008.sxsw.com/interactive/"&gt;&lt;span class="caps"&gt;SXSW&lt;/span&gt; Interactive&lt;/a&gt;. On top of that, this blog reached 100 readers over the summer – thanks you guys.&lt;/p&gt;


	&lt;p&gt;Speaking of which, the only real down note is how I’ve labored with this blog these past few months. I’ve had article ideas bouncing around in my head, but the most important step – writing them out – has totally eluded me. So, my first resolution for next year is to rediscover my writing touch and whip this blog back into shape.&lt;/p&gt;


	&lt;p&gt;&lt;b&gt;My other resolutions?&lt;/b&gt; Write more code for the hell of it, build something with &lt;a href="http://merbivore.com/"&gt;merb&lt;/a&gt;, and contribute to a proper open source project. I’ve shared plenty of half-baked code here on my blog, but I’d like to get involved with a project with legs – whether I’m writing docs, test cases, or patches, it’s all good. (Looking for help? Drop me a line.)&lt;/p&gt;


	&lt;p&gt;So here’s to a new year – may it be a good one.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=a7fhtI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=a7fhtI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=gpPRBI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=gpPRBI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=Yy9eki"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=Yy9eki" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/209702507" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2008%2F1%2F2%2Flooking-back-at-2007</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2007-11-23:990</id>
    <published>2007-11-23T02:50:00Z</published>
    <updated>2007-12-17T02:55:08Z</updated>
    <category term="php" />
    <link href="http://www.benlog.org/2007/11/23/php-5-3-now-with-less-chafing" rel="alternate" type="text/html" />
    <title>PHP 5.3: Now with less chafing</title>
<content type="html">
            &lt;p&gt;I’m not one for blogging about feature announcements, but there’s been a recent flurry of &lt;span class="caps"&gt;PHP 5&lt;/span&gt;.3 news I’d like to draw attention to.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://blog.felho.hu/whats-new-in-php-53-part-1-namespaces.html"&gt;Namespaces&lt;/a&gt; will finally make an appearance. No comment necessary, really – what with &lt;a href="http://www.php.net/quickref.php"&gt;&lt;span class="caps"&gt;PHP&lt;/span&gt;’s 5500+ global functions&lt;/a&gt; and reserved words.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://blog.felho.hu/what-is-new-in-php-53-part-2-late-static-binding.html"&gt;Late static binding&lt;/a&gt;, along with dynamic static calls (see: &lt;a href="http://blog.felho.hu/what-is-new-in-php-53-part-4-__callstatic-openid-support-userini-xslt-profiling-and-more.html"&gt;__callStatic&lt;/a&gt;), will hopefully give way to an ActiveRecord implementation that doesn’t depend on a generic finder class.&lt;/p&gt;


	&lt;p&gt;Okay, so that’s only two. Yes, there’s a healthy list of other changes, but these solve some major pain points for me and other moonlight Ruby programmers.&lt;/p&gt;


	&lt;p&gt;If you’d like to learn more, Gergely Hodicska &lt;a href="http://blog.felho.hu/stone/php-53"&gt;goes in depth on his blog&lt;/a&gt;.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=DxR5UI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=DxR5UI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=JLOSQI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=JLOSQI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=7hb2zi"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=7hb2zi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/201437974" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2007%2F11%2F23%2Fphp-5-3-now-with-less-chafing</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2007-10-21:781</id>
    <published>2007-10-21T05:36:00Z</published>
    <updated>2007-12-14T23:54:27Z</updated>
    <category term="speaking" />
    <category term="sxsw" />
    <link href="http://www.benlog.org/2007/10/21/next-stop-austin" rel="alternate" type="text/html" />
    <title>Next stop, Austin</title>
<content type="html">
            &lt;p&gt;Big news – my &lt;span class="caps"&gt;SXSW&lt;/span&gt; panel proposal, “Web Service APIs Your Mom Will Love”, made the &lt;a href="http://2008.sxsw.com/blogs/ia.php/2007/10/19/p317"&gt;preliminary list of 2008 programming&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;I’d like to thank everyone who voted for the panel, as well as my colleagues at &lt;a href="http://www.freshbooks.com"&gt;FreshBooks&lt;/a&gt; for their ruthless peer pressure in getting me to participate.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=WInzdI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=WInzdI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=K1yCrI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=K1yCrI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=fU9mei"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=fU9mei" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/172771328" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2007%2F10%2F21%2Fnext-stop-austin</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2007-09-16:485</id>
    <published>2007-09-16T22:06:00Z</published>
    <updated>2007-09-16T22:06:43Z</updated>
    <category term="freshbooks" />
    <category term="ruby" />
    <link href="http://www.benlog.org/2007/9/16/freshbooks-rb-now-at-rubyforge-installed-as-gem" rel="alternate" type="text/html" />
    <title>FreshBooks.rb now at Rubyforge, installed as gem</title>
<content type="html">
            &lt;p&gt;As the title suggests, the FreshBooks.rb project &lt;a href="http://rubyforge.org/projects/freshbooks/"&gt;can now be found at Rubyforge&lt;/a&gt;. If you’ve got any bug reports, feature requests, or just want to ping me about the software – please use the tools there.&lt;/p&gt;


	&lt;p&gt;Why the change? Well, now you can now install FreshBooks.rb as a &lt;a href="http://www.rubygems.org/read/chapter/1#page22"&gt;gem&lt;/a&gt;. It’s as easy as:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;gem install freshbooks&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Lastly, the latest release &lt;a href="http://developers.freshbooks.com/blog/2007/08/29/api-changes-for-august-2007/"&gt;now includes support for recurring profiles&lt;/a&gt;.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=UIoHrP3n"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=UIoHrP3n" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=HiuHiFb5"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=HiuHiFb5" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=3FhAtl3I"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=3FhAtl3I" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/157338175" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2007%2F9%2F16%2Ffreshbooks-rb-now-at-rubyforge-installed-as-gem</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2007-09-08:478</id>
    <published>2007-09-08T14:38:00Z</published>
    <updated>2007-12-02T22:22:27Z</updated>
    <category term="freshbooks" />
    <category term="sxsw" />
    <link href="http://www.benlog.org/2007/9/8/vote-for-my-api-design-development-panel-at-sxsw-interactive" rel="alternate" type="text/html" />
    <title>Vote for my API Design &amp; Development Panel at SXSW Interactive</title>
<content type="html">
            &lt;p&gt;At the urging of my &lt;a href="http://www.freshbooks.com"&gt;FreshBooks&lt;/a&gt; cohorts, &lt;a href="http://panelpicker.sxsw.com/ideas/view/622?return=%2Fideas%2Findex%2F2%2Fq%3AFreshBooks"&gt;I submitted a panel proposal&lt;/a&gt; to &lt;a href="http://2008.sxsw.com/interactive/"&gt;&lt;span class="caps"&gt;SXSW&lt;/span&gt; Interactive&lt;/a&gt; for 2008. The idea: get a bunch of developers from leading web 2.0 companies to talk about the design and implementation decisions behind their web service APIs.&lt;/p&gt;


	&lt;p&gt;So, why me? Well, one of my primary duties at FreshBooks is continued development on the &lt;a href="http://developers.freshbooks.com"&gt;FreshBooks &lt;span class="caps"&gt;API&lt;/span&gt;&lt;/a&gt;. I’ve had a pretty big hand in designing the request and response structure, determining which methods make the cut, writing the &lt;span class="caps"&gt;API&lt;/span&gt; documentation, and so on. It was a great learning experience, and I think it’d be great to pass that knowledge on (with the help of some others, of course) to other would-be &lt;span class="caps"&gt;API&lt;/span&gt; developers.&lt;/p&gt;


	&lt;p&gt;Whether you’re attending &lt;span class="caps"&gt;SXSW&lt;/span&gt; next year or not (hopefully you are), &lt;a href="http://panelpicker.sxsw.com/ideas/view/622?return=%2Fideas%2Findex%2F2%2Fq%3AFreshBooks"&gt;you can vote for the panel here&lt;/a&gt;. Please forgive my suspect choice of panel name :)&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=rZhdOrgc"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=rZhdOrgc" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=ewCsRJnc"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=ewCsRJnc" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=dB0SPFsw"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=dB0SPFsw" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/153872810" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2007%2F9%2F8%2Fvote-for-my-api-design-development-panel-at-sxsw-interactive</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2007-08-16:368</id>
    <published>2007-08-16T04:23:00Z</published>
    <updated>2007-12-17T19:05:46Z</updated>
    <category term="metaprogramming" />
    <category term="ruby" />
    <link href="http://www.benlog.org/2007/8/16/integer-returns-many-returns-7-somethings" rel="alternate" type="text/html" />
    <title>Integer.returns_many lets you return 7.somethings</title>
<summary type="html">&lt;p&gt;&lt;a href="http://benlog.org/2007/8/13/activesupport-for-php-ruby-style"&gt;In my last post&lt;/a&gt; I mentioned my love of all things &lt;a href="http://as.rubyonrails.org"&gt;ActiveSupport&lt;/a&gt;. I’m particularly fond of how it modifies the core &lt;a href="http://www.ruby-doc.org/core/classes/Integer.html"&gt;Integer&lt;/a&gt; class to easily convert between units of time:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;Time.now + 7.days
=&amp;gt; Thu Aug 23 04:05:54 UTC 2007

Time.now – 1.month
=&amp;gt; Tue Jul 17 04:06:12 UTC 2007&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;i&gt;Recap&lt;/i&gt;: ActiveSupport is a Rails library that modifies core Ruby classes with handy utility methods like the ones above.&lt;/p&gt;


	&lt;p&gt;Anyways, I love this syntax, and began wondering how it could be re-applied to other objects. My first idea – what about retuning an arbitrary number of objects, of any class? Wouldn’t it be neat to return 7.somethings?&lt;/p&gt;


	&lt;p&gt;It turns out you can do just that.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;&lt;a href="http://benlog.org/2007/8/13/activesupport-for-php-ruby-style"&gt;In my last post&lt;/a&gt; I mentioned my love of all things &lt;a href="http://as.rubyonrails.org"&gt;ActiveSupport&lt;/a&gt;. I’m particularly fond of how it modifies the core &lt;a href="http://www.ruby-doc.org/core/classes/Integer.html"&gt;Integer&lt;/a&gt; class to easily convert between units of time:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;Time.now + 7.days
=&amp;gt; Thu Aug 23 04:05:54 UTC 2007

Time.now – 1.month
=&amp;gt; Tue Jul 17 04:06:12 UTC 2007&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;i&gt;Recap&lt;/i&gt;: ActiveSupport is a Rails library that modifies core Ruby classes with handy utility methods like the ones above.&lt;/p&gt;


	&lt;p&gt;Anyways, I love this syntax, and began wondering how it could be re-applied to other objects. My first idea – what about retuning an arbitrary number of objects, of any class? Wouldn’t it be neat to return 7.somethings?&lt;/p&gt;


	&lt;p&gt;It turns out you can do just that.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://benlog.org/2007/8/13/activesupport-for-php-ruby-style"&gt;In my last post&lt;/a&gt; I mentioned my love of all things &lt;a href="http://as.rubyonrails.org"&gt;ActiveSupport&lt;/a&gt;. I’m particularly fond of how it modifies the core &lt;a href="http://www.ruby-doc.org/core/classes/Integer.html"&gt;Integer&lt;/a&gt; class to easily convert between units of time:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;Time.now + 7.days
=&amp;gt; Thu Aug 23 04:05:54 UTC 2007

Time.now – 1.month
=&amp;gt; Tue Jul 17 04:06:12 UTC 2007&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;i&gt;Recap&lt;/i&gt;: ActiveSupport is a Rails library that modifies core Ruby classes with handy utility methods like the ones above.&lt;/p&gt;


	&lt;p&gt;Anyways, I love this syntax, and began wondering how it could be re-applied to other objects. My first idea – what about retuning an arbitrary number of objects, of any class? Wouldn’t it be neat to return 7.somethings?&lt;/p&gt;


	&lt;p&gt;It turns out you can do just that.&lt;/p&gt;


	&lt;h3&gt;I can has apples?&lt;/h3&gt;


	&lt;p&gt;Let’s say we have a class called Apple with a single attribute – a color.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;class Apple
  attr_accessor :color

  def initialize(color = nil)
    self.color = color
  end  
end

a_red_apple = Apple.new(‘red’)&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Using Integer.returns_many, a little 15-line class method I’ve written, we can make any Integer return a corresponding amount of objects, returned in an array. It has one required argument – the pluralized version of the class you’d like to return.&lt;/p&gt;


	&lt;p&gt;In keeping with our example, lets have Integers return instances of our Apple class:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;Integer.returns_many(‘apples’)
=&amp;gt; true&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Applesauce&lt;/h3&gt;


	&lt;p&gt;After invoking the returns_many method, all Integers are blessed with the ‘apples’ method.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;3.apples
=&amp;gt; [ #&amp;lt;Apple:0xb7c70e04 @color=[]&amp;gt;, 
     #&amp;lt;Apple:0xb7c70df0 @color=[]&amp;gt;,
     #&amp;lt;Apple:0xb7c70ddc @color=[]&amp;gt; ]&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Any arguments you pass to the ‘apples’ method gets passed to the Apple#initialize method (the class constructor). This means we can give our apples color:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;2.apples(‘green’)
=&amp;gt; [ #&amp;lt;Apple:0xb7c70e04 @color=["green"]&amp;gt;, 
     #&amp;lt;Apple:0xb7c70ddc @color=["green"]&amp;gt; ]&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Since we’re dealing with arrays now, array arithmetic works dandy. If I fill my basket with 2 green apples and 1 red apple, what have I got?&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;basket = 2.apples(‘green’) + 1.apple(‘red')
=&amp;gt; [ #&amp;lt;Apple:0xb7c70e04 @color=["green"]&amp;gt;, 
     #&amp;lt;Apple:0xb7c70df0 @color=["green"]&amp;gt;,
     #&amp;lt;Apple:0xb7c70ddc @color=["red"]&amp;gt; ]&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;Conclusion and Source code&lt;/h3&gt;


	&lt;p&gt;Fixnum.many_things might be of limited usefulness, but it’s an interesting example of how Ruby’s core types can be modified to make code reading easier.&lt;/p&gt;


	&lt;p&gt;If you’d like to give Integer.returns_many a try, you can &lt;a href="/files/returns_many.rb"&gt;check out the code here&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Oh, and please forgive my &lt;a href="http://www.icanhascheezburger.com"&gt;lolcats&lt;/a&gt; reference above.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=mAYJzI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=mAYJzI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=IUUfPI"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=IUUfPI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=mCdTni"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=mCdTni" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/201795136" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2007%2F8%2F16%2Finteger-returns-many-returns-7-somethings</feedburner:awareness></entry>
  <entry xml:base="http://www.benlog.org/">
    <author>
      <name>ben</name>
    </author>
    <id>tag:www.benlog.org,2007-08-13:350</id>
    <published>2007-08-13T01:55:00Z</published>
    <updated>2007-10-20T22:16:54Z</updated>
    <category term="php" />
    <category term="rails" />
    <category term="ruby" />
    <link href="http://www.benlog.org/2007/8/13/activesupport-for-php-ruby-style" rel="alternate" type="text/html" />
    <title>ActiveSupport for PHP - Ruby style</title>
<summary type="html">&lt;p&gt;One of the things I miss most from Rails is &lt;a href="http://as.rubyonrails.com/"&gt;ActiveSupport&lt;/a&gt;, the module that modifies Ruby’s core classes (numbers, strings, more) with handy utility methods.  They tie so well into the language, most Rails developers don’t realize they aren’t core methods.&lt;/p&gt;


	&lt;p&gt;Here’s a few examples:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; 'hello_world'.camelize
=&amp;gt; 'HelloWorld'

&amp;gt;&amp;gt; 7.days.ago
=&amp;gt; Sun Aug 05 20:53:12 -0400 2007

&amp;gt;&amp;gt; 'purple people eater'.ends_with?('eater')
=&amp;gt; true&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Is it possible to port this left-to-right style of coding to &lt;span class="caps"&gt;PHP&lt;/span&gt;?&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;One of the things I miss most from Rails is &lt;a href="http://as.rubyonrails.com/"&gt;ActiveSupport&lt;/a&gt;, the module that modifies Ruby’s core classes (numbers, strings, more) with handy utility methods.  They tie so well into the language, most Rails developers don’t realize they aren’t core methods.&lt;/p&gt;


	&lt;p&gt;Here’s a few examples:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; 'hello_world'.camelize
=&amp;gt; 'HelloWorld'

&amp;gt;&amp;gt; 7.days.ago
=&amp;gt; Sun Aug 05 20:53:12 -0400 2007

&amp;gt;&amp;gt; 'purple people eater'.ends_with?('eater')
=&amp;gt; true&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Is it possible to port this left-to-right style of coding to &lt;span class="caps"&gt;PHP&lt;/span&gt;?&lt;/p&gt;
&lt;h3&gt;Quick introduction&lt;/h3&gt;


	&lt;p&gt;One of the things I miss most from Rails is &lt;a href="http://as.rubyonrails.com/"&gt;ActiveSupport&lt;/a&gt;, the module that modifies Ruby’s core classes (numbers, strings, more) with handy utility methods.  They tie so well into the language, most Rails developers don’t realize they aren’t core methods.&lt;/p&gt;


	&lt;p&gt;Here’s a few examples:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; 'hello_world'.camelize
=&amp;gt; 'HelloWorld'

&amp;gt;&amp;gt; 7.days.ago
=&amp;gt; Sun Aug 05 20:53:12 -0400 2007

&amp;gt;&amp;gt; 'purple people eater'.ends_with?('eater')
=&amp;gt; true&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;i&gt;Aside&lt;/i&gt;: For a near-complete list of ActiveSupport goodies, check out ErrTheBlog’s teriffic &lt;a href="http://errtheblog.com/post/44"&gt;Rails Rubyisms Advent&lt;/a&gt; article.&lt;/p&gt;


	&lt;h3&gt;The &lt;span class="caps"&gt;PHP&lt;/span&gt; way&lt;/h3&gt;


	&lt;p&gt;Big chunks of ActiveSupport (mostly string inflection) have been ported to each of the major &lt;span class="caps"&gt;PHP&lt;/span&gt; frameworks, and an ActiveSupport extension has already been submitted to &lt;span class="caps"&gt;PEAR&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;In nearly all of these cases, the functionality has been ported, but the elegance of ActiveSupport is lost in translation. Here’s the camelize example again, this time using &lt;a href="http://www.symfony-project.com"&gt;Symfony&lt;/a&gt;:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;sfInflector::camelize('hello_world');&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;As with pretty much all &lt;span class="caps"&gt;PHP&lt;/span&gt; code, it’s interpreted right-to-left instead of left-to-right, like Ruby. I prefer the latter.&lt;/p&gt;


	&lt;h3&gt;The Ruby way (in &lt;span class="caps"&gt;PHP&lt;/span&gt;)&lt;/h3&gt;


	&lt;p&gt;So, armed with an afternoon and a full pot of coffee, I wrote my own Ruby-like ActiveSupport library for &lt;span class="caps"&gt;PHP5&lt;/span&gt;. Here’s what it looks like:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;require_once('ActiveSupport.php');

_(14)-&amp;gt;ordinalize(); # Outputs "14th" 

_(7.3)-&amp;gt;megabytes(); # Returns number of bytes in 7.3 megabytes

_("an example sentence")-&amp;gt;endsWith("sentence"); # Returns true&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;What the hell?&lt;/h3&gt;


	&lt;p&gt;Okay, there’s some trickery going on here, so I’ll provide a quick explanation.&lt;/p&gt;


	&lt;p&gt;The underscore shortcut you see above is a quick way of instantiating one of four core ActiveSupport types: ActiveSupport_Integer, ActiveSupport_Numeric, ActiveSupport_String, or ActiveSupport_Array. The class you get depends on the type of the parameter you pass in. Each of these classes have been armed the same utility methods in their Rails counterpart.&lt;/p&gt;


	&lt;h3&gt;What about chaining?&lt;/h3&gt;


	&lt;p&gt;Ruby’s chained time/date expressions are my favourite, and they haven’t been forgotten. You can chain ActiveSupport function calls by ending them with an underscore:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;_(2)-&amp;gt;weeks_()-&amp;gt;ago(); # Returns appropriate timestamp

_(14)-&amp;gt;days_()-&amp;gt;before(time()); # Same value as above, written differently&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;By default, all ActiveSupport function calls return primitive types (integer, float, etc) in order to play nice with traditional &lt;span class="caps"&gt;PHP&lt;/span&gt;. But when you append an underscore to the function name, you get the corresponding ActiveSupport type instead. So where &lt;code&gt;_(2)-&amp;gt;weeks()&lt;/code&gt; returns an integer, &lt;code&gt;_(2)-&amp;gt;weeks_()&lt;/code&gt; returns an object of class ActiveSupport_Numeric.&lt;/p&gt;


	&lt;h3&gt;And there you have it&lt;/h3&gt;


	&lt;p&gt;Want to give it a try? Download the (mostly complete) &lt;a href="http://benlog.org/assets/2007/8/13/active_support_php-0.1.zip"&gt;source code here&lt;/a&gt; (MIT License).&lt;/p&gt;


	&lt;p&gt;I’m not sure how practical this library actually is, but developing it was an interesting exercise. I was able to learn a lot about &lt;span class="caps"&gt;PHP&lt;/span&gt;’s limitations, as well as its flexibility.&lt;/p&gt;


	&lt;p&gt;As always, feedback is appreciated.&lt;/p&gt;
          &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=rcOmjAE0"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=rcOmjAE0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=1DE6Dge3"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=1DE6Dge3" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/benlog_org?a=A73BFr6q"&gt;&lt;img src="http://feeds.feedburner.com/~f/benlog_org?i=A73BFr6q" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/benlog_org/~4/143501203" height="1" width="1"/&gt;</content>  <feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetItemData?uri=benlog_org&amp;itemurl=http%3A%2F%2Fwww.benlog.org%2F2007%2F8%2F13%2Factivesupport-for-php-ruby-style</feedburner:awareness></entry>
<feedburner:awareness xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://api.feedburner.com/awareness/1.0/GetFeedData?uri=benlog_org</feedburner:awareness></feed>
