<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>The Vose Way: Tag Ruby</title>
    <link>http://www.chuckvose.com/articles/tag/ruby</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>A Blog about Butter, Cheese, and Ruby on Rails</description>
    <item>
      <title>Pagination, Sets, Checkboxes</title>
      <description>&lt;p&gt;When I was at RailsConf2008 I learned a lot about life and Rails but there were some nagging problems that lingered after me for a long time.&lt;/p&gt;


	&lt;p&gt;At one point in the talks there was a discussion of how to make listing pages have checkboxes and how to handle this data. The problem is complicated by pagination and filtering so it&amp;#8217;s actually a really good problem to talk about.&lt;/p&gt;


	&lt;p&gt;The proposed solution was to send back a structure that looked something like this:&lt;/p&gt;


&lt;pre&gt;
[{:id =&amp;gt; 1, :activated =&amp;gt; "+", :contact =&amp;gt; "-"}, ...]
&lt;/pre&gt;

	&lt;p&gt;At this point I was probably playing pogs in the audience with Ryan Schenk so the details are lost to time but the concept remains.&lt;/p&gt;


	&lt;p&gt;It seems needlessly complex though. A very interesting idea, no doubt about it, and it certainly has its merit but it seems very complex to me when we&amp;#8217;re talking about booleans. Also, I feel like it&amp;#8217;s worth mentioning that this method is much faster than the below method but somehow that doesn&amp;#8217;t turn me off that badly.&lt;/p&gt;


	&lt;p&gt;Instead of the above I took the already well accepted practice of using the check_box_tag in the view with the addition of a hidden field which would tell me which objects to care about:&lt;/p&gt;


&lt;pre&gt;
&amp;lt;% @users.each do |user| %&amp;gt;
  &amp;lt;%= hidden_field_tag('seen[]', user.id) -%&amp;gt;
  &amp;lt;%= check_box_tag 'activated[]', user.id -%&amp;gt;
&amp;lt;% end %&amp;gt;
&lt;/pre&gt;

	&lt;p&gt;In the controller it&amp;#8217;s as easy as loading up params[:seen] and loading each object:&lt;/p&gt;


&lt;pre&gt;
def index
  if request.post?
    activated_ids = params[:activated].collect {|id| id.to_i} if params[:activated]
    seen_ids = params[:seen].collect {|id| id.to_i} if params[:seen]

    if activated_ids
      seen_ids.each do |id|
        r = User.find_by_id(id)
        r.activated = activated_ids.include?(id)
        r.save
      end
    end
  end
end
&lt;/pre&gt;

	&lt;p&gt;So what I don&amp;#8217;t get is whether this is wrong on some moral stance or if I really didn&amp;#8217;t understand what the presenter was getting at. Yes, he loads and saves fewer objects, which could be important. But he also introduced what seems to me to be a lot of complexity into a fairly simple process.&lt;/p&gt;


	&lt;p&gt;At any rate, this code is here in case someone needs to find it until I find what the presenter was proposing. I seem to recall being impressed at the time so there must be something I&amp;#8217;ve forgotten.&lt;/p&gt;</description>
      <pubDate>Mon, 25 Aug 2008 15:29:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1f1a423f-d1ae-4d35-a981-25ca8ca91372</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2008/08/25/pagination-sets-checkboxes</link>
      <category>Ruby</category>
      <category>Rails</category>
      <category>Programming</category>
      <category>check_box</category>
      <category>check_box_tag</category>
      <category>Rails</category>
      <category>Ruby</category>
      <category>view</category>
      <category>list</category>
      <category>index</category>
      <category>pagination</category>
      <category>filter</category>
      <category>check</category>
      <category>boxes</category>
      <category>multiple</category>
    </item>
    <item>
      <title>RBridge 0.2</title>
      <description>&lt;p&gt;RBridge has undergone a lot of bug fixes and I think it&amp;#8217;s worthy of a 0.2 release at long last.&lt;/p&gt;


	&lt;p&gt;1 major enhancement&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Actually runs headless via the rulang command.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;3 minor enhancements&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Uses optparse for clearer command-line options.&lt;/li&gt;
		&lt;li&gt;Option to specify port, compile directory, mnesia directory, sname, and location of server file.&lt;/li&gt;
		&lt;li&gt;Some error checking, and debug output added. Checks to see if server is already running on specified port.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;You can check it out &lt;a href="http://ruby-mnesia.rubyforge.org"&gt;here&lt;/a&gt; or just &lt;i&gt;gem install rbridge&lt;/i&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 24 May 2008 02:12:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e486a1c7-eb55-4bb4-9de2-3f9b6b133a2e</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2008/05/24/rbridge-2-0</link>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>rbridge</category>
      <category>Ruby</category>
      <category>Erlang</category>
    </item>
    <item>
      <title>RBridge-0.1.2 Announcement</title>
      <description>&lt;p&gt;Just wanted to poke my head in and let people know that a new version of rbridge has been released. New to this revision is a few little tweaks and bug fixes but the main point is that you can install the gem and just type &amp;#8216;rulang&amp;#8217; from anywhere to start the erlang server. This enabled us to build a little test suite which should improve quality.&lt;/p&gt;


	&lt;p&gt;Also, the end of quarter summary has been posted per our class requirements:
