erlang

how to use rebar to create an erlang module with an eunit test?

六月ゝ 毕业季﹏ 提交于 2019-12-25 09:42:10
问题 My goal is quite simple; while I am learning Erlang, I would like to use rebar to create a basic module with an eunit test: I have tried the following: mkdir erlangscratch cd erlangscratch rebar create template=simplemod modid=erlangscratch Edit the 'test/erlangscratch_tests.erl' to look like this: -module(erlangscratch_tests). -include_lib("eunit/include/eunit.hrl"). % This should fail basic_test_() -> ?assert(1 =:= 2). Execute the tests: snowch@tp:~/erlangscratch$ rebar co eu ==>

Kernel pid terminated application start failure, bad_return

落花浮王杯 提交于 2019-12-25 09:32:04
问题 I wrote a cowboy project that I start on localhost with gmake run . When I make run on a fresh installation, this error happens: ~/tunnel# make run erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html make[1]: Entering directory `/root/tunnel/deps/cowboy' ../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html make[2]: Entering directory `/root/tunnel/deps/cowlib' ../../erlang.mk:24: Please upgrade to GNU

Erlang module mod_confirm_delivery doesn't works with Ejabberd 16.03

心已入冬 提交于 2019-12-25 09:30:11
问题 I'm developing an Android Chat app and i'm trying to run the Erlang module mod_confirm_delivery in order to receive all the messages sent when the user suddenly lose the internet connection (but still appears online on the server). The module start correctly but doesn't works on Ejabberd 16.03, in fact all the messages sent to the "offline" user are lost, i've made some adaptations because the module was created for an older version of Ejabberd, but seems is not enough for make it working. I

CouchDB will not install as a service on Azure Windows VM

。_饼干妹妹 提交于 2019-12-25 08:50:01
问题 I have previously installed CouchDB on my Azure Windows VM (Classic) without any problems using the installer setup-couchdb-1.6.1_R16B02.exe downloaded from http://couchdb.apache.org/ Today I have uninstalled the existing CouchDB installation and service with the intention of installing it again from scratch. Unfortunately, whenever I run the installer now it fails to create a windows service. More info: I am running the installer and the command tool as Administrator I have removed existing

Issue when registering two local process with gproc within cowboy websocket handler

北战南征 提交于 2019-12-25 08:24:47
问题 I tried to register a bunch of processes with a unique family name with gproc under a cowboy websocket handler. In my handler I created two method, the first one is to handle registration: websocket_handle({text, <<"Reg: ",Message/binary>>}, State) -> io:format("Client ~p requesting to register ~n",[Message]), MyPID=list_to_binary(pid_to_list(self())), {[{_,Family}]}=jiffy:decode(Message), io:format("Client ~p requesting to register ~n",[Family]), Test = gproc:reg({p, l, Family}), erlang

Cannot expand $ERTS_LIB_DIR in bootfile

纵然是瞬间 提交于 2019-12-25 08:17:11
问题 I created a release using rebar3 but I have issues running/booting the app on my remote server. When i run the following command: $> /home/app/releases/0.0.1# erl -boot start I get the following error: {"init terminating in do_boot",'cannot expand $ERTS_LIB_DIR in bootfile'} init terminating in do_boot (cannot expand $ERTS_LIB_DIR in bootfile) Crash dump is being written to: erl_crash.dump...done What am I doing wrong? 回答1: How are you creating a release? If you do something like rebar3 as

Register a new user in ejabberd using Erlang

岁酱吖の 提交于 2019-12-25 03:45:19
问题 I am using erlang 17, ejabberd 14.07. I am trying to create chat application, For that I have to create user for ejabberd using Erlang. I have search but nothing found useful. There are three ways to do registration as far I have explored. Using command line From localhost Using other api Is there any method in ejabberd which help me to register new user? I am new in Erlang and ejabberd so it becomes useful to me if you describe step if any configuration required. 回答1: Do you mean that you

Regexes work in PHP and don't in Erlang. Why?

这一生的挚爱 提交于 2019-12-25 03:22:35
问题 I tried to rewrite url parsing function written in PHP to Erlang. And I found that these regex don't work in Erlang but work fine in PHP code. Can you tell why and how to make it work with Erlang. Loose = "^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((?:\/(\w:))?(\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)". re:compile( Loose ). {error,{"nothing to repeat",166}} Strict = "^(?:([^:\/?#]+):)?(?

Regexes work in PHP and don't in Erlang. Why?

风流意气都作罢 提交于 2019-12-25 03:22:10
问题 I tried to rewrite url parsing function written in PHP to Erlang. And I found that these regex don't work in Erlang but work fine in PHP code. Can you tell why and how to make it work with Erlang. Loose = "^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((?:\/(\w:))?(\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)". re:compile( Loose ). {error,{"nothing to repeat",166}} Strict = "^(?:([^:\/?#]+):)?(?

How to read from post param?

丶灬走出姿态 提交于 2019-12-25 02:44:11
问题 I need to parse text file. This file is in post param. I have code like this: upload_file('POST', []) -> File = Req:post_param("file"), What should I do next? How to parse it? 回答1: What's inside Req:post_param("file") ? You assume it's a path to a file: have you checked the value of File ? Anyway, it's Req:post_files/0 you are probably looking for: [{_, _FileName, TempLocation, _Size}|_] = Req:post_files(), {ok,Data} = file:read_file(TempLocation), It's also probably a Bad Idea to leave the