Concurrent code in Ruby 1.8.6 through inlining

Posted by Chuck Vose Mon, 07 Jan 2008 18:11:00 GMT

Slight typo in the code fixed: 2008-01-08

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 ETS/DETS.

To try it out please follow these steps:

1. Download Erlang for your os. Windows has binaries and OS X can be configured with `./configure—prefix=/opt/local` to make MacParts happy. I haven’t yet tried it with Linux but the default configure options should be okay.

2. Download the rbridge gem. `sudo gem install rbridge`

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 sudo erlc rulang.erl. Enter the Erlang shell by typing erl. Finally, start the server with rulang:start_server(9900). (There’s a dot at the end of the command).

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.

require 'rubygems'
require 'rbridge'

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

puts @r.erl('10*10.')

To read more check out the documentation on ruby-mnesia.rubyforge.org.

Aside: Toshiyuki Hirooka found me. Thank you to everyone that helped search and offered to translate for us. I’m constantly impressed by the support from the Ruby community.

Posted in ,  | Tags , , , ,  | 19 comments

Comments

  1. Avatar coupon codes said over 3 years later:

    This is produced by the sun enough vitamin D for a week in the body. It may be that the children get the whole day just to drink too little, then it can be a problem if they get just before the meal thirst. This one has good health, you need good, healthy food, good digestion, good elimination.

  2. Avatar knock off watches said over 3 years later:

    the whole day just to drink too little, then it can be a problem if they get just before the meal thirst. Th

  3. Avatar mma fight gear said over 3 years later:

    I found this website very interesting and the post content the good updated information thanks a lot.

  4. Avatar Pittsburgh events said over 3 years later:

    I am absolutely amazed at how terrific the stuff is on this site. I have saved this webpage and I truly intend on visiting the site in the upcoming days. Keep up the excellent work!

  5. Avatar skin tag removal at home said over 3 years later:

    Good post thanks for the help .i was searching for this….

  6. Avatar car rental india said over 3 years later:

    Thanks dude, this is absolutely fantastic post…. I like it

  7. Avatar tiffany and co outlet said over 3 years later:

    I am profoundly grateful, touched by the great distinction and honor and great compliment accorded me by the

    authorities of Harvard this morning. I am overwhelmed, as a matter of fact, and I am rather fearful of my inability

    to maintain such a high rating as you’ve been generous enough to accord to me. In these historic and lovely

    surroundings, this perfect day, and this very wonderful assembly, it is a tremendously impressive thing to an

    individual in my position.tiffany and co outlet

  8. Avatar http://www.tiffanyandcoonline.com/ said over 3 years later:

    These shoes are awesome! They are light weight and super comfortable.I am http://www.tiffanyandcoonline.com/">Tiffany And Co Outlet lover

  9. Avatar online marketing said over 3 years later:

    I love what you guys tend to be up too. This kind of clever work and reporting! Keep up the wonderful works guys I’ve you guys to our blog roll.

  10. Avatar superdry uk said over 4 years later:

    authorities of Harvard this morning. I am overwhelmed, as a matter of fact, and I am rather fearful of my inability

  11. Avatar christian louboutin said over 4 years later:

    christian louboutin

  12. Avatar ralph lauren said over 4 years later:

    ralph lauren cai bu guan ni

  13. Avatar red bottoms said over 4 years later:

    red bottoms

  14. Avatar term paper said over 4 years later:

    Not actually in the mood to write anything. It’s the southern summer humidity getting to my brain. Congratulation to both nominees and winners.

  15. Avatar lacoste uk said over 4 years later:

    This kind of clever work and reporting! Keep up the wonderful works guys I’ve you guys to our blog roll.

  16. Avatar superdry uk said over 4 years later:

    to maintain such a high rating as you’ve been generous enough to accord to me. In these historic and lovely

  17. Avatar tiffany uk sale said over 4 years later:

    tiffany uk sale

  18. Avatar lacoste outlet said over 4 years later:

    I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

  19. Avatar cribbble said over 4 years later:

    cribbble

    USKO is the globalized version of the game; the developers sign contracts with publishing houses, like K2/G1, who distribute the game to a larger audience on behalf of the developers. There was no purchase and K2/G1 does not hold any ownership of Knight Online.

(leave url/email »)

   Comment Markup Help Preview comment