erlang

How can I send a message to another node?

余生长醉 提交于 2019-12-06 00:08:13
问题 I want to implement a simple chat room in which two nodes can send message to each other synchronous. There is not a node that plays a role of server. Can I use ! to send a message to another node, if i have the pid of the process on this node by function of spawn(Node,Module,Fun,Args) ? 回答1: You can send to processes at another node just the same you would do with a process local to the same node. The trick is of course you need to have the process id. But you can also send to a process

ubuntu下安装rabbitMQ

一笑奈何 提交于 2019-12-06 00:01:22
一.环境准备 rabbitMQ需要erlang语言的支持,因此需要先安装erlang语言 二.下载 http://www.erlang.org/download/opt_src_17.3_tar.gz 并解压 三.安装 ./configure --prefix=/home/ liyixiang /erlang 注: 可能会报错 configure: error : No curses library functions found configure: error : / bin / sh ' /home/liyixiang/erlang/configure ' failed for erts 原因是缺少 ncurses包 解决: 在ubuntu系统下 apt-cache search ncurses apt-get install libncurses5-dev 继续安装erlang ‍ 命令: make make install ‍ ‍ 四.测试erlang ‍ 进入 /home/liyixiang/erlang ,启动 erl 测试 erlang 是否安装成功。 五.配置erlang环境变量 修改 /etc/profile 文件,增加下面的环境变量:(vim profile i插入 编辑完毕ESC退出 wq!强制修改 ) #set erlang environment

Ubuntu16.04下,erlang安装和rabbitmq安装步骤

蹲街弑〆低调 提交于 2019-12-05 23:57:29
  准备工作,先下载erlang和rabbitmq的安装包,注意他们的版本,版本不对可能回到值rabbitmq无法启动,这里我使用的是最新的erlang(22.1)和rabbitmq(3.8.1),下载地址:   erlang下载地址: http://erlang.org/download/otp_src_22.1.tar.gz ( 点击这里进入下载页面 )   rabbitmq下载地址: https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.1/rabbitmq-server-generic-unix-3.8.1.tar.xz ( 点击这里进入下载页 )   切记,erlang的版本要和rabbitmq的版本对上,版本比对地址: https://www.rabbitmq.com/which-erlang.html         建议使用window下载,然后再发送到linux中去,如果是linux,可直接使用命令行下载   #rabiitmq下载 wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.1/rabbitmq-server-generic-unix-3.8.1.tar.xz #erlang下载

How does Erlang sleep (at night?)

不问归期 提交于 2019-12-05 23:32:58
I want to run a small clean up process every few hours on an Erlang server. I know of the timer module. I saw an example in a tutorial used chained timer:sleep commands to wait for an event that would occur multiple days later, which I found strange. I understand that Erlang process are unique compared to those in other languages, but the idea of a process/thread sleeping for days, weeks, and even months at a time seemed odd. So I set out to find out the details of what sleeping actually does. The closest I found was a blog post mentioning that sleep is implemented with a receive timeout, but

tsung测试tigase性能

五迷三道 提交于 2019-12-05 23:18:28
tigase 性能测试,测试环境应用太多,只记录一个测试的方法; 具体性能可以参考官方的测试结果,而且有测试配置文件; http://www.tigase.org/content/tigase-load-tests-again-500k-user-connections 点击查看tsung report 的页面最下面的 XML Config file ,下载下来跑下即可; 1.环境安装参考 参考: http://linyu19872008.iteye.com/blog/1605707 (没有 apt-get,参考下面链接安装erlang ) erlang安装参考: http://hxl2009.blog.51cto.com/779549/1224816 测试过,可行! 2.启动Tsung测试: 运行tsung,执行对应的配置xml,和输出到对应的log文件夹 [root@s2-5 tsung-1.5.0]# ./tsung.sh.in Usage: tsung.sh.in <options> start|stop|debug|status Options: -f <file> set configuration file (default is ~/.tsung/tsung.xml) (use - for standard input) -l <logdir> set log

