erlang

Erlang gen_server vs stateless module

Hi, I've recently finished Joe's book and quite enjoyed it. I'm since then started coding a soft realtime application with erlang and I have to say I am a bit confused at the use of gen_server. When should I use gen_server instead of a simple stateless module? I define a stateless module as follow: - A module that takes it's state as a ...

How to navigate to erlang function in emacs by name?

I use emacs-mode. How can I navigate to function definition by name? Emacs has "imenu-add-to-menubar" command but it's not convenient way because I have to select function name from menu. Thank you! ...

XMPP programming use erlang or java?

I'm interested to hear feedback from a guru out there. If you are a java programmer, I'm sure you are familiar with openfire, while erlang programmers are familiar with ejabber. Which project has bigger community when doing programming in XMPP? ...

Event manager process in erlang. Named processes or Pids?

I have event manager process that dispatches events to subscribers (e.g. http_session_created, http_sesssion_destroyed). If Pid is used instead of named process, I must put it into functions to operate with event manager but if Named process is used, code will be more clear. Which variant is right? Thank you! ...

Where is Erlang used and why?

I would like to know a list of the most common application/websites/solutions where Erlang is used, successfully or not. Explaining why it is used into a specific solution instead of others programming languages would be very much appreciated, too. Listing BAD Erlang case studies (cases in which Erlang is misused) it would be interesti...

Erlang corba tutorial or example?

Can anyone point me at a good tutorial or example of using Erlang for a CORBA client. I have an existing CORBA server written in another language, and need to connect to it using Erlang. ...

Erlang JSON libraries: serialization performance?

There are a number of JSON libraries available for Erlang, and it's not clear to me which have the best performance characteristics (and, secondarily, ease of use), especially for erlang-to-json serialization. My use case requires both JSON parsing and serialization, but the Erlang code will probably be producing at least two orders of ...

erlang on google app engine ?

I know python can be run on GAE what is different erlang and python in lay man term? can erlang run on google app engine ? ...

erlang: uuid generator

What module/library do you use to generate uuid? ...

pattern match in formal parameter of function definition

Here's something I've seen in erlang code a few times, but it's a tough thing to google and I can only find this example (the first code block in link below): http://www.process-one.net/en/wiki/ejabberd%5FHTTP%5Frequest%5Fhandlers/ In the "head" of function definition of process/2 process(_LocalPath = ["world"], _Request) -> there i...

erlang list manipulation

I have a list of tuples: L = [{1, [a, b, c]}, {2, [d, e, f]}, {3, [[h, i, j], [k, l, m]]}] this is what I have lists:map(fun({_, B}-> B end, L). the output is [[a, b, c], [d, e, f], [[h, i, j], [k, l, m]]] what I want is: [[a, b, c], [d, e, f], [h, i, j], [k, l, m]] it seems a pretty easy problem, but I can't figure out how ...

How to do Erlang pattern matching using regular expressions?

When I write Erlang programs which do text parsing, I frequently run into situations where I would love to do a pattern match using a regular expression. For example, I wish I could do something like this, where ~ is a "made up" regular expression matching operator: my_function(String ~ ["^[A-Za-z]+[A-Za-z0-9]*$"]) -> .... I know...

What does this Erlang statement do?

I have this Erlang code: not lists:any(fun(Condition) ->Condition(Message) end, Conditions). Can anyone please explain the entire statement in layman's terms? For your information Condition is a function, Conditions is an array. What does fun(Condition) ->Condition(Message) end mean? As well as meaning of not lists:any. ...

erlang emakefile explain

i have an emakefile look like below %% -- %% %% -- {'/Users/user/projects/custom_test/trunk/*', [debug_info, {outdir, "/Users/user/projects/custom_test/trunk/ebin"}, {i, "/Users/user/projects/custom_test/trunk/include/."}]}. 1.can someone please explain in lay man term what does each item in the list means? 2. how to run the emake...

Process dictionary or loop parameters?

When should I use process-wide dictionary and when should my process state be in the parameters of the loop function? This: loop() -> receive {From, subscribe} -> put(listeners, [From|get(listeners)]), ?MODULE:loop() end. Or this: loop(Listeners) -> receive {From, subscribe} -> ?MODULE:loop([From|...

How to get the current node name in an erlang cluster?

I have a function named "message/2" in my module named "message_passing",This function is called in another function hash/1;;;now here is the problem. I need 3 nodes named node1,node2,node3, but when i want to get the current node in a variable named "Current_Node" it dosnt work. It shows an error. It is unable to get the current node in...

How do I split strings in Erlang?

I've been playing around with the splitting of atoms and have a problem with strings. The input data will always be an atom that consists of some letters and then some numbers, for instance ms444, r64 or min1. Since the function lists:splitwith/2 takes a list the atom is first converted into a list: 24> lists:splitwith(fun (C) -> is_ato...

Erlang Pattern matching with aliases

Hi, is there a possibility to match in a function definition do some subset of a touple and still get get complete touple in the method ? What I would like to do is something like this: myfun({ foo, Bar }: Var) -> otherfunction(Var, stuff). instead of: myfun({ foo, Bar }) -> otherfunction({ foo, Bar }, stuff). I hope this is clear...

Help me improve this Erlang?

So I'm really interested in Erlang. I can't find an excuse to use it for anything big, but I try to use it for toy problems from time to time. Right now, I'm implementing a Roman Numeral translator. I'm just doing the "to" part for now, and I'm finding the code is awfully repetitive. It works like a charm, but, well, just look at it:...

How to convert numbers to words in Erlang?

I found this interesting question about converting numbers into "words": http://stackoverflow.com/questions/309884/code-golf-number-to-words I would really like to see how you would implement this efficiently in Erlang. ...