It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator' | |
| g = Rails::Generators::ScaffoldControllerGenerator.new(['user', '--skip-collision-check']) | |
| g.shell.instance_variable_set(:@always_force, true) | |
| g.destination_root = '/tmp/rails' | |
| g.invoke_all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [2] (pry) main: 0> g = Rails::Generators::ScaffoldControllerGenerator.new | |
| ArgumentError: wrong number of arguments (given 0, expected 1+) | |
| from /home/kadu/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/railties-4.2.11.1/lib/rails/generators/model_helpers.rb:14:in `initialize' | |
| [3] (pry) main: 0> g = Rails::Generators::ScaffoldControllerGenerator.new('user') | |
| NoMethodError: undefined method `shift' for "user":String | |
| from /home/kadu/.asdf/installs/ruby/2.5.3/lib/ruby/gems/2.5.0/gems/thor-0.19.4/lib/thor/parser/arguments.rb:73:in `shift' | |
| [4] (pry) main: 0> g = Rails::Generators::ScaffoldControllerGenerator.new(['user']) | |
| => #<Rails::Generators::ScaffoldControllerGenerator:0x000055b1970a8680 | |
| @_initializer=[["user"], {}, {}], | |
| @_invocations={}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Criando uma rede vazia | |
| library(bnlearn) | |
| dag = empty.graph(c("P", "N")) | |
| class(dag) | |
| dag | |
| # Criando a estrutura da rede | |
| arc.set = matrix(c("P", "N"), ncol = 2, byrow = TRUE, dimnames = list(NULL, c("de", "para"))) | |
| arc.set | |
| arcs(dag) = arc.set |
OlderNewer