erlang-shell

On_load_function_failed : cberl_nif (Erlang)

我是研究僧i 提交于 2021-01-29 04:11:32
问题 I am using https://github.com/chitika/cberl. My current application version is 1.2.1. Which is running fine. I created a new release 1.2.2 which upgraded fine. But when I started a new instance it failed on 1.2.2. It keep on throwing cberl error. If I start my prev release 1.2.1 and then upgrade it to 1.2.2 again then it works fine. But starting from scratch doesn't. My application (say test) failed to start. Command I used : bin/test console . OTP version used : 18.2. Compiled on OTP 18.2.

On_load_function_failed : cberl_nif (Erlang)

蹲街弑〆低调 提交于 2021-01-29 04:06:09
问题 I am using https://github.com/chitika/cberl. My current application version is 1.2.1. Which is running fine. I created a new release 1.2.2 which upgraded fine. But when I started a new instance it failed on 1.2.2. It keep on throwing cberl error. If I start my prev release 1.2.1 and then upgrade it to 1.2.2 again then it works fine. But starting from scratch doesn't. My application (say test) failed to start. Command I used : bin/test console . OTP version used : 18.2. Compiled on OTP 18.2.

Erlang and bash scripting (escript)

倖福魔咒の 提交于 2020-08-07 18:21:31
问题 I am very new in Erlang and want to merge bash script with Erlang node and function. I have one Mnesia Database where we go into Erlang node and run several function but i want to run those functions via some bash script so that I can use those bash script output elsewhere. My Erlang shell:- sudo /opt/butler_server/bin/butler_server remote_console Erlang/OTP 20 [erts-9.3.3.6] [source] [64-bit] [smp:28:28] [ds:28:28:10] [async-threads:10] Eshell V9.3.3.6 (abort with ^G) (butler_server

An error with ets and reading files

倾然丶 夕夏残阳落幕 提交于 2020-01-25 08:23:12
问题 Disclaimer: I didn't write this code, I'm just trying to make it work. I'm trying to get the code from here working. The setup is an Ubuntu 14.04 64bit machine with Erlang installed. The sequence of actions is as follows: What I'm doing is as follows: clone the code cd to the folder with the code and erl in terminal make:all([load]). polis:create(). polis:start(). benchmarker:start(slidingwindow50). The errors I get are: 4> benchmarker:start(slidingwindow50). true Dimensions:4, Plasticity

What could cause the `net_adm` kernel Erlang module to be unavailable?

百般思念 提交于 2020-01-21 19:18:30
问题 Installed Erlang (releases from 19 to 22) using the Nix package manager apt and compiling from source on Ubuntu 18.04 with Xmonad and Debian 9 running in the cloud , but every time, net_adm is not available through the Erlang shell event though other kernel modules are. I assume that this is caused by an external system configuration because couldn't find anything about this online, so people are not complaining about it. (Only found one person so far.) 回答1: Kind of ashamed to admit that I am

Why do I get syntax error before: '{'?

故事扮演 提交于 2020-01-14 13:55:43
问题 While playing with Erlang getting started section I have met bizarre syntax error on trivial use case (simple map initialization). Are there any suggestion why does that happen? 1> #{ "key" => 42}. 1: syntax error before: '{' Details: Erlang R16B03 (erts-5.10.4), Eshell V5.10.4. 回答1: Because maps were introduced in Erlang 17. You have to upgrade your installation or do not use maps. 来源: https://stackoverflow.com/questions/31589190/why-do-i-get-syntax-error-before

Erlang Message passing between process

有些话、适合烂在心里 提交于 2020-01-07 15:20:20
问题 I am writing code that reads two input files and checks if the words in the first file are present in the second file. I want to check elements of the list one by one via process message passing. Here is my code: start()-> Pid2 = spawn(?MODULE,check2,[]), spawn(?MODULE,check1,[Pid2]). check1(Pid2) -> {ok, Data} = file:read_file("input.txt"), B = binary:split(Data, [<<" ">>], [global]), K = [binary_to_list(Item) || Item <- B], [Pid2 ! Element || Element <- K]. check2() -> {ok,IoDevice} = file

Remove a substring/ string pattern of a string in Erlang

笑着哭i 提交于 2020-01-05 10:02:29
问题 I have an xml string like S = "<B xmns=\"som2\"> <a other='v1' more='v2'/><b some=\"v3/></B>". I want to remove the end tag </B> S2 = "<B xmns=\"som2\"> <a other='v1' more='v2'/><b some=\"v3/>" How can I achieve this? 回答1: If you only want to remove the specific string literal </B> then getting a sublist will do the trick: S = "<B xmns=\"som2\"> <a other='v1' more='v2'/><b some=\"v3\"/></B>", lists:sublist(S, 1, length(S) - 4). %%= "<B xmns=\"som2\"> <a other='v1' more='v2'/><b some=\"v3\"/>"

Erlang: invoking erl -eval from command line never exits

旧巷老猫 提交于 2019-12-25 01:56:02
问题 I have a simple Erlang command that I want to invoke via erl -eval (to compile erlydtl template, as described on erlydtl page). When I do it interactively from shell everything works fine and the command exits immediately: erl -pa ebin deps\erlydtl\ebin Eshell V5.9.3.1 (abort with ^G) 1> erlydtl:compile('templates/tictactoe.dtl',tictactoe_dtl,[{out_dir,'ebin'}]). ok But when I try to do it via erl -eval (I want to run this from .bat file): erl -pa ebin deps\erlydtl\ebin -noshell -eval erlydtl

Erlang case statement

只谈情不闲聊 提交于 2019-12-24 04:22:28
问题 I have the following Erlang code and it is giving the warning as follows, when i try to compile it, but that make sense. function need two arguments, but i need to patten match "everything else" rather x, y or z. -module(crop). -export([fall_velocity/2]). fall_velocity(P, D) when D >= 0 -> case P of x -> math:sqrt(2 * 9.8 * D); y -> math:sqrt(2 * 1.6 * D); z -> math:sqrt(2 * 3.71 * D); (_)-> io:format("no match:~p~n") end. crop.erl:9: Warning: wrong number of arguments in format call. I was