erlang

Are erlang refs unique between nodes/VM restarts?

妖精的绣舞 提交于 2019-12-10 13:33:40
问题 Documentation says that make_ref() -> ref() Returns an almost unique reference. The returned reference will re-occur after approximately 2 82 calls; therefore it is unique enough for practical purposes. But my eyes tell me that between VM restarts I could easily get the same ref: [~] erl Erlang R14B04 (erts-5.8.5) 1> make_ref(). #Ref<0.0.0.33> 2> make_ref(). #Ref<0.0.0.37> ^C [~] erl Erlang R14B04 (erts-5.8.5) 1> make_ref(). #Ref<0.0.0.33> So, how unique Erlang’s Refs are? Are they suitable

Any way to convert a regular string in ActionScript 3 to a ByteArray of Latin-1 Character Codes?

醉酒当歌 提交于 2019-12-10 13:12:15
问题 I am having no problem converting a string to a byteArray of UTF-16 encoded characters, but the application I am trying to communicate with (written in Erlang) only understands Latin-1 encoding. Is there any way of producing a byteArray full of Latin-1 character codes from a string within Actionscript 3? 回答1: byteArray.writeMultiByte(string, "iso-8859-1"); http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.html#writeMultiByte() 来源: https://stackoverflow.com

Static typechecking in erlang

血红的双手。 提交于 2019-12-10 12:59:02
问题 I'm slowly falling in love with Erlang, and only have one big, BIG problem. I'm a big fan of languages like Standart ML and ocaml with their strong static typechecking. is there a nice and clean way to introduce somesort of static typechecking in erlang. I'm looking at the -type and -spec annotations. Does anyone have a nice solution? 回答1: I've been there! I love both OCaml and Erlang and use them regularly. By the time I started using Erlang I had years of experience with OCaml. It took me

RabbitMQ Failed to initialize erlang distribution

懵懂的女人 提交于 2019-12-10 12:45:36
问题 I have installed RabbidMQ but when i try to use rabbitmqctl status in cmd i have next result : D:\RabbitMQ\rabbitmq_server-3.6.2\sbin>rabbitmqctl status Error: Failed to initialize erlang distribution: {{shutdown, {failed_to_start_child, net_kernel, {'EXIT',nodistribution}}}, {child,undefined, net_sup_dynamic, {erl_distribution, start_link, [['rabbitmq-cli-70', shortnames]]}, permanent,1000,supervisor, [erl_distribution]}}. Folder with Erlang : D:\erl7.3 I have following environment variables

Possible xml parsing

心已入冬 提交于 2019-12-10 12:22:28
问题 I've got a newbie question. I'm trying to parse a xml message with pattern matching in functions A sample of a message is: <msg> <action type="xxx"... /> </msg> What I would like to able to do is ( sort of ) decode_msg_in( << $<,$m,$s,$g,$>, Message/binary, $<,$/,$m,$s,$g,$> >>, R ) -> The decode does not work (obviously, it's only a indication on what I'd like to do ) Is this even possible? Does anyone have an idea? Or do I need to "iterate" the whole message as a list, building new "words"

How to uninstall odbc for Ejabberd?

…衆ロ難τιáo~ 提交于 2019-12-10 11:52:19
问题 I have installed Ejabberd with odbc_mysql before, but I want to use mnesia now, so I removed odbc by: {auth_method, internal}. %% {auth_method, odbc}. But when I close mysql service, and restart ejabberd , I found that there are connection error: E(<0.333.0>:ejabberd_odbc:542) : mysql_conn: post_start error connect_failed So how to removed odbc ? 回答1: I suspect the problem might be due to the fact ejabberd's configuration file is used to bootstrap the "real" configuration storage which uses

ejabberd status showing error while server is running

不羁的心 提交于 2019-12-10 11:39:07
问题 I am trying to configure eJabberd on my server. I finished the installation. The following sequence of commands gives an unexpected output: $ ejabberd start $ ejabberd status In this sequence the ejabbed is started and we are able to access the web admin interface. But after running the ejabberd status its giving following output: Failed to create main carrier for temp_alloc /sbin/ejabberdctl: line 412: 9616 Aborted $EXEC_CMD "$ERL $NAME ${CONN_NAME} -noinput -hidden -pa $EJABBERD_EBIN_PATH

Escape Html in erlang

江枫思渺然 提交于 2019-12-10 11:39:04
问题 Does anyone have a good way to escape html tags in erlang (as for CGI.escapeHtml in Ruby)? Thanks 回答1: Well, i would tell you to roll your own method using string and list processing But, i would also say that if you have yaws web server source, there is a method i have used and copied into my own libraries. yaws_api:url_encode(HtmlString) . See it here in action. 1> Html = "5 > 4 = true". "5 > 4 = true" 2> yaws_api:url_encode(Html). "5%20%3E%204%20%3D%20true" 3> I hope this is some how what

how to animate picture without making it flicker using wxWidgets in erlang?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 11:38:56
问题 I am trying to make images seems like moving. I clear the screen and put the images back on it, but the screen is flickering a lot. Is there a way to make it seems like moving without flicker that much? the "draw_asteroids" is called every 100 ms since I want the movement of the image to be as much as continuous as possible, plus i have many other elements that move on screen as well (the code is similar to the spaceship). my code: start-> Wx = wx:new(), Frame = wxFrame:new(Wx, -1, "Main Game

trouble when using anonymous functions inside erlang modules

走远了吗. 提交于 2019-12-10 11:33:03
问题 i was working with anonymous functionss in erlang when a problem caught my attention. the function is defined as follows -module(qt). -export([ra/0]). ra = fun() -> 4 end. this however does not work -export(Ra/0]). Ra = fun() -> 4 end. and neither does this can anyone tell me why erlang exhibits this behaviour ? 回答1: An Erlang module cannot export variables, only functions. You can achieve something similar to exporting variables by exporting a function with zero arguments that simply returns