I have a supervisor with two worker processes: a TCP client which handles connection to a remote server and an FSM which handles the connection protocol.
Handling TCP errors in the child process complicates code significantly. So I'd prefer to "let it crash", but this has a different problem: when the server is unreachable, the maximum ...
Possible Duplicate:
Where is Erlang used and why?
What are the use cases for which Erlang does particularly better than mainstream languages and meet the investment?
...
I have two questions regarding Erlang file i/o; what is the best way to achieve in Erlang:
reading large binary files (many gigabytes) without copying the whole file into memory
reading a gzipped binary file as a decompressed stream
Thanks!
...
Suppose I have the module test.erl, and inside it is the macro TOTAL:
-module(test)
-export([...])
-define(TOTAL,(100))
...
If get_total() was defined in test.erl, I could call test:get_total(). from the REPL
How do I call ?TOTAL (the macro) outside of the module test.erl without defining a function?
...
I've figured out the Erlang-style loops: tail-recursion with functions that take all the "variables that don't vary":
%% does something, 80 bytes at a time
loop(Line, File) -> loop(Line, File, 0).
loop(Line, File, Count) ->
do_something(Line, Count),
case file:read(File, 80) of
{ok, Line2} -> loop(Line2, File, Count + 1...
Hi,
If I want my Erlang process connect with a C shared lib I use Erlang linked in port driver.
As I want my C program stores some data structures to respond to erlang calls, I must use global variables.
Is there any problem?
Thanks!
...
Hi All,
I am building a network router application using Erlang OTP framework.
In its process of running a Supervisor creates two genservers and each estagen_server:call(CurrentProcName,{BinEvent,UniqueTrxId,MdPid},infinity),blishes a tcp connection to two individual servers.
Now while running the application , It happens that one gen...
[97, 98, 99]. yields "abc", in the Erlang shell. I realize this is because the ASCII values of a, b and c are 97, 98 and 99 respectively.
So.. how would one go about returning [97,98,99] without Erlang translating it to ASCII?
...
I have a C server (a data feed handler) that has the potential to send millions of tiny messages per second across a few thousand long-lived Erlang processes. In a single day, some of these processes will receive a few thousand messages, while others will receive tens of millions. My interests are threefold:
to minimize latency — shor...
Mr Joe Armstrong says that with Erlang we might have sequential code running N times faster with N cores. Does this apply to F# also? Or is the Erlang VM designed in that way? Does F# manage processes in the OS or language?
...
By the CAP theorem, it is impossible for a distributed Erlang system to simultaneously provide all three of the following guarantees:
Consistency (all Erlang runtimes, or nodes, see the same data at the same time)
Availability (node failures do not prevent survivors from continuing to operate)
Partition Tolerance (the system continues ...
For my logging I wanted the ability to macro out the statements at compile time, so -define to the rescue!
For my compiler flags I'm compiling with erlc -DFOO, is there a way for -ifdef to determine the difference between FOO = ok, FOO/0, and FOO/1?
-module(foo).
-define(FOO, ok).
-define(FOO(X), io:format("~p~n", [X])).
-export([tes...
I tried to do something similar to http://stackoverflow.com/questions/1894363/how-to-make-two-different-source-directories-in-a-makefile-output-to-one-bin-dire/1895096#1895096, so I have these files (relative to my project root):
Emakefile:
% EMakefile
% -*- mode: erlang -*-
{["src/*", "src/*/*", "src/*/*/*"],
[{i, "include"}, {outdir,...
I realize that they are different beast used to solve different problems, but I would like to ask for an enumerated list of advantages of Erlang over node.js (and vice-versa). When would you use one over the other?
...
I have a list of JSON objects (received from a nosql db) and want to remove or rename some keys. And then I want to return data as a list of JSON objects once again.
This Stackoverflow post provides a good sense of how to use mochijson2. And I'm thinking I could use a list comprehension to go through the list of JSON objects.
The par...
I'm trying to learn some Erlang and having trouble figuring out the best approach for a particular problem. Here's what I'm doing:
I have a big 2-D array of data (list of lists) whose values are calculated by independent processes. The processes send a message back to an aggregator with the result when they're done calculating. My probl...
Is there any alternate Erlang interpreter?
...
I have the following code
loop(Data) ->
receive
{Key, Value} ->
[{Key, Value}|Data];
{Key} ->
member(Key, Data);
14 loop(Data);
stop ->
io:format("server_stopped"),
ok
end .
and I get the following error (I put the line number 14 in the code)
./dist_erlang.erl:14: syntax error before: ';...
I start a process as follows
start() ->
register (dist_erlang, spawn(?MODULE, loop, [])),
ok.
But get the following error when trying to run start().
Error in process <0.62.0> with exit value: {undef,[{dist_erlang,loop,[]}]}
The module is called dist_erlang.
What am I doing wrong?
Thanks
...
hi
I am interesting what are the limits for gen_tcp:accept function?
I mean what is max concurrent connection count?
Or how can it be configured? (gen_tcp setting, ulimit or something else)
how much get_tcp can accept connection per second?
...