<?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>DEV_MEM.dump_to(:blog) - Multimedia systems blog &#187; Tutorial</title>
	<atom:link href="http://blog.mmediasys.com/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mmediasys.com</link>
	<description>Compartiendo fragmentos de código con el mundo.</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:32:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RubyInstaller: Getting Started with Rails and MySQL</title>
		<link>http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/</link>
		<comments>http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 22:48:24 +0000</pubDate>
		<dc:creator>Luis</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Windows]]></category>

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

Update: Gems are not officially released, no need to add --source anymore.
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 [...]]]></description>
			<content:encoded><![CDATA[<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>
<p><strong>Update:</strong> Gems are not officially released, no need to add <code>--source</code> anymore.</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</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>ruby script\about</pre>
<p>And you should see something like this as result:</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>
]]></content:encoded>
			<wfw:commentRss>http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>RubyInstaller: Getting Started with Rails and SQLite3</title>
		<link>http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/</link>
		<comments>http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 20:09:20 +0000</pubDate>
		<dc:creator>Luis</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.mmediasys.com/?p=233</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

Update: Gems are not officially released, no need to add --source anymore.
First, Getting Ruby
Please download from here one of the preview1 installers for Ruby.
For this demonstration, I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<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>
<p><strong>Update:</strong> Gems are not officially released, no need to add <code>--source</code> anymore.</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</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>
]]></content:encoded>
			<wfw:commentRss>http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
