<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Beautiful Pixel - Home</title>
  <id>tag:beautifulpixel.com,2008:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://beautifulpixel.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://beautifulpixel.com/" rel="alternate" type="text/html"/>
  <updated>2008-07-21T19:07:13Z</updated>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-07-21:1717</id>
    <published>2008-07-21T02:23:00Z</published>
    <updated>2008-07-21T19:07:13Z</updated>
    <category term="Objective C"/>
    <link href="http://beautifulpixel.com/2008/7/21/objective-c-syntax" rel="alternate" type="text/html"/>
    <title>Objective-C Syntax</title>
<content type="html">
            &lt;p&gt;I&#8217;m still trying to learn Objective-C and Cocoa here, and coming from Ruby, its an interesting experience.&lt;/p&gt;


	&lt;h3&gt;Method calling Syntax&lt;/h3&gt;


	&lt;p&gt;I simultaneously love and hate the method calling syntax.  Take this for example:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;[UIColor colorWithRed:1.0 green:1.0 blue:1.0];&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This create an instance of the UIColor class with red green and blue values as specified, in this case white.  I do like that the parameters are labeled, and I like that better than simply passing in a list of anonymous argument that most languages give you.&lt;/p&gt;


	&lt;p&gt;But what I don&#8217;t like is the method name being forced to mingle with the arguments.  Semantically, red, green, and blue are all equal things.  However I am forced to prepend the declaration of the red value with this &lt;code&gt;colorWith&lt;/code&gt; prefix.  The named parameters actually &lt;em&gt;are&lt;/em&gt; the method name.  According to the langauge internals, the name of this method is:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;colorWithRed:green:blue:&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Here&#8217;s how I might do the same thing in ruby:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;UIColor.new(1.0, 1.0, 1.0)&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Although, this requires some formal knowledge that the order of arguments is red, then green, then blue.  But I can easily remember this since its a basic language feature.&lt;/p&gt;


	&lt;p&gt;Usually I don&#8217;t mind long method names, but when handling things as simple as initialization, it seems like I should have to look up the syntax.  Long ruby method names aren&#8217;t too much of a problem, because they only have one part.  Objective-C methods tend to be more verbose, and its hard to know where the arguments go and what type the arguments are supposed to be.&lt;/p&gt;


	&lt;p&gt;The result is that I can&#8217;t possibly imagine writing Objective-C without a code completing &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt;.  I have written huge amounts of ruby in Textmate, and really don&#8217;t miss code completion much.  Maybe I just have to get used to the &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; mindset.&lt;/p&gt;


	&lt;h3&gt;Objects and non-Objects&lt;/h3&gt;


	&lt;p&gt;Ruby has spoiled me.  Everything is an object in ruby.  A string, a number, a chunk of code, everything.  Even a class is an instance of the class &lt;code&gt;Class&lt;/code&gt;.&lt;/p&gt;


	&lt;p&gt;In Objective-C the story is different.  An object is an instance of a class that inherits from the &lt;code&gt;NSObject&lt;/code&gt; class.  Basically this means that the only things that are objects are things that are provided by Cocoa.  Other things that are provided by the underlying C, like floats, strings and whatnot are not objects.  Although, to be fair, Cocoa provides object based wrappers for most of the C non object primitives, but its not always worth the overhead to use them for simple stuff.&lt;/p&gt;


	&lt;p&gt;This makes the syntax a bit of a mess.  The bracket method calling syntax only works on objects, because a non object (I dont even know what to call it) cant have methods at all.  And then you have calls to C functions like:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;UIGetCurrentGraphicsContext()&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Which doesn&#8217;t even use the bracket syntax at all.  I&#8217;m sure I will get used to all this, but I can&#8217;t help but feel this language would be a lot more fun if everything was an object.  I think most people go from something like C to ruby, but I am going the other way around, and it&#8217;s odd.  We&#8217;ll see where this goes.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-07-20:1716</id>
    <published>2008-07-20T19:36:00Z</published>
    <updated>2008-07-20T20:40:46Z</updated>
    <category term="FlexImage"/>
    <category term="Ruby"/>
    <link href="http://beautifulpixel.com/2008/7/20/ie7-header-issues" rel="alternate" type="text/html"/>
    <title>IE7 header issues</title>
<content type="html">
            &lt;p&gt;I got to deploy a new build to &lt;a href=&quot;http://thewinespies.com&quot;&gt;TheWineSpies.com&lt;/a&gt; this weekend, which among many other things, upgraded the app to rails 2.1.  This process had me refactoring the admin to be RESTfull-er, and incorporating the latest version of Fleximage.  I thought everything was dandy.&lt;/p&gt;


	&lt;h3&gt;The Problem&lt;/h3&gt;


	&lt;p&gt;My client was doing some testing on this code with &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt;, their browser of choice.  But something odd was happening.  They would click a link triggering a resources &lt;code&gt;show&lt;/code&gt; action, and instead of a html page about that resource, they would just get the image.  At first I was stumped.  I never thought cross browser issues could change server behavior.  Firefox got a page of &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; got an image.  And I confirmed that the server was actually sending different content to the different browsers.  The truly bizarre part, was that after clicking a link to this page, you could refresh and get the content you were expecting.&lt;/p&gt;


	&lt;p&gt;What the hell?&lt;/p&gt;


	&lt;h3&gt;The Code&lt;/h3&gt;


	&lt;p&gt;The Wine Spies uses Fleximage enahnced models across a few different resources, but here is a simple action that was causing me grief.&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;show&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;iv&quot;&gt;@product&lt;/span&gt; = &lt;span class=&quot;co&quot;&gt;Product&lt;/span&gt;.find(params[&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;])&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  respond_to &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |format|&lt;tt&gt;