Which Erlang implementation of OpenId should I use, if any?

天大地大妈咪最大 提交于 2019-12-05 23:14:32
问题 I'd need an Erlang implementation of the OpenId protocol. I found the following, but it seems to be a project on its early stage. http://code.google.com/p/erlopenid/ Any hint or suggestion on what should I use? 回答1: I finally found all the existing Erlang implementations for OpenID thanks to the following search engine for Erlang projects: http://projects.trapexit.org/web/ Here are the results: http://github.com/etnt/eopenid http://github.com/brendonh/erl_openid http://github.com/pib

mochijson2 or mochijson

我只是一个虾纸丫 提交于 2019-12-05 23:03:45
问题 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 if I output this somewhere I'll get string "[102,111,111]" which is obviously not that what I what. If i try mochijson2:encode(<<"foo">>). [34,<<"foo">>,34] So I again i get a list of two doublequotes and binary

Erlang: module attribute

点点圈 提交于 2019-12-05 22:58:46
问题 I am new to Erlang. Found the following -module attribute declaration in an existing Erlang project: -module(mod_name, [Name, Path, Version]). What does mean the second parameter (list [Name, Path, Version]) here? I haven't found any information in the Erlang reference on it. 回答1: This defines a parameterised erlang module - one you can "instantiate" with new and then access the parameters passed by that new when executing code in your module. A very brief overview is here: http:/

Erlang: Mnesia can not create schema while release with rebar

杀马特。学长 韩版系。学妹 提交于 2019-12-05 22:53:39
When I call mnesia:create_schema on startup, the program crashes. If I run my program in ebin without releasing it, it works find. The error log as follows: =INFO REPORT==== 3-Jul-2013::09:44:06 === application: eddy exited: {bad_return, {{eddy_app,start,[normal,[]]}, {'EXIT', {{badmatch, {error, {'EXIT', {undef, [{mnesia_backup,open_write, ["/home/cometeor/eddy/rel/eddy/Mnesia.eddy@127.0.0.1/eddy@127.0.0.1137284464686415846847780"], []}, {mnesia_bup,do_apply,4, [{file,"mnesia_bup.erl"},{line,387}]}, {mnesia_bup,make_initial_backup,3, [{file,"mnesia_bup.erl"},{line,378}]}, {mnesia_bup,create

不要把分层当做解耦!

大城市里の小女人 提交于 2019-12-05 22:37:27
公司的老员工很喜欢一种他们称之为“解耦”的做法: 先这么进行系统分析:把系统运行拆解为若干个环节,先执行A,再执行B,形成一个一个的步骤。 然后进行“解耦”:把每个环节变成一个服务,环节之间用 MQ 连接。环节衔接的输入输出数据形成协议规范。 “解耦”之后得到的好处是: 环节用MQ串联,当服务死掉后,MQ能存储消息,等服务重启可以继续执行;当MQ无法消化时,可以为这个环节的服务增加机器;当这个环节的服务饱和时,可以裁剪人员。 这套“解耦”的办法和部门划分一脉相承,部门人员富裕就裁剪,工作量完不成就加入,公文始终堆在那儿。 程序员的特点是手里有锤子到处找钉子,凡是看到系统没有这么分割的,他们就认为“解耦不充分”。程序人生就是不断复制这个模型的人生。 很多公司的架构也停留在这种软件设施级别的架构:如何实施 KAFKA,如何上SPARK,如何玩ZOOKEEPER等等,妄图通过引入这些灵丹妙药改变世界。 然而效果如何呢?由于涉及公司内部系统,保密起见这里不做展开,简单的说,系统烂的一比! 为什么会演变成这样呢? 第一,系统烂源于业务架构识别不当。 如权限方面,本人在05年就搞组织机构无限划分,而这套系统里公司都是平齐的,难道它们都搞扁平化管理了? 权限不是目前系统的核心业务,本系统核心业务对象识别的也一塌糊涂,但涉及公司业务这里不展开。 我认为,系统分析能力主要指的是业务架构的能力