erlang

performance penalty of message passing as opposed to shared data

There is a lot of buzz these days about not using locks and using Message passing approaches like Erlang. Or about using immutable datastructures like in Functional programming vs. C++/Java. But what I am concerned with is the following: AFAIK, Erlang does not guarantee Message delivery. Messages might be lost. Won't the algorithm and...

ejabberd ip address

Does anyone know if there's a direct way to map an IP address to a user logged into ejabberd? I found an indirect way by modifying ejabberd_receiver.erl and calling inet:peername(Socket) from here: http://stackoverflow.com/questions/1240312/determining-ip-address-and-port-of-an-incoming-tcp-ip-connection-in-erlang but there doesn't see...

Messing with erlang and gen_event behaviour

In a concept proof I'm developing, I've built the folowing scheme: _ A _ _ / | \ \ SS S H CC / \ C C In which: A - Application SS - Supervisor CC - "Real" client S - gen_server H - gen_event C - "internal" client The application works like a multiplexer. I connect on my internal client on my server and request so...

Providing robust message delivery in Erlang

This is in relation to the ongoing discussion in my previous Question http://stackoverflow.com/questions/1810313/performance-penalty-of-message-passing-as-opposed-to-shared-data One of issues being discussed was the amount of work needed to distributed algorithms in Erlang using Message Passing vs. Shared state. My viewpoint is that ...

What is the best language for sockets programming?

I'd like to develop software program that communicates between clients. What is the best programming language to do this? ...

Integrating Erlang with C++

What interfaces exist to tie Erlang with C++? ...

Common use cases of erlang

What are common use cases of erlang? I know about it in general, but I am looking for specific examples. Are the following some situations where Erlang might be useful? A distributed Job scheduler. (Take complex multi-staged jobs from a job queue and assign it to worker threads that will perform each thread of it and then pass along th...

It's a good idea use ruby for socket programming?

My language of choice is Ruby, but I know because of twitter that Ruby can't handle a lot of requests. It is a good idea using it for socket development? or Should I use a functional language like erlang or haskell or scala like twitter developers did? ...

Benefit to the ".app" file in Erlang?

I've never really used the .app files for my projects. I understand those are required for loading an application through the application module. Is there another use of such files? ...

Mochiweb Log files

Anyone know where Mochiweb logs files by default? I'm running it along with the Beepbeep framework. ...

Mochiweb debug (like ejabberd debug)

I was wonderng if anyone knows of a way to get into Mochiweb like ejabberd does when you run /sbin/ejabberdctl debug? ...

Erlang (Functional Programming) vs Object Oriented Programming in terms of thinking

I am learning Erlang and I am trying to create a very sample blog program. However my mind currently is trapped in the OO world (var p = new Post(); p.Title = ""; p.Save();). I would like to understand some basic thinkings in Erlang. Instead of creating Post object what I should do in terms of data structure (p.Title, p.DateCreated, p.Bo...

case issue in erlang

Hi Working with erlang- case I m facing a propblem.following is the problem other langauges:- switch(A) { case "A" : case "B" : //do-somthing break; } so using erlang how to achieve the same thing..because some times it very important to put condition like this..to avoid overhead. Thanx in Advance. ...

Erlang : Breaking out of lists:foreach "loop"

I have a list of elements in Erlang, and I'm using lists:foreach to traverse through the elements in the list. Is there a way to break out of this "foreach loop" in the middle of the traversal. For eg: suppose I want to stop traversing the list further if I encounter a '1' in the list [2, 4, 5, 1, 2, 5]. How do I do this? ...

Erlang : Mnesia : Updating a single field value in a row

I have an mnesia table with three fields, i, a and b, created using the record -record(rec, {i, a,b}). Now I insert a row into the table as: mnesia:transaction( fun() -> mnesia:write("T", #rec{i=1, a=2, b=3}, write) end ). Now what do I do if I want to update this row, and change only the value of a to 10, while leaving i and b wit...

Problems gen_tcp:accept

I've made a tcp server witch spawns a process to listen incoming connections. Here is the sample code (removed a few things from my original code): module a: main([]) -> { ok, Pid } = b:start(), receive _ -> ok end. module b: -define(TCP_OPTIONS, [binary, { active, false}, { packet, 0 } , ...

Convert nested Lists into a List of Tuples

I have the following list ["txtvers=1","userid=3A6524D4-E31C-491D-94DD-555883B1600A","name=Jarrod Roberson","version=2"] I want to create a Dict where the left side of the = is the key and the right side is the value. Preferably where the key is an atom. Using the following list comprehension I get this. KVL = [string:tokens(T,"=")...

Current state of Erlang web development? Frameworks, Template languages

Django is to Python as Rails is to Ruby. What is the current front-runner for Erlang? Recent Erlang web activity has resulted in many new frameworks but they are all still moving targets. ErlyWeb is very far along but now seems to be dead. If you were to invest significant capital into a new web product (i.e. not a hobby, you use you...

Erlang : Mnesia : Lookup and update based on fields other than the key

I have a table in mnesia and I need to update individual fields in the records in it. According to http://stackoverflow.com/questions/1820996/erlang-mnesia-updating-a-single-field-value-in-a-row if I do something like: update_a(Tab, Key, Value) -> fun() -> [P] = mnesia:wread({Tab, Key}), mnesia:write(Tab, P#rec{a=Value}, write...

Erlang: runtime overhead of function parameter decoration?

Is there a runtime overhead if I use this sort of decoration? get_next_state(_SPid=undefined, _NextPort=undefined) -> stop; ...