erlang

Erlang/OTP R13B ARM binary download

Is there a site where Erlang/OTP binaries for ARM-Linux can be downloaded? www.erlang.org only has source release (and I haven't managed to cross-compile it on the initial attempts), while http://cean.process-one.net/downloads/ only has R12B. ...

What OS threads get used in Erlang’s abstract machine, BEAM?

I’ve begun studying Erlang and find the BEAM runtime environment fascinating. It’s commonly stated that in Erlang, processes belong to the language rather than the OS (meaning the runtime, meaning BEAM in this case). These are the lightweight, “green processes” that Erlang is getting famous for. It’s further stated (on page 5 of this pap...

Binary search in Erlang in lg(n) time .

I was searching through the possible work arounds for doing Binary search in Erlang and I found http://ruslanspivak.com/2007/08/15/my-erlang-binary-search/ But I was wondering if the solution in blog runs in O(lg n). Now since the recurrence for Binary search is:T(n) = T(n/2) + c which gives me an execution time of O(lg n). Since in a ...

Date to Megaseconds

Is there any easy way to convert from erlang datetime notation to the now/0 notation? Basically I need the inverse of this function: {Date, Time} = calendar:now_to_datetime(now()). So something like {Megaseconds, Seconds, Microsecods} = datetime_to_now({Date, Time}) ...

erlang mnesia - illegal record info

I am trying to have a function that ensures the table I need is already created and if not to create it. Here's the sample: ensure_table_exists(Table, MnesiaTables, Nodes) -> case lists:member(Table, MnesiaTables) of true -> throw({error, db_might_have_already_been_created}); false -> mnesia:create_table(Table, [...

erlang semaphore (mutex)

i found example of mutex in erlang Can somebody modify it to use it with count like semaphore? -module(mutex). -export([start/0, stop/0]). -export([wait/0, signal/0]). -export([init/0]). start() -> register(mutex, spawn(?MODULE, init, [])). stop() -> mutex ! stop. wait() -> mutex ! {wait, self()}, receive ok ...

return a list consisiting of the elements from tuples

How does one return e.g. the first element of a tuple? I would like to take a list of 2 element tuples and return the second element of each tuple as a new list. ...

Erlang node connectivity problem

Hello everyone, Struggling with connecting 2 nodes running on separate boxes. Tried to make sure that there is no usual problems with cookie synchronization, DNS or firewall. First, I run epmd in debug mode as recommended by Erlang docs: epmd -d -d Then on box #1: erl -name [email protected] -kernel inet_dist_listen_min 6000 inet_di...

Failure when trying to cross-compile Erlang R13B04 for ARM

I am trying to cross-compile Erlang and running into a weird bug. The commands used are make clean ./otp_build configure --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnu --prefix=/opt/erlang erl_xcomp_sysroot=~/sbctools/arm-2007q3 --disable-hipe --disable-threads --disable-smp --disable-megaco-flex-scanner-lineno --disable-m...

erlang, writing integer values to a file

I want to print integer values to a file. I am able to write string values to the file, but I try to write integer value it gives an error %this works fine {ok, F}=file:open("bff.txt", [read,write]), Val="howdy", file:write(F,Val). %this gets compiled, but results in error {error, badarg} while executing {ok, F}=file:open("bff.txt", [r...

remove not_exist_already node from mnesia cluster(scheme)

i have bad node (it is already not exists) in mnesia cluster data when i get > mnesia:system_info(db_nodes) [bad@node, ...] how to remove it from cluster? i do > mnesia:del_table_copy(scheme, bad@node). {aborted,{not_active,"All replicas on diskfull nodes are not active yet"... what is mean? what can i do to fix it? ...

how to backup/restore only single table from/to mnesia?

I have some big tables with disc_only_copies type. Now I need change short node name to long but cannot do it with RAM limitation... Can I use backup/restore database partly (table by table)? ...

Efficient Erlang Port Driver

Hi, I want to spawn Erlang processes that will communicate with a C program through a Port Driver. As spawning many of these processes can be inefficient, can I spawn one Erlang process that receives messages and queue these messages for processing with the C Program? As this C program starts to wait for incoming jobs, will it block? ...

Logging libraries for Erlang/OTP

For logging activity of an Erlang/OTP application, do you simply use a wrapper over disk_log or some other libraries? ...

Sorting Erlang records in a list?

Hi, I have a record in erlang: -record(myrec, { id = 0, price = 0, quantity = 0 }). I then have a list of records that I want to sort by id and price, both in descending and ascending order, where price is the first key and if two records have the same price I want to sort those by id. How can I define a f...

Newbie's question for Erlang dict.

I'm reading Programming Erlang by Joe Armstrong(Pragmatic Bookshelf). In name_server.erl source code on Chapter 16, Where's Dict variable from? Calling dict:new() generates Dict automatically? And, reference says that dict:new() creates dictionary. Don't I need to store it as a variable like Dict = dict:new()? -module(name_server). -exp...

Is there a pure Erlang cryptography library with support for AES?

I need to use AES encryption in my embedded Erlang application, but OpenSSL is unavailable for my target system and so the crypto library from OTP can't be built. I probably could cross-compile OpenSSL as well, but I would prefer a pure Erlang solution to remove another dependency. Does one exist? ...

String chomping match expression with bound variable

Hi, The following shell sessions shows some behavior I would like to understand: 1> A = "Some text". "Some text" 2> "Some " ++ R = A. "Some text" 3> R. "text" 4> B = "Some ". "Some " 5> B ++ L = A. * 1: illegal pattern Surely statements 2 and 5 are syntacticially identical? I would like to use this idiom to extract some text from a s...

[RabbitMQ] Use it for JSON data transfer

I am trying to use RabbitMQ for a distributed system that would work something like: a producer puts in a queue a JSON-formatted list of order ids several consumers pull out of that queue, do the business logic with that order ids and the result (JSON formatted) as well is put back into another queue from the second queue, another cons...

Erlang: using include from the console?

The include directive is usually used for a .hrl file at the top of an .erl file. But, I would like to use include from the Erlang console directly. I am trying to use some functions in a module. I have compiled the erl file from the console. But, the functions I want to use do not work without access to the hrl file. Any suggestion...