<?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"
	>

<channel>
	<title>Pathfinder Development &#187; Agile Ajax</title>
	<atom:link href="http://www.pathf.com/blogs/category/agileajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pathf.com/blogs</link>
	<description>Running commentary about agile development, user experience design and Ajax.</description>
	<pubDate>Wed, 19 Nov 2008 15:24:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>iPhone SDK: UIViewController Testing &#38; TDD</title>
		<link>http://www.pathf.com/blogs/2008/11/iphone-view-testing-td/</link>
		<comments>http://www.pathf.com/blogs/2008/11/iphone-view-testing-td/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 04:47:02 +0000</pubDate>
		<dc:creator>Ivan Moscoso</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[agile]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[Design]]></category>

		<category><![CDATA[iPhone]]></category>

		<category><![CDATA[Testing]]></category>

		<category><![CDATA[UIViewController]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1276</guid>
		<description><![CDATA[Unfortunately there are not enough examples out there on how to test view controllers with the iPhone SDK.  My hope is to remedy that a bit by sharing some techniques I have been using to tackle the problem, particularly in keeping with the spirit of TDD along the way.
First, If you have not already [...]]]></description>
			<content:encoded><![CDATA[<p>Unfortunately there are not enough examples out there on how to test view controllers with the iPhone SDK.  My hope is to remedy that a bit by sharing some techniques I have been using to tackle the problem, particularly in keeping with the spirit of TDD along the way.</p>
<p>First, If you have not already done so, configure your project to use <a title="Google Toolbox for Mac" href="http://code.google.com/p/google-toolbox-for-mac/" target="_blank">GTM</a>.  This is a bit of a no-brainer as it currently stands.  Until Apple comes up with something better, GTM is the way to go.  It works as advertised, and is a credit to the folks at Google for providing this toolkit.</p>
<p>Now then, many tutorials on the web seem to imply that one should test somewhere in the middle by suggesting to add a few outlets to your controller, fire up IB and wire up your view to your view controller before you even start to think about testing any of it.
<p>Testing controller logic means working under the assumption that you have wired up your view components correctly to match the controller's actions and outlets.  Wire up an element to the wrong action (or worse, forget to wire it up at all) and you can easily learn to rely too heavily on manual testing.  While this might be acceptable for small one-off applications, within a team of developers practicing <a href="http://www.extremeprogramming.org/rules/collective.html">collective code ownership</a>, this kind of error can cost real money over time.  "Thanks for caring, but I'd rather have a unit test."</p>
<p>Now then, let's take a look at some code!</p>
<p><span id="more-1276"></span></p>
<p>I have been taking an alternate approach to creating my views and view controllers by writing the test first and then wiring up my components to pass the test.  As a result, I'm starting to see other cool ways of tackling the problem while minimizing the amount of code required to get the system under test.</p>
<p>The following is a short method from one of my controller tests which allows me to assert that a UIButton is properly wired up to the right action on a controller (sorry for the screenshots, I'm having problem with syntax highlighting today):</p>
<p><br></p>
<div style="center;"><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/assert-selector-wired1.png" alt="assert_selector_wired.png" border="0" width="543" height="225" /></div>
<p><br></p>
<p>The controller in the above code snippet is an instance variable referencing the controller under test.  While it's possible to move this logic into a macro, I liked keeping it as a method.  See "actionsForTarget:forControlEvent:" for more information on the second assertion-- this should work with any UIControl as long as you understand which UIControlEvents to accept.  Here's a sample unit test which uses the helper method above:</p>
<p><br></p>
<div style="center;"><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/assert-selector-wired-usage.png" alt="assert_selector_wired_usage.png" border="0" width="543" height="183" /></div>
<p>This varies from other examples I have seen on the web in that I don't actually 'fire' an event through the UIButton at all.  Technically that approach exercises more of the system, but in this case, if I am confident that the button is wired up to the correct action, that's good enough for me.  I would rather invoke the controller logic directly within the test than make the test code longer than it needs to be.</p>
<p>This approach to unit testing avoids mocking, or creating custom categories to get at, say, the internals of UIEvent.  Surely there is a time and place for mocks, but so far I have found the SDK to allow me just enough in most cases without requiring me to be too clever.  And while I think other approaches are worthwhile in their own way, in a team environment I am less apt to mock out the internals of a system if it means making the tests harder for others to read or follow along.  Clean tests are their own reward!</p>
<p>Let me know if you find this approach useful, or how you go about testing that your view and view controllers play nicely.  I'm still looking for better ways, and plan to talk a lot more about iPhone SDK testing in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/iphone-view-testing-td/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Icons are evil; so are menus - unless you do them right</title>
		<link>http://www.pathf.com/blogs/2008/11/icons-are-evil-so-are-menus-unless-you-do-them-right/</link>
		<comments>http://www.pathf.com/blogs/2008/11/icons-are-evil-so-are-menus-unless-you-do-them-right/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 22:37:35 +0000</pubDate>
		<dc:creator>Brian Dillard</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[UXD]]></category>

		<category><![CDATA[Confluence]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Flock]]></category>

		<category><![CDATA[User Experience]]></category>

		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1270</guid>
		<description><![CDATA[Menus and dropdowns seem like attractive design choices because they conserve screen real estate while providing users access to a potentially large number of commands. But if you resist the easy out of menus and dropdowns, you may find that your applications become far more usable.
Survey the software you use for yourself, both browser- and [...]]]></description>
			<content:encoded><![CDATA[<p>Menus and dropdowns seem like attractive design choices because they conserve screen real estate while providing users access to a potentially large number of commands. But if you resist the easy out of menus and dropdowns, you may find that your applications become far more usable.</p>
<p>Survey the software you use for yourself, both browser- and desktop-based. Think about which applications provide the most invisible, effortless interfaces. I doubt it will be the ones that hide commands in complex menus and dropdown systems.</p>
<p>For some negative examples, let's look at Firefox and its more social cousin, Flock. Each app offers an advanced bookmark management mechanism, but the usability of that mechanism suffers in each due to over-reliance on cryptic menus.</p>
<p><span id="more-1270"></span></p>
<p>Here's Firefox:</p>
<p><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/11/firefox.jpg'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/firefox.jpg" alt="Firefox" title="Firefox" width="300" height="185" /></a></p>
<p>Can you guess which bookmark management options are going to appear under each menu? Where, for example, would the command for adding a separator live? What about sorting your bookmarks? Can't figure it out? Welcome to the world of evil icons.</p>
<p>For comparison, here's Flock, the social browser derived from Firefox:</p>
<p><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/11/flock.jpg'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/flock.jpg" alt="Flock" title="Flock" width="300" height="160" /></a></p>
<p>Clearly, Flock provides friendlier menus; at least they've got text labels. With enough trial-and-error training, you'll probably be able to teach yourself which command lives under which menu.</p>
<p>Here's another example, this time from the webapp world: Confluence, the popular enterprise wiki package. Older versions of Confluence offered the by-now-familiar star icon. Click it, and a page would be added to your favorites. More recent versions, however, hide the "add favorite" option in one of several dropdown menus. Can you guess which?</p>
<p><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/11/confluence-hidden.jpg'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/confluence-hidden.jpg" alt="Confluence 1" title="Confluence 1" width="300" height="64" class="alignnone size-medium wp-image-1273" /></a></p>
<p>If you guessed the "Add" menu, for "add to favorites," you're wrong. It's under the "Tools" menu. Welcome to the world of evil menus.</p>
<p><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/11/confluence.jpg'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/confluence.jpg" alt="Confluence" title="Confluence" width="189" height="300" /></a></p>
<p>So where does that leave us? Must every single command available in an interface exist as an always-visible text link within the browser viewport? Of course not. But there are some best practices in choosing how to build our menus:</p>
<ul>
<li>Icons are great, but they should either be universally recognizable (such as a star or trash can) or paired with a text label.</li>
<li>Menu groupings should be intuitive. Use care in choosing the top-level labels and don't group disparate items under the same menu.</li>
<li>For frequently accessed functionality, consider leaving it as a dedicated clickable item on the page. There's nothing wrong with a mixture of icons and menus, the former for the most popular features and the latter for everything else.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/icons-are-evil-so-are-menus-unless-you-do-them-right/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Truth About Designing For Security</title>
		<link>http://www.pathf.com/blogs/2008/11/designing-for-security/</link>
		<comments>http://www.pathf.com/blogs/2008/11/designing-for-security/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 17:49:39 +0000</pubDate>
		<dc:creator>Ivan Moscoso</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[architecture]]></category>

		<category><![CDATA[Design]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1261</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img class="right" src="/blogs/wp-content/uploads/2008/11/85543900_e0019d7864.jpg" alt="\" width="300" height="225" /><br />
Security is an area of concern where value and cost are often difficult to estimate.  While big mistakes made early on in many areas of an application may prove difficult to correct, this is especially true for security, since its specifications often model a direct reflection of an organizational structure.</p>
<p>And all too often, dysfunctional organizations create dysfunctional security requirements.</p>
<p>It is common knowledge then that a failure to account for security from the start can prove much more costly in the end.  However, over-engineering security needs can require so much effort that your team may not have enough time left over to actually build the very features you are trying to secure.</p>
<p>I find the following two points very useful to keep in mind when participating in discussions concerning security regardless of the application, but especially when working under the assumption that a new application needs the same kind of security model as the old application:</p>
<ul>
<li><strong>All security models are idiosyncratic</strong></li>
<li><strong>Never underestimate the cost of being flexible</strong></li>
</ul>
<p>These two items work as polar opposites of each other:  a flexible system can accommodate many types of organizations, but not without the added cost of training, installation, documentation or maintenance.  On the other hand, a static model is cheap to build, but rarely captures the nuances of an organization's structure, particularly as business needs evolve over time.<br />
<span id="more-1261"></span></p>
<p>Years ago I worked on a small part of the security infrastructure for a public-facing site.  The security model included a fairly complex, "lattice-based" authorization scheme:  User roles were arranged in hierarchies.  Access to resources could only be determined by understanding both the hierarchy and the security level at each step in the hierarchy.  Resources were configured with different "security levels" along the way.  Half of the information needed to answer the question of access control was stored in a database, and the other half in code.  Because of this, user management was left in the hands of development, and only after that proved to be a clear bottleneck were we given the opportunity to build a front-end management interface for non-developers to manage user access rights.</p>
<p>The system was flexible, but a coordinated mess.  Several developers spent a significant effort to keep things going, and it still took a few hours with a whiteboard to explain problems or inconsistencies in the model.  A simpler, role-based authorization would have sufficed.  In retrospect, the idea of role hierarchies was never justified, and could have been done away completely if just a little bit of the front-end interface had been designed in tandem with the original security specification.</p>
<p>I wish this were an isolated case, but we hear these types of stories time and again.  The lesson I take from it is that, in trying to be flexible, an organization can overshoot its needs.  In this case, the security model covered the nuances of the organization, but at an ever-widening cost measured in development time, maintenance, training, documentation, review, etc.</p>
<hr>
<a href="http://www.flickr.com/photos/generated/85543900/">('spiritual lattice' by jared)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/designing-for-security/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GWT, Gadgets and OpenSocial, Part 2</title>
		<link>http://www.pathf.com/blogs/2008/11/gwt-gadgets-and-opensocial-part-2/</link>
		<comments>http://www.pathf.com/blogs/2008/11/gwt-gadgets-and-opensocial-part-2/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 23:15:03 +0000</pubDate>
		<dc:creator>Dietrich Kappe</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Google Gadgets]]></category>

		<category><![CDATA[GWT]]></category>

		<category><![CDATA[iGoogle]]></category>

		<category><![CDATA[OpenSocial]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1262</guid>
		<description><![CDATA[Note: It is assumed that you know your way around GWT and Eclipse for purposes of this tutorial.
While developing OpenSocial applications can be a bit tricky, getting set up to develop can be a real pain in the neck. For this installment of OpenSocial and GWT, I'm going to go through the basics of setting [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/11/hellogadget.png'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/hellogadget.png" alt="" title="hellogadget" width="300" height="286" class="alignright size-medium wp-image-1264" style="float:right;padding:10px" /></a><strong>Note:</strong> It is assumed that you know your way around GWT and Eclipse for purposes of this tutorial.</p>
<p>While developing OpenSocial applications can be a bit tricky, getting set up to develop can be a real pain in the neck. For this installment of OpenSocial and GWT, I'm going to go through the basics of setting up a simple Hello World gadget with iGoogle. We'll get into the details of signing up for other OpenSocial containers, testing, and so on, later. Right now we're just going to do the basics.</p>
<p>So, what do you need to build a Google Gadget with GWT for iGoogle? You need the following:</p>
<ol>
<li> The <a href="http://code.google.com/webtoolkit/" target="_blank">Google Web Toolkit</a></li>
<li>The <a href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=GadgetsGettingStarted" target="_blank">GWT Google Gadget API</a></li>
<li>An account on <a href="http://www.google.com/ig" target="_blank">iGoogle</a></li>
<li>Access to the <a href="http://www.google.com/ig/sandbox" target="_blank">iGoogle sandbox</a></li>
<li>Some public server space so you can serve up your gadget to iGoogle</li>
</ol>
<p><span id="more-1262"></span></p>
<p>Pretty much everything else is self explanatory, but the sandbox can be a little bit confusing. Let's talk a little bit about the iGoogle sandbox. It's an experimental space where you can test things out without polluting your regular iGoogle account. Eventually you'll want several accounts in order to test. But every journey starts with a single step.</p>
<p>First, you need to sign up for iGoogle. I'll assume this isn't your first rodeo and you've done this before. Once you've got your iGoogle access, you'll want to go over to <a href="http://code.google.com/apis/igoogle/docs/gs.html" target="_blank">this page</a> to sign up for the developer sandbox and add the developer tools to your space.</p>
<p>When developing, make sure that there's a message towards the top left of the page that says "Welcome to the iGoogle Developer sandbox." If you don't see that message, you're not in the sandbox. If you have to, navigate to <a href="http://www.google.com/ig/sandbox" target="_blank">http://www.google.com/ig/sandbox</a>. You may have to "sign up" again to drop into the sandbox.</p>
<p>Once there, you can add those developer tools. Just clicking <a href="http://www.google.com/ig/sharetab?atr=Developer%20Tools&amp;n_32=url%3Dhttp://hosting.gmodules.com/ig/gadgets/file/107532026754505494237/updates.xml&amp;n_32=url%3Dhttp://hosting.gmodules.com/ig/gadgets/file/105542374478112771668/sandbox-friends.xml&amp;n_32=url%3Dhttp://hosting.gmodules.com/ig/gadgets/file/107532026754505494237/sandboxProfileEditor.xml&amp;n_32=url%3Ddeveloper.xml" target="_blank">this link</a> will get you started.</p>
<p>The developer widgets are:</p>
<ul>
<li>My Gadgets: let's you set inlining and caching on the Gadgets on your page from a handy interface</li>
<li>Sandbox Profile Editor: let's you modify your profile in the sandbox so you can test a few things out.</li>
<li>Sadbox Friends: lets you view and edit who your friends are. Important for OpenSocial applications.</li>
<li>Updates:shows activities posted to your friends while interacting with the gadget.</li>
</ul>
<p><strong>The Hello World Gadget</strong></p>
<p>In this part we're not doing anything OpenSocial related. We're just setting up a Google Gadget. That's a necessary first step for the OpenSocial stuff.</p>
<p>Let's get started. In my example I'll be working in <code>~/src/HelloGadget</code>. Create a <code>lib</code> directory and put the <code>gwt-gadgets.jar</code> library file from the GWT Gadgets API project in it. Next, we run the GWT <code>projectCreator</code> to create our ant and Eclipse files:</p>
<pre>./projectCreator -ant HelloGadget -eclipse HelloGadget -out ~/src/HelloGadget/ -addToClassPath ~/src/HelloGadget/lib/gwt-gadgets.jar
Created directory /Users/dkappe/src/HelloGadget/src
Created directory /Users/dkappe/src/HelloGadget/test
Created file /Users/dkappe/src/HelloGadget/HelloGadget.ant.xml
Created file /Users/dkappe/src/HelloGadget/.project
Created file /Users/dkappe/src/HelloGadget/.classpath</pre>
<p>Now we create a simple sample application using the <code>applicationCreator</code> tool:</p>
<pre>./applicationCreator -eclipse HelloGadget -out ~/src/HelloGadget/ -addToClassPath ~/src/HelloGadget/lib/gwt-gadgets.jar com.pathf.demo.app.gwt.client.HelloGadget
Created directory /Users/dkappe/src/HelloGadget/src/com/pathf/demo/app/gwt
Created directory /Users/dkappe/src/HelloGadget/src/com/pathf/demo/app/gwt/client
Created directory /Users/dkappe/src/HelloGadget/src/com/pathf/demo/app/gwt/public
Created file /Users/dkappe/src/HelloGadget/src/com/pathf/demo/app/gwt/HelloGadget.gwt.xml
Created file /Users/dkappe/src/HelloGadget/src/com/pathf/demo/app/gwt/public/HelloGadget.html
Created file /Users/dkappe/src/HelloGadget/src/com/pathf/demo/app/gwt/public/HelloGadget.css
Created file /Users/dkappe/src/HelloGadget/src/com/pathf/demo/app/gwt/client/HelloGadget.java
Created file /Users/dkappe/src/HelloGadget/HelloGadget.launch
Created file /Users/dkappe/src/HelloGadget/HelloGadget-shell
Created file /Users/dkappe/src/HelloGadget/HelloGadget-compile</pre>
<p>You now have a nice little application that you can run using the hosted mode script <code>HelloGadget-shell</code> in the <code>src/HelloGadget</code> directory. Congratulations, you have a sample GWT application.</p>
<p>But we want a Google Gadget. In order to make it a gadget, we have to change the code a bit. First, import the project into Eclipse. Then open the <code>HelloGadget.gwt.xml</code> and add the following inherit statement.</p>
<pre class="xml"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Other module inherits                                      --&gt;</span></span>
	  <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Inherit Google Gadgets API --&gt;</span></span>
	  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;inherits</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;com.google.gwt.gadgets.Gadgets&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></pre>
<p>Now let's open up the <code>HelloGadget.java</code> file. We're going to change it around a bit so it can be a gadget. The critical part of the original looks like this.</p>
<pre class="java5"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloGadget <span style="color: #000000; font-weight: bold;">implements</span> EntryPoint <span style="color: #66cc66;">&#123;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/**
   * This is the entry point method.
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> onModuleLoad<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></pre>
<p>We change our class to extend <code>Gadget</code> and change the <code>onModuleLoad</code> method to <code>init</code>.</p>
<pre class="java5">@ModulePrefs<span style="color: #66cc66;">&#40;</span>title = <span style="color: #ff0000;">&quot;HelloGadget&quot;</span>, author = <span style="color: #ff0000;">&quot;Dietrich Kappe&quot;</span>, author_email = <span style="color: #ff0000;">&quot;dkappe@gmail.com&quot;</span>, height = <span style="color: #cc66cc;">300</span>, description = <span style="color: #ff0000;">&quot;A simple gadget.&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloGadget <span style="color: #000000; font-weight: bold;">extends</span> Gadget&lt;UserPreferences&gt; <span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/**
	 * This is the entry point method.
	 */</span>
	@<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Override.html"><span style="color: #aaaadd; font-weight: bold;">Override</span></a>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #993333;">void</span> init<span style="color: #66cc66;">&#40;</span>UserPreferences preferences<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></pre>
<p>You have to also import the following three classes:</p>
<pre class="java5"><span style="color: #000000; font-weight: bold;">import</span> com.<span style="color: #006600;">google</span>.<span style="color: #006600;">gwt</span>.<span style="color: #006600;">gadgets</span>.<span style="color: #006600;">client</span>.<span style="color: #006600;">Gadget</span>;
<span style="color: #000000; font-weight: bold;">import</span> com.<span style="color: #006600;">google</span>.<span style="color: #006600;">gwt</span>.<span style="color: #006600;">gadgets</span>.<span style="color: #006600;">client</span>.<span style="color: #006600;">UserPreferences</span>;
<span style="color: #000000; font-weight: bold;">import</span> com.<span style="color: #006600;">google</span>.<span style="color: #006600;">gwt</span>.<span style="color: #006600;">gadgets</span>.<span style="color: #006600;">client</span>.<span style="color: #006600;">Gadget</span>.<span style="color: #006600;">ModulePrefs</span>;</pre>
<p><strong>Running the Darned Thing</strong></p>
<p>Done! Well, not quite. While changing the <code>EntryPoint</code> to a <code>Gadget</code> was pretty straightforward, we now need a container to run the thing. Mind you, it will still run in it's current form in hosted mode, but all of those things it's expecting from iGoogle are not going to happen. So it's time to inject it into iGoogle.</p>
<p>Go ahead and compile the code using the shell command <code>HelloGadget-compile</code>. The resulting compiled JavaScript and sundries is under the <code>www</code> directory in your projects home. If you take a look, you'll see a new file that you likely haven't seen before, namely <code>com.pathf.demo.app.gwt.client.HelloGadget.gadget.xml</code>. This is the gadget manifest. Essentially, this is what your gadget container needs to load to display the app. Many of the parameters are set by the parameters to the <code>@ModulePrefs</code> annotation.</p>
<p>Bundle this app up and upload it to your publicly available server. In my case, I've uploaded the app <a href="http://www.pathf.com/sites/pfd/test/HelloGadget/com.pathf.demo.app.gwt.client.HelloGadget.gadget.xml">here</a>. This is the link to the XML file. You can now go to the sandbox and, using the My Gadgets gadget, add it to your sandbox.</p>
<p><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/11/mygadgets.png'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/mygadgets.png" alt="" title="mygadgets" width="300" height="230" class="alignnone size-medium wp-image-1265" /></a></p>
<p>You can tweak some of the settings having to do with caching of he Gadget resources with the MyGadgets gadgets, but more on that later. Next time we'll set up our simple Gadget in various other containers and perform something a little bit more useful with it (but only a little).</p>
<p>As always, comments and questions are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/gwt-gadgets-and-opensocial-part-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Has Many has_many: A Refactoring Story</title>
		<link>http://www.pathf.com/blogs/2008/11/has-many-has_many-a-refactoring-story/</link>
		<comments>http://www.pathf.com/blogs/2008/11/has-many-has_many-a-refactoring-story/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 17:23:09 +0000</pubDate>
		<dc:creator>Noel Rappin</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1260</guid>
		<description><![CDATA[




Image is a Pieceless Puzzle, from Ceaco


Lately I've been working on a revision of one of my first Pathfinder projects, an internal agile management tool. Along with adding and rearranging some features, I'm also taking the opportunity to modernize some of the Rails 1.2 era code up to new Rails 2.1 and 2.2 features. 
Note [...]]]></description>
			<content:encoded><![CDATA[<div class="right">
<a href="<strong></strong>"><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/ceaco.jpg" alt="Ceaco Pieceless Puzzle" border="0" width="228" height="344" class="right"/><img src="" alt="" border="0" width="" height="" class="right"/><br />
</a><br />
<br clear="all"/><br />
<span class="right" style="font-size: smaller"><br />
<a href="http://www.ceaco.com/ceaco/index.php?category=Pieceless%20Puzzles">Image is a Pieceless Puzzle, from Ceaco</a><br />
</span>
</div>
<p>Lately I've been working on a revision of one of my first Pathfinder projects, an internal agile management tool. Along with adding and rearranging some features, I'm also taking the opportunity to modernize some of the Rails 1.2 era code up to new Rails 2.1 and 2.2 features. </p>
<p>Note 1: I don't always (or often) recommend a wholesale update of working code when updating features. But this was a large enough feature change that cleaning up the code is worth the effort. </p>
<p>Note 2: When the time comes for you to perform a major refactoring like this remember that your tests have all the institutional memory about how the application should work. What I actually did was create a new blank project, and copy test files one by one. For each file, I commented all the tests, then uncomment them one at a time, rearranging the test as needed to match the new data model. Sometimes I take the new code directly from the previous version, sometimes I rewrite using a newer or better idiom. This gives me the benefits of test-driven design in my big refactor, while still preserving all the functional specification in my tests. (This seems to work better on models than controller/views, I'll probably have a fuller report next week).</p>
<p><span id="more-1260"></span><br />
There was one particular design decision in the original code that had always bothered me, but I could never think of a better solution. </p>
<p>In this system, the basic unit is the story. A story can belong to several other different entities in the system -- one or more users, an application, a specific iteration, and so on. Each of those entities, obviously has a <code>has_many</code> relationship with stories, and each one has a mostly-common set of functionality needed from that relationship -- how many stories have been done, how many are left, how many stories were done last week, and so on.</p>
<p>My original design placed all those common methods in a <code>StoryGroup</code> module. Each class that used stories had a declaration like this:</p>
<pre style="white-space: pre !important;">
class Application &lt; ActiveRecord::Base
  include StoryGroup
  has_many :stories
  ## and so on
end
</pre>
<p>Within the story group, there were a lot of methods that performed calculations and called back to class methods of Story, in part, that might look like this...</p>
<pre style="white-space: pre !important;">
Module StoryGroup
  def remaining_expected_hours
    Story.expected_hour_total(remaining_stories)
  end 

  def remaining_tasks
    stories.select{ |each| !each.complete? }
  end
end

Class Story
  def self.expected_hour_total(story_list)
    if story_list.blank? then return 0 end
    story_list.to_a.sum(&:expected_hours)
  end
end
</pre>
<p>Honestly, I can't quite recreate the rationale for having the <code>expected_hour_total</code> method as a class method of <code>Story</code>. I think it's because there was a usage within the <code>Story</code> class before there was a need for it among the <code>StoryGroup</code> classes.</p>
<p>I have two main problems with the structure of the old code. First, having to include the module and declare the <code>has_many</code> relationship always struck me as kind of dodgy. Second, calling back to a class method of <code>Story</code> that takes a list of stories as an argument is really ugly looking, and the class methods kind of gunk up the <code>Story</code> class with a lot of calculations that don't necessarily belong there.</p>
<p>Everything works in the old version, but I was pretty sure there was a cleaner way. In the new version I solve both problems (I think). The first problem is solved by taking a page from your basic <code>acts_as</code> plugin. The second problem is solved with named scopes. Named scopes are particularly helpful here, since they apply to both <code>Story</code> as a class and to any <code>has_many :stories</code> associations. As a result, all the common story functionality is easier and clearer to describe.</p>
<p>The new <code>StoryGroup</code> functionality is a module, now placed in the config/initializers directory. This seems a bit verbose, but most of it is the standard boilerplate for an ActiveRecord plugin -- the main functionality will be in the <code>InstanceMethods</code> submodule</p>
<pre style="white-space: pre !important;">
module ActiveRecord
  module HasManyStories

    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods
      def has_many_stories
        has_many :stories
        include ActiveRecord::HasManyStories::InstanceMethods
      end
    end

    module InstanceMethods
      def remaining_expected_hours
        stories.uncompleted.sum(:expected_hours)
      end
    end

  end
end
ActiveRecord::Base.send(:include, ActiveRecord::HasManyStories)
</pre>
<p>On initialization, the <code>has_many_stories</code> method is added to <code>ActiveRecord::Base</code>. Any ActiveRecord class that calls the method, then gets all the instance methods included within it (I've left out common class methods, because they are not needed for this example)</p>
<p>Adding the story relationship and the common methods is now down to a single line within the class:</p>
<pre style="white-space: pre !important;">
class Application &lt; ActiveRecord::Base
  has_many_stories
end
</pre>
<p>In the new module, the <code>remaining_expected_hours</code> method has changed, now calling the named scope <code>stories.uncompleted</code> rather than a class method. The scope definition itself is straightforward.</p>
<pre style="white-space: pre !important;">
class Stories
  named_scope :uncompleted,
      :conditions => {:state => ["new", "in_progress", "blocked"]}
end
</pre>
<p>As an added bonus, using the scope and appending <code>sum</code> to the scope now does the calculation in the database, which should be faster than the earlier version, which was calculating the sum in Ruby.</p>
<p>I like this cleanup. The individual methods within <code>StoryGroup</code> are now significantly simpler. The named scopes they depend on are also simpler and less distracting in the class then the previous class methods. Because the scopes are compossible, it's much easier to add calculations to the various slices of stories that the system needs.</p>
<p>What do you think? Have you had a similar problem? Is there a better way to solve it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/has-many-has_many-a-refactoring-story/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Hidden Power of Canvas</title>
		<link>http://www.pathf.com/blogs/2008/11/the-hidden-power-of-canvas/</link>
		<comments>http://www.pathf.com/blogs/2008/11/the-hidden-power-of-canvas/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 04:19:54 +0000</pubDate>
		<dc:creator>Dietrich Kappe</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Ajax]]></category>

		<category><![CDATA[Canvas]]></category>

		<category><![CDATA[DHTML]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1257</guid>
		<description><![CDATA[Whenever we have Flash versus DHTML discussions in the office, someone usually utters the words "you probably can't do it, unless you used Canvas and some fancy JavaScript..."
At times that can seem like a cop out, an admission of defeat in the face of the Flash arsenal of graphic effects. Somtimes, like today, it seems [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float:right;padding:10px" src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/projective-transform.png" alt="Projective Transform" />Whenever we have Flash versus DHTML discussions in the office, someone usually utters the words "you probably can't do it, unless you used Canvas and some fancy JavaScript..."</p>
<p>At times that can seem like a cop out, an admission of defeat in the face of the Flash arsenal of graphic effects. Somtimes, like today, it seems more like a visionary declaration of the power of Canvas. Check out <a href="http://acko.net/blog/projective-texturing-with-canvas" target="_blank">Steven Wittens'</a> use of <a href="http://ajaxian.com/archives/projective-texturing-using-canvas" target="_blank">Canvas for projective texturing</a>. Maybe there is a little bit more coolness left in these Ajax bones.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/the-hidden-power-of-canvas/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Review of fixture_replacement2 plugin</title>
		<link>http://www.pathf.com/blogs/2008/11/review-of-fixture_replacement2-plugin/</link>
		<comments>http://www.pathf.com/blogs/2008/11/review-of-fixture_replacement2-plugin/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 15:39:05 +0000</pubDate>
		<dc:creator>Jason Sendelbach</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[fixtures]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1248</guid>
		<description><![CDATA[We have been using fixture_replacement2 on some of our Ruby on Rails projects.  I am writing an internal application and finally switched over from using fixtures.  It took a bit of time to get the tests that I had written modified to stop using the fixture data, but now I am completely fixture [...]]]></description>
			<content:encoded><![CDATA[<p>We have been using <a href="http://github.com/ratnikov/fixture_replacement2/tree/master">fixture_replacement2</a> on some of our Ruby on Rails projects.  I am writing an internal application and finally switched over from using fixtures.  It took a bit of time to get the tests that I had written modified to stop using the fixture data, but now I am completely fixture free.  The tests are a lot easier to write, and I created a few helper methods that setup common datasets.  This way, I can call a setup method to configure my data, and then - it's all good. At first I called the method <strong>test_</strong>data_blah, and was wondering why I was getting an error running any test, so now it's called data_blah.  Doh!</p>
<p>At first I didn't like the fact that I needed to explicitly create the data for what I was working on, but then I realized that (especially for unit tests)  you don't need much dependent data; usually it's one or two records.  For functional tests, I found that the data setup methods rocked, as I could quickly get the data set up that I needed.I could quickly assert the content of the response, based on the data in my setup.  I missed fixtures at first, but now realize that over time, they are a pain.</p>
<p><span id="more-1248"></span></p>
<p>My unit tests used to take about 5 seconds, now it's around a minute.  I am not really happy about this, as I like to run rake before each commit, and I am apparently very impatient.  The luxury of fixtures is that it loads the data directly in the database, and skips the model validations and what-not.  The transaction is started, each test is run, and then the transaction is rolled back.  Now, all of my data setup occurs in the transaction rather than before it.</p>
<p>So, I think I am definitely using the plugin, but need to make sure not to create any more data than necessary for the tests I'm writing.  I guess I miss the speed of fixtures, but the benefits from the plugin seem to outweigh my impatience.  At first it seemed that fixtures were the way to go, but the more I use fixture replacement, the more I realize that I don't miss them at all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/review-of-fixture_replacement2-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Chess Game Viewer in GWT</title>
		<link>http://www.pathf.com/blogs/2008/11/chess-game-viewer-in-gwt/</link>
		<comments>http://www.pathf.com/blogs/2008/11/chess-game-viewer-in-gwt/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 23:14:35 +0000</pubDate>
		<dc:creator>Dietrich Kappe</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[chess]]></category>

		<category><![CDATA[Chesspresso]]></category>

		<category><![CDATA[GWT]]></category>

		<category><![CDATA[PGN]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1255</guid>
		<description><![CDATA[It's not quite done (the game notation looks like crap in IE), but I thought I'd give a taste of my latest labor of love, a chess game viewer in GWT. This is the sort of thing that is usually implemented as a Java Applet. A few others have already built chess viewers in GWT, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pathf.com/blogs/wp-content/uploads/2008/11/chessviewer.png"><img class="alignnone size-medium wp-image-1256" style="float:right;padding:10px" title="chessviewer" src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/chessviewer.png" alt="" width="300" height="177" /></a>It's not quite done (the game notation looks like crap in IE), but I thought I'd give a taste of my latest labor of love, a <a href="http://www.pathf.com/sites/pfd/test/ChessBoard/" target="_blank">chess game viewer in GWT</a>. This is the sort of thing that is usually implemented as a Java Applet. A few others have already built chess viewers in GWT, but as they say in Full Metal Jacket, "this one is mine." <img src='http://www.pathf.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>As I blogged <a href="http://www.pathf.com/blogs/2008/09/porting-java-libraries-jazzed-about-gwt/" target="_blank">a few weeks ago</a>, I ported the Java chess library <a href="http://www.chesspresso.org/" target="_blank">ChessPresso</a> into GWT, which was a blast and an example of how you can leverage existing Java libraries to write browser-based apps.</p>
<p>In the example, I've pulled the eleven games of the recently completed world championship between Anand and Kramnik in a single page. The GWT app identifies all of the relevant tags, reads the PGN (Portable Game Notation) in those tags, then inserts a game viewer widget into the page.</p>
<p>What isn't working yet:</p>
<ul>
<li>Doesn't look so good in IE (a little CSS work)</li>
<li>The notation pane isn't hooked in so you can click on a move and jump to the position</li>
</ul>
<p>Anyhow, have a look and let me know what you think.</p>
<p><strong>Update:</strong> OK, the notation panel is hooked up to allow clicking on moves to navigate aroung the game. Still looks like crap in IE, though.</p>
<p><strong>Update:</strong> for those interested in some of my very few games that make me look good, see <a href="http://www.pathf.com/sites/pfd/test/ChessBoard/dkappe.html" target="_blank">here</a>.</p>
<p><strong>Update:</strong> Another set of tweaks to display a collection of games, one 41 games PGN chunk and a 250 or so chunk. See <a href="http://www.pathf.com/sites/pfd/test/ChessBoard/other.html" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/chess-game-viewer-in-gwt/feed/</wfw:commentRss>
		</item>
		<item>
		<title>From JSP to Ruby on Rails: First thoughts on front-end coding conventions</title>
		<link>http://www.pathf.com/blogs/2008/11/from-jsp-to-ruby-on-rails-first-thoughts-on-front-end-coding-conventions/</link>
		<comments>http://www.pathf.com/blogs/2008/11/from-jsp-to-ruby-on-rails-first-thoughts-on-front-end-coding-conventions/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 21:00:01 +0000</pubDate>
		<dc:creator>Brian Dillard</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[HTML]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[JSP]]></category>

		<category><![CDATA[MVC]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1253</guid>
		<description><![CDATA[Now that I've got a few Ruby on Rails projects under my belt, I finally feel qualified to comment on Rails front-end coding conventions. As a UI specialist coming to Rails from the JSP world, I find a lot of room for improvement in the RoR approach to view-layer code. I love working on the [...]]]></description>
			<content:encoded><![CDATA[<p>Now that I've got a few Ruby on Rails projects under my belt, I finally feel qualified to comment on Rails front-end coding conventions. As a UI specialist coming to Rails from the JSP world, I find a lot of room for improvement in the RoR approach to view-layer code. I love working on the non-view aspects of RoR projects, but I find I've got to do tons of cleanup at the ERB layer. Expect to see some open-source components from Pathfinder to help ease this pain. In the meantime, let me articulate my pain points:</p>
<h3>Code organization</h3>
<p>If I'm filling a front-end role on a Rails project, most of the files I need are in /app/views and /public. I dig that. Likewise, I appreciate the underscore naming conventions for partials. However, I wish /layouts weren't just another subdirectory of /app/views. Layouts are inherently different from standard view templates. A better hierarchy within /app/views would help drive this home. Likewise, I wish partials and full templates each had their own directory within a specific controller's view folder. That would help keep directories manageable on big projects. The /public directory, on the other hand, offers just the right amount of organization.</p>
<p><span id="more-1253"></span></p>
<h3>Markup and styles</h3>
<p>Scaffolds are awesome for rapid prototyping, but the markup and styles they spit out reflect a standard of front-end coding that's several years out of date. Plenty of plugins tackle this very problem, but I'm disappointed to find so little attention to view-layer code from the core version of such a respected application platform.</p>
<p>In an ideal world, a platform famed for its convention-over-configuration approach would ship with a decent reset.css and a solid baseline stylesheet with reusable utility styles that rely on class rather than id attributes to work their magic. I'm not talking about layout so much as simple problems that have long been solved in the web standards world: pure CSS pipe-delimited lists, table-free form layouts and the like.</p>
<p>So much Rails development is about tweaking the defaults just enough to achieve the results you need. That means lots of crappy auto-generated markup ends up in production. Rails can't be all things to all people, but it would be cool if it didn't pump out antiquated UI code by default.</p>
<h3>Macros and view-logic encapsulation</h3>
<p>Tab-based templating systems make it easy to separate view logic from application logic. Whether you're using JSTL or a custom tag library, JSP 2.0 offers a specific syntax for templating that's different from the syntax used for model and controller logic. Sure, JSP tags compile down to Java, but they look different from regular Java. And sure, you can use scriptlets in JSP, but you don't have to.</p>
<p>In Rails, however, ERB looks like plain old Ruby code. It's hard to tell at a glance whether the Ruby contained in a template is doing view stuff or jumping the shark to tackle controller and model stuff. This makes it very difficult for either humans or automated tools to do sniff tests on Rails code for separation of concerns at the view layer.</p>
<p>Helpers exacerbate the problem. In JSP, if you need to create a view-layer macro, you do it as a tag. In Rails, you do it as a helper. But those helpers live in the same place as other, unrelated helpers from the controller. The result is a mixture of view code and controller code within the same directories and even the same files.</p>
<p>If experience has taught me anything, it's that controller logic and even model logic like to leak into the view. Without strong conventions to prevent this, it's too easy to compromise your MVC architecture and hinder the maintainability of your application. JSP offers better encapsulation of the view layer - a clear advantage.</p>
<h3>JavaScript</h3>
<p>I've posted before about my experiences <a href="http://www.pathf.com/blogs/2008/06/jquery-rails-agile-plantcollections-database-project-now-live/">dropping jQuery into Rails</a> and making it work. I'm not a huge fan of the tight coupling between a specific JavaScript framework and the core server-side framework. Nor do I love the lack of built-in progressive enhancement on many of the Rails Ajax helpers. I get why it's attractive to people without dedicated front-end resources. But for anybody who wants to do a really sophisticated behavior layer, Rails Ajax helpers are more of a hindrance than a help. <a href="http://ennerchi.com/projects/jrails">jRails</a> and other projects offer a way to drop jQuery into a project and still access the Rails Ajax helpers, but I'd love to see a different approach to sophisticated Rails Ajax, one that doesn't create apps that break when JavaScript is unavailable.</p>
<h3>Conclusions</h3>
</p>
<p>Of course, I'm still a Rails noob and have probably missed all sorts of best practices that could help ameliorate the bad and accentuate the good. Let me know in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/from-jsp-to-ruby-on-rails-first-thoughts-on-front-end-coding-conventions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Helpers and Partials</title>
		<link>http://www.pathf.com/blogs/2008/11/helpers-and-partials/</link>
		<comments>http://www.pathf.com/blogs/2008/11/helpers-and-partials/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 20:08:33 +0000</pubDate>
		<dc:creator>Noel Rappin</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1252</guid>
		<description><![CDATA[





Picture of Sinatra from WikipediaBecause he sang "Love and Marriage"..


Everybody sing! (to the tune of "Love and Marriage")
Helpers and Partials
Helpers and Partials
Go together like a
Fire and a Marshal.
Okay, that was silly. In my defense, the tune has been going through my head all day since I decided this would be my topic today.
Yes, we're back [...]]]></description>
			<content:encoded><![CDATA[<div class="right">
<a href=""><br />
<img src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/9101abd3-7800-40d6-966f-6e8950208ed9.jpg" alt="9101ABD3-7800-40D6-966F-6E8950208ED9.jpg" border="0" width="241" height="311" class="right"/><br />
</a><br />
<br clear="all"/><br />
<span class="right" style="font-size: smaller"><br />
<a href="/">Picture of Sinatra from Wikipedia<br/>Because he sang "Love and Marriage"..</a><br />
</span>
</div>
<p>Everybody sing! (to the tune of "Love and Marriage")</p>
<p>Helpers and Partials<br/><br />
Helpers and Partials<br/><br />
Go together like a<br/><br />
Fire and a Marshal.<br/></p>
<p>Okay, that was silly. In my defense, the tune has been going through my head all day since I decided this would be my topic today.</p>
<p>Yes, we're back in Chapter One Zillion And Three in the ongoing epic: How Do You Write View Code Anyway?</p>
<p>Previously, I had tried to move as much view code as possible to helper methods. This produced some interesting code, as well as a threatened revolt on the part of the non-Ruby programming HTML designers and architects who had to look at it. Pitchforks and torches were mentioned, and there was muttering about know-it-all code monkeys. The primary complaint was that non-Rubyists couldn't easily modify the code buried in tangled Ruby gunk in helpers. At the same time, everybody agrees that ERb code running all over the place is a total mess.</p>
<p>What to do, what to do?</p>
<p>Listen to me, of course. Here are my thoughts about managing view code. This week.</p>
<p><span id="more-1252"></span></p>
<h3>Keep the view code as close to HTML as you can</h3>
<p>This is something of a change for me -- I've always been a big fan of generating HTML from code, dating back to my first web apps. And I still think that generating HTML has a place. Still, working close to HTML has some advantages -- non-Ruby designers can tweak the view directly, which is much more efficient. It's easier for new people to join the team. ERb is, in my experience, close enough to HTML for people to be able to tweak. To give one other example, Haml is not.</p>
<h3>Treat ERb with the respect that you treat your code</h3>
<p>A slight attitude adjustment toward the ERb can help a lot. I see a lot of legacy Rails code that we get where the ERb files have been allowed to get out of hand in a way that a professional developer would never let plain Ruby code get out of hand. ERb is part of your code, and the same design principles that inform your code structure still apply. </p>
<ul>
<li>Don't Repeat Yourself in ERb</li>
<p/>
<li>Indentation and layout still help readability in HTML and ERb</li>
<p/>
<li>Refactoring ERb files is a valuable way to clean them up</li>
<p/>
<li>View code should be tested to ensure correct results</li>
</ul>
<p>And so on. Replacing ERb with Ruby in the preceding list would make it seem like complete newbie advice, but not everybody treats their ERb the same way.</p>
<h3>An individual ERb file is a method. Not a class.</h3>
<p>The biggest problem in ERb files is that they get long and raggedy, which makes it increasingly difficult to find what's going on and make changes -- in exactly the same way that long methods make Ruby code hard to manage.</p>
<p>Luckily this is reasonably easy to manage by aggressively breaking ERb code off into partial methods, in much the same way that a long method is best refactored into a series of smaller methods. I like to break off code inside loops into a partial, headers, footers, and sidebars of various types are obvious candidates. Really, any coherent block of the page should be in it's own partial.</p>
<p>Doing this has several advantages.</p>
<ul>
<li>Keeping the ERb files smaller makes them easier to follow. I start to get nervous when they go longer then a screen, which is a mere 35 lines or so on my monitor. Obviously, sometimes you need an ERb chunk to be longer, but a long ERb file should at least trigger a "can I split this" thought. </li>
<p/>
<li>Your main page ERb will likely then largely consist of calling several partials. If you give the partials meaningful names, it's very easy to follow what the page is doing, you get some self-commenting code.</li>
<p/>
<li>It's almost inevitable that you'll find reuse opportunities for some of your small partials, especially in an Ajax-heavy site.</li>
<p/>
</ul>
<p>The main disadvantage is that it can get tricky to find a specific piece of page if you need to follow the code through nested partials. I find that clear naming tends to make this a minor problem.</p>
<h3>Helpers are best used to help</h3>
<p>Helpers are most useful, I think, for small, boilerplate pieces of code that are used frequently and which are unlikely to be messed with by designers. Basically, you're using them to improve the API to make it more specific to your application. Looking at recent projects, I see things like:</p>
<ul>
<li>Wrappers around commonly used link_to and link_to_remote patterns</li>
<p/>
<li>Wrappers around common HTML patterns -- such as <code>header_row</code> or <code>label_block</code>. Most of these are very short.
	</li>
<p/>
<li>Block guards along the lines of <code>if_logged_in?</code></li>
<p/>
<li>Rarely, global data access methods along the lines of <code>current_user</code>, where it makes more sense to have a method rather than assign the data in some weird set of controller actions that might need it.</li>
<p/>
<li>As presenters, generating display-specific data based on a model, where you don't want to put the code in the model because it's view specific. The display-specific formatting of an address, for example.</li>
</ul>
<p>Going much beyond that, I find from somewhat painful experience, and you run the risk of having some opaque view code in your helpers.</p>
<p>Your turn. How are you structuring view code these days?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/helpers-and-partials/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing various roles in ruby on rails</title>
		<link>http://www.pathf.com/blogs/2008/11/testing-various-roles-in-ruby-on-rails/</link>
		<comments>http://www.pathf.com/blogs/2008/11/testing-various-roles-in-ruby-on-rails/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 17:12:54 +0000</pubDate>
		<dc:creator>Jason Sendelbach</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[TechDev]]></category>

		<category><![CDATA[Ruby on Rails testing role]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1250</guid>
		<description><![CDATA[On pretty much every project I've ever been on, there have always been various roles in the system that experience different behavior.  Admins can generally do everything, end users get the least functionality, and there are always a few in between that vary based on requirements.  Unfortunately, all too often all possible scenarios [...]]]></description>
			<content:encoded><![CDATA[<p>On pretty much every project I've ever been on, there have always been various roles in the system that experience different behavior.  Admins can generally do everything, end users get the least functionality, and there are always a few in between that vary based on requirements.  Unfortunately, all too often all possible scenarios aren't tested, or they test only positive cases for each role.</p>
<p>In my current Ruby on Rails project, I am checking all roles and ensuring those who should be able to do certain things are able to, and those that shouldn't are unable to.  What I have found, is that usually, the Admin and one other role can usually do a set of things, and every other role can't.  So, I find that I set up my tests the following manner:</p>
<pre class="ruby"><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'root'</span>,<span style="color:#996600;">'hr'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |role_name|
    context <span style="color:#996600;">&quot;logged in as #{role_name}&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      setup <span style="color:#9966CC; font-weight:bold;">do</span>
        login_as_user<span style="color:#006600; font-weight:bold;">&#40;</span>role_name<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      should <span style="color:#996600;">'index'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
         get <span style="color:#ff3333; font-weight:bold;">:index</span>
         assert_response <span style="color:#ff3333; font-weight:bold;">:success</span>
         <span style="color:#008000; font-style:italic;"># other assertions</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre>
<p><span id="more-1250"></span><br />
This is for the roles who cannot do the actions:</p>
<pre class="ruby"><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'user'</span>,<span style="color:#996600;">'manager'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |role_name|
    context <span style="color:#996600;">&quot;logged in as #{role_name}&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      setup <span style="color:#9966CC; font-weight:bold;">do</span>
        login_as_user<span style="color:#006600; font-weight:bold;">&#40;</span>role_name<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      should <span style="color:#996600;">'index'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
         get <span style="color:#ff3333; font-weight:bold;">:index</span>
         assert_redirected_to root_url
         <span style="color:#008000; font-style:italic;"># or logged out - or whatever you do with a violation of this type</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre>
<p>You can now see that we have automated tests that assert the expected functionality for all roles in the system.  As a developer who deploys and supports applications in production, it is very reassuring to me that our code has this level of tests.  I know that when I deploy, there won't be that many bugs, and I don't have to fear production deployments; just schedule them and perform them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/testing-various-roles-in-ruby-on-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Skinning Flex with Illustrator CS3</title>
		<link>http://www.pathf.com/blogs/2008/11/skinning-flex-with-illustrator-cs3/</link>
		<comments>http://www.pathf.com/blogs/2008/11/skinning-flex-with-illustrator-cs3/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 15:46:06 +0000</pubDate>
		<dc:creator>Sasha Dzeletovic</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[TechDev]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[flex css]]></category>

		<category><![CDATA[flex skins]]></category>

		<category><![CDATA[illustrator cs3]]></category>

		<category><![CDATA[importing graphics to flex]]></category>

		<category><![CDATA[skins]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1249</guid>
		<description><![CDATA[There is many ways to skin Flex applications. To name some that I've used: Flex CSS, Programmatic AS3, Flash, Degrafa, Photoshop (JPG's, GIF's and PNG's) and Illustrator.
What usually needs to happen on a project is a combination of some or all of the above. Not having a single point of reference for skinning creates quite [...]]]></description>
			<content:encoded><![CDATA[<p>There is many ways to skin Flex applications. To name some that I've used: Flex CSS, Programmatic AS3, Flash, Degrafa, Photoshop (JPG's, GIF's and PNG's) and Illustrator.</p>
<p>What usually needs to happen on a project is a combination of some or all of the above. Not having a single point of reference for skinning creates quite a bottleneck.</p>
<p>From different approaches, two surfaced as having the best pipeline: Illustrator CS3 and Degrafa. If we are talking speed and ease of graphic design, I would now default to Illustrator CS3. For advanced skinning and interactions Degrafa holds first place.</p>
<p><span id="more-1249"></span></p>
<p>Speed, of course, is a major factor. A lot of projects do not need advanced skinning, but just a step forward from useful but many times seen default Flex skins. By that I mean applying the brand guidelines of the company or product/service.</p>
<p>After a long time I gave Illustrator another chance and the CS3 version proved remarkably useful. Illustrator with Flex CSS that is.</p>
<p>My goal was to create the fore mentioned single point of reference for skins and I did it in Flex CSS. Good people of Adobe even made a script for Illustrator to speed things up which I gladly use. Process works fine without the script too (maybe even faster, but you have more skins to track yourself), and you can find a tutorial for that version <a href="http://www.adobe.com/devnet/flex/articles/flex_skins_07.html" target="_blank">here</a>.</p>
<p>For the streamlined version you can find Illustrator scripts <a href="http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex_skins" target="_blank">here</a> (together with scripts for other apps) and you need to have a free Adobe account to download.</p>
<p><b>STEPS:</b></p>
<p><b>1.</b> Download the Illustrator scripts from <a href="http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex_skins" target="_blank">here</a>. You can find the installation instructions in the downloaded archive.<a href="http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex_skins" target="_blank"><br />
</a></p>
<p><b>2.</b> Create your skins for various states of the component in Illustrator as you would do usually using all the wonderful features of Illustrator.</p>
<p><b>3.</b> Convert your skins to Symbols.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>a.</b> Open the Symbols panel in Illustrator (Window -&gt; Symbols).</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>b.</b> Select a particular skin graphic that you have made.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>c.</b> Click the "New Symbol" icon in the bottom right corner of the Symbol panel.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>d.</b> Naming the symbol is important. For example, if you want to automate creating an "up" state skin for a button, you would name it myButton_upSkin. For "down" state you would select an appropriate graphic to create a symbol from and name it myButton_downSkin. So for every state you want, you would add an underscore and state name after the symbol name that needs to be camelCase.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>e.</b> I would highly recommend setting the "Flash Registration" point to upper left corner to be in sync with standard flex registration point.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>f.</b> If you want to have the symbol to scale using 9-slice approach, check the box labeled "Enable guides for 9-slice scaling". You can later go back to your symbol and adjust the slices position.</p>
<p><b>4.</b> Now that you have made the symbol (and adjusted slicing if need be), you can export it by choosing:</p>
<p>File -&gt; Scripts -&gt; Flex Skin -&gt; Export Flex Skin.</p>
<p>A SWF file will be created by name of your choice.</p>
<p><b>5.</b> Go to Flex Builder and choose:</p>
<p>File -&gt; Import -&gt; Skin Artwork</p>
<p><b>6.</b> Set up parameters in the dialog box like this:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>a.</b> Select "SWC of SWF file" and point to the file you've just created in Illustrator.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>b.</b> Select the folder you want to import it in.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>c.</b> Click "Next".</p>
<p><b>7.</b> At this window you will be prompted to select the skins that you want to import. No reason not to "Check All" here. For the selected skins you will now see the states of the particular skin in the "Skin Part" Column.</p>
<p><b>8.</b> Click "Finish" and a Flex CSS file will be made with all the skins appropriately declared.</p>
<p><b>9.</b> All you have to do now is to apply the name of a particular skin to your components Style name.</p>
<p>This skining approach has proven very fast and error free for me.</p>
<p>I'm enjoying the 9-slice scaling, vector graphic crisp scaling and mouse interaction only with visible pixels.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/skinning-flex-with-illustrator-cs3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What makes a good requirement document for an agile project</title>
		<link>http://www.pathf.com/blogs/2008/11/what-makes-a-good-requirement-document-for-an-agile-project/</link>
		<comments>http://www.pathf.com/blogs/2008/11/what-makes-a-good-requirement-document-for-an-agile-project/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 17:26:38 +0000</pubDate>
		<dc:creator>Jason Sendelbach</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1223</guid>
		<description><![CDATA[As a developer, I start from requirements.  I have worn project management and business analyst 'hats' on many projects (but I am a geek, as I really enjoy the developer hat the most). My coworker, Alice Toth, has come up with a pretty awesome template and style of writing requirements that seems to be [...]]]></description>
			<content:encoded><![CDATA[<p>As a developer, I start from requirements.  I have worn project management and business analyst 'hats' on many projects (but I am a geek, as I really enjoy the developer hat the most). My coworker, Alice Toth, has come up with a pretty awesome template and style of writing requirements that seems to be perfect for the agile development methodology.  Too often, I see struggling projects struggle, because their requirements suck.  I look at their "requirements" and they are nothing more than a picture with a bunch of notes.  The developers have so many questions, and in general, all people involved (client, developers, BAs, IAs and testers) don't have a good understanding of the system as a whole, and what are the various personas that use the system.</p>
<p>I have worked on projects that have used Use Cases and Functional Specifications, but these never seem to convey all the necessary information for all involved.  They tend to be very verbose, and they are really not fun to write, read or manage.  A good requirement should tell each audience member exactly what the expected functionality is, and never generate a myriad of questions from all involved.  It's often difficult to solicit information from a client, but documenting for developers should never be that hard.  Here is a recap of what a good requirement is:</p>
<p><span id="more-1223"></span></p>
<p><strong>Good Requirements:</strong></p>
<ul>
<li>User Stories</li>
<li>User Acceptance Tests</li>
<li>Workflow</li>
<li>Requirements (Details)</li>
<li>Wireframes</li>
</ul>
<p>Without any one of the aforementioned sections, the requirements start to lose value.  Each section brings a lot to the table, and too often they are judged as a "waste of time."  Much like pair programming, having each of the sections for your requirements actually creates a synergy, as the development process is sped up. (Sorry for the consultant buzzword, but it does)</p>
<ul>
<li><strong>User Stories</strong></li>
</ul>
<p>This states all of the scenarios of the users involved.  These should read:</p>
<p>As a SOME ROLE,<br />
I want to DO SOMETHING,<br />
So that I CAN GET SOME BENEFIT</p>
<p>The user stories are critical to lay out exactly who is going to do what, and for what reason(s).</p>
<ul>
<li><strong>User Acceptance Tests</strong></li>
</ul>
<p>These should include all scenarios outlined in the user stories.  These should not be too detailed (they don't need to mention specific screens or a complete list of actions to execute the steps).   These should read:</p>
<p>GIVEN that  condition 1 and condition 2....<br />
WHEN I do step 1, and step 2...<br />
THEN, desired result 1, desired result 2....</p>
<p>These define a set of actual scenarios a tester could walk through to assert that the feature is complete.  These are not detailed test scripts that you find in UAT.  They are meant to convey a set of tests that all involved can walk through to understand how the feature will work.</p>
<ul>
<li><strong>Workflow</strong></li>
</ul>
<p>This should include a picture of the screens involved.  Error states and view changes based on role should be  documented.  This picture is worth a thousand words, as the details of the flow through the feature can be quite complex, and this is hard to spell out the details in the next section.  We have been using <a href="http://www.gliffy.com/">Gliffy</a>, a confluence plugin, and it rocks.  It is a flash app that allows us to create and edit the workflows with eases.</p>
<ul>
<li><strong>Requirements (Details)</strong></li>
</ul>
<p>These are the details of the feature. Document all screen(s) and every field, label, validation, message, and action.  This is essentially the functional specification of the details of the screen(s) involved.  Because it is in the context of the wireframe (next section), it is more concise.  You can simply reference the field name, rather than verbosely state everything about the field.  You can keep the details to field length, required, etc.</p>
<ul>
<li><strong>Wireframes</strong></li>
</ul>
<p>A picture is required for each screen involved.  Wireframes can be simple drawings on a whiteboard that are photographed, or a set of boxes created in Visio or OmniGraffle (or anything really).  Some are photoshop-ed, and others are HTML. We have found that the best approach is HTML if that's your end result.  Recreating HTML that looks the exact same as a picture can be quite painful.  Usually, a visual designer is involved in creating the mock ups, and can easily do this work in HTML.  The developers can therefore take the exact HTML that is requested, and fill in their code as needed.</p>
<p>See Alice's <a href="http://www.pathf.com/blogs/2007/05/wireframes_much/">post</a> about wireframes, and Noel's <a href="http://www.pathf.com/blogs/2008/08/integrating-design-drafts-into-your-rails-app/">post</a> about how you can allow a designer to write the HTML within a rails application.</p>
<p><strong>Smooth Project</strong></p>
<p>If each iteration begins with all features fully documented in this format, it runs smoothly, and often finishes early, leaving time for those TODOs we all keep a list of.  I have found that when writing requirements in this format, many of my questions for the client comes from writing the very first two sections.  Coming up with the user stories and acceptance tests often find huge oversights of the feature, as you start to detail who will use it and in what ways.</p>
<p>Given that I am a user who clicks on a link....  well  - what if that user doesn't have access to view the link?  Details like this help generate a list of questions for the client, who often can't think that far ahead with respect to the complexities of the system.  Writing the requirements to this level of details, ensures that oversights are found early, and before any code is written.  Unfortunately, all too often, some project managers don't see the value in ensuring requirements are complete before they get the developers involved.  This always leads to chaos during the iterations and is a recipe for disaster.  I have found that projects that have finished requirements before iterations are often under-budget, and the team members are quite happy to be on the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/what-makes-a-good-requirement-document-for-an-agile-project/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing Edge Ferret/acts_as_ferret</title>
		<link>http://www.pathf.com/blogs/2008/11/installing-edge-ferretacts_as_ferret/</link>
		<comments>http://www.pathf.com/blogs/2008/11/installing-edge-ferretacts_as_ferret/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 19:12:27 +0000</pubDate>
		<dc:creator>Anthony Caliendo</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[acts_as_ferret]]></category>

		<category><![CDATA[ferret]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1246</guid>
		<description><![CDATA[
If you do a gem install ferret, you will be getting 0.11.6.  The latest stable version of acts_as_ferret is 0.4.3.  Both of these versions were released nearly a year ago in November 2007.  Since then, there have been various performance improvements and bug fixes which you'll be missing out on.  In [...]]]></description>
			<content:encoded><![CDATA[<div class="right"><a href="http://github.com/dbalmain/ferret/tree/master"><img class="alignnone size-medium wp-image-1247" src="http://www.pathf.com/blogs/wp-content/uploads/2008/11/ferret_logo.png" alt="" width="240" height="100" /></a></div>
<p>If you do a <code>gem install ferret</code>, you will be getting 0.11.6.  The latest stable version of acts_as_ferret is 0.4.3.  Both of these versions were released nearly a year ago in November 2007.  Since then, there have been various performance improvements and bug fixes which you'll be missing out on.  In order to get the latest versions, you'll need to do a little bit of work but I would recommend it if an update is feasible for you.</p>
<p>Since it will be the easiest, let's begin with acts_as_ferret.<br />
<span id="more-1246"></span></p>
<h1>acts_as_ferret</h1>
<p>Installing the latest version of acts_as_ferret is pretty straight forward, as the <a href="http://projects.jkraemer.net/acts_as_ferret/#InsideyourRailsproject">documentation</a> for it is pretty clear.</p>
<p>If you are starting a new project:</p>
<pre>script/plugin install svn://projects.jkraemer.net/acts_as_ferret/trunk/plugin/acts_as_ferret</pre>
<p>If you are updating an existing project:</p>
<pre>script/plugin install svn://projects.jkraemer.net/acts_as_ferret/trunk/plugin/acts_as_ferret --force</pre>
<p>The <code>--force</code> option will force a re-install.</p>
<h1>Ferret</h1>
<p>Ferret is a bit more involved.  The gem on <a href="http://rubyforge.org/">RubyForge</a> is version 0.11.6.  Ferret has been moved to <a href="http://github.com/">github</a>, but sadly the github gem source does not include ferret.  In order to install an updated ferret gem, we will need to compile it and install it by hand.  Thankfully, this process is not difficult.</p>
<p>Unfortunately, the ferret <a href="http://ferret.davebalmain.com/">project site</a> has been down for a few days now.  Google cache does have a copy of the instructions from the site for installing edge as a gem on your machine; however, the instructions are old and a little inaccurate for the latest version.  Despair not! I went through this process yesterday and this is what worked for me.</p>
<h3>Checkout and Compile</h3>
<p>First, we need to checkout the latest ferret code.  This will require <a href="http://git.or.cz/">git</a>.</p>
<pre>$ cd /tmp
$ git clone git://github.com/dbalmain/ferret.git</pre>
<p>Next, let's run the tests to make sure everything is working right.  This step will compile the code, which will take a little bit of time before the tests are run.</p>
<pre>$ cd ferret/ruby
$ rake</pre>
<blockquote><p>
If this fails, you will need to make a slight change to the rake task.  I got the following error message while running this on a mac: <code>rake aborted! WIN32 has been removed, use CURRENT instead</code>.</p>
<p>Do the following step <strong>only</strong> if you get this error and you are not on a windows machine.<br />
Change the following lines in <em>ferret/ruby/Rakefile</em></p>
<pre>windows = (RUBY_PLATFORM =~ /win/) rescue nil
SUDO = windows ? "" : "sudo "</pre>
<p>to</p>
<pre>windows = false</pre>
<p>Then, run rake again.</p></blockquote>
<p>Now, we need to build the ferret gem.</p>
<pre>$ rake package</pre>
<p>Simple, right?</p>
<h3>Installation</h3>
<p>Installing the gem is simple as well.</p>
<pre>$ cd pkg/
$ sudo gem install ferret-0.11.8.gem</pre>
<p>Of course, if there is a different version number you should use that instead.  Feel free to uninstall the old gem if you want.</p>
<p>If you unpacked the ferret gem in your rails app, you will need to remove it and unpack this new version.  Navigate to your rails app directory.</p>
<pre>$ rm -rf vendor/gems/ferret-0.11.6
$ rake gems:unpack ferret</pre>
<p>You will probably need to rebuild your index, as I do not believe a 0.11.6 index is compatible with 0.11.8 (I needed to rebuild it).</p>
<pre>$ rake ferret:rebuild</pre>
<p>I would highly recommend that you run your tests for your app, to make sure nothing was broken.  Assuming everything went well, you should now be using the latest versions of ferret and acts_as_ferret.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/installing-edge-ferretacts_as_ferret/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Speed Up Ferret/acts_as_ferret Bulk Indexing</title>
		<link>http://www.pathf.com/blogs/2008/11/speed-up-ferretacts_as_ferret-bulk-indexing/</link>
		<comments>http://www.pathf.com/blogs/2008/11/speed-up-ferretacts_as_ferret-bulk-indexing/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 22:21:00 +0000</pubDate>
		<dc:creator>Anthony Caliendo</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[acts_as_ferret]]></category>

		<category><![CDATA[ferret]]></category>

		<category><![CDATA[fulltext search]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1234</guid>
		<description><![CDATA[Image by hyperhaus
Those of you using ferret 0.11.6 (the latest released gem) and acts_as_ferret 0.4.3 (the latest stable version) may have noticed that rebuilding an index can be painfully slow when working with a large number of documents. Even if each document contains a relatively small amount of text, indexing crawls with a large set [...]]]></description>
			<content:encoded><![CDATA[<div class="right"><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/09/ferret.jpg'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/09/ferret.jpg" alt="by hyperhaus" width="199" height="172" class="alignnone size-medium wp-image-1144" /></a><br><a href="http://www.flickr.com/photos/hyperhaus/2693701798/">Image by hyperhaus</a></div>
<p>Those of you using ferret 0.11.6 (the latest released gem) and acts_as_ferret 0.4.3 (the latest stable version) may have noticed that rebuilding an index can be painfully slow when working with a large number of documents. Even if each document contains a relatively small amount of text, indexing crawls with a large set of documents.  The problem is a result of how bulk update works; "bulk indexing" processes a single document at a time!  Fortunately, there is a simple patch which will provide a significant speed boost.</p>
<p><span id="more-1234"></span></p>
<p>There is a fairly old <a href="http://projects.jkraemer.net/acts_as_ferret/ticket/202">trac ticket</a> where Francois Lagunas posted a clever patch which will make bulk indexing process documents as a group.  Here is a monkey patch based on what he submitted as a patch (in Rails, just drop this as a file into <em>config/initializers</em>).</p>
<pre>class Ferret::Index::Index

  def update_batch(docs)
    @dir.synchrolock do
      ensure_writer_open()
      commit = false
      docs.each do |id, value|
        delete(id)
        commit = true if id.is_a?(String) or id.is_a?(Symbol)
      end
      if commit
        @writer.commit
      end
      ensure_writer_open()
      docs.each do |id, new_doc|
        @writer &lt;&lt; new_doc
      end
      flush() if @auto_flush
    end
  end

end

class ActsAsFerret::BulkIndexer

  def index_records(records, offset)
    docs = {}
    batch_time = measure_time {
      records.each { |rec| docs[rec.id] = rec.to_doc if rec.ferret_enabled?(true) }
      @index.update_batch(docs)
    }.to_f
    @work_done = offset.to_f / @model_count * 100.0 if @model_count &gt; 0
    remaining_time = ( batch_time / @batch_size ) * ( @model_count - offset + @batch_size )
    @logger.info "#{@reindex ? 're' : 'bulk '}index model #{@model.name} : #{'%.2f' % @work_done}% complete : #{'%.2f' % remaining_time} secs to finish"

  end

end</pre>
<p>If you are using a newer version of ferret by building the gem yourself, the ferret side of this patch is already included (although, you do need to make a slight change on the acts_as_ferret side).  Stay tuned for another post about how to do this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/speed-up-ferretacts_as_ferret-bulk-indexing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The courage to redesign</title>
		<link>http://www.pathf.com/blogs/2008/11/the-courage-to-redesign/</link>
		<comments>http://www.pathf.com/blogs/2008/11/the-courage-to-redesign/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 22:12:54 +0000</pubDate>
		<dc:creator>Brian Dillard</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[UXD]]></category>

		<category><![CDATA[Amazon]]></category>

		<category><![CDATA[Facebook]]></category>

		<category><![CDATA[FriendFeed]]></category>

		<category><![CDATA[Google]]></category>

		<category><![CDATA[iGoogle]]></category>

		<category><![CDATA[resesign]]></category>

		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1233</guid>
		<description><![CDATA[People are still griping about the recent redesigns of Facebook and iGoogle, but I think we should cheer on any company brave enough to disregard user feedback and embrace change.
Lots of big-name, highly successful sites eventually reach a state of paralysis in which they're too scared of alienating their customers to examine their interaction design [...]]]></description>
			<content:encoded><![CDATA[<p>People are still griping about the recent redesigns of <a href="http://www.facebook.com/group.php?gid=2298898409">Facebook</a> and <a href="http://www.macworld.co.uk/business/news/index.cfm?newsid=23235&pagtype=allchandate">iGoogle</a>, but I think we should cheer on any company brave enough to disregard user feedback and embrace change.</p>
<p>Lots of big-name, highly successful sites eventually reach a state of paralysis in which they're too scared of alienating their customers to examine their interaction design and information architecture from a fresh perspective.</p>
<h3>The cautionary tale of Amazon.com</h3>
<p>Look at Amazon: The online retailer <a href="http://www.pathf.com/blogs/2007/10/misuse-case-ama/">adopted DHTML navigation</a> just last year - at least 5 years after most other big sites - because its tab interface had grown so comically large. Nevertheless, huge chunks of the Amazon user experience are still massively broken:</p>
<ul>
<li>Once you've started down the checkout process, the site tries to keep you from getting back to your shopping cart to add or remove additional items. If you use your back button to do so, you've got to start the checkout process all over again.</li>
<li>Wish lists offer perhaps the most confusing, error-prone user interface I've ever had the displeasure to experience.</li>
<li>Link targets on a wide variety of UI controls are tiny and persnickety enough to elicit involuntary profanity.</li>
</ul>
<p><span id="more-1233"></span></p>
<p>Why does Amazon let its design blunders live on in perpetuity? It's simple: Redesigns confuse users, and confused users don't spend money. Your current customers have invested so much effort in learning to work around your site's shortcomings that a new interface stops them in their tracks. Even the most humane and usable UI refresh takes acclimation - and that may cost your site conversions and revenue in the meantime.</p>
<h3>The agony and the ecstasy of the redesign</h3>
<p>I learned this lesson the hard way during my days at <a href="http://www.internetretailer.com/internet/marketing-conference/40065-why-pg-shut-down-reflectcom.html">Reflect.com</a> and <a href="http://www.orbitz.com">Orbitz</a>, where A/B testing constantly shocked us by revealing that change, any change, causes key metrics to dip, at least temporarily. Redesign an unusable feature and test the old and new versions with your current customer base on the live site. Chances are, the old version will win in the short term. That's why it takes guts to even consider a top-to-tails redesign. If small changes can have a negative impact, big changes could be deadly.</p>
<p>To me, however, it seems as if the bigger danger lies in allowing your site's information architecture to become ossified. Eventually, new UI paradigms will offer your younger competitors an avenue for feature differentiation. I was at Orbitz when <a href="http://www.kayak.com">Kayak.com</a> launched, and I was sick with envy that a site could push the user experience of online travel into such new and compelling directions. I knew a company as large as mine could never rock the boat by switching to such an off-the-wall UI.</p>
<p>Sure, budget aggregator Kayak wasn't a direct competitor to an online travel agent like Orbitz. But if somebody had launched a full-service OTA with an interface as fresh as Kayak's, then <a href="http://www.expedia.com/">Expedia</a>, Orbitz and <a href="http://www.travelocity.com/">Travelocity</a> would have been forced to play catch-up. After all, it was UI differentiation that had originally allowed Orbitz to woo customers from other, more established competitors: Its matrix-based results pages provided a compelling new way to find cheap seats. Eventually, though, other sites copied that feature. Now, all the big OTAs match each other feature for feature.</p>
<h3>Beta sites: Hope for the future</h3>
<p>That's what's so impressive about today's crop of Web 2.0 upstarts. A young service such as FriendFeed can offer <a href="http://mashable.com/2008/09/18/friendfeed-beta-released/">an entirely separate, opt-in beta site</a> and tinker away at it without annoying current users. Then, once the geekier end of the user base has helped work out the kinks, the service can flip the switch and roll out its new features to everyone. That's exactly what Facebook did with its new interface, but at far greater risk than FriendFeed. Facebook may be obscenely overvalued, but it does function as a business. A redesign is far less scary for the relatively unmonetized FriendFeed.</p>
<p>Regardless of whether you're a social networking giant or a microblogging upstart, this kind of usability and design lab has become de rigueur. By acclimating your users to frequent change early on, you can help ensure that future refreshes don't send them packing. Amazon may be in a design coma, but your site shouldn't have to be. Have the courage to redesign early and often.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/the-courage-to-redesign/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scriptaculous: Fixing Hover After Highlight</title>
		<link>http://www.pathf.com/blogs/2008/11/scriptaculous-fixing-hover-after-highlight/</link>
		<comments>http://www.pathf.com/blogs/2008/11/scriptaculous-fixing-hover-after-highlight/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 16:34:28 +0000</pubDate>
		<dc:creator>Anthony Caliendo</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Scriptaculous]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1231</guid>
		<description><![CDATA[
One of the annoying things about the highlight visual effect in Scriptaculous is that it will break your :hover background-color CSS definitions.  The occurs because scriptaculous sets the background-color style property of the element to whatever it was set to before the effect began.  This behavior would be desirable if you're using inline [...]]]></description>
			<content:encoded><![CDATA[<div class="right"><a href='http://www.pathf.com/blogs/wp-content/uploads/2008/07/scriptaculous_logo.jpg'><img src="http://www.pathf.com/blogs/wp-content/uploads/2008/07/scriptaculous_logo.jpg" alt="" width="91" height="75" class="alignright size-medium wp-image-1052" /></a></div>
<p>One of the annoying things about the highlight visual effect in Scriptaculous is that it will break your <code>:hover</code> background-color CSS definitions.  The occurs because scriptaculous sets the background-color style property of the element to whatever it was set to before the effect began.  This behavior would be desirable if you're using inline styles or setting the style property through javascript, but you will run into issues if you're doing it The Right Way&#8482; and using CSS classes and <code>Element.add/removeClassName</code>.  Fortunately, there is an easy solution to this problem.</p>
<p><span id="more-1231"></span></p>
<p>To fix this on a case-by-case basis, you will need to use the <code>afterFinish</code> callback. </p>
<p>First, we'll define the function in some javascript so we can reuse it.</p>
<pre>
Object.extend(Effect.Highlight, {
  clearBackgroundStyle: function(effect) {
    effect.element.style.background = "";
  }
});
</pre>
<p>Unfortunately, we cannot use <code>Element.setStyle</code> to do this, as the blank style definition is ignored when going through prototype.</p>
<p>Now, we just need to set the callback.  If you're in rails and doing RJS, it will look something like this:</p>
<pre>
page.visual_effect(:highlight, dom_id(@smurf),
  :afterFinish =&gt; 'Effect.Highlight.clearBackgroundStyle'
)
</pre>
<p>Which will produce the following javascript:</p>
<pre>
new Effect.Highlight("smurf_7",{
  afterFinish: Effect.Highlight.clearBackgroundStyle
});
</pre>
<p>If you would prefer to just patch scriptaculous instead, just include the following javascript after <code>effect.js</code> from scriptaculous is loaded (a default rails app can drop it into application.js).</p>
<pre>
Object.extend(Effect.Highlight.prototype, {
  finish: function() {
    this.element.style.background = "";
  }
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/11/scriptaculous-fixing-hover-after-highlight/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rails 2.2 For Me And For You</title>
		<link>http://www.pathf.com/blogs/2008/10/rails-22-for-me-and-for-you/</link>
		<comments>http://www.pathf.com/blogs/2008/10/rails-22-for-me-and-for-you/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 19:24:51 +0000</pubDate>
		<dc:creator>Noel Rappin</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1228</guid>
		<description><![CDATA[




Photo: Blue Sky On Rails by ecstaticist


The Rails 2.2 release contains a number of big features that are going to be commented on endlessly, especially thread safety, internationalization, and ETag support. Going through the various release notes and what's new documents, I found a lot of smaller features that I'm looking forward to using in [...]]]></description>
			<content:encoded><![CDATA[<div class="right">
<a href="http://www.flickr.com/photos/ecstaticist/2589723846/"><br />
<img src="http://www.pathf.com/blogs/wp-content/uploads/2008/10/c56a48ed-db3b-418d-b304-670ceb9e0d63.jpg" alt="C56A48ED-DB3B-418D-B304-670CEB9E0D63.jpg" border="0" width="240" height="180" class="right"/></a><br />
<br clear="all"/><br />
<span class="right" style="font-size: smaller"><br />
<a href="http://www.flickr.com/photos/ecstaticist/2589723846/">Photo: Blue Sky On Rails by ecstaticist</a><br />
</span>
</div>
<p>The Rails 2.2 release contains a number of big features that are going to be commented on endlessly, especially thread safety, internationalization, and ETag support. Going through the various <a href="http://guides.rubyonrails.org/2_2_release_notes.html">release notes</a> and <a href="http://envycasts.com/products/ruby-on-rails-22-pdf">what's new documents</a>, I found a lot of smaller features that I'm looking forward to using in future projects, or would have made past projects easier, or are just cool in a framework-geek kind of way.</p>
<h3>The concat method no longer needs a block binding</h3>
<p>This may be the most subtle change I've ever been this excited about. Let's go back to the bad old days -- last week -- and say that you wanted to write a <a href="http://www.pathf.com/blogs/2008/07/pretty-blocks-in-rails-views/">block helper method like this:</a> </p>
<p><span id="more-1228"></span></p>
<pre style="white-space: pre !important;">
  def label_block(caption, &block)
    content = content_tag("span", caption) + capture(&block)
    concat(content_tag("label", content), block.binding)
  end
</pre>
<p>It's the <code>block.binding</code> part that was crazy-making. It was an implementation detail that was unfortunately exposed to the programmer (Since the ERb output stream was a private attribute, the method needed direct access to a binding frame to push text into the stream. I think.) Plus, it was off-putting to explain to new Rails programmers, and as an added bonus, made block helpers a total pain to test.</p>
<p>Well, now the ERb output stream is more accessible, and you can now do without the block.binding argument -- in fact, you'll get a DepricationWarning if you use it. You can just remove the argument from the helper, or since you no longer need the explicit block, the helper can now be written in a more Rubyish style:</p>
<pre style="white-space: pre !important;">
  def label_block(caption)
    concat("&lt;label&gt;")
    concat("&lt;span&gt;#{caption}&lt;/span&gt;")
    yield
    concat("&lt;/label&gt;")
  end
</pre>
<p>I'm also interested to see how this works with my <a href="http://www.pathf.com/blogs/2008/05/html-code-marku/">Html generator mini-library</a></p>
<h3>While On The Subject of Blocks</h3>
<p>There are two nice additions of things that now take blocks. The first is <code>link_to</code>, as in:</p>
<pre style="white-space: pre !important;">
    &lt;% link_to(@project) do %&gt;
      "Caption"
      &lt;%= image_tag(@project.image_url) %&gt;
    &lt;% end %&gt;
</pre>
<p>Also, partials now take blocks, meaning they can act somewhat like layouts.</p>
<p>The partial itself can contain a <code>yield</code>:</p>
<pre style="white-space: pre !important;">
   &lt;table&gt;
     &lt;tr&gt;&lt;td&gt;
       &lt;%= yield %&gt;
     &lt;/td&gt;&lt;/tr&gt;
   &lt;/table&gt;
</pre>
<p>Then the call to the partial can include a block:</p>
<pre style="white-space: pre !important;">
&lt;% render :partial =&gt; "table_partial" do %&gt;
  &lt;%= @project.name %&gt;
&lt;% end %&gt;
</pre>
<p>And the <code>yield</code> command invokes the block, as you would expect</p>
<h3>Rails Guides</h3>
<p>For this release, Rails has added a number of in-depth guides to various and sundry rails features, accessible at <a href="http://guides.rubyonrails.org/">http://guides.rubyonrails.org/</a> or by <code>rake doc:guides</code> from your command line.</p>
<h3>Better error message for assert_difference</h3>
<p>Speaking of minor changes that make me happy, the error message for an <code>assert_difference</code> failure now actually contains the text of the failing expression, as in "&lt;projects.count&gt; was the expression that failed". I actually saw this one in my testing before I saw it in the release notes. Since it's pretty common for me to nest <code>assert_difference</code> calls when multiple objects are being created at one time, this made me smile.</p>
<h3>Performance Tests</h3>
<p>And.... another chapter of my book gets further out of date with the inclusion of performance tests that are essentially wrappers around the ruby-prof profiling module. A new generator, <code>performance_test</code>, places tests in a <code>test/performance</code> directory. Inside each test you can do integration test style calls to controllers, and you get nice ruby-prof profiling reports on the results.</p>
<p>This feature, at least in, release candidate, does not seem totally polished. Couple of notes -- it requires ruby-prof 0.6.1, which is not the version available via regular gem methods, it seems like you need to get it <a href="http://github.com/nitay/ruby-prof/tree/master">at github</a>, and install via the directions <a href="http://snippets.aktagon.com/snippets/255-How-to-profile-your-Rails-and-Ruby-applications-with-ruby-prof">here</a>. </p>
<p>There also isn't a rake task to run the performance tests, you need to run them as individual Ruby scripts, which means, if you are like me, then you will be scrambling a bit to make sure the Rails environment loads properly.</p>
<h3>second through tenth</h3>
<p>This is the sort of nearly pointless syntactic sugar that I love. I mean, nearly pointless in the best and most respectful way, because I plan to use this all over the place. It's actually very Lisp-like...</p>
<pre style="white-space: pre !important;">
&gt;&gt; players = %w(who what i_dont_know today tomorrow why because i_dont_care)
=&gt; [&quot;who&quot;, &quot;what&quot;, &quot;i_dont_know&quot;, &quot;today&quot;, &quot;tomorrow&quot;, &quot;why&quot;, &quot;because&quot;, &quot;i_dont_care&quot;]
&gt;&gt; players.second
=&gt; &quot;what&quot;
&gt;&gt; players.fifth
=&gt; &quot;tomorrow&quot;
</pre>
<p>I would love to see a knock-down drag-out argument about the merits of players.second versus players[1]...</p>
<h3>assert_sql</h3>
<p>This may seem a little esoteric, but I have a reporting feature where I would have used this test extensively. Probably good for searches too. It checks for a match between the argument to the method and SQL generated inside the block.</p>
<pre style="white-space: pre !important;">
should "produce correct sql" do
  assert_sql(/LIKE \'me\'/) do
    Product.report(params)
  end
end
</pre>
<h3>StringInquirer</h3>
<p>I like this because it's such a nice Rails metaprogramming thing.</p>
<pre style="white-space: pre !important;">
&gt;&gt; role = ActiveSupport::StringInquirer.new(&quot;admin&quot;)
=&gt; &quot;admin&quot;
&gt;&gt; role.admin?
=&gt; true
&gt;&gt; role.user?
=&gt; false
</pre>
<p>I like it. Here's the entire implementation of the class</p>
<pre style="white-space: pre !important;">
  class StringInquirer < String
    def method_missing(method_name, *arguments)
      if method_name.to_s[-1,1] == "?"
        self == method_name.to_s[0..-2]
      else
        super
      end
    end
  end
</pre>
<p>That's pretty.</p>
<h3>Rails scaffolds now generate belong_to links</h3>
<p>And finally...</p>
<pre style="white-space: pre !important;">
script/generate scaffold task name:string project:references
</pre>
<p>Will now generate </p>
<pre style="white-space: pre !important;">
class Task &lt; ActiveRecord::Base
  belongs_to :project
end
</pre>
<p>A small thing, but useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/10/rails-22-for-me-and-for-you/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Everything&#8217;s Coming Up Windows</title>
		<link>http://www.pathf.com/blogs/2008/10/everythings-coming-up-windows/</link>
		<comments>http://www.pathf.com/blogs/2008/10/everythings-coming-up-windows/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 00:07:28 +0000</pubDate>
		<dc:creator>Dietrich Kappe</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Disruption]]></category>

		<category><![CDATA[Amazon]]></category>

		<category><![CDATA[Azure]]></category>

		<category><![CDATA[Cloud Computing]]></category>

		<category><![CDATA[EC2]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[S3]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1226</guid>
		<description><![CDATA[I've been beating the drum of cloud computing and the advantage that it gives to companies building solutions on Linux. Microsoft needed to respond. Well, now we have two solutions for Windows on demand:

Amazon EC2 is offering Windows on EC2, with the pricing at $0.125 per hour for a small instance running Windows Server (as [...]]]></description>
			<content:encoded><![CDATA[<p>I've been beating the <a href="http://www.pathf.com/blogs/2008/05/agile-business/" target="_blank">drum of cloud computing</a> and the advantage that it gives to companies building solutions on Linux. Microsoft needed to <a href="http://www.pathf.com/blogs/2008/10/microsoft-to-jump-on-board-ec2/" target="_blank">respond</a>. Well, now we have two solutions for Windows on demand:</p>
<ul>
<li>Amazon EC2 is offering <a href="http://aws.amazon.com/ec2/" target="_blank">Windows on EC2</a>, with the pricing at $0.125 per hour for a small instance running Windows Server (as compared to $0.10 for a Linux instance). You can run SQL Server Express at no extra charge. The SQL Server Standard smallest instance (Stadard Large) rings in at $1.10 per hour, however, which ain't such a good deal.</li>
<li>Microsoft's <a href="http://www.microsoft.com/azure/default.mspx" target="_blank">Azure Services Platform</a>. It's still in community evaluation mode, but there is one thing that is already clear about it: it's as confusing as all git out. One of the advantages of Amazon's services like S3 and EC2 is that they are simple and can form the building blocks for other applications and services.</li>
</ul>
<p>If I'm provisioning a web application, I'm pretty comfortable thinking in terms of virtual servers or instances. Not sure how to think about scaling and cost with Azure. I think MS would have done better to start out with a KISS approach to drive adoption. Time will tell if their "it can cure cancer" approach will work out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/10/everythings-coming-up-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Review of EnvyCast: Ruby on Rails 2.2 Screencast</title>
		<link>http://www.pathf.com/blogs/2008/10/review-of-envycast-ruby-on-rails-22-screencast/</link>
		<comments>http://www.pathf.com/blogs/2008/10/review-of-envycast-ruby-on-rails-22-screencast/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 18:08:06 +0000</pubDate>
		<dc:creator>Noel Rappin</dc:creator>
		
		<category><![CDATA[Agile Ajax]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=1222</guid>
		<description><![CDATA[





Promotional image from envycasts.com


This week, Rails 2.2 Release Candidate one was loosed on an unsuspecting public. Friday, I'll post about the Rails 2.2 features that I'm most excited about working with. Today, I'm going to review Gregg Pollack and Jason Seifer's screencast on new Rails features (and the associated PDF document by Carlos Brando and [...]]]></description>
			<content:encoded><![CDATA[<div class="right">
<a href="http://www.envycasts.com"><br />
<img src="http://www.pathf.com/blogs/wp-content/uploads/2008/10/envy.jpg" alt="envy.jpg" border="0" width="236" height="175" class="right"/><br />
</a><br />
<br clear="all"/><br />
<span class="right" style="font-size: smaller"><br />
<a href="http://www.envycasts.com">Promotional image from envycasts.com</a><br />
</span>
</div>
<p>This week, <a href="http://weblog.rubyonrails.org/2008/10/24/rails-2-2-rc1-i18n-thread-safety-docs-etag-last-modified">Rails 2.2 Release Candidate one</a> was loosed on an unsuspecting public. Friday, I'll post about the Rails 2.2 features that I'm most excited about working with. Today, I'm going to review Gregg Pollack and Jason Seifer's <a href="http://envycasts.com/products/ruby-on-rails-22-package-deal">screencast</a> on new Rails features (and the associated PDF document by Carlos Brando and Carl Youngblood.)</p>
<p>In the interests of full disclosure, I should mention that we received a review copy of the screencast. In the interest of fuller disclosure, I'll add that had the email from them come even 10 minutes later than it did, I would have already bought it myself (I really was just about to go to their site and buy when I got the email) -- I really liked <a href="http://envycasts.com/products/advanced-activerecord">their first screencast on ActiveRecord</a>. And I really liked this one, as well.</p>
<p><span id="more-1222"></span><br />
Like their first EnvyCast, the Rails 2.2 cast consists primarily of Gregg and Jason talking directly to the audience while code samples and diagrams appear in greenscreen behind them, with a lot of Keynote-style effects. They've raised the bar in terms of the visual presentation of screencast code. It's a lot more engaging then the typical screencast (including <a href="http://www.wrox.com/WileyCDA/Section/id-321347.html">my own</a>). We showed the video in a meeting for all our developers, which I don't think we could have done with a more traditional screencast. Gregg and Jason use the visuals to make the changes between Rails 2.1 and Rails 2.2 code extremely clear. The visual effects don't feel gimmicky or overdone, but nicely focus attention at the important parts of the new code and features.</p>
<p>In particular, the section on the new ETag features is outstanding, clearly explaining what the feature does and how you might use it. This is potentially one of the most important features in the new release. I knew very little about it going into watching the video, and now I am ready to start using the ETag feature in some of our projects.</p>
<p>The video is split into different sections for the different Rails sections with updates -- ActiveRecord, ActiveSupport, ActionPack, ActionController, etc, and covers a lot of ground in 45 minutes. The PDF is even more detailed. I've just started working in Rails 2.2 and I learned about several features that I can't wait to try out.</p>
<p>Overall the two make an excellent guide to the latest and greatest in Rails 2.2. The screencast and PDF are well worth your time and money if and when you are planning on working in Rails 2.2.  </p>
<p>Quick notes:</p>
<ul>
<li>I would have liked to have gotten more detail on the internationalization features, and to a slightly lesser extent more detail on the costs and benefits of thread safety.</li>
<li>My favorite of the cheesy jokes was the one about the rejected method <code>eighthiest</code>, returning true if the object doesn't believe in the existence of <code>Enumerable</code>.</li>
<li>I would have liked a little more acknowledgement that some of the changes were big and some were just little tweaks. I realize that you don't want to put all the big changes up front and then end with twenty minutes of little tweaky things. Still, the video feels a little scattershot at times, and a couple of "here are a few new little code-cleanup features" kind of would have minimized that.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.pathf.com/blogs/2008/10/review-of-envycast-ruby-on-rails-22-screencast/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
