<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Tony Amoyal</title>
	
	<link>http://www.tonyamoyal.com</link>
	<description>Web Application Consultant</description>
	<lastBuildDate>Tue, 31 Aug 2010 19:44:20 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TonyAmoyal" /><feedburner:info uri="tonyamoyal" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>TonyAmoyal</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Rails Authentication with Devise and CanCan – Customizing Devise Controllers</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/4q-hKsN-XjY/</link>
		<comments>http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 16:34:17 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[can-can]]></category>
		<category><![CDATA[devise]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[ryan-bates]]></category>
		<category><![CDATA[user-permissions]]></category>
		<category><![CDATA[user-roles]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=543</guid>
		<description><![CDATA[I&#8217;m tired of spending loads of time creating user authentication systems with permissions or swimming against the current to customize what&#8217;s available. There&#8217;s great open source stuff out there but until now, I haven&#8217;t gotten the full package with really easy customization.
The Devise and CanCan combo for user authentication and permissions in Rails is my [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F07%2F28%2Frails-authentication-with-devise-and-cancan-customizing-devise-controllers%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F07%2F28%2Frails-authentication-with-devise-and-cancan-customizing-devise-controllers%2F" height="61" width="51" /></a></div><p>I&#8217;m tired of spending loads of time creating user authentication systems with permissions or swimming against the current to customize what&#8217;s available. There&#8217;s great open source stuff out there but until now, I haven&#8217;t gotten the full package with really easy customization.</p>
<p>The <a href="http://github.com/plataformatec/devise">Devise</a> and <a href="http://github.com/ryanb/cancan">CanCan</a> combo for user authentication and permissions in Rails is my combo of choice.<br />
<h2 style="margin-top: 0; padding-top: 0; font-weight: normal;">With Devise and CanCan, you can create a customized authentication and registration process in 15 minutes, and spend another 15 minutes implementing roles and permissions.</h2>
<p><img src="http://www.tonyamoyal.com/wp-content/uploads/2010/07/rails_beauty-300x225.jpg" alt="Rails Beauty" title="Rails Beauty" width="400" height="225" class="alignnone size-medium wp-image-558" /><br />
It&#8217;s pure beauty.</p>
<p><span style="font-size: 80%; line-height: 1.1em"><em>Note that the code here uses Rails 3.  The difference in Rails 3 and Rails 2 code for this purpose should be minimal, but please refer to the documentation for differences.</em></span></p>
<p>Let&#8217;s start with authentication using devise.</p>
<p><strong>Step 1 &#8211; Installation</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">gem install devise
rails generate devise:install
rails generate devise user</pre></div></div>

<p><strong>Step 2 &#8211; Configuration</strong><br />
Configuration is super easy with Devise.  Just choose which of the 11 available modules you would like to include in your authentic model (most up-to-date list <a href="http://github.com/plataformatec/devise">here</a>):</p>
<ol>
<li>Database Authenticatable: encrypts and stores a password in the database to validate the authenticity of an user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.</li>
<li>Token Authenticatable: signs in an user based on an authentication token (also known as &#8220;single access token&#8221;). The token can be given both through query string or HTTP Basic Authentication.</li>
<li>Oauthable: adds OAuth2 support</li>
<li>Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.</li>
<li>Recoverable: resets the user password and sends reset instructions.</li>
<li>Registerable: handles signing up users through a registration process, also allowing them to edit and destroy their account.</li>
<li>Rememberable: manages generating and clearing a token for remembering the user from a saved cookie.</li>
<li>Trackable: tracks sign in count, timestamps and IP address.</li>
<li>Timeoutable: expires sessions that have no activity in a specified period of time.</li>
<li>Validatable: provides validations of email and password. It’s optional and can be customized, so you’re able to define your own validations.</li>
<li>Lockable: locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.</li>
</ol>
<p><img src="http://www.tonyamoyal.com/wp-content/uploads/2010/07/easy_button.jpg" alt="easy_button" title="easy_button" width="232" height="249" class="alignnone size-full wp-image-564" /><br />
I chose 5 of the 11 modules and configured with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># In your model</span>
 <span style="color:#9966CC; font-weight:bold;">class</span> User <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
    devise <span style="color:#ff3333; font-weight:bold;">:database_authenticatable</span>, <span style="color:#ff3333; font-weight:bold;">:confirmable</span>, <span style="color:#ff3333; font-weight:bold;">:recoverable</span>, <span style="color:#ff3333; font-weight:bold;">:rememberable</span>, <span style="color:#ff3333; font-weight:bold;">:trackable</span>, <span style="color:#ff3333; font-weight:bold;">:validatable</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># In your migration</span>
create_table <span style="color:#ff3333; font-weight:bold;">:users</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
    t.<span style="color:#9900CC;">database_authenticatable</span>
    t.<span style="color:#9900CC;">confirmable</span>
    t.<span style="color:#9900CC;">recoverable</span>
    t.<span style="color:#9900CC;">rememberable</span>
    t.<span style="color:#9900CC;">trackable</span>
    t.<span style="color:#9900CC;">timestamps</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># In your routes</span>
devise_for <span style="color:#ff3333; font-weight:bold;">:users</span></pre></div></div>

<p><strong>Step 3 &#8211; Use It!</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># In your controllers</span>
before_filter <span style="color:#ff3333; font-weight:bold;">:authenticate_user</span>!, <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:some_action_without_auth</span><span style="color:#006600; font-weight:bold;">&#93;</span>
<span style="color:#008000; font-style:italic;"># Access Current User</span>
<span style="color:#9966CC; font-weight:bold;">def</span> index
    <span style="color:#0066ff; font-weight:bold;">@things</span> = current_user.<span style="color:#9900CC;">things</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This simple modular approach to authentication is hot.  Devise also makes it really easy for you to customize views.  The out-of-the-box views are great for prototyping, but if you need more, just generate the views and edit them:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rails generate devise:views</pre></div></div>

<p>Devise will generate all of the views it is using and place them in an app/views/devise directory.  Now you have complete control over your views.</p>
<p>The next thing you might want to do is customize your controllers.  This is a bit more tricky with devise and we&#8217;ll get to that in a minute.  Right now I want to touch on permissions and then I&#8217;ll tie it all together.</p>
<p>Let&#8217;s consider an example where your website is in Alpha/Beta or maybe an internal tool.  You want to restrict user registration to only an administrator.  Enter <a href="http://github.com/ryanb/cancan">CanCan</a> created by <a href="http://railscasts.com/">Ryan Bates</a>.</p>
<h1 style="padding-top: 0; margin-top: 0;">CanCan</h1>
<p>CanCan is a great gem for implementing model permissions.  The main reasons I chose CanCan are:</p>
<ul>
<li>The code written to check permissions is very readable</li>
<li>The code written to declare permissions is very concise and readable</li>
<li>It keeps permission logic in a single location so it is not duplicated across controllers, views, etc.</li>
<li>Aliasing actions (read = index and show) creates more concise and readable code</li>
</ul>
<h3 style="padding-top: 0; margin-top: 0">Ryan Bates has a great screen cast on using CanCan <a href="http://railscasts.com/episodes/192-authorization-with-cancan">here</a>, but I do not recommend using his roles mask method (mentioned in the screen cast).  It certainly works but it&#8217;s bad database design and you will feel the pain later.</h3>
<p>After you install CanCan (instructions <a href="http://github.com/ryanb/cancan">here</a>),  I recommend you set up a typical users HABTM roles relationship.  So you end up with migrations that look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> CreateRoles <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span>
    create_table <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
      t.<span style="color:#CC0066; font-weight:bold;">string</span> <span style="color:#ff3333; font-weight:bold;">:name</span>
      t.<span style="color:#9900CC;">timestamps</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    drop_table <span style="color:#ff3333; font-weight:bold;">:roles</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> UsersHaveAndBelongToManyRoles <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span>
    create_table <span style="color:#ff3333; font-weight:bold;">:roles_users</span>, <span style="color:#ff3333; font-weight:bold;">:id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
      t.<span style="color:#9900CC;">references</span> <span style="color:#ff3333; font-weight:bold;">:role</span>, <span style="color:#ff3333; font-weight:bold;">:user</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    drop_table <span style="color:#ff3333; font-weight:bold;">:roles_users</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>And your models look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># User Model</span>
<span style="color:#9966CC; font-weight:bold;">class</span> User <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_and_belongs_to_many <span style="color:#ff3333; font-weight:bold;">:roles</span>
....
<span style="color:#008000; font-style:italic;"># Role model</span>
<span style="color:#9966CC; font-weight:bold;">class</span> Role <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_and_belongs_to_many <span style="color:#ff3333; font-weight:bold;">:users</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The next step is to create your Ability class that will define permissions.  Mine looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Ability
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">CanCan::Ability</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>user<span style="color:#006600; font-weight:bold;">&#41;</span>
    user <span style="color:#006600; font-weight:bold;">||</span>= User.<span style="color:#9900CC;">new</span> <span style="color:#008000; font-style:italic;"># guest user</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">if</span> user.<span style="color:#9900CC;">role</span>? <span style="color:#ff3333; font-weight:bold;">:super_admin</span>
      can <span style="color:#ff3333; font-weight:bold;">:manage</span>, <span style="color:#ff3333; font-weight:bold;">:all</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> user.<span style="color:#9900CC;">role</span>? <span style="color:#ff3333; font-weight:bold;">:product_admin</span>
      can <span style="color:#ff3333; font-weight:bold;">:manage</span>, <span style="color:#006600; font-weight:bold;">&#91;</span>Product, Asset, Issue<span style="color:#006600; font-weight:bold;">&#93;</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> user.<span style="color:#9900CC;">role</span>? <span style="color:#ff3333; font-weight:bold;">:product_team</span>
      can <span style="color:#ff3333; font-weight:bold;">:read</span>, <span style="color:#006600; font-weight:bold;">&#91;</span>Product, Asset<span style="color:#006600; font-weight:bold;">&#93;</span>
      <span style="color:#008000; font-style:italic;"># manage products, assets he owns</span>
      can <span style="color:#ff3333; font-weight:bold;">:manage</span>, Product <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>product<span style="color:#006600; font-weight:bold;">|</span>
        product.<span style="color:#9900CC;">try</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:owner</span><span style="color:#006600; font-weight:bold;">&#41;</span> == user
      <span style="color:#9966CC; font-weight:bold;">end</span>
      can <span style="color:#ff3333; font-weight:bold;">:manage</span>, Asset <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>asset<span style="color:#006600; font-weight:bold;">|</span>
        asset.<span style="color:#9900CC;">assetable</span>.<span style="color:#9900CC;">try</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:owner</span><span style="color:#006600; font-weight:bold;">&#41;</span> == user
      <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>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Most of this is application specific but you can see some conveniences right away.  For example, the super admin role &#8220;can manage all&#8221;.  That line is saying &#8220;If the user has the super_admin role, he may perform any action on any model.&#8221;  Easy enough. Also notice that the product team can &#8220;read&#8221; products and assets.  This means that they can access the index or show action of either of those models.  You can pass a block to the can method for more complicated permission checks, but that is beyond the scope of this post and pretty easy to figure out.</p>
<p>Let&#8217;s take a look at the role method.  I store role names as CamelCase strings in the database but I access them with underscores which is more ruby like. The method looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> role?<span style="color:#006600; font-weight:bold;">&#40;</span>role<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> !!<span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">roles</span>.<span style="color:#9900CC;">find_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span>role.<span style="color:#9900CC;">to_s</span>.<span style="color:#9900CC;">camelize</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h1 style="padding-top: 0; margin-top: 0;">Tying it all together</h1>
<p>Now let&#8217;s go back to the situation I mentioned earlier &#8211; you want to protect user registrations.  This requires us to use CanCan to check for permissions but customize the Devise Registrations controller to restrict access.  </p>
<p>One way to do this is to copy the devise controllers into your controllers directory and start customizing.  That may be the best way to go and it&#8217;s certainly an obvious path, but all I want to do restrict registration.  Should I really have to re-implement the registrations controller to do that?  For now, I will not.  It might make sense when there are more customizations.  Instead I inherit from the Devise Registrations controller.  Here are the steps:</p>
<p><strong>Step 1 &#8211; Create the controller</strong><br />
$ mkdir app/controllers/users<br />
$ touch app/controllers/users/registrations_controller.rb</p>
<p><strong>Step 2 &#8211; Add the custom functionality</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#6666ff; font-weight:bold;">Users::RegistrationsController</span> <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Devise::RegistrationsController</span>
  before_filter <span style="color:#ff3333; font-weight:bold;">:check_permissions</span>, <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:new</span>, <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#ff3333; font-weight:bold;">:cancel</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  skip_before_filter <span style="color:#ff3333; font-weight:bold;">:require_no_authentication</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> check_permissions
    authorize! <span style="color:#ff3333; font-weight:bold;">:create</span>, resource
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The check permissions method is really simple.  It calls the CanCan method, authorize!, and checks if the current user can create users.  We use resource here because devise uses resource to refer to the model that can be authenticated.  Also notice how I removed the require_no_authentication filter, a Devise filter which allows access to actions without authentication.  </p>
<p><strong>Step 3 &#8211; Tell your routes to go to the new controller</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># replace devise_for :users with:</span>
devise_for <span style="color:#ff3333; font-weight:bold;">:users</span>,  <span style="color:#ff3333; font-weight:bold;">:controllers</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:registrations</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;users/registrations&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p><strong>Step 4 &#8211; Handle the CanCan::AccessDenied exception</strong><br />
At this point if you hit the users/sign_up page when not logged in, you will notice that a CanCan::AccessDenied is thrown.  This exception is thrown anytime permission is denied so you should customize it to your liking.  I put the handler in my ApplicationController:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> ApplicationController <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActionController::Base</span>
  ...
  <span style="color:#9900CC;">rescue_from</span> <span style="color:#6666ff; font-weight:bold;">CanCan::AccessDenied</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>exception<span style="color:#006600; font-weight:bold;">|</span>
    flash<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#93;</span> = exception.<span style="color:#9900CC;">message</span>
    redirect_to root_url
  <span style="color:#9966CC; font-weight:bold;">end</span>
  ...
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>I realize I skipped some steps in here but this post + Devise documentation + CanCan documentation should help you set up authentication with roles and permissions very quickly.  Let me know if you have any questions.  Enjoy!</p>
<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/4q-hKsN-XjY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/</feedburner:origLink></item>
		<item>
		<title>Safely turn off Spotlight and remove from menu bar in OS X Snow Leopard</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/cBg0RYoZxOQ/</link>
		<comments>http://www.tonyamoyal.com/2010/06/17/safely-turn-off-spotlight-and-remove-from-menu-bar-in-os-x-snow-leopard/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 17:55:13 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[customize snow leopard]]></category>
		<category><![CDATA[disable-spotlight]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[snow leopard]]></category>
		<category><![CDATA[spotlight]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=532</guid>
		<description><![CDATA[I don&#8217;t like the Spotlight indexing and search that is included in Mac OS X.  I use Quicksilver instead but have been procrastinating turning off Spotlight.
Well I finally got around to disabling Spotlight and wanted to go about it in a safe way.  I came across too many forum posts doing dangerous things [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F06%2F17%2Fsafely-turn-off-spotlight-and-remove-from-menu-bar-in-os-x-snow-leopard%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F06%2F17%2Fsafely-turn-off-spotlight-and-remove-from-menu-bar-in-os-x-snow-leopard%2F" height="61" width="51" /></a></div><p>I don&#8217;t like the Spotlight indexing and search that is included in Mac OS X.  I use <a href="http://www.versiontracker.com/dyn/moreinfo/macosx/22549" target="_blank">Quicksilver</a> instead but have been procrastinating turning off Spotlight.</p>
<p>Well I finally got around to disabling Spotlight and wanted to go about it in a safe way.  I came across too many forum posts doing dangerous things to disable Spotlight.  I also wanted and easy way to remove it from the menu bar.  Below are aliases I added to my bash profile to conveniently enable and disable spotlight.  I am not a bash scripting master, so feedback is welcome and appreciated.</p>
<p><strong>Step 1 &#8211; Add aliases</strong><br />
Open your bash profile (location: ~/.bash_profile ) and add these lines:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> spotlight-off=<span style="color: #ff0000;">'sudo mdutil -a -i off &amp;&amp; sudo mv /System/Library/CoreServices/Search.bundle/ /System/Library/CoreServices/SearchOff.bundle/'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> spotlight-on=<span style="color: #ff0000;">'sudo mdutil -a -i on &amp;&amp; sudo mv /System/Library/CoreServices/SearchOff.bundle/ /System/Library/CoreServices/Search.bundle/'</span></pre></div></div>

<p><strong>Step 2 &#8211; Source your bash profile</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile</pre></div></div>

<p><strong>Step 3 &#8211; Run command</strong><br />
In your shell, run</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ spotlight-off</pre></div></div>

<p><strong>Step 4 &#8211; Restart SystemUIServer Process</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ps</span> aux <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> SystemUIServer.app
<span style="color: #666666; font-style: italic;"># take note of the PID which is the first number you will see</span>
$ <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-HUP</span> <span style="color: #000000; font-weight: bold;">&lt;</span>insert PID here<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>You could potentially restart your computer instead of performing Step 4, but that is inconvenient.  Let me know if you have any comments or a nice way to include everything in one script.  I didn&#8217;t have time to condense this process further.</p>
<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/cBg0RYoZxOQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/06/17/safely-turn-off-spotlight-and-remove-from-menu-bar-in-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/06/17/safely-turn-off-spotlight-and-remove-from-menu-bar-in-os-x-snow-leopard/</feedburner:origLink></item>
		<item>
		<title>Country Seed Data for your Rails App</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/JaWtbnDUkWM/</link>
		<comments>http://www.tonyamoyal.com/2010/06/15/country-seed-data-for-your-rails-app/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 19:49:35 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[country data]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[seed data]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=527</guid>
		<description><![CDATA[Never go looking for basic country seed data again:

&#91;
  &#123; :name =&#62; 'Afghanistan', :iso_two_letter_code =&#62; 'AF' &#125;,
  &#123; :name =&#62; 'Aland Islands', :iso_two_letter_code =&#62; 'AX' &#125;,
  &#123; :name =&#62; 'Albania', :iso_two_letter_code =&#62; 'AL' &#125;,
  &#123; :name =&#62; 'Algeria', :iso_two_letter_code =&#62; 'DZ' &#125;,
  &#123; :name =&#62; 'American Samoa', :iso_two_letter_code =&#62; 'AS' [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F06%2F15%2Fcountry-seed-data-for-your-rails-app%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F06%2F15%2Fcountry-seed-data-for-your-rails-app%2F" height="61" width="51" /></a></div><p>Never go looking for basic country seed data again:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&#91;</span>
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Afghanistan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Aland Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AX'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Albania'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Algeria'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'American Samoa'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Andorra'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AD'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Angola'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Anguilla'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Antarctica'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AQ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Antigua And Barbuda'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Argentina'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Armenia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Aruba'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Australia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Austria'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Azerbaijan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bahamas'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bahrain'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bangladesh'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BD'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Barbados'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BB'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Belarus'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Belgium'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Belize'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Benin'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BJ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bermuda'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bhutan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bolivia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bosnia and Herzegovina'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Botswana'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bouvet Island'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BV'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Brazil'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'British Indian Ocean Territory'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Brunei Darussalam'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Bulgaria'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Burkina Faso'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Burundi'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cambodia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cameroon'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Canada'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cape Verde'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CV'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cayman Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Central African Republic'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Chad'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TD'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Chile'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'China'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Christmas Island'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CX'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cocos (Keeling) Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Colombia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Comoros'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Congo'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Congo (DRC)'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CD'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cook Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Costa Rica'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cote d<span style="color:#000099;">\'</span>Ivoire'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Croatia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'HR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cuba'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Cyprus'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Czech Republic'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Denmark'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Djibouti'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DJ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Dominica'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Dominican Republic'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Ecuador'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'EC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Egypt'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'EG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'El Salvador'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SV'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Equatorial Guinea'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GQ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Eritrea'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ER'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Estonia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'EE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Ethiopia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ET'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Falkland Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'FK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Faroe Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'FO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Fiji'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'FJ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Finland'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'FI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'France'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'FR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'French Guiana'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'French Polynesia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'French Southern Territories'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Gabon'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Gambia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Georgia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Germany'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Ghana'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Gibraltar'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Greece'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Greenland'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Grenada'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GD'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Guadeloupe'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GP'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Guam'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Guatemala'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Guernsey'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Guinea'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Guinea-Bissau'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Guyana'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Haiti'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'HT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Heard and McDonald Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'HM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Holy See (Vatican City State)'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'VA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Honduras'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'HN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Hong Kong'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'HK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Hungary'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'HU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Iceland'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'India'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Indonesia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ID'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Iran'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Iraq'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IQ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Ireland'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Isle of Man'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Israel'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Italy'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'IT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Jamaica'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'JM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Japan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'JP'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Jersey'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'JE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Jordan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'JO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Kazakhstan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Kenya'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Kiribati'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'North Korea'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KP'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'South Korea'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Kuwait'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Kyrgyzstan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Laos'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Latvia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LV'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Lebanon'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LB'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Lesotho'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Liberia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Libya'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Liechtenstein'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Lithuania'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Luxembourg'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Macao'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Macedonia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Madagascar'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Malawi'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Malaysia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Maldives'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MV'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Mali'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ML'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Malta'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Marshall Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Martinique'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MQ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Mauritania'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Mauritius'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Mayotte'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'YT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Mexico'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MX'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Micronesia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'FM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Moldova'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MD'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Monaco'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Mongolia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Montenegro'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ME'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Montserrat'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Morocco'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Mozambique'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Myanmar'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Namibia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Nauru'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Nepal'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NP'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Netherlands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Netherlands Antilles'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'New Caledonia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'New Zealand'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Nicaragua'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Niger'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Nigeria'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Niue'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Norfolk Island'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Northern Mariana Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'MP'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Norway'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'NO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Oman'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'OM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Pakistan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Palau'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Palestinian Territory'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Panama'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Papua New Guinea'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Paraguay'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Peru'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Philippines'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Pitcairn'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Poland'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Portugal'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Puerto Rico'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Qatar'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'QA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Reunion'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'RE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Romania'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'RO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Russia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'RU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Rwanda'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'RW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Saint Barthelemy'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'BL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Saint Helena'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Saint Kitts and Nevis'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'KN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Saint Lucia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Saint Pierre and Miquelon'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'PM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Saint Vincent and the Grenadines'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'VC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Samoa'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'WS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'San Marino'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Sao Tome and Principe'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ST'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Saudi Arabia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Senegal'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Serbia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'RS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Seychelles'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Sierra Leone'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Singapore'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Slovakia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Slovenia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Solomon Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SB'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Somalia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'South Africa'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ZA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'South Georgia and the South Sandwich Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GS'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Spain'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ES'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Sri Lanka'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'LK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Sudan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SD'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Surinam'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Svalbard and Jan Mayen'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SJ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Swaziland'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Sweden'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Switzerland'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'CH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Syria'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'SY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Taiwan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TW'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Tajikistan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TJ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Tanzania'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Thailand'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Timor-Leste'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TL'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Togo'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Tokelau'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TK'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Tonga'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TO'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Trinidad and Tobago'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TT'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Tunisia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Turkey'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TR'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Turkmenistan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Turks and Caicos Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TC'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Tuvalu'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'TV'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Uganda'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'UG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Ukraine'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'UA'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'UAE'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'AE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'United Kingdom'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'GB'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'United States'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'US'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'United States Minor Outlying Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'UM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Uruguay'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'UY'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Uzbekistan'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'UZ'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Vanuatu'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'VU'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Venezuela'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'VE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Vietnam'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'VN'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'British Virgin Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'VG'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'US Virgin Islands'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'VI'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Wallis and Futuna'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'WF'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Western Sahara'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'EH'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Yemen'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'YE'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Zambia'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ZM'</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Zimbabwe'</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'ZW'</span> <span style="color:#006600; font-weight:bold;">&#125;</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> <span style="color:#006600; font-weight:bold;">|</span>c<span style="color:#006600; font-weight:bold;">|</span>
  Country.<span style="color:#9900CC;">find_or_create_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> c<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> c<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:iso_two_letter_code</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Let me know if you have any improvements, but it&#8217;s pretty much taken directly from the <a href="http://www.iso.org/iso/english_country_names_and_code_elements">ISO website</a>.</p>
<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/JaWtbnDUkWM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/06/15/country-seed-data-for-your-rails-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/06/15/country-seed-data-for-your-rails-app/</feedburner:origLink></item>
		<item>
		<title>Simple Quarter Select – Rails plugin for Q1,Q2,Q3,Q4 selector</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/XvZ9SmZsL24/</link>
		<comments>http://www.tonyamoyal.com/2010/05/06/simple-quarter-select-rails-plugin-for-q1q2q3q4-selector/#comments</comments>
		<pubDate>Thu, 06 May 2010 17:23:44 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[simple-quarter-select]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=512</guid>
		<description><![CDATA[Have you ever wanted a select component for Quaters of the Fiscal Year (Q1,Q2,Q3,Q4)? The Simple Quarter Select Ruby on Rails plugin does it for you.  It&#8217;s highly configurable and maps to the month of any datetime attribute in your model.

Why map the quarter to a datetime attribute?
I think the answer is obvious but [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F05%2F06%2Fsimple-quarter-select-rails-plugin-for-q1q2q3q4-selector%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F05%2F06%2Fsimple-quarter-select-rails-plugin-for-q1q2q3q4-selector%2F" height="61" width="51" /></a></div><p>Have you ever wanted a select component for Quaters of the Fiscal Year (Q1,Q2,Q3,Q4)? The <a href="http://github.com/tamoyal/simple_quarter_select">Simple Quarter Select Ruby on Rails plugin</a> does it for you.  It&#8217;s highly configurable and maps to the month of any datetime attribute in your model.<br />
<img src="http://www.tonyamoyal.com/wp-content/uploads/2010/05/Screen-shot-2010-05-06-at-11.53.16-AM.png" alt="Simple Quarter Select screen shot" title="Simple Quarter Select screen shot" width="206" height="34" class="size-full wp-image-511" /><br />
<strong>Why map the quarter to a datetime attribute?</strong><br />
I think the answer is obvious but for the sake of being comprehensive, I&#8217;ll list 3 questions to guide your decision:<br />
1) How else would you store the information in your database?<br />
2) What if some of your objects are quarterly but others are actual dates? How about semiannual?<br />
3) How would your sort-by-date query look?</p>
<p>If you answer these 3 questions, you will likely see the logic in my decision.</p>
<p><strong>Installation</strong><br />
<a href="http://github.com/tamoyal/simple_quarter_select">Get it or view the source here</a></p>
<p><strong>Usage</strong><br />
It&#8217;s really easy to use.  Just toss this code into your view:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= date_select<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:some_model</span>, <span style="color:#ff3333; font-weight:bold;">:some_date_attribute</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>:discard_day <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#ff3333; font-weight:bold;">:order</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:month</span>,:year<span style="color:#006600; font-weight:bold;">&#93;</span>, 
<span style="color:#ff3333; font-weight:bold;">:simple_quarter_select</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p><strong>Configurability</strong><br />
Simple Quarter Select has a misleading name.  It should really be called &#8220;Named Month Intervals&#8221; because that represents its true flexibility.  To illustrate this, let&#8217;s look at an example. Let&#8217;s say you want your users to be able to choose from two halves of a year:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= date_select<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:some_model</span>, <span style="color:#ff3333; font-weight:bold;">:some_date_attribute</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>:discard_day <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#ff3333; font-weight:bold;">:order</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:month</span>,:year<span style="color:#006600; font-weight:bold;">&#93;</span>, 
<span style="color:#ff3333; font-weight:bold;">:simple_quarter_select</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#ff3333; font-weight:bold;">:month_interval</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">6</span>, <span style="color:#ff3333; font-weight:bold;">:interval_names</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;H1&quot;</span>,<span style="color:#996600;">&quot;H2&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p><img src="http://www.tonyamoyal.com/wp-content/uploads/2010/05/Screen-shot-2010-05-06-at-1.18.39-PM.png" alt="Simple Quarter Select sample configuration screenshot" title="Simple Quarter Select sample configuration screenshot" width="240" height="55" class="alignnone size-full wp-image-521" /><br />
 &#8220;H1&#8243; would store as 01/01/YYYY and &#8220;H2&#8243; would store as 07/01/YYYY.</p>
<p>Or maybe you just want to display the full word &#8220;Quarter&#8221; in each option:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= date_select<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:some_model</span>, <span style="color:#ff3333; font-weight:bold;">:some_date_attribute</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>:discard_day <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#ff3333; font-weight:bold;">:order</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:month</span>,:year<span style="color:#006600; font-weight:bold;">&#93;</span>, 
<span style="color:#ff3333; font-weight:bold;">:simple_quarter_select</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#ff3333; font-weight:bold;">:interval_names</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;Quarter 1&quot;</span>,<span style="color:#996600;">&quot;Quarter 2&quot;</span>,<span style="color:#996600;">&quot;Quarter 3&quot;</span>,<span style="color:#996600;">&quot;Quarter 4&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>You get the idea <img src='http://www.tonyamoyal.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let me know if you find this plugin useful or find any bugs.  Enjoy!</p>
<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/XvZ9SmZsL24" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/05/06/simple-quarter-select-rails-plugin-for-q1q2q3q4-selector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/05/06/simple-quarter-select-rails-plugin-for-q1q2q3q4-selector/</feedburner:origLink></item>
		<item>
		<title>Scaling a Rails Application  – Thinking About the Full Stack</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/zlWo9YFYhc8/</link>
		<comments>http://www.tonyamoyal.com/2010/05/06/scaling-a-rails-application-thinking-about-the-full-stack/#comments</comments>
		<pubDate>Thu, 06 May 2010 14:13:59 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[scaling]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=499</guid>
		<description><![CDATA[I found a great presentation about scaling web applications that I wanted to share with the world.  Enjoy!
Scaling a Rails Application from the Bottom Up 
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F05%2F06%2Fscaling-a-rails-application-thinking-about-the-full-stack%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F05%2F06%2Fscaling-a-rails-application-thinking-about-the-full-stack%2F" height="61" width="51" /></a></div><p>I found a great presentation about scaling web applications that I wanted to share with the world.  Enjoy!<br />
<a title="View Scaling a Rails Application from the Bottom Up on Scribd" href="http://www.scribd.com/doc/66377/Scaling-a-Rails-Application-from-the-Bottom-Up" style="margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block; text-decoration: underline;">Scaling a Rails Application from the Bottom Up</a> <object id="doc_397793493420335" name="doc_397793493420335" height="600" width="100%" type="application/x-shockwave-flash" data="http://d1.scribdassets.com/ScribdViewer.swf" style="outline:none;" ><param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf"><param name="wmode" value="opaque"><param name="bgcolor" value="#ffffff"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="FlashVars" value="document_id=66377&#038;access_key=93bwnxpspl5ti&#038;page=1&#038;viewMode=list"><embed id="doc_397793493420335" name="doc_397793493420335" src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=66377&#038;access_key=93bwnxpspl5ti&#038;page=1&#038;viewMode=list" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="600" width="100%" wmode="opaque" bgcolor="#ffffff"></embed></object></p>
<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/zlWo9YFYhc8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/05/06/scaling-a-rails-application-thinking-about-the-full-stack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/05/06/scaling-a-rails-application-thinking-about-the-full-stack/</feedburner:origLink></item>
		<item>
		<title>Getting FancyUpload to work with Rails</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/wAp4ZKnd2Uw/</link>
		<comments>http://www.tonyamoyal.com/2010/04/27/getting-fancyupload-to-work-with-rails/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 15:41:56 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[fancyupload]]></category>
		<category><![CDATA[file uploading]]></category>
		<category><![CDATA[progress bar]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[swiff uploader]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=484</guid>
		<description><![CDATA[FancyUpload is a slick looking file uploader with a progress bar.  However, it&#8217;s not completely obvious how to get it working with your Rails application.  I searched long and hard and found 2 pretty good examples here and here.  The problem is that the former only works with Amazon S3, and the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F27%2Fgetting-fancyupload-to-work-with-rails%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F27%2Fgetting-fancyupload-to-work-with-rails%2F" height="61" width="51" /></a></div><p><a href="http://digitarald.de/project/fancyupload/" target="_blank">FancyUpload</a> is a slick looking file uploader with a progress bar.  However, it&#8217;s not completely obvious how to get it working with your Rails application.  I searched long and hard and found 2 pretty good examples <a target="_blank" href="http://github.com/ncri/Rails-S3-Uploader-Example">here</a> and <a target="_blank" href="http://github.com/rpflorence/fancyupload-3-with-rails">here</a>.  The problem is that the former only works with Amazon S3, and the latter just doesn&#8217;t seem to work. If you are using Amazon S3 check out the first link which will be more useful than this article.  I will show you how to get a great file uploading interface up and running in minutes.<br />
<img src="http://www.tonyamoyal.com/wp-content/uploads/2010/04/Screen-shot-2010-04-27-at-11.31.37-AM.png" alt="FancyUpload with Rails 1" title="FancyUpload with Rails 1" width="293" height="109" class="aligncenter size-full wp-image-486" /><br />
<img src="http://www.tonyamoyal.com/wp-content/uploads/2010/04/Screen-shot-2010-04-27-at-11.30.38-AM-300x143.png" alt="FancyUpload with Rails 2" title="FancyUpload with Rails 2" width="300" height="143" class="aligncenter size-medium wp-image-487" /><br />
<img src="http://www.tonyamoyal.com/wp-content/uploads/2010/04/Screen-shot-2010-04-27-at-11.30.48-AM-300x66.png" alt="FancyUpload with Rails 3" title="FancyUpload with Rails 3" width="300" height="66" class="aligncenter size-medium wp-image-488" /><br />
<img src="http://www.tonyamoyal.com/wp-content/uploads/2010/04/Screen-shot-2010-04-27-at-11.30.53-AM-300x110.png" alt="FancyUpload with Rails 4" title="FancyUpload with Rails 4" width="300" height="110" class="aligncenter size-medium wp-image-489" /></p>
<p>After some wrestling with the code in both examples, I was able to get a sample Rails app up and running.  The <a target="_blank" href="http://github.com/tamoyal/fancyupload_with_rails">app is hosted on github</a> for your downloading pleasure.</p>
<p>I don&#8217;t think it&#8217;s worth going through the fancyuploader code here because you can view examples and usage on the <a href="http://digitarald.de/project/fancyupload" target="_blank">official website</a>, but I will mention the trick to getting it working in Rails:</p>
<p><strong>Step 1. Disable protect_from_forgery for the upload action</strong><br />
This is as simple as:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> UploadsController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
  protect_from_forgery <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'upload'</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> upload
...</pre></div></div>

<p><strong>Step 2. Copy the file somewhere useful and return 200</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> UploadsController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
  protect_from_forgery <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'upload'</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> upload
    <span style="color:#CC00FF; font-weight:bold;">FileUtils</span>.<span style="color:#9900CC;">mv</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:file</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">path</span>, RAILS_ROOT<span style="color:#006600; font-weight:bold;">+</span><span style="color:#996600;">&quot;/data/#{params[:Filename]}&quot;</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> render <span style="color:#ff3333; font-weight:bold;">:nothing</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">200</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p><strong>Step 3. Set the URL param of FancyUploader properly</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">...
<span style="color: #003366; font-weight: bold;">var</span> up <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> FancyUpload3.<span style="color: #660066;">Attach</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'uploader_file_list'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'#upload_link'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
      path<span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://#{request.host_with_port}/javascripts/fancyupload/source/Swiff.Uploader.swf'</span><span style="color: #339933;">,</span>
      url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://#{request.host_with_port}/uploads/upload'</span><span style="color: #339933;">,</span>
...</pre></div></div>

<p>I highly recommend <a href="http://github.com/tamoyal/fancyupload_with_rails" target="_blank">checking out the sample app from my git repository</a> and poking around in the code.  There is very little.  Feel free to contact me if you cannot get fancyupload to work with Rails after trying my sample app.</p>
<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/wAp4ZKnd2Uw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/04/27/getting-fancyupload-to-work-with-rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/04/27/getting-fancyupload-to-work-with-rails/</feedburner:origLink></item>
		<item>
		<title>How to change a UIBarButtonItem in the iphone toolbar</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/OqY6JkGK5K8/</link>
		<comments>http://www.tonyamoyal.com/2010/04/17/how-to-change-a-uibarbuttonitem-in-the-iphone-toolbar/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 19:23:06 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[UIBarButtonItem]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=476</guid>
		<description><![CDATA[I recently needed to add a custom button to the iPhone toolbar but it needed to have state. Specifically, I needed the ability to enable and disable it based on some conditions.  I implemented this using two images for the button &#8211; one for enabled and one for disabled.
First, add the button to the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F17%2Fhow-to-change-a-uibarbuttonitem-in-the-iphone-toolbar%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F17%2Fhow-to-change-a-uibarbuttonitem-in-the-iphone-toolbar%2F" height="61" width="51" /></a></div><p>I recently needed to add a custom button to the iPhone toolbar but it needed to have state. Specifically, I needed the ability to enable and disable it based on some conditions.  I implemented this using two images for the button &#8211; one for enabled and one for disabled.</p>
<p>First, add the button to the toolbar:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">UIBarButtonItem <span style="color: #339933;">*</span>flexibleSpace <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIBarButtonItem alloc<span style="color: #009900;">&#93;</span> initWithBarButtonSystemItem<span style="color: #339933;">:</span>UIBarButtonSystemItemFlexibleSpace target<span style="color: #339933;">:</span>nil action<span style="color: #339933;">:</span>nil<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
UIImage <span style="color: #339933;">*</span>shuffleButtonDisabledImage <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;shuffle_button_disabled.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
UIButton <span style="color: #339933;">*</span>shuffleButton <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIButton buttonWithType<span style="color: #339933;">:</span>UIButtonTypeCustom<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>shuffleButton setImage<span style="color: #339933;">:</span>shuffleButtonDisabledImage forState<span style="color: #339933;">:</span>UIControlStateNormal<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
shuffleButton.<span style="color: #202020;">frame</span> <span style="color: #339933;">=</span> CGRectMake<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> shuffleButtonDisabledImage.<span style="color: #202020;">size</span>.<span style="color: #202020;">width</span><span style="color: #339933;">,</span> shuffleButtonDisabledImage.<span style="color: #202020;">size</span>.<span style="color: #202020;">height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>shuffleButton addTarget<span style="color: #339933;">:</span>self action<span style="color: #339933;">:</span>@selector<span style="color: #009900;">&#40;</span>shuffleSelected<span style="color: #009900;">&#41;</span> forControlEvents<span style="color: #339933;">:</span>UIControlEventTouchUpInside<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
UIBarButtonItem <span style="color: #339933;">*</span>shuffleBarItem <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIBarButtonItem alloc<span style="color: #009900;">&#93;</span>	initWithCustomView<span style="color: #339933;">:</span>shuffleButton<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
toolbarItems <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>NSMutableArray arrayWithObjects<span style="color: #339933;">:</span>flexibleSpace<span style="color: #339933;">,</span>shuffleBarItem<span style="color: #339933;">,</span>flexibleSpace<span style="color: #339933;">,</span>nil<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>toolbarItems retain<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I did this in my init function.</p>
<p>Next you need to implement the logic for disabling and enabling:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>someFlag<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        shuffleActivated <span style="color: #339933;">=</span> YES<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span>UIButton <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>toolbarItems objectAtIndex<span style="color: #339933;">:</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> customView<span style="color: #009900;">&#93;</span> setImage<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;shuffle_button_small.png&quot;</span><span style="color: #009900;">&#93;</span> forState<span style="color: #339933;">:</span>UIControlStateNormal<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        shuffleActivated <span style="color: #339933;">=</span> NO<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span>UIButton <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>toolbarItems objectAtIndex<span style="color: #339933;">:</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> customView<span style="color: #009900;">&#93;</span> setImage<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;shuffle_button_small_disabled.png&quot;</span><span style="color: #009900;">&#93;</span> forState<span style="color: #339933;">:</span>UIControlStateNormal<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Update:</strong><br />
There is actually a better way to set enabled and disabled view states for a button anywhere in your iPhone application.  You can specify which image to display based on the enabled or disabled state of the button, and then just manage the button state. One benefit to this is your disabled button won&#8217;t bounce like it is enabled.  You also don&#8217;t have to create an image every time the button state changes.  Of course you could have avoided both of these issues with a little more code, but this is a nice way to avoid both of those issues with a little less code.  Here is what creating the toolbar will look like now:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">UIBarButtonItem <span style="color: #339933;">*</span>flexibleSpace <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIBarButtonItem alloc<span style="color: #009900;">&#93;</span> initWithBarButtonSystemItem<span style="color: #339933;">:</span>UIBarButtonSystemItemFlexibleSpace target<span style="color: #339933;">:</span>nil action<span style="color: #339933;">:</span>nil<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// this code is copied which is bad, should put in a utility class</span>
UIImage <span style="color: #339933;">*</span>shuffleButtonDisabledImage <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;shuffle_button_disabled.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
UIImage <span style="color: #339933;">*</span>shuffleButtonEnabledImage <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;shuffle_button.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
UIButton <span style="color: #339933;">*</span>shuffleButton <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIButton buttonWithType<span style="color: #339933;">:</span>UIButtonTypeCustom<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
shuffleButton.<span style="color: #202020;">adjustsImageWhenDisabled</span> <span style="color: #339933;">=</span> YES<span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>shuffleButton setEnabled<span style="color: #339933;">:</span>NO<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>shuffleButton setImage<span style="color: #339933;">:</span>shuffleButtonEnabledImage forState<span style="color: #339933;">:</span>UIControlStateNormal<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>shuffleButton setImage<span style="color: #339933;">:</span>shuffleButtonDisabledImage forState<span style="color: #339933;">:</span>UIControlStateDisabled<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
shuffleButton.<span style="color: #202020;">frame</span> <span style="color: #339933;">=</span> CGRectMake<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> shuffleButtonDisabledImage.<span style="color: #202020;">size</span>.<span style="color: #202020;">width</span><span style="color: #339933;">,</span> shuffleButtonDisabledImage.<span style="color: #202020;">size</span>.<span style="color: #202020;">height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>shuffleButton addTarget<span style="color: #339933;">:</span>self action<span style="color: #339933;">:</span>@selector<span style="color: #009900;">&#40;</span>shuffleSelected<span style="color: #009900;">&#41;</span> forControlEvents<span style="color: #339933;">:</span>UIControlEventTouchUpInside<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
UIBarButtonItem <span style="color: #339933;">*</span>shuffleBarItem <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIBarButtonItem alloc<span style="color: #009900;">&#93;</span>	initWithCustomView<span style="color: #339933;">:</span>shuffleButton<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
toolbarItems <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>NSMutableArray arrayWithObjects<span style="color: #339933;">:</span>flexibleSpace<span style="color: #339933;">,</span>shuffleBarItem<span style="color: #339933;">,</span>flexibleSpace<span style="color: #339933;">,</span>nil<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#91;</span>toolbarItems retain<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Again, this is done in my init function.</p>
<p>Your enabling/disabling logic would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>numSelected <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>shuffleActivated<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span>UIButton <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>toolbarItems objectAtIndex<span style="color: #339933;">:</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> customView<span style="color: #009900;">&#93;</span> setEnabled<span style="color: #339933;">:</span>YES<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>numSelected <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span>shuffleActivated<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span>UIButton <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>toolbarItems objectAtIndex<span style="color: #339933;">:</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> customView<span style="color: #009900;">&#93;</span> setEnabled<span style="color: #339933;">:</span>NO<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/OqY6JkGK5K8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/04/17/how-to-change-a-uibarbuttonitem-in-the-iphone-toolbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/04/17/how-to-change-a-uibarbuttonitem-in-the-iphone-toolbar/</feedburner:origLink></item>
		<item>
		<title>B’more on Rails synopsis – April 2010</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/qw1d0DcE2y4/</link>
		<comments>http://www.tonyamoyal.com/2010/04/14/bmore-on-rails-synopsis-april-2010/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 18:33:10 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Bmore On Rails Review]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[capybara]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[integration tests]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[rub]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[shoulda]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[webrat]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=465</guid>
		<description><![CDATA[B&#8217;more on Rails is a community of Baltimore folks who use the Ruby programming language and the Ruby on Rails application framework.  Check out our MeetUp page.  Below is a brief synopsis from our April 2010 meetup.  You can also download the slides here.
Bundler is great for gem management.  Among other [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F14%2Fbmore-on-rails-synopsis-april-2010%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F14%2Fbmore-on-rails-synopsis-april-2010%2F" height="61" width="51" /></a></div><p><a href="http://bmoreonrails.org/" target="_blank">B&#8217;more on Rails</a> is a community of Baltimore folks who use the Ruby programming language and the Ruby on Rails application framework.  Check out our <a href="http://www.meetup.com/bmore-on-rails/" target="_blank">MeetUp</a> page.  Below is a brief synopsis from our April 2010 meetup.  You can also download the slides <a href="http://benevolentcode.com/2010/04/bmore-on-rails-effective-cucumber/" target="_blank">here</a>.</p>
<p><a href="http://github.com/carlhuda/bundler" target="_blank">Bundler</a> is great for gem management.  Among <a href="http://yehudakatz.com/2010/04/12/some-of-the-problems-bundler-solves/" target="_blank">other things</a>, it solves the issue where <a target="_blank" href="https://rails.lighthouseapp.com/projects/8994/tickets/1721-unify-approach-to-gem-dependencies">gems are required to load your environment but the environment needs to be loaded for the  bootstrapping code that installs those gems to execute</a>.</p>
<p><a href="http://cukes.info/" target="_blank">Cucumber</a> seems to be the most agile solution for BDD style integration tests.  Writing out the features before you write code seems like a lot of work, but it will yield better productivity as it forces you to keep the business requirement paramount during development.    It&#8217;s overkill for unit tests in which case <a href="http://github.com/dchelimsky/rspec" target="_blank">RSpec</a>, <a target="_blank" href="http://github.com/thoughtbot/shoulda">Shoulda</a>, or TestUnit (shipped with Rails) will serve you well.  Also, it can be quite painful at first, but the key is to start simple and you will be naturally drawn to advanced usage.</p>
<p>Cucumber should be used in conjunction with <a target="_blank" href="http://github.com/jnicklas/capybara">Capybara</a> or <a href="http://github.com/brynary/webrat" target="_blank">Webrat</a> for browser simulation.  Also the following testing tools were mentioned:</p>
<ul>
<li>
<a href="http://github.com/bmabey/email-spec" target="_blank">Email-spec</a>: a great way to test emails with Cucumber
</li>
<li>
<a href="http://github.com/ianwhite/pickle" target="_blank">Pickle</a>: great Cucumber steps for creating your models
</li>
<li>
<a href="http://github.com/thoughtbot/factory_girl" target="_blank">Factory Girl</a>: fixtures replacement (use in conjunction with Pickle)
</li>
<li>
<a href="http://github.com/jtrupiano/timecop" target="_blank">Timecop</a>: travel time for time-dependent tests (<a href="http://github.com/liangzan/timecop" target="_blank">cucumber usage here</a>)
</li>
<li>
<a href="http://github.com/norman/friendly_id" target="_blank">Friendly ID</a>: more friendly (readable) references to your model
</li>
</ul>
<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/qw1d0DcE2y4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/04/14/bmore-on-rails-synopsis-april-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/04/14/bmore-on-rails-synopsis-april-2010/</feedburner:origLink></item>
		<item>
		<title>Install MySQL on Mac OS X 10.6 and add StartupItem</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/jK2_Wfy7zLg/</link>
		<comments>http://www.tonyamoyal.com/2010/04/13/install-mysql-on-mac-os-x-10-6-and-add-startupitem/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 15:03:09 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=455</guid>
		<description><![CDATA[Installing MySQL on Mac OS X 10.6 took a bit of digging around.  Here is a consolidated tutorial.  I am leaving out sudo commands for convenience.  Use them where you don&#8217;t have permission.

# create the directory where you will keep your MySQL binary distribution
mkdir ~/src
cd ~/src
&#160;
# download mysql binary distribution from http://dev.mysql.com/downloads/mysql/
# [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F13%2Finstall-mysql-on-mac-os-x-10-6-and-add-startupitem%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F04%2F13%2Finstall-mysql-on-mac-os-x-10-6-and-add-startupitem%2F" height="61" width="51" /></a></div><p>Installing MySQL on Mac OS X 10.6 took a bit of digging around.  Here is a consolidated tutorial.  I am leaving out sudo commands for convenience.  Use them where you don&#8217;t have permission.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># create the directory where you will keep your MySQL binary distribution</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>src
&nbsp;
<span style="color: #666666; font-style: italic;"># download mysql binary distribution from http://dev.mysql.com/downloads/mysql/</span>
<span style="color: #666666; font-style: italic;"># then move the distribution into your src directory</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>download.tar.gz ~<span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #666666; font-style: italic;"># make sure you are in ~/src (use pwd if unsure) then untar</span>
<span style="color: #c20cb9; font-weight: bold;">gunzip</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>mysql-VERSION-OS.tar.gz <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> xvf -
&nbsp;
<span style="color: #666666; font-style: italic;"># create the MySQL group</span>
dscl . create <span style="color: #000000; font-weight: bold;">/</span>Groups<span style="color: #000000; font-weight: bold;">/</span>mysql
<span style="color: #666666; font-style: italic;"># give it some group id</span>
dscl . create <span style="color: #000000; font-weight: bold;">/</span>Groups<span style="color: #000000; font-weight: bold;">/</span>mysql gid <span style="color: #000000;">296</span>
<span style="color: #666666; font-style: italic;"># create a MySQL user</span>
dscl . <span style="color: #660033;">-create</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>mysql
<span style="color: #666666; font-style: italic;"># make the MySQL user a member of the MySQL group</span>
dscl . append <span style="color: #000000; font-weight: bold;">/</span>Groups<span style="color: #000000; font-weight: bold;">/</span>mysql GroupMembership mysql
<span style="color: #666666; font-style: italic;"># change ownership to mysql</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> mysql .
<span style="color: #c20cb9; font-weight: bold;">chgrp</span> <span style="color: #660033;">-R</span> mysql .
&nbsp;
<span style="color: #666666; font-style: italic;"># install mysql</span>
scripts<span style="color: #000000; font-weight: bold;">/</span>mysql_install_db <span style="color: #660033;">--user</span>=mysql
<span style="color: #666666; font-style: italic;"># make a symlink in the /usr/local directory or you can customize the location in support-files/mysql.server if you prefer</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span><span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>full<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>your<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">install</span><span style="color: #000000; font-weight: bold;">/</span>directory mysql
&nbsp;
<span style="color: #666666; font-style: italic;"># you should now be able to start the server</span>
support-files<span style="color: #000000; font-weight: bold;">/</span>mysql.server start
&nbsp;
<span style="color: #666666; font-style: italic;"># add mysql to your PATH</span>
<span style="color: #666666; font-style: italic;"># in ~/.bash_profile</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span><span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span>
<span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile
<span style="color: #666666; font-style: italic;"># should bring up the mysql CLI</span>
mysql
<span style="color: #666666; font-style: italic;"># exit </span>
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">exit</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># set mysql server to auto start upon boot</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>StartupItems<span style="color: #000000; font-weight: bold;">/</span>MySQLCOM
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>StartupItems<span style="color: #000000; font-weight: bold;">/</span>MySQLCOM<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span><span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>support-files<span style="color: #000000; font-weight: bold;">/</span>mysql.server MySQLCOM
&nbsp;
<span style="color: #666666; font-style: italic;"># test for success</span>
<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>StartupItems<span style="color: #000000; font-weight: bold;">/</span>MySQLCOM<span style="color: #000000; font-weight: bold;">/</span>MySQLCOM stop
<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>StartupItems<span style="color: #000000; font-weight: bold;">/</span>MySQLCOM<span style="color: #000000; font-weight: bold;">/</span>MySQLCOM start
&nbsp;
<span style="color: #666666; font-style: italic;"># create a root password</span>
mysqladmin <span style="color: #660033;">-u</span> root password your_root_password</pre></div></div>

<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/jK2_Wfy7zLg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/04/13/install-mysql-on-mac-os-x-10-6-and-add-startupitem/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/04/13/install-mysql-on-mac-os-x-10-6-and-add-startupitem/</feedburner:origLink></item>
		<item>
		<title>Recovering off screen windows in Mac OS X</title>
		<link>http://feedproxy.google.com/~r/TonyAmoyal/~3/PQG1d8Qr47k/</link>
		<comments>http://www.tonyamoyal.com/2010/02/18/recovering-off-screen-windows-in-mac-os-x/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 22:46:44 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.tonyamoyal.com/?p=451</guid>
		<description><![CDATA[I constantly lose windows on OS X.  I think it&#8217;s because sometimes I am connected to an external monitor so OS X gets confused when I am not.  I found a great solution online that I would like to re-post here so that I never have to look for it again and I [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F02%2F18%2Frecovering-off-screen-windows-in-mac-os-x%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.tonyamoyal.com%2F2010%2F02%2F18%2Frecovering-off-screen-windows-in-mac-os-x%2F" height="61" width="51" /></a></div><p>I constantly lose windows on OS X.  I think it&#8217;s because sometimes I am connected to an external monitor so OS X gets confused when I am not.  I found a great solution online that I would like to re-post here so that I never have to look for it again and I can help share it with the world.  All credit goes to the author of the <a href="http://www.jonathanlaliberte.com/2007/10/19/move-all-windows-to-your-main-screen/" target="_blank">original article</a>.</p>
<p>The solution is to pop open your Script Editor and run this Apple script:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Example list of processes to ignore: {&quot;xGestures&quot;} or {&quot;xGestures&quot;, &quot;OtherApp&quot;, ...}</span>
<span style="color: #b1b100;">property</span> processesToIgnore : <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Get the size of the Display(s), only useful if there is one display</span>
<span style="color: #808080; font-style: italic;">-- otherwise it will grab the total size of both displays</span>
<span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;Finder&quot;</span>
  <span style="color: #b1b100;">set</span> _b <span style="color: #b1b100;">to</span> bounds <span style="color: #b1b100;">of</span> window <span style="color: #b1b100;">of</span> desktop
  <span style="color: #b1b100;">set</span> screen_width <span style="color: #b1b100;">to</span> item <span style="color: #cc66cc;">3</span> <span style="color: #b1b100;">of</span> _b
  <span style="color: #b1b100;">set</span> screen_height <span style="color: #b1b100;">to</span> item <span style="color: #cc66cc;">4</span> <span style="color: #b1b100;">of</span> _b
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
&nbsp;
<span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;System Events&quot;</span>
  <span style="color: #b1b100;">set</span> allProcesses <span style="color: #b1b100;">to</span> application processes
  <span style="color: #b1b100;">set</span> _results <span style="color: #b1b100;">to</span> <span style="color: #ff0000;">&quot;&quot;</span>
  <span style="color: #b1b100;">repeat</span> <span style="color: #b1b100;">with</span> i <span style="color: #b1b100;">from</span> <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">to</span> <span style="color: #000066;">count</span> allProcesses
    <span style="color: #b1b100;">set</span> doIt <span style="color: #b1b100;">to</span> <span style="color: #cc66cc;">1</span>
    <span style="color: #b1b100;">repeat</span> <span style="color: #b1b100;">with</span> z <span style="color: #b1b100;">from</span> <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">to</span> <span style="color: #000066;">count</span> processesToIgnore
      <span style="color: #b1b100;">if</span> process i <span style="color: #66cc66;">=</span> process <span style="color: #66cc66;">&#40;</span>item z <span style="color: #b1b100;">of</span> processesToIgnore<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
        <span style="color: #b1b100;">set</span> doIt <span style="color: #b1b100;">to</span> <span style="color: #cc66cc;">0</span>
      <span style="color: #b1b100;">end</span> <span style="color: #b1b100;">if</span>
    <span style="color: #b1b100;">end</span> <span style="color: #b1b100;">repeat</span>
&nbsp;
    <span style="color: #b1b100;">if</span> doIt <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">then</span>
      <span style="color: #b1b100;">tell</span> process i
        <span style="color: #b1b100;">repeat</span> <span style="color: #b1b100;">with</span> x <span style="color: #b1b100;">from</span> <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">to</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000066;">count</span> windows<span style="color: #66cc66;">&#41;</span>
          <span style="color: #b1b100;">set</span> winPos <span style="color: #b1b100;">to</span> position <span style="color: #b1b100;">of</span> window x
          <span style="color: #b1b100;">set</span> _x <span style="color: #b1b100;">to</span> item <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> winPos
          <span style="color: #b1b100;">set</span> _y <span style="color: #b1b100;">to</span> item <span style="color: #cc66cc;">2</span> <span style="color: #b1b100;">of</span> winPos
&nbsp;
          <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_x <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #000066;">or</span> _y <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #000066;">or</span> _x &gt; screen_width <span style="color: #000066;">or</span> _y &gt; screen_height<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
&nbsp;
            <span style="color: #b1b100;">set</span> position <span style="color: #b1b100;">of</span> window x <span style="color: #b1b100;">to</span> <span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">22</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
          <span style="color: #b1b100;">end</span> <span style="color: #b1b100;">if</span>
        <span style="color: #b1b100;">end</span> <span style="color: #b1b100;">repeat</span>
&nbsp;
      <span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
    <span style="color: #b1b100;">end</span> <span style="color: #b1b100;">if</span>
  <span style="color: #b1b100;">end</span> <span style="color: #b1b100;">repeat</span>
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span></pre></div></div>

<div style='clear:both'></div><img src="http://feeds.feedburner.com/~r/TonyAmoyal/~4/PQG1d8Qr47k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tonyamoyal.com/2010/02/18/recovering-off-screen-windows-in-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.tonyamoyal.com/2010/02/18/recovering-off-screen-windows-in-mac-os-x/</feedburner:origLink></item>
	</channel>
</rss>
