<?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/" version="2.0">

<channel>
	<title>Jesus Carrera</title>
	
	<link>http://www.jesuscarrera.info</link>
	<description>Web development, Web Design, and stuff like that</description>
	<lastBuildDate>Sat, 20 Mar 2010 14:49:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/jesuscarrera" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="jesuscarrera" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Install nginx in Leopard</title>
		<link>http://www.jesuscarrera.info/2009/07/29/install-nginx-in-leopard/</link>
		<comments>http://www.jesuscarrera.info/2009/07/29/install-nginx-in-leopard/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 19:01:05 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/2009/07/29/install-nginx-in-leopard/</guid>
		<description><![CDATA[sudo port install nginx
sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist
sudo mkdir /var/log/nginx
sudo /opt/local/sbin/nginx
To stop it:
sudo launchctl unload /opt/local/etc/LaunchDaemons/org.macports.nginx/org.macports.nginx.plist
]]></description>
			<content:encoded><![CDATA[<p><kbd>sudo port install nginx<br />
sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist<br />
sudo mkdir /var/log/nginx<br />
sudo /opt/local/sbin/nginx</kbd></p>
<p>To stop it:</p>
<p><kbd>sudo launchctl unload /opt/local/etc/LaunchDaemons/org.macports.nginx/org.macports.nginx.plist</kbd></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/07/29/install-nginx-in-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show hidden files in Finder command</title>
		<link>http://www.jesuscarrera.info/2009/07/03/show-hidden-files-in-finder-command/</link>
		<comments>http://www.jesuscarrera.info/2009/07/03/show-hidden-files-in-finder-command/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 10:05:34 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=590</guid>
		<description><![CDATA[Hide:
defaults write com.apple.finder AppleShowAllFiles true
killall Finder
Show:
defaults write com.apple.finder AppleShowAllFiles false
killall Finder
]]></description>
			<content:encoded><![CDATA[<p>Hide:<br />
<kbd>defaults write com.apple.finder AppleShowAllFiles true<br />
killall Finder</kbd></p>
<p>Show:<br />
<kbd>defaults write com.apple.finder AppleShowAllFiles false<br />
killall Finder</kbd></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/07/03/show-hidden-files-in-finder-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Omio gets 5 stars!</title>
		<link>http://www.jesuscarrera.info/2009/06/15/omio-gets-5-stars/</link>
		<comments>http://www.jesuscarrera.info/2009/06/15/omio-gets-5-stars/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 12:07:03 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=585</guid>
		<description><![CDATA[Web user magazine gave 5 stars to Omio, one of the last projects I was working for. Its main strengths are a tidy interface and easy to use. I think we did a great job to the interface. Congrats Omio team!

]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.omio.com/site-news/omio-gets-5-star-gold-award-in-web-user-magazine/">Web user magazine gave 5 stars to Omio</a>, one of the <a href="http://www.jesuscarrera.info/2009/04/14/omios-new-look/">last projects I was working for</a>. Its main strengths are a tidy interface and easy to use. I think we did a great job to the interface. Congrats Omio team!<br />
<img src="http://www.jesuscarrera.info/uploads/webuser-gold-award.png" alt="webuser-gold-award" title="webuser-gold-award" width="410" height="294" class="alignnone size-full wp-image-587" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/06/15/omio-gets-5-stars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Attending @media</title>
		<link>http://www.jesuscarrera.info/2009/04/28/attending-media/</link>
		<comments>http://www.jesuscarrera.info/2009/04/28/attending-media/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 12:22:59 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=581</guid>
		<description><![CDATA[I&#8217;m going to attend @media. I can&#8217;t wait&#8230; 
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to attend <a href="http://www.vivabit.com/atmedia2009/">@media</a>. I can&#8217;t wait&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/04/28/attending-media/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cut&amp;Paste London</title>
		<link>http://www.jesuscarrera.info/2009/04/27/cutpaste-london/</link>
		<comments>http://www.jesuscarrera.info/2009/04/27/cutpaste-london/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 16:40:00 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=575</guid>
		<description><![CDATA[This year I had the opportunity to attend to Cut&#038;Paste London. It was fun and with several activities for the public. Although if I have to complain for something, the price of the drinks where too expensive. This is one of the contest I took part:
.
If you want to see what have the rest of [...]]]></description>
			<content:encoded><![CDATA[<p>This year I had the opportunity to attend to <a href="http://www.cutandpaste.com/events/2009/apr/4/london-2009/">Cut&#038;Paste London</a>. It was fun and with several activities for the public. Although if I have to complain for something, the price of the drinks where too expensive. This is one of the contest I took part:<br />
<a href="http://www.jesuscarrera.info/uploads/1.jpg"><img src="http://www.jesuscarrera.info/uploads/1-300x225.jpg" alt="cut&amp;paste" title="cut&amp;paste" width="300" height="225" class="alignnone size-medium wp-image-576" /></a><a href="http://www.jesuscarrera.info/uploads/2.jpg"><img src="http://www.jesuscarrera.info/uploads/2-300x199.jpg" alt="cut&amp;paste art" title="cut&amp;paste art" width="300" height="199" class="alignnone size-medium wp-image-578" /></a>.</p>
<p>If you want to see what have the rest of participants done, they have a <a href="http://www.techsuperpowers.com/vote">gallery here</a>. Don&#8217;t worry, I&#8217;m not asking for any vote :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/04/27/cutpaste-london/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Omio’s new look</title>
		<link>http://www.jesuscarrera.info/2009/04/14/omios-new-look/</link>
		<comments>http://www.jesuscarrera.info/2009/04/14/omios-new-look/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 15:26:36 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=568</guid>
		<description><![CDATA[This is the result of my last project, where I&#8217;ve been working about one month and a half. It&#8217;s a mobile phone comparison website and the objective was to change the look and structure, and make it simpler and faster. It was kind of painful work on it, because everything was a mess, and developed [...]]]></description>
			<content:encoded><![CDATA[<p>This is the result of my last project, where I&#8217;ve been working about one month and a half. It&#8217;s a <a href="http://www.omio.com">mobile phone comparison</a> website and the objective was to change the look and structure, and make it simpler and faster. It was kind of painful work on it, because everything was a mess, and developed from the beginning without taking care of performance, proper browser compatibility, consistent/reusable styles, etc. </p>
<p>The main front end work was:</p>
<p>- General CSS and JavaScript performance changing the way CSS and JavaScript were generated. It was using one different CSS and JavaScript depending on the section. The idea was saving HTTP requests, but the fact that we loose caching and gain heavier files, wasn&#8217;t compensating saving requests. Now we just use one CSS file and some JavaScrips depending on the functionality, leaving them in cache.</p>
<p>- General structure/navigation/Search Engine Optimization improvements. </p>
<p>- CSS cleanup. It had loads of old/unnecessary styles. Of course applying the new design&#8230;</p>
<p>- CSS performance. Less image requests using the <a href="http://css-tricks.com/css-sprites/ ">sprites technique</a>.</p>
<p>- Better browser compatibility. No use of conditional extra files for Explorer, and real IE6 good looking. </p>
<p>- CSS centralization: forum and blog are different applications, and they where using different CSS files, duplicating the same styles. Now everything use the same CSS file.</p>
<p>- JavaScript cleanup. It was loading old/unnecessary plugins, and old/unnecessary code.</p>
<p>- JavaScript load performance. It was using just one file in the header, and executing most part of the things when the document is loaded. This caused jumps in the rendering, and long waiting time without feedback for the user. After some work, it doesn&#8217;t load JS in the header, rendering the website frame almost instantly. Loads the necessary files for rendering just before the content. Inline scripts just after the DOM elements to be replaced, so we don&#8217;t realize the change and the rendering is smooth. Load of the rest of scripts at the end of the document, so the page is rendered and usable for the user even before everything is loaded.</p>
<p>Apart of the front end, the back end is quite complex, and I would never do it without the great job of my mates <a href="http://www.marcinciszak.com/">Marcin</a> and <a href="http://www.siddharthdawara.blogspot.com/">Sid</a>, who helped me adding functionality. They also did some database performance work and the migration to Amazon EC2. Also mention to <a href="http://sanyetlee.com/">San</a> and <a href="http://www.jnkmail.com/">Emilio</a>, who did the much better neat and simpler design.</p>
<h2>The overall result:</h2>
<p>Rendering times for the deals page:</p>
<p>08/10/08 &#8211; Old design in Engineyard servers (San Francisco)<br />
From London: 7.11s<br />
From San Francisco: 2.1s</p>
<p>09/03/09 &#8211; Old design in EC2 (Europe) + filters performance work<br />
From London: 1.5s<br />
From San Francisco: 4.5s</p>
<p>09/04/09 &#8211; New design<br />
From London: 0.7s (more than 10x faster!!)<br />
From San Francisco: 2.1s (same as when the servers where in San Francisco!!)</p>
<p>Plus (and this is a big plus) the next requests will have already cached all CSS and most part of the JavaScripts.</p>
<p>I&#8217;m pretty happy with the result, I hope the much better user experience help the site to make more sales. Will see in some months&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/04/14/omios-new-look/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configure different routes in Rails depending on the domain/host name</title>
		<link>http://www.jesuscarrera.info/2009/04/02/configure-different-routes-in-rails-depending-on-the-domainhost-name/</link>
		<comments>http://www.jesuscarrera.info/2009/04/02/configure-different-routes-in-rails-depending-on-the-domainhost-name/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:40:18 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=565</guid>
		<description><![CDATA[Configure different routes in Rails depending on the domain/host name
We can have a Rails application with different domains/hostnames, and responding different to each.
First of all we need to configure our localhost to have different hostnames. In /etc/hosts add:
127.0.0.1 www.localhost.uk.local
127.0.0.1 www.localhost.jp.local
Now in the application to start the server for that hosts without port (port 80), we&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Configure different routes in Rails depending on the domain/host name</p>
<p>We can have a Rails application with different domains/hostnames, and responding different to each.</p>
<p>First of all we need to configure our localhost to have different hostnames. In <em>/etc/hosts</em> add:</p>
<p><code>127.0.0.1 www.localhost.uk.local<br />
127.0.0.1 www.localhost.jp.local</code></p>
<p>Now in the application to start the server for that hosts without port (port 80), we&#8217;ll need to stop the current server in port 80 and start it with the root user:</p>
<p><kbd>sudo apachectl stop<br />
sudo script/server -p 80<br />
</kbd><br />
Then we need to monkey patch the default Rails routing.</p>
<p>Add to the end of <em>config/environments.rb</em></p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
require File.join(File.dirname(__FILE__), '..', 'lib' ,'core_ext')
</textarea>
<p>Create <em>lib/core_ext.rb</em></p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
require File.join(File.dirname(__FILE__), 'core_ext', 'routes')
</textarea>
<p>Create <em>lib/core_ext/routes.rb</em></p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
module ActionController
  module Routing
    class RouteSet
      def extract_request_environment(request)
        { :method => request.method, :hostname => request.server_name }
      end
    end
    class Route
      alias_method :old_recognition_conditions, :recognition_conditions
      def recognition_conditions
        result = old_recognition_conditions
        result << "conditions[:hostname] === env[:hostname]" if conditions[:hostname]
        result
      end
    end
  end
end
</textarea>
<p>I based that code on this post <a href="http://www.smallroomsoftware.com/articles/2007/2/10/rails-routing-based-on-hostname">http://www.smallroomsoftware.com/articles/2007/2/10/rails-routing-based-on-hostname</a>.</p>
<p>Now in the routes we can use hostname as condition:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
map.root :controller => 'en', :action => 'home', :conditions => {:hostname => 'www.localhost.uk.local'}
map.root :controller => 'ja', :action => 'home', :conditions => {:hostname => 'www.localhost.jp.local'}
</textarea>
<p>Obviously we can set up it differently depending on the environment. You can use this technic.</p>
<p>If we use page caching, we&#8217;ll need to store it in different folders depending on the hostname, otherwise if the domains have the same URI, will get the same cached page. In the controler/s:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
before_filter :set_cache_folder
  
  private
  
  def set_cache_folder
    @@page_cache_directory  = "#{RAILS_ROOT}/public/caches/" + request.server_name + "/"
  end
</textarea>
<p>restart the server.</p>
<p>There is another way to do it with the request routing plugin <a href="http://agilewebdevelopment.com/plugins/request_routing">http://agilewebdevelopment.com/plugins/request_routing</a>:</p>
<p>Install the plugin:<br />
<kbd><br />
 script/plugin install http://svn.danwebb.net/external/rails/plugins/request_routing/trunk/<br />
</kbd><br />
In my case, I was using multiple TDLs domains, so I added the hostname option to the plugin. Looks like this:</p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
module ActionController
  module Routing
    class Route
      
      TESTABLE_REQUEST_METHODS = [:subdomain, :domain, :hostname, :method, :port, :remote_ip, 
                                  :content_type, :accepts, :request_uri, :protocol]
      
      def recognition_conditions
        result = ["(match = #{Regexp.new(recognition_pattern).inspect}.match(path))"]
        conditions.each do |method, value|
          if TESTABLE_REQUEST_METHODS.include? method
            result << if value.is_a? Regexp
              "conditions[#{method.inspect}] =~ env[#{method.inspect}]"
            else
              "conditions[#{method.inspect}] === env[#{method.inspect}]"
            end
          else
          end
        end
        result
      end
      
    end
    
    class RouteSet
      
      def extract_request_environment(request)
        { 
          :method => request.method,
          :subdomain => request.subdomains.first.to_s, 
          :domain => request.domain, 
          :hostname => request.server_name,
          :port => request.port, 
          :remote_ip => request.remote_ip, 
          :content_type => request.content_type, 
          :accepts => request.accepts.map(&#038;:to_s).join(','), 
          :request_uri => request.request_uri, 
          :protocol => request.protocol
        }
      end
      
    end
  end
end

</textarea>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/04/02/configure-different-routes-in-rails-depending-on-the-domainhost-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load different configuration for each environment</title>
		<link>http://www.jesuscarrera.info/2009/03/08/load-different-configuration-for-each-environment/</link>
		<comments>http://www.jesuscarrera.info/2009/03/08/load-different-configuration-for-each-environment/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 20:58:34 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=557</guid>
		<description><![CDATA[Sometimes is necessary load different configuration for each environment. This is a way to do it.
Add to config/environments/development.rb

begin
  environment_config = YAML.load_file( File.dirname(__FILE__) + '/development_config.yml' )
  GOOGLE_AJAX_API_KEY = environment_config["google_ajax_api_key"]
rescue
  print 'CANNOT LOAD ENVIRONMENT CONFIG!!!!!!!'
end

Create config/environments/development_config.yml

google_ajax_api_key: ___YOUR_KEY___

Repeat the process with production environment.
The development file would be different for each developer, so is better to [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes is necessary load different configuration for each environment. This is a way to do it.</p>
<p>Add to <em>config/environments/development.rb</em></p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
begin
  environment_config = YAML.load_file( File.dirname(__FILE__) + '/development_config.yml' )
  GOOGLE_AJAX_API_KEY = environment_config["google_ajax_api_key"]
rescue
  print 'CANNOT LOAD ENVIRONMENT CONFIG!!!!!!!'
end
</textarea>
<p>Create <em>config/environments/development_config.yml</em></p>
<textarea name="code" class="ruby:nocontrols" cols="60" rows="10">
google_ajax_api_key: ___YOUR_KEY___
</textarea>
<p>Repeat the process with production environment.</p>
<p>The development file would be different for each developer, so is better to delete it from the repository:<br />
<kbd>cp config/environments/development_config.yml config/environments/development_config_sample.yml</kbd></p>
<p>Add to <em>.gitignore</em><br />
<kbd>config/environments/development_config.yml</kbd></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/03/08/load-different-configuration-for-each-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac Art</title>
		<link>http://www.jesuscarrera.info/2009/03/05/mac-art/</link>
		<comments>http://www.jesuscarrera.info/2009/03/05/mac-art/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 00:22:35 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=553</guid>
		<description><![CDATA[ Yes, Macs also crash, but with artistic style.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jesuscarrera.info/uploads/mac-art.jpg"><img src="http://www.jesuscarrera.info/uploads/mac-art-300x225.jpg" alt="mac-art" title="mac-art" width="300" height="225" class="alignnone size-medium wp-image-554" /></a> Yes, Macs also crash, but with artistic style.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/03/05/mac-art/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show the current song in iTunes</title>
		<link>http://www.jesuscarrera.info/2009/03/02/550/</link>
		<comments>http://www.jesuscarrera.info/2009/03/02/550/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 21:39:55 +0000</pubDate>
		<dc:creator>Jesús Carrera</dc:creator>
				<category><![CDATA[Varios]]></category>

		<guid isPermaLink="false">http://www.jesuscarrera.info/?p=550</guid>
		<description><![CDATA[If you want to tell Growl  to show the current song on iTunes after hitting a combination of keys, you can use a Quicksilver trigger. Simply put this script in ~/Library/Application Support/Quicksilver/scripts, and create a custom trigger to open it.
]]></description>
			<content:encoded><![CDATA[<p>If you want to tell <a href="http://growl.info/">Growl</a>  to show the current song on iTunes after hitting a combination of keys, you can use a <a href="http://docs.blacktree.com/quicksilver/what_is_quicksilver">Quicksilver</a> trigger. Simply put <a href="http://www.jesuscarrera.info/uploads/GrowlNotifyiTunes.scpt">this script</a> in <em>~/Library/Application Support/Quicksilver/scripts</em>, and create a custom trigger to open it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jesuscarrera.info/2009/03/02/550/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
