erlang

How to use Eunit:test() generate a xml file which include some compling info

荒凉一梦 提交于 2019-12-12 02:08:18
问题 I have some erlang file(.erl).And I compile them. Now I want to use some function to generate a xml which is about the compling info of these files. Here is a address, http://www.erlang.org/doc/apps/eunit/eunit.pdf In this pdf,There is a function eunit:test/2 which can generate a xml file. eunit:test([fib, eunit_examples], [{report,{eunit_surefire,[{dir,"."}]}}]). But i don't know these parameters represent. I just know fib = modulename dir = generate location.What about eunit_examples?

Erlang supervisor exception on starting worker

隐身守侯 提交于 2019-12-12 02:05:49
问题 I'm playing with code for supervisor trees taken from http://learnyousomeerlang.com/building-applications-with-otp but I get a noproc exception that I can't figure out when I try to get a supervisor to start the child process. This is my shell interaction: 1> application:start(test). root supervisor init ok 2> test_sup:start_service(service_sup,{service_worker, start_link,[]}). {ok,<0.39.0>} worker supervisor initialise (M: service_worker,F: start_link,A: []) 3> test_app:run(service_worker,[]

Why chunk is returning some code while reading the file in Erlang/ChicagoBoss

旧时模样 提交于 2019-12-12 01:56:02
问题 Further to my old question, We are generating XML using following code: download_xml('GET', [])-> Xml =generateXML(123445), %% generated Xml data in string without any values 400,.etc Filename = export_xml:get_file_name(?SESSION_ID1, ?SESSION_ID2), Filepath = "./priv/static/" ++ Filename, TotalSize = filelib:file_size(Filepath), {ok, FP} = file:open(Filepath, [read]), Generator = fun(FH) -> case file:read(FH, 1024) of %% But this line is causing something that we never wanted. eof -> file

Why is my cowboy server not running?

走远了吗. 提交于 2019-12-12 01:22:52
问题 I'm trying to run my server. I copied my src files into a fresh cowboy install, this is the error I'm getting. ~/cowboy_ninja:.ls src action_handler.erl gate.beam resolution.beam arena.beam gate.erl resolution.erl arena.erl guestbook.beam temple.beam cowboy_ninja_app.erl guestbook.erl temple.erl cowboy_ninja_sup.erl hello_handler.erl ~/cowboy_ninja:. cat src/cowboy_ninja_app.erl -module(cowboy_ninja_app). -behaviour(application). -export([start/2]). -export([stop/1]). start(_Type, _Args) ->

How to use dialyzer with parse transform modules

最后都变了- 提交于 2019-12-12 00:44:48
问题 I'm trying to use dialyzer on my erlang application but here's the output : dialyzer \ --src -r src \ -pa /home/niahoo/src/popos \ -pa /home/niahoo/src/popos/deps/parse_trans \ --verbose Checking whether the PLT c:/MinGW/msys/1.0/home/niahoo/.dialyzer_plt is up-to-date... yes Proceeding with analysis... dialyzer: Analysis failed with error: Could not scan the following file(s): [{"c:/MinGW/msys/1.0/home/niahoo/src/popos/src/tools/r.erl", ["c:/MinGW/msys/1.0/home/niahoo/src/popos/src/tools/r

Why the error “function_clause”,about erlang,mongodb-erlang,mongodb

天涯浪子 提交于 2019-12-12 00:42:03
问题 Sorry for my pool Englsih!:-) My code is here: http://pastebin.com/zus6dGdz I just want to use the poolboy as my database connection pools,and i use the mongodb-erlang as my driver to communicate with the mongodb. After running it,from the shell report,I am sure that the mongodb-erlang has created the pools for me ***************************Debug********************************* Module:db_mongo_handler Line:73 Database Connection:<0.174.0> ***************************Debug*********************

Elixir: how can I leverage release_handler?

帅比萌擦擦* 提交于 2019-12-11 23:33:08
问题 I know there are projects such as exrm which do that for you, and it seem to do it extremely well. However, I would like to manually play with release_handler for educational purposes, and I find little documentation or articles on the subject. 回答1: Have you read the Learn You Some Erlang article about release handling? Doing upgrades with release handler is both easy and difficult. Easy because once you know all the nitty gritty details it's pretty much automatic. But difficult, because

Linux 部署 RabbitMQ 集群

不羁的心 提交于 2019-12-11 23:29:10
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Linux 部署 RabbitMQ 集群 rabbitmq centos7 阅读约 13 分钟 一般情况下,如果只是为了探究 RabbitMQ 或者验证业务工程的正确性那么在本地环境或者测试环境上使用其单实例部署就可以了,但是出于 MQ 中间件本身的可靠性、并发性、吞吐量和消息堆积能力等问题的考虑,在生产环境上一般都会考虑使用 RabbitMQ 的集群方案。 本文档旨在介绍 RabbitMQ 集群的工作原理以及在 CentOS 7 系统上安装配置具备高可用性和具备一定负载能力的 RabbitMQ 集群。 RabbitMQ 集群工作原理介绍 RabbitMQ 这款消息队列中间件产品本身是基于 Erlang 编写,Erlang 语言天生具备分布式特性(通过同步 Erlang 集群各节点的 magic cookie 来实现)。因此,RabbitMQ 天然支持 Clustering。这使得 RabbitMQ 本身不需要像ActiveMQ、Kafka 那样通过 ZooKeeper 分别来实现 HA 方案和保存集群的元数据。集群是保证可靠性的一种方式,同时可以通过水平扩展以达到增加消息吞吐量能力的目的。 RabbitMQ 集群有两种模式: 默认模式 ,以两个节点 mq1 和 mq2 为例来进行说明。对于 Queue 来说

Erlang gen_server communication

天涯浪子 提交于 2019-12-11 23:14:57
问题 If I have several instances of server, how can I pass info from one to another, for example: I have this: ... -record(id,{name,hash}). -record(state, {id ,m, succ, pred}). start(Name, M) -> gen_server:start_link({local, Name}, ?MODULE, {new_ring, Name, M}, []). join_ring(Name, Other) -> gen_server:start_link({local, Name}, ?MODULE, {join_ring, Name, Other}, []). ... init({new_ring, Name, M}) -> Me=#id{name=Name,hash=M} {ok, #state{ id = Me, m = M, succ = Me, pred = nil, }}; init({join_ring,

Presence Stanze for ejabberd NOT working via mod_rest module

空扰寡人 提交于 2019-12-11 20:06:18
问题 Currently i am using ejabberd 14.05 server and using it`s mod_rest module to update the presence of the user from server based on a certain condition from a 3rd party web service. But i am not able to post the presence stanza to update the presence of user. Below are my finding. command using to invoke the presence stanza via mod_rest. curl --verbose --data "World" -X POST servername:5280/rest/ -H "Content-Type: text/xml" -H "Accept: application/xml" logs. ==> error.log <== 2014-12-12 03:00