erlang

Logging libraries for Erlang/OTP [closed]

半腔热情 提交于 2019-12-18 12:52:46
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . For logging activity of an Erlang/OTP application, do you simply use a wrapper over disk_log or some other libraries? 回答1: I've also found: http://github.com/sinnus/ejabberd_logger http://github.com/etnt/elogger http://github.com/JacobVorreuter/log_roller 回答2: There is standard error logging application SASL

rabbitmqctl Error: unable to connect to node rabbit@myserver nodedown

倾然丶 夕夏残阳落幕 提交于 2019-12-18 12:17:40
问题 I am running RabbitMQ v3.3.5 with Erlang OTP 17.1 on Windows 2008 R2. My Dev and QA environments are stand-alone. My staging and production environments are clustered. I am finding this one problem happening often where the RabbitMQ service is running, the RabbitMQ management console is seeing everything, but when I try running rabbitmqctl from the command line it fails with an error saying that the node is down (tried locally and on a remote server). This problem is resolved if I restart the

Why is useful to have a atom type (like in elixir, erlang)?

蓝咒 提交于 2019-12-18 12:14:47
问题 According to http://elixir-lang.org/getting-started/basic-types.html#atoms: Atoms are constants where their name is their own value. Some other languages call these symbols I wonder what is the point of have a atom type. Probably to help build a parser or for macros? But in everyday use how it help the programmer? BTW: Never use elixir or erlang, just note it exist (also in kdb) 回答1: I think that one of the most common usage in erlang is to tag variables and messages, with the benefit of fast

Why is useful to have a atom type (like in elixir, erlang)?

拈花ヽ惹草 提交于 2019-12-18 12:14:11
问题 According to http://elixir-lang.org/getting-started/basic-types.html#atoms: Atoms are constants where their name is their own value. Some other languages call these symbols I wonder what is the point of have a atom type. Probably to help build a parser or for macros? But in everyday use how it help the programmer? BTW: Never use elixir or erlang, just note it exist (also in kdb) 回答1: I think that one of the most common usage in erlang is to tag variables and messages, with the benefit of fast

How do you do modulo or remainder in Erlang?

孤者浪人 提交于 2019-12-18 12:12:07
问题 I'm brand new to Erlang. How do you do modulo (get the remainder of a division)? It's % in most C-like languages, but that designates a comment in Erlang. Several people answered with rem, which in most cases is fine. But I'm revisiting this because now I need to use negative numbers and rem gives you the remainder of a division, which is not the same as modulo for negative numbers. 回答1: In Erlang, 5 rem 3. gives 2 , and -5 rem 3. gives -2 . If I understand your question, you would want -5

Can a CouchDB document update handler get an update conflict?

人走茶凉 提交于 2019-12-18 11:56:03
问题 How likely is a revision conflict when using an update handler? Should I concern myself with conflict-handling code when writing a robust update function? As described in Document Update Handlers, CouchDB 0.10 and later allows on-demand server-side document modification. Update handlers can process non-JSON formats; but the other major features are these: An HTTP front-end to arbitrarily complex document modification code Similar code needn't be written for all possible clients—a DRY

Erlang Multicast

天大地大妈咪最大 提交于 2019-12-18 11:48:21
问题 How do you use gen_udp in Erlang to do multicasting? I know its in the code, there is just no documentation behind it. Sending out data is obvious and simple. I was wondering on how to add memberships. Not only adding memberships at start-up, but adding memberships while running would be useful too. 回答1: Here is example code on how to listen in on Bonjour / Zeroconf traffic. -module(zcclient). -export([open/2,start/0]). -export([stop/1,receiver/0]). open(Addr,Port) -> {ok,S} = gen_udp:open

Convert timestamp to datetime in erlang

落爺英雄遲暮 提交于 2019-12-18 11:45:10
问题 How can I convert a timestamp (number of milliseconds since 1 Jan 1970...) to Date or DateTime format in Erlang? Something like {Year,Month,Day}. 回答1: Roughly: msToDate(Milliseconds) -> BaseDate = calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}}), Seconds = BaseDate + (Milliseconds div 1000), { Date,_Time} = calendar:gregorian_seconds_to_datetime(Seconds), Date. 回答2: It just so happens that I have a github gist with a bunch of datetime utilities for exactly this purpose: http:/

mochijson2 examples!

梦想的初衷 提交于 2019-12-18 11:28:06
问题 I'm a two-week old infant with regards to Erlang and Mochiweb. Earlier I had a system running on PHP and soon I realised that it wasn't going to be able to handle the kind of load I was expecting. So I decided to switch the backend to a Mochiweb based server. Right now I need to know how to implement JSON with Mochiweb. I'm fully aware of the existense of mochijson2 library, but being a beginner, I can't get around to figuring out how to use it. Could someone point me to some place where I

Erlang-style Concurrency for Other Languages

醉酒当歌 提交于 2019-12-18 10:37:38
问题 What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)? Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing library. 回答1: Message Passing Interface (MPI) (http://www-unix.mcs.anl.gov/mpi/) is a highly scalable and robust library for parallel programming, geared original towards C but now available in several flavors http://en