Similar documents

RubyKaigi2009 COBOL

Rinda, druby answering the RubyConf, RubyKaigi Masatoshi SEKI

BASIC / / BA- SIC Web 1/10 1/10 / / JavaScript


Ruby演習テキスト1

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

Kyosuke MOROHASHI

Microsoft PowerPoint - ruby_instruction.ppt

untitled

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

r1.dvi

listings-ext

parser.y 3. node.rb 4. CD-ROM

Condition DAQ condition condition 2 3 XML key value

Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

Ruby 50 Ruby UTF print, \n [Ruby-1] print("hello, Ruby.\n") [Ruby-2] Hello, Ruby. [Ruby-3] print("hello, \"Ruby\".\n") 2 [Ruby-4] seisuu = 10 pr

PowerPoint Presentation

Ruby Ruby ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( ) 44=>

Microsoft PowerPoint - 11RubyIntro-No02.ppt [互換モード]

Emacs Ruby..

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

K227 Java 2

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè3²ó

Java updated

つくって学ぶプログラミング言語 RubyによるScheme処理系の実装

CAS Yale Open Source software Authentication Authorization (nu-cas) Backend Database Authentication Authorization Powered by A

A B 1: Ex. MPICH-G2 C.f. NXProxy [Tanaka] 2:

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè1²ó

fp.gby

Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo if 11 for 11 range 12 break continue 13 pass

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

comp -MYPEDIA Programing- Ruby 1 attr_accessor :< 1>, :< 2> class Car def = carname end attr_accessor :name end car = Car.ne

Sequel のすすめ 私が SQL を嫌いな理由 とみたまさひろ RubyHiroba Sequel のすすめ - 私が SQL を嫌いな理由 Powered by Rabbit 2.0.7

Networking Semester 802.3

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè1²ó

tuat1.dvi

10 (1) s 10.2 rails c Rails 7 > item = PlanItem.new => #<PlanItem id nil, name nil,...> > item.name = "" => "" > item.valid? => true valid? true false

javascript key

Java学習教材

ストラドプロシージャの呼び出し方

̤Äê


s

ohp1.dvi

Ruby 2.3 のてざわり新機能と使いどころ Kunihiko Ito ESM 富山合同勉強会

untitled

1. COBOL COBOL COBOL COBOL 2

2. 2 (LAN) Web 7 2 DBMS Java Applet 2.1 Java RDBMS Java 1 Lisp S S Common Lisp Java DBMS 2.2 DBMS RDBMS(Oracle) Java BLOB(Binary Large OBject) RDBMS R

PowerPoint Presentation

Java演習(4) -- 変数と型 --

ruby novice ruby novice ruby novice.


Oracle9i JDeveloperによるWebサービスの構築

untitled

*.....J.....S.q..2013B_....

For_Beginners_CAPL.indd

fiš„v3.dvi

1 VisBAR edu H 2 O.....

r03.dvi

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

Q&A集

