Erlectricity. Tom Preston-Werner. github.com/mojombo/erlectricity
|
|
- Kerry Henry
- 5 years ago
- Views:
Transcription
1 Erlectricity Tom Preston-Werner github.com/mojombo/erlectricity 1
2 github 2
3 3
4 4
5 5
6 6
7 7
8 8
9 Like an Erlang Process that runs Ruby Erlang VM 9
10 Like an Erlang Process that runs Ruby Erlang VM 9
11 Like an Erlang Process that runs Ruby Erlang VM 9
12 Like an Erlang Process that runs Ruby Erlang VM 9
13 Like an Erlang Process that runs Ruby Erlang VM 9
14 Like an Erlang Process that runs Ruby Erlang VM Ruby 9
15 What really happens Erlang VM Ruby PortOwner Port fd(3,4) 10
16 Inside Ruby Ruby fd 3 Decoder Receiver Matcher Handler fd 4 Encoder 11
17 Time to Code 12
18 Time to Code Announcing Erlectricity Release 12
19 Time to Code Announcing Erlectricity Release gem install erlectricity 12
20 A Simple Example 13
21 Erlang Code -module(echo). -export([test/0]). test() -> Cmd = "ruby echo.rb", Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]), Payload = term_to_binary({echo, <<"hello world!">>}), port_command(port, Payload), receive {Port, {data, Data}} -> {result, Text} = binary_to_term(data), io:format("~p~n", [Text]) end. 14
22 Erlang Code -module(echo). -export([test/0]). test() -> Cmd = "ruby echo.rb", Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]), Payload = term_to_binary({echo, <<"hello world!">>}), port_command(port, Payload), receive {Port, {data, Data}} -> {result, Text} = binary_to_term(data), io:format("~p~n", [Text]) end. 15
23 Erlang Code -module(echo). -export([test/0]). test() -> Cmd = "ruby echo.rb", Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]), Payload = term_to_binary({echo, <<"hello world!">>}), port_command(port, Payload), receive {Port, {data, Data}} -> {result, Text} = binary_to_term(data), io:format("~p~n", [Text]) end. 16
24 Erlang Code -module(echo). -export([test/0]). test() -> Cmd = "ruby echo.rb", Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]), Payload = term_to_binary({echo, <<"hello world!">>}), port_command(port, Payload), receive {Port, {data, Data}} -> {result, Text} = binary_to_term(data), io:format("~p~n", [Text]) end. 17
25 Erlang Code -module(echo). -export([test/0]). test() -> Cmd = "ruby echo.rb", Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]), Payload = term_to_binary({echo, <<"hello world!">>}), port_command(port, Payload), receive {Port, {data, Data}} -> {result, Text} = binary_to_term(data), io:format("~p~n", [Text]) end. 18
26 Ruby Code require 'rubygems' require 'erlectricity' receive do f f.when([:echo, String]) do text f.send!([:result, "You said: #{text}"]) f.receive_loop end end 19
27 Ruby Code require 'rubygems' require 'erlectricity' receive do f f.when([:echo, String]) do text f.send!([:result, "You said: #{text}"]) f.receive_loop end end 20
28 Ruby Code require 'rubygems' require 'erlectricity' receive do f f.when([:echo, String]) do text f.send!([:result, "You said: #{text}"]) f.receive_loop end end 21
29 Ruby Code require 'rubygems' require 'erlectricity' receive do f f.when([:echo, String]) do text f.send!([:result, "You said: #{text}"]) f.receive_loop end end 22
30 Ruby Code require 'rubygems' require 'erlectricity' receive do f f.when([:echo, String]) do text f.send!([:result, "You said: #{text}"]) f.receive_loop end end 23
31 Ruby Code require 'rubygems' require 'erlectricity' receive do f f.when([:echo, String]) do text f.send!([:result, "You said: #{text}"]) f.receive_loop end end 24
32 Data Conversion and Matching {echo, <<"hello world!">>} [:echo, "hello world!"] ~ [:echo, String] 25
33 send(port, test). f.when(:test) { p :ok } # :ok 26
34 Erlang send(port, test). f.when(:test) { p :ok } # :ok 27
35 send(port, test). Ruby f.when(:test) { p :ok } # :ok 28
36 send(port, test). f.when(:test) { p :ok } Ruby Output # :ok 29
37 send(port, {atom, symbol}). f.when([:atom, Symbol]) { sym p sym } # :symbol 30
38 send(port, {number, 1}). f.when([:number, Fixnum]) { num p num } # 1 31
39 send(port, {string, <<"foo">>}). f.when([:string, String]) { str p str } # "foo" 32
40 send(port, {array, [1,2,3]}). f.when([:array, Array]) { arr p arr } # [1, 2, 3] 33
41 send(port, {array, [<<"abc">>, <<"def">>]}). f.when([:array, Array]) { arr p arr } # ["abc", "def"] 34
42 send(port, {bool, true}). f.when([:bool, Erl.boolean]) { bool p bool } # true 35
43 send(port, {hash, [{key,val}]}). f.when([:hash, Erl.hash]) { hash p hash } # {:key=>:val} 36
44 send(port, {object, {1,{2},3,<<"four">>}}). f.when([:object, Any]) { any p any } # [1, [2], 3, "four"] 37
45 Round Trip Conversions 38
46 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 39
47 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 40
48 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 41
49 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 42
50 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 43
51 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 44
52 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 45
53 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 46
54 Erlang Ruby Erlang foo :foo foo true true true false false false <<"baz">> "baz" <<"baz">> "bar" [98, 97, 114] {98, 97, 114} [1, 2, 3] [1, 2, 3] {1, 2, 3} 47
55 48
56 49
57 Fuzed 50
58 Erlang Fuzed Node Port Owner Port Ruby Port Owner Port Ruby Port Owner Port Ruby Port Owner Port Ruby 51
59 52
60 The most beautiful binary format of all time 53
61 Port Invocation open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]). 54
62 Term Transfer Protocol [1, 2, 3] 55
63 Four Byte Packet Length <<0,0,0,7,131,107,0,3,1,2,3>> 56
64 Max Packet Size bytes = 4,294,967,296 bytes = 4 GiB 57
65 One Byte Magic Number <<0,0,0,7,131,107,0,3,1,2,3>> 58
66 One Byte Type <<0,0,0,7,131,107,0,3,1,2,3>> 59
67 Type Lookup SMALL_INT = 97 INT = 98 SMALL_BIGNUM = 110 LARGE_BIGNUM = 111 FLOAT = 99 ATOM = 100 REF = 101 NEW_REF = 114 PORT = 102 PID = 103 SMALL_TUPLE = 104 LARGE_TUPLE = 105 NIL = 106 STRING = 107 LIST = 108 BIN = 109 FUN = 117 NEW_FUN =
68 Type Lookup SMALL_INT = 97 INT = 98 SMALL_BIGNUM = 110 LARGE_BIGNUM = 111 FLOAT = 99 ATOM = 100 REF = 101 NEW_REF = 114 PORT = 102 PID = 103 SMALL_TUPLE = 104 LARGE_TUPLE = 105 NIL = 106 STRING = 107 LIST = 108 BIN = 109 FUN = 117 NEW_FUN =
69 Two Byte Data Length <<0,0,0,7,131,107,0,3,1,2,3>> 61
70 Data Content <<0,0,0,7,131,107,0,3,1,2,3>> 62
71 Try it at home! Eshell V5.6.4 (abort with ^G) 1> term_to_binary([1, 2, 3]). <<131,107,0,3,1,2,3>> 63
72 A bit more complex {ok, [99, << beers >>]} 64
73 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 65
74 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 66
75 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 67
76 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 68
77 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 69
78 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 70
79 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 71
80 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 72
81 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 73
82 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 74
83 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 75
84 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 76
85 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 77
86 A bit more complex {ok, [99, << beers >>]} <<131,104,2,100,0,2,111, 107,108,0,0,0,2,97,99, 109,0,0,0,5,98,101, 101,114,115,106>> 78
87 1> A = fun() -> 42 end. #Fun<erl_eval > 2> B = term_to_binary(a). <<131,112,0,0,2,139,0,213,76,172,89,236,217,232,254, 184,178,23,144,76,140,192,206,0,0,0,1,0,0,...>> 3> size(b) > C = binary_to_term(b). #Fun<erl_eval > 5> apply(c, [])
88 80
89 Erlectricity 80
90 Erlectricity = 80
91 Erlectricity = The scalability of Erlang 80
92 Erlectricity = The scalability of Erlang + 80
93 Erlectricity = The scalability of Erlang + The ease of Ruby 80
94 Towards Erlectricity
95 See Also Erlix github.com/kdr2/erlix Rebar github.com/mojombo/rebar 82
96 83
97 Binary Erlang Term 84
98 Binary Erlang Term BERT 84
99 85
100 [1, 2, 3] Term BERT <<131,107,0,3,1,2,3>> 86
101 Simple Data Types Only SMALL_INT = 97 INT = 98 FLOAT = 99 ATOM = 100 SMALL_BIGNUM = 110 LARGE_BIGNUM = 111 SMALL_TUPLE = 104 LARGE_TUPLE = 105 NIL = 106 STRING = 107 LIST = 108 BIN =
102 highly compact binary easy to parse not human readable generic data types 88
103 Binary Erlang Term - Remote Procedure Call 89
104 Binary Erlang Term - Remote Procedure Call BERT-RPC 89
105 BERT-RPC Basics 90
106 BERT-RPC Call {call, myapp, add, [1, 2]} {reply, 3} 91
107 BERT-RPC Call {call, myapp, add, [1, 2]} {reply, 3} 92
108 BERT-RPC Call {call, myapp, add, [1, 2]} {reply, 3} 93
109 BERT-RPC Call {call, myapp, add, [1, 2]} {reply, 3} 94
110 BERT-RPC Call {call, myapp, add, [1, 2]} {reply, 3} 95
111 BERT-RPC Call {call, myapp, add, [1, 2]} {reply, 3} 96
112 BERT-RPC Call {call, myapp, add, [1, 2]} {reply, 3} 97
113 BERT-RPC Call {call, myapp, add, [1, 2]} -or- 98
114 BERT-RPC Call {call, myapp, add, [1, 2]} {error, [server, 2, unknown module ]} 99
115 BERT-RPC Call {call, myapp, add, [1, 2]} {error, [server, 2, unknown module ]} 100
116 BERT-RPC Call {call, myapp, add, [1, 2]} {error, [server, 2, unknown module ]} 101
117 BERT-RPC Call {call, myapp, add, [1, 2]} {error, [server, 2, unknown module ]} 102
118 BERT-RPC Call {call, myapp, add, [1, 2]} {error, [server, 2, unknown module ]} 103
119 BERT Packet (BERTP) BERTP = 4 byte length header + BERT {call, myapp, add, [1, 2]} <<0,0,0,29,131,104,4,100,0,4,99,97,108,108,100,0,5,109,121, 97,112,112,100,0,3,97,100,100,107,0,2,1,2>> 104
120 Transfer via BERTP {call, myapp, add, [1, 2]} <<0,0,0,29,131,104,4,100,0,4,99,97,108,108,100,0,5,109,121, 97,112,112,100,0,3,97,100,100,107,0,2,1,2>> <<0,0,0,13,131,104,2,100,0,5,114,101,112,108,121,97,3>> {reply, 3} 105
121 BERT-RPC Cast {cast, myapp, incr, [5]} {noreply} 106
122 BERT-RPC Cast {cast, myapp, incr, [5]} {noreply} 107
123 BERT-RPC Cast {cast, myapp, incr, [5]} {noreply} 108
124 BERT-RPC Cast {cast, myapp, incr, [5]} {noreply} 109
125 BERT-RPC Cast {cast, myapp, incr, [5]} {noreply} 110
126 Optional Opaque ID {call, myapp, add, [1, 2], [{id, fc1e542 }]} {reply, 3, [{id, fc1e542 }]} 111
127 BERT-RPC Streaming 112
128 Known Length Streaming Reply {call, myapp, log, [ a.log ]} <<0,0,0,59,131,104,3,100,0,5,114,101,112,108,121,106,108,0,0,0,1,104,3,100,0,6,115,116, 114,101,97,109,100,0,4,98,121,116,101,108,0,0,0,1,104,2,100,0,6,108,101,110, 103,116,104,98,0,4,1,134,106,106,73,44,32,91,50,48,48,57,45,48,52,45,50,51,...>> {reply, [], [{stream, byte, [{length, }]}]} <byte-0>...<byte > 113
129 Known Length Streaming Reply BERTP Raw Binary Data 114
130 Chunked Streaming Reply {call, myapp, log, [ a.log ]} <<0,0,0,59,131,104,3,100,0,5,114,101,112,108,121,106,108,0,0,0,1,104,3,100,0,6,115,116, 114,101,97,109,100,0,4,98,121,116,101,108,0,0,0,1,104,2,100,0,6,108,101,110, 103,116,104,98,0,4,1,134,106,106,0,0,7,38,73,44,32,91,50,52,45,50,51,...,0,0,0,0>> {reply, [], [{stream, byte, chunked}]} <n-header><n-bytes><m-header><m-bytes> <0-header> 115
131 Chunked Streaming Reply BERTP N Bytes M Bytes N Header M Header 0 Header 116
132 BERT Streaming Reply {call, myapp, friends, [ mojombo ]} <<0,0,0,59,131,104,3,100,0,5,114,101,112,108,121,106,108,0,0,0,1,104,3,100,0,6,115,116, 114,101,97,109,100,0,4,98,121,116,101,108,0,0,0,1,104,2,100,0,6,108,101,110,103,116, 104,98,0,4,1,134,106,106,0,0,0,29,131,104,2,100,0,4,117,115,101,114,104,2,100,0,4,110,97, 109,101,107,0,7,109,111,106,111,109,98,111,0,0,0,35,131,104,2,100,...>> {reply, [], [{stream, bert, [{length, 100}]}]} <BERTP-0>...<BERTP-99> 117
133 BERT Streaming Reply BERTP BERTP 0... BERTP
134 Terminated BERT Streaming Reply {call, myapp, friends, [ mojombo ]} <<0,0,0,59,131,104,3,100,0,5,114,101,112,108,121,106,108,0,0,0,1,104,3,100,0,6,115,116, 114,101,97,109,100,0,4,98,121,116,101,108,0,0,0,1,104,2,100,0,6,108,101,110,103,116, 104,98,0,4,1,134,106,106,0,0,0,29,131,104,2,100,0,4,117,115,101,114,104,2,100,0,4,110,97, 109,101,107,0,7,109,111,106,111,109,98,111,0,0,0,35,131,104,2,100,...>> {reply, [], [{stream, bert, [{terminator, done}]}]} <BERTP>...done 119
135 BERT Streaming Reply BERTP BERTP... done 120
136 BERT Streaming Request {call, myapp, samples, [], [{stream, bert, [{length, 100}]}]} <BERTP 0>...<BERTP 99> {reply, {ok, 100}} 121
137 BERT-RPC Exotica 122
138 Persistent Connections {persistence, enable} {result, enabled} 123
139 Asynchronous Call {call, myapp, factor, [161], [{async, bert.example.com:9377 }, {id, 7af639b }]} {reply, async, [{id, 7af639b }]} {reply, [7, 23], [{id, 7af639b }]} 124
140 Tom Preston-Werner on Twitter github.com/mojombo 125
141 Credits
VALEO: programs robustifier
VALEO: programs robustifier by Younès HAFRI younes.hafri@aleph-archives.com talk to the outside? 3 Who Am I? Aleph Archives' CTO & Founder love coding hate complexity love un-optimizing programs hate cooking
More informationRUBY IS FROM MARS, Functional Languages Are from Venus
RUBY IS FROM MARS, Functional Languages Are from Venus Integrating Ruby with Erlang, Scala & F# ANDREA O. K. WRIGHT Chariot Solutions aok@chariotsolutions.com 1 The source for all of the examples can be
More informationMacros, and protocols, and metaprogramming - Oh My!
Macros, and protocols, and metaprogramming - Oh My! (aka "What is Elixir and why should you care?") jim mccoy, Facebook Infosec Tools mccoy@fb.com (jim.mccoy@gmail.com) Who? Currently build and maintain
More informationCSCI-1680 RPC and Data Representation. Rodrigo Fonseca
CSCI-1680 RPC and Data Representation Rodrigo Fonseca Today Defining Protocols RPC IDL Problem Two programs want to communicate: must define the protocol We have seen many of these, across all layers E.g.,
More informationCSCI-1680 RPC and Data Representation. Rodrigo Fonseca
CSCI-1680 RPC and Data Representation Rodrigo Fonseca Administrivia TCP: talk to the TAs if you still have questions! ursday: HW3 out Final Project (out 4/21) Implement a WebSockets server an efficient
More informationThrift specification - Remote Procedure Call
Erik van Oosten Revision History Revision 1.0 2016-09-27 EVO Initial version v1.1, 2016-10-05: Corrected integer type names. Small changes to section headers. Table of Contents 1.
More informationCSCI-1680 RPC and Data Representation John Jannotti
CSCI-1680 RPC and Data Representation John Jannotti Original Slides from Rodrigo Fonseca Today Defining Protocols RPC IDL Problem Two programs want to communicate: must define the protocol We have seen
More informationErlang: distributed programming
Erlang: distributed May 11, 2012 1 / 21 Fault tolerance in Erlang links, exit signals, system process in Erlang OTP Open Telecom Platform 2 / 21 General idea Links Exit signals System processes Summary
More informationGoogles Approach for Distributed Systems. Slides partially based upon Majd F. Sakr, Vinay Kolar, Mohammad Hammoud and Google PrototBuf Tutorial
Protocol Buffers Googles Approach for Distributed Systems Slides partially based upon Majd F. Sakr, Vinay Kolar, Mohammad Hammoud and Google PrototBuf Tutorial https://developers.google.com/protocol-buffers/docs/tutorials
More informationCSE 123: Computer Networks
Student Name: PID: UCSD email: CSE 123: Computer Networks Homework 1 Solution (Due 10/12 in class) Total Points: 30 Instructions: Turn in a physical copy at the beginning of the class on 10/10. Problems:
More informationExercise: Using Numbers
Exercise: Using Numbers Problem: You are a spy going into an evil party to find the super-secret code phrase (made up of letters and spaces), which you will immediately send via text message to your team
More informationAvro Specification
Table of contents 1 Introduction...2 2 Schema Declaration... 2 2.1 Primitive Types... 2 2.2 Complex Types...2 2.3 Names... 5 3 Data Serialization...6 3.1 Encodings... 6 3.2 Binary Encoding...6 3.3 JSON
More informationREdis: Implementing Redis in Erlang. A step-by-step walkthrough
R: Implementing Redis in Erlang A step-by-step walkthrough 1 2 : Implementing Redis in Erlang A step-by-step walkthrough 2 My Background Microsoft Visual Studio Visto Corporation Founded Inaka Moved to
More informationAn Introduction to Erlang
An Introduction to Erlang Part 2 - Concurrency Richard Carlsson Processes P1 fib(0) -> 1; fib(1) -> 1; fib(n) when N > 0 -> fib(n-1) + fib(n-2). Whenever an Erlang program is running, the code is executed
More informationRemote Procedure Call. Tom Anderson
Remote Procedure Call Tom Anderson Why Are Distributed Systems Hard? Asynchrony Different nodes run at different speeds Messages can be unpredictably, arbitrarily delayed Failures (partial and ambiguous)
More informationpybdg Documentation Release 1.0.dev2 Outernet Inc
pybdg Documentation Release 1.0.dev2 Outernet Inc April 17, 2016 Contents 1 Source code 3 2 License 5 3 Documentation 7 Python Module Index 15 i ii Bitloads, or bit payloads, are compact payloads containing
More informationAvro Specification
Table of contents 1 Introduction...2 2 Schema Declaration... 2 2.1 Primitive Types... 2 2.2 Complex Types...2 2.3 Names... 5 2.4 Aliases... 6 3 Data Serialization...6 3.1 Encodings... 7 3.2 Binary Encoding...7
More informationPiqi-RPC. Exposing Erlang services via JSON, XML and Google Protocol Buffers over HTTP. Friday, March 25, 2011
Piqi-RPC Exposing Erlang services via JSON, XML and Google Protocol Buffers over HTTP 1 Anton Lavrik http://piqi.org http://www.alertlogic.com 2 Overview Call Erlang functions using HTTP POST : Server
More informationcode://rubinius/technical
code://rubinius/technical /GC, /cpu, /organization, /compiler weeee!! Rubinius New, custom VM for running ruby code Small VM written in not ruby Kernel and everything else in ruby http://rubini.us git://rubini.us/code
More informationParallel Programming in Erlang (PFP Lecture 10) John Hughes
Parallel Programming in Erlang (PFP Lecture 10) John Hughes What is Erlang? Haskell Erlang - Types - Lazyness - Purity + Concurrency + Syntax If you know Haskell, Erlang is easy to learn! QuickSort again
More informationAdvanced Functional Programming, 1DL Lecture 2, Cons T Åhs
Advanced Functional Programming, 1DL450 2012 Lecture 2, 2012-11-01 Cons T Åhs Higher order functions hof() -> F = fun(x) -> X * X + 1 end, L = lists:map(f, [1, 2, 3], G = fun([]) -> nil; ([_ _]) -> cons
More informationAn Introduction to Erlang. Richard Carlsson
An Introduction to Erlang Richard Carlsson Erlang Buzzwords Functional (strict) Single-assignment Dynamically typed Concurrent Distributed Message passing Soft real-time Fault tolerant No sharing Automatic
More informationAlleviate the Apprehension of Coding in Ruby
Alleviate the Apprehension of Coding in Ruby Chris Lasell Apple Peeler Pixar Animation Studios Install session materials Includes some example code & libraries ruby-jss and ruby gem dependencies into /Library/Ruby/Gems
More informationIntroduction to Erlang. Franck Petit / Sebastien Tixeuil
Introduction to Erlang Franck Petit / Sebastien Tixeuil Firstname.Lastname@lip6.fr Hello World % starts a comment. ends a declaration Every function must be in a module one module per source file source
More informationYour First Ruby Script
Learn Ruby in 50 pages Your First Ruby Script Step-By-Step Martin Miliauskas @mmiliauskas 1 Your First Ruby Script, Step-By-Step By Martin Miliauskas Published in 2013 by Martin Miliauskas On the web:
More informationA Client-Server Exchange
Socket programming A Client-Server Exchange A server process and one or more client processes Server manages some resource. Server provides service by manipulating resource for clients. 1. Client sends
More informationNabto Serial Link Protocol
Nabto Serial Link Protocol Nabto TM Nabto Serial Link Protocol Page 1 of 22 Contents Vocabulary... 4 Introduction... 5 Access Control... 5 Connection type... 5 Access Control List... 5 Protocol details...
More informationCOSC441. Lecture 8 Introduction to Erlang
COSC441 Lecture 8 Introduction to Erlang Approach The reference book is Learn You Some Erlang for Great Good! by Fred Hébert. http://learnyousomeerlang.com lets you read it free on-line. What I am going
More informationThe Actor Model. CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016
The Actor Model CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016 1 Goals Introduce the Actor Model of Concurrency isolation, message passing, message patterns Present examples from
More informationRuby: Objects and Dynamic Types
Ruby: Objects and Dynamic Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 5 Primitive vs Reference Types Recall Java type dichotomy: Primitive: int, float,
More informationCSCI 466 Midterm Networks Fall 2013
CSCI 466 Midterm Networks Fall 2013 Name: This exam consists of 6 problems on the following 7 pages. You may use your single-sided hand-written 8 ½ x 11 note sheet and a calculator during the exam. No
More informationErlang: An Overview. Part 2 Concurrency and Distribution. Thanks to Richard Carlsson for most of the slides in this part
Erlang: An Overview Part 2 Concurrency and Distribution Thanks to Richard Carlsson for most of the slides in this part Processes P1 fib(0) -> 1; fib(1) -> 1; fib(n) when N > 0 -> fib(n-1) + fib(n-2). Whenever
More informationSoar Markup Language (SML) IJCAI Nate Derbinsky
Soar Markup Language (SML) IJCAI 2016 Nate Derbinsky Topics Big picture System setup + Hello Soar (homework) Basic usage Example walkthrough Additional resources July 11, 2016 Soar Markup Language (SML)
More informationShell Programming (Part 2)
i i Systems and Internet Infrastructure Security Institute for Networking and Security Research Department of Computer Science and Engineering Pennsylvania State University, University Park, PA Shell Programming
More informationA Language for Specifying Type Contracts in Erlang and its Interaction with Success Typings
A Language for Specifying Type Contracts in Erlang and its Interaction with Success Typings Miguel Jiménez 1, Tobias Lindahl 1,2, Konstantinos Sagonas 3,1 1 Department of Information Technology, Uppsala
More informationThe current topic: Python. Announcements. Python. Python
The current topic: Python Announcements! Introduction! reasons for studying languages! language classifications! simple syntax specification Object-oriented programming: Python Types and values Syntax
More informationConfigure IP SLA Tracking for IPv4 Static Routes on an SG550XG Switch
Configure IP SLA Tracking for IPv4 Static Routes on an SG550XG Switch Introduction When using static routing, you may experience a situation where a static route is active, but the destination network
More informationCS115 - Module 4 - Compound data: structures
Fall 2017 Reminder: if you have not already, ensure you: Read How to Design Programs, sections 6-7, omitting 6.2, 6.6, 6.7, and 7.4. Compound data It often comes up that we wish to join several pieces
More informationLFE - a lisp on the Erlang VM
Robert Virding Principle Language Expert at Erlang Solutions Ltd. LFE - a lisp on the Erlang VM What LFE isn t It isn t an implementation of Scheme It isn t an implementation of Common Lisp It isn t an
More informationLecture 1. Basic Ruby 1 / 61
Lecture 1 Basic Ruby 1 / 61 What does this do? 3.times do print 'Hello, world!' end 2 / 61 Why Ruby? Optimized for programmer happiness Used for Ruby on Rails Very popular web framework 3 / 61 Course Policies
More informationCPE Summer 2015 Exam I (150 pts) June 18, 2015
Name Closed notes and book. If you have any questions ask them. Write clearly and make sure the case of a letter is clear (where applicable) since C++ is case sensitive. You can assume that there is one
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationWinter Lecture 7
Winter 2008-2009 Lecture 7 Erlang provides several mechanisms for storing and retrieving data Today: Simple file-based storage ETS: Erlang Term Storage DETS: Disk ETS All of these mechanisms support storage
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More information1.3b Type Conversion
1.3b Type Conversion Type Conversion When we write expressions involved data that involves two different data types, such as multiplying an integer and floating point number, we need to perform a type
More informationShellcode Analysis. Chapter 19
Shellcode Analysis Chapter 19 What is Shellcode Shellcode a payload of raw executable code, attackers use this code to obtain interactive shell access. A binary chunk of data Can be generally referred
More informationTFTP Copyright Ericsson AB. All Rights Reserved. TFTP 1.0 June 19, 2018
TFTP Copyright 1997-2018 Ericsson AB. All Rights Reserved. TFTP 1.0 June 19, 2018 Copyright 1997-2018 Ericsson AB. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you
More informationNetwork Object in C++
Network Object in C++ Final Project of HonorOS Professor David Maziere Po-yen Huang (Dennis) Dong-rong Wen May 9, 2003 Table of Content Abstract...3 Introduction...3 Architecture...3 The idea...3 More
More informationExam 2, Form A CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.
Name: Section: Date: INSTRUCTIONS: (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. (2) This exam booklet contains 30 questions, each of which will be weighted equally at 5 points each.
More informationExam 2, Form B CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.
Name: Section: Date: INSTRUCTIONS: (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. (2) This exam booklet contains 30 questions, each of which will be weighted equally at 5 points each.
More informationBinary Encodings for JavaScript Object Notation: JSON-B, JSON-C, JSON-D
Internet Engineering Task Force P. Hallam-Baker Internet-Draft Comodo Group Inc. Intended status: Standards Track June 11, 2013 Expires: December 13, 2013 Binary Encodings for JavaScript Object Notation:
More informationA JSON Data Processing Language. Audrey Copeland, Walter Meyer, Taimur Samee, Rizwan Syed
A JSON Data Processing Language Audrey Copeland, Walter Meyer, Taimur Samee, Rizwan Syed Introduction Language design centered around the programmatic manipulation of JSON data and interacting with HTTP
More informationSoar Workshop SML Tutorial Nate Derbinsky, Rico Angell While waiting download Eclipse At least eclipse.org. June SML Tutorial 1
Soar Workshop SML Tutorial Nate Derbinsky, Rico Angell While waiting download Eclipse At least Java @ eclipse.org June 8 2016 SML Tutorial 1 Agenda Big picture System setup + Hello Soar Basic usage Additional
More informationSupermann. Release 3.0.0
Supermann Release 3.0.0 May 27, 2015 Contents 1 Usage 3 1.1 What Supermann does.......................................... 3 1.2 supermann-from-file....................................... 3 2 Installation
More informationBrewmeister Documentation
Brewmeister Documentation Release 0.1.0dev Matthias Vogelgesang August 07, 2014 Contents 1 Features 3 2 Documentation 5 3 Screenshot 7 4 Contents 9 4.1 Installation..............................................
More informationThe HALFWORD HEAP EMULATOR
The HALFWORD HEAP EMULATOR EXPLORING A VIRTUAL MACHINE patrik Nyblom, Ericsson ab pan@erlang.org The Beam Virtual Machine Björns/Bogdans Erlang Abstract Machine Has evolved over the years and is a joint
More information1 Docstrings. COSC 101 Lecture #14 Handout: Defining Functions, Part 4 Spring 2015
Docstrings A docstring is a string at the beginning of a function that explains what the function does. A docstring explains what a function does, but not necessarily how it does it. Collectively, docstrings
More informationLogin management commands
Contents Login management commands 1 CLI login configuration commands 1 display telnet client configuration 1 telnet 1 telnet ipv6 2 telnet server enable 3 User interface configuration commands 3 acl (user
More informationCS302 - Data Structures using C++
CS302 - Data Structures using C++ Pre-Course: Variables, Basic Types, Control Structures Kostas Alexis Slides inspired by the course Modern C++, Uni Bonn: http://www.ipb.uni-bonn.de/teaching/modern-cpp/
More informationAllegro CL Certification Program
Allegro CL Certification Program Lisp Programming Series Level I Session 1.3.1 David Margolies Manipulating Lists 9/16/2010 1 What is a List? An ordered (possibly empty) collection of things in a particular
More informationOSE Copyright Ericsson AB. All Rights Reserved. OSE 1.0 June 23, 2014
OSE Copyright 2014-2014 Ericsson AB. All Rights Reserved. OSE 1.0 June 23, 2014 Copyright 2014-2014 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License,
More informationCSE 333 Lecture C++ final details, networks
CSE 333 Lecture 19 -- C++ final details, s Steve Gribble Department of Computer Science & Engineering University of Washington Administrivia HW3 is due in 5 days! - we re up to 6 bugs for you to patch
More informationLists, loops and decisions
Caltech/LEAD Summer 2012 Computer Science Lecture 4: July 11, 2012 Lists, loops and decisions Lists Today Looping with the for statement Making decisions with the if statement Lists A list is a sequence
More informationScalable Name-Based Packet Forwarding: From Millions to Billions. Tian Song, Beijing Institute of Technology
Scalable Name-Based Packet Forwarding: From Millions to Billions Tian Song, songtian@bit.edu.cn, Beijing Institute of Technology Haowei Yuan, Patrick Crowley, Washington University Beichuan Zhang, The
More informationCHAPTER 3 BASIC INSTRUCTION OF C++
CHAPTER 3 BASIC INSTRUCTION OF C++ MOHD HATTA BIN HJ MOHAMED ALI Computer programming (BFC 20802) Subtopics 2 Parts of a C++ Program Classes and Objects The #include Directive Variables and Literals Identifiers
More informationInteger Representation Floating point Representation Other data types
Chapter 2 Bits, Data Types & Operations Integer Representation Floating point Representation Other data types Why do Computers use Base 2? Base 10 Number Representation Natural representation for human
More informationDynomite. Yet Another Distributed Key Value Store
Dynomite Yet Another Distributed Key Value Store @moonpolysoft - questions #dynomite on irc.freenode.net Alpha - 0.6.0 Focus on Distribution Focus on Performance Latency Average ~ 10 ms Median ~ 5 ms
More informationA Small Web Server. Programming II - Elixir Version. Johan Montelius. Spring Term 2018
A Small Web Server Programming II - Elixir Version Johan Montelius Spring Term 2018 Introduction Your task is to implement a small web server in Elixir. exercise is that you should be able to: The aim
More informationFirst name (printed): a. DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.
CSE 231 F 13 Exam #1 Last name (printed): First name (printed): Form 1 X Directions: a. DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b. This exam booklet contains 25 questions, each
More informationCMSC330 Fall 2015 Midterm #1 12:30pm/2:00pm/5:00pm
CMSC330 Fall 2015 Midterm #1 12:30pm/2:00pm/5:00pm Name: Discussion Time: 10am 11am 12pm 1pm 2pm 3pm TA Name (Circle): Adam Maria Chris Chris Michael Candice Amelia Amelia Samuel Josh Max Instructions
More informationProtocol Buffers, grpc
Protocol Buffers, grpc Szolgáltatásorientált rendszerintegráció Service-Oriented System Integration Dr. Balázs Simon BME, IIT Outline Remote communication application level vs. transport level protocols
More informationDiscussion 1H Notes (Week 2, 4/8) TA: Brian Choi Section Webpage:
Discussion 1H Notes (Week 2, 4/8) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 Variables You have to instruct your computer every little thing it needs to do even
More informationCS 856 Latency in Communication Systems
CS 856 Latency in Communication Systems Winter 2010 Latency Challenges CS 856, Winter 2010, Latency Challenges 1 Overview Sources of Latency low-level mechanisms services Application Requirements Latency
More informationPerformance Optimization 101. Louis-Philippe Gauthier Team AdGear Trader
Performance Optimization 101 Louis-Philippe Gauthier Team leader @ AdGear Trader Exercise HTTP API server API GET /date - returns today s date GET /time - returns the unix time in seconds HTTP API server
More informationEthereal Exercise 2 (Part A): Link Control Protocol
Course: Semester: ELE437 Ethereal Exercise 2 (Part A): Link Control Protocol Introduction In this exercise some details at the data link layer will be examined. In particular, the Link Control Protocol
More informationDogeon Documentation. Release Lin Ju
Dogeon Documentation Release 1.0.0 Lin Ju June 07, 2014 Contents 1 Indices and tables 7 Python Module Index 9 i ii DSON (Doge Serialized Object Notation) is a data-interchange format,
More informationCS 3113 Introduction to Operating Systems Midterm October 11, 2018
General instructions: CS 3113 Introduction to Operating Systems Midterm October 11, 2018 Please wait to open this exam booklet until you are told to do so. This examination booklet has 10 pages. You also
More informationCS 3113 Introduction to Operating Systems Midterm October 11, 2018
General instructions: CS 3113 Introduction to Operating Systems Midterm October 11, 2018 Please wait to open this exam booklet until you are told to do so. This examination booklet has 10 pages. You also
More informationArvind Krishnamurthy Spring Implementing file system abstraction on top of raw disks
File Systems Arvind Krishnamurthy Spring 2004 File Systems Implementing file system abstraction on top of raw disks Issues: How to find the blocks of data corresponding to a given file? How to organize
More informationRudy: a small web server. Johan Montelius. October 2, 2016
Rudy: a small web server Johan Montelius October 2, 2016 Introduction Your task is to implement a small web server in Erlang. The aim of this exercise is that you should be able to: describe the procedures
More informationSocket Programming Assignment 6: Video Streaming with RTSP and RTP
Socket Programming Assignment 6: Video Streaming with RTSP and RTP In this lab you will implement a streaming video server and client that communicate using the Real-Time Streaming Protocol (RTSP) and
More informationInspirel. YAMI4 Requirements. For YAMI4Industry, v page 1
YAMI4 Requirements For YAMI4Industry, v.1.3.1 www.inspirel.com info@inspirel.com page 1 Table of Contents Document scope...3 Architectural elements...3 Serializer...3 Socket...3 Input buffer...4 Output
More informationProgramming Paradigms Written Exam (6 CPs)
Programming Paradigms Written Exam (6 CPs) 19.09.2018 First name Student number Last name Signature Instructions for Students Write your name and student number on the exam sheet and on every solution
More informationFall 08, Sherri Goings, Exam #1 (10/2), form 1 B
Fall 08, Sherri Goings, Exam #1 (10/2), form 1 B Last name (printed): First name (printed): Directions: a) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b) You have 80 minutes to complete
More informationExamination 2D1392 Protocols and Principles of the Internet 2G1305 Internetworking 2G1507 Kommunikationssystem, fk SOLUTIONS
Examination 2D1392 Protocols and Principles of the Internet 2G1305 Internetworking 2G1507 Kommunikationssystem, fk Date: January 17 th 2006 at 14:00 18:00 SOLUTIONS 1. General (5p) a) Draw the layered
More informationGFS-python: A Simplified GFS Implementation in Python
GFS-python: A Simplified GFS Implementation in Python Andy Strohman ABSTRACT GFS-python is distributed network filesystem written entirely in python. There are no dependencies other than Python s standard
More informationDynamic Types, Concurrency, Type and effect system Section and Practice Problems Apr 24 27, 2018
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Apr 24 27, 2018 1 Dynamic types and contracts (a) To make sure you understand the operational semantics of dynamic types
More informationCS 417 9/18/17. Paul Krzyzanowski 1. Socket-based communication. Distributed Systems 03. Remote Procedure Calls. Sample SMTP Interaction
Socket-based communication Distributed Systems 03. Remote Procedure Calls Socket API: all we get from the to access the network Socket = distinct end-to-end communication channels Read/write model Line-oriented,
More informationImpossible Programs. Tom Stuart
Impossible Programs Tom Stuart IMPOSSIBLE PROGRAMS @tomstuart / GOTO Chicago / 2015-05-11 PROGRAMS CAN T DO EVERYTHING IMPOSSIBLE PROGRAMS @tomstuart / GOTO Chicago / 2015-05-11 how can a PROGRAM be IMPOSSIBLE?
More informationSpring Semester 13, Dr. Punch. Exam #1 (2/14), form 1 A
Spring Semester 13, Dr. Punch. Exam #1 (2/14), form 1 A Last name (printed): First name (printed): Directions: a) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b) You have 80 minutes
More informationA Module Mapper. 1 Background. Nathan Sidwell. Document Number: p1184r0 Date: SC22/WG21 SG15. /
A Module Mapper Nathan Sidwell Document Number: p1184r0 Date: 2018-10-05 To: SC22/WG21 SG15 Reply to: Nathan Sidwell nathan@acm.org / nathans@fb.com The modules-ts specifies no particular mapping between
More informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
More informationDistributed Systems. 03. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Fall 2017
Distributed Systems 03. Remote Procedure Calls Paul Krzyzanowski Rutgers University Fall 2017 1 Socket-based communication Socket API: all we get from the OS to access the network Socket = distinct end-to-end
More informationLecture 2: Variables & Assignments
http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 2: Variables & Assignments (Sections 2.1-2.3,2.5) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,
More informationFinal assignment: Hash map
Final assignment: Hash map 1 Introduction In this final assignment you will implement a hash map 1. A hash map is a data structure that associates a key with a value (a chunk of data). Most hash maps are
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
More informationxkcd.com End To End Protocols End to End Protocols This section is about Process to Process communications.
xkcd.com 1 2 COS 460 & 540 End to End Protocols 3 This section is about Process to Process communications. or the how applications can talk to each other. 5- (UDP-TCP).key - November 9, 2017 Requirements
More informationFile Operations. Lecture 16 COP 3014 Spring April 18, 2018
File Operations Lecture 16 COP 3014 Spring 2018 April 18, 2018 Input/Ouput to and from files File input and file output is an essential in programming. Most software involves more than keyboard input and
More information