I came across the following statement in Trapexit, an Erlang community website:
Erlang is a programming language used
to build massively scalable soft
real-time systems with requirements on
high availability.
Also I recall reading somewhere that Twitter switched from Ruby to Scala to address scalability problem.
Hence, I won...
Say I have some function fn1() in Erlang which returns {ok, Result} if the function was executed successfully and {error, "ErrorReason"} if there was an error.
Now in another function fn2() I call fn1() and I need to check the result of fn1 and proceed only if it is {ok, Result}.
I figured, I can do this using either case or try catch...
What is the proper way to embed the inets:httpd module inside an existing application?
I would like an example / guidelines to achieving this, please.
Updated: I want to be able to start an inets:httpd service dynamically from within an existing application. I do not want a solution which leverages a boot script as using this method do...
Is it possible to cascade supervisors inside an application?
E.g. supervisor sup1 spawning a child process which creates a supervisor sup2 ?
...
Is erlang considered managed or do you have to handle memory/pointers?
...
erlang and scala, do they run on apache?
...
I've installed Erlang through macports on my macbook and I'm trying to use the Erlang Eclipse plugin, but it needs me to point it to the $ERL_TOP directory.
Where does that exist? I know my erl binary shell is located at:
which erl
/opt/local/bin/erl
...
I need to write a server that will receive instructions from other modules and take actions depending on the instructions received. Efficiency is my main concern. So do I use gen_server or do I write my own server. By "my own server" I mean something like:
-module(myserver).
-export([start/0, loop/0]).
start() ->
spawn(myserver...
What is the appropriate place for performing inets:start() ?
in `applicationname_app' module?
in applicationname_sup supervisor module?
in a child process hanging from the supervisor?\
someplace else?
(I am still struggling with inets:httpd)
Note: the answer cannot be to the tune " use a boot file " , please.
...
I am looking to make use of Erlang's hot code swapping feature on a gen_server, so that I don't have to restart it. How should I do that? When I searched, all I could find was one article which mentioned that I need to make use of gen_server:code_change callback.
However, I could not really find any documentation/examples on how to use...
Q: I'd like to have an idea of the pros and cons of defining multiple behaviors in the same module file.
E.g.
-module(someapp_sup).
-behavior(supervisor).
-behavior(application).
Using this sort of layout, I can save a module file whilst not loosing much on the maintainability side (the whole application is started through someapp...
How do I specify a working directory for mnesia without resorting to passing the "dir" parameter on the command-line?
In other words, can I specify a "working directory" for mnesia just before calling `mnesia:start()' ?
...
Is there a side effect to calling mnesia:create_schema() on each application start?
From what I keep reading, this function should only be called once per database instance. Is it a big issue to call it more than once on an existing database?
...
We're looking for a framework in which we can assign multiple roles to different users and allow those users to in turn manipulate certain data (based on their role). We have an ejabberd backend and a Mochiweb (BeepBeep framework) front end, and the nodes are connected so Mochiweb can manipulate ejabberd's mnesia tables.
Does a direc...
I want to be able to read a file just as it is being uploaded by the user, i.e. I want to read the incoming stream of bytes from the user's browser.. Is that possible with Mochiweb? If not, where do I need to look/modify?
If something else easier exists on Yaws, that will also be great. Thanks.
...
Hi, I am trying to run all unit tests using eunit inside a folder but it seems like timeout always reset to 5 seconds.
e.g.
Module:
-module(example).
-include_lib("eunit/include/eunit.hrl").
main_test() ->
% sleep for 10 seconds
?assertEqual(true, begin timer:sleep(10000), true end).
Command line:
Eshell V5.7.3 (abort wit...
What is the difference between "include_lib" and "include" ?
E.g.
-include_lib("eunit/include/eunit.hrl")
...
First of all sorry for my English.
I would like to use a backtracking algorithm in Erlang. It would serve as a guessing to solve partially filled sudokus. A 9x9 sudoku is stored as a list of 81 elements, where every element stores the possible number which can go into that cell.
For a 4x4 sudoku my initial solution looks like this:
[[1...
Our Mnesia DB is running slowly and we think it should be somewhat faster.
So we need to profile it and work out what is happening.
There are a number of options that suggest themselves:
run fprof and see where the time is going
run cprof and see which functions are called a lot
However these are both fairly standard performance ...
I'm just wondering if there is a ready implementation of zip-function in the standart erlang library. Something like that:
zip([H1|T1], [H2|T2], Acc)->
zip(T1, T2, Acc ++ [{H1, H2}]);
zip([], [], Acc) ->
Acc.
...