erlang

0MQ with green threads?

I've grown to like erlang, and it's a great (cough) architectural fit to my problem. Meanwhile I still like to imagine that I can kludge erlang processes & asynchronous message passing in python (I am currently in therapy to rid myself of this obsession). During a recent binge I came across 0MQ & I like its messaging features. These may...

ERLANG - Splitting Lists into sub list

Hi this is my first post here hope you all are well. So Im just starting erlang and I ran into a problem im not sure how to tackle yet. So I have a binary I am recieving in the form of <<56, 23, 67, 34, 45, 78, 01, 54, 67, 87, 45, 53, 01, 34, 56, 78>> My goal is to split it into a sub list (or binary if more efficient) based on t...

ERlANG - Splitting Lists into sub list

Hi Everyone, So this I just had one problem solved very quickly by a nice guy on my other post. http://stackoverflow.com/questions/3464207/erlang-splitting-lists-into-sub-list Now I am a beginner at Erlang and need a little help with the syntax of another function that does work on the result from my previous post. For example, I now...

ERLANG - Pattern Matching

Hi Everyone, I have a variable: Data = [[<<>>, [<<"10">>,<<"171">>], [<<"112">>,<<"Gen20267">>], [<<"52">>,<<"20100812-06:32:30.687">>]] I am trying to pattern match for two specific cases.. One where anything that resembles the outside structure - simply [] Anything inside goes I have tried [ _ ] but no go? The Second, for a ...

ERLANG - Pattern Matching specifc pattern in unknown size list

Ok now I think Im getting warmer, I have to pattern match whatever comes in. So if I had say Message = = [[<<>>], [<<"10">>,<<"171">>], [<<"112">>,<<"Gen20267">>], [<<"52">>,<<"20100812-06:32:30.687">>]] And I was looking to pattern match the field <<"112">> Such as the 112 is always going to say 112, but the Gen2067 can change...

ERlang - Very Weird - calender:... Does not work

I did not think I would spent an hour trying to figure this one out... with all the headway I made today and such. So I'm using what would seem to be - straight out the manual - erlang BIF calender:universal_time(). But I get 35> calender:universal_time(). ** exception error: undefined function calender:universal_time/0 Checked m...

ERlang - Trying to find LENGTH of constituents of List

Hi Everyone, guess its getting late, and Im a beginner, just need a little help.. Im trying to find the length of a list.. BUT NOT of the lists themselves, rather the length of the values within.. I take something like: Other = [<<"366">>,0, <<1>>, <<"344">>,<<"Really" <<1>>, <<"9...

Erlang - Interleave the easy way

Whats the easy/efficient way of interleaving three data sets.. Data1 = [<<5>>,<<6>>,<<7>>], Data2 = [<<5>>,<<6>>,<<7>>], Data3 = [<<5>>,<<6>>,<<7>>]. End Result: Final = [<<5>>, <<5>>, <<5>>, <<6>>, <<6>>, <<6>>, <<7>>, <<7>>, <<7>>] Im sure its like [X || X <- [Data1, Data2, Data3]] ...

Stopping of Erlang app hangs when mnesia stopped from within the program

Hi all, I've run into a problem where I cannot stop mnesia within my program without causing the app to hang. I'm presently doing prototyping of mnesia within my erlang app. In my jaus_app.erl file the start() calls: {atomic, ok} = mnesia:load_textfile("priv/mnesia_prototype.txt") My stop() function calls: mnesia:dump_to_textfile(...

Erlang nodes can't see each other

Hi, I am new to Erlang and trying to set two nodes on my laptop. In one terminal I type: eli@elimayost: ~/erlang_apps> erl -sname foo -setcookie secret And in the second terminal: eli@elimayost: ~/erlang_apps> erl -sname bar -setcookie secret If I use the first terminal to ping the second: (foo@elimayost)1> net_adm:ping(bar@elim...

Erlang - Compatible CPU's / Servers

Possible Duplicate: Does Erlang work on any non-x86 processors? Im having trouble finding a list of compatible CPU's for erlang. I have read its somewhere on the erlang site.. not an easy find so far. Besides maybe a link does anyone recommend a certain server? I am looking to run on as many cores as possible An Intel Quad...

Erlang - Global Variables .. yes I know, I know

Ok I have been trying every which way to figure this out. I need to get this table to be a global.. I have realized it is much less efficient to pass TableID around.. in the scope of my program. So I tried creating a new table then looking it up: TableID = ets:new(tb, [set,public]), put({tableUniqueID}, TableID), Then I used: get({...

Erlang - Split a list into lists based on value

I am trying to split this list List = [[<<"5">>, <<"54">>], [<<"00">>], [<<"35">>, <<"54">>, <<"45">>, <<"55">>], [<<"00">>],[ <<"5">>]] into List = [[<<"5">>, <<"54">>], [<<"35">>, <<"54">>, <<"45">>, <<"55">>], [<<"5">>]] Basically based on the <<"00">> What is the best BIF to go about this, I have some code, but its sloppy, an...

Erlang Error Handling , X unsafe in 'try'

Can anyone enlighten me as to why this bit of code spits back that the X is unsafe in 'try', well I know why, but more so how to fix it. try X = lists:append(lists:zipwith3(fun(X, Y, Z) -> [X, Y, Z] end, Data1, Data2, Data3)) of MP -> X catch K -> (X = 0) end. %MP = [lists:zipwith3(X, Y, Z...

Erlang application launch on a Windows server

I have an Erlang application that is deployed on a server with Windows Server 2008. The way I do this: Copy application folder in Erlang lib directory. Open command line (cmd). Execute erl. Execute application:start(app_name) in Erlang shell. Are there any better approaches to launch the application? How to make the application to l...

Erlang: Implementing a Finite State Machine using gen_fsm

I'm looking for an example of a simple FSM implemented in Erlang using the gen_fsm from OTP. ...

Erlang xml to tuples and lists

Hi everyone! I'm very excited to be starting my erlang journey, but I've been stuck on this for a few days now and I'm starting to get scared I won't meet my deadline. I'm trying to create key, value pair tuples out of xml. I'd like to make a list out of any nested xml. It seems like a very common thing to do, but I can't find any ex...

Can I ignore thread safety when programming in Erlang?

I've just started learning about thread safety. This is making me code a lot more defensively, perhaps too defensively. Would using a functional language like Erlang completely rid me of this concern? ...

Why does the performance drops that much when my Erlang TCP proxy gets many concurrent requests?

For learning purposes I've written a simple TCP proxy in Erlang. It works but I experience an odd performance fall-off when I use ab (Apache Bench) to make many concurrent requests. It's not the performance fall-off per se that makes me wonder but the scale of the fall-off. The backend is nginx as a web server. My proxy sits inbetween ab...

Erlang long 64 number BUG

Erlang is truncating the value of big long operations if one of the operands are not big enough. Although it is not truncating if both operands are big enough. 199> 3656626623097354252900000 * 11111111111111111111111111. 40629184701081713921111110704819264100293971900000 200> 3656626623097354252900000 * 64. 2340241...