&lt;/tt&gt;    format.html&lt;tt&gt;
&lt;/tt&gt;    format.jpg  { render &lt;span class=&quot;sy&quot;&gt;:template&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/some/path/small.flexi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; }&lt;tt&gt;
&lt;/tt&gt;    format.xml  { render &lt;span class=&quot;sy&quot;&gt;:xml&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@product&lt;/span&gt;.to_xml }&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This is pretty straightforward.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;If &lt;code&gt;html&lt;/code&gt; is requested, render the default template&lt;/li&gt;
		&lt;li&gt;If &lt;code&gt;jpg&lt;/code&gt; is requested, render some &lt;code&gt;.flexi&lt;/code&gt; template&lt;/li&gt;
		&lt;li&gt;If &lt;code&gt;xml&lt;/code&gt; is requested, dump the object to xml and send it out&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;But still, &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; on a url of &lt;code&gt;/products/123&lt;/code&gt; would trigger the &lt;code&gt;jpg&lt;/code&gt; format renderer.  Somehow rails was thinking that &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; &lt;em&gt;wanted&lt;/em&gt; a jpeg image instead of &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;.  Where other browser were making rails think they want &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; unless overridden by a format extension on the url.&lt;/p&gt;


	&lt;h3&gt;Tracking down the cause&lt;/h3&gt;


	&lt;p&gt;I began to think back to the &lt;span class=&quot;caps&quot;&gt;DHH&lt;/span&gt; keynote &#8220;World of Resources&#8221; and some of the early stuff that was forming around rails, and luckily, I remembered something important.  I tend to use this format pattern a lot, and I usually trigger it by url extensions like &lt;code&gt;/products/123.jpg&lt;/code&gt; or &lt;code&gt;/products/123.xml&lt;/code&gt;.  But rails looks at something else too.&lt;/p&gt;


	&lt;p&gt;Your browser, or any &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; client, sends along a header named &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; with any request.  I decided to add some debug code to my action to see what was in this header:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;raise request.headers[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;HTTP_ACCEPT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;In Firefox 3, the result was (minor edit for simplicity):&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;text/html,application/xhtml+xml,application/xml,*&lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This is a comma separated list of &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt; types.  The purpose of this header is to let to receiver know what kind of data the client wants, or what it will &#8220;accept&#8221;.  It&#8217;s a prioritized list where the first items are wanted &lt;em&gt;more&lt;/em&gt; then the items at the end of the list.  Firefox is saying &#8220;Please give me html.  If you don&#8217;t have that give me xhtml.  But I guess xml would be ok too if that&#8217;s all you got.  You got none of those?  Well give me whatever you got then, I don&#8217;t care.&#8221;&lt;/p&gt;


	&lt;p&gt;Ok what does &lt;strong&gt;&lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt;&lt;/strong&gt; send?&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/ag-plugin, *&lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;Until I refreshed the page, instead of clicking a link to this page, and got:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;*&lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;What the hell?&lt;/p&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; doesn&#8217;t say it wants &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; at all!  It says it would rather have a gif, bitmap, jpg, flash, or even a plugin, rather than any other &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt; type, including html.  Rails gets this header, and sees that is no explicit format on the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;, so it goes down the list:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Does this action respond to the &lt;code&gt;image/gif&lt;/code&gt; format? nope.&lt;/li&gt;
		&lt;li&gt;How about the &lt;code&gt;image/x-bitmap&lt;/code&gt; format? no.&lt;/li&gt;
		&lt;li&gt;Maybe the &lt;code&gt;image/jpeg&lt;/code&gt; format? Oh look at that yes it does!&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;The item that would have matched the html renderer &lt;code&gt;*/*&lt;/code&gt; is too far down the list, and we don&#8217;t get to it before a suitable responder is found.&lt;/p&gt;


	&lt;p&gt;Since &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; sends a different &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; of &lt;code&gt;*/*&lt;/code&gt; on a refresh, it is declaring it has no preferred format at all.  Rails then renders the default: html.&lt;/p&gt;


	&lt;h3&gt;The Solution&lt;/h3&gt;


	&lt;p&gt;After trying many ways to capture the damn header, override it somehow, shoving some &lt;code&gt;Mime::Type&lt;/code&gt; object into &lt;code&gt;request.format&lt;/code&gt;, and other failed solutions, here is what I finally ended up with:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#application.rb&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;before_filter &lt;span class=&quot;sy&quot;&gt;:set_default_format&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;set_default_format&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  params[&lt;span class=&quot;sy&quot;&gt;:format&lt;/span&gt;] ||= &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This basically tells rails to ignore the &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; header.  If a format is not explicitly declared on the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;, then force it to be &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;.  It&#8217;s as if every html page on the site has a &lt;code&gt;.html&lt;/code&gt; appended to the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;And finally salvation from that circle of hell.&lt;/p&gt;


	&lt;h3&gt;Conclusions&lt;/h3&gt;


	&lt;p&gt;What makes a good &lt;code&gt;HTTP_ACCEPT&lt;/code&gt; header?  I think Firefox has it right.  Being a web browser, its main job is to display &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;, with embedded media.  So it should want &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; more than anything since the images are just there in support of the html (mostly anyway).&lt;/p&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; makes 2 mistakes:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;It sends different headers depending on how the page was loaded&lt;/li&gt;
		&lt;li&gt;It states that is prefers images over &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; headers are a powerful tool.  They can make interfacing with web applications and &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;&#8217;s much cleaner.  But as we depend on them increasingly, we need have a level of trust with the clients that people use to connect.  &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; said it wanted one thing, and I forced to create a hack in order to tell &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; &#8220;No, you don&#8217;t really want that.  You really want something else.&#8221;  And that makes me sad.&lt;/p&gt;


	&lt;p&gt;I thought clients who don&#8217;t know what they want are pain, but now browsers have the same problem.  &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; is a &lt;em&gt;huge&lt;/em&gt; improvement over &lt;span class=&quot;caps&quot;&gt;IE6&lt;/span&gt;, however it obviously still has its issues for web developers.  The simple fact is that both versions of this browser have cost me way too much time, and that means it cost me money.  The number of hours I have spent troubleshooting issues like this, as well as &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; and javascript issues, is way more than I want to admit to.&lt;/p&gt;


	&lt;p&gt;And that makes cranky.  So tell your parents, &#8220;Save a web developer.  Switch to Firefox.&#8221;  Then maybe the world will be a better place.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-05-21:1407</id>
    <published>2008-05-21T15:14:00Z</published>
    <updated>2008-05-21T15:35:56Z</updated>
    <category term="Ruby"/>
    <link href="http://beautifulpixel.com/2008/5/21/rails-documentation-patches" rel="alternate" type="text/html"/>
    <title>Rails Documentation Patches</title>
<content type="html">
            &lt;p&gt;I have just commited a &lt;a href=&quot;http://github.com/lifo/docrails/commit/028a236f102cb617d1c3e39d3de9d51b99c4fd61&quot;&gt;documentation patch to Rails&lt;/a&gt; which adds instructions on how to use &lt;code&gt;ActiveResource::HttpMock&lt;/code&gt; to test your ActiveResource models.  But the really cool thing is how easy it was to do.&lt;/p&gt;


	&lt;p&gt;If you ever have been frustrated because something wasnt documented clearly, or documented at all in the case of &lt;code&gt;ActiveResource::HttpMock&lt;/code&gt;, I really encourage you to fix up that part of the rails documentation and commit a patch.  The steps are simple:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Read the &lt;a href=&quot;http://github.com/lifo/docrails/wikis&quot;&gt; docrails conventions wiki page&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;Send lifo:&#8221;http://github.com/lifo&#8221; a message asking for commit access to the docrails project on GitHub.  You may want to include a brief description of what you intend to fix, just so he knows your cool.&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;git clone&lt;/code&gt; the docrails project, and write some documentation.&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;rake rdoc&lt;/code&gt; and review that the new documentation looks great when converted to &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;.&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;git commit&lt;/code&gt; and &lt;code&gt;git push&lt;/code&gt;, and you are now a rails contributor!&lt;/li&gt;
	&lt;/ol&gt;


&lt;hr /&gt;


	&lt;p&gt;A useful tool in this endeavor was &lt;code&gt;rstakeout&lt;/code&gt;.  It&#8217;s a &lt;a href=&quot;http://nubyonrails.com/articles/automation-with-rstakeout&quot;&gt;script by Geoffrey Grossenbach&lt;/a&gt; that allows to run a command everytime a set of watched files changed.  You can use it to run tests, compile &lt;a href=&quot;http://haml.hamptoncatlin.com/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HAML&lt;/span&gt; or &lt;span class=&quot;caps&quot;&gt;SASS&lt;/span&gt;&lt;/a&gt; outside of rails, or generate the documentation when you save.&lt;/p&gt;


	&lt;p&gt;Copy &lt;a href=&quot;http://svn.topfunky.com/public/scripts/rstakeout.rb&quot;&gt;this script&lt;/a&gt; to somewhere in your &lt;code&gt;PATH&lt;/code&gt; and make sure its executable.  Remove the &lt;code&gt;.rb&lt;/code&gt; extension so it can be called like any other command line program.  Now when working on the documentation:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;&lt;code&gt;cd&lt;/code&gt; into the rails component you are writing documentation for.&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;rstakeout &quot;rake rdoc&quot; lib/**/*&lt;/code&gt; This will watch all files in all directories directly under &lt;code&gt;lib&lt;/code&gt; for changes.  This is a typical glob format and you can use as many globs as you like if you want it to watch lots of files.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Now everytime you switch over the your browser, the newly generated docs will be up to date and waiting for you to preview them after a simple refresh.  Sure does save you some time.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-05-13:1380</id>
    <published>2008-05-13T17:58:00Z</published>
    <updated>2008-05-13T18:47:57Z</updated>
    <link href="http://beautifulpixel.com/2008/5/13/i-ve-seen-the-test-driven-light" rel="alternate" type="text/html"/>
    <title>I've seen the test driven light</title>
<content type="html">
            &lt;p&gt;Over the past few years I have known Test Driven Development was the way to go, but my execution of that has been far from consistent.&lt;/p&gt;


	&lt;p&gt;Sometimes I think my project is too small to worry about it.  But projects always get bigger than you think they will.  A small bit of code with no tests isn&#8217;t really a big deal.  But there is a certain project complexity threshold, where you can no longer keep the entire codebase in your head, when tests become an &lt;em&gt;absolute necessity&lt;/em&gt;.  As large bits of code become connected in an increasing number of ways, you need tests to ensure that unexpected things don&#8217;t break.  And writing tests first ensure allows you to focus on just what your implementing without getting lost in the large and complicated guts of your app.  The trouble is that when you start a project you don&#8217;t always know if it will reach that threshold.&lt;/p&gt;


	&lt;p&gt;Sometimes I think that I can just write tests later.  After following this pattern many times, I can assure you, it is at least twice as slow as writing tests first, and your test coverage is far worse.  The problem is that you have to root through your code and figure out what to test and how to test it.  Coverage suffers because you are sure to miss branches of code, partly because you simply missed them, and partly because you are tired of writing tests.  It just feels tedious to tread on through, writing code hours that adds no functionality to your application.  It&#8217;s not fun.&lt;/p&gt;


	&lt;p&gt;Writing the tests first does a few things to make life easier:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Write a small test, write a bit of code, is a cycle that remains fresh and fun because you are not stuck writing only tests for hours on end.&lt;/li&gt;
		&lt;li&gt;Only writing code if you have a failing test keeps you focused.  Its easy to get side tracked, fixing this and that, introducing more code changes before you are done with the current task.  Focusing on smaller goals helps you code faster because there are less variables to think about all at once.&lt;/li&gt;
		&lt;li&gt;Implement features with almost no manual testing.  With a tool like &lt;code&gt;autotest&lt;/code&gt; its easy to add features or fix bugs without ever leaving your code editor.  When all tests pass, you know you did it.  One cursory manual test to confirm, is a lot faster than manually testing the features everytime you make a minor code change.&lt;/li&gt;
		&lt;li&gt;There is something very satisfying about seeing that &#8220;0 failures, 0 errors&#8221; after 45 minutes of hacking.  It&#8217;s a carrot, and you just want to keep chasing it.  When you get it, you just write another carrot to chase.  It&#8217;s an addictive cycle.&lt;/li&gt;
		&lt;li&gt;The ruby community will like you more.  All the cool kids do it.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;None of this is novel or new for those who practice this.  It&#8217;s simply my own journey to the &lt;span class=&quot;caps&quot;&gt;TDD&lt;/span&gt; religion.  To be honest I am just really tired of writing tests after a large body of code has been written.  It&#8217;s a painful and tedious process.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://railsenvy.com/2007/10/4/how-i-learned-to-love-testing-presentation&quot;&gt;Checkout this is awesome presentation from RailsEnvy.com&#8217;s Greg Polluck&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;iv&quot;&gt;@blog_post&lt;/span&gt;.gsub!(&lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;RSpec, test/unit, test/spec, in the end I don&#8217;t think it matters.  Use the test suite that is the most comfortable for you.  The fact that you practice &lt;span class=&quot;caps&quot;&gt;TDD&lt;/span&gt; is far more important than the tool you use to do it.  So use the tool that makes you &lt;em&gt;want&lt;/em&gt; to do it.&lt;/p&gt;


	&lt;p&gt;I&#8217;m not going back to my lazy old ways, I&#8217;ve finally learned my lesson.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-05-07:1354</id>
    <published>2008-05-07T18:12:00Z</published>
    <updated>2008-05-17T19:11:21Z</updated>
    <category term="FlexImage"/>
    <link href="http://beautifulpixel.com/2008/5/7/render-fleximage-inline" rel="alternate" type="text/html"/>
    <title>Render Fleximage inline</title>
<content type="html">
            &lt;p&gt;When you write your plugins the right way, Rails just works in nice ways for you.  &lt;strong&gt;madrobby&lt;/strong&gt; (a.k.a. Thomas Fuchs, as made famous by script.aculo.us javascript awesomeness), provided a useful tip in the &lt;a href=&quot;http://github.com/Squeegy/fleximage/wikis/rendering&quot;&gt;Fleximage wiki&lt;/a&gt; on GitHub.&lt;/p&gt;


	&lt;p&gt;If you have some quick and small templates for a simple resize operation, you can do a &lt;code&gt;render :inline&lt;/code&gt; in order to create a template on the fly for quick and easy rendering of a small template.  Try this in your controller:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;thumb&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;iv&quot;&gt;@photo&lt;/span&gt; = &lt;span class=&quot;co&quot;&gt;Photo&lt;/span&gt;.find(params[&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;])&lt;tt&gt;
&lt;/tt&gt;  render &lt;span class=&quot;sy&quot;&gt;:inline&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;@photo.operate {|p| p.resize '100x100'}&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:type&lt;/span&gt; =&amp;gt; &lt;span class=&quot;sy&quot;&gt;:flexi&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;I have never used an inline template before, but I can definitely see how that could be handy.  Although, to be honest, I feel like this is very much view logic and would like to see this in a view file in all but the absolute simplest cases.&lt;/p&gt;


	&lt;p&gt;Thanks for the tip Thomas!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-05-01:1337</id>
    <published>2008-05-01T18:52:00Z</published>
    <updated>2008-05-01T18:54:27Z</updated>
    <category term="openid"/>
    <link href="http://beautifulpixel.com/2008/5/1/github-will-support-openid" rel="alternate" type="text/html"/>
    <title>GitHub will support OpenID</title>
<content type="html">
            &lt;p&gt;Thanks to some &lt;a href=&quot;http://logicalawesome.lighthouseapp.com/projects/8570-github/tickets/306-integrate-openid&quot;&gt;loud complaining from the community&lt;/a&gt; (including myself), GitHub will soon support OpenID.&lt;/p&gt;


	&lt;p&gt;Awesome.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-04-29:1332</id>
    <published>2008-04-29T20:03:00Z</published>
    <updated>2008-04-29T20:25:48Z</updated>
    <category term="openid"/>
    <link href="http://beautifulpixel.com/2008/4/29/30-000-openid-users-on-37-signals-apps" rel="alternate" type="text/html"/>
    <title>30,000 OpenID users on 37 signals apps</title>
<content type="html">
            &lt;p&gt;If you&#8217;re thinking about whether or not to support OpenID in your new Rails app, consider this &lt;a href=&quot;http://twitter.com/d2h/statuses/799301858&quot;&gt;tweet from &lt;span class=&quot;caps&quot;&gt;DHH&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Around 30K accounts on 37s apps are using OpenID. That&#8217;s a nice chunk!&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Even if that just a few percent of the whole, 30K is a huge amount of users.  And if these people are like me, OpenID support makes me much more likely to create an account somewhere.  If a see a site that looks kinda cool, but I need to login to start using it, and it has a 5-10 field registration form, I usually skip it.  Now if I see the same site with OpenID support, I simply enter OpenID and bypass the extended registration fields making me &lt;em&gt;far&lt;/em&gt; more likely to signup and try it out.&lt;/p&gt;


	&lt;p&gt;If you want a chunk of that 30K, maybe you should add OpenID to your authentication as well.&lt;/p&gt;


	&lt;p&gt;While I&#8217;m on the subject, 37 signals does a cool thing if you log into their apps with OpenID.  I currently have account at 3 different basecamps.  I have my own basecamp, a basecamp for my primary day job, and a basecamp with another project I am helping out on.  Since I login with OpenID on all three, they give me a little drop down near the top that lets me switch between basecamps.  Remember that basecamp account are unique per basecamp instance.  So the only way it can link my account together like that is to use my OpenID.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Why can&#8217;t you provide this by looking for the same username? Well, since your account is specific to a basecamp instance, you can&#8217;t always have the same username in multiple basecamps.&lt;/li&gt;
		&lt;li&gt;Why can&#8217;t you use an email, that&#8217;s globally unique right? Indeed, but I use more than 1 email address.  While each email is unique, I dont have just one that means &#8220;me&#8221;.  Plus in order to verify the email you have to do a messy email validation step, that noone likes doing.&lt;/li&gt;
		&lt;li&gt;OpenID is globally unique no matter what.  People usually have just one that they use.  And verification is done by an identity broker rather than an email.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;It all adds up to a big frickin&#8217; win to me.  This has bigger implications for me, though.  What if you logged into a site, and simply by creating an account it could go out and get publicly available information about you and mash it up.  Say, your favorite bands from Last.FM, the latest comments on your blog, your most recent twitter tweet.  And it would be able to do all this with &lt;em&gt;zero&lt;/em&gt; configuration because the OpenID you used on this site is the same that you used on other sites.  Single Sign On is a big deal, but this is the real reason OpenID is awesome to me.&lt;/p&gt;


	&lt;p&gt;The past web was founded on the principal of anonymity, but the future of the web is grounded in absolute identity.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-04-21:1308</id>
    <published>2008-04-21T16:52:00Z</published>
    <updated>2008-04-21T16:57:46Z</updated>
    <category term="FlexImage"/>
    <link href="http://beautifulpixel.com/2008/4/21/fleximage-is-top-rated" rel="alternate" type="text/html"/>
    <title>Fleximage is "Top Rated"</title>
<content type="html">
            &lt;p&gt;According to &lt;a href=&quot;http://agilewebdevelopment.com/plugins/top_rated&quot;&gt;AgileWebDevelopment.com&lt;/a&gt; Fleximage is in the first 15 &#8220;top rated&#8221; rails plugins on their site.  Currently it sits at 5/5 with 71 votes.  Not bad at all!&lt;/p&gt;


	&lt;p&gt;If you use it, and like it, go give it a thumbs up.&lt;/p&gt;


	&lt;p&gt;So I know you guys are out there.  If you are using the plugin on a production site, go ahead and add yourself to the &lt;a href=&quot;http://github.com/Squeegy/fleximage/wikis/whousesfleximage&quot;&gt;Who uses Fleximage Wiki page&lt;/a&gt; over on Github.  I would love to see what you creative have done with dynamic images.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-04-15:1292</id>
    <published>2008-04-15T16:34:00Z</published>
    <updated>2008-04-15T16:42:45Z</updated>
    <category term="FlexImage"/>
    <category term="Ruby"/>
    <link href="http://beautifulpixel.com/2008/4/15/fleximage-now-form-redisplay-safe" rel="alternate" type="text/html"/>
    <title>Fleximage now form redisplay safe</title>
<content type="html">
            &lt;p&gt;There was a minor annoyance with all version of Fleximage up to this point.  If you upload an image to a model, and validation fails for whatever reason, then you would have to find the image on your disk again, re-upload the image again, before you resubmit the form.  Wouldn&#8217;t it be nice of the file stayed uploaded, even if the record isnt ready to be saved yet?  How about getting a preview of the uploaded image too?&lt;/p&gt;


	&lt;p&gt;It&#8217;s all possible with the latest version of &lt;a href=&quot;http://github.com/Squeegy/fleximage&quot;&gt;Fleximage up on GitHub&lt;/a&gt;.  Checkout this &lt;a href=&quot;http://github.com/Squeegy/fleximage/wikis/uploadform&quot;&gt;GitHub wiki page&lt;/a&gt; for details.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-04-12:1288</id>
    <published>2008-04-12T22:10:00Z</published>
    <updated>2008-04-12T22:15:43Z</updated>
    <category term="Ruby"/>
    <category term="settings"/>
    <category term="Settings"/>
    <link href="http://beautifulpixel.com/2008/4/12/settings-plugin-update" rel="alternate" type="text/html"/>
    <title>Settings Plugin update</title>
<content type="html">
            &lt;p&gt;Since &lt;a href=&quot;http://beautifulpixel.com/2008/4/11/github-open-source-is-now-easier-than-closed-source&quot;&gt;GitHub makes open source so easy&lt;/a&gt; I opened up my &lt;a href=&quot;http://beautifulpixel.com/2006/4/18/settings-plugin-improvements&quot;&gt;old Settings plugin&lt;/a&gt; after almost a year and put it up with a few improvements.&lt;/p&gt;


	&lt;p&gt;Most importantly, I got the tests working.  I also created a less ugly way of defining defaults:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;co&quot;&gt;Settings&lt;/span&gt;.defaults[&lt;span class=&quot;sy&quot;&gt;:foo&lt;/span&gt;] = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# or&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;Settings&lt;/span&gt;.defaults = {&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;sy&quot;&gt;:foo&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;sy&quot;&gt;:baz&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;faz&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;}.with_indifferent_access&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;&lt;a href=&quot;http://github.com/Squeegy/rails-settings&quot;&gt;Check out the updated version of GitHub&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-04-11:1284</id>
    <published>2008-04-11T18:48:00Z</published>
    <updated>2008-04-11T19:18:16Z</updated>
    <category term="Random"/>
    <link href="http://beautifulpixel.com/2008/4/11/github-open-source-is-now-easier-than-closed-source" rel="alternate" type="text/html"/>
    <title>GitHub: Open source  is now easier than Closed source</title>
<content type="html">
            &lt;p&gt;I usually don&#8217;t blog about stuff that everyone else is obviously blogging about already.  But I am making an exception, just this once, because I am excited about &lt;a href=&quot;http://github.com/&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;GitHub is a social source control platform based on &lt;a href=&quot;http://git.or.cz/&quot;&gt;Git&lt;/a&gt;.  Git is a whole different animal than &lt;span class=&quot;caps&quot;&gt;SVN&lt;/span&gt;.  Git has no concept of source and checked out copy.  You can commit locally, you can easily branch and merge, you can push some branches to some central repos, and keep other to yourself for now, its amazingly dynamic.  But I&#8217;m not here to talk about Git so much.&lt;/p&gt;


	&lt;p&gt;The first part that makes GitHub cool is the social thing.  It&#8217;s been really hard for me to get into social networks.  I try every once and a while and find it hard to convince my peers to join me on said network.  I can upload a widget, or have a friends list, but I never seem to find any functionality that keeps me using the network for any length of time.  GitHub is finally a social network I can get into.  You don&#8217;t have &#8220;friends&#8221;, you have contibutors, watchers and forkers.  You can add people to your project as contributors, people can simply keep an eye on your project by watching it, or they can fork your code to make their own modifications in their own sandbox.  It&#8217;s completely addicting to see how many &#8220;Watchers&#8221; I have today.  As of this writing the &lt;a href=&quot;http://github.com/Squeegy/fleximage/watchers&quot;&gt;Fleximage watcher page&lt;/a&gt; lists 9 watchers.  Not bad for less than 1 week in the wild.&lt;/p&gt;


	&lt;p&gt;Now, lets say someone wants to add some useful functionality to Fleximage.  They can fork my code, without my permission, and work on their useful feature.  They then let me know saying &#8220;I did some cool stuff, check it out&#8221;.  I can clone their working repo, test it out, and integrate the diff with my code with just a few commands.  Even if someone forks my code in order to overlay a monkey watermark on every image, that&#8217;s still fine.  They can keep their forked little sandbox for themselves or whoever else wants to use it and I never have to pull in their changes at all.&lt;/p&gt;


	&lt;p&gt;The second part that is awesome is what this does for open source.  The pricing model really encourages open source.  &lt;strong&gt;Open source hosting is free&lt;/strong&gt;.  Private repositories cost money.  Let that sink in a minute.  This means that its easier and cheaper to release your project open source than not to.  Previously, to open source a project you needed server side repository hosting, need a website for your project, in order to get those free you needed the convoluted rubyforge interface or ad laden source forge.  This made it more time consuming and costly than a private codebase.  So the &#8220;default&#8221; mode for most apps was private, because it was easier.&lt;/p&gt;


	&lt;p&gt;What GitHub did, was to make open source easier and cheaper than closed source.  So going forward my apps will be, by default, open source.  Thats a big deal.  Now the little nuggets that I write every now and again will be opensourced on GitHub.  Some of them may turn out to be nothing.  But other may get forked by someone far smarter than me, enhanced, and eventually turned into something totally cool. Such scenarios never would be possible if there wasn&#8217;t an easy and free open source hosting platform like GitHub.&lt;/p&gt;


	&lt;p&gt;GitHub, you guys rock.  The worldwide open source community has been greatly enhanced by the presence of GitHub.  Give it some time and I think GitHub will be the defacto open source standard.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-04-07:1276</id>
    <published>2008-04-07T06:10:00Z</published>
    <updated>2008-04-07T06:13:41Z</updated>
    <category term="Random"/>
    <category term="Ruby"/>
    <link href="http://beautifulpixel.com/2008/4/7/ruby-experts" rel="alternate" type="text/html"/>
    <title>Ruby Experts</title>
<content type="html">
            &lt;p&gt;Hey look, &lt;a href=&quot;http://www.odinjobs.com/blogs/careers/entry/ruby_experts_whythey_are_in&quot;&gt;I&#8217;m a Ruby expert&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Not sure how I stack up with people that wrote Ruby books&#8230; Had I realized that I was going to be quoted in such a manner, perhaps I would have answered with slightly more verbosity.  Live and learn.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-04-05:1265</id>
    <published>2008-04-05T23:43:00Z</published>
    <updated>2008-04-06T06:13:27Z</updated>
    <category term="FlexImage"/>
    <link href="http://beautifulpixel.com/2008/4/5/fleximage-v2-now-with-more-awesome" rel="alternate" type="text/html"/>
    <title>Fleximage v2, now with more awesome</title>
<content type="html">
            &lt;p&gt;You ever make something, and then look back a few years later and say &#8220;What the hell was I thinking&#8221;?  This happened to me recently.  Fleximage has been quite a useful plugin for me, but under the hood it was a mess; the &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; was cumbersome, and mixing in all the image transformations as direct model methods was code smell.&lt;/p&gt;


	&lt;p&gt;This release represents the 3rd complete rewrite of this code base.  The first effort was &lt;a href=&quot;http://beautifulpixel.textdriven.com/2006/04/27/superimage-plugin-making-resizeable-uploaded-images-easy&quot;&gt;SuperImage&lt;/a&gt;.  It worked, but it happened almost entirely in the controller and made more interesting effects harder.  The first &lt;strong&gt;Fleximage&lt;/strong&gt; was next introducing more tranformations and &lt;code&gt;.flexi&lt;/code&gt; views and a good effort to making it more &lt;span class=&quot;caps&quot;&gt;MVC&lt;/span&gt; friendly.&lt;/p&gt;


	&lt;h1&gt;&lt;a href=&quot;http://github.com/Squeegy/fleximage/wikis/gettingstarted&quot;&gt;Get Fleximage v2 here&lt;/a&gt;&lt;/h1&gt;


	&lt;p&gt;So I now present, &lt;strong&gt;Fleximage v2&lt;/strong&gt;.  The output is very similar, but the &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; and internals are completely different.  Here&#8217;s some highlights.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Creation date based master image storage to prevent OS imposed directory limits.  i.e. /path/to/images/2008/02/06/999.jpg&lt;/li&gt;
		&lt;li&gt;Rails 2 formatted resource route friendly&lt;/li&gt;
		&lt;li&gt;Magic columns to capture filename and image size&lt;/li&gt;
		&lt;li&gt;Image transformation methods are not injected into your model or controller at all.&lt;/li&gt;
		&lt;li&gt;Image operations now happen via Operator class that refactor each transformation into their own encapsulated class.&lt;/li&gt;
		&lt;li&gt;Easily output &lt;span class=&quot;caps&quot;&gt;JPG&lt;/span&gt;, PNG, or &lt;span class=&quot;caps&quot;&gt;GIF&lt;/span&gt; based on request format.&lt;/li&gt;
		&lt;li&gt;Simple acts_as_* style model activation rather than using a cumbersome inheritance method&lt;/li&gt;
		&lt;li&gt;Side by side file upload or &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; fields for easy uploading.&lt;/li&gt;
		&lt;li&gt;Uploading will only ever replace you image file if the uploaded file actually has content, removing the need for &#8220;if file.size &amp;gt; 0&#8221; nonsense in your controller.&lt;/li&gt;
		&lt;li&gt;Rake tasks to convert from master image directory styles, as well as master image formats (jpg =&amp;gt; png for instance)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;And it&#8217;s all hosted on &lt;a href=&quot;http://github.com/Squeegy/fleximage&quot;&gt;GitHib&lt;/a&gt;.  It&#8217;s new, it&#8217;s awesome, and has extensive documentation in the attached Wiki.&lt;/p&gt;


	&lt;p&gt;Lastly, if you are using &lt;strong&gt;Fleximage&lt;/strong&gt; in an existing production site, please add it on the &lt;a href=&quot;http://github.com/Squeegy/fleximage/wikis/whousesfleximage&quot;&gt;WhoUsesFleximage&lt;/a&gt; page.  I know you&#8217;re out there.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-03-30:1247</id>
    <published>2008-03-30T06:09:00Z</published>
    <updated>2008-03-30T06:20:02Z</updated>
    <category term="Projects"/>
    <category term="Ruby"/>
    <link href="http://beautifulpixel.com/2008/3/30/heroku-and-the-hillcrest-development-watch" rel="alternate" type="text/html"/>
    <title>Heroku and the Hillcrest Development Watch</title>
<content type="html">
            &lt;p&gt;A friend asked me to donate a tiny google maps application to a non-profit cause.  The Hillcrest Development Watch monitor housing and construction in their area and they wanted an easier way to do it than emailing a spreadsheet around.  Now, being a Rails programmer, of course I wanted to deal with this in Rails.  Sadly Rails is a pain to host right?&lt;/p&gt;


	&lt;p&gt;Wrong.  Enter &lt;a href=&quot;http://heroku.com&quot;&gt;Heroku&lt;/a&gt;.  Their fantastic setup is free (for now).  They create a git repository for your app when you create your app.  Then you simply suck down that git, commit to it and push it back.  Their server software automatically updates your working code and reboots your app to the latest code, simply by pushing your commits to the server.  It is the least painful rails deployment process I have ever used.  In fact, I would go so far as to call it pleasurable, which is a big deal to say about rails deployment.&lt;/p&gt;


	&lt;h3&gt;&lt;a href=&quot;http://hillcrest.heroku.com/&quot;&gt;Check out Hillcrest Development Watch&lt;/a&gt;&lt;/h3&gt;


	&lt;p&gt;The site itself is a simple single resource web app.  It tracks properties, their addresses and development states.  For a supre small app like this, Heroku even provides access to its user login system.  It lets you use the user logged into heroku.com as a user in your app.  So if your needs are simple, you can have a user authentication system, and have your app not care about registration, authentication, or user management.  This app simply show some admin function if the user is authorized to edit this heroku app.  This wouldn&#8217;t stand up to the needs of anything more complex, but it saved a huge bundle of time for this project.&lt;/p&gt;


	&lt;p&gt;In case this lengthy prose didn&#8217;t convey my point:&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Heroku is Aweome!&lt;/strong&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beautifulpixel.com/">
    <author>
      <name>Squeegy</name>
    </author>
    <id>tag:beautifulpixel.com,2008-03-08:1216</id>
    <published>2008-03-08T18:05:00Z</published>
    <updated>2008-03-08T18:06:44Z</updated>
    <category term="Objective C"/>
    <link href="http://beautifulpixel.com/2008/3/8/learning-objective-c" rel="alternate" type="text/html"/>
    <title>Learning Objective C</title>
<content type="html">
            &lt;p&gt;With the release of the iPhone &lt;span class=&quot;caps&quot;&gt;SDK&lt;/span&gt;, it&#8217;s clear that I need to learn some Objective C.  I have been meaning to pick it up for a while now, if only to write Mac &lt;span class=&quot;caps&quot;&gt;OS X&lt;/span&gt; Desktop Apps.  But coming from Ruby, and not knowing C, its a little weird.  I have a brain dump of initial thoughts as I trudge through my learning process that I will document here.&lt;/p&gt;


	&lt;p&gt;First of all, memory management?  Ruby has way spoiled me here.  Having to manually allocate and deallocate memory manually seems like a huge pain the ass.  But on the other hand, maybe that is one reason that Rails apps take need 50MB of &lt;span class=&quot;caps&quot;&gt;RAM&lt;/span&gt; just to be present.&lt;/p&gt;


	&lt;p&gt;The bracket method invocation syntax is pretty weird to me.  As is the method declaration syntax.  I&#8217;m getting used to it, I am starting to see why it&#8217;s done that way.  But its still ugly.&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;// method declaration&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;- (&lt;span class=&quot;pt&quot;&gt;void&lt;/span&gt;)&lt;span class=&quot;la&quot;&gt;touchesBegan:&lt;/span&gt;(NSSet *)touches &lt;span class=&quot;la&quot;&gt;withEvent:&lt;/span&gt;(UIEvent *)event {&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;// method invocation&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;[myObject &lt;span class=&quot;la&quot;&gt;touchesBegan:&lt;/span&gt;someTouches &lt;span class=&quot;la&quot;&gt;withEvent:&lt;/span&gt;someEvent]&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;The &#8220;every argument is named&#8221; thing, is actually pretty nice.  But the syntax to hook all that up, and strongly type every argument, is pretty ugly.&lt;/p&gt;


	&lt;p&gt;Lastly, for now, the language just seems needlessly verbose.  For example, to create a new Photo:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;photo1 = [[Photo alloc] init];&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;I much prefer ruby&#8217;s &lt;code&gt;Photo.new&lt;/code&gt;.  Or to get objects out of an NSArray object you actually have to do something like:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;[myArray &lt;span class=&quot;la&quot;&gt;objectAtIndex:&lt;/span&gt;&lt;span class=&quot;i&quot;&gt;123&lt;/span&gt;]&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;Learning a new language is a great mind expanding exercise.  But I hope to, one day, learn a language that didn&#8217;t make me wish I was using ruby instead.&lt;/p&gt;
          </content>  </entry>
</feed>
