erlang

erlang rebar escriptize & nifs

China☆狼群 提交于 2019-12-06 21:38:26
问题 I can use nif's if I write the escript myself, however when I use rebar escriptize the nif functions cannot be found. I think it is because *.so objects are not getting packed like beam files. Here is an simple example; rebar.config : {deps, [ {'jiffy', "", {git, "https://github.com/davisp/jiffy.git", {branch, master}}} ]}. {escript_incl_apps, [jiffy]}. %% I tried this to see what happens if the so got in there but didn't help {escript_incl_extra, [{"deps/jiffy/priv/jiffy.so", "/path/to/my

Erlang File Append mode

流过昼夜 提交于 2019-12-06 20:53:45
问题 I m trying to write some content in file using append mode in erlang but it giving error as bad argument. Syntax used: file:write_file("/tmp/test1.txt","Abhimanyu","append"). error:{error,badarg} thank you 回答1: On the "don't create it if it doesn't exist" additional question, you have to be more creative by using something like file:read_file_info : case file:read_file_info(FileName) of {ok, FileInfo} -> file:write_file(FileName, "Abhimanyu", [append]); {error, enoent} -> % File doesn't exist

How to uninstall or upgrade Erlang/OTP?

天涯浪子 提交于 2019-12-06 18:38:11
问题 How can I uninstall Erlang/OTP which I use make install to build from source earlier. The install is pretty simple by using ./configure;make;make install; The reason to uninstall is that I want to upgrade from Erlang R15B01 to Erlang R15B03 . Now I have: # erl --version Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9.1 (abort with ^G) 1> 回答1: There is an option --prefix=path of script configure, where path is a path to directory

Erlang needs to connect to https server?

六眼飞鱼酱① 提交于 2019-12-06 16:49:01
I have an erlang application and it needs to connect to a php application hosted on Apache with HTTPS. How do I install the client certificate on my erlang machine? The SSL module of Erlang/OTP which is the interface for Secure Socket Layer has an option for defining client side certificate: {cacertfile, path()} Path to a file containing PEM-encoded CA certificates. The CA certificates are used during server authentication and when building the client certificate chain. Now if you want to use an HTTP client with the support of client side ssl certificate instead of writing everything by

How do I handle a WebSocket close from the client in Yaws?

时间秒杀一切 提交于 2019-12-06 16:47:18
I have implemented a simple appmod that handle WebSockets and echo back the messages. But how do I handle an ws.close(); from the JavaScript client? I have tried with the code below, but handle_message({close, Reason}) is never called and ws.onclose = function(evt) {} is never executed on the JavaScript client. When I use the same JavaScript client code interacting with a node.js websocket, the client receives an onclose event immediately after ws.close(); . Here is the code for my simple appmod : -module(mywebsocket). -export([handle_message/1]). handle_message({text, Message}) -> {reply,

How to read erlang term from redis by using java client?

孤者浪人 提交于 2019-12-06 16:38:33
e.g. I save the tuple T = {k1, v1, k2, v2} to the redis by jedis: eredis:q(Conn, ["SET", <<"mykey">>, term_to_binary(T)]). I am trying to use the code below to read this erlang term: Jedis j = Redis.pool.getResource(); byte[] t = j.get("mykey").getBytes(); OtpInputStream ois = new OtpInputStream(t); System.out.println(OtpErlangObject.decode(ois)); The error is: com.ericsson.otp.erlang.OtpErlangDecodeException: Uknown data type: 239. So how can I get the erlang term correctly? Erlang side: term_to_binary({k1, v1, k2, v2}). <<131,104,4,100,0,2,107,49,100,0,2,118,49,100,0,2,107,50, 100,0,2,118,50

Time zone list issue

早过忘川 提交于 2019-12-06 16:37:40
For my application, I'm importing the calendar event from google calendar. The only problem which I'm facing is Time zone list. I'm getting the timezone as output from google calendar xml, which I have to check with time zone list and add time accordingly... so from where I can get this standard time zone list.. or some other alternative to achieve the same. If you're using Java, use Joda Time - the time zone ID given by Google Calendar will be one the Joda Time understands. The standard TimeZone class may well understand it too, but I think Joda is more likely to. Assuming you're seeing all

what good orm api will work well with scala or erlang

牧云@^-^@ 提交于 2019-12-06 16:15:33
问题 I'm considering taking up scala programming but i'm really concerned about what will become of my ORM based applications. I currently use hibernate as my ORM and i find it a really reliable tool. I'd like to know if there's any ORM tool as efficient but written in scala, or will hibernate work seamlessly with it. i don't want to have to start writing endless sql queries again (like the days of JDBC). I also have the same thought about erlang. is there a good orm out there for erlang?? and can

RabbitMQ 离线安装(带视频)

随声附和 提交于 2019-12-06 15:23:55
疯狂创客圈 Java 高并发【 亿级流量聊天室实战】实战系列 【 博客园总入口 】 架构师成长+面试必备之 高并发基础书籍 【 Netty Zookeeper Redis 高并发实战 】 疯狂创客圈 高并发 环境 视频,陆续上线: Windows Redis 安装(带视频) Linux Redis 安装(带视频) Windows Zookeeper 安装(带视频) Linux Zookeeper 安装(带视频) RabbitMQ 离线安装(带视频) Nacos 安装(带视频) 小视频以及所需工具的 百度网盘链接 ,请参见 疯狂创客圈 高并发社群 博客 依赖包安装 Rabbitmq安装主要依赖两个rpm依赖包:** erlang和socat**。 Rabbitmq依赖包的下载和安装 下载erlang, 在https://packagecloud.io/rabbitmq/erlang页面选择对应版本的erlang的rpm安装包(centos7需要19.3以上版本)。这里选择的是版本为22.0.6。 疯狂创客圈的网盘,有提供离线包 将下载后的erlang安装包上传到Linux的/usr/local目录,然后,使用rpm命令进行安装,命令如下: sudo rpm -ivh /usr/local/erlang-22.0.6-1.el6.x86_64.rpm socat 依赖包的下载和安装

centos7上安装erlang22.1

浪尽此生 提交于 2019-12-06 15:00:50
1.下载安装包 wget http://erlang.org/download/otp_src_22.1.tar.gz 2.解压 tar -xzvf otp_src_22.1.tar.gz 3.cd otp_src_22.1 4.创建安装目录 mkdir /opt/erlang_22.1 5. 配置 ./configure --prefix=/opt/erlang_22.1 6.关注 APPLICATIONS DISABLED ,其他可忽略 7.若使用c++编译则可以忽略jinterface:No java compiler found 8.yum -y install ncurses-devel 9.yum -y install openssl 10.yum -y install openssl-devel 11.yum -y install unixODBC-devel 12.重新配置 ./configure --prefix=/opt/erlang_22.1 或 ./configure --prefix=/opt/erlang_22.1 --without-javac 13.安装 make && make install 14. 配置环境变量 vim /etc/profile 在最后新加一行 export PATH=$PATH:/opt/erlang_22.1/bin 退出,