erlang

How to handle deps while using rebar to release?

情到浓时终转凉″ 提交于 2019-12-06 05:43:23
问题 I'm using rebar generate to handle release, but when I start the application, the deps I use will not be found.` I can start the application manually using erl -pa ./ebin ./deps/*/ebin -s myapp . I'm wonder how to config rebar.config and reltool.config to handle dependencies? Thanks. 回答1: In order for reltool to generate a release which includes the dependencies, you will need to add them to reltool.config . I have an application called drill_instructor , which has the following reltool

Allocating memory in Erlang C NIF

给你一囗甜甜゛ 提交于 2019-12-06 05:29:23
Why would one use void *enif_alloc_resource(ErlNifResourceType* type, unsigned size) as opposed to void *enif_alloc(size_t size) when trying to allocate memory from an Erlang C NIF? Reference does not specify much as to why. http://www.erlang.org/doc/man/erl_nif.html#enif_alloc enif_alloc_resource is used to create resources which are garbage collected by the vm when not used any more. enif_alloc works just like malloc, only is uses an Erlang VM specific implementation rather than the OSs malloc. Take a look at the documentation for ErlNifResourceType and the functions which use it for some

Parallel power set generation in Erlang?

。_饼干妹妹 提交于 2019-12-06 05:13:46
There is a lot of example implementations of generating a powerset of a set in Java, Python and others, but I still can not understand how the actual algorithm works. What are the steps taken by an algorithm to generate a power set P(S) of a set S? (For example, the power set of {1,2,3,4} is {{}, {1}, {2}, {1,2}, {3}, {1,3}, {2,3}, {1,2,3}, {4}, {1,4}, {2,4}, {1,2,4}, {3,4}, {1,3,4}, {2,3,4}, {1,2,3,4}}.) UPD: I have found this explanation, but still I don't get it. I am trying to understand the algorithm of generating a power set, because I would like to write a parallel implementation of it

Erlang xml to tuples and lists

无人久伴 提交于 2019-12-06 05:09:26
问题 I'm very excited to be starting my erlang journey, but I've been stuck on this for a few days now and I'm starting to get scared I won't meet my deadline. I'm trying to create key, value pair tuples out of xml. I'd like to make a list out of any nested xml. It seems like a very common thing to do, but I can't find any examples. For instance: <something> <Item> <name>The Name!</name> <reviews> <review> <review-by>WE</review-by> <review-points>92</review-points> </review> <review> <review-by>WS

Generate all possible subgraphs of a directed graph keeping the number of vertices

我怕爱的太早我们不能终老 提交于 2019-12-06 05:07:29
I have two lists of vertices: V and S . I would like to generate all possible directed graphs from V and S so, that each vertex from V has only one out-edge and exactly one in-edge, and each vertex from S can have any number of in- and out- edges. Each graph in the result should contain exactly all vertices from V and from S . The result can contain both connected and disconnected graphs. First I thought it was a powerset-related problem, but powerset has many other sets that may contain just one element (and I do not need those). My current strategy is to: find all pairs between vertices from

When to use erlang application:start or included_applications and a supervisor?

。_饼干妹妹 提交于 2019-12-06 04:50:42
问题 I have an Erlang application which has a dependency in its deps directory on another application. From what I understand I can either; a) start my dependent application from my including application by calling application:start(some_other_app) which starts the application and shows it running standalone within Observer. b) include my dependent application in my .app file with {included_applications, [some_other_app]} so that the application is loaded and not started and then start the

Rebar: “Release mynode uses non existing application mynode”

空扰寡人 提交于 2019-12-06 04:47:19
问题 I've been trying to set up a simple Erlang app using Rebar but can't get it to work. I followed the instructions on http://skeptomai.com/?p=56 to the letter, and when I run ./rebar -v generate , I get this error: ==> Entering directory `/home/adam/erlang-test3/testing-rebar/apps/myapp' WARN: 'generate' command does not apply to directory /home/adam/erlang-test3/testing-rebar/apps/myapp ==> Leaving directory `/home/adam/erlang-test3/testing-rebar/apps/myapp' ==> Entering directory `/home/adam

Extracting C functions signatures for Erlang

寵の児 提交于 2019-12-06 04:43:10
I was wondering what the most suitable tool is for extracting c (and eventually c++) function names, arguments and their types from source code. I would like to use a tool that can be automated as much as possible. I want to extract the signature types then have the output read by another program written in Erlang. My goal is to use this information to construct the equivalent of the C types/signatures in Erlang (using ei). I would like this process to work for any C file so I can't use any hardcoded stuff. I have found a lot of tools that look promising like CLang, CScope and ANTLR and so on

Running erlang shell as a daemon/service

可紊 提交于 2019-12-06 04:35:46
问题 I have an Erlang program that runs in Erlang shell, obviously, and I want to monitor it. This is what I want: When the machine starts the Erlang shell should start up with it, and the program that runs in the shell too. If the Erlang shell crashes for some reason it should get restarted. You should be able to manually start/stop/restart the Erlang shell. Example: /etc/init.d/foobar start /etc/init.d/foobar stop /etc/init.d/foobar restart I haven't started with the whole "restart itself if

ERROR: Could not find 'wxe_driver.so'

…衆ロ難τιáo~ 提交于 2019-12-06 04:32:34
问题 I got this error on my ubuntu when I run debugger:start(). Erlang R14B02 (erts-5.8.3) [source] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] Eshell V5.8.3 (abort with ^G) 1> debugger:start(). =ERROR REPORT==== 14-Feb-2012::17:57:27 === ERROR: Could not find 'wxe_driver.so' in: /usr/local/lib/erlang/lib/wx-0.98.9/priv {ok,<0.36.0>} I want to know how to fix the error in order to use debugger ? 回答1: Are you running the default erlang running on ubuntu? Unfortunately there is no longer