<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Sacramento Software Development</title>
	
	<link>http://www.particlewave.com/internet-marketing</link>
	<description>ParticleWave.com - Web development on Ruby on Rails</description>
	<lastBuildDate>Fri, 03 Jul 2009 03:23:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/InklitcomWritingBlog" type="application/rss+xml" /><feedburner:emailServiceId>InklitcomWritingBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Ruby on Rails Enumerations and Fixtures</title>
		<link>http://feedproxy.google.com/~r/InklitcomWritingBlog/~3/taKM2EZUCyQ/</link>
		<comments>http://www.particlewave.com/internet-marketing/2009/06/30/ruby-enumerations-and-fixtures/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 18:37:31 +0000</pubDate>
		<dc:creator>John Lockwood</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Enumerations]]></category>
		<category><![CDATA[Fixtures]]></category>
		<category><![CDATA[Rails Tips]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ruby Tips]]></category>

		<guid isPermaLink="false">http://www.particlewave.com/internet-marketing/?p=356</guid>
		<description><![CDATA[I had to figure out Ruby on Rails enumerations and fixtures today.  
The solution will be here in just a moment, but first, some gratuitous background:  I was working on a Person resource &#8212; or a &#8220;Contact&#8221; resource if you prefer your people to have a CRM flare to them.  Naturally, hanging [...]]]></description>
			<content:encoded><![CDATA[<p>I had to figure out Ruby on Rails enumerations and fixtures today.  </p>
<p>The solution will be here in just a moment, but first, some gratuitous background:  I was working on a Person resource &#8212; or a &#8220;Contact&#8221; resource if you prefer your people to have a CRM flare to them.  Naturally, hanging off of these People (or Contacts) are as many phone numbers as they might have.</p>
<p>Twenty-first century people have a lot of phones.</p>
<p>Once you start having contacts who own lots of phones, naturally you want to know if you&#8217;re bugging someone to buy your widgets on their cell phone or their home phone or what have you.</p>
<p>You don&#8217;t want to store whole strings to do this, so probably you end up with a line in your schema that looks something like this:<br />
<code><br />
    t.integer  "phone_type"<br />
</code></p>
<p>Well, that&#8217;s fine, but in your code you don&#8217;t want to be saying &#8220;p.phone_type = 2&#8243;, because that&#8217;s not all that readable.  </p>
<p>Now Ruby doesn&#8217;t have enums (BAD language &#8212; just for that you&#8217;re going straight to bed with no strong typing, young man).  It does, however, have constants, and this <a href="http://www.rubyfleebie.com/enumerations-and-ruby/">Rails tip</a> shows you how to use them.</p>
<p>Like me you may have opted for the simple &#8220;first approach&#8221; of adding the constants to your model, like so.</p>
<p><code><br />
class Phone < ActiveRecord::Base<br />
  # Type constants<br />
  HOME = 1<br />
  WORK = 2<br />
  CELL = 3<br />
  # ... more model code ...<br />
end<br />
</code></p>
<p>Well, all that's well and good, but then what do you do about your fixtures?  Remember, your whole point in starting on this Enumeration journey was to get your code more readable, not less, so if you end up having fixtures that look like this, that's not a good outcome:<br />
<code><br />
et_the_extra_terestrial:<br />
  id:                     1<br />
  person_id:        1<br />
  phone_num:     9165551212<br />
  phone_type:     1<br />
</code></p>
<p>Phone_type:    1<br />
At about this point, I remembered that one of my Rails books said something about dynamic fixtures.  Looking those up, it was easy enough to get ET's phone looking the way it should in no time.</p>
<p><code><br />
et_the_extra_terestrial:<br />
  id:                     1<br />
  person_id:        1<br />
  phone_num:     9165551212<br />
  phone_type:     <%= Phone::HOME %><br />
</code></p>
<p>And there you have it, Bob's you're uncle, and Drew Barrymore's your hot aunt.</p>
<img src="http://feeds.feedburner.com/~r/InklitcomWritingBlog/~4/taKM2EZUCyQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.particlewave.com/internet-marketing/2009/06/30/ruby-enumerations-and-fixtures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.particlewave.com/internet-marketing/2009/06/30/ruby-enumerations-and-fixtures/</feedburner:origLink></item>
		<item>
		<title>Using Ruby Fixtures at the Console</title>
		<link>http://feedproxy.google.com/~r/InklitcomWritingBlog/~3/NS_fE3Ja8xU/</link>
		<comments>http://www.particlewave.com/internet-marketing/2009/06/27/using-ruby-fixtures-at-the-console/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 17:59:41 +0000</pubDate>
		<dc:creator>John Lockwood</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.particlewave.com/internet-marketing/?p=344</guid>
		<description><![CDATA[At the risk of showing how (not) far I am along the learning curve given my Month of Sundays Rails project, here&#8217;s a great beginner sort of   rails tip I found on how to load fixtures into the console.
The meat of it is this, which I like because it simultaneously shows you how [...]]]></description>
			<content:encoded><![CDATA[<p>At the risk of showing how (not) far I am along the learning curve given my Month of Sundays Rails project, here&#8217;s a great beginner sort of   <a href="http://www.railsforum.com/viewtopic.php?id=11479">rails tip</a> I found on how to load fixtures into the console.</p>
<p>The meat of it is this, which I like because it simultaneously shows you how to set up your environment correctly for the console, and for rake.  Not a bad little tutorial for two lines worth of stuff:<br />
<code><br />
rake db:fixtures:load RAILS_ENV=test<br />
script/console test<br />
</code></p>
<img src="http://feeds.feedburner.com/~r/InklitcomWritingBlog/~4/NS_fE3Ja8xU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.particlewave.com/internet-marketing/2009/06/27/using-ruby-fixtures-at-the-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.particlewave.com/internet-marketing/2009/06/27/using-ruby-fixtures-at-the-console/</feedburner:origLink></item>
		<item>
		<title>Software At The Speed of Part Time</title>
		<link>http://feedproxy.google.com/~r/InklitcomWritingBlog/~3/3L0hTT88f0Q/</link>
		<comments>http://www.particlewave.com/internet-marketing/2009/06/20/software-at-the-speed-of-part-time/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 08:03:25 +0000</pubDate>
		<dc:creator>John Lockwood</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.particlewave.com/internet-marketing/?p=339</guid>
		<description><![CDATA[I&#8217;ve been working on a Rails application, not all the live long day, but generally on a long Friday night and part of Saturday.
Being self-employed during the boom years, now that we&#8217;re in a recession I own a real estate company for pin money, and have a full time ecological niche banging on legacy C [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a Rails application, not all the live long day, but generally on a long Friday night and part of Saturday.</p>
<p>Being self-employed during the boom years, now that we&#8217;re in a recession I own a real estate company for pin money, and have a full time ecological niche banging on legacy C code in a cube forest.  Following my ancestors, the hunter-gatherers, I am a typer-debugger.</p>
<p>On Friday nights I cut loose from the dusty streets of this one horse Bruce Springsteen song, and do, what exactly?</p>
<p>More typing.</p>
<p>Because I hope to get paid for this Rails application eventually, I have to go at it weekend after weekend.  But because I&#8217;m not yet getting paid for it yet, and because even if I ever will I&#8217;ll be more or less in charge of its direction, I enjoy it as a creative outlet.</p>
<p>The speed of part time takes some getting used to.   Software is one of those things where you start to really get rolling on whatever language it is you happen to be using this year after several weeks of being back in that environment.  Sure, you can be semi-productive on day one, but by week 12 you&#8217;re cruising along nicely.</p>
<p>When we say week twelve, though, that&#8217;s for a full time gig.  When you get a day of programming per week, then multiply everything by five, given what would have been your five day work week.  So twelve weeks becomes sixty.</p>
<p>Programming at the speed of part time, a six month project takes two and a half years.</p>
<p>To be sure, you have a bit more than a day per weekend you can conceivably put in, but on the minus side, you&#8217;re having to keep it all in memory after flushing C through your brain all week.</p>
<p>Needless to say, the hardest part of such a project is staying encouraged after four months or so, with a mere few weeks of progress seeming to show for one&#8217;s efforts.</p>
<p>It&#8217;s amazing to see how &#8220;the economy&#8221; changes things.  It seems like all the coffee shops around here are closed.  During the boom years, when one could make a living by blogging alone, I used to go out with all the other high-on-the-hog heloc bailout recipients and enjoy my French roasts.</p>
<p>Today I went out for my birthday mocha, and my old shop was closed, and the place I would go before I went to my old shop was closed.  To be sure, the coffee shops inside the supermarkets are still doing OK, rescued from collapse by their proximity to the produce.</p>
<p>I wonder if any of the old baristas who lost their jobs are now inside Safeway coffee shops, while working on their own chai latte projects on Friday nights.</p>
<p>I hope not.</p>
<img src="http://feeds.feedburner.com/~r/InklitcomWritingBlog/~4/3L0hTT88f0Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.particlewave.com/internet-marketing/2009/06/20/software-at-the-speed-of-part-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.particlewave.com/internet-marketing/2009/06/20/software-at-the-speed-of-part-time/</feedburner:origLink></item>
		<item>
		<title>SVN Recurisvely Show Unversioned Files</title>
		<link>http://feedproxy.google.com/~r/InklitcomWritingBlog/~3/6ODEyXx0kLg/</link>
		<comments>http://www.particlewave.com/internet-marketing/2009/06/19/svn-recurisvely-show-unversioned-files/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 04:18:27 +0000</pubDate>
		<dc:creator>John Lockwood</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://www.particlewave.com/internet-marketing/2009/06/19/svn-recurisvely-show-unversioned-files/</guid>
		<description><![CDATA[Try this:
svn status &#124; grep ?
Enjoy!
]]></description>
			<content:encoded><![CDATA[<p>Try this:</p>
<p>svn status | grep ?</p>
<p>Enjoy!</p>
<img src="http://feeds.feedburner.com/~r/InklitcomWritingBlog/~4/6ODEyXx0kLg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.particlewave.com/internet-marketing/2009/06/19/svn-recurisvely-show-unversioned-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.particlewave.com/internet-marketing/2009/06/19/svn-recurisvely-show-unversioned-files/</feedburner:origLink></item>
		<item>
		<title>A Farewell to SlickEdit</title>
		<link>http://feedproxy.google.com/~r/InklitcomWritingBlog/~3/SOISTBSLjGk/</link>
		<comments>http://www.particlewave.com/internet-marketing/2009/05/29/a-farewell-to-slickedit/#comments</comments>
		<pubDate>Sat, 30 May 2009 04:35:05 +0000</pubDate>
		<dc:creator>John Lockwood</dc:creator>
				<category><![CDATA[Random Particles]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.particlewave.com/internet-marketing/?p=333</guid>
		<description><![CDATA[For most men, a mid-life crisis involves either some young bimbo, a motorcycle, or both.  My own midlife crisis is unfolding somewhat differently.
In a couple of weeks, the age of fifty will come out to greet me, as the windshield greets the mayfly.   The local bimbos being unforthcoming, and Harley Davidsons being [...]]]></description>
			<content:encoded><![CDATA[<p>For most men, a mid-life crisis involves either some young bimbo, a motorcycle, or both.  My own midlife crisis is unfolding somewhat differently.</p>
<p>In a couple of weeks, the age of fifty will come out to greet me, as the windshield greets the mayfly.   The local bimbos being unforthcoming, and Harley Davidsons being too noisy, I am learning a new text editor.</p>
<p>For many years, my editor of choice has been Visual SlickEdit, with Brief emulation turned on.  This worked fine for me, especially as long as I was coding web sites for my real estate business and not really feeling myself to be in the Programmer Swing of Things.</p>
<p>Over the years when I was in the Programmer Swing of Things, however, I had previously spent hundreds of dollars on SlickEdit upgrades.  I can count no less than seven SlickEdit boxes here in the study, which tells me I&#8217;ve been through one Linux version and at least six versions of the Windows product.  So naturally lately when I started to really get into Ruby on Rails, I thought I&#8217;d check out what kind of upgrade I&#8217;d be eligible for, so I could take advantage of the latest language support feature.</p>
<p>It turns out I&#8217;m not eligible for an upgrade.   The SlickEdit site has a tool where you enter your license number, and the web site says, in effect:  S-U-C-K-E-R!  You want to develop on Linux and Windows and get the latest features after buying seven licenses already?  Sorry, that&#8217;ll be six hundred dollars more.</p>
<p>They&#8217;re not Microsoft, but they&#8217;re in the same religion.</p>
<p>I decided at this point that VIM was really worth taking another look at.  I&#8217;ve used it sporadically over the years, usually when connecting to an ISP on a shell account and needing to get something done in a hurry.  In the last few weeks, I decided to start using it systematically, remembering from my Brief days that after a couple of weeks of pain I&#8217;d be liking the world again.  Now I&#8217;m up to the point where I&#8217;m somewhat competent.  Some things still go too slowly, but I&#8217;ve found that if I open up SlickEdit my fingers are already trying to make GVIM work, not Brief.</p>
<p>On the Ruby front, Tim Pope&#8217;s <a href="http://www.vim.org/scripts/script.php?script_id=1567">Vim Ruby Plugin</a> is a solidly competent free tool for navigating Rails code and getting pretty much anything else done in Rails without resorting to the terminal (unless you happen to feel like resorting to the terminal, of course).</p>
<p>GVIM  works great on Linux, of course, and with a minor wrinkle or two (like using CTRL-Q for &#8220;Visual Block&#8221; instead of CTRL-V), it works great on Windows, too.   If you find it useful you&#8217;re asked to help the <a href="http://iccf-holland.org/">Ugandan Children</a>, but outside of that it&#8217;s free.</p>
<p>So that&#8217;s my midlife crisis, in its nerdly nutshell.  No harlot, no Harley:  just me and my new editor, which I like very much, and a lot of useless SlickEdit boxes.</p>
<img src="http://feeds.feedburner.com/~r/InklitcomWritingBlog/~4/SOISTBSLjGk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.particlewave.com/internet-marketing/2009/05/29/a-farewell-to-slickedit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.particlewave.com/internet-marketing/2009/05/29/a-farewell-to-slickedit/</feedburner:origLink></item>
		<item>
		<title>Graphical Unit Testing for Ruby on Windows</title>
		<link>http://feedproxy.google.com/~r/InklitcomWritingBlog/~3/Fcl49qck2YI/</link>
		<comments>http://www.particlewave.com/internet-marketing/2009/05/08/graphical-unit-testing-for-ruby-on-windows/#comments</comments>
		<pubDate>Sat, 09 May 2009 04:46:46 +0000</pubDate>
		<dc:creator>John Lockwood</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://www.particlewave.com/internet-marketing/?p=331</guid>
		<description><![CDATA[In my last post I discussed some of the pros and cons of Ruby on Rails versus .NET.  One of my complaints at the time was that Ruby lacks a good graphical unit test runner, because I&#8217;m a sucker for a green bar.  I also complained that running tests is cumbersome on Windows.
Tonight [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post I discussed some of the pros and cons of Ruby on Rails versus .NET.  One of my complaints at the time was that Ruby lacks a good graphical unit test runner, because I&#8217;m a sucker for a green bar.  I also complained that running tests is cumbersome on Windows.</p>
<p>Tonight I decided to see if there was a green bar to be had anywhere in the Ruby world, and the answer is this:  well, yes, if you&#8217;re running on Linux, and if you&#8217;re running Windows, well, sort of.  The good news is that Ruby does have a graphical test runner &#8212; in my case it lives in ruby\lib\ruby\1.8\test\unit\ui\gtk2.  You can learn how to set up <a href="http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows">Ruby GTK on Windows here</a>.   Also even though the source clearly wants gtk2, and the web site warns that that&#8217;s not fully supported on Windows, it does appear to be working.  I must say the treeview is a lot more primitive than NUnit&#8217;s, and you don&#8217;t get to see which tests passed &#8212; though of course you get the more important information about which ones failed and where.  And most of all, you get the green bar.  Sweet, beautiful green telling you the world is OK.</p>
<p>And in spite of what the docs say about ActiveSupport::TestCase being derived from Object, it&#8217;s not &#8212; it&#8217;s derived from ::Test::Unit::TestCase as it should be, at least in the code I&#8217;m looking at.  Like I said before:  Ruby documentation makes Jesus cry.  And I&#8217;m not even religious.</p>
<img src="http://feeds.feedburner.com/~r/InklitcomWritingBlog/~4/Fcl49qck2YI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.particlewave.com/internet-marketing/2009/05/08/graphical-unit-testing-for-ruby-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.particlewave.com/internet-marketing/2009/05/08/graphical-unit-testing-for-ruby-on-windows/</feedburner:origLink></item>
	</channel>
</rss>
