erlang

Tsung error: can't start newbeam on host

妖精的绣舞 提交于 2019-12-07 17:20:32
问题 I have been trying to get tsung to connect to a box I have running kubuntu 12.04 Here is the client portion of my config <clients> <client host="klaptop" weight="1" maxusers="500"/> </clients> I run tsung with the following command tsung -f /var/tsung/xml/config.xml -l /var/tsung/logs/ start I get the following error in my tsung_controller log file =INFO REPORT==== 20-Jun-2012::15:06:01 === ts_config_server:(0:<0.72.0>) Can't start newbeam on host klaptop (reason: timeout) ! Aborting! I have

Elixir rename and wrap Erlang module?

[亡魂溺海] 提交于 2019-12-07 16:48:44
问题 Is it possible to rename an existing Erlang module? I have some code in several Erlang modules that I want to use in an Elixir project (assertion library). I don't want to convert all the Erlang modules to Elixir as they are complete, but I want to rename them, and possible add additional functions to them. Both modules are simply collections of functions, they don't implement behaviors or do anything unusual. I want to be able to take an existing Erlang module: -module(foo_erl). -export(

Erlang “unbound variable” when calling a function

♀尐吖头ヾ 提交于 2019-12-07 14:16:24
问题 I am trying to pass an integer parameter N to cake and return a list of size N of the square of 2 (for the sake of example). e.g. bakery:cake(3) => [4,4,4] Here is what I have attempted so far: -module(bakery). -export([cake/1]). Foo = fun(X) -> X * X end. cake(0) -> []; cake(N) when N > 0 -> [ Foo(2) | cake(N-1) ]. When I compile the code c(bakery). in erl however, I get the following error trace: bakery.erl:4: syntax error before: Foo bakery.erl:7: variable 'Foo' is unbound error I am still

RabbitMq 3.6.1安装

ぃ、小莉子 提交于 2019-12-07 13:16:36
RabbitMQ3.6.1的安装方法跟以前的版本有点不一样,我在网上找了很多资料,基本都是3.1左右的版本,而且安装过程很繁琐,所以我花了一下午的时间研究如何实现最简安装。为了让大家少走弯路,就把安装过程记录了下来,也便于以后如果忘记了好查阅。3.6最大的特点就是不用再运行make命令了,而是直接解压就可以用。下面是具体步骤: 1. 首先下载RabbitMQ,地址为:http://www.rabbitmq.com/install-generic-unix.html。这里我们下载的是generic unix的版本,下载的文件名为:rabbitmq-server-generic-unix-3.6.1.tar.xz。xz是一个使用LZMA压缩算法的无损数据压缩文件格式,是绝大数linux默认就带的一个压缩工具。其解压方式为xz -d {要解压的文件名},解压出来是一个tar文件,我就可以用tar文件的解压方法tar -xvf {解压出来的tar文件名}。 tar解压出来是一个叫rabbitmq_server-3.6.1的文件夹,为了便于管理我们把它移动到/usr/local/bin下。 到此为止RabbitMQ的基本安装就完成了,这个版本是不需要其他额外的编译和安装的。 2. 安装最新版的Erlang,因为RabbitMQ是基于Erlang开发的。记住:一定要用最新的版本

Starting the erlang VM without epmd

谁说我不能喝 提交于 2019-12-07 13:11:26
问题 I'm trying to startup epmd separately from the erlang vm, in order to do monitoring on the connection handling. This works fine, except for cases when the vm starts up before epmd. Is there a way to make the erlang vm start without it starting the epmd on its own? 回答1: Possible helpful questions/answers: Is there a way to stop Erlang servers from automatically starting epmd? Ensure epmd started So inline with those questions/answers, I'd suggest to make the erlang vm service depend on epmd

Is handle_info guaranteed to be executed immediately after init with timeout 0?

Deadly 提交于 2019-12-07 12:39:19
问题 I am getting a strange error report that makes me think some calls are being executed before the gen_server initialization. Here is the init code: init([ResourceId]) -> process_flag(trap_exit, true), {ok, {not_initialized, ResourceId}, 0}. Here is the handle_info that should initialize the resource. handle_info(timeout, {not_initialized, ResourceId}) -> Resource = data_store:get_resource(ResourceId), {noreply, Resource, ?CACHE_TIMEOUT}; the return value of data_store:get_resource(ResourceId)

how to handle low_entropy exception of crypto:strong_rand_bytes(N)?

六月ゝ 毕业季﹏ 提交于 2019-12-07 11:59:29
问题 I want to generate cryptographically strong pseudorandom numbers in erlang for session IDs. There is crypto:strong_rand_bytes(N). What if it throws the low_entropy exception? From http://www.erlang.org/doc/man/crypto.html#strong_rand_bytes-1 strong_rand_bytes(N) -> binary() Types: N = integer() Generates N bytes randomly uniform 0..255, and returns the result in a binary. Uses a cryptographically secure prng seeded and periodically mixed with operating system provided entropy. By default this

Call Erlang from Ruby

南笙酒味 提交于 2019-12-07 11:25:44
问题 What is the most awesome gem I should use to call Erlang functions from Ruby app? I wish to use rspec for testing some gen_server stuff. Erlectricity looking solid, but there is no something like Node#rpc, just message passing. Any ideas? 回答1: Well. I am using BERT-RPC and happy with it. http://github.com/mojombo/bertrpc 回答2: For rpc calls, rinterface might be the right option. From the README: r = Erlang::Node.rpc("math","math_server","add",[10,20]) if r[0] == :badrpc puts "Got and Error.

CouchDB installs fine for everything except execution of views on win7 x64

老子叫甜甜 提交于 2019-12-07 10:47:23
问题 Did a fresh install of Apache CouchDB on Windows 7 x64, using setup-couchdb-1.4.0_R16B01.exe Can access futon without any problem Can programmatically create databases and add documents (including views) Get the error pasted below when executing a view (even when executing the simplest default non-edited temporary map-reduce in Futon "map": "function(doc){ emit(null, doc); }" (in which case the same exact error text is shown in a browser pop-up) Does this error make sense to anyone? Where

Erlang: How to limit the memory assigned to a process

北战南征 提交于 2019-12-07 10:43:37
问题 What I'm asking is if it's possible to limit memory (heap or stack) assigned to a specific process, so that this process can't exceed it. Maybe something like "process_flag(min_heap_size, MinHeapSize)", but for the maximum heap. 回答1: You could put together some kind of process tracking gen_server that periodically checks assigned processes for memory footprint and kills them if it exceeds a certain amount. Using a combination of process_info(Pid, memory). and exit(Pid, Reason) calls, this