Wednesday, April 30, 2008

Rails 2.0.2 running on Ruby 1.9

There are many exciting happenings in the Ruby world. It will be interesting to take some of it in at the end of the month at RailsConf in Portland.

There's an eye on the future with Rubinius which is incredibly exciting and promising -- you should take a look too, and at least understand that team's ambitious and very worthy goal. You've probably read the recent happenings here and here -- its great to see all the low-level discussions being bubbled up, and especially great to see the endeavors or running Ruby 'everywhere' being pursued. My personal summarized commentary: the JVM is a great piece of architecture, but i and many others want the opportunity someday to hack the the VM with Ruby, not C nor Java. It's as simple as that.

Meanwhile though, and the point of this post, is while we all have an eye on the future, don't forget about the present. I am most looking forward to Rails running on top of Ruby 1.9 (YARV). The benchmarks I have seen and fiddled with myself show a significant performance boost!

Now... when will Rails run on top of Ruby 1.9?

Thursday, April 17, 2008

Amazon MP3 Music Downloads - DRM free

Heard about this yesterday in my weekly Ruby class … looked into it last night… Amazon’s music service

http://www.amazon.com/MP3-Music-Download/b?ie=UTF8&node=163856011

http://www.amazon.com/gp/dmusic/help/faq.html/ref=sv_dmusic_0

better than iTunes -- DRM free .mp3’s. Copy and play with impunity once you buy. As many computers as you want. Unlike iTunes which has the 5 computer limit (lame). Amazon also has a little downloader that automatically sucks the .mp3 files into your iTunes so you can still organize and play the files via iTunes like you’re used to, still put them on your iPod, etc etc. (it even includes the cover art in your iTunes). They did a great job.

Killer app and model. Hat’s off to them, well done. This is what people want. DRM-free. I’m in.

“Songs from Amazon MP3 can be played on any MP3-capable device, including iPods™, Zunes™, Zens™, iPhones™, RAZRs™, and BlackBerrys™. Our files are free of digital rights management (DRM) software, so you can burn your songs to CDs, play them on all your computers, and transfer them to all your devices. Songs are encoded at 256 kbps (learn more), which means you get high audio quality at a manageable file size.”

Friday, April 11, 2008

Another Good Reason to Learn Python in 2008/2009

Per the Pragmatic Programmer directive, I've been learning a language a year for the last couple of years... Python is very likely the next language I grok:

http://googleappengine.blogspot.com/2008/04/introducing-google-app-engine-our-new.html

At the same time though, I am focused on Ruby development still now. My goals are to master building and deploy highly scalable Ruby-based web apps in Rails, Merb... on top of Mongrel, Nginx... on the cloud.

Hopefully Google will support Ruby's open source efforts and help push that direction too, with additional languages on their innovative AppEngine.

Tuesday, April 08, 2008

RubyConf 2007

http://rubyconf2007.confreaks.com/

Rubini.us 1.0, 2.0 and native threads

Listening to the Ruby on Rails podcast... Rubinius developers have already demonstrated native threads running. Not only that, each Rubinius VM you spawn can have green threads. First preview of 1.0 release of Rubinius (running Ruby 1.8) will be May 15th. Right around the corner. 1.0 will not includethe native threads, but they are planned for 2.0 release of Rubinius. Likewise, Ruby 2.0 with YARV is planning native threads as well.

On top of that, Mentalguy is building an Actors library on top of Rubinius' capability to run native threads (Omnibus?). So very soon, Ruby will have a VM (written almost entirely in Ruby! with a small amount of C primitives = Rubinius)... that will enable native threads. Imagine the potential this has to reduce the memory footprint for Rails.

In addition, Merb (Mongrel + erb) has gained a lot of momentum as an option along with Rails.

Both Rubinius and Merb are both open source, but are funded by Engine Yard (Engine Yard has 5 full time developers working on Rubinius, for instance,... and Ezra Zygmuntowitz, the founder, is the creator of Merb)

great to see a lot of momentum for Ruby community...

From the Rubini.us website:


Concurrency

Rubinius provides a number of concurrency techniques, significantly expanding upon that available in standard Ruby. As such, use of these additional primitives is non-standard.

Note: Currently, Rubinius achieves concurrency through the use of green-threads. Native thread support is not implemented at present, although it is planned for the 2.0 release of Rubinius, and Shotgun has been constructed with thread-safety in mind.

Tasks

Tasks are the foundation of green threads in Rubinius. See here for an overview of Rubinius tasks.

Threads

Channels

Channels provide a simple mechanism for coordinating the work of two or more threads. A channel resembles a queue, in that producer thread(s) can write to the channel, while consumer thread(s) read from it. If there is no data currently in the channel, consumer threads will suspend until data is available.

Actors

The Actor class provides an implementation of the Actor concurrency pattern. Actor instances are threads that can be given work to do via message objects. Actor instances process messages according to filters, deciding what to do based on the type of message to be processed (where comparison of message types uses the same comparison logic as case, namely ===).

Unlike Channels, the read end of an Actor is fixed (to the thread owned by the Actor), and the Actor can prioritise handling of messages, and even postpone processing of messages for which no filter has yet been defined.

Actor.receive do |filter|
filter.when SomeMessageClass do |message|
# handle message
end
filter.when OtherMessageClass do |message|
# handle message
end
end

Rubinius 1.0 Preview - May 15th

...can't wait for this. Rubinius 1.0 Preview is, according to the following, expected on May 15th:
http://rubinius.lighthouseapp.com/projects/5089/getting-started

