erlang

Erlang (rebar?): fixing “potentially included by two different application” errors

时光毁灭记忆、已成空白 提交于 2019-12-25 02:37:05
问题 So I need to build riak from git snapshot, (note: there's also a recent official snapshot sharing same problem). During build, following happens: Generating dev1 - node='dev1@127.0.0.1' yzsolrjmx=10013 yzsolr=10014 pbc=10017 http=10018 handoff=10019 (cd rel && ../rebar generate target_dir=../dev/dev1 overlay_vars=vars/dev1_vars.config) ==> rel (generate) ERROR: generate failed while processing /tmp/riak/rel: {'EXIT',{{badmatch,{error,"Module mochijson2 potentially included by two different

test with loop in erlang

我的未来我决定 提交于 2019-12-25 01:58:11
问题 I have a list of values ​​ "Z0010", "Z0011", "Z0012", "Z0013" "Z0014", "Z0015", "Z0016", "Z0017", "Z0018", "Z0019" I want to develop a function that takes a value in parameter and I want to do a test in my function if the value passed as a parameter is equal to a value in the list in this cases it will show "existe" if not it displays "not existe" I try with : test(Token)-> case get_user_formid_by_token(Token) of {ok, H} -> FormId=string:substr(H, 2, length(H)), Form=string:to_integer(FormId)

Erlang: invoking erl -eval from command line never exits

旧巷老猫 提交于 2019-12-25 01:56:02
问题 I have a simple Erlang command that I want to invoke via erl -eval (to compile erlydtl template, as described on erlydtl page). When I do it interactively from shell everything works fine and the command exits immediately: erl -pa ebin deps\erlydtl\ebin Eshell V5.9.3.1 (abort with ^G) 1> erlydtl:compile('templates/tictactoe.dtl',tictactoe_dtl,[{out_dir,'ebin'}]). ok But when I try to do it via erl -eval (I want to run this from .bat file): erl -pa ebin deps\erlydtl\ebin -noshell -eval erlydtl

Why doesnt work regex

本秂侑毒 提交于 2019-12-25 01:46:44
问题 Code Example 14> case re:run("5162754", "/^\d+$/") of {match, _} -> ok end. ** exception error: no case clause matching nomatch 15> case re:run(<<"5162754">>, "/^\d+$/") of {match, _} -> ok end. ** exception error: no case clause matching nomatch Why doesn't it match? 回答1: Two things: The regular expression you pass to re:run shouldn't be surrounded by / . In other languages, you write a regexp inside / signs, but in Erlang, regexps are always written as strings, and thus no / signs are

Erlang server request order

孤街醉人 提交于 2019-12-25 00:34:41
问题 I'm trying to understand request order in erlang, but I can't seem to grasp it very well. Here's the example code: test() -> Server = start(), spawn(fun() -> write(Server, 2), io:format(”Child 1 read ~p~n”, [read(Server)]) end), write(Server, 3), write2(Server, 5), spawn(fun() -> write2(Server, 1), io:format(”Child 2 read ~p~n”, [read(Server)]) end), io:format(”Parent read ~p~n”, [read(Server)]). And here's the server: start() -> spawn(fun() -> init() end). init() -> loop(0). loop(N) ->

centos7安装RabbitMQ

老子叫甜甜 提交于 2019-12-24 21:52:27
1,安装编译工具 yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel 2,下载并解压otp_src_18.3.tar.gz wget http://erlang.org/download/otp_src_18.3.tar.gz tar -zxvf otp_src_18.3.tar.gz 3,编译安装erlang cd otp_src_18.3 ./configure --prefix=/data/soft/erlang --with-ssl -enable-threads -enable-smmp-support -enable-kernel-poll --enable-hipe --without-javac make && make install 4,设置环境变量 vim /etc/profile 在文件末尾添加下面代码, ‘ERLANG_HOME’等于上一步’–prefix’指定的目录 ERLANG_HOME=/usr/local/erlang PATH=$ERLANG_HOME/bin:$PATH export ERLANG_HOME export PATH 使环境变量生效 source /etc/profile 输入命令检验是否安装成功 erl 如下输出表示安装成功

Call to i:im() in application debugger failed in ejabberd

荒凉一梦 提交于 2019-12-24 21:18:20
问题 I'm trying to debug ejabberd. I have compiled the files with debug_info. I start ejabberd, then use ejabberd debug to get into the shell. Once in there, running im() produces "Call to i:im() in application debugger failed". I can't figure out what's causing this. Any ideas on how to debug? Edit I've tried running this in just the erl shell independent of ejabberd and it still fails. So it looks like it's related to my erlang setup as opposed to a problem with my ejabberd setup. 回答1: Foolish

Is this a correct child spec ?

依然范特西╮ 提交于 2019-12-24 21:15:03
问题 I notice there is the code as follows in cowboy https://github.com/extend/cowboy supervisor:start_child(cowboy_sup, child_spec(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts)). child_spec(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> {{cowboy_listener_sup, Ref}, {cowboy_listener_sup, start_link, [ NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts ]}, permanent, 5000, supervisor,[cowboy_listener_sup]}. http://www.erlang.org/doc/man/supervisor.html#start

List of tuples [{id, [<List>]}, {id2, [<List>]} ] where ids are the second item of the tuple of the original list- Erlang

一曲冷凌霜 提交于 2019-12-24 19:14:59
问题 The title^ is kinda confusing but I will illustrate what I want to achieve: I have: [{<<"5b71d7e458c37fa04a7ce768">>,<<"5b3f77502dfe0deeb8912b42">>,<<"1538077790705827">>}, {<<"5b71d7e458c37fa04a7ce768">>,<<"5b3f77502dfe0deeb8912b42">>,<<"1538078530667847">>}, {<<"5b71d7e458c37fa04a7ce768">>,<<"5b3f77502dfe0deeb8912b42">>,<<"1538077778390908">>}, {<<"5b71d7e458c37fa04a7ce768">>,<<"5bad45b1e990057961313822">>,<<"1538082492283531">> }] I want to convert it to a list like this: [ {<<

erlang和rabbitmq安装(0)

为君一笑 提交于 2019-12-24 18:50:40
1. erlang下载地址(之前官网下载的有问题): https://bintray.com/rabbitmq/rpm/erlang/20.3.8.9-1 2. 安装erlang & rabbitmq: rpm -ivh erlang-20.3.8.9-1.el6.x86_64.rpm rpm -ivh rabbitmq-server-3.7.8-1.el6.noarch.rpm 3. 启动 1): rabbitmq前台启动 rabbitmq-server start 2): rabbitmq后台启动 rabbitmq-server -detached 4. 查看所有插件列表: rabbitmq-plugins list -v 4.1 启动插件: rabbitmq-plugins enable rabbitmq_management 5. 创建用户: rabbitmqctl add_user nie 1234 6. 设置角色: rabbitmqctl set_user_tags nie administrator 7. 设置默认vhost("/")访问权限 rabbitmqctl set_permissions -p "/" nie "." "." ".*" 来源: 51CTO 作者: 海德堡绝尘 链接: https://blog.51cto.com/coffee/2300742