erlang

Online mnesia recovery from network partition

Is it possible to recover from a network partition in an mnesia cluster without restarting any of the nodes involved? If so, how does one go about it? I'm interested specifically in knowing: How this can be done with the standard OTP mnesia (v4.4.7) What custom code if any one needs to write to make this happen (e.g. subscribe to mnes...

Has anyone used rinda, pylinda, or the like?

Does anyone have any experience with rinda, the ruby library for the linda blackboard system? Most specifically, I'm curious about the possibility of using it to provide a ruby interface (with some sort of shim) to some extant erlang code via the tuplespace. So any knowledge about the protocol it uses would be great. But more generall...

What is the difference between multicore programming in Erlang and other language?

I read Joe Armstrong's 'Programming Erlang', and the 'n times faster in n core machine' theory. The efficient way to multicore programming in Erlang is to use lots of processes (threads). I'm a C++ programmer, so I am curious about the difference between making lots of threads in C++ and making lots of processes in Erlang. I understand ...

How can I make sure N threads run at roughly the same speed?

I'm toying with the idea of writing a physics simulation software in which each physical element would be simulated in its own thread. There would be several advantages to this approach. It would be conceptually very close to how the real world works. It would be much easier to scale the system to multiple machines. However, for this t...

Flash: AMF3 with reference tables?

AMF3 specification defines use of so called "reference tables" (see Section 2.2 of this specification). I implemented this behavior in my AMF3 encoder/decoder I developed in Erlang, but being not very experienced with Flash API, I can hardly find how can I easily force Flash to use these reference tables when serializing objects to AMF...

mnesia delete_object exception?

I don't see what's wrong here, but I may just misunderstand the syntax. I'm trying to delete a "user" record from my "user" mnesia table who have the first name of "ryan" (there are multiples of them). Here is what I do: Delete=#user{first_name = "ryan", _ = '_'}, mnesia:dirty_delete_object(Delete) Here is my record definition: -reco...

Is Erlang a concise language from a programmer's perspective?

Where would Erlang fall on the spectrum of conciseness between, say, Java/.net on the less concise end and Ruby/Python on the more concise end of the spectrum? I have an RSI problem so conciseness is particularly important to me for health reasons. ...

What's the Erlang/Haskell job market like in the U.S.?

I've heard that Telecoms are the big source of Erlang jobs but I'm not sure how much of a market there is. How likely is it that someone could find a job in Erlang/Haskell if they decided to learn it? In my case I have a lot of programming experience in Java but am tired of Java and want to try something different. ...

Using Erlang, how should I distribute load amongst a cluster?

I was looking at the slave/pool modules and it seems similar to what I want, but it also seems like I have a single point of failure in my application (if the master node goes down). The client has a list of gateways (for the sake of fallback - all do the same thing) which accept connections, and one is chosen from randomly by the clien...

Adobe Flex to erlang connectivity?

Has anyone gotten Adobe Flex and erlang to connect to each other? A number of people talk about this on various blogs, but I haven't seen a working solution yet. Flex and erlang would form a real best-of-breed combination. Thanks. Dean ...

can one make concurrent scalable reliable programs in C as in erlang?

Hi, a theoretical question. After reading Armstrongs 'programming erlang' book I was wondering the following: It will take some time to learn Erlang. Let alone master it. It really is fundamentally different in a lot of respects. So my question: Is it possible to write 'like erlang' or with some 'erlang like framework', which given tha...

How do I elegantly check many conditions in Erlang?

So when a user sends a request to register an account, they send their username, password, email, and other info. The registration function must verify all of their data. An example would be: verify email not in use verify username not in use verify username is alphanumeric verify all fields are above X characters long verify all field...

How to Search for an item in a List in Erlang?

I am writing a cache gen-server for the company Use. I am wondering how to search an item from the list as I want the cost of the search for comparing various data structures in erlang like dict, orddict, List, tuples, tree, queue etc to use for cache program. Example, List = [{"A1",["ankit","sush", "Hover", "x4", "a3","nilesh","mike",...

How to "share state" with Erlang Style Concurrency?

Erlang works with message passing between actors as it's concurrency model. Assume I have 3 actors who sell items. The total number of items is 7. How do they excactly sell 7 items? How do they coordinate themselves? We could have one actor with the number of available items, acting on "buy" messages (inventory actor). This would be a S...

Safe, Sequential And Scalable Counters In Mnesia

I am writing an application in Erlang/OTP and want to use sequential counters on a version recording system. I first implemented them with mnesia:dirty_update_counter but the experience of using it drove out these hard requirements: The counters must have the following properties: be strictly sequential - 1 followed by 2 followed by ...

How to explain supervision trees? [Erlang]

Hi, I tried to explain supervision trees. My best try is: ok, You get a chocolate box from the factory, with warranty, "Every bit will taste good." Then if you find that one bit taste funny. You can throw the whole box away. Because you get a new from the factory. That is like supervision trees in Erlang. If one thread misbehave. The...

How to read integer in Erlang?

I'm trying to read user input of integer. (like cin >> nInput; in C++) I found io:fread bif from http://www.erlang.org/doc/man/io.html, so I write code like this. {ok, X} = io:fread("input : ", "~d"), io:format("~p~n", [X]). but when I input 10, the erlang terminal keep giving me "\n" not 10. I assume fread automatically read 10 ...

Real world applications of erlang

I'm searching for real world applications of erlang, like projects already built with that language or pointers on how to search for such projects. I'm looking for real projects not just test projects that won't do anything ...

In a mnesia cluster, which node is queried?

Let's say you have a mnesia table replicated on nodes A and B. If on node C, which does not contain a copy of the table, I do mnesia:change_config(extra_db_nodes, [NodeA, NodeB]), and then on node C I do mnesia:dirty_read(user, bob) how does node C choose which node's copy of the table to execute a query on? ...

What's the best way to prevent adding a record whose primary key is already present in mnesia?

Suppose I've got a simple record definition: -record(data, {primary_key = '_', more_stuff = '_'}). I want a simple function that adds one of these records to a mnesia database. But I want it to fail if there's already an entry with the same primary key. (In the following examples, assume I've already defined db_get_data(Key)-> ...