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

<channel>
	<title>Mundo Ruby &#187; Rails</title>
	<atom:link href="http://www.mundoruby.com.ar/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mundoruby.com.ar</link>
	<description>Ruby Artists, Hackers y otras yerbas ...</description>
	<lastBuildDate>Wed, 12 Aug 2009 23:02:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails edge, Ruby 1.9 style String interpolation support</title>
		<link>http://www.mundoruby.com.ar/2009/07/13/rails-edge-ruby-1-9-style-string-interpolation-support/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/13/rails-edge-ruby-1-9-style-string-interpolation-support/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:43:41 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=133</guid>
		<description><![CDATA[
Este es el primer post de una serie que he decidido comenzar titulada “Analizando commits de rails edge”. Aclaro que los post no van a tener orden alguno y que voy a comentar los que me llaman la atención a _mí_  .
En este caso el commit se trata de agregar a rails la nueva forma de interpolación [...]]]></description>
			<content:encoded><![CDATA[<div class="snap_preview">
<p>Este es el primer post de una serie que he decidido comenzar titulada <strong>“Analizando commits de rails edge”</strong>. Aclaro que los post no van a tener orden alguno y que voy a comentar los que me llaman la atención a _mí_ <img style="margin: 5px;" src="http://s.wordpress.com/wp-includes/images/smilies/face-smile.png" alt=":)" /> .<br />
En este caso el <a style="color: #557799; text-decoration: none;" href="http://github.com/rails/rails/commit/da635394c1c3004f4dacf4a35275404e5b1aef43">commit</a> se trata de agregar a rails la nueva forma de interpolación de strings que trae ruby 1.9 ( la idea es que se pueda usar con versiones menores también), pueden ver el código en este archivo:</p>
<pre>activesupport/lib/active_support/core_ext/string/interpolation.rb</pre>
<p>Cómo uds sabrán en Ruby se pueden interpolar strings de la siguiente manera:</p>
<pre>&gt;&gt;"%s, %s" % ["Masao", "Mutoh"]
=&gt; "Masao, Mutoh"</pre>
<p>Cómo lo explica el comentario en el código:</p>
<pre> # call-seq:
  #   %(arg)
  #   %(hash)
  #
  # Format - Uses str as a format specification, and returns the result of applying it to arg.
  # If the format specification contains more than one substitution, then arg must be
  # an Array containing the values to be substituted. See Kernel::sprintf for details of the
  # format string. This is the default behavior of the String class.
  #   * arg: an Array or other class except Hash.
  #   * Returns: formatted String
  # Example:
  #    "%s, %s" % ["Masao", "Mutoh"]
  #
  # Also you can use a Hash as the "named argument". This is recommended way so translators
  # can understand the meanings of the msgids easily.
  #   * hash: {:key1 =&gt; value1, :key2 =&gt; value2, ... }
  #   * Returns: formatted String
  # Example:
  #   For strings.
  #   "%{firstname}, %{familyname}" % {:firstname =&gt; "Masao", :familyname =&gt; "Mutoh"}
  #
  #   With field type to specify format such as d(decimal), f(float),...
  #   "%d, %.1f" % {:age =&gt; 10, :weight =&gt; 43.4}</pre>
<p>Es decir que ahora podemos interpolar strings de la siguiente manera:</p>
<pre>&gt;&gt; "%{firstname}, %{familyname}" % {:firstname =&gt; "Masao", :familyname =&gt; "Mutoh"}
ArgumentError: malformed format string - %{
	from (irb):2:in `%'
	from (irb):2
&gt;&gt;</pre>
<p>Auuuchh! estoy probando con un irb con ruby 1.8.6, así que necesito requerir el archivo:</p>
<pre>&gt;&gt; require 'activesupport/lib/active_support/core_ext/string/interpolation.rb'
=&gt; true
&gt;&gt; "%{firstname}, %{familyname}" % {:firstname =&gt; "Masao", :familyname =&gt; "Mutoh"}
=&gt; "Masao, Mutoh"</pre>
<p>Ahora sí! podemos interpolar string nombrados pasando un hash como argumento, Hermoso!<br />
Estuve mirando en los fuentes de Ruby 1.9 y no encuentro dónde está escrita esta nueva funcionalidad, el método que define la interpolación con”%” es <strong>rb_str_format_m</strong> y está en la línea número 1202 del archivo <strong>string.c</strong> en el trunk de ruby, pero sólo está la vieja forma de interpolación. <strong>Entonces dónde está ? Alguien sabe?</strong><br />
Es más hice esta prueba:</p>
<pre>$ irb1.9
require 'activesupport/lib/active_support/string/interpolation.rb'
=&gt; true
irb(main):002:0&gt; "%{firstname}, %{familyname}" % {:firstname =&gt; "Masao", :familyname =&gt; "Mutoh"}
ArgumentError: malformed format string - %{
	from (irb):2:in `%'
	from (irb):2
	from /usr/bin/irb1.9:12:in `'</pre>
<p>Y la versión que tengo de ruby 1.9 es:<br />
<strong>ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]</strong><br />
Un poco vieja, probemos con ruby 1.9 compilado desde trunk<br />
<strong>ruby 1.9.2dev (2009-07-11 trunk 24027) [i686-linux]</strong></p>
<pre>./ruby  -e 'puts "%{firstname}, %{familyname}" % {:firstname =&gt; "Masao", :familyname =&gt; "Mutoh"}'
Masao, Mutoh</pre>
<p>Funcionó! entonces en algún lugar tiene que estar.</p>
<p><a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gastonramos.wordpress.com/352/"><img src="http://feeds.wordpress.com/1.0/comments/gastonramos.wordpress.com/352/" border="0" alt="" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gastonramos.wordpress.com/352/"><img src="http://feeds.wordpress.com/1.0/delicious/gastonramos.wordpress.com/352/" border="0" alt="" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gastonramos.wordpress.com/352/"><img src="http://feeds.wordpress.com/1.0/stumble/gastonramos.wordpress.com/352/" border="0" alt="" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gastonramos.wordpress.com/352/"><img src="http://feeds.wordpress.com/1.0/digg/gastonramos.wordpress.com/352/" border="0" alt="" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gastonramos.wordpress.com/352/"><img src="http://feeds.wordpress.com/1.0/reddit/gastonramos.wordpress.com/352/" border="0" alt="" /></a> <img src="http://stats.wordpress.com/b.gif?host=gastonramos.wordpress.com&amp;blog=1034400&amp;post=352&amp;subd=gastonramos&amp;ref=&amp;feed=1" border="0" alt="" /></div>
<p>(Via <a href="http://gastonramos.wordpress.com">Gastón Ramos &#8211; Ruby, Rails&#8230;</a>.) Original Link: <a href="http://gastonramos.wordpress.com/2009/07/10/rails-edge-ruby-1-9-style-string-interpolation-support/#comments">Rails edge, Ruby 1.9 style String interpolation support</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/13/rails-edge-ruby-1-9-style-string-interpolation-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.3, rake y reenable method</title>
		<link>http://www.mundoruby.com.ar/2009/07/13/rails-2-3-rake-y-reenable-method/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/13/rails-2-3-rake-y-reenable-method/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:42:27 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=129</guid>
		<description><![CDATA[

Estoy terminando de hacer una migration a Rails 2.3 de la
app con la que estoy trabajando, resulta que me encontré con el siguiente tema:
Luego de instalar rails y migrar la app, llegó el momento de hacer un deploy a
staging, entonces me econtré con el siguiente error:

undefined method `reenable' for &#60;Rake::Task db:schema:dump =&#62;
[environment]&#62;:Rake::Task

googleando un poco llegué [...]]]></description>
			<content:encoded><![CDATA[<p>
<div class='snap_preview'>
<p>Estoy terminando de hacer una migration a Rails 2.3 de la<br />
app con la que estoy trabajando, resulta que me encontré con el siguiente tema:<br />
Luego de instalar rails y migrar la app, llegó el momento de hacer un deploy a<br />
staging, entonces me econtré con el siguiente error:</p>
<pre>
undefined method `reenable' for &lt;Rake::Task db:schema:dump =&gt;
[environment]&gt;:Rake::Task
</pre>
<p>googleando un poco llegué a este <a href="http://antono.info/en/138">link </a> que dice que hay que instalar<br />
la nueva versión de rake, investigando un poco más, llegué a este <a href="http://rails.lighthouseapp.com/projects/8994/tickets/1412-dbmigrateredo-does-not-dump-the-schema-after-migrating-back-up">PATCH </a><br />
que hace uso del método Rake::Task#reenable, el caso es que este método<br />
se agrega e con la versión de rake 0.8.2 y como el pibe dice en el comentario<br />
del patch, no hay problemas por que rails 2.3 require rake 0.8.3&#8230;. pero<br />
que pasa cuando:</p>
<p>1- Instalo rails 2.3<br />
2- Hago un &#8216;rake rails:freeze&#8217;<br />
3- hago &#8216;cap staging deploy:migrations&#8217;</p>
<p>Y no tengo rails 2.3 instalado en el server y por eso justamente hice un freeze.</p>
<p>Si leemos la task que arma las dependencias de rails:</p>
<pre>
  s.add_dependency('rake', '&gt;= 0.8.3')
  s.add_dependency('activesupport',    '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('activerecord',     '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('actionpack',       '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('actionmailer',     '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('activeresource',   '= 3.0.pre' + PKG_BUILD)
</pre>
<p>uando hacemos el freeze nos copia todas estas cosas menos el rake,<br />
lo cual parece razonable. Pero creo debería agregar en config/environment.rb</p>
<p>config.gem &#8220;rake&#8221;, :version =&gt; &#8216;0.8.3&#8242;</p>
<p>Que opinan uds? </p>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gastonramos.wordpress.com/345/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gastonramos.wordpress.com&#038;blog=1034400&#038;post=345&#038;subd=gastonramos&#038;ref=&#038;feed=1" /></div>
</p>
<p>(Via <a href="http://gastonramos.wordpress.com">Gastón Ramos &#8211; Ruby, Rails&#8230;</a>.) Original Link: <a href="http://gastonramos.wordpress.com/2009/07/08/rails-2-3-rake-y-reenable-method/#comments">Rails 2.3, rake y reenable method</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/13/rails-2-3-rake-y-reenable-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyInstaller: Getting Started with Rails and SQLite3</title>
		<link>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-sqlite3/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-sqlite3/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 14:10:12 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=127</guid>
		<description><![CDATA[
A few folks asked this over the past weeks, and since I released preview1 version of RubyInstaller, wouldn&#8217;t be awesome I write a guide for it?
So, here we go

First, Getting Ruby
Please download from here one of the preview1 installers for Ruby.
For this demonstration, I&#8217;m going to use Ruby 1.9.1-p129. Downloaded, executed and installed to it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>A few folks asked this over the past weeks, and since I <a href="http://blog.mmediasys.com/2009/06/28/rubyinstaller-preview1-released/">released preview1</a> version of RubyInstaller, wouldn&#8217;t be awesome I write a guide for it?</p>
<p>So, here we go</p>
<p><span id="more-233"></span></p>
<h3>First, Getting Ruby</h3>
<p>Please download <a href="http://rubyinstaller.org/downloads/">from here</a> one of the preview1 installers for Ruby.</p>
<p>For this demonstration, I&#8217;m going to use Ruby 1.9.1-p129. Downloaded, executed and installed to it&#8217;s default location <code>C:\Ruby19</code></p>
<p>Now, start a Command prompt with Ruby (under start menu, inside Ruby 1.9.1-p129).</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/prompt.png" alt="Command Prompt with Ruby" title="Command Prompt with Ruby" width="515" height="365" class="alignnone size-full wp-image-238" /></p>
<h3>Getting <span class="caps">SQL</span>ite3</h3>
<p>As you may know, Windows do not came out of the box with libraries like <span class="caps">SQL</span>ite3. For this, we are going to download it from Internet.</p>
<p>Going to <a href="http://sqlite.org/download.html"><span class="caps">SQL</span>ite downloads</a>, under <em>Precompiled binaries for Windows</em>, download <code>sqlitedll-3_6_16.zip</code> and <code>sqlite-3_6_16.zip</code>. Those two packages contains the <span class="caps">DLL </span>(sqlite3.dll) and the command line executable for <span class="caps">SQL</span>ite (sqlite3.exe).</p>
<p>Please extract those contents inside <code>C:\Ruby19\bin</code></p>
<p>Now, let&#8217;s get the Ruby bindings for <span class="caps">SQL</span>ite3</p>
<h3>Getting <span class="caps">SQL</span>ite3/Ruby bindings</h3>
<p>As you may know, the preferred way to distribute Ruby libraries is using Gems. Users on other platforms usually compile themselves these components, using the mechanisms provided by the operating system distribution.</p>
<p>We are going to avoid the compilation process using pre-compiled binaries that has been <em>cooked</em> for us.</p>
<p>So, back to the Command Prompt with Ruby, let&#8217;s install the sqlite3 bindings:</p>
<pre>gem install sqlite3-ruby --source http://gems.rubyinstaller.org</pre>
<p>Adding <code>--source</code> help us indicate a non-standard location from where gems are going to be installed. RubyInstaller team has built and packaged special versions of these gems that we hope get published soon into RubyForge, the official place for gem distribution.</p>
<p>Once installed, you should see something like this at the screen:</p>
<pre>Successfully installed sqlite3-ruby-1.2.4.1-x86-mingw32
1 gem installed</pre>
<p>These special version of the gem are <em>fat binaries</em>, which means these can be safely installed on Ruby 1.8.6 or 1.9.1.</p>
<h3>Getting Rails</h3>
<p>Now it&#8217;s time to install and build a Rails application. First, let&#8217;s install the rails gem:</p>
<pre>gem install rails</pre>
<p>That command is going to take a bit, since is a 2MB or so download, and will install several of the Rails dependencies (ActiveRecord, ActionPack, ActiveSupport, etc). You should expect similar output to this:</p>
<pre>Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
6 gems installed</pre>
<p>Let&#8217;s build our application now.</p>
<h3>Creating a Rails application.</h3>
<p>Let&#8217;s call the application <code>railsapp</code></p>
<pre>rails railsapp</pre>
<p>An excerpt of the output you should get:</p>
<pre>      create
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  config/initializers
      create  config/locales
      create  db
...</pre>
<p>Rails 2.3.2 defaults it&#8217;s database format to <span class="caps">SQL</span>ite3, so there is no need for us to tweak anything.</p>
<p>Checking if everything is ok, using <code>script\about</code>:</p>
<pre>cd railsapp
ruby script\about</pre>
<p>And the output should be something like this:</p>
<pre>About your application's environment
Ruby version              1.9.1 (i386-mingw32)
RubyGems version          1.3.4
Rack version              1.0 bundled
Rails version             2.3.2
Active Record version     2.3.2
Action Pack version       2.3.2
Active Resource version   2.3.2
Action Mailer version     2.3.2
Active Support version    2.3.2
Application root          C:/Users/Luis/railsapp
Environment               development
Database adapter          sqlite3
Database schema version   0</pre>
<p>Now, it&#8217;s up to you create your models, controllers and everything.</p>
<h3>Some notes and considerations.</h3>
<p>At the time of this writing, Mongrel has not been updated to build and install properly either on 1.9 or MinGW versions of Ruby.</p>
<p>As part of Mongrel development team, I&#8217;m going to work on a solution for this in the upcoming days.</p>
<p>If you find something wrong with the Ruby Installer, please report <a href="http://rubyforge.org/tracker/?atid=715&amp;group_id=167&amp;func=browse">here</a>, but issues with your code, Rails or other are not responsability of RubyInstaller.</p>
<p>The binary gems provided at <code>gems.rubyinstaller.org</code> are based on our forks of sqlite3-ruby, which can be cloned and explored <a href="http://github.com/luislavena/sqlite3-ruby">here</a> at GitHub.</p>
<p>Keep in mind that some gems would not work under Ruby 1.9, or you will need a compiler (DevKit) for it. See previous post with details how to get those from our download page.</p>
</p>
<p>(Via <a href="http://blog.mmediasys.com">DEV_MEM.dump_to(:blog) &#8211; Multimedia systems blog</a>.) Original Link: <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/#comments">RubyInstaller: Getting Started with Rails and SQLite3</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-sqlite3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RubyInstaller: Getting Started with Rails and MySQL</title>
		<link>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 14:09:53 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[msyql]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=125</guid>
		<description><![CDATA[
This is a follow up instruction set from previous post, but this time, using MySQL

Getting Ruby
These steps are the same for Ruby 1.9 or Ruby 1.8, please feel free to download the installer from here
For this guide I&#8217;m going to use Ruby 1.9.1-p129, since it the coolest new version that all the guys are playing [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>This is a follow up instruction set from <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/">previous post</a>, but this time, using MySQL</p>
<p><span id="more-250"></span></p>
<h3>Getting Ruby</h3>
<p>These steps are the same for Ruby 1.9 or Ruby 1.8, please feel free to download the installer <a href="http://rubyinstaller.org/downloads">from here</a></p>
<p>For this guide I&#8217;m going to use Ruby 1.9.1-p129, since it the coolest new version that all the guys are playing with <img src='http://blog.mmediasys.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now, start a Command prompt with Ruby (under start menu, inside Ruby 1.9.1-p129).</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/prompt.png" alt="Command Prompt with Ruby 1.9" title="Command Prompt with Ruby 1.9" width="515" height="365" class="alignnone size-full wp-image-238" /></p>
<h3>Getting the right MySQL version</h3>
<p>While building the MySQL/Ruby bindings, we found that mixing versions of the bindings with different versions of MySQL installations ended on undesired results (abnormal program termination, weird errors, etc.)</p>
<p>For this guide, and because we are going to use binary gems, we are going to stick to MySQL version <strong>5.0.83</strong>. </p>
<p>Now is time to download MySQL. For this guide, I&#8217;m going to install the <em>essentials</em> version, which contains only MySQL and command line tools, no Query Builder or any other administrative tool.</p>
<p>Please go to <a href="http://dev.mysql.com/downloads/mysql/5.0.html#win32">this page</a> and download <em>Windows Essentials (x86)</em>. Once downloaded you will end with <code>mysql-essential-5.0.83-win32.msi</code> file. Execute it and install with defaults.</p>
<h3>Configure MySQL</h3>
<p>If you&#8217;re an advanced and savvy MySQL user, you can skip the following steps. For the sake of this guide, I&#8217;m going to list the simple options you must follow when installing it.</p>
<p>Once you installed MySQL, the installer should have started the <em>Configuration Wizard</em> page.</p>
<p>Inside of it, please apply the following options:</p>
<table>
<tr>
<th>Option/Screen</th>
<th>Value</th>
</tr>
<tr>
<td>Configuration Type</td>
<td>Detailed configuration</td>
</tr>
<tr>
<td>Server type</td>
<td>Developer Machine</td>
</tr>
<tr>
<td>Database usage</td>
<td>Transactional Database only</td>
</tr>
<tr>
<td>InnoDB datafile</td>
<td><em>Your option or leave defaults</em></td>
</tr>
<tr>
<td>Number of connections</td>
<td>Decision Support</td>
</tr>
<tr>
<td>Networking options</td>
<td>Check <em>Add firewall exceptions</em></td>
</tr>
<tr>
<td>Character set</td>
<td>Best support for Multilingualism (UTF8)</td>
</tr>
<tr>
<td>Windows Options</td>
<td>Add to <span class="caps">PATH </span>if you want <em>mysql</em> available on every prompt</td>
</tr>
<tr>
<td>Security Options</td>
<td>Uncheck if you want <em>root</em> password be blank</td>
</tr>
</table>
<p>Once done with all this, on the summary screen, please click <em>Execute</em> to complete the configuration of MySQL Server.</p>
<p>Under some system, starting of MySQL server will fail during this wizard, but don&#8217;t be afraid, most of the times, this can be safely ignored.</p>
<p>To check everything was properly installed, please go to the Start Menu, and inside <em>MySQL Server 5.0</em>, click on <em>MySQL Command Line Client</em></p>
<p>If you changed the <em>root</em> password, or, like me, leaved it unchecked, you can simply press enter when asked for the password and see that the server is running!</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/mysql-client.png" alt="MySQL Console Client" title="MySQL Console Client" width="566" height="353" class="alignnone size-full wp-image-253" /></p>
<p>If you decided to add MySQL to the <span class="caps">PATH, </span>you will require to restart your computer so the <span class="caps">PATH </span>change is available to the system.</p>
<p>If you decided not to add MySQL to the <span class="caps">PATH, </span>please go, with Explorer to the location where you installed MySQL Server and copy <code>libmySQL.dll</code> into <code>C:\Ruby19\bin</code></p>
<p>In my case, I found this file in <code>C:\Program Files\MySQL\MySQL Server 5.0\bin</code></p>
<p>Now, it is time to install the bindings.</p>
<h3>Getting MySQL/Ruby</h3>
<p>For this version of Ruby, there is no official binary gems for both Ruby 1.8 and 1.9. So we are going to install the specially built version from RubyInstaller gems repository. </p>
<p>At the <em>Command Prompt with Ruby</em>, please enter the following command:</p>
<pre>
gem install mysql --source http://gems.rubyinstaller.org
  </pre>
<p>This is going to install the special version of MySQL bindings. This version works with Ruby 1.8 and 1.9, since bundles <em>fat binaries</em>. You should expect a similar output like this:</p>
<pre>Successfully installed mysql-2.8.1.1-x86-mingw32
1 gem installed</pre>
<h3>Getting Rails</h3>
<p>Now is time to install Rails and build our application. At the same command prompt, please enter the following command:</p>
<pre>gem install rails</pre>
<p>This is going to take a bit, since Rails and it&#8217;s dependencies takes around 2MB or so, and need to be downloaded and installed.</p>
<p>Once done, expect see at the screen something like this:</p>
<pre>Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
6 gems installed</pre>
<h3>Creating a Rails application</h3>
<p>Let&#8217;s name our application <code>mysqlapp</code></p>
<pre>rails mysqlapp --database=mysql</pre>
<p>The <code>--database</code> option indicates to Rails that we want to use MySQL instead of the default database adapter (SQLite3).</p>
<p>Rails will output a lot of lines when creating your application structure, just an excerpt of what to see:</p>
<pre>
...
      create  config/database.yml
      create  config/routes.rb
      create  config/locales/en.yml
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_rails_defaults.rb
      create  config/initializers/session_store.rb
      create  config/environment.rb
...
</pre>
<h3>Configuring our Database</h3>
<p>Now Rails have configured for us the name of the database we want to use, and you can verify it in <code>config\database.yml</code></p>
<p>Rails will try to connect to <code>mysqlapp_development</code>, but that database do not exist in our fresh new MySQL server.</p>
<p>So, let&#8217;s create it:</p>
<pre>cd mysqlapp
rake db:create</pre>
<p>Just that, simple <code>db:create</code> is going to connect to our MySQL server, and create the database for us.</p>
<p>Keep in mind that if you changed root password or want to use other MySQL user to connect to the database, you need to edit <code>database.yml</code> to reflect those changes.</p>
<p>Let&#8217;s verify that everything is in place, using the following command:</p>
<pre>About your application's environment
Ruby version              1.9.1 (i386-mingw32)
RubyGems version          1.3.4
Rack version              1.0 bundled
Rails version             2.3.2
Active Record version     2.3.2
Action Pack version       2.3.2
Active Resource version   2.3.2
Action Mailer version     2.3.2
Active Support version    2.3.2
Application root          C:/Users/Luis/mysqlapp
Environment               development
Database adapter          mysql
Database schema version   0</pre>
<p>Now is up to you to create your models, controllers and views!</p>
<h3>Some notes and considerations</h3>
<p>On other post I&#8217;m going to guide you with steps on building the bindings against MySQL 5.1.36, since you will need to install the Ruby Development Kit and the development headers for MySQL.</p>
<p>If you find something wrong with the Ruby Installer, please report it <a href="http://rubyforge.org/tracker/?atid=715&amp;group_id=167&amp;func=browse">here</a>, but issues with your code, Rails or other are not responsability of RubyInstaller.</p>
<p>The binary gems provided at <code>gems.rubyinstaller.org</code> are based on our forks of mysql bindings, which can be cloned and explored <a href="http://github.com/luislavena/mysql-gem">here</a> at GitHub.</p>
<p>Keep in mind that some gems would not work under Ruby 1.9, or you will need a compiler (DevKit) for it. See previous post with details how to get those from our download page.</p>
</p>
<p>(Via <a href="http://blog.mmediasys.com">DEV_MEM.dump_to(:blog) &#8211; Multimedia systems blog</a>.) Original Link: <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/#comments">RubyInstaller: Getting Started with Rails and MySQL</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Scrap con Rails</title>
		<link>http://www.mundoruby.com.ar/2009/06/13/google-scrap-con-rails/</link>
		<comments>http://www.mundoruby.com.ar/2009/06/13/google-scrap-con-rails/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 12:18:07 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=109</guid>
		<description><![CDATA[
web_search_plugin es un nuevo plugin de Rails que hice, para poder obtener los resultados de una determinada consulta en google y mostrarla en tu sitio. Hasta el momento solo realiza búsquedas en Google, a futuro lo voy a integrar con Yahoo y Live.
Instalar web_search_plugin


# cd myapprails
# ruby script/plugin install git@github.com:chebyte/web_search_plugin.git


Uso
Como ejemplo, tenemos el modelo #link.rb


 [...]]]></description>
			<content:encoded><![CDATA[<p>
<p><a href="http://github.com/chebyte/web_search_plugin/tree/master">web_search_plugin</a> es un nuevo plugin de Rails que hice, para poder obtener los resultados de una determinada consulta en google y mostrarla en tu sitio. Hasta el momento solo realiza búsquedas en Google, a futuro lo voy a integrar con Yahoo y Live.</p>
<p><strong>Instalar web_search_plugin</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># cd myapprails</span>
<span style="color:#008000; font-style:italic;"># ruby script/plugin install git@github.com:chebyte/web_search_plugin.git</span></pre>
</div>
</div>
<p><strong>Uso</strong><br />
Como ejemplo, tenemos el modelo #link.rb</p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;"> <span style="color:#9966CC; font-weight:bold;">class</span> Link <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
   <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">Chebyte::WebSearch</span>
   web_search
 <span style="color:#9966CC; font-weight:bold;">end</span></pre>
</div>
</div>
<p>Ahora para obtener los resultados solo debemos llamar al método search_web</p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;"> Link.<span style="color:#9900CC;">google_search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:query</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;tuquito&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre>
</div>
</div>
<p>esto nos devolveria</p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Google::Response:0xb734d3cc @results=[{:domain=&gt;&quot;www.tuquito.org.ar&quot;, :content=&gt;&quot;Proyecto Linux de Tucumán, datos y temas relacionados al proyecto, foros y ayuda para usuarios de la distribución y descargas.&quot;, :title=&gt;&quot;Tuquito 3&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:4NZXKc3gQA8J:www.tuquito.org.ar&quot;, :url=&gt;&quot;http://www.tuquito.org.ar/&quot;}, {:domain=&gt;&quot;en.wikipedia.org&quot;, :content=&gt;&quot;Oct 11, 2008 ... Tuquito is a Debian-based operating system created in Tucumán, Argentina, by Ignacio Díaz, Chris Arenas and Mauro Torres, students of The ...&quot;, :title=&gt;&quot;Tuquito - Wikipedia, the free encyclopedia&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:a1xAEvHHujUJ:en.wikipedia.org&quot;, :url=&gt;&quot;http://en.wikipedia.org/wiki/Tuquito&quot;}, {:domain=&gt;&quot;www.slideshare.net&quot;, :content=&gt;&quot;Tuquito 3 Nuevo Diseño En varios idiomas (Ingles,Portugues y Español) Interfaces mas intuitivas Optimizado para la conectividad(wifi, ...&quot;, :title=&gt;&quot;Tuquito 3&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:T8VfO-4iyioJ:www.slideshare.net&quot;, :url=&gt;&quot;http://www.slideshare.net/chebyte/tuquito-3&quot;}, {:domain=&gt;&quot;www.olpcnews.com&quot;, :content=&gt;&quot;OLPC Tuquito's team began to work at 1st January of 2007, with the knowledge acquisition about the project One Laptop Per Child and then with development ...&quot;, :title=&gt;&quot;OLPC Tuquito Project Progress in Argentina - OLPC News&quot;, :cache_url=&gt;&quot;http://www.google.com/search?q=cache:eoGfDNbaZ8kJ:www.olpcnews.com&quot;, :url=&gt;&quot;http://www.olpcnews.com/countries/argentina/olpc_tuquito_project_argentina.html&quot;}], @status=200, @size=4, @query=&quot;tuquito&quot;&gt;</span></pre>
</div>
</div>
<p>El resultado es un simple objecto hash, algunos de los campos disponibles son<br />
 <strong>   * title</strong> titulo del resultado<br />
   <strong> * url </strong>Url del resultado<br />
<strong>    * domain</strong> Root url del resultado<br />
  <strong>  * content </strong>contenido<br />
<strong>    * cache_url</strong> Google cache url</p>
</p>
<p>(Via <a href="http://www.chebyte.com.ar">Chebyte&#8217;s Blog</a>.)  Original Link: <a href="http://www.chebyte.com.ar/2009/06/12/google-scrap-con-rails/#comments">Google Scrap con Rails</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/06/13/google-scrap-con-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Desinfecta tu html (sanitizer)</title>
		<link>http://www.mundoruby.com.ar/2009/06/13/desinfecta-tu-html-sanitizer/</link>
		<comments>http://www.mundoruby.com.ar/2009/06/13/desinfecta-tu-html-sanitizer/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 12:17:03 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=107</guid>
		<description><![CDATA[
simple_sanitizer_html es un plugin muy sencillo que arme para Rails, que te permite básicamente escapar el html.
Lo interesante de este plugin es que solo debemos extender el modelo y de forma automática guarda todo los registros escapando el html en la base de datos.
Instalar simple_sanitizer_html


  http://github.com/chebyte/simple_sanitizer_html/tree/master


Uso Práctico


# ruby script/generate model Post title:string copy:text




class Post
 [...]]]></description>
			<content:encoded><![CDATA[<p>
<p><a href="http://github.com/chebyte/simple_sanitizer_html/tree/master">simple_sanitizer_html </a>es un plugin muy sencillo que arme para Rails, que te permite básicamente<a href="http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/"> escapar el html</a>.<br />
Lo interesante de este plugin es que solo debemos extender el modelo y de forma automática guarda todo los registros escapando el html en la base de datos.</p>
<p><strong>Instalar simple_sanitizer_html</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;">  http:<span style="color:#006600; font-weight:bold;">//</span>github.<span style="color:#9900CC;">com</span><span style="color:#006600; font-weight:bold;">/</span>chebyte<span style="color:#006600; font-weight:bold;">/</span>simple_sanitizer_html<span style="color:#006600; font-weight:bold;">/</span>tree<span style="color:#006600; font-weight:bold;">/</span>master</pre>
</div>
</div>
<p><strong>Uso Práctico</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># ruby script/generate model Post title:string copy:text</span></pre>
</div>
</div>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Post
 simple_sanitizer_html
<span style="color:#9966CC; font-weight:bold;">end</span></pre>
</div>
</div>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;">$ ruby script<span style="color:#006600; font-weight:bold;">/</span>console
Loading development environment <span style="color:#006600; font-weight:bold;">&#40;</span>Rails 2.3.2<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">p</span> <span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span> = Post.<span style="color:#9900CC;">new</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Post id: nil, title: nil, copy: nil, created_at: nil, updated_at: nil&gt;</span>
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">title</span> = <span style="color:#996600;">&quot;&lt;script&gt;alert('hi tuquito')&lt;/script&gt;&quot;</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&lt;script&gt;alert('hi tuquito')&lt;/script&gt;&quot;</span>
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">save</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;">&gt;&gt;</span> <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">title</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&amp;lt;script&amp;gt;alert(&amp;#39;hi tuquito&amp;#39;)&amp;lt;/script&amp;gt;&quot;</span>
<span style="color:#006600; font-weight:bold;">&gt;&gt;</span></pre>
</div>
</div>
<p>Este plugin puede ser muy útil para<a href="http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/"> prevenir ataques XSS</a> o del estilo</p>
</p>
<p>(Via <a href="http://www.chebyte.com.ar">Chebyte&#8217;s Blog</a>.)  Original Link: <a href="http://www.chebyte.com.ar/2009/06/12/desinfecta-tu-html-sanitizer/#comments">Desinfecta tu html (sanitizer)</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/06/13/desinfecta-tu-html-sanitizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Engine Yard hiring developers to help build our cloud</title>
		<link>http://www.mundoruby.com.ar/2009/04/07/engine-yard-hiring-developers-to-help-build-our-cloud/</link>
		<comments>http://www.mundoruby.com.ar/2009/04/07/engine-yard-hiring-developers-to-help-build-our-cloud/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 02:26:08 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=76</guid>
		<description><![CDATA[I&#8217;m looking for a few good folks to join my team. You need to be able to work on site in San Francisco, we can assist with moving expenses for the right candidate.
You would work with my team(currently 5 devs). We do no bs agile style development with pairing where appropriate and test infected mentality [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m looking for a few good folks to join my team. You need to be able to work on site in San Francisco, we can assist with moving expenses for the right candidate.</p>
<p>You would work with my team(currently 5 devs). We do no bs agile style development with pairing where appropriate and test infected mentality . generally we have a fun, tight team and get to work on some of the hardest and most rewarding areas of software development relevant today.</p>
<p>You would be on my team working on <a href='http://engineyard.com/solo'>http://engineyard.com/solo</a> and it&#8217;s successors as well as Engine Yard&#8217;s on premises infrastructure.</p>
<p>You would be working on/with the following ruby technologies:</p>
<pre>
Ruby
Merb
Rails
Sinatra
DataMapper
Nanite
Chef
Event Machine
Many others..
</pre>
<p>You would be working on the following problem domains:</p>
<pre>
Scalable Ruby Deployment Architectures
Scalable Cloud Computing Architectures
Scalable Database Architecture
Distributed Computing
Key Value Data Stores
Infrastructure automation
Cloud provider API's
Multi-Cloud portability
Monitoring and alerting systems
Security in the Cloud
Horizontally Scalable Architectures
Many other interesting areas of computing
</pre>
<p>Familiarity with the following tech is nice but not necessarily required if you can learn fast:</p>
<pre>
Gentoo Linux
Nginx
Apache
Monit
Daemontools
Mysql
Postgresql
Memcached
Passenger
Mongrel
Thin
SSL Certs
Iptables/Networking
Erlang
</pre>
<p>If you think you have the &#8220;right stuff&#8221; and you have the kick ass take names attitude then send a resume with a short intro about who you are and why you are the person we should hire.</p>
<p><a href='mailto:ez@engineyard.com'>ez@engineyard.com</a></p>
<p>(Via <a href="http://brainspl.at/">Brainspl.at</a>.) Original Link: <a href="http://brainspl.at/articles/2009/04/07/engine-yard-hiring-developers-to-help-build-our-cloud">Engine Yard hiring developers to help build our cloud</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/04/07/engine-yard-hiring-developers-to-help-build-our-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Take A  Photo &#8211; Fotos instantáneas desde tu web</title>
		<link>http://www.mundoruby.com.ar/2009/04/03/take-a-photo-fotos-instantaneas-desde-tu-web/</link>
		<comments>http://www.mundoruby.com.ar/2009/04/03/take-a-photo-fotos-instantaneas-desde-tu-web/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 22:05:20 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=74</guid>
		<description><![CDATA[En la última semana estuve trabajando en agregar nuevas funcionalidades a un sitio de un cliente y entre los pedidos estaba una especie de Fotoblog para los usuarios (y bue, hay que pagar las cuentas a fin de mes  ).
La cosa salió rápido, usando Paperclip que guarda las imágenes que se suben, se muestra [...]]]></description>
			<content:encoded><![CDATA[<p>En la última semana estuve trabajando en agregar nuevas funcionalidades a un sitio de un cliente y entre los pedidos estaba una especie de Fotoblog para los usuarios (y bue, hay que pagar las cuentas a fin de mes <img src='http://www.mundoruby.com.ar/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ).</p>
<p>La cosa salió rápido, usando Paperclip que guarda las imágenes que se suben, se muestra en orden, etc, nada del otro mundo. Pero hablando con el cliente surgió la idea de hacer que el usuario se pueda tomar una foto directamente desde la web usando su webcam, así que después de decir &#8220;<em>si, se debe poder hacer</em>&#8221; mentalmente me salió un &#8220;<em>doh!, que dije!</em>&#8220;. Lo último que se dijo en esa reunión fue &#8220;<em>Lo quiero</em>&#8221; <img src='http://www.mundoruby.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
<p>Ya había visto juegos flash que utilizan la webcam así que empecé por ahí, para ver como sacaban un frame del video, lo cual era muy fácil. Lo siguiente era serializarla. A falta de algo mejor hice un serializador de imágenes muy pedorro, pero que anda (aunque es lento), que envía por POST la información de cada pixel.</p>
<p>La parte de Ruby fue fácil y decidí encapsularla en un plugin de Rails para poder reutilizarlo luego o por si a alguien más le sirve <img src='http://www.mundoruby.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Además se puede integrar con Paperclip o AttachmentFu para hacer la persistencia de la imagen en donde sea.</p>
<p>La única parte que usa Flash es el capturador de la cámara, porque otra no quedaba, pero luego el botón para tomar la foto y los eventos se manejan todo por Javascript.</p>
<p>El plugin tiene varios TODOs, pero por si a alguien le sirve está en <a href="http://github.com/Gazer/take-a-photo/tree/master">github</a>.</p>
<p>(Via <a href="http://www.gazer.com.ar">El Futirifoken</a>.) Original Link: <a href="http://www.gazer.com.ar/2009/04/02/take-a-photo-fotos-instantaneas-desde-tu-web/#comments">Take A  Photo &#8211; Fotos instantáneas desde tu web</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/04/03/take-a-photo-fotos-instantaneas-desde-tu-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to know a user location with Rails</title>
		<link>http://www.mundoruby.com.ar/2009/03/26/how-to-know-a-user-location-with-rails/</link>
		<comments>http://www.mundoruby.com.ar/2009/03/26/how-to-know-a-user-location-with-rails/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 20:02:42 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[GeoLocation]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=60</guid>
		<description><![CDATA[Knowing the user location is useful not only for statics, but also, for example, to avoid that the same ip address votes twice or to allow that your site shows products dynamically in relation with the place where the user is and a lot of other applications.
The first task is to know the ip address [...]]]></description>
			<content:encoded><![CDATA[<p>Knowing the user location is useful not only for statics, but also, for example, to avoid that the same ip address votes twice or to allow that your site shows products dynamically in relation with the place where the user is and a lot of other applications.</p>
<p>The first task is to know the ip address of the user, to do this we can use a very helpful method of rails called remote_ip, this function is very smart, looks for in the headers HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR and REMOTE_ADDR and parse the value to figure out the ip address. So if we want to know the ip address we can use this:</p>
<pre class="source-code"><code>@client_ip = request.remote_ip</code></pre>
<p>If you are working in your local machine the remote_ip will be 127.0.0.1 and this address cannot be processed, then you have to write the following, instead the above code:</p>
<pre class="source-code"><code>@client_ip = (RAILS_ENV == 'development') ? '201.231.22.125' : request.remote_ip</code></pre>
<p>Once we have the ip address we have to figure out the place where the ip address is from, to do this we are going to use a free database of <a href="http://www.maxmind.com/">MaxMind</a>, they offer geolocation databases, the free edition (GeoIpLite) is less accurate than the commercial version but it was enough for me, <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz">here</a> is the link to the free binary database, I decompress the database in /opt/GeoIP/share/GeoIP/.</p>
<p>To work with the above database you have to install the C library <a href="http://www.maxmind.com/app/c">geoip</a>, I did this from the source but you can get it from synaptic, these are the commands that I used:</p>
<pre class="source-code"><code>wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gztar -zxvf GeoIP.tar.gzcd GeoIP./configure --prefix=/opt/GeoIPmake &amp;&amp; sudo make install</code></pre>
<p>And to work from Ruby with this library I use <a href="http://rubyforge.org/projects/geoip-city/">geoip_city</a> gem, to install it I used:</p>
<pre class="source-code"><code>sudo gem install geoip_city -- --with-geoip-dir=/opt/GeoIP</code></pre>
<p>Well we have everything installed, now we can test it from the Rails side, in the root project open a console and run the following:</p>
<p><span style="font-size:85%;"><span style="font-family:courier new;">script/console</span><br />
<span style="font-family:courier new;"> &gt;&gt; require &#8216;geoip_city&#8217;</span><br />
<span style="font-family:courier new;"> &gt;&gt; g = GeoIPCity::Database.new(&#8217;/opt/GeoIP/share/GeoIP/GeoLiteCity.dat&#8217;)</span><br />
<span style="font-family:courier new;"> &gt;&gt; res = g.look_up(&#8217;201.231.22.125&#8242;)</span><br />
<span style="font-family:courier new;"> =&gt; {:latitude=&gt;-33.13330078125, :country_code3=&gt;&#8221;ARG&#8221;, :longitude=&gt;-64.3499984741211, :city=&gt;&#8221;Río Cuarto&#8221;, :country_name=&gt;&#8221;Argentina&#8221;, :country_code=&gt;&#8221;AR&#8221;, :region=&gt;&#8221;05&#8243;}</span></span></p>
<p>If you get something like this you have everything working, but when I did my first test I got the following error message:<br />
<span style="font-size:85%;"><span style="font-family:courier new;"> &#8220;libgeoip.so.1: cannot open shared object file: No such file or directory&#8221;</span></span><br />
I solved it running:  <span style="font-family:courier new;">sudo <span style="font-size:85%;">ldconfig /etc/ld.so.conf</span></span></p>
<p>Once that we have everything working we can build our country method oracle, I did it in the application.rb file:</p>
<p><code>def get_country<br />
@client_ip = request.remote_ip @client_ip = '201.231.22.125'</p>
<p>if session[:country].blank?<br />
g = GeoIPCity::Database.new('/opt/GeoIP/share/GeoIP/GeoLiteCity.dat')<br />
@user_location = g.look_up(@client_ip)</p>
<p> # if there isn't a country_code then the default country is USA<br />
session[:country] = @user_location[:country_code] || 'US'<br />
end<br />
end</code></p>
<p>and &#8220;voila&#8221; you have in all the views and controllers the variable session[:country] that contains the current country location of the user, if you want you can be more accurate and ask for cities, lats, longs but I  just neded the user country.</p>
<p>Well this was my first post, so I hope that this will be useful for somebody.</p>
<div class="blogger-post-footer"><img src="http://res1.blogblog.com/tracker/2450465518865184850-3236818411256954707?l=mea-docta-ignorantia.blogspot.com" alt="" width="1" height="1" /></div>
<p>(Via <a href="http://mea-docta-ignorantia.blogspot.com/">Docta Ignorantia</a>.) Original Link: <a href="http://mea-docta-ignorantia.blogspot.com/2009/03/how-to-know-user-location-with-rails.html">How to know a user location with Rails</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/03/26/how-to-know-a-user-location-with-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with Jekyll</title>
		<link>http://www.mundoruby.com.ar/2009/03/25/getting-started-with-jekyll/</link>
		<comments>http://www.mundoruby.com.ar/2009/03/25/getting-started-with-jekyll/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 19:41:35 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=58</guid>
		<description><![CDATA[Jekyll is a simple static site generator created by Tom Preston-Werner that is used as the engine behind the well-known GitHub Pages.
I must admit that the first time I heard about this, the idea did not grab my attention at all. But after reading some inspiring blog posts about it, everything started to make sense [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/mojombo/jekyll">Jekyll</a> is a simple static site generator created by <a href="http://tom.preston-werner.com/">Tom Preston-Werner</a> that is used as the engine behind the well-known <a href="http://pages.github.com/">GitHub Pages</a>.</p>
<p>I must admit that the first time I heard about this, the idea did not grab my attention at all. But after reading <a href="http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html">some</a> <a href="http://jarinheit.com/2009/02/16/simplified-blogging-with-github-pages-and-jekyll.html">inspiring</a> <a href="http://blog.new-bamboo.co.uk/2009/2/20/migrating-from-mephisto-to-jekyll">blog</a> <a href="http://metajack.im/2009/01/23/blogging-with-git-emacs-and-jekyll/">posts</a> about it, everything started to make sense and I decided to give it a try on my new blog, and so far, I like it.</p>
<h2>Installing Jekyll</h2>
<p>The easiest way to install Jekyll is via RubyGems:</p>
<pre>
  <code>
    $ sudo gem install mojombo-jekyll -s http://gems.github.com
  </code>
</pre>
<p>Notice that Jekyll requires directory_watcher, liquid, open4 and maruku. They will be automatically installed by the gem install command.</p>
<h2>Creating content</h2>
<p>Basically, what Jekyll does is to take several <a href="http://www.textism.com/tools/textile/">.textile</a> or <a href="http://daringfireball.net/projects/markdown/">.markdown</a> files and translates them into html, optionally using layout templates to avoid duplicating the common areas of our blog on each post. So, all we need to do is place our own content files in the correct locations.</p>
<p>A typical Jekyll blog setup would be as follows:<br/><br/></p>
<ul>
<li>An <code>index.html</code> file on the root directory that will serve as the home page of our blog.</li>
<li>One or more template layouts in the <code>_layouts</code> directory. These layouts can then be referenced from any other file by using the layout attribute in the <span class="caps">YAML</span> header. Also notice that layouts can be nested.</li>
<li>One .textile or .markdown file for each post in the <code>_posts</code> directory.</li>
<li>One .textile or .markdown file for each draft in the <code>_drafts</code> directory. Any posts in this directory will be ignored by Jekyll at generation time.</li>
<li>One or more .textile or .markdown files in the <code>_includes</code> directory. Any files located in this directory can be included into another file with the <code>include</code> tag.</li>
</ul>
<p>For a starting point, you might want to take a look at Tom Preston-Werner&#8217;s <a href="http://github.com/mojombo/tpw"><span class="caps">TPW</span></a> repository.</p>
<h2>Generating the blog</h2>
<p>Once that the basic layout and content of our blog was set up, we are ready for telling Jekyll to generate our site:</p>
<pre>
  <code>
    $ jekyll
  </code>
</pre>
<p>If everything goes well, by now we should have our brand new Jekyll-powered blog generated on the <code>_site</code> directory.</p>
<p>We can also run Jekyll with the <code>--server</code> flag in order to test the generated site:</p>
<pre>
  <code>
    $ jekyll --server
  </code>
</pre>
<p>This flag tells Jekyll to launch a WEBrick server instance. Now we can point our web browser to <code>http://localhost:4000</code> and test the generated site locally.</p>
<h2>Publishing everything</h2>
<p>At this point, we can just ftp the contents of the <code>_site</code> directory to our web site and we&#8217;re done.</p>
<p>However, a much better solution would be to create a remote git repository and add some git hooks there that take care of generating the site for us each time we do a simple <code>git push</code>. That is exactly the setup I am using to maintain this blog, and I will be writing about it in a future post.</p>
<h2>Conclusion</h2>
<p>This solution is definitely not for everyone. But if you are a programmer, and especially if you spend most of your day working with a text editor and a terminal window opened, then you may find the combination of Jekyll, Git, and your editor of choice (vim, in my case, but Emacs, TextMate or any other would work just fine, of course) more appealing than any traditional blog software.</p>
<p>(Via <a href="http://matflores.com/">matflores.com</a>.) Original Link: <a href="http://matflores.com/2009/03/25/getting-started-with-jekyll.html">Getting started with Jekyll</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/03/25/getting-started-with-jekyll/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

