Questions tagged [erlang]
Erlang is a general-purpose, garbage-collected programming language and runtime environment, with built-in support for concurrency, distribution and fault tolerance.
9,363
questions
1
vote
1
answer
16
views
What are the requirements for position of custom attributes in an Erlang module?
It seems:
Dialyzer and erlc both error when there is a user-defined attribute in a source file before -module
Shell session demonstrating:
~ cat sample.erl
-my_attr(my_value).
-module(sample).
-...
0
votes
0
answers
24
views
Phoenix channels, How I kick a user from a channel?
So I am trying to understand the workflow in kicking a user from a channel. I have a command I can issue to the channel #kick username. This is handle by a handle in which parse the message and will ...
0
votes
1
answer
22
views
Sending Raw Tcp Packet Using NetCat to Erlang Server
I am trying to create a TCP Server which will store incoming TCP Packets as binary, for a Key/Value Store. I already have an Erlang client which can send TCP packets to my Erlang Server, however for ...
0
votes
1
answer
29
views
error Performing erlang migration to another node
I have 2 nodes rabbit2 and rabbit3 everything is working fine until i start cluster
then I did the command
scp -r rabbit2:/var/lib/rabbitmq/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie .
and after ...
1
vote
1
answer
43
views
How to visualize a graph data structure?
I'm looking for a way to plot or visualize a graph made in Erlang using the digraph module. In the manual pages I can't find any function for doing this.
How do I plot or visualize a graph?
0
votes
2
answers
64
views
How can I identify a complete response when receive lot of packets in concurrent TCP requests
I have a single TCP connection to a server, but possibly have multiple requests at the same time. Most of the time the response will be so big that I would constantly receive lot of data chunks. It's ...
1
vote
0
answers
38
views
Erlang wont start. Unable to load emulator (beam.smp.dll)
I had Erlang 21.2 installed as I am using RabbitMQ (3.7.10), this is on Windows 10. I wanted to upgrade to a later version RabbitMQ (3.9.15), so I uninstalled 21.2 and installed 24.3.3. But after ...
1
vote
2
answers
66
views
How to write these nested for-loops in Erlang
I want to implement this psuedo code in Erlang:
function()
B[1] <-- 1
for m <-- 2 to 21 do ...
1
vote
1
answer
67
views
High erlang process memory executing mnesia:dirty_select/2
I have an mnesia table gen_saga_persist which is queried by a process every 1 second.
The function used is mnesia:dirty_select(gen_saga_persist, [{#gen_saga_persist{id = '$1', app = undefined, ...
2
votes
1
answer
30
views
Erlang Database Join Association
Iam just wondering how to implement Mnesia tables join association efficiently, in other terms I want to know how to implement Nested SQL queries in Mnesia, for example consider we have 3 tables : ...
1
vote
1
answer
36
views
Why am I getting permission denied on my Travis CI build for rebar?
I ran a build, on Travis CI and got a permission denied error:
$ source ${TRAVIS_HOME}/otp/23.0/activate
3.01s$ ./rebar get-deps /home/travis/.travis/functions: line 355: ./rebar: Permission denied ...
0
votes
0
answers
42
views
Erlang IO blocking native calls best practices
I've done a lot of reading lately about calling my C code from Erlang. My C code will be making a remote call and I expect to have a timeout of ~10 seconds. In order to keep Erlang responsive and ...
1
vote
1
answer
31
views
Are Erlang funs garbage collected?
If one generates funs in erlang, are they garbage collected? For instance to replicate a python like iterator or to read a stream, one may generate funs for every yield -- potentially a great many. ...
1
vote
2
answers
37
views
In Erlang's EUnit, assert that a function was called with an anonymous function
I have some code that looks like this:
-module(ca_data).
-export([delete_ca_data/1]).
% ...
delete_ca_data(N) when N < 1 -> ?NEGATIVE_ID_ERROR;
delete_ca_data(N) -> util_db_generic:...
2
votes
1
answer
49
views
Erlang multiple mnesia databases in the same application or in a application tree dependency
To use mnesia, the path on the filesystem to the relative mnesia scheme to be used must be set as the environment variable of the application(application:set_env('path_to_schema')).
Now 2 questions ...
1
vote
1
answer
51
views
How to validate day and time in Erlang?
How do I validate today is business day and also current time is in between two time? I tried below code but I can only check after or before time.
is_past_15() ->
{_, {Hour, _, _}} = calendar:...
1
vote
1
answer
47
views
How to set lager.error_logger_hwm in RabbitMQ by rabbitmqctl command
This How to set error_logger_hwm in the new RabbitMQ .conf configuration file format? not suitable for my situation which running rabbitmq(RabbitMQ 3.7.10 on Erlang 20.2.2 -- Ubuntu 16.04) by docker ...
0
votes
1
answer
69
views
Write a program to spawn a new process, which recieves X an integer and returns X+1. It exits if a non integer message is passed to it in erlang?
I am new to erlang and I have done the code, But I need the right answer format for this question. Here's my code. If I enter any Integers then it'll have to add 1 to that number. If character or ...
1
vote
1
answer
27
views
Upgrade from RabbitMQ 3.6.9 to 3.8 Windows server(Erlang 20.01)
Can you help with the RabbitMQ update?
I need to upgrade from version 3.6.9 to version 3.8
Erlang version 20.01
What steps do I need to follow?
1
vote
1
answer
56
views
Phoenix framework installation fail
Im trying to start developing in Phoenix framework on Linux Mint Uma
and Im running Erlang OTP 22, Elixir 1.9
Im following the official installation guide and the problem is -- I cannot install ...
1
vote
1
answer
22
views
how to find "wx" module version from erlang shell?
I use module_info() as follows, the vsn field doesn't contain the version information. How to translate 190640877967407394157636569138961474448 to wx version?
From erlang 24.3.3,
wxErlang Reference ...
1
vote
0
answers
30
views
which include file has contain "wxEVT_WEBVIEW_LOADED" macro?
erlang 24.3.3 is used.
From the 24.3.3 document, the wx version is 2.1.3.
I have find 2.1.3's wx.hrl and it doesn't contain the wxEVT_WEBVIEW_LOADED and wxEVT_WEBVIEW_ERROR.
But in the doc, it says
...
1
vote
2
answers
76
views
erlang maps key pattern match
I am newer to erlang, I have a map like #{"a/.+":"v1", "b/c/.+": "v2"}
I want to get value by input key like "a/d" to match "a/.+" and get &...
1
vote
1
answer
20
views
How to specify the ".erlang" to use when "erl" command is called?
The original .erlang contains code:add_pathz("/Users/xxxxx/Documents/Project/CY2/keyboard/ebin").
It is located at the ~/.erlang.
The another erlang start file contains
code:add_pathz("/...
1
vote
0
answers
19
views
What's the meaning of “stdlib: Object code (filename) out of date erlang”?
erlang 24.3.3, rebar3 are used.
rebar3 as default keyboard
show the following message
bash-3.2$ rebar3 as default tar
===> Verifying dependencies...
===> Analyzing applications...
===> ...
1
vote
0
answers
25
views
Why does RabbitMQ becomes unresponsive?
RabbitMQ 3.7.13 on Microsoft Windows Server 2012 R2 Standard 32GB RAM 48GB page file
Very low utilization - 10 queues , 20 clients , hundreds of messages per day , < 1MB size
Ran fine for 1 year ...
0
votes
0
answers
35
views
How to change indentation of lambdas for Erlang in spacemacs?
No matter what I try I can't make lambdas indent with 4 spaces. They always land with 8:
fun() ->
8
end
instead of desired
fun() ->
4
end
I tried adding to my user config following ...
0
votes
0
answers
33
views
erlang 23 24 version, get_stacktrace problem, All related library need to upgrade?
I am trying to use erlang jit and webview function. It only exists in erlang 24.
Because erlang 24's
erlang:get_stacktrace
not allowed to use, I have changed it in my application.
Like rebar3, add ...
1
vote
1
answer
44
views
Implementing N-dim arrays in Erlang
I have an Erlang project requiring generating a nested list of array indices. Perhaps using arrays: would be a quick solution, but I would like to see how this is done without that module.
If one ...
1
vote
1
answer
40
views
Beam VM Scheduler vs OS Scheduler
Beam VM breaks the program into small, light-weight processes and has its own scheduler. How does this scheduler works alongside the underlying OS scheduler ? If these are processes, then OS will ...
1
vote
1
answer
48
views
Could not validate time whether is greater or lesser in erlang
Problem in validating current time whether it is greater or lesser than time which is in 24 format in erlang
scenario : have to auto reply after 3clk.
1
vote
3
answers
52
views
Implement a lists:map using case clauses instead of function clauses in Erlang
Can anyone tell me what this means? I am new to this and my friend recommended me to post in this website.
By the way I'm new to Erlang.
If possible I want to write a code in editor and I don't even ...
1
vote
2
answers
57
views
Deploying Elixir Docker to Heroku. Can't set long node name
I'm trying to deploy a Dockerfile to Heroku and when the app starts, it immediately crashes with this error:
=INFO REPORT==== 2-Apr-2022::16:20:30.959748 ===
Can't set long node name!
Please check ...
1
vote
2
answers
59
views
Is there a better way to write Head and Tail without using fun?
f6(List) ->
[Head2 | Tail2 ] <- [List],
Head2.
Tail2.
Hello there I have been trying to figure out the way to use Head and Tail without using fun and for the ...
1
vote
1
answer
50
views
Elixir Timezone Comparison for UTC and DateTime Struct
I am trying to compare two datetimes to see if they overlap. However, one is a DateTime struct and the other is a ~U[] time - this is how they come out of the database. I cannot work out how to do ...
1
vote
1
answer
58
views
Is there any special syntax for shell to editor for erlang?
I am new to erlang, I have been learning to code on console/command prompt. Now I have to do the below code on editor. I need the sum of given numbers (a list [1,2,3]) with foldl/3 function.
lists:...
0
votes
2
answers
63
views
Where should the erlang_ls.config go
I want to use coc.nvim and elrang_ls in vim8.2. There are some problems. It report missing an erlang_ls.config when I open a erlang file. But i have erlang_ls.config in project root.
the result of ...
1
vote
0
answers
24
views
How to solve the wxGrid class no "findWindowById" function?
In the wxframe, there is one button and one "wxGrid" object.
I want to "click“ the function to change the "wxGrid".
But wxStaticText hasn't function for "findWindowById&...
1
vote
1
answer
40
views
Reading files in Erlang
I have an Erlang app that fetches some key/value pair from files.
In one of the files, instead of the key/value pairs, I have a path to a different folder, in which it has the key/value pairs.
The ...
0
votes
0
answers
13
views
make-basic.publish with default value for exchange gives exception error: bad argument
I'm trying to follow the RabbitMq hello world tutorial in Lisp Flavoured Erlang. The tutorial is for Elixir, with the help of Erlang RabbitMQ client user guide I try to translate the steps to LFE. ...
1
vote
1
answer
38
views
Failed install Rabbitmq (3.9) server does not startup because it needs older ssl library required by Erlang running on Ubuntu 20.04.4
I'm setting up a new server on Ubuntu 20.04.4 I installed rabbitmq and when starting up the service I'm hitting an error: Failed to load NIF library /usr/lib/erlang/lib/crypto-5.0.5/priv/lib/crypto ...
0
votes
2
answers
45
views
Splitting lines read from file into array of key-value pairs in Erlang
I have a txt file with N key-value pairs:
key_1=val_1
key_2=val_2
key_N=val_N
I need to read this file and set those to an array:
Attributes = [
{key_1, val_1},
{key_2, val_2},
{key_N, ...
1
vote
1
answer
36
views
Erlang - How is the creation integer (a part of a distributed pid representation ) actually created?
In a distributed Erlang system pids can have two different representations: i) internal; ii) external.
The internal representation has the following shape: < A.B.C >
The external representation, ...
4
votes
1
answer
66
views
How to debug Elixir with erlangs GUI debugger on Ubuntu-based linux?
I installed Erlang and Elixir as recommended in the Elixir documentation for Ubuntu & Debian.
The results of running elixir -v:
Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:32:32] [ds:32:32:...
1
vote
0
answers
47
views
erlang lists:foreach/lists:foldl/lists:foldr consumes more memory than using tail recursion
I ran a query using nested lists:foreach on the list of size 15000, each having lists of size about 37.
This query consumed more than 5 Gb of memory, but when query was ran using tail recursion memory ...
0
votes
1
answer
43
views
Erlang: Cannot start supervisor on another node
I have a simple supervisor that looks like this
-module(a_sup).
-behaviour(supervisor).
%% API
-export([start_link/0, init/1]).
start_link() ->
supervisor:start_link({local,?MODULE}, ?MODULE, []...
1
vote
2
answers
74
views
Why Are So Many Guard Expressions in Ifs Illegal?
I am writing a function that will push a value to a list on a map if the key already exists, or init the key on the map with a new list if it does not already exist.
I tried making this part of the ...
0
votes
1
answer
43
views
Erlang: ets table does not persist data after gen_server crashes and restarts
I have a gen_server which stores positions of objects in an ets table like this
-module(my_gen_server).
-record(slot, {position, object}).
-behavior(gen_server).
%% API
-export([start_link/1, init/1, ...
0
votes
1
answer
62
views
Erlang: gen_server in supervisor does not restart at the last known state
I'm working in Erlang with a supervisor that looks like this:
-module(a_sup).
-behaviour(supervisor).
%% API
-export([start_link/0, init/1]).
start_link() ->
supervisor:start_link({local,?...
1
vote
0
answers
20
views
Cannot find supervisor and gen_servers in Erlang observer
I'm running a simple supervisor with a couple of children and I want to see how the supervisor tree structure looks using Erlang Observer. I start the Erlang shell, initiate the supervisor and then ...