erlang

How to receive stdio and error_logger messages on a remote shell

After spending a good while getting rb to work on a remote shell, I would like to get stdio / error logger messages on a remote shell, I have dug around changing group_leaders but it would seem to require changing the group_leader of all the running process, and my experiments have found that to be pretty unstable. ...

Using the erlang mysql module, how is a database connection closed?

In using the erlang mysql module the exposed external functions are: %% External exports -export([start_link/5, start_link/6, start_link/7, start_link/8, start/5, start/6, start/7, start/8, connect/7, connect/8, connect/9, fetch/1, fetch/2, fetch/3, prepare/2, execute/1, execute/2, ...

Is it possible to package an Erlang program as a .exe file?

It has to be self contained, some sort of Erlang runtime library, and the BEAM files. This is so that anyone can run the program with one click, by running a .exe off a network drive, without having to install Erlang or anything else. ...

Which DB (SQL) is better supported in Erlang ?

Hello! What do you recommend me to use with Erlang -- MySQL or Postgres ? Which DB has better (more mature, more stable, faster) driver for Erlang ? ...

Passing local variables to Erlydtl block

Hi, I've got a block of erlydtl code which I use repeatedly and would like to abstract to some kind of block / partial template. The issue is that I need to pass the block a local variable. This is possible with Rails partial templates; it looks like it's possible with Django's blocks [albeit with some kind of Python hackery]; I'm wonde...

Starting inets/httpd with custom application

I've got a module that I'm attempting to turn into a proper OTP application. Currently, the module has start/0 which starts a genserver which supplies configuration data read from a config file. It then calls inets:start(httpd,config:lookup(httpd_conf)). I gather that I need to move the starting of these out into the .app file's (appl...

Log out of an SSH session into Erlang VM without stopping the VM or leaving stale processes

I have an Erlang application running as a daemon, configured as an SSH server. I can connect to it with an SSH client and I get the standard Erlang REPL. If I 'q().' I shut down the Erlang VM, not the connection. If I close the connection ('~.' for OpenSSH, close the window in PuTTY) some processes remain under the sshd_sup/ssh_system_...

AMQP 'connection.open' reserved parameters

I am writing an AMQP Client Library in Erlang. For the 'connection.open' method, there are 2 reserved parameters "documented" in AMQP 0.9.1 out of a total of 3. When I send the method in question without the "reserved parameters", I get "unable to decode method" in the error log. What should I be sending as value for those "reserved p...

Any tips on how to build Erlang Beam files?

I am currently using: c(module_name) : to build my Erlang files ones by one, and I was wondering about how other people handle the build process for Erlang when they have multiple files ...

Erlang Edoc in Emacs

Let's say that I have an Erlang function, with spec. -spec foo(integer(), string()) -> boolean(). foo(_Integer, _String) -> true. My dream would be to generate the edoc from this information within Emacs automatically. The generated code should look like: %%-----------------------------------------------------------------...

Do Scala and Erlang use green threads?

I've been reading a lot about how Scala and Erlang does lightweight threads and their concurrency model (actors). However, I have my doubts. Do Scala and Erlang use an approach similar to the old thread model used by Java (green threads) ? For example, suppose that there is a machine with 2 cores, so the Scala/Erlang environment will ...

Erlang: How to view output of io:format/2 calls in processes spawned on remote nodes.

Hello, I am working on a decentralized Erlang application. I am currently working on a single PC and creating multiple nodes by initializing erl with the -sname flag. When I spawn a process using spawn/4 on its home node, I can see output generated by calls io:format/2 within that process in its home erl instance. When I spawn a proce...

Matching and deleting items in list of tuples

I have a list of tuples, say [{x, a, y}, {x, b, y}]. Is there a built-in function (or can I use a combination of BIFs) to delete all tuples matching {x, _, y}, as in match and delete based on the first and third term in the tuples, ignoring the second? ...

Where are tables in Mnesia located?

I try to compare Mnesia with more traditional databases. As I understand it tables in Mnesia can be located to (see Memory consumption in Mnesia): ram_copies - tables are stored in ets, so no durability as in ACID. disc_copies - tables are located to ets and dets, so the table can not be bigger than the available memory? And if the ta...

Concept of GUI's - Centralized or decentralized

Hello all, Since a few months I've been learning Erlang, and now it was time to do some basic GUI. After some quick research I saw there was an interesting library called 'wxi' (based on Fudgets of Haskell) which uses a different approach on GUI's. No central loop, every widget processes it's own events and handles it's own data. What...

bad_application error starting erlang gen_server application

I have written a simple erlang app using gen_server. When starting it with application:start(myapp), I get the following tuple... {error,{bad_application,{appliction,myapp ... (rest of my application config). There are no other error or warning messages. I have also tried to google examples of how to configure gen_server and also the...

Erlang-style light-weight processes in .NET

Is there any way to implement Erlang-style light-weight processes in .NET? I found some projects that implement Erlang messaging model (actors model). For example, Axum. But I found nothing about light-weight processes implementation. I mean multiple processes that run in a context of a single OS-thread or OS-process. ...

Overuse of guards in Erlang?

Hi, I have the following function that takes a number like 5 and creates a list of all the numbers from 1 to that number so create(5). returns [1,2,3,4,5]. I have over used guards I think and was wondering if there is a better way to write the following: create(N) -> create(1, N). create(N,M) when N =:= M -> [N]; create(N,M) ...

How to read/write from erlang to a named pipe ?

I need my erlang application to read and write through a named pipe. Opening the named pipe as a file will fail with eisdir. I wrote the following module, but it is fragile and feels wrong in many ways. Also it fails on reading after a while. Is there a way to make it more ... elegant ? -module(port_forwarder). -export([start/2, forwa...

Supervising multiple gen_servers with same module / different arguments

Hi, I have a OTP application comprising a single supervisor supervising a small number of gen_servers. A typical child specification is as follows: {my_server, {my_server, start_link, [123]}, permanent, 5000, worker, [my_server]} No problems so far. I now want to an add extra gen_server to the supervisor structure, usi...