&lt;a href="http://www.chuckvose.com/pages/eoq_review"&gt;Review&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 10 Mar 2008 16:20:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:38349606-a616-426e-a984-65dc6dbe962e</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2008/03/10/rbridge-0-1-2-announcement</link>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>rbridge</category>
      <category>release</category>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>announcement</category>
    </item>
    <item>
      <title>Concurrent code in Ruby 1.8.6 through inlining</title>
      <description>&lt;p&gt;&lt;strong&gt;Slight typo in the code fixed: 2008-01-08&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Toshiyuki and I have released a new gem called rbridge which allows us to execute functional, side-effect free, concurrent code directly in Ruby regardless of the version by using Erlang as a processor. This includes using the Mnesia distributed database and &lt;span class="caps"&gt;ETS&lt;/span&gt;/DETS.&lt;/p&gt;


	&lt;p&gt;To try it out please follow these steps:&lt;/p&gt;


	&lt;p&gt;1. Download Erlang for your os. Windows has binaries and &lt;span class="caps"&gt;OS X&lt;/span&gt; can be configured with `./configure&amp;#8212;prefix=/opt/local` to make MacParts happy. I haven&amp;#8217;t yet tried it with Linux but the default configure options should be okay.&lt;/p&gt;


	&lt;p&gt;2. Download the rbridge gem. `sudo gem install rbridge`&lt;/p&gt;


	&lt;p&gt;3. Start the rulang server in Erlang on port 9900. Change dir to the gem directory which is usually /usr/local/lib/ruby/gems/1.8/gems/rbridge-0.1/lib and run &lt;strong&gt;sudo erlc rulang.erl&lt;/strong&gt;. Enter the Erlang shell by typing &lt;strong&gt;erl&lt;/strong&gt;. Finally, start the server with &lt;strong&gt;rulang:start_server(9900).&lt;/strong&gt; (There&amp;#8217;s a dot at the end of the command).&lt;/p&gt;


	&lt;p&gt;4. Require rubygems and rbridge in your code and create a new connection to the rulang server. This is the simplest bit of inline code I can think of but there is a lot more we can do: asynchronous access and ruby-style syntax specifically.&lt;/p&gt;


&lt;pre&gt;
require 'rubygems'
require 'rbridge'

@r = RBridge.new(nil, 'localhost', 9900)

puts @r.erl('10*10.')
&lt;/pre&gt;

	&lt;p&gt;To read more check out the documentation on &lt;a href="http://ruby-mnesia.rubyforge.org"&gt;ruby-mnesia.rubyforge.org&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Aside:&lt;/strong&gt; Toshiyuki Hirooka found me. Thank you to everyone that helped search and offered to translate for us. I&amp;#8217;m constantly impressed by the support from the Ruby community.&lt;/p&gt;</description>
      <pubDate>Mon, 07 Jan 2008 13:11:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:dd7dc46a-8bfa-4828-bcc9-2136ee24bd1b</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2008/01/07/concurrent-code-in-ruby-1-8-6-through-inlining</link>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>rbridge</category>
      <category>rulang</category>
      <category>gems</category>
    </item>
    <item>
      <title>rbridge 0.1 Released</title>
      <description>&lt;by Chuck Vose (adapted from Toshi Hirooka's RulangBridge)&gt;
&lt;ruby-mnesia.rubyforge.org (originally http://code.google.com/p/rulangbridge/)&gt;

	&lt;h2&gt;&lt;span class="caps"&gt;FEATURES&lt;/span&gt;:&lt;/h2&gt;


	&lt;p&gt;Allows use of Erlang code within Ruby&lt;/p&gt;


	&lt;h2&gt;Changes:&lt;/h2&gt;


	&lt;p&gt;v0.1 / 2008-01-04 (vosechu)&lt;/p&gt;


	&lt;p&gt;1 major enhancement&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Allows many-lined Erlang commands when using the Erlang class for direct
  access.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;3 minor enhancements&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Revised error checking to allow custom resolution&lt;/li&gt;
		&lt;li&gt;stop_server/0 now shuts down any servers running in an erl shell&lt;/li&gt;
		&lt;li&gt;created tests to run with RSpec and autotest (erl server must be running 
  on port 9900).&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;3 other changes&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Forked onto rubyforge complete with rdocs, gem, etc.&lt;/li&gt;
		&lt;li&gt;Translated some comments into english as well as the &lt;span class="caps"&gt;README&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;Packaged explicitly with gpl documentation&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Fri, 04 Jan 2008 19:54:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:ab0f9ea2-e2fd-4b28-b073-6e4d661aa946</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2008/01/04/ann-rbridge-0-1-released</link>
      <category>Ruby</category>
      <category>Mnesia</category>
      <category>Erlang</category>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>rulang</category>
      <category>bridge</category>
    </item>
    <item>
      <title>Complex commands with Rulang</title>
      <description>&lt;p&gt;Rulang was giving me a lot of trouble with regards to multi-line commands and complex commands in general. After hacking on it for a while I&amp;#8217;ve developed a patch that will allow ruby code such as the following:&lt;/p&gt;


&lt;pre&gt;
require 'rulang'

@mnesia = RulangBridge::Erlang.new("localhost", 9900)

def find
  @mnesia.eval(&amp;lt;&amp;lt;-EOF
    QH = qlc:q([X || X &amp;lt;- mnesia:table(shop)]),
    F = fun() -&amp;gt; qlc:eval(QH) end,
    {atomic, Val} = mnesia:transaction(F),
    Val.
  EOF
  )
end

puts find
&lt;/pre&gt;

	&lt;p&gt;&lt;span class="caps"&gt;PATCH&lt;/span&gt;&lt;/p&gt;


&lt;pre&gt;
diff -u Desktop/rulangbridge/rulang.erl Current Schoolwork/Project/mnesia/rulang_test/rulang.erl
--- Desktop/rulangbridge/rulang.erl     2007-05-17 20:25:50.000000000 -0700
+++ Current Schoolwork/Project/mnesia/rulang_test/rulang.erl    2008-01-03 10:12:05.000000000 -0800
@@ -30,11 +30,15 @@
 handle_connection(Socket) -&amp;gt;
-       Reason = (catch communication(Socket)),
-       gen_tcp:send(Socket, io_lib:format("Error: ~w~n", [Reason])),
+       try communication(Socket)
+  catch
+    error:Reason -&amp;gt;
+         {gen_tcp:send(Socket, io_lib:format("Error: ~p~n", [Reason]))}
+  end,
        ok = gen_tcp:close(Socket).

+% Try to evaluate the code submitted throwing an exception if the evaluation
+% doesn't work. Return the code submitted.
 communication(Socket) -&amp;gt;
        {ok, Binary} = gen_tcp:recv(Socket, 0),
        {ok, Result} = eval(binary_to_list(Binary)),
@@ -43,9 +47,9 @@

 eval(Expression) -&amp;gt;
-       {ok, Scanned, _} = erl_scan:string(Expression),
-       {ok, [Parsed]} = erl_parse:parse_exprs(Scanned),
-       {value, Result, _} = erl_eval:expr(Parsed, []),
+       {done, {ok, Scanned, _}, _} = erl_scan:tokens([], Expression, 0),
+       {ok, Parsed} = erl_parse:parse_exprs(Scanned),
+       {value, Result, _} = erl_eval:exprs(Parsed, []),
        {ok, Result}.

diff -u Desktop/rulangbridge/rulang.rb Current Schoolwork/Project/mnesia/rulang_test/rulang.rb
--- Desktop/rulangbridge/rulang.rb      2007-05-24 10:42:22.000000000 -0700
+++ Current Schoolwork/Project/mnesia/rulang_test/rulang.rb     2008-01-03 10:02:19.000000000 -0800
@@ -79,7 +79,7 @@
                def eval(command)
                        socket = TCPSocket.new(@host, @port)
                        socket.write(command)
-                       socket.gets # ...?
+                       socket.read # ...?
                end
&lt;/pre&gt;</description>
      <pubDate>Thu, 03 Jan 2008 12:17:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:effba11d-9820-471e-8e22-476292ddacae</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2008/01/03/complex-commands-with-rulang</link>
      <category>Ruby</category>
      <category>Mnesia</category>
      <category>Erlang</category>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>Mnesia</category>
      <category>rulang</category>
    </item>
    <item>
      <title>Mnesia to ruby bridge evaluation</title>
      <description>&lt;p&gt;Owing to the complexities of building a Rails adapter for Mnesia I&amp;#8217;ve been looking into using a Ruby to Erlang bridge and have looked at the various projects that seem to be available and want to share my comments on how each is stacking up so far.&lt;/p&gt;


	&lt;h2&gt;Rebar&lt;/h2&gt;


	&lt;p&gt;&lt;a href="http://rubyisawesome.com/2007/4/30/calling-erlang-from-ruby-teaser"&gt;Rebar&lt;/a&gt; was announced on 2007-04-20 and has since never surfaced to the public as far as his blog and Google are concerned. The code looked to be among the easiest to understand but is thankfully very similar to the Japanese RulangBridge below. The existence of the Japanese project could explain why Tom Werner never finished the project but that&amp;#8217;s merely a guess.&lt;/p&gt;


	&lt;h2&gt;Erlectricity&lt;/h2&gt;


	&lt;p&gt;&lt;a href="http://nullstyle.com/2007/05/08/erlectricity-hi-ruby-im-erlang/"&gt;Erlectricity&lt;/a&gt; by Scott Fleckenstein was the first project I really tried out and I am impressed by some aspects and disappointed by others. On one hand it was easy to obtain being hosted on &lt;a href="https://rubyforge.org/projects/erlectricity/"&gt;RubyForge&lt;/a&gt; and &lt;a href="http://code.google.com/p/erlectricity/"&gt;Google Code&lt;/a&gt; and works well at using Ruby from Erlang. On the other hand it comes with no documentation or rdocs outside of two uncommented examples.&lt;/p&gt;


	&lt;p&gt;I could never figure out a way to get it to bridge Erlang commands from Ruby but there may be a way that I&amp;#8217;m missing; I have to admit I&amp;#8217;ve not asked Scott about whether this code can go both ways or not.&lt;/p&gt;


	&lt;p&gt;So if you need something that Ruby does well but Erlang doesn&amp;#8217;t then this may be your project. The second example uses the bridge to generate a gruff graph from Erlang which seems like it&amp;#8217;ll come in handy for a lot of people.&lt;/p&gt;


	&lt;p&gt;Outside of documentation I&amp;#8217;m concerned about whether the bridge can handle asynchronous requests from Erlang. From first glance it doesn&amp;#8217;t seem like there&amp;#8217;s any blocking and each Erlang thread calls the script directly instead of central blocking thread so I&amp;#8217;m guessing that there&amp;#8217;s no concurrency built in; something that we would have to work with if we were to use this bridge for a many-threaded project.&lt;/p&gt;


	&lt;h2&gt;RulangBridge&lt;/h2&gt;


	&lt;p&gt;&lt;a href="http://code.google.com/p/rulangbridge/"&gt;RulangBridge&lt;/a&gt; by Toshi Hirooka (?) is a Japanese project allowing Ruby to use Erlang functions. Google&amp;#8217;s translation allows us to read the usage instructions and browse the code which has allowed me to start using it in earnest to build the &lt;a href="http://www.chuckvose.com/articles/2007/12/22/mnesia-ruby-announcement"&gt;Ruby to Mnesia bridge&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;My first impressions are that the bridge is that it is a little immature despite the &amp;gt;1.0 release number. The example code is excellent (if in Japanese) but it isn&amp;#8217;t packaged in a gem or hosted on RubyForge and doesn&amp;#8217;t have a way to auto-start an Erlang server. Furthermore, using only the built in classes we have to make the choice of asynchronicity or complicated/multi-module code.&lt;/p&gt;


	&lt;p&gt;Of course the raw class (called Erlang) can be made asynchronous by wrapping it in a Thread.new which is essentially what the Rulang wrapper class does, but it would be nice to have this built-in. Putting the asynchronous switch in the wrapper class is fine but the wrapper class suffers from a desire to make the Erlang calls feel like ruby and therefore makes calling complicated code impossible through the wrapper and thus makes the asynchronous aspect moot also.&lt;/p&gt;


	&lt;p&gt;The last concern I have is that each class must connect to a node explicitly rather than being able to automatically find and balance between nodes. In order to be happy with the adapter we&amp;#8217;ll have to figure out how to load-balance or make Erlang do it for us.&lt;/p&gt;


	&lt;h2&gt;Conclusion&lt;/h2&gt;


	&lt;p&gt;For the purposes of the the Ruby to Mnesia Adapter I believe that RulangBridge will be sufficient but Erlectricity definitely has its purposes in the Erlang community. Despite some concerns and drawbacks both are usable code and could easily move forward with a little love from the community or follow-up versions by the owners.&lt;/p&gt;


	&lt;p&gt;Any project involving Erlang and Ruby will have to deal extensively with concurrency. Ideally it would be nice to see a broker model between the two that supports communication in both directions and deals with concurrency issues and load-balancing transparently. Until that happens we&amp;#8217;ll have to work with Erlectricity and Rulang and love the creators for their hard work.&lt;/p&gt;</description>
      <pubDate>Wed, 02 Jan 2008 17:25:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:50d75558-ef97-48fd-abdd-155d528c18d3</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2008/01/02/mnesia-to-ruby-bridge-evaluation</link>
      <category>Ruby</category>
      <category>Mnesia</category>
      <category>Programming</category>
      <category>Erlang</category>
      <category>Ruby</category>
      <category>Erlang</category>
      <category>bridge</category>
      <trackback:ping>http://www.chuckvose.com/articles/trackback/265</trackback:ping>
    </item>
    <item>
      <title>Mnesia + Ruby Announcement</title>
      <description>&lt;p&gt;My goal this year is to release a Ruby port of the Mnesia distributed database and hopefully start the process of moving to a true slice architecture. The port is an interesting project but I think the importance of the slice architecture is paramount.&lt;/p&gt;


	&lt;p&gt;For the last couple of years we&amp;#8217;ve been working on the n-tier model with ruby. It&amp;#8217;s well established and it has been working nicely for us. But the web server industry is starting to move more towards the idea of instances or clouds of ambiguous slices. Amazon is doing it, mongrel is a part of it certainly, Mnesia has always worked this way.&lt;/p&gt;


	&lt;p&gt;My hope is that my port will help us to create an &lt;span class="caps"&gt;EC2&lt;/span&gt; instance that is both the master of it&amp;#8217;s domain and a part of a cloud at the same time. I would like to see an &lt;span class="caps"&gt;EC2&lt;/span&gt; instance that can autoconfigure itself and automatically find its neighbors, which contains a complete Mnesia instance, a couple mongrels, and a proxy/load balancer.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m not sure if we can do this quite yet but multi-processor theory suggests that it can be done. Whether it&amp;#8217;s advantageous to remove all the bottle-necks and have to deal with the scheduling individually is where we&amp;#8217;ll have to analyze but I&amp;#8217;m confident that we are moving somewhere truly incredible.&lt;/p&gt;


	&lt;p&gt;In the future I hope to be able to drop in a new &lt;span class="caps"&gt;EC2&lt;/span&gt; and just have it completely figure things out for me. No more MySQL master, no more apache proxying. Whether we use my new port or SimpleDB is of no concern to me at all.&lt;/p&gt;</description>
      <pubDate>Sat, 22 Dec 2007 01:17:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:a94fd9ce-bee4-4caf-b059-6207e3dc5560</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2007/12/22/mnesia-ruby-announcement</link>
      <category>Ruby</category>
      <category>Mnesia</category>
      <category>Programming</category>
      <category>Erlang</category>
      <category>Mnesia</category>
      <category>Ruby</category>
      <category>Amazon</category>
      <category>EC2</category>
      <category>SimpleDB</category>
      <category>Erlang</category>
      <category>DDBMS</category>
      <category>Distributed</category>
    </item>
    <item>
      <title>Long Bets</title>
      <description>&lt;p&gt;&lt;a href="http://intertwingly.net"&gt;Sam Ruby&lt;/a&gt; occasionally does an article about his long bets and I really respect his ability to predict the future. &lt;a href="http://intertwingly.net/blog/2007/08/12/Long-Bets"&gt;This time&lt;/a&gt; I feel that he was focusing too close and forgot the long part of the &amp;#8216;long bet&amp;#8217;. &lt;span class="caps"&gt;REST&lt;/span&gt; is already important, and there are further developments in edge rails that make it even more important (active resource). MySQL is already a pain for scaling and the plugins are starting to come out but haven&amp;#8217;t really hit the fan yet.&lt;/p&gt;


	&lt;h3&gt;Bet One &amp;#8211; MySQL becomes the exception&lt;/h3&gt;


	&lt;p&gt;First, I think Sam Ruby is dead on about databases. Right now there are only a few things that are a consistent pain for deployment and scaling and databases are the top of the heap. I know there are things like MaxDB for mysql and there are ways to set up ring replication but it&amp;#8217;s hard; something that Ruby&amp;#8217;s community is really good at solving.&lt;/p&gt;


	&lt;p&gt;My first bet is that MySQL dies out for the rails community and something new pops in. It wouldn&amp;#8217;t surprise me if it was &lt;a href="http://www1.erlang.org/documentation/doc-5.0.1/lib/mnesia-3.9.2/doc/index.html"&gt;Mnesia&lt;/a&gt; from &lt;a href="http://www.erlang.se"&gt;Erlang/OTP&lt;/a&gt; or something involving &lt;a href="http://lucene.apache.org/hadoop/"&gt;Hadoop&lt;/a&gt; and &lt;a href="http://wiki.apache.org/lucene-hadoop/Hbase"&gt;HBase&lt;/a&gt;. It would surprise me if &lt;a href="http://www.couchdb.org"&gt;CouchDB&lt;/a&gt; popped onto the scene in a big way but it&amp;#8217;s the sort of thinking that could lead us somewhere interesting. The other option is that someone comes up with a really concrete stack of abstractions that makes it easy to balance mysql requests and writes.&lt;/p&gt;


	&lt;h3&gt;Bet Two &amp;#8211; Rails drops &lt;span class="caps"&gt;REST&lt;/span&gt; completely&lt;/h3&gt;


	&lt;p&gt;Secondly, I think &lt;span class="caps"&gt;REST&lt;/span&gt; is the wrong way to move forward. &lt;span class="caps"&gt;REST&lt;/span&gt; maps very well onto the &lt;span class="caps"&gt;CRUD&lt;/span&gt; principles, but I feel like we very rarely actually use just &lt;span class="caps"&gt;CRUD&lt;/span&gt;. More often than not I want to run custom little things and create crazy associations. And I realize that this is all possible in the &lt;span class="caps"&gt;REST&lt;/span&gt; model, but it makes the controllers obscene sometimes.&lt;/p&gt;


	&lt;p&gt;What we really want is Query Language for the Internet and what better language to build that in than Ruby. I&amp;#8217;ve seen &lt;span class="caps"&gt;DSL&lt;/span&gt;&amp;#8217;s for direct database access and it seems like the routes would be just around the corner if this is where we decide to take it.&lt;/p&gt;


	&lt;p&gt;The question is whether &lt;span class="caps"&gt;DHH&lt;/span&gt; sees the writing on the wall or desperately wants to hang on to &lt;span class="caps"&gt;REST&lt;/span&gt;. Since he&amp;#8217;s put so much effort into the &lt;span class="caps"&gt;REST&lt;/span&gt; idea it seems like he would be loath to drop it, but at the same time he&amp;#8217;s an incredibly mature developer and would hopefully handle a change like this if it ever happened.&lt;/p&gt;


	&lt;h3&gt;Conclusion&lt;/h3&gt;


	&lt;p&gt;All respect to Sam Ruby, I really do respect his predictions over my own. But I think his predictions are too close to us right now. I would like to know what happens after &lt;span class="caps"&gt;REST&lt;/span&gt; and what happens in the database arena.&lt;/p&gt;</description>
      <pubDate>Tue, 11 Sep 2007 23:42:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:048e70f7-20cc-49ba-aac8-3d4bd0f2e433</guid>
      <author>vosechu@create-on.com (Chuck Vose)</author>
      <link>http://www.chuckvose.com/articles/2007/09/11/long-bets</link>
      <category>Rails</category>
      <category>MySQL</category>
      <category>Programming</category>
      <category>REST</category>
      <category>MySQL</category>
      <category>Rails</category>
      <category>Future</category>
      <category>Ruby</category>
      <category>Scaling</category>
      <category>Bets</category>
      <category>Hadoop</category>
      <category>HBase</category>
      <category>Mnesia</category>
      <category>Erlang</category>
      <category>CouchDB</category>
    </item>
  </channel>
</rss>
