<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Manas</title>
	<atom:link href="http://www.manas.com.ar/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.manas.com.ar</link>
	<description>Thinking code</description>
	<lastBuildDate>Thu, 12 Apr 2012 20:00:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to check if object can be destroyed if it has dependent: restrict associations</title>
		<link>http://www.manas.com.ar/spalladino/2012/01/31/how-to-check-if-object-can-be-destroyed-if-it-has-dependent-destroy-associations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-check-if-object-can-be-destroyed-if-it-has-dependent-destroy-associations</link>
		<comments>http://www.manas.com.ar/spalladino/2012/01/31/how-to-check-if-object-can-be-destroyed-if-it-has-dependent-destroy-associations/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 14:35:14 +0000</pubDate>
		<dc:creator>Santiago Palladino</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/spalladino/?p=350</guid>
		<description><![CDATA[Rails provides several handy options for specifying how to deal with associated models upon deletion, for example: class Blog has_many :posts, :dependent =&#62; :destroy end The destroy value for the dependent option will call the destroy method for every post in the blog when the blog itself is destroyed. Other options are delete or nullify, &#8230; <a href="http://www.manas.com.ar/spalladino/2012/01/31/how-to-check-if-object-can-be-destroyed-if-it-has-dependent-destroy-associations/">more</a>]]></description>
			<content:encoded><![CDATA[<p>Rails provides <a href="http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_many-label-Options">several handy options</a> for specifying how to deal with associated models upon deletion, for example:</p>
<pre>
class Blog
  has_many :posts, :dependent =&gt; :destroy
end
</pre>
<p>The <em>destroy</em> value for the <em>dependent</em> option will call the destroy method for every post in the blog when the blog itself is destroyed. Other options are delete or nullify, but the one we are interested in is <strong>restrict</strong>.</p>
<p>By specifying a relation as dependent restrict, Rails will prevent us from destroying a particular object if it has any associated objects. In the example, we would not be able to destroy a Blog if it has any Posts. It is implemented simply, by raising an <a href="http://apidock.com/rails/ActiveRecord/DeleteRestrictionError">ActiveRecord::DeleteRestrictionError</a> if there is any associated object.</p>
<p>Now, this works perfectly for preventing us from accidentally destroying an object, but we will usually want to check if we can destroy it beforehand, this is, when rendering a page to the client with a big bad <em>delete</em> button. Showing a delete button only to show an alert box with a &#8220;Could not delete&#8221; annoying message is certainly not a good practice, we should simply not draw the delete button in the first place.</p>
<p>How do we check this? We could manually check if each and every one of the associations we have marked with dependent restrict in the object are empty, but taking Rails DRY principle into account, we would like to automatically get that information from the object.</p>
<p>Luckily, ActiveRecord provides <a href="http://api.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html">reflection methods</a> for obtaining info on the associations. Therefore, given an object, we can iterate its associations, and check if the restricted ones are empty or not.</p>
<p>This all boils down to <a href="https://gist.github.com/1710839">this small method</a>, which can be placed as an initializer in the Rails app:</p>
<pre>
class ActiveRecord::Base
  def can_destroy?
    self.class.reflect_on_all_associations.all? do |assoc|
      assoc.options[:dependent] != :restrict ||
        (assoc.macro == :has_one &amp;&amp; self.send(assoc.name).nil?) ||
        (assoc.macro == :has_many &amp;&amp; self.send(assoc.name).empty?)
    end
  end
end
</pre>
<p>That&#8217;s it! Now you can simply make a small helper method that renders a destroy link if can_destroy?, or a plain span notifying the user why she cannot destroy the object.<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/spalladino/2012/01/31/how-to-check-if-object-can-be-destroyed-if-it-has-dependent-destroy-associations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Default request parameters in Rails functional tests</title>
		<link>http://www.manas.com.ar/spalladino/2011/12/02/default-request-parameters-in-rails-functional-tests/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=default-request-parameters-in-rails-functional-tests</link>
		<comments>http://www.manas.com.ar/spalladino/2011/12/02/default-request-parameters-in-rails-functional-tests/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 16:01:46 +0000</pubDate>
		<dc:creator>Santiago Palladino</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/spalladino/?p=343</guid>
		<description><![CDATA[I was looking for an easy way to force every request in a functional test in Rails to use a set of parameters by default, regardless of being specified explicitly. This is, every time I write: it "should get index" do get :index end Rails should actually do: it "should get index" do get :index, &#8230; <a href="http://www.manas.com.ar/spalladino/2011/12/02/default-request-parameters-in-rails-functional-tests/">more</a>]]></description>
			<content:encoded><![CDATA[<p>I was looking for an easy way to force every request in a functional test in Rails to use a set of parameters by default, regardless of being specified explicitly. This is, every time I write:</p>
<pre>
it "should get index" do
  get :index
end
</pre>
<p>Rails should actually do:</p>
<pre>
it "should get index" do
  get :index, :foo =&gt; 'value'
end
</pre>
<p>Lacking any option in the testing framework, I opted for simply monkeypatching the <b>process</b> method in <a href="http://api.rubyonrails.org/classes/ActionController/TestCase/Behavior.html">ActionController::TestCase::Behaviour</a>. This method is invoked whenever methods <b>get</b>, <b>post</b>, <b>put</b>, <b>delete</b> or <b>head</b> are called, so it is the easiest single point to modify.</p>
<p><a href="https://gist.github.com/1423757">This gist</a> has the necessary code to perform the patch. If you are using <a href="https://www.relishapp.com/rspec">rspec</a>, simply copy the file in the spec/support folder.<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/spalladino/2011/12/02/default-request-parameters-in-rails-functional-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>InSTEDD at Pacific Endeavor 2011</title>
		<link>http://www.manas.com.ar/spalladino/2011/09/21/instedd-at-pacific-endeavor-2011/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=instedd-at-pacific-endeavor-2011</link>
		<comments>http://www.manas.com.ar/spalladino/2011/09/21/instedd-at-pacific-endeavor-2011/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 03:20:32 +0000</pubDate>
		<dc:creator>Santiago Palladino</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[Instedd]]></category>
		<category><![CDATA[Pacific Endeavor]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/spalladino/?p=311</guid>
		<description><![CDATA[Pacific Endeavor is a humanitarian communication workshop, organized by the US Pacific Command, which brings together military representatives from all SE Asia, NGOs and industry leaders. Its main goal is to improve the multi-national communications in HA/DR situations, based on the premise that communication is the foundation to a successful response. This workshop if part &#8230; <a href="http://www.manas.com.ar/spalladino/2011/09/21/instedd-at-pacific-endeavor-2011/">more</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pacom.mil/web/Site_Pages/Media/News_2011/08/17-Pacific-enveavor-2011-kicks-off.shtml">Pacific Endeavor</a> is a humanitarian communication workshop, organized by the US Pacific Command, which brings together military representatives from all SE Asia, NGOs and industry leaders. Its main goal is to improve the multi-national communications in HA/DR situations, based on the premise that communication is the foundation to a successful response. This workshop if part of the <a href="http://www.facebook.com/pages/MCIP-Multinational-Communications-Interoperability-Program/101122066602006?sk=info">MCIP</a>, Multinational Communications Interoperability Program:</p>
<blockquote><p>MCIP establishes a process that identifies and documents interoperability between Communication Systems (CS) of the MPAT nations in the Asia Pacfic Area. The process provides a mechanism for CS planners to effectively and rapidly establish interoperable CS arrangements to support MPAT during Multinational Humanitarian Assistance and Disaster Relief Operations (MNHADRO).</p></blockquote>
<p>Pacific Endeavor has had several previous editions. Last year Eric Rasmussen assisted representing InSTEDD; and last August I had the opportunity to assist to this year&#8217;s event, in order to communicate our experiences with the usage of text messaging during disaster response.</p>
<p><a href="http://www.manas.com.ar/wp-content/uploads/2011/09/IMG_12191.jpg"><img class="size-medium wp-image-316" src="http://www.manas.com.ar/wp-content/uploads/2011/09/IMG_12191-300x225.jpg" alt="Pacific Endeavor 2011" width="300" height="225" /></a></p>
<p>Pacific Endeavor is a large event, in which military representatives from multiple nations gather to assess the interoperability of their communication systems. The results of these experiments are fed into the MCIG, Multinational Communications Interoperability Guide, a database maintained by the MCIP that can be queried anytime to know whether communications between field teams of different countries on a disaster scenario will be possible, so that each team knows which equipment will be needed to communicate with others.</p>
<p><a href="http://www.manas.com.ar/wp-content/uploads/2011/09/IMG_0846.jpg"><img class="aligncenter size-medium wp-image-319" src="http://www.manas.com.ar/wp-content/uploads/2011/09/IMG_0846-300x198.jpg" alt="Technical Interoperability Assessment" width="300" height="198" /></a></p>
<p>Pacific Endeavor is also composed by other workshops, such as Phoenix Endeavor and <a href="http://www.dvidshub.net/news/75868/cyber-endeavor-2011-ends-will-return-next-year">Cyber Endeavor</a>. The goal of the former is to determine how to share the radio frequency spectrum during a disaster response situation, in which multiple teams arrive at the site, each with their own need for their share of spectrum in order to communicate. In order to address this situation, a web application was developed, that allows foreign countries and organizations to make requests to the host nation for radio spectrum, and allows the host nation to keep track of all these requests in a centralized location.</p>
<p>The latter, on the other hand, is focused on maintaining the security and availability of network communications during a disaster, ensuring the network is resilient to attacks. As stated by Staff Sgt. Carl Hudson:</p>
<blockquote><p>Cyber Endeavor is a new program under Pacific Endeavor 2011 which involves non-government organizations, national militaries across the Pacific Region, academic and industrial representatives. Focusing on protecting information in a collaborative environment, the intent was an information sharing workshop to develop core competencies amongst the Multinational Communications Interoperability Program countries and entities.</p></blockquote>
<p>The event involves different NGOs and Industry Leaders, leading to very interesting discussions on the interaction between the different parties on a disaster situation, and which should be the role of the military.</p>
<h2>Scenarios</h2>
<p>Multiple issues were under discussion by the time we arrived at the event. How to coordinate the local government, the military and the NGOs was, as usual, one of these trending topics. The discussions made clear the importance that the local government makes clear requests about what is needed, that information is shared across the different organization, and that the work is coordinated so that efforts are not duplicated.</p>
<p>Providing a reliable network infrastructure is another subject of critical importance. By assuring the different organizations deployed on the field that they will have the network access needed to perform their operations, the network can be better controlled and the disorganization generated by every team bringing their own equipment to attempt to set up their own network is eliminated. The role of providing network access for all teams deployed is then to be fulfilled by the military, and not by different private companies or each team individually.</p>
<p>Good bandwidth is also important, and it is vital during the first hours during which it is most scarce to determine the correct use for it. The NZ Red Cross estimates that only 0.1% of the transmitted information is actually operational, all the rest can be reduced by cutting down on videoconferences, sending formatted files instead of plain text, moving large unnecessary images, etc.</p>
<p>The key ongoing discussions were finally boiled down to four different scenarios, which had to be addressed by the present military representatives:</p>
<h3>Bandwidth</h3>
<p>Deployed organizations have need for bandwidth to conduct their operations, although this access is very scarce, specially during the first hours of the response. The solution is to develop a protocol and <a href="http://en.wikipedia.org/wiki/Standard_operating_procedure">SOP</a> so that the military can provide this much needed bandwidth with their infraestructure. It is worth noting that there is already a DOD initiative being implemented to address this very issue.</p>
<h3>Spectrum</h3>
<p>The organizations have requirements for usage of the radio spectrum during HA/DR; the military can lease certain frequencies during the response for these organizations to use. The aforementioned Mercury web application is a first step towards achieving this goal.</p>
<h3>Imagery</h3>
<p>Several organizations usually require access to highly detailed imagery data for decision-making; therefore, a protocol and SOP is to be developed for sharing this data between the military and the different organizations. It is critical that this point is implemented in such a way that the flow of detailed imagery does not consume the much needed bandwidth.</p>
<h3>Restoring Comms</h3>
<p>The first priority of the military during DR is to attend to the local government, whose communications are usually compromised during a disaster. As such, a SOP is to be developed to assemble a task force with the capabilities and know-how to help the local government restore their own communications as fast as possible.</p>
<h2>Technology Demonstrations</h2>
<p>On the last part of the event, the conclusions on the different scenarios were passed onto the Senior Communicators of each country. It was during this part that InSTEDD and other third party organizations entered the game.</p>
<p>It is worth noting that, even though representatives from different NGOs were present, such as <a href="http://www.tsfi.org/">Telecom Sans Frontiers</a> or the <a href="http://www.redcross.org.nz/cms_display.php">New Zealand Red Cross</a>, InSTEDD&#8217;s role during the event was of Solution Provider. The task as Solution Providers was to present the different tools and experience we have that can provide help for the military during HA/DR situations.</p>
<p>In our particular case, InSTEDD is in position to provide the <a href="http://instedd.org/blog/make-your-sms-apps-scale/">technological backbone for articulating SMS communications</a> with the people and different groups, aggregate this information, and <a href="http://blog.ushahidi.com/index.php/2010/02/11/project-4636-revisited-the-updated-info-graphic/">share it with the relevant organizations</a> during a disaster.</p>
<p>Most of the other solution providers were from the industry, and displayed very interesting tools. Several were related to satellite communications, to be used during the first hours when other means of communications are down; others focused on restoring damaged networks. Companies such as <a href="http://www.inmarsat.com/">Inmar-sat</a>, <a href="http://www.stee.com.sg/">ST Electronics</a>, <a href="http://www.delorme.com/">Delorme</a>, <a href="http://www.cisco.com">Cisco</a> or <a href="http://www.hp.com/">Hewlett Packard</a> were present.</p>
<p><strong>Cisco</strong> offered a team specialized in restoring networks at the disposal of any nation requesting them during a disaster, the <a href="http://www.cisco.com/web/about/doing_business/business_continuity/tacops.html">Disaster Incident Response Team</a>. <strong>Delorme</strong> presented a new satellite phone equipped with GPS that can send pre-canned SMS messages anywhere or augment an Android phone via Bluetooth with satellite capabilities. The <strong><a href="http://www.nps.edu/">Naval Postgraduate School</a></strong>, from Monterey, CA, was also in place, presenting multiple tools as well as their expertise on managing networks. A representative of the <a href="http://www.gvf.org/">Global VSAT Forum</a>, a worldwide association of satellite communications companies, presented the aid that can be provided by these organizations acting together during a disaster.</p>
<p><a href="http://www.cmu.edu/silicon-valley/faculty-staff/griss-martin.html">Dr Martin Griss</a>, from Silicon Valley Carnegie Mellon, made an excellent presentation introducing the usage of text messaging, smartphones and social media for obtaining information from the crowds during a disaster; presenting the work done within the <a href="http://www.cmu.edu/silicon-valley/dmi/">Disaster Management Initiative</a>. This opened the discussion for the usage of alternative ways of communication, both for communicating field workers, and for harnessing information from the different channels used by the people.</p>
<h2>The role of InSTEDD</h2>
<p>The exchange of ideas, experiences and requirements regarding these subjects was most fruitful. The <a href="http://ict4peace.wordpress.com/2010/05/11/instedds-response-in-haiti/">experience of the earthquake in Haiti</a>, now over a year ago, is still a key case study on HA/DR, so our findings during our participation on the <a href="http://instedd.org/blog/emergency-information-service-launched-in-haiti/">response</a> <a href="http://instedd.org/blog/ebyen-kile-tranbleman-de-te-a-ap-fin-pase-potoprens-en/">to</a> <a href="http://instedd.org/blog/haiti-sms-short-codes-ecosystem/">the</a> <a href="http://instedd.org/blog/haiti-sms-short-codes-ecosystem-update/">disaster</a> were most valuable. The role that text messaging had for both receiving reports from the people and sending localized pieces of key information back to them was of extreme importance; and the tools we used for channeling and analyzing the incoming flow of messages, as well as managing responses, were of interest for several parties.</p>
<p>We also presented other tools under development: an unreleased project, <strong>Pollit</strong>, formerly known as <a href="http://instedd.org/technologies/geochat-polls/">Geochat Polls</a>, was also the focus of much attention from many Senior Communicators, seeing in this SMS-based survey tool an easy way to perform damage assessment during a disaster.</p>
<p>Many other inquiries by the communicators were discussed. The problem of analyzing the large incoming flow of messages during an emergency, in order to be able to perform appropriate decision-making, was a trending topic. <a href="http://en.wikipedia.org/wiki/Crowdsourcing">Crowdsourcing</a> was the key concept when solving this matter on a disaster response situation, and <a href="http://taskmeup.org/">TaskMeUp</a>, a tool born from <a href="http://wiki.rhok.org/TaskMeUp">RHOK 2010</a> and inspired on the <a href="http://irevolution.net/2010/01/26/haiti-power-of-crowdsourcing/">information needs during Haiti&#8217;s Earthquake</a>, provided a simple way to implement it.</p>
<p>How to extract structured data from SMS was also an issue, one that we have been facing for a long time and has led us to many different solutions (some of them even <a href="http://ndt.instedd.org/2010/05/it-without-software.html">without relying on software</a>), which we presented during the event.</p>
<p>Some misconceptions were also clarified, stressing the fact that text messaging is <strong>not a replacement</strong> for all current communications. Radio and satellite communications are still the best choice for multiple scenarios, specially those related to keeping in touch the deployed S&amp;R teams during a disaster. But for other cases, such as obtaining information from the people, communicating back to them with localized key information for survival, or establishing a large network of local workers, SMS has proven to be a formidable tool: low cost communications, most people own a mobile and know how to text, SMS channels are more reliable than voice, text is easier to mine for information, etc.</p>
<h2>Call to Action</h2>
<p>Upon a disaster, receiving reports and requests for help from the people is vital on the <em>response</em> stage, as we found out on Haiti. During the <em>recovery</em> process SMS also fullfil an important role by empowering people with vital information for survival and development. The key for these to work is <em>preparedness</em>, and that is our call to action to the Senior Communicators.</p>
<p>Connecting with people at a massive level requires an agreement with the local telephone companies in order to achieve the necessary combination of high throughtput at low cost. These agreements can be set up beforehand, as well as the connections themselves to reduce the time for set up to a minimum.</p>
<p>Keeping a SMS-based network of local workers in key points is vital for damage assessment and coordination. A previously set up network of health workers for disease surveillance, for instance, can be quickly turned into a powerful damage assessment tool upon a disaster, and can be used to easily coordinate efforts between the network.</p>
<p>To sum up, it is critical to regard SMS as an important channel for communication during HA/DR scenarios, and to be prepared before the disaster happens in order to be able to deploy multiple solutions during the first vital hours.</p>
<h2>Conclusion</h2>
<p><a href="http://www.youtube.com/watch?v=zzc7ej3B8f8">Pacific Endeavor</a> is an event of critical importance for enabling communications between teams from different nations during an HA/DR mission, not only military, but also from NGOs and the industry sector. Coordination and communication between different parties is vital for an appropriate response.</p>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/zzc7ej3B8f8?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>We are very excited to participate in these events, and provide our experiences, tools and expertise to the representatives of countries from all South East Asia, to improve the communications between response teams and with the people in need.<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/spalladino/2011/09/21/instedd-at-pacific-endeavor-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using xmpp for mocking SMS channel in Nuntium</title>
		<link>http://www.manas.com.ar/spalladino/2011/09/07/using-xmpp-for-mocking-sms-channel-in-nuntium/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-xmpp-for-mocking-sms-channel-in-nuntium</link>
		<comments>http://www.manas.com.ar/spalladino/2011/09/07/using-xmpp-for-mocking-sms-channel-in-nuntium/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 10:51:45 +0000</pubDate>
		<dc:creator>Santiago Palladino</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[Nuntium]]></category>
		<category><![CDATA[SMS]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/spalladino/?p=286</guid>
		<description><![CDATA[For those of you not familiar with it, Nuntium is an open-source tool we developed together with InSTEDD for easily building applications that rely on SMS for communication. Even though several other kinds of channels are supported, such as email or twitter, text messaging has been one of its most important features. A common scenario &#8230; <a href="http://www.manas.com.ar/spalladino/2011/09/07/using-xmpp-for-mocking-sms-channel-in-nuntium/">more</a>]]></description>
			<content:encoded><![CDATA[<p>For those of you not familiar with it, <a href="http://code.google.com/p/nuntium" target="_blank">Nuntium</a> is an open-source tool we developed together with <a href="http://instedd.org/technologies/nuntium/" target="_blank">InSTEDD</a> for easily building applications that rely on SMS for communication. Even though several other kinds of <a href="http://code.google.com/p/nuntium/wiki/Channels" target="_blank">channels</a> are supported, such as email or twitter, text messaging has been <a href="http://instedd.org/blog/make-your-sms-apps-scale/" target="_blank">one of its most important</a> features.</p>
<p><a href="http://code.google.com/p/nuntium/"><img class="alignright" src="http://instedd.org/wp-content/uploads/_post_blog_image/1195-5b23c41e.png?9d7bd4" alt="" width="234" height="130" /></a></p>
<p>A common scenario that we face is how to easily test the flow of text messages in a development or manual testing environment. While using a local gateway is a possibility, most likely you won&#8217;t want to spend actual text messages while developing; it is costly in the long run, and cumbersome to switch between the development station and a test cellphone.</p>
<p>One possibility to get around this is to use Nuntium&#8217;s very interface for generating <a href="http://code.google.com/p/nuntium/wiki/Messages#Application_Terminated_messages" target="_blank">AT</a> messages, and check the <a href="http://code.google.com/p/nuntium/wiki/Messages#Application_Originated_messages" target="_blank">AO</a> queue for responses.</p>
<div id="attachment_287" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.manas.com.ar/wp-content/uploads/2011/08/create-at.png"><img class="size-medium wp-image-287 " src="http://www.manas.com.ar/wp-content/uploads/2011/08/create-at-300x234.png" alt="Create Application Terminated Message in Nuntium" width="300" height="234" /></a><p class="wp-caption-text">Create Application Terminated Message in Nuntium</p></div>
<p>This interface can be a bit unsuited, however, for sending messages and receiving their responses instantly on the same page. It also requires access to the Nuntium account, so if you are looking forward to using it for testing, it implies granting access to everyone who is to test it to the account. An elegant solution, provided by my colleague <a href="http://www.linkedin.com/in/adrianromero/en">Adrian Romero</a>, is to use an XMPP channel for mocking the SMS flow.</p>
<h3>Setting up the XMPP channel</h3>
<p>Step one is to create a new account that you will use for testing the application and an application within the account. Now you are ready to set up the XMPP channel. For this, you will need an XMPP account to act as the channel; creating a test account in gmail is always a good candidate, in which case configuration is pretty straightforward:</p>
<div id="attachment_293" class="wp-caption alignright" style="width: 251px"><a href="http://www.manas.com.ar/wp-content/uploads/2011/08/channelxmpp.png"><img class="size-full wp-image-293" src="http://www.manas.com.ar/wp-content/uploads/2011/08/channelxmpp.png" alt="" width="241" height="294" /></a><p class="wp-caption-text">Configuration for xmpp channel with google talk</p></div>
<p>Make sure you <strong>change the protocol of the channel</strong> from XMPP to SMS. This will make Nuntium use this XMPP channel for routing SMS messages.</p>
<h3>Configuring AT Rules</h3>
<p>The trickiest part is setting up the <a href="http://code.google.com/p/nuntium/wiki/Rules">message rules</a> for mocking the SMS channel. The main challenge is that you want to simulate, from a single xmpp account, multiple SMS phones. In other words, you want to use your user@gmail.com account for pretending you are sending a text message from 555-1000, but also from 555-2000, 555-3000, and so on.</p>
<p>A nice solution to this is to actually specify the phone number as part of the message, and have Nuntium interpret it accordingly. So, if we send the message:</p>
<pre>5551000 Hello world</pre>
<p>We want Nuntium to convert it to a text message from <em>sms://5551000</em> with the content &#8220;Hello world&#8221;. To do this, we need to set up the following AT rules:</p>
<p style="text-align: center"><a href="http://www.manas.com.ar/wp-content/uploads/2011/08/atrules.png"><img class="aligncenter size-medium wp-image-296" src="http://www.manas.com.ar/wp-content/uploads/2011/08/atrules.png" alt="" width="600" height="74" /></a></p>
<pre>Condition: Body regex (d+)(s+)(.+)
Action:    From sms://${body.1}
           Body ${body.3}</pre>
<p>Let&#8217;s take a look at them more closely:</p>
<ul>
<li>The condition captures the number at the beginning in the message in a regex group, and leaves the rest of the message in another one. In our example, it would be 5551000 in the first group, and <em>Hello world</em> in the thrid one.</li>
<li>The first action forces the <em>from</em> field to be equal to the phone number; for this, it uses <a href="http://code.google.com/p/nuntium/wiki/Rules#Regular_Expressions" target="_blank">the ${field.group} syntax</a>. In this case, ${body.1} tells Nuntium to use the first capturing group from the regex matched on the body field, 5551000 in our example.</li>
<li>The second action removes the phone number from the body, leaving only <em>Hello world</em> in our example.</li>
</ul>
<p>Having these rules in place, we can use a single channel, xmpp in this case, to <em>fake</em> that we are multiple different senders.</p>
<h3>Configuring AO Rules</h3>
<p>Next step is to setup the AO rules now. Nuntium, instructed by your application, will attempt to send messages to phone numbers, and your xmpp channel will have a difficult time trying to send an IM to <em>sms://5552000</em>. So we want to divert these messages to our test jabber account, but still letting us know who was the original recipient for testing purposes.</p>
<p>So, if the application is trying to send a <em>Hello user!</em> message to <em>sms://5552000</em>, we want a message delivered to our jabber <em>username@gmail.com</em> account with the content:</p>
<pre>To: 5552000 Message: Hello user!</pre>
<p>To do this, we will set up the following set of rules that affect the <em>To</em> and the <em>Body</em> fields of the application originated message.</p>
<p style="text-align: center">
<a href="http://www.manas.com.ar/wp-content/uploads/2011/09/AORules1.png"><img class="aligncenter size-medium wp-image-308" src="http://www.manas.com.ar/wp-content/uploads/2011/09/AORules1.png" alt="" width="600" height="74" /></a>
</p>
<pre>Condition: To regex sms://(.+)
           Body regex (.*)
Actions:   To username@gmail.com
           Body To: ${to.1} Message: ${body.1}</pre>
<p>These rules are simpler than the previous ones. The conditions simply extract the phone number and body of the message; whereas the actions replace the target of the message with a hardcoded one, and condense the original target and the content in the body of the new message.</p>
<h3>To sum up&#8230;</h3>
<p>Nuntium offers greats flexibility by the usage of AT and AO rules, by granting the possibility to alter the flow of messages or their content. These tools, originally designed for connecting systems in real-world situations, can be also used for simplifying the development of a Nuntium-based application.<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/spalladino/2011/09/07/using-xmpp-for-mocking-sms-channel-in-nuntium/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reuse code, not user experience</title>
		<link>http://www.manas.com.ar/mverzilli/2011/06/15/reuse-code-not-user-experience/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reuse-code-not-user-experience</link>
		<comments>http://www.manas.com.ar/mverzilli/2011/06/15/reuse-code-not-user-experience/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 22:47:23 +0000</pubDate>
		<dc:creator>Martin Verzilli</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[interaction design]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/mverzilli/?p=46</guid>
		<description><![CDATA[Let&#8217;s face it: as a developer, I&#8217;m lazy. I just want to write just enough code. What is more, I want to reuse it whenever possible. I want it to be abstract. If I&#8217;m asked to implement a view which needs a sortable grid, one of those whose rows you can sort by any column by &#8230; <a href="http://www.manas.com.ar/mverzilli/2011/06/15/reuse-code-not-user-experience/">more</a>]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face it: as a developer, I&#8217;m lazy. I just want to write <em>just enough</em> code.<em> </em>What is more, I want to reuse it whenever possible. I want it to be <em>abstract</em>.</p>
<p>If I&#8217;m asked to implement a view which needs a sortable grid, one of those whose rows you can sort by any column by clicking on it, I&#8217;ll either make use of any sortable grid widget available in the project&#8217;s UI framework of choice or build sorting functionality into a regular one. No matter the choice, I would end up with a grid widget that sorts strings lexicographically, dates chronologically and numbers&#8230; well, you get the idea.</p>
<p>Sounds reasonable, doesn&#8217;t it? Yes, it does&#8230; <em>in general</em>. <em>In general</em> means that statistically it IS the desired behavior,  <strong>provided that we know nothing else about the context of use.</strong> If we don&#8217;t focus on the task we&#8217;re trying to help the user accomplish, if we don&#8217;t <em>wear her shoes</em>, we risk ending up happy with our <em>reusable</em> grid at the cost of making it <em>less usable.</em></p>
<p>Let&#8217;s take a look at an example of  a team which clearly cares for its users:</p>
<div id="attachment_47" class="wp-caption aligncenter" style="width: 662px"><a href="http://www.manas.com.ar/wp-content/uploads/2011/06/Screen-shot-2011-06-15-at-6.20.23-PM.png"><img class="size-full wp-image-47" src="http://www.manas.com.ar/wp-content/uploads/2011/06/Screen-shot-2011-06-15-at-6.20.23-PM.png" alt="" width="652" height="243" /></a><p class="wp-caption-text">The grid in iTunes music library, sorted by song name</p></div>
<p>So, let&#8217;s see. Name is a string field, then we should sort it lexicographically&#8230; wait a minute! If it&#8217;s in lexicographical order why is it that &#8220;5 &#8211; In Your Eyes!!s&#8221; is placed between &#8220;05 &#8211; Heartbreaker&#8221; and &#8220;05 &#8211; Intermedio (JadeI)&#8221;? Because it makes sense in this context.</p>
<p>Odds are I don&#8217;t care whether the track number starts with zero or it doesn&#8217;t. By discarding the <em>general </em>approach to sorting strings, the iTunes&#8217; team made its users&#8217; experience a little bit more pleasant. And, at the end of the day, all those little details add up to make an overall satisfactory experience.</p>
<p>Now, if you ask me, at least when I sort my list by song name, I usually don&#8217;t even care about the track number and whichever other characters prefixing a song&#8217;s title. I would even ignore all those characters and start sorting by the first alphabetical character. But I can&#8217;t assure most iTunes users would agree with me. Maybe it&#8217;s a good example of a decision you would like to make based on the results of usability tests.</p>
<p>To sum up, if you&#8217;re a lazy developer like me, don&#8217;t let your appetite for abstraction and reuse leak into the user experience. Less is more, except sometimes when more is more!<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/mverzilli/2011/06/15/reuse-code-not-user-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thesis in Computer Science</title>
		<link>http://www.manas.com.ar/spalladino/2011/06/05/thesis-in-computer-science/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=thesis-in-computer-science</link>
		<comments>http://www.manas.com.ar/spalladino/2011/06/05/thesis-in-computer-science/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 22:46:23 +0000</pubDate>
		<dc:creator>Santiago Palladino</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Thesis]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/spalladino/?p=276</guid>
		<description><![CDATA[After a long time, I have finally finished my thesis to get the MSc in Computer Science degree, from FCEN UBA. It has been almost a year since I started working in the thesis in the context of Manas Research, and before that I had been working on it for over another year within the &#8230; <a href="http://www.manas.com.ar/spalladino/2011/06/05/thesis-in-computer-science/">more</a>]]></description>
			<content:encoded><![CDATA[<p>After a long time, I have finally finished my thesis to get the MSc in Computer Science degree, from <a href="http://dc.uba.ar/">FCEN UBA</a>. It has been <a href="http://www.manas.com.ar/spalladino/2010/06/30/making-a-thesis-2-0/">almost a year</a> since I started working in the thesis in the context of <a href="http://www.manas.com.ar/node/12">Manas Research</a>, and before that I had been working on it for over another year within the <a href="http://dc.uba.ar/">computer science department</a>.</p>
<p>The text of the thesis, called A branch and cut algorithm for the <a href="http://www.manas.com.ar/spalladino/2010/07/22/partitioned-graph-coloring/">Partitioned Coloring Problem</a>, can be downloaded in English <a href='http://www.manas.com.ar/wp-content/uploads/2011/06/pcp.pdf'>here</a>. The slides (in Spanish) that I&#8217;ll be using tomorrow to present the thesis are also available <a href='http://www.manas.com.ar/wp-content/uploads/2011/06/slides.pdf'>here</a>.</p>
<p>A sincere thank you to everyone who helped me during all this time with this work, and to Manas for sponsoring it!<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/spalladino/2011/06/05/thesis-in-computer-science/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t make me think&#8230; nor work more than I&#8217;m supposed to</title>
		<link>http://www.manas.com.ar/mverzilli/2011/05/09/dont-make-me-think-nor-work-more-than-im-supposed-to/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dont-make-me-think-nor-work-more-than-im-supposed-to</link>
		<comments>http://www.manas.com.ar/mverzilli/2011/05/09/dont-make-me-think-nor-work-more-than-im-supposed-to/#comments</comments>
		<pubDate>Mon, 09 May 2011 14:35:33 +0000</pubDate>
		<dc:creator>Martin Verzilli</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[interaction design]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/mverzilli/?p=39</guid>
		<description><![CDATA[Don&#8217;t make me think is a great book about usability and interaction design written by Steve Krug. One of the best things about it is that Steve has used the very same principles he preaches at in his book in the design of its reading experience. The book goes straight to the point, focuses on &#8230; <a href="http://www.manas.com.ar/mverzilli/2011/05/09/dont-make-me-think-nor-work-more-than-im-supposed-to/">more</a>]]></description>
			<content:encoded><![CDATA[<p><em><a href="http://www.sensible.com/dmmt.html" target="_blank">Don&#8217;t make me think</a> </em>is a great book about usability and interaction design written by <a href="http://www.sensible.com/about.html" target="_blank">Steve Krug</a>. One of the best things about it is that Steve has used the very same principles he preaches at in his book in the design of its reading experience. The book goes straight to the point, focuses on a handful of very clearly stated ideas and can be read in just a couple of hours!</p>
<p>I don&#8217;t mean this post to be a review of <em>Don&#8217;t make me think</em>, it&#8217;s just that it was the first thought which came to my mind when I received the following &#8220;update email&#8221; from a very well known group mailing system:</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-41" src="http://www.manas.com.ar/wp-content/uploads/2011/05/Screen-shot-2011-05-09-at-11.00.40-AM1.png" alt="" width="650" height="86" /></p>
<p>Who&#8217;s the new member? Do I know her? Wouldn&#8217;t it make sense to be able to see some of her profile info right there, without needing to go to the group&#8217;s home page? Why do I have to make an additional step to get that info? Don&#8217;t make me work more than what&#8217;s strictly necessary!</p>
<p>By the way, &#8220;geochatUsers-Geochat Users Community&#8221; is a link, but you just get to know that once you hover over it and your mouse cursor turns into a pointer. I remember having got this wrong in my own developments countless times: links which don&#8217;t look alike links. Don&#8217;t make the user think! If there&#8217;s something that she can click or act over, it has to be apparent. That&#8217;s what designers call <em>affordance</em>: it&#8217;s what an object&#8217;s appearance, smell, texture, sound, etc, tells us about what we can do with it.</p>
<p>Last but not least, when I clicked the link I had to manually log in before being able to enter the group&#8217;s home page. The group mailing system already knew it was me (or it could have easily known it), because I clicked the link from my email box. That takes us to another principle: user input is sacred, don&#8217;t lose it nor ask more of it than necessary.</p>
<p>Have a nice week!<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/mverzilli/2011/05/09/dont-make-me-think-nor-work-more-than-im-supposed-to/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Careful when truncating strings</title>
		<link>http://www.manas.com.ar/spalladino/2011/04/20/careful-when-truncating-strings/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=careful-when-truncating-strings</link>
		<comments>http://www.manas.com.ar/spalladino/2011/04/20/careful-when-truncating-strings/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 14:11:46 +0000</pubDate>
		<dc:creator>Santiago Palladino</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/spalladino/?p=267</guid>
		<description><![CDATA[One of our Rails applications has to consume an RSS. Nothing fancy here, we simply wanted to extract some fields from each item and store them in the PostgreSQL DB (app was hosted on heroku). Simply slicing the string seemed to work at first: summary = entry.summary[0...255] But soon we started obtaining PGError (incomplete multibyte &#8230; <a href="http://www.manas.com.ar/spalladino/2011/04/20/careful-when-truncating-strings/">more</a>]]></description>
			<content:encoded><![CDATA[<p>One of our Rails applications has to consume an RSS. Nothing fancy here, we simply wanted to extract some fields from each item and store them in the <a href="http://www.postgresql.org/">PostgreSQL</a> DB (app was hosted on <a href="http://www.heroku.com">heroku</a>). </p>
<p>Simply slicing the string seemed to work at first:</p>
<pre>
summary = entry.summary[0...255]
</pre>
<p>But soon we started obtaining <em>PGError (incomplete multibyte character)</em> when trying to persist our records in the DB. It seemed that the summary we were obtaining had a <a href="http://en.wikipedia.org/wiki/Variable-width_encoding">multibyte char</a> in that position, and slicing the string seemed to <a href="http://stackoverflow.com/questions/5081528/ruby-chinese-character-substring-problem">slice the char itself</a>.</p>
<p>Luckily, we were working on rails, and there is a helpful TextHelper <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-truncate">truncate</a> function to perform precisely the task we wanted. </p>
<pre>
include ActionView::Helpers::TextHelper
summary = truncate(entry.summary, :length =&gt; 255)
</pre>
<p>As a side note, trying to save the same sliced string in MySql, produced no errors whatsoever. Apparently, PostgreSQL is stricter than its counterpart.<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/spalladino/2011/04/20/careful-when-truncating-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nuntium: exponential backoff and new xmpp library</title>
		<link>http://www.manas.com.ar/ary/2011/03/30/nuntium-exponential-backoff-and-new-xmpp-library/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nuntium-exponential-backoff-and-new-xmpp-library</link>
		<comments>http://www.manas.com.ar/ary/2011/03/30/nuntium-exponential-backoff-and-new-xmpp-library/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 14:51:42 +0000</pubDate>
		<dc:creator>Ary Borenszweig</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[Nuntium]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/ary/?p=234</guid>
		<description><![CDATA[This week we&#8217;ve updated nuntium to version 2.8, yay! Aside from some minor bug fixes, nuntium now implements an exponential backoff strategy when a message delivery fails. Previously, it worked like this: A message failed to be delivered. If the cause was the message itself (for example it contains invalid data), it was discarded. If &#8230; <a href="http://www.manas.com.ar/ary/2011/03/30/nuntium-exponential-backoff-and-new-xmpp-library/">more</a>]]></description>
			<content:encoded><![CDATA[<p>This week we&#8217;ve updated <a href="http://instedd.org/technologies/nuntium/">nuntium</a> to version 2.8, yay!</p>
<p>Aside from some minor bug fixes, nuntium now implements an exponential backoff strategy when a message delivery fails. Previously, it worked like this:</p>
<ol>
<li>A message failed to be delivered.</li>
<li>If the cause was the message itself (for example it contains invalid data), it was discarded.</li>
<li>If the cause was an authentication problem, for example an SMTP server&#8217;s password changed, the channel responsible for delivering the message was disabled and an alert was sent to the administrator.</li>
<li>Otherwise, the cause was a temporary one, maybe a connection timeout. In that case, delivery through that channel was suspended for five minutes with an alert being sent to the administrator.</li>
</ol>
<p>In this last point, sometimes the cause was in fact an invalid message for which the other side expecting to get the message wasn&#8217;t correctly prepared to handle. This caused all subsequent valid messages to be suspended for five minutes.</p>
<p>We changed this behavior to just suspend this message for some time (using an exponential backoff strategy) but allowing next messages to be sent. The message is marked as &#8220;delayed&#8221; an you can see it in the UI. We think this is a much more resilient solution.</p>
<p>The other big thing is that we changed the library we used to receive and send XMPP messages. Previously we used <a href="http://home.gna.org/xmpp4r/">xmpp4r</a>, which works quite well but sometimes it would raise unexpected exceptions which we couldn&#8217;t understand. Also, it wasn&#8217;t based on event machine. We switched to the excelent <a href="http://blather.squishtech.com/">blather</a> library and so far it didn&#8217;t let us down.</p>
<p>What&#8217;s next? Having implemented delayed messages on failure cases we are only a small step away from implementing delayed messages just for the sake of it. Imagine sending a message to nuntium and telling it to send it on a specific date. With this you could implement things as simple as birthday reminders to pregnancy checks reminders or messages sent today or tomorrow afternoon of a given time zone.<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/ary/2011/03/30/nuntium-exponential-backoff-and-new-xmpp-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to Rails 3: @routes is nil</title>
		<link>http://www.manas.com.ar/mverzilli/2011/03/18/upgrading-to-rails-3-routes-is-nil/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=upgrading-to-rails-3-routes-is-nil</link>
		<comments>http://www.manas.com.ar/mverzilli/2011/03/18/upgrading-to-rails-3-routes-is-nil/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 18:10:11 +0000</pubDate>
		<dc:creator>Martin Verzilli</dc:creator>
				<category><![CDATA[Blogs]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Rails 3]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.manas.com.ar/mverzilli/?p=35</guid>
		<description><![CDATA[I&#8217;m currently in the process of upgrading an application from Rails 2 to Rails 3. Fortunately, it&#8217;s not the first time someone does so, and there&#8217;s plenty of resources throughout the web that will help you to work it out. In particular, I chose to follow the steps demonstrated by Ryan Bates in an outstanding &#8230; <a href="http://www.manas.com.ar/mverzilli/2011/03/18/upgrading-to-rails-3-routes-is-nil/">more</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently in the process of upgrading an application from Rails 2 to Rails 3. Fortunately, it&#8217;s not the first time someone does so, and there&#8217;s plenty of resources throughout the web that will help you to work it out. In particular, I chose to follow the steps demonstrated by Ryan Bates in an outstanding series of three <a href="http://railscasts.com">railscasts</a>, titled <em>Upgrading to Rails 3</em> (<a href="http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1">Part 1</a>,<a href="http://railscasts.com/episodes/226-upgrading-to-rails-3-part-2"> Part 2</a>,<a href="http://railscasts.com/episodes/227-upgrading-to-rails-3-part-3"> and Part 3</a>).</p>
<p>Everything was going smoothly, until while trying to get my functional tests to pass I got the following error:</p>
<p><code>test_should_decode_a_message_with_a_plain_code(DecodeControllerTest):<br />
RuntimeError: <strong>@routes is nil</strong>: make sure you set it in your test's setup method.<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:388:in `block in process'<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:386:in `each'<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:386:in `process'<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:47:in `process'<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.5/lib/action_controller/test_case.rb:355:in `post'<br />
test/functional/decode_controller_test.rb:67:in `block in '<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/testing/setup_and_teardown.rb:67:in `block in run'<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/callbacks.rb:428:in `_run_setup_callbacks'<br />
/Users/mverzilli/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.5/lib/active_support/testing/setup_and_teardown.rb:65:in `run'<br />
</code></p>
<p>As usual, I resorted to allmighty Google looking for &#8220;@routes is nil&#8221;, since &#8220;someone must have already stumbled upon this before&#8221;&#8230;and no luck. So I started comparing some of the files in my upgraded app with their correspondent files in another (working) app which had developed using Rails 3 from scratch. I found out there was a slight difference between both &#8220;test_helper.rb&#8221; files:</p>
<p><code><br />
require 'rails/test_help'<br />
</code></p>
<p>That line was present in the Rails-3-from-scratch app but not in the one I&#8217;m upgrading. Then, I just added that line and the &#8220;@routes is nil&#8221; error was gone. I should have payed more attention, because when running <em>rake rails:upgrade:check</em>, I was getting the following warning:</p>
<p><code><br />
Deprecated test_help path<br />
You now must require 'rails/test_help' not just 'test_help'.<br />
More information: http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices</code></p>
<p><code> </code></p>
<p><code> The culprits:<br />
- [...]test/test_helper.rb<br />
</code></p>
<p>That&#8217;s right, the rails_upgrade plugin had let me know of the issue and even how to solve it, but I just skipped that suggestion. I&#8217;m writing this post hoping that Google will crawl it and, if you happen to be as scatty as me, you&#8217;ll get a quick pointer to the solution when searching for &#8220;@routes is nil&#8221;.</p>
<p>So, in short (please write this down, Google), <strong>if after upgrading to Rails 3 your app, you&#8217;re getting a &#8220;@routes is nil&#8221; error, just add the line <code>require 'rails/test_help'</code> at the beginning of your test_helper.rb file, and that should do the trick.</strong><br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manas.com.ar/mverzilli/2011/03/18/upgrading-to-rails-3-routes-is-nil/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

