erlang

Pattern matching key in erlang maps

谁说胖子不能爱 提交于 2020-01-20 08:22:46
问题 I have a map of form shown below: Map = #{#{country=>"India"} => #{rank => 1}}. I am trying to match it as follows: 1. #{Key := V} = Map. OR 2. #{#{country := Country} := #{rank := Rank}} = Map. But its not working for me. Any help as to how it can be done? 回答1: When matching key-value associations from maps the key expression must be an expression with literals or bound variables, see the documentation of maps (section Maps in Patterns ). The problem with a match expression like: #{Key := V}

What is a tuple module in Erlang?

孤街浪徒 提交于 2020-01-20 04:54:45
问题 http://www.erlang.org/news/35 mentioned that this will be documented, but I can't find it in the documentation. 回答1: A "tuple module" is a tuple with two elements, the name of a module and a list of extra arguments. For example: {my_module, [foo, bar]} Such a tuple can be used instead of a module name in function calls. In this case, the function being called will get the tuple in question as an additional argument at the end of the argument list: 3> Module = {lists, [[foo]]}. {lists,[[foo]]}

What is a tuple module in Erlang?

左心房为你撑大大i 提交于 2020-01-20 04:54:11
问题 http://www.erlang.org/news/35 mentioned that this will be documented, but I can't find it in the documentation. 回答1: A "tuple module" is a tuple with two elements, the name of a module and a list of extra arguments. For example: {my_module, [foo, bar]} Such a tuple can be used instead of a module name in function calls. In this case, the function being called will get the tuple in question as an additional argument at the end of the argument list: 3> Module = {lists, [[foo]]}. {lists,[[foo]]}

centos安装rabbitmq

陌路散爱 提交于 2020-01-18 23:43:35
系统之间传递数据,或者业务层和数据层数据传递,以及与第三方公司数据进行数据传递,都是用了队列来实现,队列的种类也有很多,由于工作需要,我在centos7上安装rabbitmq.安装rabbitmq之前需要先安装erLang环境. 第一下载rpm包   官网下载最新版本: http://www.rabbitmq.com/download.html http://www.erlang.org/downloads   erLang: http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpm rabbitmq: http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm 第二安装erLang环境   rpm -ivh erlang-19.0.4-1.el7.centos.x86_64.rpm   测试是否安装成功: 第三、安装rabbitmq    在安装rabbitmq时提示依赖socat    yum install socat    rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm 第四、启动和关闭    

RabbitMq 手动安装

血红的双手。 提交于 2020-01-18 21:59:53
git https://github.com/rabbitmq/erlang-rpm 通过yum安装很方便。 安装rabbitmq # In /etc/yum.repos.d/rabbitmq_erlang.repo [rabbitmq_erlang] name=rabbitmq_erlang baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch repo_gpgcheck=1 gpgcheck=1 enabled=1 # PackageCloud's repository key and RabbitMQ package signing key gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 [rabbitmq_erlang-source] name=rabbitmq_erlang-source baseurl=https://packagecloud.io

RabbitMQ安装与原理详解

人走茶凉 提交于 2020-01-18 02:40:32
文章目录 一、概述 1. 什么是消息队列 2. 为什么要使用消息队列 3. RabbitMQ特点 二、安装 1. 安装Erlang 2. 安装RabbitMQ 三、RabbitMQ 1. 启动和关闭 2. 插件管理 3. 用户管理 4. 权限管理 5. vhost管理 6. 设置管理员权限 四、消息发送和接收 1. RabbitMQ消息发送和接收机制 2. AMQP 中的消息路由 3. Exchange与Queue关联绑定 4. Exchange 类型 (1)direct (2)fanout (3)topic 5. Client与Brocker进行连接 五、RabbitMQ镜像集群 1. 准备 2. 配置Cookie文件 3. 配置hosts文件 4. 组建集群 5. 节点类型 一、概述 1. 什么是消息队列 消息(Message)是指在应用间传送的数据。消息可以非常简单,比如只包含文本字符串,也可以更复杂,可能包含嵌入对象。 消息队列(Message Queue)是一种应用间的通信方式,消息发送后可以立即返回,由消息系统来确保消息的可靠传递。消息发布者只管把消息发布到 MQ 中而不用管谁来取,消息使用者只管从 MQ 中取消息而不管是谁发布的。这样发布者和使用者都不用知道对方的存在。 2. 为什么要使用消息队列 从上面的描述中可以看出消息队列是一种应用间的 异步协作机制

requires erlang >= R16B-03

这一生的挚爱 提交于 2020-01-17 21:59:22
参考 https://segmentfault.com/q/1010000006032347/a-1020000016906832 参考 https://blog.csdn.net/qq_22075041/article/details/78855708 解决方法: yum -y install socat 此时会报错没有socat包或是找不到socat包,解决方法安装centos的epel的扩展源 yum -y install epel-release 之后执行yum -y install socat 重新 安装socat 来源: CSDN 作者: 取个名字有点烦 链接: https://blog.csdn.net/zxl0428/article/details/104022122

Linux下 RabbitMQ的安装与配置

浪尽此生 提交于 2020-01-17 06:50:45
1,下载 erlang (http://www.rabbitmq.com/releases/erlang/)   wget http://www.rabbitmq.com/releases/erlang/erlang-18.2-1.el6.x86_64.rpm 2,安装 erlang   rpm -ihv http://www.rabbitmq.com/releases/erlang/erlang-18.2-1.el6.x86_64.rpm 3,下载 rabbitMQ server (http://www.rabbitmq.com/install-rpm.html) (根据自己的系统下载)    4,安装       rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc     rpm -ihv rabbitmq-server-3.6.10-1.el6.noarch.rpm   报错:     error: Failed dependencies:     socat is needed by rabbitmq-server-3.6.10-1.el6.noarch 解决: wget – no - cache http : //www.convirture.com/repos

rabbitmq安装错误集

醉酒当歌 提交于 2020-01-17 06:48:46
1.安装依赖 yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson 2.yum install erlang export PATH=$PATH:/usr/lib/erlang 检查erlang是否安装成功 find / -name erlang find / -name erl 执行/usr/lib/erlang/bin/erl 查看erlang版本 [root@localhost rabbit]# erl Erlang R16B03-1 (erts-5.10.4) [source] [async-threads:10] [hipe] [kernel-poll:false] Eshell V5.10.4 (abort with ^G) 第一种安装的erlang版本过低 下载 wget http://erlang.org/download/otp_src_19.3.tar.gz 配置cd otp_src_19.3: ./configure --enable-smp-support --enable-threads --enable-sctp --enable-kernel-poll -

erlang race condition of spawn and receive

让人想犯罪 __ 提交于 2020-01-17 04:08:08
问题 I am learning erlang with book , In chapter 13, the first exercise is writing a function my_spawn, which catch exit message when spawned message crash/exited. -module(my_spawn1). -compile(export_all). my_spawn(Mod,Func,Args) -> {M1, S1, Mi1} = os:timestamp(), Pid = spawn(Mod,Func,Args), lib_misc:on_exit(Pid, fun(Why) -> {M2,S2,Mi2} = os:timestamp(), ElapsedTime = (M2 - M1) * 1000000 + (S2 - S1) * 1000 + (Mi2-Mi1), io:format("~p died with:~p~n consume time:~p(ms)", [Pid,Why,ElapsedTime]), end)