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.

Erlang is a general-purpose functional programming language and runtime environment. It has built-in support for concurrency, distribution and fault tolerance. Erlang is used in several large telecommunication systems from Ericsson. Erlang is open source and available for download on GitHub.

Some Erlang features:

Online Resources:

Erlang Books:

9600 questions
43
votes
2 answers

Erlang: what is the difference between "include_lib" and "include"?

What is the difference between "include_lib" and "include" ? E.g. -include_lib("eunit/include/eunit.hrl")
jldupont
  • 93,734
  • 56
  • 203
  • 318
42
votes
1 answer

Erlang/Elixir on Docker and Hot Code Swap

One of the features of Erlang (and, by definition, Elixir) is that you can do hot code swap. However, this seems to be at odd with Docker, where you would need to stop your instances and restart new ones with new images holding the new code. This…
Marc Trudel
  • 1,244
  • 1
  • 12
  • 19
42
votes
3 answers

How do you create and load modules dynamically at runtime in Elixir, or Erlang?

The basic scenario is this: I need to load text from a database, and then turn that text into an Elixir module (or an Erlang module) and then make calls into it. The text is effectively the same as a module file. So this is a form of hot code…
nirvana
  • 4,081
  • 4
  • 25
  • 29
41
votes
5 answers

How do you write a fun that's recursive in Erlang?

I'm trying to write a recursive fun in an Erlang shell, but I keep getting an unbound variable exception: 1> Foo = fun(X) -> Foo(X) end. * 1: variable 'Foo' is unbound This probably goes without saying, but I'm not trying to create an infinite…
allyourcode
  • 21,871
  • 18
  • 78
  • 106
41
votes
4 answers

How to define an function in the eshell (Erlang shell)?

Is there any way to define an Erlang function from within the Erlang shell instead of from an erl file (aka a module)?
yazz.com
  • 57,320
  • 66
  • 234
  • 385
39
votes
1 answer

Remove not_exist_already node from mnesia cluster(scheme)

I have a bad node (it doesn't exist) in the mnesia cluster data when I get: > mnesia:system_info(db_nodes) [bad@node, ...] How do I remove it from the cluster? I tried: > mnesia:del_table_copy(scheme, bad@node). {aborted,{not_active,"All replicas…
vinnitu
  • 4,234
  • 10
  • 41
  • 59
38
votes
2 answers

How did WhatsApp achieve 2 million connections per server?

On Ubuntu, the maximum number of sockets which can be opened seems to be governed from following: $ cat /proc/sys/net/ipv4/tcp_max_orphans 262144 As per one of the presentations by Rick Reed (from WhatsApp), these guys took it up to 2 million…
Piyush Kansal
  • 1,201
  • 4
  • 18
  • 26
38
votes
0 answers

Chicago Boss: Routes does not work in production mode?

I created the rahm_test_controller.erl file in src directory, and added an action named hello. In /priv/rahm.routes, I added this line for home page: {"/",[{controller,"test"}, {action, "hello"}]}. If I launch the server with ./init-dev.sh, it…
Mr.Wang from Next Door
  • 13,670
  • 12
  • 64
  • 97
38
votes
16 answers

Windows x64 RabbitMQ install error with Erlang environment var (ERLANG_HOME)

I'm ask/answering this question because it hung me up & it's likely someone else will have the same problem. Install of RabbitMQ x64 v2.8.6 on Windows Server 2008 x64. After Erlang install using default install location to C:\Program…
Kevin Won
  • 7,156
  • 5
  • 36
  • 54
37
votes
4 answers

How to perform actions periodically with Erlang's gen_server?

I want to start a gen_server that additionally, will perform one action every minute. What is the best way to schedule that?
Piotr Usewicz
  • 620
  • 2
  • 6
  • 13
37
votes
5 answers

When does Erlang's parallelism overcome its weaknesses in numeric computing?

With all the hype around parallel computing lately, I've been thinking a lot about parallelism, number crunching, clusters, etc... I started reading Learn You Some Erlang. As more people are learning (myself included), Erlang handles concurrency in…
Jon Smock
  • 9,451
  • 10
  • 46
  • 49
36
votes
14 answers

RabbitMQ, Erlang: How to "make sure the erlang cookies are the same"

I am using RabbitMQ with Grails, and a problem cropped up this morning. When I run rabbitmqctl status it tells me: C:\Users\BuildnTest2>rabbitmqctl status Status of node 'rabbit@BUILDNTEST2-PC' ... Error: unable to connect to node…
Mikey
  • 4,692
  • 10
  • 45
  • 73
36
votes
6 answers

How to write a simple webserver in Erlang?

Using the default Erlang installation what is the minimum code needed to produce a "Hello world" producing web server?
yazz.com
  • 57,320
  • 66
  • 234
  • 385
35
votes
4 answers

How does the Erlang compiler implement pattern matching?

I am wondering how pattern matching is usually implemented. for example in Erlang do you think its implemented at the byte-code level( there's a byte-code for it so that its done efficiently) or is it generated as a series of instructions (series of…
deepblue
  • 8,426
  • 13
  • 48
  • 60
35
votes
6 answers

Authentication failed (rejected by the remote node), please check the Erlang cookie

I installed erlang and rabbitmq in the way mentioned in the official documentation. But then, when I do this C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.0\sbin>rabbitmqctl add_user XXXXXX YYYYYYY it gives me the following error... Error:…
Jit
  • 633
  • 2
  • 6
  • 10