Все вопросы: [erlang]

304 вопросов

3
голосов
2ответов
354 просмотров

Erlang newbie question

From the past few hours I am trying to install and compile beepbeep framework sample application on Win XP Pro. Hope experts here can help me! Here are the steps I am following http://www.planeterlang.org/en/planet/article/BeepBeep_A_Rails_like_framework_for_Mochiweb/ On step 3 when I enter the...

3
голосов
2ответов
817 просмотров

Jinterface OtpNode initialization -name or -sname flag

When creating an OtpNode instance what kind of node is this? Is it like an erl -sname xxx or like an elr -name xxx ?

26
голосов
7ответов
8213 просмотров

What tool do you use to build an Erlang program?

What tool do you use to build an Erlang program: Emake, makiefile or another?

3
голосов
3ответов
1005 просмотров

need help understanding this erlang code

I'm having trouble understanding this line. [Pid2 ! {delete, V1a} || {Pid1a, V1a} <- PV1a, Pid2 <- P2, Pid1a /= Pid2 ], Here is what I understand: anything before the double pipe "||" is done repeatedly, according what's after the double pipe. so messages with delete atom is repe...

1
голосов
1ответов
113 просмотров

erlang: running "erl" I get "Fatal, could not get clock_monotonic value!, errno=22"

I have cross-compiled Erlang on a DNS-323 NAS but I get the error "Fatal, could not get clock_monotonic value!, errno=22". What am I missing?

11
голосов
4ответов
4359 просмотров

What makes Erlang suitable for soft real-time applications?

Some background I'm working on building a programming language for digital media programming, which should support concurrency using no-sharing message passing and soft real-time (i.e. do your best to compute audio/video without losing samples or frames and with a constant throughput). It turns...

2
голосов
3ответов
601 просмотров

Mochiweb mnesia requests

I'm trying to link Mochiweb with my ejabberd mnesia db and am unable to do any mnesia transactions in my controllers. I test my controllers without the mnesia transactions and they work fine. I am using application:start(mnesia) inside the start function. On the browser, I see "Internal server...

6
голосов
2ответов
557 просмотров

Erlang emacs mode - setting outdir

Does anyone know how to configure Erlang emacs mode so that compiling a buffer [C-c C-k] writes the beam file to the ebin directory rather than the current directory ? Thanks!

7
голосов
1ответов
4055 просмотров

mochijson2 or mochijson

I'm encoding some data using mochijson2. But I found that it behaves strange on strings as lists. Example: mochijson2:encode("foo"). [91,"102",44,"111",44,"111",93] Where "102", "111", "111" are $f, $o, $o encoded as strings 44 are commas and 91 and 93 are square brakets. Of course ...

1
голосов
1ответов
285 просмотров

How do you debug functions from includes in Erlang?

The implementation of ScrumJet on GitHub (as of this writing) shares essentially identical functions between the storage modules for tasks, categories and boards. This was achieved by moving the identical code which makes heavy use of the ?MODULE macro into scrumjet_datastore.hrl. Each of scrum...

10
голосов
4ответов
13447 просмотров

how to use erlang lists:map function

The following is a erlang function. I don't understand how lists:map function is used here. Could someone please explain? % perform M runs with N calls to F in each run. % For each of the M runs, determine the average time per call. % Return, the average and standard deviation of these M results...

11
голосов
5ответов
2573 просмотров

Advice on Learning "How to Think Functional"?

As a newbie in functional languages (I started touching Erlang a couple of weeks ago -- the first functional language I could get my hands on). I started to writing some small algorithms (such as left_rotate_list, bubble_sort, merge_sort etc.). I found myself often getting lost in decisions such...

2
голосов
6ответов
1802 просмотров

right rotate a List in Erlang

I am getting myself familiar to Sequential Erlang (and the functional programming thinking) now. So I want to implement the following two functionality without the help of BIF. One is left_rotate (which I have come up with the solution) and the other is right_rotate (which I am asking here) -exp...

6
голосов
5ответов
2377 просмотров

String delimiting in Erlang

Is there an equivalent to Perl's """ in Erlang? I'd like to be able to define a pretty long string full of double-quotes without escaping every single one. Is that possible? Feel free to let me know if I'm Doing It Wrong. Thanks!

5
голосов
2ответов
3110 просмотров

Erlang: Is there a way to pattern match a record in a receive clause?