…l…b…g…‘†[…N…v…“…O…›…~…fi…OfiÁŸ_

データベース認識Webサービス

ETL Webinar

r9.dvi

8 if switch for while do while 2

ohp03.dvi

r2.dvi

23 Study on Generation of Sudoku Problems with Fewer Clues

Hadoop Introduction

メタコンピュータ構成方式の研究

Sinatra と MongoDB 今回は Sinatra で MongoDB の操作を体験してみます 進捗に合わせて ドライバから Ruby で使える便利な ORM の紹介をします


1 Ex Ex. 2 2

untitled

Microsoft PowerPoint - 13Kadai.pptx

CAC

~~~~~~~~~~~~~~~~~~ wait Call CPU time 1, latch: library cache 7, latch: library cache lock 4, job scheduler co

r08.dvi

bdd.gby

第5回お試しアカウント付き並列プログラミング講習会

Spring Framework 2.0  デファクトスタンダードDIコンテナの現在と未来

jssst-ocaml.mgp

Copyright c 2008 Zhenjiang Hu, All Right Reserved.

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Vol. 29 No. 2 May Wiki ML Wiki qwikweb ML foobar foobar@qwik.jp ML Wiki Wiki 1 qwikweb Wiki Wiki ML Wiki ML Wiki Wik

9iAS_DEV.PDF

ohp08.dvi

Python Speed Learning

OSS JobScheduler openqrm Hadoop XtreemFS Ceph, Fabric etc. 2013/12/9 OSS X Users Meeting #5 OpenStack 2

Gray [6] cross tabulation CUBE, ROLL UP Johnson [7] pivoting SQL 3. SuperSQL SuperSQL SuperSQL SQL [1] [2] SQL SELECT GENERATE <media> <TFE> GENER- AT

: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp

e10s におけるプロセス間通信の基本 219 HACK #34 Components.manager.removeBootstrappedManifestLocati on() function shutdown(adata, areason) { const IOService =

haskell.gby

Parametric Polymorphism

Transcription:

3360 druby Web

Who is translating it?

http://dx.doi.org/10.1007/s10766-008-0086-1

$32.00 International Journal of PARALLEL PROGRAMING Must buy!

http://dx.doi.org/10.1007/s10766-008-0086-1

toruby LT

Linux Conference 2000 fall Perl/Ruby Conference 2000.11.29-12/1

Hello, Again. Ruby 01

Remote Method Invocation Remote Procedure Call

Web Service XML-RPC

shttpsrv shttpsrv UI shttpsrv user

druby RMI RMI, RPC

druby druby Ruby RMI RMI Ruby

druby Ruby

(2) Object

(3) Object Object

def hoge(a1, a2, a3, &block)... raise FooError unless some_cond... return value

Marshal dumpable Number, String, Boolean... can t dump Proc, Thread, File... pass by value pass by reference

irb % irb --simple-prompt --noreadline % irb --simple-prompt --noreadline

DRb.start_service >> require drb/drb >> DRb.start_service =>...

front >> require drb/drb >> front = {} >> DRb.start_service('druby://localhost:12345', front)

DRbObject >> ro = DRbObject.new_with_uri('druby://localhost:12345') => #<DRb::DRbObject:0x...> >> ro.keys => [] >> ro.class => DRb::DRbObject >> ENV.each { k, v ro[k] = v} => {...} >> ro.keys => ["MANPATH", "CVS_RSH", "USER",...]

DRbObject >> ro = DRbObject.new_with_uri('druby://localhost:12345') => #<DRb::DRbObject:0x...> >> ro.keys => [] >> ro.class => DRb::DRbObject >> ENV.each { k, v ro[k] = v} => {...} >> ro.keys => ["MANPATH", "CVS_RSH", "USER",...]

DRbObject >> ro = DRbObject.new_with_uri('druby://localhost:12345') => #<DRb::DRbObject:0x...> >> ro.keys => [] >> ro.class => DRb::DRbObject >> ENV.each { k, v ro[k] = v} => {...} >> ro.keys => ["MANPATH", "CVS_RSH", "USER",...]

>> front.keys => ["MANPATH", "CVS_RSH", "USER",...]

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

SizedQueue server require 'thread' require 'drb/drb' queue = SizedQueue.new(10) DRb.start_service('druby://localhost:12345', queue) sleep

Producer require 'drb/drb' DRb.start_service queue = DRbObject.new_with_uri('druby://localhost:12345') 100.times do n sleep(rand) queue.push(n)

Consumer require 'drb/drb' DRb.start_service queue = DRbObject.new_with_uri('druby://localhost:12345') 100.times do sleep(rand) puts queue.pop

DRbObject class DRbObject def initialize(obj, uri=nil) @uri = uri DRb.uri @ref = obj.id if obj def method_missing(msg_id, *a) succ, result = DRbConn.new(@uri).s_message(self, msg_id, *a) raise result if! succ result attr :ref

DRbObject URI ref

method_missing class DRbObject def initialize(obj, uri=nil) @uri = uri DRb.uri @ref = obj.id if obj def method_missing(msg_id, *a) succ, result = DRbConn.new(@uri).s_message(self, msg_id, *a) raise result if! succ result attr :ref

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front result = obj. s (msg.intern, *argv) succ = true rescue result = $! succ = false s_reply(s, succ, result) ensure close s if s

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front result = obj. s (msg.intern, *argv) succ = true rescue result = $! succ = false s_reply(s, succ, result) ensure close s if s

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front result = obj. s (msg.intern, *argv) succ = true rescue result = $! succ = false s_reply(s, succ, result) ensure close s if s

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front result = obj. s (msg.intern, *argv) succ = true rescue result = $! succ = false s_reply(s, succ, result) ensure close s if s

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front result = obj. s (msg.intern, *argv) succ = true rescue result = $! succ = false s_reply(s, succ, result) ensure close s if s

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front result = obj. s (msg.intern, *argv) succ = true rescue result = $! succ = false s_reply(s, succ, result) ensure close s if s

def dump(obj, soc) begin str = Marshal::dump(obj) rescue ro = DRbObject.new(obj) str = Marshal::dump(ro) soc.write(str) if soc return str

hatena screenshot id:secondlife @ RK06 httpd DB Queue SnapShot Engine Linux 1. take a request 2. make the snapshot 3. store to DB SnapShot Engine Windows

RWiki In-Memory Database with logging Wiki Object 25000 Wiki druby ERB

WEBrick::CGI WEBrick CGI

require webrick/cgi require thread class SimpleCountCGI < WEBrick::CGI def initialize super @count = Queue.new @count.push(1) def count value = @count.pop ensure @count.push(value + 1) def do_get(req, res) res[ content-type ] = text/plain res.body = count.to_s SimpleCountCGI.new.start

WEBrick::CGI WEBrick::CGI front FastCGI

CGI require webrick/cgi require drb/drb require thread class SimpleCountCGI < WEBrick::CGI def initialize super @count = Queue.new @count.push(1) def count value = @count.pop ensure @count.push(value + 1) def do_get(req, res) res[ content-type ] = text/plain res.body = count.to_s DRb.start_service( druby://localhost:12321, SimpleCountCGI.new) sleep

cgi.start() module WEBrick class CGI... def start(env=env, stdin=$stdin, stdout=$stdout)...

4 lines CGI #!/usr/local/bin/ruby require drb/ drb DRb.start_service( druby://localhost:0 ) ro = DRbObject.new_with_uri( druby://localhost:12321 ) ro.start(env.to_hash, $stdin, $stdout)

author of Linda Reviewer#1 Must buy!

Tuple Space Engine Client Engine TupleSpace Engine Client

Tuple Array Hash Marshal Marshal druby

Tuple [:chopstick, 2] [:room_ticket] [ abc, 2, 5] [:matrix, 1.6, 3.14] [ family, is-sister, Carolyn, Elinor ]

Pattern Tuple === case equals Regexp, Range, Class nil

Pattern [/^A/, nil, nil] [:matrix, Numeric, Numeric] [ family, is-sister, Carolyn, nil] [nil, age, (0..18)]

[ seki, age, 20] >> require rinda/tuplespace >> ts = Rinda::TupleSpace.new >> ts.write([ seki, age, 20]) >> ts.write([ sougo, age, 18]) >> ts.write([ leonard, age, 18]) >> ts.read_all([nil, age, 0..19]) => [["sougo", "age", 18], ["leonard", "age", 18]] >> ts.read_all([/^s/, age, Numeric]) => [["seki", "age", 20], ["sougo", "age", 18]]

>> ts = Rinda::TupleSpace.new => #<Rinda::TupleSpace:...> >> DRb.front['ts'] = ts => #<Rinda::TupleSpace:...> >> TupleSpaceProxy druby >> it = DRbObject.new_with_uri('druby://localhost:12345? ts') => #<DRb::DRbObject:...> >> ts = Rinda::TupleSpaceProxy.new(it) => #<Rinda::TupleSpaceProxy:...> >>

>> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace :seki :age 20

>> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace >> ts.take([:seki, :age, nil]) => [:seki, :age, 20] >> :seki :age 20

>> ts.take([:seki, :age, nil]) TupleSpace

>> ts.take([:seki, :age, nil]) >> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace :seki :age 20

>> ts.take([:seki, :age, nil]) >> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace => [:seki, :age, 20] >> :seki :age 20

TupleSpace >> tuple = ts.take([:count, nil])

TupleSpace >> tuple = ts.take([:count, nil]) >> ts.write([:count, 0]) => #<Rinda::TupleEntry:...> >> :count 0

TupleSpace >> tuple = ts.take([:count, nil]) >> ts.write([:count, 0]) => #<Rinda::TupleEntry:...> >> => [:count, 0] >> :count 0

TupleSpace >> tuple = ts.take([:count, nil]) >> ts.write([:count, 0]) => #<Rinda::TupleEntry:...> >> => [:count, 0] >> >> tuple = ts.take([:count, nil]) >> tuple[1] += 1 => 1 >> ts.write(tuple) => #<DRb::DRbObject:...> >> => [:count, 1] >> :count 1

bin = [] while line = gets line.scan(/\w+/) do w bin << [w, 1]

bin.sort_by { pair pair[0]}

word = nil sum = 0 bin.sort_by { pair pair[0]}.each do key, value if word && word!= key p [word, sum] sum = 0 word = key sum += value p [word, sum]

bin = Hash.new { h, k h[k] = []} while line = gets line.scan(/\w+/) do w bin[w] << 1 bin.keys.sort.each do k p [k, bin[k].reduce(:+)]

Tiny MapReduce by TupleSpace bin = Rinda::TupleSpace.new while line = gets line.scan(/\w+/) do w bin.write([w, 1])

while true key,= bin.read_all([string, nil]).min_by { k, v k} break unless key sum = 0 while true begin key, value = bin.take([key, nil], 0) sum += value rescue break p [key, sum]

while true key,= bin.read_all([string, nil]).min_by { k, v k} break unless key sum = 0 while true begin key, value = bin.take([key, nil], 0) sum += value rescue break p [key, sum]

TokyoCabinet QDBM TokyoCabinet BigTable

OODB Koya OODB

Koya PRb - PostgreSQL OODB ID

Koya with SQLite2 SQLite awk SQL UNIX

Koya with QDBM Hash

Hash BigTable

3360 druby Web

Who is translating it?

$32.00 International Journal of PARALLEL PROGRAMING Must buy!

http://dx.doi.org/10.1007/s10766-008-0086-1

Must buy! druby