ID | Name | Birthdate | |
---|---|---|---|
1 | Jesse Cooke | 9/28/1981 | jesse@jc00ke.com |
2 | Jon Doe | 6/23/1972 | jon@doe.name |
Widget.find_by_name("foo")
# or
User.create({ email: "foo@bar.com" })
select * from widgets where name = 'foo';
# or
insert into users...
class Post < ActiveRecord::Base
end
The future of Ruby is here, it’s just that we have it over in the Smalltalk world and you guys should come and get it.
GemStone/S is the state-of-the-art platform for developing, deploying, and managing scalable, high-performance, multi-tier applications based on business objects.
How much do you think about saving your data instead of using it?
I've often wished that I could just do something where I just change a bunch of models and at the end of the request cycle something magical goes through and collects up all the models that have changed and persists them, and I haven't really gotten to that level yet. Sometimes I feel that ActiveRecord is holding me back from that.
Avdi Grimm
You can just switch to Java, or .NET.
David Laribee
Maglev::PERSISTENT_ROOT
# VM #1
Maglev.abort_transaction
j = Rubyist.new("Jesse")
j.object_id
# => 1234567
Maglev::PERSISTENT_ROOT[:jesse] = j
Maglev.commit_transaction
# VM #2
Maglev.abort_transaction
Maglev::PERSISTENT_ROOT[:jesse].object_id
# => 1234567
Maglev.abort_transaction
Maglev.commit_transaction
# VM #1
Maglev.abort_transaction
cats = CatCollection.new
pierre = Cat.new("Pierre")
cats << pierre
Maglev::PERSISTENT_ROOT[:cats] = cats
Maglev.commit_transaction
pierre.object_id
# => 9876543
# VM #2
Maglev.abort_transaction
persisted_cats = Maglev::PERSISTENT_ROOT[:cats]
persisted_cats.first.object_id
# => 9876543
# VM #3
Maglev.abort_transaction
pierre = Maglev::PERSISTENT_ROOT[:cats].first
pierre.favorite_toy = BallOfYarn.new
Maglev.commit_transaction
# VM #4
Maglev.abort_transaction
Maglev::PERSISTENT_ROOT[:cats].first.favorite_toy
# => #<BallOfYarn:123987>
Arrays
Sets
Hashes
Counters
Sorted Sets
Leftist Tree
class MaglevBlogApp < Sinatra::Application
set :root, File.dirname(__FILE__)
before do
@blog = Maglev::PERSISTENT_ROOT[:maglev_blogs].first
@posts = @blog.posts
end
get "/" do
erb :index
end
end
class MaglevBlogApp < Sinatra::Application
# ...
get "/posts/:id" do
@post = @posts.detect { |post|
post.object_id == params[:id].to_i
}
erb :post
end
end
class MaglevBlogApp < Sinatra::Application
# ...
post "/post" do
post = @posts.class.new(params[:title], params[:body])
@blog.posts << post
redirect "/"
end
end
class MagLevTransactionWrapper
def initialize(app); @app = app; end
def call(env)
begin
Maglev.abort_transaction
status, headers, body = @app.call env
[status, headers, body]
ensure
if committable? status
Maglev.commit_transaction
else
Maglev.abort_transaction
end
end
end
end
class MaglevBlog
attr_accessor :posts, :name, :author
def initialize(name, author_name)
@posts = []
@name = name
@author = Author.new(author_name)
end
# ...
end
class MaglevBlog
# ...
class Post
attr_accessor :title, :body
def initialize(title, body)
@title = title
@body = body
end
end
# ...
end
class MaglevBlog
# ...
class Author
attr_accessor :name
def initialize(name)
@name = name
end
end
end
# bootstrap.rb
Maglev.persistent do
load "maglev_blog.rb"
blog = MaglevBlog.new("Cascadia Ruby!", "jc00ke")
Maglev::PERSISTENT_ROOT[:maglev_blogs] = [blog]
end
maglev-ruby -Mcommit bootstrap.rb
# pseudo
jobs = []
jobs << Proc.new { puts "doing work" }
jobs.shift.call
Maglev.abort_transaction
Maglev::PERSISTENT_ROOT[:q] ||= []
while true do
Maglev::PERSISTENT_ROOT[:q] << Proc.new { puts "doing work" }
Maglev.commit_transaction
end
while true do
Maglev.abort_transaction
work = Maglev::PERSISTENT_ROOT[:q].shift
Maglev.commit_transaction
work.call if work
end
Maglev.abort_transaction
Maglev::PERSISTENT_ROOT[:q] ||= []
while true do
Maglev::PERSISTENT_ROOT[:q] << Proc.new { puts "doing work" }
Maglev.commit_transaction
rescue Maglev::CommitFailedException
puts "Couldn't add the job. Retrying..."
redo
end
while true do
Maglev.abort_transaction
work = Maglev::PERSISTENT_ROOT[:q].shift
Maglev.commit_transaction
work.call if work
rescue Maglev::CommitFailedException
puts "Someone grabbed this job before me. Go grab another."
redo
end
require 'maglev/rcqueue'
Maglev.abort_transaction
Maglev::PERSISTENT_ROOT[:q] ||= RCQueue.new
while true do
Maglev::PERSISTENT_ROOT[:q] << Proc.new { puts "doing work" }
Maglev.commit_transaction
rescue Maglev::CommitFailedException
puts "Couldn't add the job. Retrying..."
redo
end
Totals grouped by language (dominant language first): ruby: 34 (100.00%) Total Physical Source Lines of Code (SLOC) = 34 Development Effort Estimate, Person-Months = 0.07 Schedule Estimate, Months = 0.90 Estimated Average Number of Developers (Effort/Schedule) = 0.08 Total Estimated Cost to Develop = $ 776 (average salary = $56,286/year, overhead = 2.40).
Generated using David A. Wheeler's 'SLOCCount'
rvm install maglev
ruby-build install maglev-1.1.0-dev
./install.sh
jesse [at] jc00ke.com
Created by Hakim El Hattab / @hakimel
Reveal.js comes with a few themes built in:
Solarized
* Theme demos are loaded after the presentation which leads to flicker. In production you should load your theme in the <head>
using a <link>
.
function linkify( selector ) {
if( supports3DTransforms ) {
var nodes = document.querySelectorAll( selector );
for( var i = 0, len = nodes.length; i < len; i++ ) {
var node = nodes[i];
if( !node.className ) {
node.className += ' roll';
}
}
}
}
Courtesy of highlight.js.