erlang

Accessing Erlang business layer via REST

For a college project i'm thinking of implementing the business layer in Erlang and then accessing it via multiple front-ends using REST. I would like to avail of OTP features like distributed applications, etc. My question is how do I expose gen_server calls/casts to other applications? Obviously I could make RPC calls via language spe...

C libraries for parsing Erlang binaries?

I have an erlang server that will be communicating via tcp sockets with a client written in C. Are there any C libraries for parsing erlang binary terms to C structs? I realize this is not absolutely necessary, but it would be very convenient. ...

How can i split a binary in erlang

What I want is, I think, relatively simple: > Bin = <<"Hello.world.howdy?">>. > split(Bin, "."). [<<"Hello">>, <<"world">>, <<"howdy?">>] Any pointers? ...

Learning Erlang? speedbump thread, common, small problems

Hi, I just want know all the small problems that got between you and your final solution when you were new to Erlang. For example, here are the first speedbumps I had: Use controlling_process(Socket, Pid) if you spawn off in multiple threads. Right packet to the right thread. You going to start talking to another server? Remember to...

Ruby in Erlang

Is it possible to embed Ruby into Erlang? Would Yecc be the correct tool for that? If it is possible how many man hours would it take, rough estimate? ...

Erlang and run-time record limitations

Im developing an Erlang system and having reoccurring problems with the fact that record's are compile time pre-processor macros (almost), and that they cant be manipulated at runtime... basically Im working with a property pattern, where properties are added at run-time to objects on the front-end (AS3). Ideally I would reflect this wi...

Scalaris: P2P key-value database - your opinion please.

Why wouldn't you use Scalaris? ...

Erlang : Disallowed Nodes / Maybe Cookie question.

Trying to get two erlang nodes talking to each other : one on a Ubuntu machine and one on Windows XP. We're getting a "Connection attempt from disallowed node" message which prevents one node receiving messages from the other. They're both using 5.XXX versions of Erlang OTP. Both nodes have the same cookie ( .erlang.cookie) We are s...

How to rename the Node running a mnesia Database

I created a Mnesia database / Schema on machine1. The node was named mypl@machine1. I then moved all files to machine2, because machine1 broke down. Everything runs fine as long as the code is running with the name "mypl@machine1". Obviously this is somewhat confugsing, because it is now running on machine2. If I start Erlang with the n...

Erlang: doing a good job

I've done a bit of functional programming, and I have a couple online references, so I'm finding basic Erlang programming pretty easy. But since I've done far more procedural/object-oriented programming than functional programming, I expect my Erlang code isn't very well styled or efficient. Can anybody recommend any resources that cov...

Unexpected behavior of io:fread in Erlang

This is an Erlang question. I have run into some unexpected behavior by io:fread. I was wondering if someone could check whether there is something wrong with the way I use io:fread or whether there is a bug in io:fread. I have a text file which contains a "triangle of numbers"as follows: 59 73 41 52 40 09 26 53 06 34 10 51 87 86 81...

How/why do functional languages (specifically Erlang) scale well?

I have been watching the growing visibility of functional programming languages and features for a while. I looked into them and didn't see the reason for the appeal. Then, recently I attended Kevin Smith's "Basics of Erlang" presentation at Codemash. I enjoyed the presentation and learned that a lot of the attributes of functional p...

Erlang Quiz

Hi, folks. Many of you sometimes face with interesting code, problems, solutions. And all of this could be used as good interview questions or just for fun as any other quiz. Could you please share such things? I think it would be interesting to create an Erlang quiz - a list with good questions and answers. ...

Distinctive traits of the functional languages

It is known that all functional languages share some basic properties like using functions as basic building block for programs with all the consequences like using recursion instead of iteration. However, some fundamental differences also exist. Lisp uses a single representation for both Lisp code and data, while ML has no standard repr...

Erlang Building Dynamic File Names

I am trying to create a file with a name based on an integer value from a function, clearly below does not work but gives you the idea : getValue() -> 1. createFile() -> {ok, File} = file:open( getValue(), [write]), io:format(File,"Test~n"), file:close(File). This ought to be simple, even with Erlangs lack of support for...

gen_server named timer_server caused timer module functions to not return

I created a supervisor that spawned a gen_server I called timer_server. One of the tasks of this timer_server is to manage registration and call timer:send_interval to send a message to a pid on a certain interval. However, in the init of the gen_server, where I call timer:send_interval I was getting a lockup. The documentation said t...

Gracefully terminating an Erlang server or fsm?

I have a module that has the behavior of gen_fsm. Right now I am terminating it by returning the standard {stop, Reason, State} in an appropriate state/message. It seems to terminate correctly, but it's considered an error during runtime. Is this normal? Is there a way to stop the fsm process without it being considered an error? ...

[F#] Mailbox Processor on Distributed Systems

I noticed the following comment in my copy of Expert F# on page 379: Passing and Processing Messages A distinction is often made between shared-memory concurrency and message passing concurrency. The former is often more efficient on local machines and is covered in the section "Using Shared-Memory Concurrency" later i...

Process balancing in Erlang

Does anybody knows if there is a sort of 'load-balancer' in the erlang standard library? I mean, if I have some really simple operations on a really large set of data, the overhead of constructing a process for every item will be larger than perform the operation sequentially. But if I can balance the work in the 'right number' of proces...

Mnesia transactions

hello accidentally some code that I'm writing is slowly turning into a DB system on its own, with incremental indexing, freeform "documents" (aka CouchDB kind) which can have arbitrary properties... annyyywaay... I decided to keep evolving it, mainly for educational purposes, and also to really tightly customize it just for my needs and ...