I want to do a selective receive where a record property needs to be matched, but whatever syntax I try, I get an "illegal pattern" message. loop(State) -> receive {response, State#s.reference} -> do_something() end. Is this not possible?

5
голосов
8ответов
4901 просмотров

csv parser in erlang

for my application i have to parse CSV file using Erlang.following is the code which will parse CSV using Erlang:- parse_file(Fn) -> {ok, Data} = file:read_file(Fn), parse(binary_to_list(Data)). parse(Data) -> lists:reverse(parse(Data, [])). parse([], Acc) -> Acc; parse(Data, Acc) -&g...

4
голосов
1ответов
900 просмотров

Markdown And Escaping Javascript Line Breaks

I am writing a markdown compiler in Erlang for server-side use. Because it will need to work with clients I have decided to adopt the client side library (showdown.js) as the specification and then test my code for compatibility with that. In the first couple of iterations I built up 260-odd uni...

9
голосов
2ответов
906 просмотров

Erlang erl_call causes gen_server module to quit

I have a genserver module which I need to start as a server running in the background. During development, I used a standard erl terminal to start it as $erl Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) 1> my...

3
голосов
5ответов
694 просмотров

functional programming model efficiency (Erlang specific)

Hi I am a newbie in the Erlang world. When I think of how we need to solve the following problem (and there are a long list of similar ones), I think it's really inefficient because we are speaking of a lot of recursion. Apprently, language like C/Java would not need the clumsy recursion to solve...

5
голосов
2ответов
901 просмотров

Mochiweb Port 80

I am attempting to run BeepBeep through Mochiweb on Port 80. It works if I type sudo ./start_server.sh. Are there any security risks with running Mochiweb like this? If so how to remedy? Thanks!

6
голосов
2ответов
637 просмотров

erlang: ei_get_type() : where are the defined constants for the 'type' field?

I am trying to use ei_get_type() (ei) but I am having trouble finding where the 'type' field is documented. I've looked in ei.h but all I could find was a list of constants starting with "ERL_". #define ERL_SMALL_INTEGER_EXT 'a' #define ERL_INTEGER_EXT 'b' #define ERL_FLOAT_EXT 'c'...

11
голосов
4ответов
4589 просмотров

In Erlang, what are the benefits of using ets instead of process dictionary within a process?

I think using ets will still introduce similar side effects.

10
голосов
9ответов
1523 просмотров

Is Erlang's recursive functions not just a goto?

Just to get it straight in my head. Consider this example bit of Erlang code: test() -> receive {From, whatever} -> %% do something test(); {From, somethingelse} -> %% do something else test(); end....

2
голосов
1ответов
632 просмотров

what this error means? [Erlang, mochiweb, MySQL]

I made a comet chat server with Erlang and Mochiweb. And I run the "./start-dev.sh" to start the server. But after about 1 month I got the following error: =ERROR REPORT==== 26-Sep-2009::09:21:06 === {mochiweb_socket_server,235, {child_error, {badmatch, {error, ...

11
голосов
4ответов
4935 просмотров

erlang: UNIX domain socket support?

Is there a way to access UNIX domain sockets (e.g. /var/run/dbus/system_bus_socket ) directly from Erlang without resorting to a third-party driver?

5
голосов
2ответов
1130 просмотров

Erlang: is there an API to 'epmd'?

Is there a way to query the name table that epmd daemon manages? The nodes() function isn't very helpful on that front. NOTE: I am looking for an API aside from parsing the output generated through stdout.

1
голосов
4ответов
1517 просмотров

Speeding up Erlang indexation function

So following on from this question: Erlang lists:index_of function? I have the following code which works just fine: -module(test_index_of). -compile(export_all). index_of(Q)-> N=length(Q), Qs=lists:zip(lists:sort(Q), lists:seq(1, N)), IndexFn=fun(X)-> {_, {_...

0
голосов
2ответов
1047 просмотров

Parsing \"–\" with Erlang re

I've parsed an HTML page with mochiweb_html and want to parse the following text fragment 0 – 1 Basically I want to split the string on the spaces and dash character and extract the numbers in the first characters. Now the string above is represented as the following Erlang list [48,32,226,12...

5
голосов
4ответов
1266 просмотров

Getting ctags to include module qualifiers in the tags file for Erlang code

I'm using Exuberant ctags to index Erlang files. The "tags" file contains functions, but they do not have module qualifiers; so I can't search for "module:function", only "function", which may give several results. Do you know a way to get ctags to include module qualifiers in the tags file? T...

9
голосов
5ответов
4001 просмотров

interfacing erlang application with php

I have a website built with PHP. I have an Erlang application running as a daemon on the same server. I need to call functions on the Erlang application from PHP and get back the result. I've found PHP/Erlang and over PHP modules but I can't install a PHP module on this server, I can only use PH...