erlang

Spawn remote process w/o common file system

吃可爱长大的小学妹 提交于 2019-12-20 02:46:11
问题 (nodeA@foo.hyd.com)8> spawn(nodeA@bar.del.com, tut, test, [hello, 5]). I want to spawn a process on bar.del.com which has no file system access to foo.hyd.com (from where I am spawning the process), running subroutine "test" of module "tut". Is there a way to do so, w/o providing the nodeA@bar.del.com with the compiled "tut" module file? 回答1: You can use the following function to load a module at remote node without providing the file itself: load_module(Node, Module) -> {_Module, Bin,

Erlang: when to perform `inets:start()`?

独自空忆成欢 提交于 2019-12-20 01:46:47
问题 What is the appropriate place for performing inets:start() ? in `applicationname_app' module? in applicationname_sup supervisor module? in a child process hanging from the supervisor?\ someplace else? (I am still struggling with inets:httpd ) Note : the answer cannot be to the tune " use a boot file " , please. 回答1: inets is a "stand-alone" Erlang application; inets:start() is just an alias to application:start(inets) . I guess the answer pretty much depends on how you maintain your code. If

Erlang: when to perform `inets:start()`?

无人久伴 提交于 2019-12-20 01:46:28
问题 What is the appropriate place for performing inets:start() ? in `applicationname_app' module? in applicationname_sup supervisor module? in a child process hanging from the supervisor?\ someplace else? (I am still struggling with inets:httpd ) Note : the answer cannot be to the tune " use a boot file " , please. 回答1: inets is a "stand-alone" Erlang application; inets:start() is just an alias to application:start(inets) . I guess the answer pretty much depends on how you maintain your code. If

Does erlang record when a process started?

折月煮酒 提交于 2019-12-19 21:53:30
问题 I'm working with monitoring an Erlang application and I'm currently trying to determine how long a specific PID has been running. Absolute timestamp or duration would work for me, but I do not see either of those bits of data in process_info or via the sys module. Is there a way to get this information from within the Erlang VM? I can get the start time of the overall VM from the ps command, but that doesn't have any visibility of individual Erlang processes. Edit: I've noticed that when the

Erlang的热更新

ぐ巨炮叔叔 提交于 2019-12-19 19:02:04
Erlang 热更步骤 1.创建热更模块接口 2.替换编译文件.beam 3.执行热更 主要实现方法是使用code代码服务函数 code:purge(Mod), 清除模块的代码,清除并标记为旧版本代码 code:load_file(Mod). 加载一个模块 由于模块加载之后存在虚拟机 可直接替换bin文件夹中的Mod.beam文件 执行跟新 当旧的Mod:A-old()执行结束 会切到Mod:A-new() 所以不用担心冲突 接口 运维后台通过TCP请求热更和参数 由于使用TCP/IP 后台传参(即热更模块名称已转为二进制,需进行转换为原子,且后台执行热更需要返回结果 如果热更文件过多 直接调用fun()可能后台需要等待很长时间 所以需要用到Spawn) 实现 //入口 Ref2 = lib_gm_command:process_binary(Socket, Binary), lib_send:send_one(Socket, Ref2); //处理二进制获取参数(根绝自己和后台的规则处理 此处忽略) spawn(lib_update,update_file,[Filename]),//Filename热更文件list <<>>; //即Ref2 //热更操作 UpdateFileList = lists:map(fun(E)-> binary_to_atom(E,latin1)

Getting two erl shells to talk on OS X

南笙酒味 提交于 2019-12-19 18:24:17
问题 I want to be able to have two Erlang shells to talk. I'm running on OS X. I tried the tut17 example here. I've also tried: $ erl -sname foo and then in a new Terminal: $ erl -sname bar (bar@elife)1> net_adm:ping(foo@elife). pang Any ideas? 回答1: It's kind of broken on the mac. By default, the mac can't resolve its own shortname. Your host's name is really probably "elife.local". If you start erl with -name FQDN, then the pings will work. ie: you would start it with $ erl -name foo@elife.local

erlang lists:dropwhile weird result

你说的曾经没有我的故事 提交于 2019-12-19 18:22:21
问题 can someone please help me understand what's going on here lists:dropwhile(fun(X) -> X < 8 end, lists:seq(1,10)). "\b\t\n" % ??? what is this ? why not [8,9,10] lists:dropwhile(fun(X) -> X < 7 end, lists:seq(1,10)). [7,8,9,10] % this is correct 回答1: Your results are actually correct in both cases. The unexpected string in the first case is due to the fact that in Erlang strings are just lists of integers. Therefore, Erlang chooses to interpret your first list as a string, since it contains

Does Erlang work on any non-x86 processors?

久未见 提交于 2019-12-19 16:33:02
问题 Does Erlang work on any non-x86 platforms? Microcontrollers for instance? I think it'd be neat to get a bunch of these and put Erlang code on them. Or does it work on GPUs? With Erlangs concurrent nature, it should be able to properly use a GPU. Or is CUDA pretty much it (at least for NVidia cards)? 回答1: erlang runs on anything that has gcc built for it just about. I have run it on mips, x86, ppc, and arm. It also runs on several vxworks platforms. 回答2: Erlang is not a great fit for GPUs.

Does Erlang work on any non-x86 processors?

好久不见. 提交于 2019-12-19 16:31:18
问题 Does Erlang work on any non-x86 platforms? Microcontrollers for instance? I think it'd be neat to get a bunch of these and put Erlang code on them. Or does it work on GPUs? With Erlangs concurrent nature, it should be able to properly use a GPU. Or is CUDA pretty much it (at least for NVidia cards)? 回答1: erlang runs on anything that has gcc built for it just about. I have run it on mips, x86, ppc, and arm. It also runs on several vxworks platforms. 回答2: Erlang is not a great fit for GPUs.

Does Erlang work on any non-x86 processors?

余生长醉 提交于 2019-12-19 16:31:08
问题 Does Erlang work on any non-x86 platforms? Microcontrollers for instance? I think it'd be neat to get a bunch of these and put Erlang code on them. Or does it work on GPUs? With Erlangs concurrent nature, it should be able to properly use a GPU. Or is CUDA pretty much it (at least for NVidia cards)? 回答1: erlang runs on anything that has gcc built for it just about. I have run it on mips, x86, ppc, and arm. It also runs on several vxworks platforms. 回答2: Erlang is not a great fit for GPUs.