erlang

Thrift: Python Server, Erlang Client Errors… {thrift_socket_server,244,{child_error,function_clause,[]}}

我与影子孤独终老i 提交于 2019-12-12 14:27:54
问题 This is actually my first question on stackoverflow, but I've been having a problem that I can't really seem to solve. I'm making a Python server that calls an erlang client through thrift. The only function I've made in thrift is one called bar, which takes in an integer and prints bar (integer). Heres the Python Client, its not too complicated: #!/usr/bin/env python import sys sys.path.append('../gen-py') from foo import Foo from foo.ttypes import * from foo.constants import * from thrift

IMAP client library in Erlang to query IMAP servers [closed]

白昼怎懂夜的黑 提交于 2019-12-12 14:16:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Is there any working IMAP client library implemented in Erlang which can query IMAP servers? 回答1: erlmail easily found on google 回答2: there is another one erlimap. But work is in progress. 来源: https://stackoverflow.com/questions/2866956/imap-client-library-in-erlang-to-query-imap-servers

Erlang: Interfacing with Xalan: port driver or nif?

左心房为你撑大大i 提交于 2019-12-12 13:53:15
问题 I'd like to get a real XSLT processor working with erlang. Which would be the best interface, nif or port driver? According to the nif documentation, nif calls block the runtime, so they should not take long. Is processing a long xml document too long? Also, I'd like to allow erlang callbacks during the transformation. Does that seem possible? Possible with nif but not port drivers or vice versa? I've never written any C, so I figured this would be good introduction. Xalan is C++. I assume

problems in printing each digit of a number in erlang

孤街醉人 提交于 2019-12-12 13:28:48
问题 I am trying to make a program that will read in a number and then output every digit of that number in a list. However, most of the things look fine until I try with number 8 and 9. The program only output \b \t instead. if the input number contains 8 or 9, and in the same time there are other numbers, for example 283 , it will print normally. Otherwise if there is only 8 or 9, such as 8 , 99 , then it will give me that binary representation of 8 and 9 (if I remember correctly). My program is

Erlang: How to transform a decimale into a Hex string filled with zeros

你离开我真会死。 提交于 2019-12-12 13:04:34
问题 I would like to transform 42 (Base 10) into 000002A (Base 16) in Erlang... I have found some pointers on the web : io:format("~8..0B~n", [42]) -> 00000042 And io:format("~.16B~n", [42]) -> 2A But I cannot seems to find how to do both at the same time, I have tried : io:format("~8..0.16B~n", [42]) Which seemed to be the logical thing, but it is not, it gives me an error. Thanks. 回答1: io:format("~8.16.0B~n", [42]). 0000002A basically, it's ~F.P.Pad where: F = field width P = precsion Pad = pad

Setting node name dynamically at boot time

南楼画角 提交于 2019-12-12 12:25:03
问题 I am building my release using relx and I can not use the default -sname someuser@127.0.0.1 . Instead I would like to do something like -sname someuser@`hostname -i` to define the node's public IP at boot time. Using -sname someuser@ hostname -i`` does not work because hostname -i is not expanded to a real IP. I tried to use net_kernel:start(xxxxxxx) but it did not work. Is there any way to get a dynamic -sname in vm.args using relx ? Thanks :) 回答1: As written in the documentation (and

Erlang - undefined function

给你一囗甜甜゛ 提交于 2019-12-12 12:18:09
问题 I'm trying to execute a very simple Erlang code, and it's not working. I've tryied executed some hello worlds without problem, but not mine own code. -module(server). %% Exported Functions -export([start/0, process_requests/1]). %% API Functions start() -> ServerPid = spawn(server, process_requests, [[]]), register(myserver, ServerPid). process_requests(Clients) -> receive {client_join_req, Name, From} -> NewClients = [From|Clients], %% TODO: COMPLETE broadcast(NewClients, {join, Name}),

Type of non-terminating function in erlang

时光毁灭记忆、已成空白 提交于 2019-12-12 12:13:53
问题 I'm learning erlang and trying to use dialyzer to get maximum type-safety when it's possible. There's a thing that I don't understand: what is the type of non-terminating function and how to denote it in spec. Could you please shed a light on this? 回答1: A function that loops forever and never terminates has the return type no_return() . (That return type is also used for functions that always throw exceptions, e.g. a custom error function. If you don't specify that return type, Dialyzer will

How to use erlang-examples

落花浮王杯 提交于 2019-12-12 11:34:46
问题 I just downloaded Erlang using apt-get onto Ubuntu 10.10 . How do I run the examples that come with Erlang (the examples you can get through apt-get install erlang-examples ). I tried going to the directory where they were stored and compiling ball.erl , but I got this error: ball.bea#: error writing file error 回答1: The directory where those examples are stored isn't writeable by normal users. To compile a .erl file, the compiler needs to be able to write out the compiled .beam file. One way

Where should you put application properties in a rebar erlang application?

倖福魔咒の 提交于 2019-12-12 11:23:42
问题 A newbie question: I wrote my first rebar based erlang application. I want to configure some basic properites like server host etc. Where is the best place to put them and how should I load them into the app? 回答1: The next steps are to make a release and create a node in it. A node runs your application in a standalone Erlang VM. A good starting point for creating a release using rebar: Erlang Application Management with Rebar Once you have created a release. The configuration properties for