erlang

Ejabberd- Push notifications APNS and GCM with mod_offline_push

懵懂的女人 提交于 2020-01-06 18:09:55
问题 I'm trying to get push notifications working with ejabberd and I found this link here: https://github.com/diamondbybold/ejabberd_mod_offline_post where it should make a POST request at a URL for offline messages. I edited my ejabberd.yml file to include the URL and token, however, I'm running into some issues when trying to run it on Ejabberd 16.12. It runs, but I send a message to someone offline, I'm seeing the following error in /var/log/ejabberd/error.log 2017-02-07 09:12:19.359 [error]

Ejabberd- Push notifications APNS and GCM with mod_offline_push

拥有回忆 提交于 2020-01-06 18:09:09
问题 I'm trying to get push notifications working with ejabberd and I found this link here: https://github.com/diamondbybold/ejabberd_mod_offline_post where it should make a POST request at a URL for offline messages. I edited my ejabberd.yml file to include the URL and token, however, I'm running into some issues when trying to run it on Ejabberd 16.12. It runs, but I send a message to someone offline, I'm seeing the following error in /var/log/ejabberd/error.log 2017-02-07 09:12:19.359 [error]

Erlang exercise, creating lists

你离开我真会死。 提交于 2020-01-06 14:11:08
问题 I`m learning Erlang and doing exercises from the book: "Write a function which returns a list of the format [1,2,..,N-1,N]. create(3) -> [1,2,3]." I have a solution, which is: create(N) -> create(1, N). create (M,M) -> [M]; create(M,N) -> [M | create(M+1, N)]. I went through it dozen of times, but I simply can`t understand what is happening on line 2 of the solution. Can please somebody explain? Thank you. EDIT. Ok, so i think I`m on the right track for understanding it. In line 2, the new

inets httpd: Can't get simple esi script to work

只愿长相守 提交于 2020-01-06 11:47:23
问题 Here's the proplist_file that I use to configure the httpd server: [ {modules, [ mod_alias, mod_actions, mod_cgi, mod_get, mod_esi, mod_log ]}, {bind_address, "localhost"}, {port,0}, {server_name,"httpd_test"}, {server_root,"/Users/7stud/erlang_programs/inets_proj"}, {document_root,"./htdocs"}, {script_alias, {"/cgi-bin/", "/Users/7stud/erlang_programs/inets_proj/cgi-bin/"} }, {erl_script_alias, {"/cgi-bin/example", [httpd_example]} }, {erl_script_nocache, true}, {error_log, "./errors.log"},

inets httpd: Can't get simple esi script to work

南楼画角 提交于 2020-01-06 11:47:20
问题 Here's the proplist_file that I use to configure the httpd server: [ {modules, [ mod_alias, mod_actions, mod_cgi, mod_get, mod_esi, mod_log ]}, {bind_address, "localhost"}, {port,0}, {server_name,"httpd_test"}, {server_root,"/Users/7stud/erlang_programs/inets_proj"}, {document_root,"./htdocs"}, {script_alias, {"/cgi-bin/", "/Users/7stud/erlang_programs/inets_proj/cgi-bin/"} }, {erl_script_alias, {"/cgi-bin/example", [httpd_example]} }, {erl_script_nocache, true}, {error_log, "./errors.log"},

inets httpd: Can't get simple esi script to work

一笑奈何 提交于 2020-01-06 11:46:08
问题 Here's the proplist_file that I use to configure the httpd server: [ {modules, [ mod_alias, mod_actions, mod_cgi, mod_get, mod_esi, mod_log ]}, {bind_address, "localhost"}, {port,0}, {server_name,"httpd_test"}, {server_root,"/Users/7stud/erlang_programs/inets_proj"}, {document_root,"./htdocs"}, {script_alias, {"/cgi-bin/", "/Users/7stud/erlang_programs/inets_proj/cgi-bin/"} }, {erl_script_alias, {"/cgi-bin/example", [httpd_example]} }, {erl_script_nocache, true}, {error_log, "./errors.log"},

How to set a 24 byte length key to elixir/erlang block_encrypt/4 function using des_ede3 as mode of encryption

久未见 提交于 2020-01-06 09:52:46
问题 Am trying to send data to an external api that expects encrypted data using 3DES encryption but am having issues understanding how to pass my api key as the key field to erlangs des_ede3 cipher. According to erlangs cipher docs des_ede3 expects 3 keys that are all 8 bytes in length. How can i pass my 24 byte api key as the key to elixir/erlang :cryptoblock_encrypt/4 function *** how can i pass key to block_encrypt/4 *** key = "123456789012345678901234" data = "hello world! The world is yours"

How to get a sample of a generator?

只愿长相守 提交于 2020-01-06 03:26:09
问题 I'm using Triq to write my property based test. How can I see what kind of data my generator produces? Let's say I have the following generator: -module (my). -include_lib("triq/include/triq.hrl"). -export([valid_type_gen/1]). valid_type_gen() -> non_empty(list(any())). I would like to examine what kind of data it generates, i.e. something like: $ rebar3 shell 1> my:valid_type_gen().sample() %??? [1,b,"blah"] 回答1: Ok, I figured it out, I just need to call the sample function: 1> hd(triq_dom

using ei_decode_list when decoding a nested list of elements

落爺英雄遲暮 提交于 2020-01-06 02:35:48
问题 I have a nested list of the form, {stack, "over", flow, ["is", "a"], ["knowledge", "sharing", "site"], "a", "b"} I am not able to cleanly decode the above tuple. I decode the above into a vector<vector<string> > However, If I replace the inner lists into a tuple, I am able to decode that fine. I doubt that the usage of ERL_NIL_EXT and ERL_LIST_EXT but the documentation is only a little helpful. Idea is if I get list inside my tuple, I am decoding that and returning a vector of strings and do

Erlang - How Can I Parse RFC1123 Dates Into An Erlang Term?

假如想象 提交于 2020-01-06 01:33:49
问题 Without using a third party module, what steps would I need to take to convert this: <<"Mon, 17 Feb 2014 11:07:53 GMT">> Into this?: [17, 2, 2014, 10, 07, 53] Most of the answers I've Googled suggest using a library. So far, I suspect I'd get somewhere by pattern matching the formatted date string. Something like: <<_:5/binary, Date:2/binary>> = <<"Mon, 17 Feb 2014 11:07:53 GMT">>... Which I think should produce the following 'match' Date = 17... That's based on an idea found here - https:/