erlang

What are the constraints/limitations of compiling with “+native”?

混江龙づ霸主 提交于 2019-12-18 05:54:53
问题 What are the limitations/constraints when compiling Erlang .erl source with the +native option compared with the usual "non native" compilation? Related to: Erlang OTP release compiles with HiPE? 回答1: The functionality for tracing, breakpoints and single stepping that the BEAM emulator provides are not available in native compiled code. There is also still a limitation that native code is not really unloaded from memory when you load newer versions of the same module. (This can be an issue if

RabbitMQ 安装步骤

蹲街弑〆低调 提交于 2019-12-18 05:42:50
RabbitMQ 安装步骤 一、安装erlang 1.下载erlang wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm 2.安装许可 rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc 3.安装erlang环境 rpm -Uvh erlang-solutions-1.0-1.noarch.rpm yum install erlang 二、安装rabbitmq 1.下载rabbitmq wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.15/rabbitmq-server-3.7.15-1.el7.noarch.rpm 2.安装许可 rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc 3.安装rabbitmq yum install rabbitmq-server-3.7.15-1.el7.noarch.rpm 4

Erlang equivalent to if else

試著忘記壹切 提交于 2019-12-18 03:57:32
问题 I have 2 parts of code I want to execute. Both are conditionals if Value1 < N do something else if Value1 >= N do something if Value2 < N do something else if Value2 >= N do something I want at one statement of each to execute. How does the if work in erlang? there is no else. I use multiple guards, but that looks like I have 4 if statements. in groups of 2. if some condition code; if other condition code end. I get a syntax error. 回答1: The form for an if is: if <guard 1> -> <body1> ; <guard

Run C Code Block in Erlang

匆匆过客 提交于 2019-12-18 02:50:15
问题 How to Run C Code Block from Erlang? ( Or Call a C function from erlang? ) 回答1: This is for creating a driver Firstly you'll need to create the C/C++ files to do it. They will need to include #include "erl_driver.h" #include "ei.h" Then you'll need to set up the driver mapping /* mapping of the drivers functions */ static ErlDrvEntry driver_entry = { NULL, /* init */ startup_function_name, /* startup */ shutdown_function_name, /* shutdown */ NULL, /* output */ NULL, /* ready_input */ NULL, /*

Erlang: what is the difference between “include_lib” and “include”?

怎甘沉沦 提交于 2019-12-17 22:35:59
问题 What is the difference between "include_lib" and "include" ? E.g. -include_lib("eunit/include/eunit.hrl") 回答1: The way the documentation describes the difference between include and include_lib is: include_lib is similar to include , but should not point out an absolute file. Instead, the first path component (possibly after variable substitution) is assumed to be the name of an application. Example: -include_lib("kernel/include/file.hrl"). The code server uses code:lib_dir(kernel) to find

How do I concatenate two binaries in Erlang?

馋奶兔 提交于 2019-12-17 22:34:52
问题 How do I concatenate two binaries in Erlang? For example, let's say I have: B1 = <<1,2>>. B2 = <<3,4>>. How do I concatenate B1 and B2 to create a binary B3 which is <<1,2,3,4>>? The reason I am asking this is because I am writing code to encode a packet for some networking protocol. I am implementing this by writing encoders for the fields in the packet and I need to concatenate those fields to build up the whole packet. Maybe I am doing this the wrong way. Should I build up the packet as a

Erlang and Toolchains

你说的曾经没有我的故事 提交于 2019-12-17 19:39:31
问题 Has anyone worked out an ultra efficient workflow and toolset for Erlang? Debugging, prototyping, browsing, version control, etc. I'm extremely impressed with Smalltalk's integrated image system, but was wondering if something could be even approaching it with Erlang. 回答1: Erlang has a very robust development chain, especially if you are an EMACS maven. There is an Erlang specific build system, there is robust support for packaging your application and its dependencies for deployment and don

How to filter messages in Ejabberd

安稳与你 提交于 2019-12-17 18:37:47
问题 I have Ejabberd up and running with test users, and its working fine. I want to write a module that can intercept messages and modify them, as follows : intercept "messages" send them to a php file get the result from the same php file (immediate) Modify the message stanza and send it down the wire to the recipient The ejabberd documentation is weak and tutorials are non-existent. Can you give me some sample code that does this. I can then figure how to configure it for my needs. Thanks a

服务器安装配置(JDK,tomcat,redis,rabbitMQ,MySQL)

夙愿已清 提交于 2019-12-17 17:28:35
1、服务器安装配置( JDK , tomcat , redis , rabbitMQ , MySQL ) 1.1、安装 JDK 通过 xftp 上传 jdk 压缩包, jdk 版本采用1.8,如果电脑安装过 rz 命令可以直接通过命令上传 安装 lrzsc 的yum命令 yum -y install lrzsz 个人习惯:会在根目录下创建package和local两个文件夹 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ydDnxgaT-1576568044334)(C:\Users\25452\AppData\Roaming\Typora\typora-user-images\image-20191217142842279.png)] 没有的话创建一个(目录根据个人习惯) mkdir package; mkdir local; cd package; rz ;# (上传文件) [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-V9GrEvM0-1576568044335)(C:\Users\25452\AppData\Roaming\Typora\typora-user-images\image-20191217143112738.png)] 将tar包解压至 jdk 路径之下 mkdir /local/java tar

Erlang server, Java client - TCP messages get split?

孤者浪人 提交于 2019-12-17 17:13:42
问题 As the title says, I have a server written in Erlang, a client written in Java and they are communicating through TCP. The problem that I am facing is the fact that gen_tcp:recv apparently has no knowledge of when a "complete" message from the client has been received, and is therefore "splitting" it up in multiple messages. This is an example of what I'm doing (Incomplete code, trying to keep it to only the relevant parts): Code Erlang server -module(server). -export([start/1]). -define(TCP