<?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>/dev/caffeine &#187; programming</title>
	<atom:link href="http://devcaffeine.com/categories/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://devcaffeine.com</link>
	<description>anything worth taking seriously is worth making fun of</description>
	<lastBuildDate>Thu, 24 Sep 2009 20:50:49 +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>Specify a relative time in Cucumber</title>
		<link>http://devcaffeine.com/2009/08/17/relative-time-in-cucumber/</link>
		<comments>http://devcaffeine.com/2009/08/17/relative-time-in-cucumber/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 17:52:59 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://devcaffeine.com/?p=96</guid>
		<description><![CDATA[Prepping for working on a feature at $work that involves limiting documents by relative time, I hashed out the following steps.  Posting here in case they prove useful for anyone.
I want to be able to specify an arbitrary time, in english, relative to the current time, in my Cucumber steps.  For example,

Scenario: Only [...]]]></description>
			<content:encoded><![CDATA[<p>Prepping for working on a feature at $work that involves limiting documents by relative time, I hashed out the following steps.  Posting here in case they prove useful for anyone.</p>
<p>I want to be able to specify an arbitrary time, in english, relative to the current time, in my Cucumber steps.  For example,</p>

<div class="wp_syntax"><div class="code"><pre class="cucumber" style="font-family:monospace;">Scenario: Only posts from the last two months are shown
  Given the following posts:
    | title           | posted_at           |
    | recent post     | 2 days ago          |
    | recent post 2   | yesterday           |
    | older post      | 2 months ago        |
    | really old post | 2 months, 1 day ago |
    | tomorrow's post | 1 day from now      |
  When I go to the posts page
  Then I should see 3 posts</pre></div></div>

<p>The desire, there, is to be able to specify a date relative to the current time, in plain english.  The tricky bit is being able to chain them together, as in <code>1 year, 3 months, 2 days ago</code></p>
<p>I got this worked out by stringing a few regular expressions together in my step definition helper.  It depends on the 2.days.ago type dsl in ActiveSupport.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Given <span style="color:#006600; font-weight:bold;">/</span>^the following posts?:?<span style="color:#006600; font-weight:bold;">/</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>table<span style="color:#006600; font-weight:bold;">|</span>
  table.<span style="color:#9900CC;">map_column</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'posted_at'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>date<span style="color:#006600; font-weight:bold;">|</span> interpret_time<span style="color:#006600; font-weight:bold;">&#40;</span>date<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  table.<span style="color:#9900CC;">hashes</span>.<span style="color:#9900CC;">each</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>hash<span style="color:#006600; font-weight:bold;">|</span> Factory <span style="color:#ff3333; font-weight:bold;">:post</span>, hash<span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> interpret_time<span style="color:#006600; font-weight:bold;">&#40;</span>time<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">if</span> time.<span style="color:#9900CC;">blank</span>?
  <span style="color:#0000FF; font-weight:bold;">return</span> time <span style="color:#9966CC; font-weight:bold;">if</span> time.<span style="color:#9900CC;">kind_of</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">Time</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">or</span> time.<span style="color:#9900CC;">kind_of</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">Date</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  named_time<span style="color:#006600; font-weight:bold;">&#40;</span>time<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> time_by_regex<span style="color:#006600; font-weight:bold;">&#40;</span>time<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span>time<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> named_time<span style="color:#006600; font-weight:bold;">&#40;</span>time<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">case</span> time.<span style="color:#9900CC;">downcase</span>
  <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#996600;">&quot;today&quot;</span> : <span style="color:#CC00FF; font-weight:bold;">Date</span>.<span style="color:#9900CC;">today</span>
  <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#996600;">&quot;now&quot;</span> : <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>
  <span style="color:#008000; font-style:italic;"># etc ...</span>
  <span style="color:#9966CC; font-weight:bold;">else</span> <span style="color:#0000FF; font-weight:bold;">nil</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> time_by_regex<span style="color:#006600; font-weight:bold;">&#40;</span>time<span style="color:#006600; font-weight:bold;">&#41;</span>
  directional_regex = <span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>ago<span style="color:#006600; font-weight:bold;">|</span>from now<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span>i
  time_regex = <span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>minute<span style="color:#006600; font-weight:bold;">|</span>hour<span style="color:#006600; font-weight:bold;">|</span>day<span style="color:#006600; font-weight:bold;">|</span>week<span style="color:#006600; font-weight:bold;">|</span>month<span style="color:#006600; font-weight:bold;">|</span>year<span style="color:#006600; font-weight:bold;">&#41;</span>s?<span style="color:#006600; font-weight:bold;">/</span>i
&nbsp;
  direction = time.<span style="color:#9900CC;">scan</span><span style="color:#006600; font-weight:bold;">&#40;</span>directional_regex<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">flatten</span>
  shifts = time.<span style="color:#9900CC;">scan</span><span style="color:#006600; font-weight:bold;">&#40;</span>time_regex<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">if</span> direction.<span style="color:#9900CC;">empty</span>? <span style="color:#9966CC; font-weight:bold;">or</span> shifts.<span style="color:#9900CC;">empty</span>?
  forward = direction.<span style="color:#9900CC;">first</span> == <span style="color:#996600;">&quot;from now&quot;</span>
&nbsp;
  result = <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>
  shifts.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>count, unit<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#008000; font-style:italic;">#depends on the 1.week type DSL for time measurements</span>
    adjust = count.<span style="color:#9900CC;">to_i</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span>unit<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;"># move time in correct direction</span>
    result = forward ? <span style="color:#006600; font-weight:bold;">&#40;</span>result <span style="color:#006600; font-weight:bold;">+</span> adjust<span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#006600; font-weight:bold;">&#40;</span>result <span style="color:#006600; font-weight:bold;">-</span> adjust<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  result
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2009/08/17/relative-time-in-cucumber/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Integration testing SSL with Cucumber</title>
		<link>http://devcaffeine.com/2009/02/16/integration-testing-ssl-with-cucumber/</link>
		<comments>http://devcaffeine.com/2009/02/16/integration-testing-ssl-with-cucumber/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 18:50:27 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://devcaffeine.com/?p=81</guid>
		<description><![CDATA[Cucumber, for those who aren&#8217;t up to speed on the latest in testing hotness, is an integration testing framework for Ruby.  While it&#8217;s not strictly limited to integration testing Rails applications, that&#8217;s the context i use it in most of the time.
I saw a question on the rspec list recently asking about how you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/aslakhellesoy/cucumber/wikis">Cucumber</a>, for those who aren&#8217;t up to speed on the latest in testing hotness, is an integration testing framework for Ruby.  While it&#8217;s not strictly limited to integration testing Rails applications, that&#8217;s the context i use it in most of the time.</p>
<p>I saw a question on the rspec list recently asking about how you test an SSL required page within cucumber, and I realized that I&#8217;ve had that, and even more cert-related chaos, figured out at $WORK, and that I should probably talk a little bit about it.</p>
<p>Simple scenario is that you&#8217;ve got some controller on your site that is supposed to only be accessible via https, and you want to make sure it behaves correctly in cucumber.  In your standard deployment scenario, mongrel never really sees anything about SSL; that&#8217;s all handled by Apache.  Apache will set some headers for you, which rails can check to determine if you&#8217;re using SSL.  Since you&#8217;re not testing with Apache at this testing level, you just need to set the relevant HTTP headers.</p>
<blockquote><p>
Given I am using HTTPS<br />
When I visit /payments<br />
Then I should see the payments page</p>
<p>Given I am not using HTTPS<br />
When I visit /payments<br />
Then I should see an SSL error page
</p></blockquote>
<p>If I&#8217;m using <a href="http://gitrdoc.com/brynary/webrat/tree/master/">webrat</a> (which is <i>highly</i> recommended here) this becomes as simple as setting a header value.  In recent versions of webrat, that boils down to:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Given <span style="color:#006600; font-weight:bold;">/</span>I am using HTTPS<span style="color:#006600; font-weight:bold;">/</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  header<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;HTTPS&quot;</span>, <span style="color:#996600;">&quot;on&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
Given <span style="color:#006600; font-weight:bold;">/</span>I am <span style="color:#9966CC; font-weight:bold;">not</span> using HTTPS<span style="color:#006600; font-weight:bold;">/</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#008000; font-style:italic;"># this space left intentionally blank</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>If you&#8217;re NOT using webrat, but still at the rails integration test level,  the call is a bit uglier</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  get <span style="color:#ff3333; font-weight:bold;">:show</span>, <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">1234</span> <span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:https</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'on'</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>The <code>get</code> method at the integration test level actually takes a third argument, which is the HTTP headers set on that request.  At the functional / controller example level, the same method <i>might</i> work &#8212; I don&#8217;t know, I havn&#8217;t actually tested this at that level, instead I&#8217;ve just stubbed the <code>https?</code> method as needed.</p>
<p>Now, for bonus points.  At $WORK, I exist in one of those ideal closed environments where x509 authentication actually stands a <i>chance</i> of working.  That is, everyone gets a client certificate, which they send to us with the HTTPS request.  We check against an external service, see that the cert is good, and viola, we can pre-populate with all sorts of juicy user information.  Pipe dream on the internet, but it works well on an intranet. (having worked with this stuff, it&#8217;s no surprise to me at <i>all</i> that x509 client certs havn&#8217;t even managed to catch on with <i>banks</i> much less the general public &#8230;)</p>
<p>Apache takes care of checking the certificate, making sure it&#8217;s valid and well formed, and that it&#8217;s not in any CRL, and that it&#8217;s trusted.  Makes my life easier, at the Rails level, we just have to check against the external service and we&#8217;re off to the races.  And, happily, apache will pass things on in the headers.</p>
<blockquote><p>
Given I use the client certificate for &#8220;Joe&#8221;<br />
Then when I visit /administration<br />
I should be let in
</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Given <span style="color:#006600; font-weight:bold;">/</span>I use the client certificate <span style="color:#9966CC; font-weight:bold;">for</span> <span style="color:#996600;">&quot;(.*)&quot;</span><span style="color:#006600; font-weight:bold;">/</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>cert_user<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#008000; font-style:italic;">#lookup or generate stub certificate information</span>
  header<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;X_CLIENT_CERT&quot;</span>, certificate.<span style="color:#9900CC;">certificate</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  header<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;X_CLIENT_DN&quot;</span>, certificate.<span style="color:#9900CC;">dn</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  header<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;HTTPS&quot;</span>, <span style="color:#996600;">&quot;on&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  DirectoryService.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">stub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:lookup</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">with</span><span style="color:#006600; font-weight:bold;">&#40;</span>certificate.<span style="color:#9900CC;">dn</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">and_return</span> certificate.<span style="color:#9900CC;">remote_xml</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>I&#8217;m hand-waving around some of the stubbing that would have to go on here, as far as generating dummy information goes, but the basic idea should be sound.  In this case, I&#8217;m stubbing the entire <code>DiectoryService.lookup</code> method for a particular DN, which I set in the headers, and returning &#8220;remote_xml&#8221; which is a stand in for the XML document that the remote system returns.  This lets me cut out the remote system, which wouldn&#8217;t appreciate being hit for all sorts of trash data every time the tests run, while still exercising most of the relevant internal code.</p>
<p>The general idea of an integration test is to see all of the pieces of the system working together.  At this point, Cucumber is exercising everything in the stack below Apache. Since certificates and x509 client certificates are largely dealt with <i>by</i> apache, we have to stub those ins and outs to work through the rest of the system.  The system is otherwise left unstubbed, and we check those integration points during manual testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2009/02/16/integration-testing-ssl-with-cucumber/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Spec a FormBuilder in RSpec</title>
		<link>http://devcaffeine.com/2009/02/06/spec-a-formbuilder-in-rspec/</link>
		<comments>http://devcaffeine.com/2009/02/06/spec-a-formbuilder-in-rspec/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 16:04:31 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://devcaffeine.com/?p=62</guid>
		<description><![CDATA[yesterday, I started trying to work on a helper for generating a frequently-repeated calendar widget for the rails app at $WORK.  Being the good BDDer that I am, I launched off a new spec to test the form builder &#8212; and to attempt to backfill specs and cover up the evidence of my naughty [...]]]></description>
			<content:encoded><![CDATA[<p>yesterday, I started trying to work on a helper for generating a frequently-repeated calendar widget for the rails app at $WORK.  Being the good <abbr title="behavior driven development">BDD</abbr>er that I am, I launched off a new spec to test the form builder &#8212; and to attempt to backfill specs and cover up the evidence of my naughty non-testing past.</p>
<p>This is a form builder we use in a couple of heavily used forms on the site, so we &#8220;know&#8221; this works, aside from the new code I want to add.  But in moving in to backfill some specs, I discovered that, like many things relating to form builders in rails, it&#8217;s not the easiest thing to do, nor is it exactly well documented &#8230;</p>
<p>After a bit of digging, I finally managed to work out the right setup to get this going.  Documented below for posterity</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># spec/helper/random_form_builder_spec.rb</span>
  describe RandomFormBuilder <span style="color:#9966CC; font-weight:bold;">do</span>
    attr_reader <span style="color:#ff3333; font-weight:bold;">:builder</span>, <span style="color:#ff3333; font-weight:bold;">:helper</span>
    before <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@helper</span> = <span style="color:#CC00FF; font-weight:bold;">Object</span>.<span style="color:#9900CC;">extend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">ActionView::Helpers::FormHelper</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@object</span> = stub_model<span style="color:#006600; font-weight:bold;">&#40;</span>Random<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@builder</span> = RandomFormBuilder.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:random</span>, <span style="color:#0066ff; font-weight:bold;">@object</span>, <span style="color:#0066ff; font-weight:bold;">@helper</span>, <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#0000FF; font-weight:bold;">nil</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>You can then spec as normal, calling methods on builder and verifying the result.</p>
<p>The tricky part is the constructor.</p>
<dl>
<dt>:random</dt>
<dd>This is the name of the object, by analog, the first argument of a  <tt>#form_for</tt></dd>
<dt>@object</dt>
<dd>The object you run with; where the form pulls field values from</dd>
<dt>@helper</dt>
<dd>this is the tricky one.  A form builder is really just a pass-through, decorating calls down to methods that live in FormHelper.  If you don&#8217;t have a template that defines the FormHelper methods, failures abound.</p>
<dt>{}</dt>
</dd>
<dd>Options for the FormBuilder.  Here, unused</dd>
<dt>nil</dt>
<dd>A proc</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2009/02/06/spec-a-formbuilder-in-rspec/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oracle and rails 1.2.1</title>
		<link>http://devcaffeine.com/2007/02/08/rails-12-database-indexes/</link>
		<comments>http://devcaffeine.com/2007/02/08/rails-12-database-indexes/#comments</comments>
		<pubDate>Thu, 08 Feb 2007 23:09:53 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://devcaffeine.com/2007/02/08/rails-12-database-indexes/</guid>
		<description><![CDATA[Grrr &#8230; So, in the course of updating to rails 1.2, it seems that the automagically generated names for database indexes were changed.  Went from &#8220;#{table}_#{columns}_index&#8221; to &#8220;index_#{table}_on_#{columns}&#8221; &#8230; an annoying little change that bumps me up against some sort of Oracle column name length ceiling.  And has the effect of probably breaking [...]]]></description>
			<content:encoded><![CDATA[<p>Grrr &#8230; So, in the course of updating to rails 1.2, it seems that the automagically generated names for database indexes were changed.  Went from &#8220;#{table}_#{columns}_index&#8221; to &#8220;index_#{table}_on_#{columns}&#8221; &#8230; an annoying little change that bumps me up against some sort of Oracle column name length ceiling.  And has the effect of probably breaking down migrations.</p>
<p>So, I&#8217;m gonna jump into the migrations and patch the existing add_index calls to specify a :name => value for all of the existing indexes, so that migrations will actually <i>work</i> and leave me with a database that matches the one in production &#8230;. </p>
<p>Figuring out why I suddenly couldn&#8217;t build my test database was not exactly the way I meant to spend the last hour &#8230;.</p>
<p><b>Update</b></p>
<p>Changeset 4768 is responsible for all this.  Apparently, to allow reverse parsing of the indexes from the index name.  Not alltogether a bad goal, but it still breaks down migrations &#8230;  (thanks to <a href=http://blog.twifkak.com/articles/2007/02/08/using-rails-migrations-add-remove_index-upgrading-to-1-2">Devin</a> for find this one)</p>
<p>And, I discovered another problem last night.  Seems that all of my text fields have a default value of &#8220;empy_clob()&#8221;  &#8230; not the function, but <i>that actual string</i>.  Sort of trashes one&#8217;s assumptions about unset fields.  Apparently (thanks Roy) this has been worked out in <a href="http://dev.rubyonrails.org/ticket/7344">ticket 7344</a> and already applied to Edge.  Some sort of thing that only applies to Oracle, because, of course, nobody tests Rails on Oracle, it&#8217;s all MySQL.  And I can&#8217;t really look into the patch attached to the ticket, because I keep getting Trac errors.  Shaping up to have been a lovely adventure &#8230;</p>
<p><b>update</b><br />
Finally got through to the site, and worked out a monkey patch to fix this.  For those of you who might be running with oracle, and can&#8217;t upgrade to Edge (gee, wonder why not) the patch is below.   This is a temporary thing, given that the ticket is closed, and will hopefully be fixed in 1.2.2 &#8230;<br />
[ruby]<br />
class ActiveRecord::ConnectionAdapters::OracleColumn<br />
  attr_writer :default<br />
end if defined? ActiveRecord::ConnectionAdapters::OracleColumn</p>
<p>class ActiveRecord::ConnectionAdapters::OracleAdapter<br />
  def quote(value, column = nil) #:nodoc:<br />
    if value &#038;&#038; column &#038;&#038; [:text, :binary].include?(column.type)<br />
      %Q{empty_#{ column.sql_type.downcase rescue &#8216;blob&#8217; }()}<br />
    else<br />
       super<br />
    end<br />
  end</p>
<p>  alias columns_orig columns<br />
  def columns(*a)<br />
    columns_orig(*a).each do |col|<br />
      col.default = nil if col.default =~ /^(null|empty_[bc]lob())$/i<br />
    end<br />
  end<br />
end if defined? ActiveRecord::ConnectionAdapters::OracleAdapter<br />
[/ruby]</p>
<p>This appears to do the trick &#8230; a dump of the test schema no longer defaults all of our text columns to &#8220;empty_clob()&#8221; and tests are again passing  &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2007/02/08/rails-12-database-indexes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Railsconf 2007</title>
		<link>http://devcaffeine.com/2007/02/08/railsconf-2007/</link>
		<comments>http://devcaffeine.com/2007/02/08/railsconf-2007/#comments</comments>
		<pubDate>Thu, 08 Feb 2007 17:07:49 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://devcaffeine.com/2007/02/08/railsconf-2007/</guid>
		<description><![CDATA[I&#8217;m signed up for railsconf 2007, which runs in late May of 2007, up in Portland, Oregon.  Looks like I&#8217;m one of about 10 NoVaRUG members going.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m signed up for <a href="http://conferences.oreillynet.com/rails/">railsconf 2007</a>, which runs in late May of 2007, up in Portland, Oregon.  Looks like I&#8217;m one of about 10 <a href="http://novarug.org">NoVaRUG</a> members going.</p>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2007/02/08/railsconf-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A breather, of sorts</title>
		<link>http://devcaffeine.com/2007/01/29/a-breather-of-sorts/</link>
		<comments>http://devcaffeine.com/2007/01/29/a-breather-of-sorts/#comments</comments>
		<pubDate>Mon, 29 Jan 2007 17:47:50 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://devcaffeine.com/2007/01/29/a-breather-of-sorts/</guid>
		<description><![CDATA[So, after a marathon at work, we deployed our first delivery of the appilcation I&#8217;ve been working on since July.  It&#8217;s an enterprise application, on a private intranet, so no links.  However, it&#8217;s fair to say that we&#8217;ll be getting hits from a wide variety of sources.  It should be good to [...]]]></description>
			<content:encoded><![CDATA[<p>So, after a marathon at work, we deployed our first delivery of the appilcation I&#8217;ve been working on since July.  It&#8217;s an enterprise application, on a private intranet, so no links.  However, it&#8217;s fair to say that we&#8217;ll be getting hits from a wide variety of sources.  It should be good to see how well it holds up.</p>
<p>Right now, it&#8217;s deployed using the standard-mongrel-rails-stack &#8482;, using 2 mongrel servers, all on one box.  Seems to be holding up very well.  As a note, moving your session store off the disc and into the database (ARSeession) does wonderful things for performance.  Down side:  It appears that a Text field in oracle is capped out at 4096b.  Which puts an upper limit on an individual session size.  Not necessarily a bad thing, but it&#8217;s likely to bite us in the butt at some point.</p>
<p>To top off the deployment exctiement, I&#8217;m buying a house.  Closing comes in on Wednesday.  We&#8217;ve already been through and plotted everything out.  New appliances are ordered and on their way, buying up lighting fixtures, picking out paint colors &#8230; it&#8217;s pretty much all done but the installation, which is scheduled for Friday.</p>
<p>So, after about a month, I finally get a chance to breath.  So, what am I doing?  Refocusing on Dark Sun stuff.  Lots to do there, including actually following through on the site.  At least <em>that</em> one will be public &#8230; <img src='http://devcaffeine.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2007/01/29/a-breather-of-sorts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>moment of truth</title>
		<link>http://devcaffeine.com/2006/08/30/moment-of-truth/</link>
		<comments>http://devcaffeine.com/2006/08/30/moment-of-truth/#comments</comments>
		<pubDate>Wed, 30 Aug 2006 17:30:55 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.devcaffeine.com/2006/08/30/moment-of-truth/</guid>
		<description><![CDATA[Well, after about two months of solid work, with one other developer and a UI/graphics guy, we&#8217;ve managed to produce a webapp redesign for work.  The system is basically a really big CMS, where the data gets fed to the database through some backend processing, and the producer side users are building the contents [...]]]></description>
			<content:encoded><![CDATA[<p>Well, after about two months of solid work, with one other developer and a UI/graphics guy, we&#8217;ve managed to produce a webapp redesign for work.  The system is basically a really big CMS, where the data gets fed to the database through some backend processing, and the producer side users are building the contents of various pages from those building blocks.  It&#8217;s sort of like building up the pages of a newspaper site.  At least, that&#8217;s the idea.</p>
<p>We demo today, which will basically determine whether or not we get to keep running with this little experement.  At the moment it&#8217;s a <i>very</i> functional proof of concept.  Covers all the basics, but &#8230; well, I wouldn&#8217;t call it robust just yet.  Early demos have gone well, but this is the important one.</p>
<p>In all, I&#8217;d have to say that I&#8217;ve picked up a <i>lot</i> of Ruby on Rails knowledge, so it&#8217;s been a good experience in that respect, regardless of outcome.</p>
<p>I&#8217;m sure the demo will go well, but some of the guys havn&#8217;t gotten much sleep last night.  Not much point in loosing sleep, what will be will be.  And really, the demo <i>will</i> go well.  Whether or not we get to take this beyond a proof-of-concept is, sadly, a matter of politics, and just a little bit out of my sphere of control.  Hence, no sense worrying about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2006/08/30/moment-of-truth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>getting started</title>
		<link>http://devcaffeine.com/2006/07/03/getting-started/</link>
		<comments>http://devcaffeine.com/2006/07/03/getting-started/#comments</comments>
		<pubDate>Mon, 03 Jul 2006 19:00:29 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.devcaffeine.com/2006/07/03/getting-started/</guid>
		<description><![CDATA[First day at new project today.
Of course, I&#8217;m mired in various bureacratic setup issues &#8230; you know, little things like system accounts and network access.
Promises to be interesting though.  My project manager has just come back from some kind of conference on agile development, and she seems to be quite fired up.  My [...]]]></description>
			<content:encoded><![CDATA[<p>First day at new project today.</p>
<p>Of course, I&#8217;m mired in various bureacratic setup issues &#8230; you know, little things like system accounts and network access.</p>
<p>Promises to be interesting though.  My project manager has just come back from some kind of conference on agile development, and she seems to be quite fired up.  My network access issues look to be somewhat mitigated by the fact that she wants to give pair programming a good try &#8230; so, it turns out that I won&#8217;t actually need my accounts and such right away.  I&#8217;ve never really done pair programming before, but it should be an interesting experience&#8230;  The other developer I&#8217;m pairing with knows what he&#8217;s talking about, as far as the depths of Ruby go, so at least <i>I</i> will get something out of it &#8230; <img src='http://devcaffeine.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2006/07/03/getting-started/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apt-get install sun-java5-jdk</title>
		<link>http://devcaffeine.com/2006/05/16/apt-get-install-sun-java5-jdk/</link>
		<comments>http://devcaffeine.com/2006/05/16/apt-get-install-sun-java5-jdk/#comments</comments>
		<pubDate>Tue, 16 May 2006 20:06:49 +0000</pubDate>
		<dc:creator>cflipse</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devcaffeine.com/2006/05/16/apt-get-install-sun-java5-jdk/</guid>
		<description><![CDATA[via SunMink:
JDK on GNU/Linux 
Finally!
I&#8217;ve been running Debian for &#8230; oh, eight years or so, I think.  Moved to debian during the libc6 update, because I didn&#8217;t want to upgrade my slackware system myself.  Debian has, without a dobut, the best packaging system in the linux/unix world.
Of course, it also has some of [...]]]></description>
			<content:encoded><![CDATA[<p>via <a href="http://blogs.sun.com/roller/page/webmink">SunMink</a>:<br />
<a href="http://blogs.sun.com/roller/page/webmink?entry=jdk_on_gnu_linux_something">JDK on GNU/Linux </a></p>
<p>Finally!</p>
<p>I&#8217;ve been running Debian for &#8230; oh, eight years or so, I think.  Moved to debian during the libc6 update, because I didn&#8217;t want to upgrade my slackware system myself.  Debian has, without a dobut, the best packaging system in the linux/unix world.</p>
<p>Of course, it also has some of the most opinionated, bigoted and stubborn people in the linux/unix world.  And, by bigoted, I mean &#8220;against anything not Free&#8221;.  The current fight is with the <a href="http://fsf.org/">Free Software Foundation</a> (!) over the GNU Free Documentation License.  Debian seems to belive that it&#8217;s not free enough, and is currently removing whole swaths of manuals and documentation because of it.</p>
<p>This approach has actually been remarkably effective in the past &#8212; Debian is primarily responsible for changing KDE&#8217;s licence back in the late 90&#8217;s because they refused to distribute it.</p>
<p>So, in some sense, it&#8217;s not surprising to see that they were working on a mutually agreeable license with Sun.  On the other hand, Java has been shipped under the same license for most of it&#8217;s 10 year history &#8212; ever since JDK2 came out, really.  It&#8217;s surprising to see that inertia shift directions.</p>
<p>It&#8217;ll certainly make the packaging and distribution of java-based applications much easier.  This goes in the &#8220;win&#8221; column.</p>
]]></content:encoded>
			<wfw:commentRss>http://devcaffeine.com/2006/05/16/apt-get-install-sun-java5-jdk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