Saturday, April 05, 2008

schedule at RailsConf 2008

Today I am going through the program and session information at RailsConf and figuring out what I'll be attending Thurs, Fri, Sat, Sun, May 29 thru June 1st.

Thurs:
7:30 a.m : Continental Breakfast - Exhibit Hall E
8:30am-12:00pm - Design for Developers - A Hands-On Workshop
1:30-5:00pm - Powering AIR Applications with Rails
7:30pm - ? - Birds of a feather sessions

Fri:
8:00 a.m.: Continental Breakfast - Exhibit Hall E
9:00 -10:15am - Plenary TBC
10:45-11:35am (BR: 251) - Entrepreneurs On Rails (Dan Benjamin, Rails Machine)
alternate: (BR: 252) IronRuby on Rails (John Lam)

11:45-12:35pm (BR: 255) - Hosting and the Woes (Ezra Zygmuntowicz, et al)
alt: (BR: 256) - Faster, Better, ORM with DataMapper (Yehuda Katz)

1:50-2:40pm (BR:255) - Facebook Development and Performance with Rails (Mike Mangino)
alt: (BR:252) - CRUD doesn't have an 'S' in it: Managing complex searching in Rails

2:50-3:40pm (BR:255) - The Profitable Programmer: Creating Successful Side Projects (Geoff Grosenbach of the Seattle.rb!, et al)
alt: (BR:252) - Design Patterns in Ruby (Neal Ford)

4:25-5:15 (BR:255) - Custom Nginx Modules: Accelerate Rails, HTTP Tricks
alt: (BR: 256) - UI Design on Rails (Ryan Singer)

SATURDAY

8:00 a.m.: Continental Breakfast - Exhibit Hall E
9:00 -10:15am - Keynote

10:45-11:35am (BR:252) - Using Git to Manage and Deploy Rails Apps (Scott Chacon)
atl: (BR:251) - Optimizing Rails (Koziarski)

11:45-12:35pm (BR: 252) - Advanced RESTful Rails (Ben Scofield)
alt: (BR:251) - Scaling Rails

1:50-2:40pm (BR:252) - Fast, Sexy, and Svelte: Our Kind of Rails Testing (Thoughtworks)
alt: (BR:251) - Build Your Own Distributed, Self-Configuring Rails Cluster

2:50-3:40pm (BR:251) - Flexible Scaling: How to Handle 1 Billion PageViews (Murphy)
alt: (BR:252) - Integration Testing with RSpec's Stor Runner (Chelimsky)

4:25-5:15pm (BR:252) - The Great Test Framework Dance-Off (Susser)
alt: (BR: ) - Metaprogramming and Ruby Internals for Rails Programmers (Farley)

7:30pm - ? - Birds of a feather sessions

SUNDAY

8:00 a.m.: Continental Breakfast - Exhibit Hall E
9:00 -10:15am - Keynote

10:45-11:35am (BR: 252) - Scaling Ruby from the Inside Out (Zygmuntowicz)
alt: (BR: 256) - Advanced Mongrel: Handlers and Plugins (Lindenbaum)

11:45-12:35pm (BR: 251) - Everyday DTrace on OSX: A Guide to Using DTRace for your full Application Stack (Barron, Humphrise)
alt: (BR:252) - Genomes on Rails (Wood)

1:50-2:40pm (BR:252 ) - Advanced Active Record Techniques: Best Practice Refactoring (Chad Pytel)
alt: (BR: 256) - ActiveRecord Associations and the Proxy Pattern

Tuesday, April 01, 2008

Corwin Brown's great attitude

…I love this attitude. Corwin Brown was discussing the Notre Dame defense here, but it also applies to anything you do, including application architectures and writing applications:

Brown intends on not wasting any time this spring working with his young defense. “You can’t afford to waste days or waste time,” Brown said. “It’s one of those deals where every time you’re out there are certain things that you try to get accomplished. When you don’t get accomplished what you set out, you can’t get that day back.”

Rack :: A Ruby Webserver Interface

Over on the Ruby-lang list, there was a discussion which pointed me to Rack. Check it out:

Rack provides an minimal interface between webservers supporting Ruby and Ruby frameworks.
  • super simple API for writing web apps
  • single API to connect to mongrel, fast-cgi, webrick
  • based on python’s WSGI, which was a good thing for python

Found this intriguing...
  • using the mongrel handler we can get crazy concurrency
  • let’s have a look at this, using ab
    • %w(rubygems rack).each { |dep| require dep }
      app = lambda { |env| sleep(5); [200, {}, 'Oi!'] }
      Rack::Handler::Mongrel.run(app, :Port => 3000)
    • ab -c 100 -n 300 http://0.0.0.0:3000/
    • Benchmarking 0.0.0.0 (be patient)
      Completed 100 requests
      Completed 200 requests
      Finished 300 requests
      Concurrency Level: 100
      Time taken for tests: 15.232 seconds
      Complete requests: 300
      Failed requests: 0

http://rack.rubyforge.org/

http://macournoyer.wordpress.com/2007/12/14/rack-the-framework-framework/

http://yeahnah.org/files/rack-presentation-oct-07.pdf

Semantic blog post by Tim Berners Lee

Nice article by Tim Berners Lee's blog related to his thoughts on the recent Time's article. Insightful blog to read if you're interested in moving forward on this topic.
http://dig.csail.mit.edu/breadcrumbs/node/232