From bbmaj7@REDACTED Tue Apr 1 04:02:31 2008 From: bbmaj7@REDACTED (Richard Andrews) Date: Tue, 1 Apr 2008 13:02:31 +1100 (EST) Subject: [erlang-questions] linkedin driver licence question In-Reply-To: Message-ID: <787462.2527.qm@web52010.mail.re2.yahoo.com> --- Matthew Dempsky wrote: > > If I develope a linkedin driver which use a GPL library, I don't have > > to publish source of my programs which use this driver, correct? I > > will only have to publish source for the driver (because Erlang > > already is open source)? > > You should be aware that the Erlang Public License is incompatible > with the GPL. You'll have legal trouble if your linked-in driver is > considered a derivative work of both the Erlang runtime and that GPL > library. See http://www.gnu.org/licenses/gpl-faq.html#GPLPluginsInNF > for some more information. Hmmm... Does erlang consider a linked-in driver to be a work derived from erlang? Has this question been formally (and legally) answered anywhere? Get the name you always wanted with the new y7mail email address. www.yahoo7.com.au/y7mail From ahmed.nawras@REDACTED Tue Apr 1 09:19:53 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 1 Apr 2008 11:19:53 +0400 Subject: [erlang-questions] new version of Erlsom XML parser In-Reply-To: <407d9ef80803301152q7fc111ben431c0b2f71b5026d@mail.gmail.com> References: <407d9ef80803301152q7fc111ben431c0b2f71b5026d@mail.gmail.com> Message-ID: Hi Willem, Thanks for the information. How about backword compatibility with previous versions of erlsom? I'm asking in order to know if I can just drop this version in yaws and have it seamlessly work. Best regards, Ahmed Al-Issaei 2008/3/30 Willem de Jong : > Hello List, > > I have released a new version of Erlsom. > > The main changes: > - I modified the SAX parser that is at the basis of erlsom to work > directly on binaries, taking advantage of the improved handling of > binaries > in Erlang R12B. This has increased the speed (provided that R12B is used) > and > decreased the memory usage. > > - Some other improvements to the SAX parser: > - it now understands user defined entities; > - working with a 'continuation' function (to support a streaming mode of > processing) has been made easier; > - the output values can be binaries in stead of strings; > - I added some examples and improved the documentation a bit; > > - I changed the license to the Lesser GPL. > > Erlsom can be found on sourceforge: http://sourceforge.net/projects/erlsom > > Regards, > Willem > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From w.a.de.jong@REDACTED Tue Apr 1 09:50:59 2008 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Tue, 1 Apr 2008 09:50:59 +0200 Subject: [erlang-questions] new version of Erlsom XML parser In-Reply-To: References: <407d9ef80803301152q7fc111ben431c0b2f71b5026d@mail.gmail.com> Message-ID: <407d9ef80804010050w3ff64d5fpd6a795832d6314eb@mail.gmail.com> Hi Ali, It should be backward compatible. You should do some tests to be sure, as always... Let me know if you have any problems. I am not sure whether the yaws SOAP solution does explicit decoding and conversion to list. If that is the case, you won't get the benefit of the new binary parsing. I'll have a look. Regards, Willem On 4/1/08, Ahmed Ali wrote: > > Hi Willem, > > Thanks for the information. How about backword compatibility with > previous versions of erlsom? I'm asking in order to know if I can just > drop this version in yaws and have it seamlessly work. > > Best regards, > > Ahmed Al-Issaei > > 2008/3/30 Willem de Jong : > > Hello List, > > > > I have released a new version of Erlsom. > > > > The main changes: > > - I modified the SAX parser that is at the basis of erlsom to work > > directly on binaries, taking advantage of the improved handling of > > binaries > > in Erlang R12B. This has increased the speed (provided that R12B is > used) > > and > > decreased the memory usage. > > > > - Some other improvements to the SAX parser: > > - it now understands user defined entities; > > - working with a 'continuation' function (to support a streaming mode > of > > processing) has been made easier; > > - the output values can be binaries in stead of strings; > > - I added some examples and improved the documentation a bit; > > > > - I changed the license to the Lesser GPL. > > > > Erlsom can be found on sourceforge: > http://sourceforge.net/projects/erlsom > > > > Regards, > > Willem > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mpquique@REDACTED Tue Apr 1 12:21:24 2008 From: mpquique@REDACTED (=?ISO-8859-1?Q?Enrique_Marcote_Pe=F1a?=) Date: Tue, 1 Apr 2008 12:21:24 +0200 Subject: [erlang-questions] Modbus/TCP anyone? Message-ID: <016119D6-53A4-4A6F-809D-6F43D1D6D1E5@gmail.com> Hi, Is there any erlang Modbus/TCP implementation available? Thanks in advance, -- Quique From kenneth.lundin@REDACTED Tue Apr 1 15:20:53 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 1 Apr 2008 15:20:53 +0200 Subject: [erlang-questions] R11B-5 vs R12B-1: Win32 CPU Usage? In-Reply-To: <01d001c8935d$9979d840$c800a8c0@jan03> References: <01d001c8935d$9979d840$c800a8c0@jan03> Message-ID: Hi Jan, (strange!, this is the second time I see exactly the same mail from you and give the same answer, didn't you see my previous answer?) On 3/26/08, Jan Jacobs wrote: > Yesterday I decided to change from R11B-1 to R12B-1 and had the following > issues: > > 1) erl_interface libraries requires Visual Studio 2005 (Not documented at > all) I agree with you that this could have been mentioned in the release notes. There are no significant changes in the erl_interface code that requires Visual Studio 2005 it is just that we where forced to upgrade from the ancient MSVC we used to build with before because of the SMP support for Windows intruduced in R12B. We therefore build all the C-binaries with the same compiler from MSVS 2005 even if it is not really required for erl_interface. If you need erl_interface built with another compiler i think it is pretty straight forward to do that yourselves. You can also link your C program with erl_interface from R11B and run it towards the R12B system, I see no reason for this to cause problems. > > 2) R12B-1 consumes more CPU time than R11B-1. > I am not sure (rather the opposite) that the CPU time is a relevant measure. The interesting question is if your application executes significantly slower under R12B-1 than under R11B. If that is the case we can investigate why. It is also important to know if you have recompiled all your modules with the R12B compiler and also if you are running the SMP or non SMP version of the Erlang VM. On multicore machines as well as hyperthreaded ones the SMP version will be started as default. As far as we know the R12B version should be slightly faster than the R11B version on Windows. /Regards Kenneth, Erlang/OTP team Ericsson From kosmyq@REDACTED Tue Apr 1 17:20:47 2008 From: kosmyq@REDACTED (Bo) Date: Tue, 1 Apr 2008 08:20:47 -0700 (PDT) Subject: [erlang-questions] Questions on gen_tcp & flexible parsing Message-ID: <654085.82260.qm@web51102.mail.re2.yahoo.com> I have now been programming in Erlang for quite a while and most things are really easy to do, but I found some rather tough issues, here the come: 1) When using the example server from the man pages of the gen_tcp / inet unit I have tried to create an auto update routine, which does a sort of ?MODULE:loop(), but it seems that the sockets just won't let go, stick to the running module and as expected under the circunstances, after the second update Erlang moves the sockets out of the VM and ends the processes, so I cannot create a socket server which permits to be updated in runtime. Just for info, under any other cicumstances I have managed to create all my other modules to be updatable and it works just fine, except this simple socket server ?? Does gen_tcp have problems to do the typical ?MODULE:loop(X) ?? 2) Erlang describes that one can limit the size of the packet to be received by a socket, if it's longer it gets marked invalid and I would suppose that it gets dropped, the parameter is called packet_size. I would like to limit the packets to be received to be of X size, the example below shows 255, yet I can successfully send large packets to the socket, what's wrong ?? Note: Why do I want this ?? I want to avoid problems where hackers do a buffer overrun hack and crash the server by sending many large packets which then write to memory at some point or crash the server because it exhausts memory, something very common in Windows hacks. inet states that much depends on the underlying OS, which is Windows in this case, but I do not know if this parameter depends on the OS. Example: case gen_tcp:listen(LPort,[{active, false},{packet_size, 255}, {packet,0},{recbuf, 255},{sndbuf, 255}]) of {ok, ListenSock} -> ........ I have even used recbuf and sndbuf which do not seem to do anything either. 3) Also, I am writing a small scripted client to test the server part, now, when I am bombarding the server with messages and ask it to send these to the other processes I face the following problem: first of all and thankfully, Erlang keeps up, the server does not seem to crash, yet, when a client finally crashes with a stack overflow (problably a memory leak or too much data), this particular acceptor on the server side does not exit, although I have included code to make sure that the exit gets trapped, yet this process stays alive, instead of closing. My question here is has anyone faced this before ?? When a client exits normally no problem ocurrs, only when it crashes. 4) I am building a command parser which needs to parse in commands of the structure {CMD:DETAIL}. Each time the server receives a packet it may receive several commands of this structure, which is why I need to parse a list of commands and the parsing code could look like this: parsecmd(T) -> parseusr(T, []). parscmd("{USR:" ++ T, L) -> {Url, T1} = collect_cmd(T, reverse("")), parsecmd(T1, [Url|L]); parsecmd([_|T], L) -> parsecmd(T, L); parseusr([], L) -> L. collect_cmd("}" ++ T, L) -> {reverse(L, ""), T}; collect_cmd([H|T], L) -> collect_cmd(T, [H|L]); collect_cmd([], _) -> {[],[]}. I would like to call parsecmd(,) The problem is that I cannot pass "{CMD:" as a parameter, like in the above "{USR:", if I do Erlang complains that it cannot process that structure, where "{CMD:" is a list. Is there any way this can be parametrized ?? Or is there another function ?? And no, I have not used YECC, because I find its working incomprehensible. I can already parse several commands when I search separately for "{", "}" and ":" but not for "{CMD:" and "}", where CMD is a variable that I want to pass to the the parsing function. Any help is appreciated, I have researched different unit'mans, the whole Erlang Bible, other examples but I cannot find a solution to those 4 issues, so I am turning to the ever so wise community. Thanks in advance, Bo --------------------------------- You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mpquique@REDACTED Tue Apr 1 20:20:14 2008 From: mpquique@REDACTED (=?ISO-8859-1?Q?Enrique_Marcote_Pe=F1a?=) Date: Tue, 1 Apr 2008 20:20:14 +0200 Subject: [erlang-questions] Modbus/TCP anyone? In-Reply-To: <47F27519.9050308@snEnterprises.de> References: <016119D6-53A4-4A6F-809D-6F43D1D6D1E5@gmail.com> <47F27519.9050308@snEnterprises.de> Message-ID: <98953E06-AB28-43B9-83E7-D5F8C404D87E@gmail.com> Thank you very much Stefan, I will test it against an ADAM 6060 (data acquisition and control module) and let you know. UDP should suit me also, I believe this device supports both. Thanks again. Cheers, Quique El 01/04/2008, a las 19:47, Stefan Nickl escribi?: > Enrique Marcote Pe?a wrote: >> Hi, >> Is there any erlang Modbus/TCP implementation available? > > I've hacked up some code for this, progressing at a rate of > about 20 lines per christmas season when I got some time :) > > Actually it uses UDP, but I've used TCP before and switched > to UDP since I feel that's the more natural thing for modbus. > > Testing against a Kontron ThinkIO = Wago I/O-IPC. > > Regards, > Stefan > %%%------------------------------------------------------------------- > %%% File : modbus_tcp.erl > %%% Author : > %%% Description : > %%% > %%% Created : 29 Dec 2004 by > %%%------------------------------------------------------------------- > -module(modbus). > > -behaviour(gen_fsm). > > %% API > -export([start_link/2]). > > %% gen_fsm callbacks > -export([init/1, > state_process_request/3, > state_wait_for_response/2, state_process_response/2, > handle_event/3, handle_sync_event/4, handle_info/3, > terminate/3, code_change/4, > read_reg/1, read_reg/2, write_reg/2, add_clamp/5, get_clamp_addr/ > 1]). > > -record(state, {sock, host, port, caller, quantity, tid=0, reply, > clamps=[]}). > > -record(clamp, {name, in_words, out_words, in_coils, out_coils}). > > -define(TIMEOUT, 3000). > > -define(SERVER, {local, ?MODULE}). > -define(REF, ?MODULE). > > -define(FC_READ_COILS, 16#01). > -define(FC_WRITE_COILS, 16#0f). > -define(FC_READ_REGS, 16#03). > -define(FC_WRITE_REGS, 16#10). > -define(FC_GET_COM_EVENT, 16#0b). > > %%==================================================================== > %% API > %%==================================================================== > %%-------------------------------------------------------------------- > %% Function: start_link() -> ok,Pid} | ignore | {error,Error} > %% Description:Creates a gen_fsm process which calls Module:init/1 to > %% initialize. To ensure a synchronized start-up procedure, this > function > %% does not return until Module:init/1 has returned. > %%-------------------------------------------------------------------- > start_link(Host, Port) -> > gen_fsm:start_link(?SERVER, ?MODULE, [Host, Port], > [{debug, [trace]}]). > > add_clamp(Name, InWords, OutWords, InCoils, OutCoils) -> > gen_fsm:sync_send_all_state_event(?REF, > {add_clamp, InWords, OutWords, InCoils, OutCoils}). > get_clamp_addr(Name) -> > gen_fsm:sync_send_all_state_event(?REF, > {get_clamp_addr, Name}). > > read_reg(Offset) -> > read_reg(Offset, 1). > read_reg(Offset, Length) -> > Reply = gen_fsm:sync_send_event(?REF, > {mb_read_regs, Offset, Length}), > %io:format("reg 0x~s: ~w~n", [httpd_util:encode_hex(Offset), > Reply]), > {mb_read_regs, ValuesList} = Reply, > {ok, ValuesList}. > > % thinkio seems not to support readback from 0x200 +x, implement > shadow > % registers with a dict sometime. > write_reg(Offset, ValuesList) -> > Reply = gen_fsm:sync_send_event(?REF, > {mb_write_regs, Offset, ValuesList}), > timer:sleep(10), % 4-5ms seem to be maximum for reality to > catch up > {mb_write_regs, _Start, _Quantity} = Reply, > {ok, ValuesList}. > % io:format("reg 0x~s: ~w~n", [httpd_util:encode_hex(Offset), > Reply]). > > %%==================================================================== > %% gen_fsm callbacks > %%==================================================================== > %%-------------------------------------------------------------------- > %% Function: init(Args) -> {ok, StateName, State} | > %% {ok, StateName, State, Timeout} | > %% ignore | > %% {stop, StopReason} > %% Description:Whenever a gen_fsm is started using gen_fsm:start/ > [3,4] or > %% gen_fsm:start_link/3,4, this function is called by the new > process to > %% initialize. > %%-------------------------------------------------------------------- > init([Host, Port]) -> > {ok, Sock} = gen_udp:open(0, [binary, inet]), > timer:send_interval(1000, tick), > {ok, state_process_request, #state{sock=Sock, host=Host, > port=Port}}. > > %%-------------------------------------------------------------------- > %% Function: > %% state_name(Event, State) -> {next_state, NextStateName, NextState}| > %% {next_state, NextStateName, > %% NextState, Timeout} | > %% {stop, Reason, NewState} > %% Description:There should be one instance of this function for > each possible > %% state name. Whenever a gen_fsm receives an event sent using > %% gen_fsm:send_event/2, the instance of this function with the > same name as > %% the current state name StateName is called to handle the event. > It is also > %% called if a timeout occurs. > %%-------------------------------------------------------------------- > %state_name(_Event, State) -> > % {next_state, state_name, State}. > > state_wait_for_response(Event, State) -> > io:format("entered wait_for_response: ~w~n", [Event]), > case Event of > {timeout, _} -> > io:format("timeout: no response from server~n") > end, > {next_state, state_process_request, State}. > > state_process_response(Event, State) -> > Data = Event, > %Data = State#state.reply, > io:format("response: ~w~n", [Data]), > <> = Data, > TID = State#state.tid, % checks > PID = 0, > UID = 16#ff, > Reply = if > Fc < 128 -> > case Fc of > ?FC_READ_COILS -> > <<_ByteCount, Values/binary>> = T, > {mb_read_coils, State#state.quantity, Values}; > ?FC_WRITE_COILS -> > <> = T, > Quantity = State#state.quantity, % check > {mb_write_coils, Start, Quantity}; > ?FC_READ_REGS -> > <<_ByteCount, Values/binary>> = T, > {mb_read_regs, binary_to_word16_list(Values)}; > ?FC_WRITE_REGS -> > <> = T, > Quantity = State#state.quantity, % check > {mb_write_regs, Start, Quantity}; > _ -> > {error, function_not_implemented} > end; > true -> > <> = T, > case ExCode of > 1 -> {error, function_not_implemented_by_server}; > 2 -> {error, invalid_address}; > 3 -> {error, invalid_data_value}; > _ -> {error, other_error} > end > end, > gen_fsm:reply(State#state.caller, Reply), > {next_state, state_process_request, State}. > > %%-------------------------------------------------------------------- > %% Function: > %% state_name(Event, From, State) -> {next_state, NextStateName, > NextState} | > %% {next_state, NextStateName, > %% NextState, Timeout} | > %% {reply, Reply, NextStateName, > NextState}| > %% {reply, Reply, NextStateName, > %% NextState, Timeout} | > %% {stop, Reason, NewState}| > %% {stop, Reason, Reply, NewState} > %% Description: There should be one instance of this function for each > %% possible state name. Whenever a gen_fsm receives an event sent > using > %% gen_fsm:sync_send_event/2,3, the instance of this function with > the same > %% name as the current state name StateName is called to handle the > event. > %%-------------------------------------------------------------------- > %state_name(_Event, _From, State) -> > % Reply = ok, > % {reply, Reply, state_name, State}. > > > state_process_request(Event, From, StateIn) -> > State = StateIn#state{caller=From}, > TID = StateIn#state.tid + 1, PID = 0, UID = 16#ff, > T = case Event of > {mb_read_coils, Start, Quantity} -> > Length = 6, > State2 = State#state{quantity=Quantity, tid=TID}, > < Start:16, Quantity:16>>; > {mb_write_coils, Start, Quantity, Values} when binary(Values) -> > ByteCount = length(binary_to_list(Values)), > Length = 7 + ByteCount, > State2 = State#state{quantity=Quantity, tid=TID}, > < Start:16, Quantity:16, ByteCount, Values/binary>>; > {mb_read_regs, Start, Quantity} -> > Length = 6, > State2 = State#state{quantity=Quantity, tid=TID}, > < Start:16, Quantity:16>>; > {mb_write_regs, Start, ValuesList} when list(ValuesList) -> > ValuesBin = list_word16_to_binary(ValuesList), > ByteCount = length(binary_to_list(ValuesBin)), > Length = 7 + ByteCount, > Quantity = trunc(ByteCount / 2), % check > State2 = State#state{quantity=Quantity, tid=TID}, > < Start:16, Quantity:16, ByteCount, ValuesBin/binary>>; > _ -> > Quantity = 0, > Length = 0, > State2 = State, > function_not_implemented > end, > case T of > function_not_implemented -> > io:format("error: function is not implemented~n"), > gen_fsm:reply(State2#state.caller, > {error, function_not_implemented}), > {next_state, state_process_request, State2}; > T -> > if > Quantity < 1; Quantity > 2000 -> > gen_fsm:reply(State2#state.caller, > {error, invalid_quantity}), > {next_state, state_process_request, State2}; > true -> > Request = concat_binary([<>, T]), > io:format("request: ~w~n", [Request]), > ok = gen_udp:send(State#state.sock, State#state.host, > State#state.port, Request), > {next_state, state_wait_for_response, State2, ?TIMEOUT} > end > end. > > %%-------------------------------------------------------------------- > %% Function: > %% handle_event(Event, StateName, State) -> {next_state, > NextStateName, > %% NextState} | > %% {next_state, > NextStateName, > %% NextState, Timeout} | > %% {stop, Reason, NewState} > %% Description: Whenever a gen_fsm receives an event sent using > %% gen_fsm:send_all_state_event/2, this function is called to handle > %% the event. > %%-------------------------------------------------------------------- > handle_event(_Event, StateName, State) -> > {next_state, StateName, State}. > > %%-------------------------------------------------------------------- > %% Function: > %% handle_sync_event(Event, From, StateName, > %% State) -> {next_state, NextStateName, > NextState} | > %% {next_state, NextStateName, NextState, > %% Timeout} | > %% {reply, Reply, NextStateName, > NextState}| > %% {reply, Reply, NextStateName, > NextState, > %% Timeout} | > %% {stop, Reason, NewState} | > %% {stop, Reason, Reply, NewState} > %% Description: Whenever a gen_fsm receives an event sent using > %% gen_fsm:sync_send_all_state_event/2,3, this function is called > to handle > %% the event. > %%-------------------------------------------------------------------- > handle_sync_event(Event, _From, StateName, State) -> > io:format("in handle_sync_event: ~w~n", [Event]), > case Event of > {add_clamp, Data} -> > State2 = State#state{clamps = State#state.clamps ++ [Data]}; > {get_clamp_addr, Name} -> > %calc_clamp_addr(Name, State#state.clamps), > State2 = State > end, > Reply = ok, > io:format("in handle_sync_event1: ~w~n", [State2]), > {reply, Reply, StateName, State2}. > > %%-------------------------------------------------------------------- > %% Function: > %% handle_info(Info,StateName,State)-> {next_state, NextStateName, > NextState}| > %% {next_state, NextStateName, > NextState, > %% Timeout} | > %% {stop, Reason, NewState} > %% Description: This function is called by a gen_fsm when it > receives any > %% other message than a synchronous or asynchronous event > %% (or a system message). > %%-------------------------------------------------------------------- > handle_info(Info, _StateName, State) -> > case Info of > {udp, _Socket, _IP, _InPort_No, Packet} -> > gen_fsm:send_event(?REF, Packet), > {next_state, state_process_response, State}; %, State#state > {reply=Packet}}; > tick -> > % poll clamps > io:format("got tick~n"); > _ -> > {stop, connection_closed, State} > end. > > %%-------------------------------------------------------------------- > %% Function: terminate(Reason, StateName, State) -> void() > %% Description:This function is called by a gen_fsm when it is about > %% to terminate. It should be the opposite of Module:init/1 and do any > %% necessary cleaning up. When it returns, the gen_fsm terminates with > %% Reason. The return value is ignored. > %%-------------------------------------------------------------------- > terminate(_Reason, _StateName, State) -> > ok = gen_udp:close(State#state.sock), > ok. > > %%-------------------------------------------------------------------- > %% Function: > %% code_change(OldVsn, StateName, State, Extra) -> {ok, StateName, > NewState} > %% Description: Convert process state when code is changed > %%-------------------------------------------------------------------- > code_change(_OldVsn, StateName, State, _Extra) -> > {ok, StateName, State}. > > %%-------------------------------------------------------------------- > %%% Internal functions > %%-------------------------------------------------------------------- > > binary_to_word16_list(Values) when binary(Values) -> > binary_to_word16_list(binary_to_list(Values)); > binary_to_word16_list([X, Y |T]) -> > [X bsl 8 + Y |binary_to_word16_list(T)]; > binary_to_word16_list([]) -> []. > > list_word16_to_binary(Values) when list(Values) -> > concat_binary([<> || X <- Values]). > > %calc_clamp_addr(Name, Clamps) -> > % calc_clamp_addr(Name, Clamps, []). > % AOsum = #clamp{}, > %calc_clamp_addr(Name, [H|T], Acc) -> > % io:format("list: ~w~n", [H]), > > % AOsum#clamp.in_words = AOsum#clamp.in_words + H#clamp.in_words, > % calc_clamp_addr(Name, T, Acc); > %calc_clamp_addr(Name, [], Acc) -> > % Acc. > %%%------------------------------------------------------------------- > %%% File : test_mt.erl > %%% Author : > %%% Description : > %%% > %%% Created : 29 Dec 2004 by > %%%------------------------------------------------------------------- > -module(test_mt). > > -export([start/0, check_reg/2, check_comm/0]). > -import(modbus, [read_reg/1, read_reg/2, write_reg/2, > add_clamp/5, get_clamp_addr/1]). > > check_comm() -> > check_reg(16#2000, 16#0000), > check_reg(16#2001, 16#ffff), > check_reg(16#2002, 16#1234), > check_reg(16#2003, 16#aaaa), > check_reg(16#2004, 16#5555), > read_reg(16#2015). % software index > > check_reg(Offset, Value) -> > io:format("checking reg 0x~s for value: 0x~s~n", > [httpd_util:encode_hex(Offset), httpd_util:encode_hex(Value)]), > Reply = gen_fsm:sync_send_event(modbus_udp, {mb_read_regs, > Offset, 1}), > {mb_read_regs, 1, [Value]} = Reply. > > inout_test() -> > [{write_reg(0, [X]), read_reg(0)} || X <- lists:seq(30000, 0, > -3000)]. > > start() -> > %{ok,_Pid} = modbus_udp:start_link("thinkio", 502), > modbus:start_link("thinkio", 502), > %Reply = gen_fsm:sync_send_event(modbus_udp, {mb_read_coils, 0, > 1}), > %io:format("reply: ~w~n", [Reply]), > %check_comm(), > %write_reg(0, [16#3000]), > read_reg(16#0), > %inout_test(). > add_clamp(ai2_467, 2, 0, 0, 0), > add_clamp(ao2_550, 0, 2, 0, 0), > get_clamp_addr(ai2_467), > get_clamp_addr(ao2_550). From hpjcon@REDACTED Tue Apr 1 22:29:38 2008 From: hpjcon@REDACTED (Jan Jacobs) Date: Tue, 1 Apr 2008 22:29:38 +0200 Subject: [erlang-questions] R11B-5 vs R12B-1: Win32 CPU Usage? References: <01d001c8935d$9979d840$c800a8c0@jan03> Message-ID: <008401c89437$217e3310$c800a8c0@jan03> Hi Kenneth, > I am not sure (rather the opposite) that the CPU time is a relevant > measure. It is actually percentage CPU usage. >It is also important to know if you have recompiled all your modules with >the R12B compiler Yes, deleted all the beam files from my app an lib directories and recompiled it with the relevant compiler. >if you are running the SMP or non SMP version of the Erlang VM. I used the default settings, which is SMP for the Pentium 4. I did the tests again and the result are different! Erlang (BEAM) emulator version 5.6.1 [smp:2] [async-threads:0] Application percentage CPU usage: 36% Erlang (BEAM) emulator version 5.6.1 [async-threads:0] Application percentage CPU usage: 38% Erlang (BEAM) emulator version 5.5.5 [async-threads:0] Application percentage CPU usage: 40% This is more in line with what you were saying about R12B1. My mistake, I must have done something stupid the fist time around with the tests! Thanks Jan From vladdu55@REDACTED Tue Apr 1 23:44:36 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 1 Apr 2008 23:44:36 +0200 Subject: [erlang-questions] [ANN] Erlide 0.3.40 Message-ID: <95be1d3b0804011444n78ca52cehfd086b7e34e4dd58@mail.gmail.com> It's been a while since the last announcement, even if development has been ongoing. There are many improvements, I will only name the ones I remember: * R12 should now be supported (but not for developing erlide itself) * console is better, and has even syntax highlighting * ETS tables with lexical and parsing data are removed when editor is closed * lexical scanning is done more lazily (saving memory) * caching is done for documentation and file structure ("go to function") * included files are handled properly (definitions are found) * simple completion of module names in editor You can get it from https://sourceforge.net/project/platformdownload.php?group_id=58889 or point eclipse update manager at http://erlide.sf.net/update. Enjoy! Vlad NB. Please note that there is a 0.3.41, but that's not as stable - use at your own risk. It adds the possibility to run without an Erlang backend (but then there's no functionality either). -- .......__o .......\<, ....( )/ ( )... From wenewboy@REDACTED Wed Apr 2 02:06:30 2008 From: wenewboy@REDACTED (wenew zhang) Date: Wed, 2 Apr 2008 08:06:30 +0800 Subject: [erlang-questions] How can i evaluate gen_server:call/cast cross nodes? Message-ID: <4eaa09eb0804011706w1a42d21g51387164778ce618@mail.gmail.com> It's works on erl shell: Pid=global:whereis_name(authserver). <5661.50.0> (indexservernode@REDACTED)5> Uid=list_to_binary("root"). <<"root">> (indexservernode@REDACTED)6> Pwd=list_to_binary("12345"). <<"12345">> (indexservernode@REDACTED)12> Result=gen_server:call(Pid,{213,Uid,Pwd}). 0%% the normal result Code examples: io:format("rcv:~w AuthPid~w ~n",[Data,State#state.authsrv]), %global:sync(), Result=gen_server:cast(State#state.authsrv,{?PLLOGIN,Uid,Pwd}), %%even no data send to the authsrv, io:format("Result:~w~n",[Result]), Error Mesage:________________begin_________________________________________ rcv:<<0,4,97,115,100,102,0,5,115,97,102,115,100>> AuthPid{<5661.50.0>} %% the authsrv Pid =ERROR REPORT==== 2-Apr-2008::08:02:35 === ** State machine <0.58.0> terminating ** Last message in was {tcp,#Port<0.115>, <<0,6,97,97,115,97,97,97,0,5,98,98,98,98,98>>} ** When State == 'WAIT_FOR_DATA' ** Data == {state,#Port<0.115>,{192,168,0,221},{<5661.62.0>}} ** Reason for termination = ** {{function_clause,[{gen,call, [{<5661.62.0>}, '$gen_call', {213,<<"aasaaa">>,<<"bbbbb">>}, 5000]}, {gen_server,call,2}, {indexserver,'WAIT_FOR_DATA',2}, {gen_fsm,handle_msg,7}, {proc_lib,init_p,5}]}, {gen_server,call, [{<5661.62.0>},{213,<<"aasaaa">>,<<"bbbbb">>}]}} _______________end________________________________ What's problem with it? Best Regards Wenew Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: From exta7@REDACTED Wed Apr 2 05:45:41 2008 From: exta7@REDACTED (Zvi) Date: Tue, 1 Apr 2008 20:45:41 -0700 (PDT) Subject: [erlang-questions] Calculate PI in Erlang faster than in Matlab Message-ID: <16440056.post@talk.nabble.com> Hi All, I wrote "Migrating to Multi-Core" presentation, where I describe various parallel programming models and APIs. As a practical example, I calculate PI number using various parallel APIs, such as pthreads, Win32 threads, OpenMP, MPI, Intel TBB and off course plain old serial C code. So I decided to add example in my favorite parallel language - Erlang. The code and math description is attached. My machine hase dual-core CPU, but I have older version of Matlab, which doesn't use all cores, so Matlab version took 125 ms: >> tic; N=1000000; Step = 1/N; PI = Step*sum(4./(1+(((1:N)-0.5)*Step).^2)); >> toc Elapsed time is 0.125428 seconds. Below is Erlang results: 2> c(pi). {ok,pi} 3> pi:test(). [{math,{1,3.14159}}, {list_creation,{77998,3.14159}}, {lc,{671999,3.14159}}, {lc_no_pow,{593999,3.14159}}, {map,{436999,3.14159}}, {mapfoldl,{687999,3.14159}}, {serial_decr,{170999,3.14159}}, {serial,{171999,3.14159}}, {parallel,{93999,3.14159}}] 4> another run: 6> pi:test(). [{math,{1,3.14159}}, {list_creation,{62998,3.14159}}, {lc,{671999,3.14159}}, {lc_no_pow,{671999,3.14159}}, {map,{436999,3.14159}}, {mapfoldl,{687999,3.14159}}, {serial_decr,{170999,3.14159}}, {serial,{171999,3.14159}}, {parallel,{77999,3.14159}}] NOTE: "lc" - is short for "list comprehension". As you can see Erlang parallel version beats Matlab: 78-93ms vs. 123-132ms. The results are impressive, considering, thats only list creation (i.e list:seq(1,N) ) takes 63-78ms. If anyone can improve parallel version not only in speed, but also in making it clear, so it will be fitting presentation / textbook style. Also, I want to modify HOF samples to use plists module. If anyone can give me pointers, how modify this example to use big integer arithmetics, i.e. to calculate first N digits of PI. Thanks in adavnce, Zvi ================================== -module(pi). -author("Zvi"). -compile([export_all]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% functional and parallel PI calculation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% test()-> N = 1000000, Impls = [math,list_creation,lc,lc_no_pow,map,mapfoldl,serial_decr,serial,parallel], [ {Impl,timer:tc(pi,calc_pi,[Impl,N])} || Impl<-Impls ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 1. built-in constant %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(math,_N) -> math:pi(); calc_pi(list_creation,N) -> lists:seq(1,N), 3.14159; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 2. serial - list comprehension - direct Matlab translation %% Step = 1/N; %% PI = Step*sum(4./(1+(((1:N)-0.5)*Step).^2)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(lc,N) -> Step = 1/N, Step*lists:sum( [4.0/(1.0 + math:pow(Step*(I-0.5),2)) || I<-lists:seq(1,N)] ); calc_pi(lc_no_pow,N) -> Step = 1/N, Xs = [Step*(I-0.5) || I<-lists:seq(1,N)], Step*lists:sum( [4.0/(1.0 + X*X) || X<-Xs] ); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 3. serial - using HOF: map %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(map,N) -> Step = 1/N, F = fun(I) -> X=Step*(I-0.5), 4.0/(1.0+X*X) end, Step*lists:sum( lists:map( F, lists:seq(1,N) ) ); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 4. serial - using HOF: mapfoldl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(mapfoldl,N) -> Step = 1/N, F = fun(I,Sum) -> X=Step*(I-0.5), V=4.0/(1.0+X*X), {0,Sum+V} end, {_,Sum} = lists:mapfoldl(F, 0, lists:seq(1,N)), Step*Sum; %% replace list to plist module in tests using HOFs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 5. serial - tail recursion - decrement index %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(serial_decr,N) -> calc_pi1(N,1/N,0); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 6. serial - tail recursion - increment index %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(serial,N) -> calc_pi2(1,N,1/N); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 7. parallel SMP version - process per scheduler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(parallel,N) -> NWorkers = erlang:system_info(schedulers), NPerWorker = trunc(N/NWorkers+0.5), Step = 1/N, Self = self(), Pids = [spawn(fun() -> Self ! {sum,calc_pi2(I,lists:min([N,I+NPerWorker-1]),Step)} end) || I<-lists:seq(1,N,NPerWorker) ], lists:sum([receive {sum,S} -> S end || _<-Pids]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi1(0,Step,Sum) -> Step*Sum; calc_pi1(I,Step,Sum) -> X=Step*(I-0.5), V=4.0/(1.0+X*X), calc_pi1(I-1,Step,Sum+V). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi2(From,To,Step) -> calc_pi2(From,From,To,Step,0). calc_pi2(To,_From,To,Step,Sum) -> Step*Sum; calc_pi2( I,From,To,Step,Sum) -> X=Step*(I-0.5), V=4.0/(1.0+X*X), calc_pi2(I+1,From,To,Step,Sum+V). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% http://www.nabble.com/file/p16440056/pi.GIF pi.GIF http://www.nabble.com/file/p16440056/pi.erl pi.erl -- View this message in context: http://www.nabble.com/Calculate-PI-in-Erlang-faster-than-in-Matlab-tp16440056p16440056.html Sent from the Erlang Questions mailing list archive at Nabble.com. From zerthurd@REDACTED Wed Apr 2 07:31:00 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 2 Apr 2008 12:31:00 +0700 Subject: [erlang-questions] Node on specified port Message-ID: Hello Is there any method to specify IP port of erlang node. I want message exchange between two nodes behind firewall, and only this port access must be opened (and epmd port also). Thank you -- Maxim Treskin From jeffm@REDACTED Wed Apr 2 07:42:13 2008 From: jeffm@REDACTED (jm) Date: Wed, 02 Apr 2008 16:42:13 +1100 Subject: [erlang-questions] Calculate PI in Erlang faster than in Matlab In-Reply-To: <16440056.post@talk.nabble.com> References: <16440056.post@talk.nabble.com> Message-ID: <47F31CB5.6050800@ghostgun.com> Zvi wrote: > If anyone can improve parallel version not only in speed, but also in making > it clear, so it will be fitting presentation / textbook style. > Also, I want to modify HOF samples to use plists module. > > If anyone can give me pointers, how modify this example to use big integer > arithmetics, i.e. to calculate first N digits of PI. > Here's an example of how to do fixed point arithmatic. change %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 5. serial - tail recursion - decrement index %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% calc_pi(serial_decr,N) -> calc_pi1(N,1/N,0); and calc_pi1(0,Step,Sum) -> Step*Sum; calc_pi1(I,Step,Sum) -> X=Step*(I-0.5), V=4.0/(1.0+X*X), calc_pi1(I-1,Step,Sum+V). to calc_pi_fixedpoint(serial_decr, N, DecimalPlaces) -> calc_pi1(N, 1/N, 0, math:pow(10,DecimalPlaces)); calc_pi1(0, Step, Sum, _Numerator) -> 4*Sum div round(1/Step); calc_pi1(I, Step, Sum, Numerator) -> %% io:format("I ~p Step ~p Sum ~p Numerator ~p~n", %% [I, Step, Sum, Numerator]), X = Step*(I-0.5), V = round(Numerator / (1.0+X*X)), %% integer by rounding calc_pi1(I-1, Step, Sum+V, Numerator). There may be better ways of course. I'll leave converting the rest as an exercise :-). Would you care to add a distributed (multi node) example as well? The other thought I had was that instead of just having N recursive calls add a tolerance, Epsilon, which will stop the evaluation when two calls differ by less than Epsilon. Jeff. From ulf.wiger@REDACTED Wed Apr 2 08:41:04 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 02 Apr 2008 08:41:04 +0200 Subject: [erlang-questions] How can i evaluate gen_server:call/cast cross nodes? In-Reply-To: <4eaa09eb0804011706w1a42d21g51387164778ce618@mail.gmail.com> References: <4eaa09eb0804011706w1a42d21g51387164778ce618@mail.gmail.com> Message-ID: <47F32A80.1010908@ericsson.com> State#state.authsrv contains {<5661.50.0>}, which is of type {pid()}. The gen_server:call/2 function expects the following type of the first argument: ServerRef = Name | {Name,Node} | {global,GlobalName} | pid() Node = atom() GlobalName = term() (... and Name = atom(), one might add.) BR, Ulf W wenew zhang skrev: > It's works on erl shell: > > Pid=global:whereis_name(authserver). > <5661.50.0> > (indexservernode@REDACTED > )5> > Uid=list_to_binary("root"). > <<"root">> > (indexservernode@REDACTED > )6> > Pwd=list_to_binary("12345"). > <<"12345">> > (indexservernode@REDACTED > )12> > Result=gen_server:call(Pid,{213,Uid,Pwd}). > 0%% the normal result > > Code examples: > io:format("rcv:~w AuthPid~w ~n",[Data,State#state.authsrv]), > %global:sync(), > > Result=gen_server:cast(State#state.authsrv,{?PLLOGIN,Uid,Pwd}), %%even > no data send to the authsrv, > io:format("Result:~w~n",[Result]), > > Error Mesage:________________begin_________________________________________ > rcv:<<0,4,97,115,100,102,0,5,115,97,102,115,100>> AuthPid{<5661.50.0>} > %% the authsrv Pid > =ERROR REPORT==== 2-Apr-2008::08:02:35 === > ** State machine <0.58.0> terminating > ** Last message in was {tcp,#Port<0.115>, > <<0,6,97,97,115,97,97,97,0,5,98,98,98,98,98>>} > ** When State == 'WAIT_FOR_DATA' > ** Data == {state,#Port<0.115>,{192,168,0,221},{<5661.62.0>}} > ** Reason for termination = > ** {{function_clause,[{gen,call, > [{<5661.62.0>}, > '$gen_call', > {213,<<"aasaaa">>,<<"bbbbb">>}, > 5000]}, > {gen_server,call,2}, > {indexserver,'WAIT_FOR_DATA',2}, > {gen_fsm,handle_msg,7}, > {proc_lib,init_p,5}]}, > {gen_server,call, > [{<5661.62.0>},{213,<<"aasaaa">>,<<"bbbbb">>}]}} > _______________end________________________________ > What's problem with it? > > Best Regards > > Wenew Zhang > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ali.yakout@REDACTED Wed Apr 2 09:54:30 2008 From: ali.yakout@REDACTED (Ali Yakout) Date: Wed, 2 Apr 2008 09:54:30 +0200 Subject: [erlang-questions] erlc shell script In-Reply-To: References: Message-ID: Hi Martin, I would do the following to use the erl_compile in a script #! /bin/sh erl -s erl_compile compile_cmdline @cwd . @files martin.erl Thanks Regards, Ali Yakout ________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Logan, Martin Sent: Monday, March 31, 2008 5:17 AM To: Erlang Subject: [erlang-questions] erlc shell script Has anyone on the list written an erlc shell script that calls stdlib erl_compile from the commandline via -s? Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From alceste@REDACTED Wed Apr 2 10:30:07 2008 From: alceste@REDACTED (Alceste Scalas) Date: Wed, 02 Apr 2008 10:30:07 +0200 Subject: [erlang-questions] linkedin driver licence question In-Reply-To: References: <2c3a56270803310929y330ad7a6va6da58458c4760a8@mail.gmail.com> Message-ID: <1207125007.6297.205.camel@gnatziu.crs4.it> Il giorno lun, 31/03/2008 alle 14.27 -0700, Matthew Dempsky ha scritto: > On Mon, Mar 31, 2008 at 9:29 AM, Danila Bagrov wrote: > > If I develope a linkedin driver which use a GPL library, I don't have > > to publish source of my programs which use this driver, correct? I > > will only have to publish source for the driver (because Erlang > > already is open source)? Since your program will depend from the GNU GPL'ed library, it can be considered a derived work, and thus will need to be released with a GNU GPL-compatible license. (If it was not the case, then lots of people and companies would have developed thin software layers for linking GNU GPL'ed libraries without complying with the license). > You should be aware that the Erlang Public License is incompatible > with the GPL. You'll have legal trouble if your linked-in driver is > considered a derivative work of both the Erlang runtime and that GPL > library. See http://www.gnu.org/licenses/gpl-faq.html#GPLPluginsInNF > for some more information. You may also be interested in http://www.gnu.org/licenses/gpl-faq.html#IfInterpreterIsGPL --- it does confirm that your program will need to be released under the terms of a GNU GPL-compatible license. Regarding the legal status of the linked-in driver itself, the question is: does the Erlang/OTP license impose any restriction on the licensing terms of linked-in drivers? If it does not, then nothing prevents you from developing a linked-in driver for GNU GPL'ed libraries --- as long as the linked-in driver license is GNU GPL-compatible. The software that depends/derives from that library/driver will also need to be released under a GNU GPL-compatible license. > It would be better to ask an actual lawyer. You can also try emailing > the FSF or SFLC. I agree. If you do, please let us know their feedback! Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From goryachev@REDACTED Wed Apr 2 11:21:31 2008 From: goryachev@REDACTED (Igor Goryachev) Date: Wed, 02 Apr 2008 13:21:31 +0400 Subject: [erlang-questions] Node on specified port In-Reply-To: (Maxim Treskin's message of "Wed\, 2 Apr 2008 12\:31\:00 +0700") References: Message-ID: <87wsngbois.fsf@yandex-team.ru> "Maxim Treskin" writes: > Is there any method to specify IP port of erlang node. > I want message exchange between two nodes behind firewall, and only > this port access must be opened (and epmd port also). Try ``-kernel inet_dist_listen_min First inet_dist_listen_max Last'' where First..Last port range for the listener socket of a distributed Erlang node (from kernel(6)). -- Igor Goryachev Yandex development team. From chandrashekhar.mullaparthi@REDACTED Wed Apr 2 11:26:04 2008 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 2 Apr 2008 10:26:04 +0100 Subject: [erlang-questions] Node on specified port In-Reply-To: References: Message-ID: On 02/04/2008, Maxim Treskin wrote: > > Hello > > Is there any method to specify IP port of erlang node. > I want message exchange between two nodes behind firewall, and only > this port access must be opened (and epmd port also). > > Thank you > > Check out the configuration options available for the kernel application. inet_dist_listen_min inet_dist_listen_max cheers Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.dvorak@REDACTED Wed Apr 2 13:27:21 2008 From: martin.dvorak@REDACTED (=?ISO-8859-2?Q?Martin_Dvo=F8=E1k?=) Date: Wed, 02 Apr 2008 13:27:21 +0200 Subject: [erlang-questions] [bug] zip archives in memory (patch incl.) Message-ID: <47F36D99.1030403@e-fractal.cz> Hi, I've found two bugs regarding handling zip archives in memory. The attached patch solves both of them, it has been tested with R11B5 and should work with R12B1 as well. 1. When decompressing from memory (ie. the archive given as a binary to extract/2), the decompression crashes when the archive contains a directory. This is because get_z_file/7 returns In accumulator (when it encounters a directory), which is a tuple in case of binary_io/2, but the calling get_z_files/5 function undestands the tuple as a return value and a new accumulator. 2. When decompressing to memory (ie. with the 'memory' option passed to extract/2), the directories found in the archive are created on the real disk filesystem. This is because filelib:ensure_dir/1 is called in get_z_file/7 no matter which function (file_io/2 or binary_io/2) has been selected for output. /Martin -------------- next part -------------- A non-text attachment was scrubbed... Name: zip.patch Type: text/x-diff Size: 1884 bytes Desc: not available URL: From bsayanthan@REDACTED Wed Apr 2 15:24:56 2008 From: bsayanthan@REDACTED (Balathasan Sayanthan) Date: Wed, 2 Apr 2008 18:54:56 +0530 Subject: [erlang-questions] macro - newbie question Message-ID: <9b2076080804020624l58c5dff8m34095e69a3a37d68@mail.gmail.com> Hi, I tried do the following using macros /////////////////////////////////////// -module(trial). -include("xx.hrl"). getval(OpId) -> Oe = ?OP_NAME(OpId), {ok, Oe}. //////////////////////////////////////// and within the xx.hrl i have some thing like -define(OP_NAME(OpId), if ............... ............... end). when I try to compile the i get an error ./trial.erl:7: syntax error before: 'end' ./trial.erl:3: function getval/1 undefined Please let me know how I should use macros in this way. regards, -- Balathasan Sayanthan -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Wed Apr 2 15:16:58 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 2 Apr 2008 15:16:58 +0200 Subject: [erlang-questions] gen_sctp:connect/5 change Message-ID: <20080402131658.GA12127@erix.ericsson.se> Hi list! I am in the process of fixing active mode for gen_sctp, and up comes a question about why connect/5 returns {ok,Assoc} instead of just ok. The connect/5 code does an implicit recv/2 to get an #sctp_assoc_change{} message to return. A change to connect/5 not returning the #sctp_assoc_change{} message, letting the user explicitly call recv/2 or in active mode receive the #sctp_assoc_change{} would simplify the connect/5 code and perhaps make gen_sctp more SCTP. But would connect/5 become much less usable? gen_sctp is still in beta state. If a change is appropriate, it should be made as soon as possible. Nevertheless, these changes will not make it into R12B-2. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From tate.zhou.cn@REDACTED Wed Apr 2 16:25:34 2008 From: tate.zhou.cn@REDACTED (tate.zhou.cn) Date: Wed, 2 Apr 2008 22:25:34 +0800 Subject: [erlang-questions] A async c driver issues: The emulator will be halted during the execution of c driver code. Message-ID: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> Hi , guys: I worte a c driver for parsing xml pieces. The driver works , but when the c driver invoked , the erlang emulator will be halted until the execution of c driver completed. during the execution of the c driver code, other process of erlang get no chance to be execute , evenif the usetage of cpu is around 50% (My cpu is duo core 2 ). Does anybody have any idea about this issues? Any infomation about how to write a async driver is appreciate. List below is pieces of my erl code and c dirver code: The execution of ?INFO_MSG in test_async_normal will start until test_async complete? although the execution time of test_async is more than 2 seconds. erlang: ========================================== test_async_newpid() -> PID = spawn(?MODULE, test_async_normal,[""]), PID2 = spawn(?MODULE, test_async,[""]), ?INFO_MSG("New Pid for port communication:",[PID]), ok. test_async_normal(Data) -> timer:sleep(2* 1000), ?INFO_MSG("Hi , I am in new Pid:",[erlang:self()]), ok. test_async (Data) -> Port = open_port({spawn, vbp_xmlhandler}, [binary]), Bin = erlang:list_to_binary("hello , i come from erlang: "), %load_xml_bin(), Port ! {self(), {command, Bin}}, Ret_str = return_port_data(Port), ?INFO_MSG("Return from port : ~p~n",[Ret_str]), % ?INFO_MSG("Return from port : ~s",[Res]), port_close(Port), ok. return_port_data(Port) -> receive {Port, {data, Data}} -> Data end. ==================================================== C driver code : ----------------------------------------------------- static ErlDrvEntry vbp_xmlhandler_entry = { NULL, /* init */ vbp_xmlhandler_start, vbp_xmlhandler_stop, vbp_xmlhandler_async, /* output */ NULL, /* ready_input */ NULL, /* ready_output */ "vbp_xmlhandler", /* the name of the driver */ NULL, /* finish */ NULL, /* handle */ NULL, NULL, /* timeout */ NULL, /* outputv */ NULL, /* ready_async */ NULL, /* flush */ NULL, /* call */ NULL /* event */ }; DRIVER_INIT(vbp_xmlhandler) /* must match name in driver_entry */ { return &vbp_xmlhandler_entry; } /* // async interface for handle command. // */ static void vbp_xmlhandler_async(ErlDrvData handle, char *buff, int bufflen){ iostream* stream; char* test_data; char *in_data; int len; int i ; int loop_count; expat_data* d = (expat_data*)handle; len = bufflen; stream = create_stream(); // force a lot of cpu time to be consumed in current invocation. loop_count = 1000000 * 80; for(i = 0;i port, stream->buff, stream->index); free_stream(stream); } -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Apr 2 17:01:06 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 2 Apr 2008 17:01:06 +0200 Subject: [erlang-questions] how: Mock processes in a test setup Message-ID: Hi, I'm looking at a java testing tool called EasyMock. It allows you to create an object that adheres to a java interface, but set it up to what calls (their order) it should expect, then throw it into a test scenario to see if expectations are met. http://www.easymock.org/EasyMock2_3_Documentation.html I wonder, have someone attempted to implement something similar in Erlang? From erik.stenman@REDACTED Wed Apr 2 17:06:27 2008 From: erik.stenman@REDACTED (Erik Stenman) Date: Wed, 2 Apr 2008 17:06:27 +0200 Subject: [erlang-questions] Job: Kreditor Message-ID: Kreditor continues to expand and we are now looking for: Junior Erlang developers Senior Project manager Test leader Software tester Web developer Integration developer Operations engineer For more information in Swedish see http://kreditor.se/jobb/r-du-intresserad-av-var-utvecklingsenhet.html or contact me directly (for information in English). If you want to learn more about Kreditor you can take a look at our EUC presentations: http://www.erlang.se/euc/06/proceedings/0900Stenman.pdf http://www.erlang.se/euc/07/papers/1130Stenman.pdf /Erik Stenman, CTO Kreditor Europe AB From pat.eyler@REDACTED Wed Apr 2 17:15:21 2008 From: pat.eyler@REDACTED (pat eyler) Date: Wed, 2 Apr 2008 09:15:21 -0600 Subject: [erlang-questions] Erlang Job Message-ID: <6fd0654b0804020815r77554af2l96504ec76a365b84@mail.gmail.com> My friends over at Engine Yard are looking for an Erlang hacker with solid mnesia and ejabberd skills. If you think you're up for it, drop me a note off-channel, and I'll put you in touch with them. -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From lcastro@REDACTED Wed Apr 2 17:25:04 2008 From: lcastro@REDACTED (Laura M. Castro Souto) Date: Wed, 2 Apr 2008 17:25:04 +0200 Subject: [erlang-questions] Very strange ODBC behaviour under 64 bits? Message-ID: <200804021725.04793.lcastro@udc.es> Hello list, I have just changed my old 32-bit development box by a 64-bit one, and I am facing the strangest behaviour of the Erlang ODBC module. Assume a table named 'divisas', which has a few rows. This is what I am getting: > {ok, Co} = odbc:connect("DSN=database-name;USR=user-name;PWD=password",[]). {ok,<0.51.0>} > odbc:sql_query(Co, "select * from divisas"). [{selected,[],[]}, {},{},{},{},{},{},{},{},{},{},{},{},{},{},{}] > odbc:sql_query(Co, "insert into divisas values (9, 'Test divisa ', 'TES', '0')"). {updated,1} > odbc:sql_query(Co, "select * from divisas"). [{selected,[],[]}, {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}] > odbc:sql_query(Co, "update divisas set dvs_abr = 'PRU' where dvs_oid = -9"). {updated,1} > odbc:sql_query(Co, "select * from divisas"). [{selected,[],[]}, {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}] > odbc:sql_query(Co, "delete from divisas where dvs_oid = -9"). {updated,1} > odbc:sql_query(Co, "select * from divisas"). [{selected,[],[]}, {},{},{},{},{},{},{},{},{},{},{},{},{},{},{}] The thing is that, every time I submit the above SELECT query, I was checking both via a database shell (psql, since the database server is PostgreSQL) and via an odbc shell (isql), and the changes are visible (i.e. data is inserted, updated and then deleted, as said by the sql_query command return value). So the disturbing thing is that only SELECT queries seem not to be working at all, always returning empty tuples. I am running R12B-0. I am assuming the 64-bit change has something to do because I was running R12B-0 on the previous 32-bit computer. Any clues/suggestions? Thanks in advance. -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From kenneth.lundin@REDACTED Wed Apr 2 17:29:06 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 2 Apr 2008 17:29:06 +0200 Subject: [erlang-questions] A async c driver issues: The emulator will be halted during the execution of c driver code. In-Reply-To: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> References: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> Message-ID: In the documentation you can read how to write an asynchronous driver. You find it here http://www.erlang.org/doc/apps/erts/driver.html#6.5. It's part of the ERTS users guide. It is a well known fact that drivers (the most common synchronous ones) block the VM during their execution. You must be very careful to secure that you don't execute for too long in those drivers. Are you really sure that the speed for parsing this in Erlang is not enough? You can even use native code generation with HiPE. By coding this in Erlang you avoid the problems you have with the driver. /Kenneth On 4/2/08, tate.zhou.cn wrote: > > Hi , guys: > > > I worte a c driver for parsing xml pieces. The driver works , but when the > c driver invoked , the erlang emulator will be halted until the execution > of c driver completed. during the execution of the c driver code, other > process of erlang get no chance to be execute , evenif the usetage of cpu is > around 50% (My cpu is duo core 2 ). > > Does anybody have any idea about this issues? > > Any infomation about how to write a async driver is appreciate. > > > List below is pieces of my erl code and c dirver code: > > The execution of ?INFO_MSG in test_async_normal will start until test_async > complete? although the execution time of test_async is more than 2 > seconds. > > > > > > > erlang: > ========================================== > > test_async_newpid() -> > > > PID = spawn(?MODULE, test_async_normal,[""]), > > PID2 = spawn(?MODULE, test_async,[""]), > > ?INFO_MSG("New Pid for port communication:",[PID]), > > > ok. > > > test_async_normal(Data) -> > > > timer:sleep(2* 1000), > ?INFO_MSG("Hi , I am in new Pid:",[erlang:self()]), > > ok. > > test_async (Data) -> > > Port = open_port({spawn, vbp_xmlhandler}, [binary]), > > Bin = erlang:list_to_binary("hello , i come from erlang: "), > %load_xml_bin(), > > > Port ! {self(), {command, Bin}}, > > Ret_str = return_port_data(Port), > > > ?INFO_MSG("Return from port : ~p~n",[Ret_str]), > > % ?INFO_MSG("Return from port : ~s",[Res]), > > port_close(Port), > > > > ok. > > > > return_port_data(Port) -> > receive > {Port, {data, Data}} -> > Data > end. > > > ==================================================== > > > > > > > > > > > > > C driver code : > > ----------------------------------------------------- > static ErlDrvEntry vbp_xmlhandler_entry = { > NULL, /* init */ > vbp_xmlhandler_start, > vbp_xmlhandler_stop, > vbp_xmlhandler_async, /* output */ > NULL, /* ready_input */ > NULL, /* ready_output */ > "vbp_xmlhandler", /* the name of the > driver */ > NULL, /* finish */ > NULL, /* handle */ > NULL, > NULL, /* timeout */ > NULL, /* outputv */ > NULL, /* ready_async */ > NULL, /* flush */ > NULL, /* call */ > NULL /* event */ > }; > DRIVER_INIT(vbp_xmlhandler) /* must match name in driver_entry */ > { > return &vbp_xmlhandler_entry; > } > > > > /* > // async interface for handle command. > // > */ > static void vbp_xmlhandler_async(ErlDrvData handle, char *buff, int > bufflen){ > iostream* stream; > char* test_data; > char *in_data; > int len; > int i ; > int loop_count; > expat_data* d = (expat_data*)handle; > > len = bufflen; > > > stream = create_stream(); > > // force a lot of cpu time to be consumed in current invocation. > loop_count = 1000000 * 80; > for(i = 0;i in_data = malloc(20); > > free(in_data); > } > in_data = malloc(len + 1); > memset(in_data,0,len +1); > memcpy(in_data,buff,len); > write_str_to_stream(stream,in_data); > free(in_data); > > write_str_to_stream(stream," [append by c driver]"); > > driver_output(d ->port, stream->buff, stream->index); > > free_stream(stream); > } > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From hasan.veldstra@REDACTED Wed Apr 2 17:58:19 2008 From: hasan.veldstra@REDACTED (Hasan Veldstra) Date: Wed, 02 Apr 2008 16:58:19 +0100 Subject: [erlang-questions] macro - newbie question In-Reply-To: <9b2076080804020624l58c5dff8m34095e69a3a37d68@mail.gmail.com> References: <9b2076080804020624l58c5dff8m34095e69a3a37d68@mail.gmail.com> Message-ID: <47F3AD1B.1080601@gmail.com> > -define(OP_NAME(OpId), > if > ............... > ............... > end). > > > when I try to compile the i get an error > ./trial.erl:7: syntax error before: 'end' > ./trial.erl:3: function getval/1 undefined > > Please let me know how I should use macros in this way. There's a syntax error somewhere between 'if' and 'end' in your macro definition, can't tell more without the source. Quite likely to be a misplaced semi-colon though... From chris.newcombe@REDACTED Wed Apr 2 20:35:24 2008 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Wed, 2 Apr 2008 11:35:24 -0700 Subject: [erlang-questions] A async c driver issues: The emulator will be halted during the execution of c driver code. In-Reply-To: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> References: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> Message-ID: <781dd98c0804021135m6877a2dap54afd8520de1519c@mail.gmail.com> > I worte a c driver for parsing xml pieces. The driver works , but when the > c driver invoked , the erlang emulator will be halted until the execution > of c driver completed. One way around this would be to use the latest release of EDTK (Erlang Driver Toolkit). http://www.snookles.com/erlang/edtk/ (For an overview read http://www.snookles.com/erlang/edtk/pli2002-edtk-paper.pdf and then look at the README files in the tarball.) When enhancing EDTK to support Berkeley DB I added the ability to call the wrapped C code from a private thread pool, so it won't block the Erlang VM. This was essential for using Berkeley DB as that library frequently blocks caller threads on database page locks, and also does blocking disk IO. The learning curve may appear steeper at first, as you have to learn how to write an XML file that declares your API. But there are a lot of docs and examples, and once you get past the initial bump it is quite flexible and powerful. e.g. BDB is a big, complex library and EDTK can now handle almost all of its features. One caveat: EDTK only runs on Linux and Solaris at the moment. I know some folks are close to having an Mac OS X port running. I don't know of anyone porting it to Windows yet. I hope this helps, Chris From raould@REDACTED Wed Apr 2 20:38:46 2008 From: raould@REDACTED (Raoul Duke) Date: Wed, 2 Apr 2008 11:38:46 -0700 Subject: [erlang-questions] Calculate PI in Erlang faster than in Matlab In-Reply-To: <47F31CB5.6050800@ghostgun.com> References: <16440056.post@talk.nabble.com> <47F31CB5.6050800@ghostgun.com> Message-ID: <91a2ba3e0804021138k6eb89ce4nca94d65a21e0fed5@mail.gmail.com> funnily enough, i think the single Fortress example is parallel pi figuring. http://projectfortress.sun.com/Projects/Community/wiki/BuffonsNeedle From w.a.de.jong@REDACTED Wed Apr 2 21:34:46 2008 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Wed, 2 Apr 2008 21:34:46 +0200 Subject: [erlang-questions] A async c driver issues: The emulator will be halted during the execution of c driver code. In-Reply-To: References: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> Message-ID: <407d9ef80804021234l4c39e1c3p3c3decd85854f44a@mail.gmail.com> Hi, To illustrate Kenneths point an experience I had today: I wanted to answer Ahmeds question (recently on the list) about the use of the new version of erlsom in the yaws soap library. It turned out that this would not use the new mode of erlsom that works directly on binaries. I wondered what the performance impact would be. I did a little test: how many soap requests could yaws handle on my PC (a simple laptop running windows XP, with the client and the server running on the same machine)? The answer disappointed me: around 25. Now I wondered how much of this would be due to the XML encoding, and would working directly on binaries make a difference. I tried how often Erlang could encode and decode a message in 1 second. Answer: 3500 times. Conclusion: erlsom in binary mode or in the 'old' list mode, xmerl, or a C driver: it would not make any difference in this case, as far as performance is concerned. All the same, if you decide to continue your attempt to use a C driver, I would be very interested to know what the result is in terms of speed compared to erlsom or xmerl. It would be great if you could let me know. Regards, Willem 2008/4/2 Kenneth Lundin : > In the documentation you can read how to write an asynchronous driver. > You find it here http://www.erlang.org/doc/apps/erts/driver.html#6.5. > It's part of the ERTS users guide. > > It is a well known fact that drivers (the most common synchronous ones) > block > the VM during their execution. You must be very careful to secure that you > don't > execute for too long in those drivers. > > Are you really sure that the speed for parsing this in Erlang is not > enough? > You can even use native code generation with HiPE. By coding this in > Erlang you > avoid the problems you have with the driver. > > /Kenneth > > On 4/2/08, tate.zhou.cn wrote: > > > > Hi , guys: > > > > > > I worte a c driver for parsing xml pieces. The driver works , but when > the > > c driver invoked , the erlang emulator will be halted until the > execution > > of c driver completed. during the execution of the c driver code, > other > > process of erlang get no chance to be execute , evenif the usetage of > cpu is > > around 50% (My cpu is duo core 2 ). > > > > Does anybody have any idea about this issues? > > > > Any infomation about how to write a async driver is appreciate. > > > > > > List below is pieces of my erl code and c dirver code: > > > > The execution of ?INFO_MSG in test_async_normal will start until > test_async > > complete? although the execution time of test_async is more than 2 > > seconds. > > > > > > > > > > > > > > erlang: > > ========================================== > > > > test_async_newpid() -> > > > > > > PID = spawn(?MODULE, test_async_normal,[""]), > > > > PID2 = spawn(?MODULE, test_async,[""]), > > > > ?INFO_MSG("New Pid for port communication:",[PID]), > > > > > > ok. > > > > > > test_async_normal(Data) -> > > > > > > timer:sleep(2* 1000), > > ?INFO_MSG("Hi , I am in new Pid:",[erlang:self()]), > > > > ok. > > > > test_async (Data) -> > > > > Port = open_port({spawn, vbp_xmlhandler}, [binary]), > > > > Bin = erlang:list_to_binary("hello , i come from erlang: "), > > %load_xml_bin(), > > > > > > Port ! {self(), {command, Bin}}, > > > > Ret_str = return_port_data(Port), > > > > > > ?INFO_MSG("Return from port : ~p~n",[Ret_str]), > > > > % ?INFO_MSG("Return from port : ~s",[Res]), > > > > port_close(Port), > > > > > > > > ok. > > > > > > > > return_port_data(Port) -> > > receive > > {Port, {data, Data}} -> > > Data > > end. > > > > > > ==================================================== > > > > > > > > > > > > > > > > > > > > > > > > > > C driver code : > > > > ----------------------------------------------------- > > static ErlDrvEntry vbp_xmlhandler_entry = { > > NULL, /* init */ > > vbp_xmlhandler_start, > > vbp_xmlhandler_stop, > > vbp_xmlhandler_async, /* output */ > > NULL, /* ready_input */ > > NULL, /* ready_output */ > > "vbp_xmlhandler", /* the name of the > > driver */ > > NULL, /* finish */ > > NULL, /* handle */ > > NULL, > > NULL, /* timeout */ > > NULL, /* outputv */ > > NULL, /* ready_async */ > > NULL, /* flush */ > > NULL, /* call */ > > NULL /* event */ > > }; > > DRIVER_INIT(vbp_xmlhandler) /* must match name in driver_entry */ > > { > > return &vbp_xmlhandler_entry; > > } > > > > > > > > /* > > // async interface for handle command. > > // > > */ > > static void vbp_xmlhandler_async(ErlDrvData handle, char *buff, int > > bufflen){ > > iostream* stream; > > char* test_data; > > char *in_data; > > int len; > > int i ; > > int loop_count; > > expat_data* d = (expat_data*)handle; > > > > len = bufflen; > > > > > > stream = create_stream(); > > > > // force a lot of cpu time to be consumed in current invocation. > > loop_count = 1000000 * 80; > > for(i = 0;i > in_data = malloc(20); > > > > free(in_data); > > } > > in_data = malloc(len + 1); > > memset(in_data,0,len +1); > > memcpy(in_data,buff,len); > > write_str_to_stream(stream,in_data); > > free(in_data); > > > > write_str_to_stream(stream," [append by c driver]"); > > > > driver_output(d ->port, stream->buff, stream->index); > > > > free_stream(stream); > > } > > > > > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jilani@REDACTED Wed Apr 2 22:17:40 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Wed, 02 Apr 2008 22:17:40 +0200 Subject: [erlang-questions] My messages don't appear in the mailing-list Message-ID: <47F3E9E4.4030109@cheapnet.it> I happened many times. Could someone give me an answer? Thank you. -- *** T E M A http://www.dotpas.org From vances@REDACTED Wed Apr 2 22:26:27 2008 From: vances@REDACTED (Vance Shipley) Date: Wed, 2 Apr 2008 16:26:27 -0400 Subject: [erlang-questions] A async c driver issues: The emulator will be halted during the execution of c driver code. In-Reply-To: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> References: <00cb01c894cd$7abc5ab0$8b01a8c0@ZHOUBO> Message-ID: <20080402202627.GG31359@h216-235-12-173.host.egate.net> On Wed, Apr 02, 2008 at 10:25:34PM +0800, tate.zhou.cn wrote: } the erlang emulator will be halted until the execution of } c driver completed. The rule is don't call synchronous functions in the emulator thread (i.e. output() callback). Use driver_async() to run synchronous calls in a seperate thread and handle the result in the ready_async() callback. -Vance From exta7@REDACTED Thu Apr 3 01:31:14 2008 From: exta7@REDACTED (Zvi) Date: Wed, 2 Apr 2008 16:31:14 -0700 (PDT) Subject: [erlang-questions] how: big float aithmetics (was PI calculation) In-Reply-To: <47F31CB5.6050800@ghostgun.com> References: <16440056.post@talk.nabble.com> <47F31CB5.6050800@ghostgun.com> Message-ID: <16454022.post@talk.nabble.com> Jeff, thank you for the solution. But I think, that mixing big integers with floats limits precision by the float. The more generic approach is to represent "big floats" using tuples, like {BigInt, Exponent}. I think it works, but I have trouble to implement division using integer "div" operator: %% big float arithmetics plus({F1,E},{F2,E}) -> {F1+F2,E}; plus({F1,E1},{F2,E2}) -> case E1 {F1+F2*pow10(E2-E1), E1}; false -> {F1*pow10(E1-E2)+F2, E2} end. minus({F1,E1},{F2,E2}) -> plus({F1,E1},{-F2,E2}). multiply({F1,E1},{F2,E2}) -> {F1*F2,E1+E2}. divide({F,E},{F,E}) -> {1,0}; divide({F1,E1},{F2,E2}) -> N1 = round(math:log10(F1)), N2 = round(math:log10(F2)), N = 2*(N1+N2), %% increase the precision? {F1*pow10(N) div F2, E1-E2-N}. %% maybe we need to scale down precision? pow10(N) -> pow10(N,1). pow10(0,Acc) -> Acc; pow10(N,Acc) -> pow10(N-1,Acc*10). jm-13 wrote: > > Zvi wrote: > > > Here's an example of how to do fixed point arithmatic. > > change > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %% 5. serial - tail recursion - decrement index > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > calc_pi(serial_decr,N) -> > calc_pi1(N,1/N,0); > > > and > > calc_pi1(0,Step,Sum) -> Step*Sum; > calc_pi1(I,Step,Sum) -> > X=Step*(I-0.5), > V=4.0/(1.0+X*X), > calc_pi1(I-1,Step,Sum+V). > > > to > > calc_pi_fixedpoint(serial_decr, N, DecimalPlaces) -> > calc_pi1(N, 1/N, 0, math:pow(10,DecimalPlaces)); > > > calc_pi1(0, Step, Sum, _Numerator) -> 4*Sum div round(1/Step); > calc_pi1(I, Step, Sum, Numerator) -> > %% io:format("I ~p Step ~p Sum ~p Numerator ~p~n", > %% [I, Step, Sum, Numerator]), > X = Step*(I-0.5), > V = round(Numerator / (1.0+X*X)), %% integer by rounding > calc_pi1(I-1, Step, Sum+V, Numerator). > > > There may be better ways of course. I'll leave converting the rest as an > exercise :-). > > Would you care to add a distributed (multi node) example as well? > > The other thought I had was that instead of just having N recursive > calls add a tolerance, Epsilon, which will stop the evaluation when two > calls differ by less than Epsilon. > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Calculate-PI-in-Erlang-faster-than-in-Matlab-tp16440056p16454022.html Sent from the Erlang Questions mailing list archive at Nabble.com. From jilani@REDACTED Wed Apr 2 12:25:46 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Wed, 02 Apr 2008 12:25:46 +0200 Subject: [erlang-questions] Calculate PI in Erlang faster than in Matlab In-Reply-To: <16440056.post@talk.nabble.com> References: <16440056.post@talk.nabble.com> Message-ID: <47F35F2A.5000601@cheapnet.it> Zvi wrote: > Hi All, > > I wrote "Migrating to Multi-Core" presentation, where I describe various > parallel programming models and APIs. As a practical example, I calculate PI > number using various parallel APIs, such as pthreads, Win32 threads, OpenMP, > MPI, Intel TBB and off course plain old serial C code. > So I decided to add example in my favorite parallel language - Erlang. The > code and math description is attached. I will have a look at the code later seen I am very interested in scientific and technical programming in Erlang. However Vega and Deneb + Plain Pascal (Free Pascal Compiler) said: Vega (1 CPU Celeron, 512 MB RAM, 2.4 GHZ, Win2K) -> 15 ms Deneb (1 CPU Celeron, 256 MB RAM, 300 MHZ, Linux Slack 10.2) -> 127 ms Your code on Vega gives: 3> c(pi). {ok,pi} 4> pi:test(). [{math,{16000,3.14159}}, {list_creation,{171999,3.14159}}, {lc,{1389999,3.14159}}, {lc_no_pow,{1249999,3.14159}}, {map,{812999,3.14159}}, {mapfoldl,{2249999,3.14159}}, {serial_decr,{389999,3.14159}}, {serial,{406999,3.14159}}, {parallel,{405999,3.14159}}] 5> pi:test(). [{math,{1,3.14159}}, {list_creation,{140998,3.14159}}, {lc,{1295999,3.14159}}, {lc_no_pow,{1468999,3.14159}}, {map,{1109999,3.14159}}, {mapfoldl,{920999,3.14159}}, {serial_decr,{390999,3.14159}}, {serial,{405999,3.14159}}, {parallel,{406999,3.14159}}] And on Deneb it gives: [{math,{2567,3.14159}}, {list_creation,{644691,3.14159}}, {lc,{5523921,3.14159}}, {lc_no_pow,{5061841,3.14159}}, {map,{3643349,3.14159}}, {mapfoldl,{9540475,3.14159}}, {serial_decr,{1156172,3.14159}}, {serial,{1196930,3.14159}}, {parallel,{1221314,3.14159}}] JK -- *** T E M A http://www.dotpas.org From exta7@REDACTED Thu Apr 3 02:03:03 2008 From: exta7@REDACTED (Zvi) Date: Wed, 2 Apr 2008 17:03:03 -0700 (PDT) Subject: [erlang-questions] how: Mock processes in a test setup In-Reply-To: References: Message-ID: <16454917.post@talk.nabble.com> Christian, I also interested in this subject. I'm not an expert, but I think that standard way to implement mockups/stubs/simulations in Erlang it's using callback modules, especially in OTP. I.e. suppose you have gen_fsm process controlling some fancy hardware. The hardware is not available yet, so you write mockup gen_fsm callback module: fancy_hw_sim . When actual hardware is available, you write fance_hw_real callback module. Then you either put callback name into define or choose it at runtime at start / start_link . Zvi Christian S wrote: > > Hi, I'm looking at a java testing tool called EasyMock. It allows you > to create an object that adheres to a java interface, but set it up to > what calls (their order) it should expect, then throw it into a test > scenario to see if expectations are met. > > http://www.easymock.org/EasyMock2_3_Documentation.html > > I wonder, have someone attempted to implement something similar in Erlang? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/how%3A-Mock-processes-in-a-test-setup-tp16453117p16454917.html Sent from the Erlang Questions mailing list archive at Nabble.com. From rvirding@REDACTED Thu Apr 3 02:24:21 2008 From: rvirding@REDACTED (Robert Virding) Date: Thu, 3 Apr 2008 02:24:21 +0200 Subject: [erlang-questions] My messages don't appear in the mailing-list In-Reply-To: <47F3E9E4.4030109@cheapnet.it> References: <47F3E9E4.4030109@cheapnet.it> Message-ID: <3dbc6d1c0804021724xf61ca71k8b94e99a65fcf72d@mail.gmail.com> This one appeared anyway. :-) I have sometimes had messages end up really funny on trapexit.org though. Robert On 02/04/2008, Jilani Khaldi wrote: > > I happened many times. Could someone give me an answer? > Thank you. > > -- > *** > T E M A > http://www.dotpas.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Thu Apr 3 03:23:19 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 02 Apr 2008 21:23:19 -0400 Subject: [erlang-questions] gen_sctp:connect/5 change In-Reply-To: <20080402131658.GA12127@erix.ericsson.se> References: <20080402131658.GA12127@erix.ericsson.se> Message-ID: <47F43187.1010907@gmail.com> It was implemented this way to make the returning signature of this function similar to gen_tcp:connect/3: {ok, Assoc} | {error, Reason} Additionally, inet_sctp does additional analysis of the #sctp_assoc_change{} record to "filter out" false negative response (i.e. only #sctp_assoc_change{state=comm_up} is considered successful) and transform it to the {ok, ...} | {error, ...} form. Note that {ok, #sctp_assoc_change{}} and {error, #sctp_assoc_change{}} are both valid responses. If this error analysis is to be done by the user of gen_sctp, this wouldn't be quite obvious and may cause unnecessary confusion. Finally, since this Assoc record is used in the gen_sctp:send/4 call, it was convenient to use it in this way for writing synchronous code: {ok, Assoc} = gen_sctp:connect(Sock, Host, Port, []), gen_sctp:send(Sock, Assoc, 0, <<"Test">>). I also agree that having optional non-blocking connect in active mode would indeed come in handy. Serge Raimo Niskanen wrote: > Hi list! > > I am in the process of fixing active mode for gen_sctp, and up > comes a question about why connect/5 returns {ok,Assoc} instead > of just ok. The connect/5 code does an implicit recv/2 to get > an #sctp_assoc_change{} message to return. > > A change to connect/5 not returning the #sctp_assoc_change{} > message, letting the user explicitly call recv/2 or in > active mode receive the #sctp_assoc_change{} would simplify > the connect/5 code and perhaps make gen_sctp more SCTP. > But would connect/5 become much less usable? > > gen_sctp is still in beta state. If a change is appropriate, > it should be made as soon as possible. > > Nevertheless, these changes will not make it into R12B-2. > From bsayanthan@REDACTED Thu Apr 3 05:04:59 2008 From: bsayanthan@REDACTED (Balathasan Sayanthan) Date: Thu, 3 Apr 2008 08:34:59 +0530 Subject: [erlang-questions] macro - newbie question In-Reply-To: <47F3AD1B.1080601@gmail.com> References: <9b2076080804020624l58c5dff8m34095e69a3a37d68@mail.gmail.com> <47F3AD1B.1080601@gmail.com> Message-ID: <9b2076080804022004yb142ef1mf876d5874ca1204@mail.gmail.com> Thank you, I am sorry it was a silly mistake and it was indeed a misplaced semicolon. On Wed, Apr 2, 2008 at 9:28 PM, Hasan Veldstra wrote: > -define(OP_NAME(OpId), > > if > > ............... > > ............... > > end). > > > > > > when I try to compile the i get an error > > ./trial.erl:7: syntax error before: 'end' > > ./trial.erl:3: function getval/1 undefined > > > > Please let me know how I should use macros in this way. > > > > There's a syntax error somewhere between 'if' and 'end' in your macro > definition, can't tell more without the source. Quite likely to be a > misplaced semi-colon though... > -- Balathasan Sayanthan -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Thu Apr 3 06:30:20 2008 From: jeffm@REDACTED (jm) Date: Thu, 03 Apr 2008 15:30:20 +1100 Subject: [erlang-questions] how: big float aithmetics (was PI calculation) In-Reply-To: <16454022.post@talk.nabble.com> References: <16440056.post@talk.nabble.com> <47F31CB5.6050800@ghostgun.com> <16454022.post@talk.nabble.com> Message-ID: <47F45D5C.80001@ghostgun.com> Zvi wrote: > Jeff, > > thank you for the solution. But I think, that mixing big integers with > floats limits precision by the float. I should have removed all the floating point operations. It is possible though. The real problem is that factor of 0.5. If you write out the equation, starting with, 1 4 (I - 0.5) pi = - \Sigma --------- where X = ----------- N 1 + X^2 N rearranging you get 1 pi = 4 \Sigma --------------------- 1 N + N( - (I - 0.5))^2 N multiple though by 1/N pi 1 -- = 4 \Sigma ------------------- N N^2 + (I - 0.5)^2 Multiply through top and by the square of a scaling factor SF SF^2 pi = 4N \Sigma -------------------------------- SF^2 * N^2 + (I * SF - SF / 2)^2 Notice all the constants. It now becomes calc_pi(fixedpoint_serial_decr, N) -> DecimalPlaces = 10, %% fudge doesn't work properly should also create an Epsilon SFig = round(math:pow(10,DecimalPlaces)), SF = SFig * SFig, SF2 = SF * SF, SF2N2 = SF2 * N * N, HalfSF = SF div 2, Numerator = SF2*SF2, %% another fudge calc_pi1(N, N, Numerator, SF, SF2N2, HalfSF, 0). calc_pi1(0, N, _SF2, _SF2N2, _HalfSF, Sum) -> 4*Sum*N; calc_pi1(I, N, SF2, SF2N2, HalfSF, Sum) -> %% io:format("I ~p N ~p Sum ~p~n", [I, N, Sum]), X = I * SF - HalfSF, V = SF2 div (SF2N2 + X*X) calc_pi1(I-1, N, SF2, SF2N2, HalfSF, Sum + V). modifing calc_pi:test/0 and running gives 26> calc_pi:test(). [{math,{4127,3.14159}}, {list_creation,{116696,3.14159}}, {lc,{1117037,3.14159}}, {lc_no_pow,{813246,3.14159}}, {map,{736112,3.14159}}, {mapfoldl,{601372,3.14159}}, {serial_decr,{272162,3.14159}}, {serial,{276182,3.14159}}, {parallel,{275360,3.14159}}, {fixedpoint_serial_decr,{3828596,31415926535898765717959767164129964000000}}] 27> 3828596 - 272162. 3556434 Yes a bit slower. However... Using the value of Pi given at http://www.research.att.com/~njas/sequences/A000796 this seems to equate to 14 places of accuracy, > Pi41 = 31415926535897932384626433832795028841971. > (31415926535898765717959767164129964000000 - Pi41)/math:pow(10,41). 8.33333e-15 And the going gets tough, > {_,P8} = timer:tc(calc_pi,calc_pi,[fixedpoint_serial_decr, 100000000]). {752066430,31415926535897932467959747166535600000000} > (Pi41 - P8)/math:pow(10,41). -8.33333e-19 each digit takes more and more processing. > The more generic approach is to represent "big floats" using tuples, like > {BigInt, Exponent}. Won't be as fast as specifically optimised code but I can understand the reasoning. > I think it works, but I have trouble to implement division using integer > "div" operator: Perhaps, try the older versions of the Numerical Recipes books ( http://www.nr.com/oldverswitcher.html ). I seem to remember something in one of them about arbitrary precision arithmetic. Also try http://citeseer.ist.psu.edu/smith91fortran.html or Knuth 1981 That's about all I can think of at the moment. Jeff. From exta7@REDACTED Thu Apr 3 06:45:58 2008 From: exta7@REDACTED (Zvi) Date: Wed, 2 Apr 2008 21:45:58 -0700 (PDT) Subject: [erlang-questions] Calculate PI in Erlang faster than in Matlab In-Reply-To: <47F35F2A.5000601@cheapnet.it> References: <16440056.post@talk.nabble.com> <47F35F2A.5000601@cheapnet.it> Message-ID: <16465102.post@talk.nabble.com> Jilani, thanks for your tests. It's expected from compiled statically-typed language, like Fortran,C or Pascal to be faster than dynamic languages. But I'm sure, that you can't calculate PI with one-liner in Pascal :) OK - maybe with very very long one-liner. Are you Free Pascal version uses N=1000000 steps? Maybe you have some epsilon-optimization, like Jeff suggested before? Can you send me your FP code? Thanks in advance, Zvi Jilani Khaldi-2 wrote: > > Zvi wrote: >> Hi All, >> >> I wrote "Migrating to Multi-Core" presentation, where I describe various >> parallel programming models and APIs. As a practical example, I calculate >> PI >> number using various parallel APIs, such as pthreads, Win32 threads, >> OpenMP, >> MPI, Intel TBB and off course plain old serial C code. >> So I decided to add example in my favorite parallel language - Erlang. >> The >> code and math description is attached. > I will have a look at the code later seen I am very interested in > scientific and technical programming in Erlang. However Vega and Deneb + > Plain Pascal (Free Pascal Compiler) said: > Vega (1 CPU Celeron, 512 MB RAM, 2.4 GHZ, Win2K) -> 15 ms > Deneb (1 CPU Celeron, 256 MB RAM, 300 MHZ, Linux Slack 10.2) -> 127 ms > > Your code on Vega gives: > 3> c(pi). > {ok,pi} > 4> pi:test(). > [{math,{16000,3.14159}}, > {list_creation,{171999,3.14159}}, > {lc,{1389999,3.14159}}, > {lc_no_pow,{1249999,3.14159}}, > {map,{812999,3.14159}}, > {mapfoldl,{2249999,3.14159}}, > {serial_decr,{389999,3.14159}}, > {serial,{406999,3.14159}}, > {parallel,{405999,3.14159}}] > 5> pi:test(). > [{math,{1,3.14159}}, > {list_creation,{140998,3.14159}}, > {lc,{1295999,3.14159}}, > {lc_no_pow,{1468999,3.14159}}, > {map,{1109999,3.14159}}, > {mapfoldl,{920999,3.14159}}, > {serial_decr,{390999,3.14159}}, > {serial,{405999,3.14159}}, > {parallel,{406999,3.14159}}] > > And on Deneb it gives: > [{math,{2567,3.14159}}, > {list_creation,{644691,3.14159}}, > {lc,{5523921,3.14159}}, > {lc_no_pow,{5061841,3.14159}}, > {map,{3643349,3.14159}}, > {mapfoldl,{9540475,3.14159}}, > {serial_decr,{1156172,3.14159}}, > {serial,{1196930,3.14159}}, > {parallel,{1221314,3.14159}}] > > JK > > -- > *** > T E M A > http://www.dotpas.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Calculate-PI-in-Erlang-faster-than-in-Matlab-tp16440056p16465102.html Sent from the Erlang Questions mailing list archive at Nabble.com. From chsu79@REDACTED Thu Apr 3 07:43:50 2008 From: chsu79@REDACTED (Christian S) Date: Thu, 3 Apr 2008 07:43:50 +0200 Subject: [erlang-questions] how: Mock processes in a test setup In-Reply-To: <16454917.post@talk.nabble.com> References: <16454917.post@talk.nabble.com> Message-ID: On Thu, Apr 3, 2008 at 2:03 AM, Zvi wrote: > I also interested in this subject. I'm not an expert, but I think that > standard way to implement mockups/stubs/simulations in Erlang it's using > callback modules, especially in OTP. > I.e. suppose you have gen_fsm process controlling some fancy hardware. The > hardware is not available yet, so you write mockup gen_fsm callback module: > fancy_hw_sim . When actual hardware is available, you write fance_hw_real > callback module. Then you either put callback name into define or choose it > at runtime at start / start_link . Oh yeah. Thats one way to make a mockup process, but it takes quite a lot of code, especially if you want to check that the mockup receives messages in the expected order. The benefit of having testing easy is hopefully I write more tests. After a night's sleep, these are the ideas/thoughts: Mock = mock:new(), mock:expect(Mock, fun ({message, _Pattern}) -> ok end), mock:expect(Mock, fun ({side_effect, Process}) -> Process ! reply, ok end), mock:replay(Mock), %% ... code to set up the scenario that involves the process to test, %% which will make the tested process message my Mocked process ... ok = mock:assertExpectation(Mock) This is not bad. A bit verbose but acceptable. Maybe it would be good to have internal state in the mock process and pass that to the funs. Java's EasyMock has some features for expecting one-or-more/at-least-N/at-most-N/between-Min-and-Max method calls. Those might be important for not ending up with tests that are too fragile (so the test doesnt depend too much on implementation details, but only high level behavior). I imagine that for the erlang programmer it is more important to be able to handle some messages in arbitrary order. I noticed how similar this seems to a regexp, a regexp on messages rather than characters. From jeffm@REDACTED Thu Apr 3 08:05:15 2008 From: jeffm@REDACTED (jm) Date: Thu, 03 Apr 2008 17:05:15 +1100 Subject: [erlang-questions] Vector instructions Message-ID: <47F4739B.5020303@ghostgun.com> Thought I'd just throw this out there. Has anyone given any thought to adding vector instructions or otherwise adding support for vectors to Erlang? Jeff. From jilani@REDACTED Thu Apr 3 08:37:17 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Thu, 03 Apr 2008 08:37:17 +0200 Subject: [erlang-questions] My messages don't appear in the mailing-list In-Reply-To: <595970ad0804021508r544c8f65j5adc3a9ef7c2a91d@mail.gmail.com> References: <47F3E9E4.4030109@cheapnet.it> <595970ad0804021508r544c8f65j5adc3a9ef7c2a91d@mail.gmail.com> Message-ID: <47F47B1D.1000107@cheapnet.it> Elliot Murphy wrote: > Are you using gmail? No. I am using a commercial e-mail server. However I am seeing them now. The problem is I sent yesterday the message about the subject "Calculate PI in Erlang faster than in Matlab" and I am seeing it only now, but I sent an other message after that and I saw it after few seconds. It doesn't happen with other mailing-lists. Perheaps the delay is due to the mail server anti-spam of "erlang-questions". -- *** T E M A http://www.dotpas.org From jilani@REDACTED Thu Apr 3 09:22:21 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Thu, 03 Apr 2008 09:22:21 +0200 Subject: [erlang-questions] Calculate PI in Erlang faster than in Matlab In-Reply-To: <16465102.post@talk.nabble.com> References: <16440056.post@talk.nabble.com> <47F35F2A.5000601@cheapnet.it> <16465102.post@talk.nabble.com> Message-ID: <47F485AD.3080402@cheapnet.it> > Are you Free Pascal version uses N=1000000 steps? Maybe you have some > epsilon-optimization, like Jeff suggested before? Can you send me your FP > code? Sure. program pi; {$mode delphi} {$H+} uses sysutils; const N = 1000000; DX = 1/N; kPI = 3.14159; var i: integer; x, p, dp: double; HH, MM, SS1, MS1, SS2, MS2: Word; st: string; begin p := 0; x := 0; DeCodeTime(Time,HH,MM,SS1,MS1); for i := 1 to N do begin dp := 4*DX/(1+x*x); p := p + dp; x := x + DX; end; DeCodeTime (Time,HH,MM,SS2,MS2); SS2 := SS2 - SS1; MS2 := MS2 - MS1; st := Format('PI = %1.8f; Seconds = %d; MSeconds = %d', [p, SS2, MS2]); writeln(st); // Now looping till we to reach 3.14159 p := 0; x := 0; i := 0; // Just to know how many loops DeCodeTime(Time,HH,MM,SS1,MS1); while p < kPI do begin dp := 4*DX/(1+x*x); p := p + dp; x := x + DX; inc(i); end; DeCodeTime (Time,HH,MM,SS2,MS2); SS2 := SS2 - SS1; MS2 := MS2 - MS1; st := Format('Loops Nr = %d; PI = %1.8f; Seconds = %d; MSeconds = %d', [i, p, SS2, MS2]); writeln(st); end. -- *** T E M A http://www.dotpas.org From jilani@REDACTED Thu Apr 3 10:05:05 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Thu, 03 Apr 2008 10:05:05 +0200 Subject: [erlang-questions] Vector instructions In-Reply-To: <47F4739B.5020303@ghostgun.com> References: <47F4739B.5020303@ghostgun.com> Message-ID: <47F48FB1.2020407@cheapnet.it> jm wrote: > Thought I'd just throw this out there. > > Has anyone given any thought to adding vector instructions or otherwise > adding support for vectors to Erlang? I find few vector operations (limited to 3D graphics) in Wings3D. Full vector operations should open "some" doors to Erlang for scientific and technical programming. Sometimes we have to remember that computers are often useful to do some numerical calculations even in Erlang. JK -- *** T E M A http://www.dotpas.org From raimo+erlang-questions@REDACTED Thu Apr 3 10:38:45 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Apr 2008 10:38:45 +0200 Subject: [erlang-questions] : gen_sctp:connect/5 change In-Reply-To: <47F43187.1010907@gmail.com> References: <20080402131658.GA12127@erix.ericsson.se> <47F43187.1010907@gmail.com> Message-ID: <20080403083845.GA30303@erix.ericsson.se> On Wed, Apr 02, 2008 at 09:23:19PM -0400, Serge Aleynikov wrote: > It was implemented this way to make the returning signature of this > function similar to gen_tcp:connect/3: > > {ok, Assoc} | {error, Reason} Ok, but making it similar to gen_tcp:connect/3 is not essential. > > Additionally, inet_sctp does additional analysis of the > #sctp_assoc_change{} record to "filter out" false negative response > (i.e. only #sctp_assoc_change{state=comm_up} is considered successful) > and transform it to the {ok, ...} | {error, ...} form. Note that {ok, > #sctp_assoc_change{}} and {error, #sctp_assoc_change{}} are both valid > responses. > And so is {error,econnrefused} with a subsequent #sctp_assoc_change{state=comm_lost} received message. (Solaris). > If this error analysis is to be done by the user of gen_sctp, this > wouldn't be quite obvious and may cause unnecessary confusion. > Valid point. > Finally, since this Assoc record is used in the gen_sctp:send/4 call, it > was convenient to use it in this way for writing synchronous code: > > {ok, Assoc} = gen_sctp:connect(Sock, Host, Port, []), > gen_sctp:send(Sock, Assoc, 0, <<"Test">>). > Yes, it is convenient. > I also agree that having optional non-blocking connect in active mode > would indeed come in handy. > No objection. But..(speculating, not tested).. for the current gen_sctp:connect/5; if an association comes in on a (passive) listen socket just while connect/5 is called - it internally calls recv/2 and may receive the unrelated #sctp_assoc_change{} for another IP:Port, and regard this as an internal error (it assumes the first message has to be the one it is waiting for). I do not know how to work around this bug, if it exists. One ugly way would to return all received unrelated events with the {ok,...} or {error,...} value (shrug!). The code for active mode I have now does receive {sctp,S,IP,Port,,..} if the socket is in active mode so it is a selective receive, which would work better in this scenario of competing incoming/outgoing #sctp_assoc_change{}, but this keeps the connect blocking. An option for non-blocking connect is missing, or if the socket is active the connect should be non-blocking and the caller should handle the comm_up message... And, if the user sets a too short timeout in connect/5 the #sctp_assoc_change{state=comm_up} may arrive just after the timeout. For passive mode this will not be noticed until recv/2 is called (much) later. For active mode the comm_up message arrives instantly in the inbox. A well written caller would have to be ready for these late messages anyway. So, there are subtle semantic differences between connect/5 in passive vs active mode. And making connect/5 always non-blocking would remove the differences but force the caller to handle the comm_up event the right way... Which is the least bad alternative...? Summary: 1) There is probably a problem with the current passive connect/5 that may be solved by making it non-blocking but that will be unconvenient. There might be other ways to solve that problem and maybe ther is no problem. 2) Should connect/5 for active socket be non-blocking or not, or selectable. If connect/5 for passive socket is made non-blocking it should be the same for active socket. > Serge > > > > > Raimo Niskanen wrote: > > Hi list! > > > > I am in the process of fixing active mode for gen_sctp, and up > > comes a question about why connect/5 returns {ok,Assoc} instead > > of just ok. The connect/5 code does an implicit recv/2 to get > > an #sctp_assoc_change{} message to return. > > > > A change to connect/5 not returning the #sctp_assoc_change{} > > message, letting the user explicitly call recv/2 or in > > active mode receive the #sctp_assoc_change{} would simplify > > the connect/5 code and perhaps make gen_sctp more SCTP. > > But would connect/5 become much less usable? > > > > gen_sctp is still in beta state. If a change is appropriate, > > it should be made as soon as possible. > > > > Nevertheless, these changes will not make it into R12B-2. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Thu Apr 3 11:17:05 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Apr 2008 11:17:05 +0200 Subject: [erlang-questions] : My messages don't appear in the mailing-list In-Reply-To: <47F47B1D.1000107@cheapnet.it> References: <47F3E9E4.4030109@cheapnet.it> <595970ad0804021508r544c8f65j5adc3a9ef7c2a91d@mail.gmail.com> <47F47B1D.1000107@cheapnet.it> Message-ID: <20080403091705.GB30303@erix.ericsson.se> On Thu, Apr 03, 2008 at 08:37:17AM +0200, Jilani Khaldi wrote: > Elliot Murphy wrote: > > Are you using gmail? > No. I am using a commercial e-mail server. > However I am seeing them now. The problem is I sent yesterday the > message about the subject "Calculate PI in Erlang faster than in Matlab" > and I am seeing it only now, but I sent an other message after that and > I saw it after few seconds. > It doesn't happen with other mailing-lists. Perheaps the delay is due to > the mail server anti-spam of "erlang-questions". > Yes. The server uses greytrapping as a spam defense. And for large SMTP farms with few subscribers (to our maling lists) it does not work that well automatically. Your mails arrive from many different mail hosts, and since one particular mail can be resent from a different host, the mail hosts have a hard time getting whitelisted. And that is why some mails get through instantaneouly and some not. If there were many subscribers to erlang-questions from your SMTP farm all hosts would become whitelisted with ease, and the problem would disappear. It disappears now too, but it takes time. I have made all your SMTP farm hosts permanently approved. Thank you for pointing this out. Anyone else with the same problem let me know! > -- > *** > T E M A > http://www.dotpas.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From jeffm@REDACTED Thu Apr 3 12:16:50 2008 From: jeffm@REDACTED (jm) Date: Thu, 03 Apr 2008 21:16:50 +1100 Subject: [erlang-questions] : My messages don't appear in the mailing-list In-Reply-To: <20080403091705.GB30303@erix.ericsson.se> References: <47F3E9E4.4030109@cheapnet.it> <595970ad0804021508r544c8f65j5adc3a9ef7c2a91d@mail.gmail.com> <47F47B1D.1000107@cheapnet.it> <20080403091705.GB30303@erix.ericsson.se> Message-ID: <47F4AE92.8010101@ghostgun.com> Raimo Niskanen wrote: > Yes. The server uses greytrapping as a spam defense. And for > large SMTP farms with few subscribers (to our maling lists) > it does not work that well automatically. Your mails arrive > from many different mail hosts, and since one particular > mail can be resent from a different host, the mail hosts > have a hard time getting whitelisted. And that is why > some mails get through instantaneouly and some not. > If there were many subscribers to erlang-questions from > your SMTP farm all hosts would become whitelisted with ease, > and the problem would disappear. It disappears now > too, but it takes time. > > I have made all your SMTP farm hosts permanently approved. > Thank you for pointing this out. > > Anyone else with the same problem let me know! > What are you using for a mail server? I'm using postfix for a mail server at an ISP and at one stage started writting a postfix policy server in erlang with mnesia support to allow grey listing to work correctly across multiple servers. It was shelved early on. Might be time to drag it out and take another look. Jeff. From saleyn@REDACTED Thu Apr 3 13:10:03 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 03 Apr 2008 07:10:03 -0400 Subject: [erlang-questions] : gen_sctp:connect/5 change In-Reply-To: <20080403083845.GA30303@erix.ericsson.se> References: <20080402131658.GA12127@erix.ericsson.se> <47F43187.1010907@gmail.com> <20080403083845.GA30303@erix.ericsson.se> Message-ID: <47F4BB0B.4030908@gmail.com> Raimo Niskanen wrote: > On Wed, Apr 02, 2008 at 09:23:19PM -0400, Serge Aleynikov wrote: > But..(speculating, not tested).. for the current gen_sctp:connect/5; > if an association comes in on a (passive) listen socket just while > connect/5 is called - it internally calls recv/2 and may receive > the unrelated #sctp_assoc_change{} for another IP:Port, > and regard this as an internal error (it assumes the > first message has to be the one it is waiting for). > I do not know how to work around this bug, if it exists. > One ugly way would to return all received unrelated events > with the {ok,...} or {error,...} value (shrug!). I think logically it is not valid to use connect calls from the "server" side (for the reason you mentioned) even though SCTP doesn't prohibit this behavior there's no way to know whether the association change message is for the prior connection setup request or for some incoming "client" connection. Therefore, it's better to use a separate SCTP socket for listening and a separate one(s) for initiating client connections to other SCTP servers to avoid this race. > The code for active mode I have now does > receive {sctp,S,IP,Port,,..} if the socket is in active mode > so it is a selective receive, which would work better in this > scenario of competing incoming/outgoing #sctp_assoc_change{}, > but this keeps the connect blocking. An option for non-blocking > connect is missing, or if the socket is active the connect > should be non-blocking and the caller should handle > the comm_up message... Perhaps this analysis could be done in the driver code and split the result in two messages #sctp_assoc_up{} and #sctp_assoc_change{}? > And, if the user sets a too short timeout in connect/5 the > #sctp_assoc_change{state=comm_up} may arrive just after > the timeout. For passive mode this will not be noticed > until recv/2 is called (much) later. For active mode > the comm_up message arrives instantly in the inbox. > A well written caller would have to be ready for > these late messages anyway. Valid point. > So, there are subtle semantic differences between > connect/5 in passive vs active mode. And making connect/5 > always non-blocking would remove the differences but > force the caller to handle the comm_up event the > right way... Which is the least bad alternative...? > > Summary: > 1) There is probably a problem with the current > passive connect/5 that may be solved by making > it non-blocking but that will be unconvenient. > There might be other ways to solve that problem > and maybe ther is no problem. The recommendation above on introducing #sctp_assoc_up{} would address this issue, but would "break" the existing 1-to-1 mapping of SCTP C structs to alike Erlang records. The later may be a worthwhile sacrifice. > 2) Should connect/5 for active socket be non-blocking > or not, or selectable. If connect/5 for passive > socket is made non-blocking it should be the > same for active socket. Agreed. Regards, Serge >> Raimo Niskanen wrote: >>> Hi list! >>> >>> I am in the process of fixing active mode for gen_sctp, and up >>> comes a question about why connect/5 returns {ok,Assoc} instead >>> of just ok. The connect/5 code does an implicit recv/2 to get >>> an #sctp_assoc_change{} message to return. >>> >>> A change to connect/5 not returning the #sctp_assoc_change{} >>> message, letting the user explicitly call recv/2 or in >>> active mode receive the #sctp_assoc_change{} would simplify >>> the connect/5 code and perhaps make gen_sctp more SCTP. >>> But would connect/5 become much less usable? >>> >>> gen_sctp is still in beta state. If a change is appropriate, >>> it should be made as soon as possible. >>> >>> Nevertheless, these changes will not make it into R12B-2. >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > From raimo+erlang-questions@REDACTED Thu Apr 3 14:09:21 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Apr 2008 14:09:21 +0200 Subject: [erlang-questions] : : My messages don't appear in the mailing-list In-Reply-To: <47F4AE92.8010101@ghostgun.com> References: <47F3E9E4.4030109@cheapnet.it> <595970ad0804021508r544c8f65j5adc3a9ef7c2a91d@mail.gmail.com> <47F47B1D.1000107@cheapnet.it> <20080403091705.GB30303@erix.ericsson.se> <47F4AE92.8010101@ghostgun.com> Message-ID: <20080403120921.GA1195@erix.ericsson.se> On Thu, Apr 03, 2008 at 09:16:50PM +1100, jm wrote: > Raimo Niskanen wrote: > > Yes. The server uses greytrapping as a spam defense. And for > > large SMTP farms with few subscribers (to our maling lists) > > it does not work that well automatically. Your mails arrive > > from many different mail hosts, and since one particular > > mail can be resent from a different host, the mail hosts > > have a hard time getting whitelisted. And that is why > > some mails get through instantaneouly and some not. > > If there were many subscribers to erlang-questions from > > your SMTP farm all hosts would become whitelisted with ease, > > and the problem would disappear. It disappears now > > too, but it takes time. > > > > I have made all your SMTP farm hosts permanently approved. > > Thank you for pointing this out. > > > > Anyone else with the same problem let me know! > > > > What are you using for a mail server? I'm using postfix for a mail > server at an ISP and at one stage started writting a postfix policy > server in erlang with mnesia support to allow grey listing to work > correctly across multiple servers. It was shelved early on. Might be > time to drag it out and take another look. > The machine is running OpenBSD so it uses sendmail. Greylisting is done by OpenBSD's spamd, and it can as far as I know collaborate across multiple hosts. Spamd uses the packet filter to route whitelisted hosts to sendmail and talks itself to the greylisted. It is also written to handle many connections efficiently. Take a look at: http://www.openbsd.org/cgi-bin/man.cgi?query=spamd and related before dragging out your old project. > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Thu Apr 3 15:04:36 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Apr 2008 15:04:36 +0200 Subject: [erlang-questions] : : gen_sctp:connect/5 change In-Reply-To: <47F4BB0B.4030908@gmail.com> References: <20080402131658.GA12127@erix.ericsson.se> <47F43187.1010907@gmail.com> <20080403083845.GA30303@erix.ericsson.se> <47F4BB0B.4030908@gmail.com> Message-ID: <20080403130436.GA2216@erix.ericsson.se> On Thu, Apr 03, 2008 at 07:10:03AM -0400, Serge Aleynikov wrote: > Raimo Niskanen wrote: > > On Wed, Apr 02, 2008 at 09:23:19PM -0400, Serge Aleynikov wrote: > > But..(speculating, not tested).. for the current gen_sctp:connect/5; > > if an association comes in on a (passive) listen socket just while > > connect/5 is called - it internally calls recv/2 and may receive > > the unrelated #sctp_assoc_change{} for another IP:Port, > > and regard this as an internal error (it assumes the > > first message has to be the one it is waiting for). > > I do not know how to work around this bug, if it exists. > > One ugly way would to return all received unrelated events > > with the {ok,...} or {error,...} value (shrug!). > > I think logically it is not valid to use connect calls from the "server" > side (for the reason you mentioned) even though SCTP doesn't prohibit > this behavior there's no way to know whether the association change > message is for the prior connection setup request or for some incoming > "client" connection. Therefore, it's better to use a separate SCTP > socket for listening and a separate one(s) for initiating client > connections to other SCTP servers to avoid this race. > Very true but, if it is allowed by SCTP someone will want to do it. Maybe we can just disallow connect on a listen socket and call it a known limitation. > > The code for active mode I have now does > > receive {sctp,S,IP,Port,,..} if the socket is in active mode > > so it is a selective receive, which would work better in this > > scenario of competing incoming/outgoing #sctp_assoc_change{}, > > but this keeps the connect blocking. An option for non-blocking > > connect is missing, or if the socket is active the connect > > should be non-blocking and the caller should handle > > the comm_up message... > > Perhaps this analysis could be done in the driver code and split the > result in two messages #sctp_assoc_up{} and #sctp_assoc_change{}? Sorry, you will have to elaborate. What should be analyzed and what should be split? If you mean the driver might check for correct IP andPort, and that it is a #sctp_assoc_change{} while in state connecting (that does not exist now), what will it do with other recv() results? I had a thought that prim_inet:connect/4 could return the {active,true|false|once} state, which would make that getopt atomic with respect to connect, but it does still not help {active,false} and {active,once} since if a message has been received it can not be undone. > > > And, if the user sets a too short timeout in connect/5 the > > #sctp_assoc_change{state=comm_up} may arrive just after > > the timeout. For passive mode this will not be noticed > > until recv/2 is called (much) later. For active mode > > the comm_up message arrives instantly in the inbox. > > A well written caller would have to be ready for > > these late messages anyway. > > Valid point. > > > So, there are subtle semantic differences between > > connect/5 in passive vs active mode. And making connect/5 > > always non-blocking would remove the differences but > > force the caller to handle the comm_up event the > > right way... Which is the least bad alternative...? > > > > Summary: > > 1) There is probably a problem with the current > > passive connect/5 that may be solved by making > > it non-blocking but that will be unconvenient. > > There might be other ways to solve that problem > > and maybe ther is no problem. > > The recommendation above on introducing #sctp_assoc_up{} would address > this issue, but would "break" the existing 1-to-1 mapping of SCTP C > structs to alike Erlang records. The later may be a worthwhile sacrifice. > Explain more. I am a fan of keeping 1-1 mapping, generally. > > 2) Should connect/5 for active socket be non-blocking > > or not, or selectable. If connect/5 for passive > > socket is made non-blocking it should be the > > same for active socket. > > Agreed. > But, should simply connect/5 for active socket be non-blocking? And only allow connect/5 on listen socket that is {active,true}? > Regards, > > Serge > : : -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kosmyq@REDACTED Thu Apr 3 18:39:06 2008 From: kosmyq@REDACTED (Bo) Date: Thu, 3 Apr 2008 09:39:06 -0700 (PDT) Subject: [erlang-questions] Questions on gen_tcp & flexible parsing -2- (readable) Message-ID: <386001.61120.qm@web51107.mail.re2.yahoo.com> *** 2nd submission, readable version *** *** Please delete fist version *** I have now been programming in Erlang for quite a while and most things are really easy to do, but I found some rather tough issues, here the come: 1) When using the example server from the man pages of the gen_tcp / inet unit I have tried to create an auto update routine, which does a sort of ?MODULE:loop(), but it seems that the sockets just won't let go, stick to the running module and as expected under the circunstances, after the second update Erlang moves the sockets out of the VM and ends the processes, so I cannot create a socket server which permits to be updated in runtime. Just for info, under any other cicumstances I have managed to create all my other modules to be updatable and it works just fine, except this simple socket server ?? Does gen_tcp have problems to do the typical ?MODULE:loop(X) ?? 2) Erlang describes that one can limit the size of the packet to be received by a socket, if it's longer it gets marked invalid and I would suppose that it gets dropped, the parameter is called packet_size. I would like to limit the packets to be received to be of X size, the example below shows 255, yet I can successfully send large packets to the socket, what's wrong ?? Note: Why do I want this ?? I want to avoid problems where hackers do a buffer overrun hack and crash the server by sending many large packets which then write to memory at some point or crash the server because it exhausts memory, something very common in Windows hacks. inet states that much depends on the underlying OS, which is Windows in this case, but I do not know if this parameter depends on the OS. Example: case gen_tcp:listen(LPort,[{active, false}, {packet_size, 255}, {packet,0}, {recbuf, 255},{sndbuf, 255}]) of {ok, ListenSock} -> ........ I have even used recbuf and sndbuf which do not seem to do anything either. 3) Also, I am writing a small scripted client to test the server part, now, when I am bombarding the server with messages and ask it to send these to the other processes I face the following problem: first of all and thankfully, Erlang keeps up, the server does not seem to crash, yet, when a client finally crashes with a stack overflow (problably a memory leak or too much data), this particular acceptor on the server side does not exit, although I have included code to make sure that the exit gets trapped, yet this process stays alive, instead of closing. My question here is has anyone faced this before ?? When a client exits normally no problem ocurrs, only when it crashes. 4) I am building a command parser which needs to parse in commands of the structure {CMD:DETAIL}. Each time the server receives a packet it may receive several commands of this structure, which is why I need to parse a list of commands and the parsing code could look like this: parsecmd(T) -> parseusr(T, []). parscmd("{USR:" ++ T, L) -> {Url, T1} = collect_cmd(T, reverse("")), parsecmd(T1, [Url|L]); parsecmd([_|T], L) -> parsecmd(T, L); parseusr([], L) -> L. collect_cmd("}" ++ T, L) -> {reverse(L, ""), T}; collect_cmd([H|T], L) -> collect_cmd(T, [H|L]); collect_cmd([], _) -> {[],[]}. I would like to call parsecmd(,) The problem is that I cannot pass "{CMD:" as a parameter, like in the above "{USR:", if I do Erlang complains that it cannot process that structure, where "{CMD:" is a list. Is there any way this can be parametrized ?? Or is there another function ?? And no, I have not used YECC, because I find its working incomprehensible. I can already parse several commands when I search separately for "{", "}" and ":" but not for "{CMD:" and "}", where CMD is a variable that I want to pass to the parsing function. Any help is appreciated, I have researched different unit'mans, the whole Erlang Bible, other examples but I cannot find a solution to those 4 issues, so I am turning to the ever so wise community. Thanks in advance, Bo --------------------------------- You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. -------------- next part -------------- An HTML attachment was scrubbed... URL: From goyalnikhil@REDACTED Thu Apr 3 19:47:21 2008 From: goyalnikhil@REDACTED (Nikhil) Date: Thu, 3 Apr 2008 10:47:21 -0700 (PDT) Subject: [erlang-questions] HPUX otp R12-B1 any one? Message-ID: <774eddfa-281c-4b4c-a7e5-3c867b377ab8@8g2000hse.googlegroups.com> Hi List, From vladdu55@REDACTED Thu Apr 3 19:56:31 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 3 Apr 2008 19:56:31 +0200 Subject: [erlang-questions] Questions on gen_tcp & flexible parsing -2- (readable In-Reply-To: <386001.61120.qm@web51107.mail.re2.yahoo.com> References: <386001.61120.qm@web51107.mail.re2.yahoo.com> Message-ID: <95be1d3b0804031056l305f807eke51df56b8b505a07@mail.gmail.com> Hi, I think it would help with some example code. The things you mention should work, if handled properly (except #2, which I don't know about). For example, the included code is not working: parsecmd(T) -> parseusr(T, []). parscmd("{USR:" ++ T, L) -> %% shouldn't be 'parseusr'? .....; parsecmd([_|T], L) -> %% shouldn't be 'parseusr'? ......; parseusr([], L) -> L. regards, Vlad From goyalnikhil@REDACTED Thu Apr 3 20:20:06 2008 From: goyalnikhil@REDACTED (Nikhil) Date: Thu, 3 Apr 2008 11:20:06 -0700 (PDT) Subject: [erlang-questions] HPUX otp R12-B1 any one? In-Reply-To: <774eddfa-281c-4b4c-a7e5-3c867b377ab8@8g2000hse.googlegroups.com> References: <774eddfa-281c-4b4c-a7e5-3c867b377ab8@8g2000hse.googlegroups.com> Message-ID: <9a86c600-b6d8-40d1-a270-0a2bf38a4fc1@p25g2000hsf.googlegroups.com> Hit the send button too soon, completing the question now. I have been trying to build otp R12B-1 on HPUX 11.23 running on a itanium with gcc 3.4.1 for a while now without success of course, has any one done this before? Regards, Nikhil On Apr 3, 12:47?pm, Nikhil wrote: > Hi List, > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From dizzyd@REDACTED Fri Apr 4 00:25:55 2008 From: dizzyd@REDACTED (Dave Smith) Date: Thu, 3 Apr 2008 16:25:55 -0600 Subject: [erlang-questions] Monitor vs. Link Message-ID: So I was sent a link to a talk done by Bob Ippolito (nice to put a name with the face) :) http://www.viddler.com/explore/rentzsch/videos/8/ In that video, Bob makes a glancing comment along the lines of: "...you'll only see process_flag(trap_exit, true) in old code. Typically you will use monitoring instead..." This is interesting to me as I recently found myself using links + trap_exit amongst some related processes and I wondered if the "Right Way" would have been to use monitors instead. I do have a bi-directional relationship between processes -- if one dies I want the other to also (typically) do some shutdown. I could accomplish the same thing with two monitors, but it seems like more work overall. So, here's my question -- is there a reason to prefer using two monitors to create a bi-directional monitor over link + trap_exit? What's the best practice, particularly when one considers that I'm using OTP patterns (gen_server and gen_fsm)? Thanks, D. From david.hopwood@REDACTED Fri Apr 4 02:13:04 2008 From: david.hopwood@REDACTED (David-Sarah Hopwood) Date: Fri, 04 Apr 2008 01:13:04 +0100 Subject: [erlang-questions] linked-in driver licence question In-Reply-To: References: <2c3a56270803310929y330ad7a6va6da58458c4760a8@mail.gmail.com> Message-ID: <47F57290.9080805@industrial-designers.co.uk> Matthew Dempsky wrote: > On Mon, Mar 31, 2008 at 9:29 AM, Danila Bagrov wrote: >> Hello list, >> If I develope a linked-in driver which use a GPL library, I don't have >> to publish source of my programs which use this driver, correct? I >> will only have to publish source for the driver (because Erlang >> already is open source)? > > You should be aware that the Erlang Public License is incompatible > with the GPL. You'll have legal trouble if your linked-in driver is > considered a derivative work of both the Erlang runtime and that GPL > library. See http://www.gnu.org/licenses/gpl-faq.html#GPLPluginsInNF > for some more information. One option is to try to get explicit approval from the developers of the GPL library for it to be linked with Erlang/OTP. Arguably, as a language implementation Erlang/OTP is playing a similar role to a "system library", even though it may not satisfy the letter of the definition, as described at . (I find the GPL to be quite {C,C++}-centric in its assumptions; that's one of the reasons why I don't use it for open-source code that I write.) Incidentally, are you sure that it is a GPL library? The LGPL is more commonly used for libraries, precisely because of this kind of license incompatibility. -- David-Sarah Hopwood From kosmyq@REDACTED Fri Apr 4 01:15:34 2008 From: kosmyq@REDACTED (Bo) Date: Thu, 3 Apr 2008 16:15:34 -0700 (PDT) Subject: [erlang-questions] %5Berlang-questions%5D%20Questions%20on%20gen_tcp%20%26%20flexible%20parsing%20-2-%0A%09%28readable&In-Reply-To=386001.61120.qm%40web51107.mail.re2.yahoo.com Message-ID: <706975.77998.qm@web51104.mail.re2.yahoo.com> Code examples for my questions: Simplified Socket Server, taken from http://www.erlang.org/doc/man/gen_tcp.html and modified for auto updates: -module(test). -compile(export_all). start() -> spawn(?MODULE, start1, [3,5678]). start1(Num,Port) -> register(?MODULE, self()), start(Num,Port), sloop([]). sloop(Ls) -> receive {accept, Pid} -> sloop([Pid|Ls]); upgrade -> io:format("TEST: Loop upgrading.~n"), lists:foreach(fun(Pid) -> Pid ! upgrade, io:format("TEST: Loop .. upgrading ..~p..~n",[Pid]) end, Ls), ?MODULE:sloop(Ls); quit -> io:format("Loop quitting~n"), sloop(Ls); Other -> io:format("Loop other: ~p~n",[Other]), sloop(Ls) end. start(Num,LPort) -> case gen_tcp:listen(LPort,[{active, false},{packet,2}]) of {ok, ListenSock} -> start_servers(Num,ListenSock), {ok, Port} = inet:port(ListenSock), Port; {error,Reason} -> {error,Reason} end. start_servers(0,_) -> ok; start_servers(Num,LS) -> Pid=spawn(?MODULE,server,[LS]), ?MODULE ! {accept, Pid}, start_servers(Num-1,LS). server(LS) -> case gen_tcp:accept(LS) of {ok,S} -> loop(S), ?MODULE:start_servers(1,LS); upgrade -> io:format("TEST: ACPT upgrading ~p~n", [self()]), ?MODULE:server(LS); Other -> io:format("accept returned ~w - goodbye!~n",[Other]), ok end, receive upgrade -> io:format("TEST: ACPT2 upgrading ~p~n", [self()]), ?MODULE:server(LS); Other1 -> io:format("accept returned ~w - goodbye!~n",[Other1]), server(LS) end. loop(S) -> inet:setopts(S,[{active,once}]), receive {tcp,S,Data} -> Answer = process(Data), gen_tcp:send(S,Answer), loop(S); {tcp_closed,S} -> io:format("Socket ~w closed [~w]~n",[S,self()]), ok; upgrade -> io:format("TEST: Client upgrading ~p~n", [self()]), ?MODULE:loop(S) end. process(Data) -> Data. ****************************** The original code has a flaw in that if you type in something erroneous in the shell and your program will terminate, because the socket responds to errors in the controlling process, which by default is whoever created it, so I modified the code so that the program spawns a loop function (the controlling process) and stays there, hence errors in the shell no longer affect it. Problem: when sending a "test ! upgrade." the instruction "gen_tcp:accept(LS)" does NOT receive the update and hence the 2nd update fails and terminates the code. How can I make this work ?? ******************************************************************* Parser questions: This example should work now: parsecmd(T) -> parsecmd(T, []). parsecmd("{USR:" ++ T, L) -> {Url, T1} = collect_usr(T, reverse("")), parsecmd(T1, [Url|L]); parsecmd([_|T], L) -> parsecmd(T, L); parsecmd([], L) -> L. collect_usr("}" ++ T, L) -> {reverse(L, ""), T}; collect_usr([H|T], L) -> collect_usr(T, [H|L]); collect_usr([], _) -> {[],[]}. ******************************************************************* What does not work is this: parsecmd(Cmd, T) -> parsecmd(Cmd, T, []). parsecmd(Cmd ++ T, L) -> {Url, T1} = collect_usr(T, reverse("")), parsecmd(T1, [Url|L]); ....... One cannot insert a variable Cmd in this case to make this search more flexible, Erlang complains about it. The statement to be evaluated MUST be a fixed one, which is not so nice, so "parsecmd(Cmd ++ T, L) ->" will not work, "parsecmd("{USR:" ++ T, L) ->" will, but the term is fixed, I would like it to be variable. I hope this clarifies my doubts a bit. Thanks, Bo --------------------------------- You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders@REDACTED Wed Apr 2 00:21:56 2008 From: anders@REDACTED (Anders Dahlin) Date: Wed, 02 Apr 2008 00:21:56 +0200 Subject: [erlang-questions] erlang sucks In-Reply-To: References: <47D52E27.6060901@kreditor.se> <8209f740803110143h53b2df4br28c85a93d826abef@mail.gmail.com> <47D67F5F.1040807@kreditor.se> <20080313085352.GK4483@katolaz.homeunix.net> <1205408470.4296.28.camel@piko.site> <20080313161129.GA23334@vailsys.com> <87wso1o4si.fsf@pingviini.kortex.jyu.fi> Message-ID: <47F2B584.1040102@dahlinenergy.se> The attached will help identifying those "bugs". The majority of the code is about a decade old. During the years I've only added new expressions as I have happened to use them. It may not cover all the additions, but using the verbose flag will tell if it ignores an expression. Usage: seqvar:check(). seqvar:check(DoFs). seqvar:check(Options). seqvar:check(DoFs, Options). Where: DoFs = Directory or File | List of Directories and/or Files Options = [Option] Option = recurse - seqvar will recurse through sub directories. verbose - seqvar will report if it ignores any expressions. {incl, Fun()} - Include a file only if Fun(File) = true. {excl, Fun()} - Exclude a file if Fun(File) = true. {incldir, Fun()} - Include a directory only if Fun(Dir) = true. {excldir, Fun()} - Exclude a directory if Fun(Dir) = true. {inclvar, Fun()} - Include a variable only if Fun(Var) = true. Var is an atom. {exclvar, Fun()} - Exclude a variable if Fun(Var) = true. Var is an atom. If DoFs is omitted, the current directory will be used. Examples: 4> seqvar:check("foo.erl", [verbose]). Checking file "foo.erl" Line 25: Usage of 'T2', expected 'T4' Line 32: Usage of 'B1', expected 'B3' Line 46: Usage of 'Foo1', expected 'Foo2' Line 47: Usage of 'Baz1', expected 'Baz2' %% Exclude all variables starting with T 5> F = fun (V) -> case atom_to_list(V) of "T" ++ _ -> true; _ -> false end end. 6> seqvar:check("foo.erl", [{exclvar, F}, verbose]). Checking file "foo.erl" Line 32: Usage of 'B1', expected 'B3' Line 46: Usage of 'Foo1', expected 'Foo2' Line 47: Usage of 'Baz1', expected 'Baz2' Happy checking - no warranties! /Anders attila.rajmund.nohl@REDACTED wrote: > On Mon, 17 Mar 2008, Kevin Scaldeferri wrote: > >> On Mar 17, 2008, at 6:31 AM, Jani Hakala wrote: >> >>> attila.rajmund.nohl@REDACTED writes: >>> >>>> I don't think that immutable variables make it easier to write less >>>> buggier code. On the contrary, I often see code like this: >>>> >>>> HR1=f(HugeRecord), >>>> ... >>>> g(HR1). >>>> >>>> Then someone adds a line to modify the HugeRecord and forgets to >>>> update >>>> the call to 'g': >>>> >>>> HR1=f(HugeRecord), >>>> HR2=f2(HR1), >>>> ... >>>> g(HR1). >>>> >>>> Now we have a stupid bug. >>>> >>> The compiler would warn about that >>> Warning: variable 'HR2' is unused >> These examples always feel like people are insisting on writing >> imperative code in a functional language. Why not: >> >> HR1 = f2(f(HugeRecord)), >> ... >> g(HR1) > > Because this is a mock-example, the real code looks more like > > HR1=HugeRecord#hugeRecordType{someField=SomeValue} > ... code uses HR1 > HR2=HR1#hugeRecordType{someOtherField=SomeOtherValue} > ... > g(HR1), % forgot to update variable name > h(HR2). % didn't forget to update variable name > > In this case the compiler won't save my a**. I see this kind of code > change all the time. Every week I see a checkin which only fixes a > variable name that wasn't updated, so this is not exactly a rare bug. > > Bye,NAR -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: seqvar.erl URL: From matthew@REDACTED Fri Apr 4 04:24:58 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 3 Apr 2008 19:24:58 -0700 Subject: [erlang-questions] Weird pg2 behavior Message-ID: We're seeing weird behavior with pg2, namely that dead pids are not getting cleared from the pg2:get_members table. E.g. 250> [X || X <- pg2:get_members(Group) -- pg2:get_local_members(Group), node(X) =:= node()]. [<0.795.0>,<0.794.0>,<0.793.0>,<0.792.0>,<0.791.0>, <0.790.0>,<0.789.0>,<0.773.0>] As I understand pg2, the above expression should always evaluate to an empty list (ignoring race conditions). I've looked over pg2's source code briefly, and I don't see anything obvious that could cause this. Am I correct that this is a bug in pg2? Can anyone suggest what might cause this? From raimo+erlang-questions@REDACTED Fri Apr 4 09:05:03 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 4 Apr 2008 09:05:03 +0200 Subject: [erlang-questions] : : : gen_sctp:connect/5 change In-Reply-To: <20080403130436.GA2216@erix.ericsson.se> References: <20080402131658.GA12127@erix.ericsson.se> <47F43187.1010907@gmail.com> <20080403083845.GA30303@erix.ericsson.se> <47F4BB0B.4030908@gmail.com> <20080403130436.GA2216@erix.ericsson.se> Message-ID: <20080404070503.GA18132@erix.ericsson.se> On Thu, Apr 03, 2008 at 03:04:36PM +0200, Raimo Niskanen wrote: : : > On Thu, Apr 03, 2008 at 07:10:03AM -0400, Serge Aleynikov wrote: : : : : > > Raimo Niskanen wrote: : : : : : : > > > 2) Should connect/5 for active socket be non-blocking > > > or not, or selectable. If connect/5 for passive > > > socket is made non-blocking it should be the > > > same for active socket. > > > > Agreed. > > > > But, should simply connect/5 for active socket be non-blocking? > > And only allow connect/5 on listen socket that is {active,true}? > On the issue of choosing between blocking and non-blocking conntect, we could make connect(Socket, Addr, Port, Opts) be non- blocking instead of being connect(Socket, Add, Port, Opts, infinity). Or (heaven forbid) introduce connect_nb/4. > > Regards, > > > > Serge > > > : > : -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From vladdu55@REDACTED Fri Apr 4 10:13:26 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 4 Apr 2008 10:13:26 +0200 Subject: [erlang-questions] %5Berlang-questions%5D%20Questions%20on%20gen_tcp%20%26%20flexible%20parsing%20-2-%0A%09%28readable&In-Reply-To=386001.61120.qm%40web51107.mail.re2.yahoo.co In-Reply-To: <706975.77998.qm@web51104.mail.re2.yahoo.com> References: <706975.77998.qm@web51104.mail.re2.yahoo.com> Message-ID: <95be1d3b0804040113h714a1db8r21ad71eb78708ca2@mail.gmail.com> I will try to address some of your questions. First of all, the example is just an example, not everything is meant to work in a real setting. > server(LS) -> > case gen_tcp:accept(LS) of > {ok,S} -> > loop(S), > ?MODULE:start_servers(1,LS); > upgrade -> > io:format("TEST: ACPT upgrading ~p~n", [self()]), > ?MODULE:server(LS); > Other -> > io:format("accept returned ~w - goodbye!~n",[Other]), > ok > end, gen_tcp:accept/1 doesn't return 'upgrade', so the case above won't match. I think you are mixing return values with messages sent. > receive > upgrade -> > io:format("TEST: ACPT2 upgrading ~p~n", [self()]), > ?MODULE:server(LS); > Other1 -> > io:format("accept returned ~w - goodbye!~n",[Other1]), > server(LS) > end. You might not receive any 'upgrade' message here either, because it is consumed in loop/1, below. > loop(S) -> > inet:setopts(S,[{active,once}]), > receive > {tcp,S,Data} -> > Answer = process(Data), > gen_tcp:send(S,Answer), > loop(S); > {tcp_closed,S} -> > io:format("Socket ~w closed [~w]~n",[S,self()]), > ok; > upgrade -> > io:format("TEST: Client upgrading ~p~n", [self()]), > ?MODULE:loop(S) > end. I am sorry that I can't help you with more details, but I would suggest that you understand first the workings of the example without any upgrades. For trying out how code updating works, a simpler test program could be useful, where it's easier to see what is happening. In chapter 12.3 in the Kernel reference manual, it is explained how code replacing works. You can only have two versions of a module active. Loading for the third time kills all processes running version 1, so you have to give the system some time to switch to version 2. If a process is blocked in a receive, it will still run version 1. > ******************************************************************* > Parser questions: > What does not work is this: > > parsecmd(Cmd, T) -> > parsecmd(Cmd, T, []). > > parsecmd(Cmd ++ T, L) -> > {Url, T1} = collect_usr(T, reverse("")), > parsecmd(T1, [Url|L]); > ....... > > One cannot insert a variable Cmd in this case to make this search more > flexible, Erlang complains about it. The statement to be evaluated MUST be > a fixed one, which is not so nice, so "parsecmd(Cmd ++ T, L) ->" will not > work, > "parsecmd("{USR:" ++ T, L) ->" will, but the term is fixed, I would like it > to be variable. Yes, you can't have a variable there. parsecmd("{USR:" ++ T, L) is a shortcut for parsecmd([${, $U, $S, $R, $: | T], L). Instead you could write a function get_cmd(Str) -> {Cmd, T} where Cmd is for example "{USR:" and change parsecmd to parsecmd({Cmd, T}, L), calling it like parsecmd(T) -> parsecmd(get_cmd(T), []). I hope this helps a little. regards, Vlad From hanssv@REDACTED Fri Apr 4 11:16:44 2008 From: hanssv@REDACTED (Hans Svensson) Date: Fri, 04 Apr 2008 11:16:44 +0200 Subject: [erlang-questions] [ANN] PhD Thesis: Verification of Distributed Erlang Programs... Message-ID: <47F5F1FC.3040300@cs.chalmers.se> Hi, I have recently managed to finish my PhD thesis 'Verification of Distributed Erlang Programs using Testing, Model Checking and Theorem Proving'. The thesis is available in pdf-format: http://www.cs.chalmers.se/~hanssv/doc/PhDThesis.pdf If you have any comments or questions, please feel free to send me an email. Have a nice day! /Hans -- Hans Svensson hanssv@REDACTED Computer Science and Engineering, Chalmers University of Technology, Gothenburg, Sweden http://www.cs.chalmers.se/~hanssv From ulf.wiger@REDACTED Fri Apr 4 12:02:07 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 04 Apr 2008 12:02:07 +0200 Subject: [erlang-questions] Monitor vs. Link In-Reply-To: References: Message-ID: <47F5FC9F.7020701@ericsson.com> One very nice aspect of link is "cascading exits", which allows you to spawn as many processes as you need and have only a few of them trap exits. The others will simply go away when the 'master' goes. Without this, you may sometimes hesitate to create extra processes, since they all have to do explicit cleanup. BR, Ulf W Dave Smith skrev: > So I was sent a link to a talk done by Bob Ippolito (nice to put a > name with the face) :) > > http://www.viddler.com/explore/rentzsch/videos/8/ > > In that video, Bob makes a glancing comment along the lines of: > > "...you'll only see process_flag(trap_exit, true) in old code. > Typically you will use monitoring instead..." > > This is interesting to me as I recently found myself using links + > trap_exit amongst some related processes and I wondered if the "Right > Way" would have been to use monitors instead. I do have a > bi-directional relationship between processes -- if one dies I want > the other to also (typically) do some shutdown. I could accomplish the > same thing with two monitors, but it seems like more work overall. > > So, here's my question -- is there a reason to prefer using two > monitors to create a bi-directional monitor over link + trap_exit? > What's the best practice, particularly when one considers that I'm > using OTP patterns (gen_server and gen_fsm)? > > Thanks, > > D. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From golubovsky@REDACTED Fri Apr 4 15:40:36 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Fri, 4 Apr 2008 09:40:36 -0400 Subject: [erlang-questions] Any recent progress on Haskerl? Message-ID: Hi, Has there been any progress on Haskerl recently? The latest commit shown here: http://www.tornkvist.org/darcsweb?r=haskerl;a=summary is 5 months ago: has the code migrated over to another repo, or is the project just suspended? I am myself interested in Haskell frontend to Erlang, but before taking any development steps I'd like to find out what has been done already. Thanks. -- Dimitry Golubovsky Anywhere on the Web From tobbe@REDACTED Fri Apr 4 16:08:34 2008 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 04 Apr 2008 16:08:34 +0200 Subject: [erlang-questions] Any recent progress on Haskerl? In-Reply-To: References: Message-ID: Dimitry Golubovsky wrote: > Hi, > > Has there been any progress on Haskerl recently? > > The latest commit shown here: > > http://www.tornkvist.org/darcsweb?r=haskerl;a=summary > > is 5 months ago: has the code migrated over to another repo, or is the > project just suspended? Nothing has happend since then. I would be more than happy to let someone else chip in. However note that, since this was my first Haskell project ever, the code is very poorly written and a seasoned Haskell coder would probably rewrite everything from scratch. So feel free to grab the code and hack away on it :-) And if you do; please keep me posted on your progress. Cheers, Tobbe > > I am myself interested in Haskell frontend to Erlang, but before > taking any development steps I'd like to find out what has been done > already. > > Thanks. > From pfisher@REDACTED Fri Apr 4 16:41:39 2008 From: pfisher@REDACTED (Paul Fisher) Date: Fri, 04 Apr 2008 09:41:39 -0500 Subject: [erlang-questions] driver_async() marks driver as permanent? Message-ID: <1207320099.6166.135.camel@pfisher-laptop> Does using driver_async() from within a linked-in driver mark the driver as permanent automatically? I am seeing an {error, permanent} out of erl_ddll:unload_driver/1 even after all of the processes which called open_port/2 have exited, and therefore all of the port instances using the driver have stopped. If this is done automatically, is there a way to "unmark" it, so that I can still unload the driver? If such automatic marking is is not done, can someone confirm? -- paul From cyberlync@REDACTED Sat Apr 5 00:18:44 2008 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 4 Apr 2008 15:18:44 -0700 Subject: [erlang-questions] Erlounge: Seattle 04/25 @ 6:30 Message-ID: Seattle 04/25 6:30 @ Barca's in Capital Hill - http://www.barcaseattle.com/ Everyone, It just so happens that three of the five Erlware maintainers are going to be in Seattle for the weekend of the 25th. That sounds like a good excuse for us to get a group together and talk about Erlang, maybe Erlware too, for a few hours. Feel free to come down to Barca's that friday night for some decent beer and conversation thats at least a little related to Erlang. Thanks, Eric From pfisher@REDACTED Sat Apr 5 03:29:04 2008 From: pfisher@REDACTED (Paul Fisher) Date: Fri, 04 Apr 2008 20:29:04 -0500 Subject: [erlang-questions] driver_async() marks driver as permanent? In-Reply-To: <1207320099.6166.135.camel@pfisher-laptop> References: <1207320099.6166.135.camel@pfisher-laptop> Message-ID: <1207358944.6166.183.camel@pfisher-laptop> On Fri, 2008-04-04 at 09:41 -0500, Paul Fisher wrote: > Does using driver_async() from within a linked-in driver mark the driver > as permanent automatically? I am seeing an {error, permanent} out of > erl_ddll:unload_driver/1 even after all of the processes which called > open_port/2 have exited, and therefore all of the port instances using > the driver have stopped. > > If this is done automatically, is there a way to "unmark" it, so that I > can still unload the driver? Answering my own question again... I got some time this evening to look into this, and apparently the answer is yes. This little tidbit in erts/emulator/beam/erl_async.c:async_add(), line 139 (R12B-1): /* XXX:PaN Is this still necessary when ports lock drivers? */ if (is_internal_port(a->port)) { ERTS_LC_ASSERT(erts_drvportid2port(a->port)); /* make sure the driver will stay around */ driver_lock_driver(internal_port_index(a->port)); } which eventually winds its way down to this in erl_bif_ddll.c, line 1109 dh->procs = NULL; erts_ddll_reference_driver(dh); dh->status = ERL_DE_PERMANENT; and there is not any place that removes that status value, that I can find on brief inspection. (Basically only initialization/reload code sets this field.) So is the comment in async_add() proper and this could be removed? (I'd appreciate some guidance on this as this is the first time i've mucked around the runtime code and just don't have the background yet to make informed decisions.) -- paul From icfp.publicity@REDACTED Sat Apr 5 17:44:09 2008 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Sat, 5 Apr 2008 10:44:09 -0500 Subject: [erlang-questions] DEFUN08: Call for Talks & Tutorials (co-located w/ ICFP08) Message-ID: <53ff55480804050844m4cd671dby35c9b559359d5f73@mail.gmail.com> Call for Talks and Tutorials ACM SIGPLAN 2008 Developer Tracks on Functional Programming http://www.deinprogramm.de/defun-2008/ Victoria, BC, Canada, 25, 27 September, 2008 The workshop will be held in conjunction with ICFP 2008. http://www.icfpconference.org/icfp2008/ Important dates Proposal Deadline: June 27, 2008, 0:00 UTC Notification: July 14, 2008 DEFUN 2008 invites functional programmers who know how to solve problems with functional prorgamming to give talks and lead tutorials at the The ICFP Developer Tracks. We want to know about your favorite programming techniques, powerful libraries, and engineering approaches you've used that the world should know about and apply to other projects. We want to know how to be productive using functional programming, write better code, and avoid common pitfals. We invite proposals for presentations in the following categories: How-to talks: 45-minute "how-to" talks that provide specific information on how to solve specific problems using functional programming. These talks focus on concrete examples, but provide useful information for developers working on different projects or in different contexts. Examples: - "How I made Haskell an extension language for SAP R/3." - "How I replaced /sbin/init by a Scheme program." - "How I hooked up my home appliances to an Erlang control system." - "How I got an SML program to drive my BMW." General language tutorials Half-day general language tutorials for specific functional languages, given by recognized experts for the respective languages. Technology tutorials Half-day tutorials on techniques, technologies, or solving specific problems in functional programming such as: - how to make the best use of specific FP programming techniques - how to inject FP into a development team used to more conventional technologies - how to connect FP to existing libraries / frameworks / platforms - how to deliver high-performance systems with FP - how to deliver high-reliability systems with FP Remember that your audience will include computing professionals who are not academics and who may not already be experts on functional programming. Presenters of tutorials will receive free registration to ICFP 2008. Submission guidelines Submit a proposal of 150 words or less for either a 45-minute talk with a short Q&A session at the end, or a 300-word-or-less proposal for a 3-hour tutorial, where you present your material, but also give participants a chance to practice it on their own laptops. Some advice: - Give it a simple and straightforward title or name; avoid fancy titles or puns that would make it harder for attendees to figure out what you'll be talking about. - Clearly identify the level of the talk: What knowledge should people have when they come to the presentation or tutorial? - Explain why people will want to attend: is the language or library useful for a wide range of attendees? Is the pitfall you're identifying common enough that a wide range of attendees is likely to encounter it? - Explain what benefits attendees are expected to take home to their own projects. - For a tutorial, explain how you want to structure the time, and what you expect to have attendees to do on their laptops. List what software you'll expect attendees to have installed prior to coming. Submit your proposal in plain text electronically to defun-2008-submission-AT-deinprogramm.de by the beginning of Friday, June 27, Universal Coordinated Time. Organizers Kathleen Fisher AT&T Labs Simon Peyton Jones Microsoft Research Mike Sperber (co-chair) DeinProgramm Don Stewart (co-chair) Galois From exta7@REDACTED Sat Apr 5 20:44:59 2008 From: exta7@REDACTED (Zvi) Date: Sat, 5 Apr 2008 11:44:59 -0700 (PDT) Subject: [erlang-questions] Calculate PI in Erlang faster than in Matlab In-Reply-To: <16440056.post@talk.nabble.com> References: <16440056.post@talk.nabble.com> Message-ID: <16516522.post@talk.nabble.com> Some more test runs. My previous runs were performed on my 2-years old laptop: Single Intel Core Duo T2500 @ 2GHz (total 2 cores), 2GB RAM Now I performed some test on my relatively new server machine: Quad Intel Xeon Quad Core @ 2.93GHz (total 16 cores), 8 GB RAM Erlang (BEAM) emulator version 5.6.1 [smp:16] [async-threads:0] Eshell V5.6.1 (abort with ^G) 2> c(plists). {ok,plists} 3> c(pi). {ok,pi} 4> pi:test(). [{math,{1,3.14159}}, {list_creation,{108998,3.14159}}, {lc,{921999,3.14159}}, {lc_no_pow,{874999,3.14159}}, {map,{624999,3.14159}}, {plists_map,{1764999,3.14159}}, {mapfoldl,{515999,3.14159}}, {serial_decr,{202999,3.14159}}, {serial_decr_opt,{327999,3.14159}}, {serial,{234999,3.14159}}, {parallel,{14999,3.14159}}] For some reason, even if each server core is much faster, than single core in my laptop. The serial benchmarks on the laptop are much better. But the parallel version takes ~15..16 ms. with a factor of 15.7, i.e. 234999/14999 = 15.6676. Zvi Zvi wrote: > > > My machine hase dual-core CPU, but I have older version of Matlab, which > doesn't use all cores, so Matlab version took 125 ms: > >>> tic; N=1000000; Step = 1/N; PI = Step*sum(4./(1+(((1:N)-0.5)*Step).^2)); >>> toc > Elapsed time is 0.125428 seconds. > > Below is Erlang results: > > 2> c(pi). > {ok,pi} > 3> pi:test(). > [{math,{1,3.14159}}, > {list_creation,{77998,3.14159}}, > {lc,{671999,3.14159}}, > {lc_no_pow,{593999,3.14159}}, > {map,{436999,3.14159}}, > {mapfoldl,{687999,3.14159}}, > {serial_decr,{170999,3.14159}}, > {serial,{171999,3.14159}}, > {parallel,{93999,3.14159}}] > 4> > > another run: > > 6> pi:test(). > [{math,{1,3.14159}}, > {list_creation,{62998,3.14159}}, > {lc,{671999,3.14159}}, > {lc_no_pow,{671999,3.14159}}, > {map,{436999,3.14159}}, > {mapfoldl,{687999,3.14159}}, > {serial_decr,{170999,3.14159}}, > {serial,{171999,3.14159}}, > {parallel,{77999,3.14159}}] > > -- View this message in context: http://www.nabble.com/Calculate-PI-in-Erlang-faster-than-in-Matlab-tp16440056p16516522.html Sent from the Erlang Questions mailing list archive at Nabble.com. From matthew@REDACTED Sun Apr 6 04:30:04 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Sat, 5 Apr 2008 19:30:04 -0700 Subject: [erlang-questions] Weird pg2 behavior In-Reply-To: References: Message-ID: For what it's worth, this is on a network of R12B-1 nodes running on Linux amd64 and FreeBSD i386. On Thu, Apr 3, 2008 at 7:24 PM, Matthew Dempsky wrote: > We're seeing weird behavior with pg2, namely that dead pids are not > getting cleared from the pg2:get_members table. E.g. > > 250> [X || X <- pg2:get_members(Group) -- > pg2:get_local_members(Group), node(X) =:= node()]. > [<0.795.0>,<0.794.0>,<0.793.0>,<0.792.0>,<0.791.0>, > <0.790.0>,<0.789.0>,<0.773.0>] > > As I understand pg2, the above expression should always evaluate to an > empty list (ignoring race conditions). I've looked over pg2's source > code briefly, and I don't see anything obvious that could cause this. > > Am I correct that this is a bug in pg2? Can anyone suggest what might > cause this? > From shehan@REDACTED Sun Apr 6 08:07:20 2008 From: shehan@REDACTED (shehan) Date: Sun, 6 Apr 2008 11:37:20 +0530 Subject: [erlang-questions] mnesia-overloaded & shutting down erlang node Message-ID: <20080406061109.E9D3719DC1D6@mail.wavenet.lk> Hi all, I fragmented mnesia database for 3 nodes. I fragmented some tables for 30 parts. (10 *3) In some times, some nodes going down without showing any errors. Some times show mnesia overload (Mnesia(test1@REDACTED): ** WARNING ** Mnesia is overloaded: .) & shutting down immediately. Pls give advice to avoid that. BR, Shehan Note : I used NUM_THREADS=64 when starting node. -------------- next part -------------- An HTML attachment was scrubbed... URL: From james.hague@REDACTED Sun Apr 6 19:37:05 2008 From: james.hague@REDACTED (James Hague) Date: Sun, 6 Apr 2008 12:37:05 -0500 Subject: [erlang-questions] Vector instructions In-Reply-To: <47F4739B.5020303@ghostgun.com> References: <47F4739B.5020303@ghostgun.com> Message-ID: > Has anyone given any thought to adding vector instructions or otherwise > adding support for vectors to Erlang? I've proposed adding APL-style vector operations on tuples: {1,2,3} + 1 ==> {2,3,4} {1,2,3) * 2 ==> {2,4,6} 2 * {1,2,3} ==> {2,4,6} {1,2,3} + {3,2,1} ==> {4,4,4} The operations apply to the top level only; they're not recursive. This would make vector math style code a lot simpler to write in Erlang. One of the points raised in response to this was that we shouldn't be overloading tuple operations like this, but have a special "vector of float" type. I'm not sure I agree with that. From exta7@REDACTED Sun Apr 6 23:16:42 2008 From: exta7@REDACTED (Zvi) Date: Sun, 6 Apr 2008 14:16:42 -0700 (PDT) Subject: [erlang-questions] Vector instructions In-Reply-To: References: <47F4739B.5020303@ghostgun.com> Message-ID: <16529946.post@talk.nabble.com> James, With generic tuples it's impossible to implement efficient SIMD operations. Also there is many undefined/confusing behaiviors, when elements of tuple are not numeric. This is the same kind of mistakes, like 2 bad design decisions made in Erlang: 1. "Ohh, record looks just like a tuple!", so let's throw in some syntactic sugar for this, instead of real immutable structs/dictionaries. 2. "Ohh, string looks just like a list of integers!", so let's throw in some syntactic sugar for this, instead of implementing real Unicode-aware immutable string datatype. In my opinion Erlang might be a good match, not only for High Availability (HA) applications, but also High Performance Computing (HPC) applications, and it might wipe out MPI as de-facto standard, by additing highly optimized Matlab-like "matrix of double"/"multidimensional array of double" datatype. Array Programming is also such a good fit for FP, since you may naturaly extend map and fold/reduce for this datatype. Also, vector math, even if not implemented efficiently, makes you much more productive and allows you to prototype with one-liners from shell. Combining this with Erlang's built-in concurrency and distrition primitives it makes it Super-High-level language. Unlike other Array programming languages, I propose that Erlang matrix datatype will be immutable. So, in my view Erlang should be H^3 (read as H-cube) language: Highly Available HPC High-level For the start maybe it's possible to take some code from PyNum (unfortunately Octave has GNU license). http://en.wikipedia.org/wiki/Category:Array_programming_languages http://en.wikipedia.org/wiki/Numpy http://en.wikipedia.org/wiki/GNU_Octave BTW, I somewhat disappointed with vector math implemented in Matlab and kdb+/Q. It's not much faster than serial Erlang code (and much much slower than parallel Erlang code). You can see it in my little PI calculation benchmark: Matlab: >> tic; N=1000000; Step = 1/N; PI = Step*sum(4./(1+(((1:N)-0.5)*Step).^2)); >> toc Elapsed time is 0.125428 seconds. Q: q)N:1000000 q)Step:1%N q)PI: {[]; Step*((4f % (1f + ((Step*((1+ til N)-0.5)) xexp 2))) +/)} q)PI() 3.141593 q)\t do[1000;PI()] 264359 q) i.e. 264 ms on my dual CPU workstation I getting ~ 200 ms. Erlang: Serial tail-recursuive Erlang version takes ~ 170 ms - 300 ms (on different machines). Parallel Erlang version on 16 cores takes 15 ms Zvi James Hague wrote: > >> Has anyone given any thought to adding vector instructions or otherwise >> adding support for vectors to Erlang? > > I've proposed adding APL-style vector operations on tuples: > > {1,2,3} + 1 ==> {2,3,4} > {1,2,3) * 2 ==> {2,4,6} > 2 * {1,2,3} ==> {2,4,6} > {1,2,3} + {3,2,1} ==> {4,4,4} > > The operations apply to the top level only; they're not recursive. > This would make vector math style code a lot simpler to write in > Erlang. One of the points raised in response to this was that we > shouldn't be overloading tuple operations like this, but have a > special "vector of float" type. I'm not sure I agree with that. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Vector-instructions-tp16468138p16529946.html Sent from the Erlang Questions mailing list archive at Nabble.com. From rvirding@REDACTED Mon Apr 7 00:00:39 2008 From: rvirding@REDACTED (Robert Virding) Date: Mon, 7 Apr 2008 00:00:39 +0200 Subject: [erlang-questions] Vector instructions In-Reply-To: <16529946.post@talk.nabble.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> Message-ID: <3dbc6d1c0804061500q1ae462acu758a31cd558a6ad8@mail.gmail.com> I agree with Zvi here. Such a change would cause much confusion to users who do not want this feature. It would be better to add a new datatype for this and a set of functions operating on this type. BUT I would put the new BIFs in a separate module and not just dump them into erlang. I don't agree with you on your other "mistakes": 1. With records we were constrained to make them as fast as pure tuple operations. We maybe could have made a new datatype for it though. 2. And I think that lists are a wonderful datatype for processing strings. Robert On 06/04/2008, Zvi wrote: > > > James, > > With generic tuples it's impossible to implement efficient SIMD > operations. > Also there is many undefined/confusing behaiviors, when elements of tuple > are not numeric. > > This is the same kind of mistakes, like 2 bad design decisions made in > Erlang: > 1. "Ohh, record looks just like a tuple!", so let's throw in some > syntactic > sugar for this, instead of real immutable structs/dictionaries. > 2. "Ohh, string looks just like a list of integers!", so let's throw in > some > syntactic sugar for this, instead of implementing real Unicode-aware > immutable string datatype. > > In my opinion Erlang might be a good match, not only for High Availability > (HA) applications, but also High Performance Computing (HPC) applications, > and it might wipe out MPI as de-facto standard, by additing highly > optimized > Matlab-like "matrix of double"/"multidimensional array of double" > datatype. > Array Programming is also such a good fit for FP, since you may naturaly > extend map and fold/reduce for this datatype. > Also, vector math, even if not implemented efficiently, makes you much > more > productive and allows you to prototype with one-liners from shell. > Combining > this with Erlang's built-in concurrency and distrition primitives it makes > it Super-High-level language. Unlike other Array programming languages, I > propose that Erlang matrix datatype will be immutable. > > So, in my view Erlang should be H^3 (read as H-cube) language: > > Highly Available > HPC > High-level > > For the start maybe it's possible to take some code from PyNum > (unfortunately Octave has GNU license). > > http://en.wikipedia.org/wiki/Category:Array_programming_languages > http://en.wikipedia.org/wiki/Numpy > http://en.wikipedia.org/wiki/GNU_Octave > > > BTW, I somewhat disappointed with vector math implemented in Matlab and > kdb+/Q. It's not much faster than serial Erlang code (and much much slower > than parallel Erlang code). You can see it in my little PI calculation > benchmark: > > Matlab: > > >> tic; N=1000000; Step = 1/N; PI = > Step*sum(4./(1+(((1:N)-0.5)*Step).^2)); > >> toc > Elapsed time is 0.125428 seconds. > > Q: > > q)N:1000000 > q)Step:1%N > q)PI: {[]; Step*((4f % (1f + ((Step*((1+ til N)-0.5)) xexp 2))) +/)} > q)PI() > 3.141593 > q)\t do[1000;PI()] > 264359 > q) > > i.e. 264 ms > > on my dual CPU workstation I getting ~ 200 ms. > > > Erlang: > > Serial tail-recursuive Erlang version takes ~ 170 ms - 300 ms (on > different > machines). > Parallel Erlang version on 16 cores takes 15 ms > > Zvi > > > > James Hague wrote: > > > >> Has anyone given any thought to adding vector instructions or > otherwise > >> adding support for vectors to Erlang? > > > > I've proposed adding APL-style vector operations on tuples: > > > > {1,2,3} + 1 ==> {2,3,4} > > {1,2,3) * 2 ==> {2,4,6} > > 2 * {1,2,3} ==> {2,4,6} > > {1,2,3} + {3,2,1} ==> {4,4,4} > > > > The operations apply to the top level only; they're not recursive. > > This would make vector math style code a lot simpler to write in > > Erlang. One of the points raised in response to this was that we > > shouldn't be overloading tuple operations like this, but have a > > special "vector of float" type. I'm not sure I agree with that. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > -- > View this message in context: > http://www.nabble.com/Vector-instructions-tp16468138p16529946.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Apr 7 01:01:34 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 7 Apr 2008 11:01:34 +1200 Subject: [erlang-questions] Vector instructions In-Reply-To: <16529946.post@talk.nabble.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> Message-ID: <43C63741-95D4-4CD9-8570-69DDFA8F4DE3@cs.otago.ac.nz> On 7 Apr 2008, at 9:16 am, Zvi wrote: > This is the same kind of mistakes, like 2 bad design decisions made in > Erlang: > 1. "Ohh, record looks just like a tuple!", so let's throw in some > syntactic > sugar for this, instead of real immutable structs/dictionaries. > 2. "Ohh, string looks just like a list of integers!", so let's throw > in some > syntactic sugar for this, instead of implementing real Unicode-aware > immutable string datatype. I cannot let this past. It must be understood clearly that for many purposes, Erlang's use of lists of integers for strings is an EXCEPTIONALLY GOOD design. The number of programming languages with a "real Unicode-aware immutable string datatype" can be counted on the fingers of one ear. Unicode is far more complicated than most people realise. The Unicode 5.0 book (which I am currently slogging through) is >1400 pages. Admittedly, much of that is code charts, but an astonishing amount of it is not. I am not excepting Java from the list of "not real Unicode" languages. Unicode has about a hundred thousand characters. Java characters are 16 bits. Need I say more? One language that _doesn't_ have Java's central defect is Haskell, where the native representation for a string is, ahem, a list of character( code)s. From exta7@REDACTED Mon Apr 7 04:05:24 2008 From: exta7@REDACTED (Zvi) Date: Sun, 6 Apr 2008 19:05:24 -0700 (PDT) Subject: [erlang-questions] Vector instructions In-Reply-To: <43C63741-95D4-4CD9-8570-69DDFA8F4DE3@cs.otago.ac.nz> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <43C63741-95D4-4CD9-8570-69DDFA8F4DE3@cs.otago.ac.nz> Message-ID: <16532464.post@talk.nabble.com> Richard A. O'Keefe wrote: > > > On 7 Apr 2008, at 9:16 am, Zvi wrote: > > I cannot let this past. It must be understood clearly that > for many purposes, Erlang's use of lists of integers for strings > is an EXCEPTIONALLY GOOD design. > > The number of programming languages with a "real Unicode-aware immutable > string datatype" can be counted on the fingers of one ear. Unicode is > far more complicated than most people realise. The Unicode 5.0 book > (which I am currently slogging through) is >1400 pages. Admittedly, > much of that is code charts, but an astonishing amount of it is not. > > I am not excepting Java from the list of "not real Unicode" languages. > Unicode has about a hundred thousand characters. Java characters are > 16 bits. Need I say more? > > One language that _doesn't_ have Java's central defect is Haskell, > where the native representation for a string is, ahem, a list of > character( code)s. > Richard, In my opinion the reason, that Erlang needs specialized datatypes like: binary, bitstring, string, matrix, etc. it's because it's dynamically typed. When Erlang designers/implementers needed to process sequences of bytes, they for some strange reason didn't used tuples or lists of integers, but introduced a new datatype. Same goes for recently introduced bitstring datatype: why not to use tuples or lists of true or false atoms? :-) In fact I was wrong and Erlang "strings" are not just syntactic sugar, I think there is a lot of optimization behind the scenes and runtime trying to guess on every list if it's a string or not. If it's string it may use a more compact representation. The question is why to guess, if we have dynamically typed language, where each value tagged by a datatype anyway? My point is Erlang tuples and lists are polymorphic collections and when you want to have homogenous collections. Also all datatypes mentioned above also must provide indexing and subslicing, which is somewhat not very effective when underlying represntation is linked lists. About Unicode-support in string datatype, it must be practical, not 100% right, so something like utf16 is good enough for me. In Haskel you specify type of element (I do not know this language, just guessing the syntax, I have no idea how to represent vector in Haskel, so everything is a list): type String = [Char] type Binary = [0..255] type Bitstring = [Bool] type Matrix = (Int,Int,[Double]) BTW: I think Haskel's tuples are done right. I never understood why Erlangs' functions have arity, when every function can have single argument as a tuple. Haskel tuples must have at least 2 elements. So any single element is a tuple of 1? It's the same like in Matlab - scalar is a matrix of 1x1. But in Erlang x and {x} is not the same. Probably it's because Erlangs tuples are both tuples AND polymorphic vectors. BR, Zvi -- View this message in context: http://www.nabble.com/Vector-instructions-tp16468138p16532464.html Sent from the Erlang Questions mailing list archive at Nabble.com. From saleyn@REDACTED Mon Apr 7 05:40:05 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 06 Apr 2008 23:40:05 -0400 Subject: [erlang-questions] : : gen_sctp:connect/5 change In-Reply-To: <20080403130436.GA2216@erix.ericsson.se> References: <20080402131658.GA12127@erix.ericsson.se> <47F43187.1010907@gmail.com> <20080403083845.GA30303@erix.ericsson.se> <47F4BB0B.4030908@gmail.com> <20080403130436.GA2216@erix.ericsson.se> Message-ID: <47F99795.104@gmail.com> Raimo Niskanen wrote: > Very true but, if it is allowed by SCTP someone will want to do it. > Maybe we can just disallow connect on a listen socket and > call it a known limitation. Possibly. >>> The code for active mode I have now does >>> receive {sctp,S,IP,Port,,..} if the socket is in active mode >>> so it is a selective receive, which would work better in this >>> scenario of competing incoming/outgoing #sctp_assoc_change{}, >>> but this keeps the connect blocking. An option for non-blocking >>> connect is missing, or if the socket is active the connect >>> should be non-blocking and the caller should handle >>> the comm_up message... >> Perhaps this analysis could be done in the driver code and split the >> result in two messages #sctp_assoc_up{} and #sctp_assoc_change{}? > > Sorry, you will have to elaborate. What should be analyzed > and what should be split? I meant to have a check in the driver for #sctp_assoc_change{state=comm_up} message and turn this record to #sctp_assoc_up{} with the same field names/values as #sctp_assoc_change{} leaving the later to represent all other states but comm_up. >> The recommendation above on introducing #sctp_assoc_up{} would address >> this issue, but would "break" the existing 1-to-1 mapping of SCTP C >> structs to alike Erlang records. The later may be a worthwhile sacrifice. >> > > Explain more. Please let me know if the statement above is still unclear. Serge From ayman_abolfadl@REDACTED Mon Apr 7 07:58:03 2008 From: ayman_abolfadl@REDACTED (ayman abolfadl) Date: Sun, 6 Apr 2008 22:58:03 -0700 (PDT) Subject: [erlang-questions] error in file processing Message-ID: <629779.79737.qm@web53109.mail.re2.yahoo.com> I have created a module that parses a file and returns it's lines using io:get_line/2 and string:tokens/2 functions then i recieve this error when i get to process a 63MB file which has 1 million lines. Could anyone suggest a proper way to open the file and process it so not to receive the following report. ./file_token_server.erl:none: internal error in parse_module; crash reason: {system_limit,[{erlang,spawn, [erlang, apply, [#Fun,[]]]}, {erlang,spawn,1}, {epp,open,3}, {epp,parse_file,4}, {compile,parse_module,1}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}]} =ERROR REPORT==== 7-Apr-2008::07:52:09 === Too many processes error Thanks, Ayman Abolfadl --------------------------------- You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Mon Apr 7 09:22:57 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 07 Apr 2008 09:22:57 +0200 Subject: [erlang-questions] Vector instructions In-Reply-To: <16529946.post@talk.nabble.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> Message-ID: <47F9CBD1.1000309@ericsson.com> In the U.S. there is a phrase, "Monday morning quarterback", referring to all those who watched the football games on Sunday, and come Monday are ready to tell the world how they would have played the game differently. Zvi skrev: > > This is the same kind of mistakes, like 2 bad design decisions > made in Erlang: > 1. "Ohh, record looks just like a tuple!", so let's throw in > some syntactic sugar for this, instead of real immutable > structs/dictionaries. At the time when records were introduced, there were no available type tags in the virtual machine, so adding real structs would have involved major redesign of the VM. There /was/, however, a real need for some sort of "struct" support. The design was subject to intense debate, but just about all agreed that the final result would be a compromise. (The tag scheme was changed later, so nowadays it would be possible to introduce a new type.) > 2. "Ohh, string looks just like a list of integers!", so let's > throw in some syntactic sugar for this, instead of > implementing real Unicode-aware immutable string datatype. In keeping with the philosophy to try to keep the language as small as possible in the beginning, using lists of integers as strings was perfectly logical and, as RoK has pointed out several times, actually quite a good strategy in many respects. Later, a 'binary' data type was introduced in order to handle protocol packets etc as chunks of bytes. While binaries could have replaced lists for string representation, it would have given worse characteristics in almost every respect except memory usage and substring by position. And there really was very little demand for Unicode when Erlang was first designed. Indeed, the earliest documented use of the term "Unicode" was in December 1987 (according to unicode.org). Back then, the subject of intense debate in the Erlang camp (according to Joe's History of Erlang) was how to get concurrency right. I think they had their priorities straight. The Unicode standard version 1.0 was printed in June 1992. At that time, the Erlang language was considered fairly stable. In 1993, Distributed Erlang was implemented by Klacke, and Tim Berners-Lee wrote the first HTML draft. The term "web application" wasn't yet popular, even though TBL had described "a multiply connected 'web'" in an information management proposal back in 1989 (http://www.w3.org/History/1989/proposal.html), and the first "WorldWideWeb" browser was demonstrated at the end of 1990. The first non-European web server was set up in Stanford in 1992. Dial-up Internet access started appearing in 1994. Java first saw the light of day in 1995: "Java, in its JDK 1.0 incarnation, had the beginnings of international support, because a Java char is stored as a Unicode character. But that was all. You couldn't enter or display non-Latin characters, and there were no facilities for language-sensitive formatting, sorting, and so on." (http://www-128.ibm.com/developerworks/java/library/j-sun-ibm-java.html) More or less complete support for Unicode didn't come until JDK 2.0 in 1998, which was also the year when XML 1.0 came out. It was also the year when the AXD 301 was released, one of the biggest commercial product development projects ever undertaken using a functional language. After 1998, Erlang had millions of lines of legacy code to consider, so any major changes to the language had to be considered with utmost care. One may also note that back in those days, string handling was not an important factor in telecoms protocol design. All protocols were byte coded, and work on a good bit syntax had higher priority than improving string and regexp support. BR, Ulf W From bengt.kleberg@REDACTED Mon Apr 7 09:24:33 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 07 Apr 2008 09:24:33 +0200 Subject: [erlang-questions] error in file processing In-Reply-To: <629779.79737.qm@web53109.mail.re2.yahoo.com> References: <629779.79737.qm@web53109.mail.re2.yahoo.com> Message-ID: <1207553074.5433.4.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Without having seen your code I can only suggest that you start erlang with a higher value for the maximum number of processes. From the documentation (http://erlang.org/doc/man/erl.html): +P Number Sets the maximum number of concurrent processes for this system. Number must be in the range 16..134217727. Default is 32768. bengt On Sun, 2008-04-06 at 22:58 -0700, ayman abolfadl wrote: > I have created a module that parses a file and returns it's lines > using io:get_line/2 and > string:tokens/2 functions then i recieve this error when i get to > process a 63MB file which has 1 million lines. > > Could anyone suggest a proper way to open the file and process it so > not to receive the following report. > > ./file_token_server.erl:none: internal error in parse_module; > crash reason: {system_limit,[{erlang,spawn, > [erlang, > apply, > [#Fun,[]]]}, > {erlang,spawn,1}, > {epp,open,3}, > {epp,parse_file,4}, > {compile,parse_module,1}, > > {compile,'-internal_comp/4-anonymous-1-',2}, > {compile,fold_comp,3}, > {compile,internal_comp,4}]} > =ERROR REPORT==== 7-Apr-2008::07:52:09 === > Too many processes > error > > Thanks, > > Ayman Abolfadl > > ______________________________________________________________________ > You rock. That's why Blockbuster's offering you one month of > Blockbuster Total Access, No Cost. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From alexander.lamb@REDACTED Mon Apr 7 10:19:47 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Mon, 7 Apr 2008 10:19:47 +0200 Subject: [erlang-questions] Sets from list then to list? Message-ID: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> Hello (list:-) Using list comprehension, I am building a list of tuples that I want unique and sorted. Is this a correct way of doing it: Result = sets:to_list(sets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- MyList])) Then sort the Result. The alternative would be to use one of the lists functions to copy elements into a new list and testing first at each insert if the element is already present. What is best? Thanks, Alex -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From kostis@REDACTED Mon Apr 7 10:51:46 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 07 Apr 2008 11:51:46 +0300 Subject: [erlang-questions] Sets from list then to list? In-Reply-To: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> References: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> Message-ID: <47F9E0A2.2080902@cs.ntua.gr> Alexander Lamb wrote: > Hello (list:-) > > Using list comprehension, I am building a list of tuples that I want > unique and sorted. > > Is this a correct way of doing it: > > Result = sets:to_list(sets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- > MyList])) > > Then sort the Result. > > The alternative would be to use one of the lists functions to copy > elements into a new list and testing first at each insert if the > element is already present. > > What is best? None of the two. Check out lists:usort/1. 1> lists:usort([{1,2},{1,3},{0,1},{1,2}]). [{0,1},{1,2},{1,3}] Kostis From vychodil.hynek@REDACTED Mon Apr 7 11:04:15 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 7 Apr 2008 11:04:15 +0200 Subject: [erlang-questions] Sets from list then to list? In-Reply-To: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> References: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> Message-ID: <4d08db370804070204q1a963d90tc33d39c00ce87b90@mail.gmail.com> Result = ordsets:to_list(ordsets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- MyList])) Up to some size it should be faster than sets and than lists:sort Other possible way is: Result = ordsets:to_list( lists:foldl( fun(S, {_X,_Y,A,_Z,B})-> ordsets:add_element(S, {A, B}); (S, _ )-> S end, ordsets:new(), MyList ) ) Benchmark it for your purpose. On Mon, Apr 7, 2008 at 10:19 AM, Alexander Lamb wrote: > Hello (list:-) > > Using list comprehension, I am building a list of tuples that I want > unique and sorted. > > Is this a correct way of doing it: > > Result = sets:to_list(sets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- > MyList])) > > Then sort the Result. > > The alternative would be to use one of the lists functions to copy > elements into a new list and testing first at each insert if the > element is already present. > > What is best? > > Thanks, > > Alex > -- > Alexander Lamb > Founding Associate > RODANOTECH S?rl > > 4 ch. de la Tour de Champel > 1206 Geneva > Switzerland > > Tel: 022 347 77 37 > Fax: 022 347 77 38 > > http://www.rodanotech.ch > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Mon Apr 7 11:07:16 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 7 Apr 2008 11:07:16 +0200 Subject: [erlang-questions] Sets from list then to list? In-Reply-To: <47F9E0A2.2080902@cs.ntua.gr> References: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> <47F9E0A2.2080902@cs.ntua.gr> Message-ID: <4d08db370804070207m71e1f646s3a26ee653af64648@mail.gmail.com> On Mon, Apr 7, 2008 at 10:51 AM, Kostis Sagonas wrote: > Alexander Lamb wrote: > > Hello (list:-) > > > > Using list comprehension, I am building a list of tuples that I want > > unique and sorted. > > > > Is this a correct way of doing it: > > > > Result = sets:to_list(sets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- > > MyList])) > > > > Then sort the Result. > > > > The alternative would be to use one of the lists functions to copy > > elements into a new list and testing first at each insert if the > > element is already present. > > > > What is best? > > None of the two. Check out lists:usort/1. > > 1> lists:usort([{1,2},{1,3},{0,1},{1,2}]). > [{0,1},{1,2},{1,3}] > Yup, faster one :-) > > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.lamb@REDACTED Mon Apr 7 11:18:04 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Mon, 7 Apr 2008 11:18:04 +0200 Subject: [erlang-questions] Sets from list then to list? In-Reply-To: <4d08db370804070207m71e1f646s3a26ee653af64648@mail.gmail.com> References: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> <47F9E0A2.2080902@cs.ntua.gr> <4d08db370804070207m71e1f646s3a26ee653af64648@mail.gmail.com> Message-ID: Thanks, usort(Fun, List) is the solution! (I need to sort according to my own algorithm) Alex Le 7 avr. 08 ? 11:07, Hynek Vychodil a ?crit : > > > On Mon, Apr 7, 2008 at 10:51 AM, Kostis Sagonas > wrote: > Alexander Lamb wrote: > > Hello (list:-) > > > > Using list comprehension, I am building a list of tuples that I want > > unique and sorted. > > > > Is this a correct way of doing it: > > > > Result = sets:to_list(sets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- > > MyList])) > > > > Then sort the Result. > > > > The alternative would be to use one of the lists functions to copy > > elements into a new list and testing first at each insert if the > > element is already present. > > > > What is best? > > None of the two. Check out lists:usort/1. > > 1> lists:usort([{1,2},{1,3},{0,1},{1,2}]). > [{0,1},{1,2},{1,3}] > > Yup, faster one :-) > > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > --Hynek (Pichi) Vychodil From alexander.lamb@REDACTED Mon Apr 7 11:57:35 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Mon, 7 Apr 2008 11:57:35 +0200 Subject: [erlang-questions] Sets from list then to list? In-Reply-To: References: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> <47F9E0A2.2080902@cs.ntua.gr> <4d08db370804070207m71e1f646s3a26ee653af64648@mail.gmail.com> Message-ID: <863C83B0-C2CE-469A-BF6C-A33188A0470D@rodanotech.ch> Well, spoke to fast. usort/1 works fine, but when I provide my own function, it doesn't remove the duplicates. It looks like this is because my sort function can only return true or false. What should it return to usort/2 removes correctly duplicates. Thanks, Alex Le 7 avr. 08 ? 11:18, Alexander Lamb a ?crit : > Thanks, usort(Fun, List) is the solution! > > (I need to sort according to my own algorithm) > > Alex > > Le 7 avr. 08 ? 11:07, Hynek Vychodil a ?crit : >> >> >> On Mon, Apr 7, 2008 at 10:51 AM, Kostis Sagonas >> wrote: >> Alexander Lamb wrote: >>> Hello (list:-) >>> >>> Using list comprehension, I am building a list of tuples that I want >>> unique and sorted. >>> >>> Is this a correct way of doing it: >>> >>> Result = sets:to_list(sets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- >>> MyList])) >>> >>> Then sort the Result. >>> >>> The alternative would be to use one of the lists functions to copy >>> elements into a new list and testing first at each insert if the >>> element is already present. >>> >>> What is best? >> >> None of the two. Check out lists:usort/1. >> >> 1> lists:usort([{1,2},{1,3},{0,1},{1,2}]). >> [{0,1},{1,2},{1,3}] >> >> Yup, faster one :-) >> >> >> Kostis >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> >> -- >> --Hynek (Pichi) Vychodil > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From per.gustafsson@REDACTED Mon Apr 7 12:36:19 2008 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Mon, 07 Apr 2008 12:36:19 +0200 Subject: [erlang-questions] Sets from list then to list? In-Reply-To: <863C83B0-C2CE-469A-BF6C-A33188A0470D@rodanotech.ch> References: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> <47F9E0A2.2080902@cs.ntua.gr> <4d08db370804070207m71e1f646s3a26ee653af64648@mail.gmail.com> <863C83B0-C2CE-469A-BF6C-A33188A0470D@rodanotech.ch> Message-ID: <47F9F923.1090506@it.uu.se> Alexander Lamb wrote: > Well, spoke to fast. usort/1 works fine, but when I provide my own > function, it doesn't remove the duplicates. > It looks like this is because my sort function can only return true or > false. What should it return to usort/2 removes correctly duplicates. > > Thanks, > > Alex > It seems (from the source code) that it should be a function F which returns true for both F(X,Y) and F(Y,X) if X is equal to Y. Per From alexander.lamb@REDACTED Mon Apr 7 12:35:13 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Mon, 7 Apr 2008 12:35:13 +0200 Subject: [erlang-questions] Sets from list then to list? (found it) In-Reply-To: <863C83B0-C2CE-469A-BF6C-A33188A0470D@rodanotech.ch> References: <7AE697D7-01D7-44C1-B691-90F3D17E27EC@rodanotech.ch> <47F9E0A2.2080902@cs.ntua.gr> <4d08db370804070207m71e1f646s3a26ee653af64648@mail.gmail.com> <863C83B0-C2CE-469A-BF6C-A33188A0470D@rodanotech.ch> Message-ID: <47733606-86BE-4885-BA71-C7A99ECD0E86@rodanotech.ch> Sorry for replying too fast. I look into the code of usort and found that to be equal you need A < B and B < A to be true (which was not the case in my function...) THanks, Alex Le 7 avr. 08 ? 11:57, Alexander Lamb a ?crit : > Well, spoke to fast. usort/1 works fine, but when I provide my own > function, it doesn't remove the duplicates. > It looks like this is because my sort function can only return true or > false. What should it return to usort/2 removes correctly duplicates. > > Thanks, > > Alex > > Le 7 avr. 08 ? 11:18, Alexander Lamb a ?crit : >> Thanks, usort(Fun, List) is the solution! >> >> (I need to sort according to my own algorithm) >> >> Alex >> >> Le 7 avr. 08 ? 11:07, Hynek Vychodil a ?crit : >>> >>> >>> On Mon, Apr 7, 2008 at 10:51 AM, Kostis Sagonas >>> wrote: >>> Alexander Lamb wrote: >>>> Hello (list:-) >>>> >>>> Using list comprehension, I am building a list of tuples that I >>>> want >>>> unique and sorted. >>>> >>>> Is this a correct way of doing it: >>>> >>>> Result = sets:to_list(sets:from_list([ {A,B} || {_X,_Y,A,_Z,B} <- >>>> MyList])) >>>> >>>> Then sort the Result. >>>> >>>> The alternative would be to use one of the lists functions to copy >>>> elements into a new list and testing first at each insert if the >>>> element is already present. >>>> >>>> What is best? >>> >>> None of the two. Check out lists:usort/1. >>> >>> 1> lists:usort([{1,2},{1,3},{0,1},{1,2}]). >>> [{0,1},{1,2},{1,3}] >>> >>> Yup, faster one :-) >>> >>> >>> Kostis >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> -- >>> --Hynek (Pichi) Vychodil >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rtrlists@REDACTED Mon Apr 7 12:44:55 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 7 Apr 2008 11:44:55 +0100 Subject: [erlang-questions] Using mod_esi:deliver() ? Message-ID: <6a3ae47e0804070344w5b3f7e74p871d99c23fa7ea00@mail.gmail.com> Hi, I'm trying out the httpd of inets using the Erl Scheme Interface in R12B. But I don't quite understand how the mod_esi:deliver() mechanism works. I appear to get no response back from the httpd when using it. My trivial test module is this: -module(test01). -export([start/0, stop/1, test1/2, test2/3]). start() -> case application:get_application(inets) of {ok, inets} -> ok; undefined -> ok = inets:start() end, {ok, Pid} = inets:start(httpd, [ {port, 8989}, {server_name,"httpd_test"}, {server_root,"."}, {document_root,"."}, {bind_address, "localhost"}, {modules, [mod_log, mod_esi]}, {log_format, common}, {error_log, "error.log"}, {security_log, "security.log"}, {transfer_log, "transfer.log"}, {erl_script_alias, {"/example", [test01]}}, {erl_script_nocache, true} ]), Pid. stop(Pid) -> ok = inets:stop(httpd, Pid). test1(Env, Input) -> io_lib:format("Content-Type: text/plain\r\n\r\nTEST1\r\n\r\n~p\r\n\r\n~p\r\n", [Env, Input]). test2(SessionID, Env, Input) -> mod_esi:deliver(SessionID, "Content-Type: text/plain\r\n\r\n"), mod_esi:deliver(SessionID, io_lib:format("TEST2\r\n\r\n~p\r\n\r\n~p\r\n", [Env, Input])). And http://localhost:8989/example/test01:test1?BlaBla gives me the anticipated response, but http://localhost:8989/example/test01:test2?SomethingElse does not return any response at all. Both GETs are shown in the transfer log, no errors as far as I can see. Do I need to deliver some kind of EOF? Thanks for all pointers, Robby From ttmrichter@REDACTED Mon Apr 7 14:09:35 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Mon, 07 Apr 2008 20:09:35 +0800 Subject: [erlang-questions] URL parsing and construction Message-ID: <1207570175.6110.15.camel@isolde> I've tried googling for this right down to site searches, but I can't seen to find any (current) library for ripping apart URLs and reassembling them for Erlang. I know about the http module, but it doesn't fit what I need to do, and I know about www_tools, but it doesn't work with the latest version of Erlang/OTP. Am I overlooking something obvious (or inobvious) in the libraries or is this a hole I have to fill myself? -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) I'm not schooled in the science of human factors, but I suspect surprise is not an element of a robust user interface. (Chip Rosenthal) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From harveyd@REDACTED Mon Apr 7 14:30:17 2008 From: harveyd@REDACTED (Dale Harvey) Date: Mon, 7 Apr 2008 13:30:17 +0100 Subject: [erlang-questions] URL parsing and construction In-Reply-To: <1207570175.6110.15.camel@isolde> References: <1207570175.6110.15.camel@isolde> Message-ID: yaws provides functions for parsing urls http://yaws.hyber.org/ On 07/04/2008, Michael T. Richter wrote: > > I've tried googling for this right down to site searches, but I can't > seen to find any (current) library for ripping apart URLs and reassembling > them for Erlang. I know about the http module, but it doesn't fit what I > need to do, and I know about www_tools, but it doesn't work with the latest > version of Erlang/OTP. Am I overlooking something obvious (or inobvious) in > the libraries or is this a hole I have to fill myself? > > -- > *Michael T. Richter* (*GoogleTalk:* > ttmrichter@REDACTED) > *I'm not schooled in the science of human factors, but I suspect surprise > is not an element of a robust user interface. (Chip Rosenthal)* > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- * http://hypernumbers.com * http://arandomurl.com/ * http://www.flickr.com/photos/daleharvey/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Mon Apr 7 14:38:58 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 7 Apr 2008 13:38:58 +0100 Subject: [erlang-questions] Using mod_esi:deliver() ? In-Reply-To: <6a3ae47e0804070344w5b3f7e74p871d99c23fa7ea00@mail.gmail.com> References: <6a3ae47e0804070344w5b3f7e74p871d99c23fa7ea00@mail.gmail.com> Message-ID: <6a3ae47e0804070538y5a7dabe0i58129c30b28bb540@mail.gmail.com> Found a previous message http://www.erlang.org/pipermail/erlang-questions/2002-November/006058.html But even adding a mod_esi:deliver(SessionID, "") at the end, does not change anything. Still getting no response. On the off chance, I also added an erl_script_timeout of 1 second, still same result. Does anyone have a working example that uses mod_esi:deliver, that I could study? Thanks, Robby PS This is R12B on Windows and my browser is IE6. From rtrlists@REDACTED Mon Apr 7 15:24:26 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 7 Apr 2008 14:24:26 +0100 Subject: [erlang-questions] Using mod_esi:deliver() ? In-Reply-To: <5c6ec331-6d55-4013-84bc-146cbdc745c2@n1g2000prb.googlegroups.com> References: <6a3ae47e0804070344w5b3f7e74p871d99c23fa7ea00@mail.gmail.com> <6a3ae47e0804070538y5a7dabe0i58129c30b28bb540@mail.gmail.com> <5c6ec331-6d55-4013-84bc-146cbdc745c2@n1g2000prb.googlegroups.com> Message-ID: <6a3ae47e0804070624x3b3a22fdyd6f3dbdfbf3950ac@mail.gmail.com> On 4/7/08, Ky?sti Ranto wrote: > Accoring to the documentation, the second argument of deliver/2 can be > either of type string() or io_list(). I don't know about the latter > but you can convert your parameter to string() by calling > lists:flatten(), i.e. > > lists:flatten(io_lib:format(...)) Ha! That did it, mod_esi:deliver() works with flat strings. Thanks, Robby From rtrlists@REDACTED Mon Apr 7 16:56:29 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 7 Apr 2008 15:56:29 +0100 Subject: [erlang-questions] Using mod_esi:deliver() ? In-Reply-To: <6a3ae47e0804070624x3b3a22fdyd6f3dbdfbf3950ac@mail.gmail.com> References: <6a3ae47e0804070344w5b3f7e74p871d99c23fa7ea00@mail.gmail.com> <6a3ae47e0804070538y5a7dabe0i58129c30b28bb540@mail.gmail.com> <5c6ec331-6d55-4013-84bc-146cbdc745c2@n1g2000prb.googlegroups.com> <6a3ae47e0804070624x3b3a22fdyd6f3dbdfbf3950ac@mail.gmail.com> Message-ID: <6a3ae47e0804070756m22f1a640q43652811d1237f74@mail.gmail.com> I poked around the sources of httpd a bit (R12B). and found http_transport:send/3 : %%------------------------------------------------------------------------- %% send(RequestOrSocketType, Socket, Message) -> ok | {error, Reason} %% SocketType = ip_comm | {ssl, _} %% Socket = socket() %% Message = list() | binary() %% Description: Sends a packet on a socket, using either gen_tcp or ssl. %%------------------------------------------------------------------------- send(ip_comm, Socket, Message) -> gen_tcp:send(Socket, Message); send({ssl, _}, Socket, Message) -> ssl:send(Socket, Message). There's a small issue here, in that gen_tcp:send/2 takes a [char()] or binary() as its second argument, whereas ssl:send/2 takes iolist() or binary(). I think this is what causes iolist() arguments to mod_esi:deliver/2 to not work under the ip_comm connection type. Robby From james.hague@REDACTED Mon Apr 7 16:59:15 2008 From: james.hague@REDACTED (James Hague) Date: Mon, 7 Apr 2008 09:59:15 -0500 Subject: [erlang-questions] Vector instructions In-Reply-To: <16529946.post@talk.nabble.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> Message-ID: On Sun, Apr 6, 2008 at 4:16 PM, Zvi wrote: > > With generic tuples it's impossible to implement efficient SIMD operations. I would hesitate to say "impossible" :) Efficiency would clearly be better than what we have now, though not the pinnacle of performance (and is anything in Erlang the pinnacle of performance?). I can certainly see the quirks in my proposal, and I don't ever expect to see it in Erlang. But I don't know if adding yet another basic data type to Erlang is the way to go. > Also there is many undefined/confusing behaiviors, when elements of tuple > are not numeric. Not any more than you have with "1 + ok". From bob@REDACTED Mon Apr 7 16:59:48 2008 From: bob@REDACTED (Bob Ippolito) Date: Mon, 7 Apr 2008 07:59:48 -0700 Subject: [erlang-questions] URL parsing and construction In-Reply-To: <1207570175.6110.15.camel@isolde> References: <1207570175.6110.15.camel@isolde> Message-ID: <6a36e7290804070759m8334c8o174d78a8e2add602@mail.gmail.com> There's some functions in mochiweb's mochiweb_util module, see urlunsplit/1 and unquote/1 http://code.google.com/p/mochiweb/ http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl 2008/4/7 Michael T. Richter : > > I've tried googling for this right down to site searches, but I can't seen > to find any (current) library for ripping apart URLs and reassembling them > for Erlang. I know about the http module, but it doesn't fit what I need to > do, and I know about www_tools, but it doesn't work with the latest version > of Erlang/OTP. Am I overlooking something obvious (or inobvious) in the > libraries or is this a hole I have to fill myself? > > > -- > Michael T. Richter (GoogleTalk: > ttmrichter@REDACTED) > I'm not schooled in the science of human factors, but I suspect surprise is > not an element of a robust user interface. (Chip Rosenthal) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bob@REDACTED Mon Apr 7 17:00:34 2008 From: bob@REDACTED (Bob Ippolito) Date: Mon, 7 Apr 2008 08:00:34 -0700 Subject: [erlang-questions] URL parsing and construction In-Reply-To: <6a36e7290804070759m8334c8o174d78a8e2add602@mail.gmail.com> References: <1207570175.6110.15.camel@isolde> <6a36e7290804070759m8334c8o174d78a8e2add602@mail.gmail.com> Message-ID: <6a36e7290804070800t7086e9ddj9886c1a096acb142@mail.gmail.com> Er, and quote/1 and urlsplit/1 of course. On Mon, Apr 7, 2008 at 7:59 AM, Bob Ippolito wrote: > There's some functions in mochiweb's mochiweb_util module, see > urlunsplit/1 and unquote/1 > > http://code.google.com/p/mochiweb/ > http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl > > 2008/4/7 Michael T. Richter : > > > > > > I've tried googling for this right down to site searches, but I can't seen > > to find any (current) library for ripping apart URLs and reassembling them > > for Erlang. I know about the http module, but it doesn't fit what I need to > > do, and I know about www_tools, but it doesn't work with the latest version > > of Erlang/OTP. Am I overlooking something obvious (or inobvious) in the > > libraries or is this a hole I have to fill myself? > > > > > > -- > > Michael T. Richter (GoogleTalk: > > ttmrichter@REDACTED) > > I'm not schooled in the science of human factors, but I suspect surprise is > > not an element of a robust user interface. (Chip Rosenthal) > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From masterofquestions@REDACTED Mon Apr 7 20:54:44 2008 From: masterofquestions@REDACTED (db) Date: Mon, 7 Apr 2008 14:54:44 -0400 Subject: [erlang-questions] noob gen_leader question Message-ID: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> I have looked at gdict example. Storing values into global dict goes to the leader and lookup is done by workers on the local gen_leader instance. It seems gen_leader works by having worker pull task rather than master push task. Am I right? Thank you, -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Mon Apr 7 22:46:19 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 07 Apr 2008 22:46:19 +0200 Subject: [erlang-questions] noob gen_leader question In-Reply-To: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> References: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> Message-ID: <47FA881B.2060304@ericsson.com> db skrev: > I have looked at gdict example. Storing values into global dict goes to > the leader and lookup is done by workers on the local gen_leader instance. > > It seems gen_leader works by having worker pull task rather than master > push task. Am I right? No, the leader pushes the whole dictionary when elected, and then each update function, as all updates go through the leader process. So, for example (expanding the macro definition): -define(store(Dict,Expr,Legend), gen_leader:leader_call(Dict, {store, fun(D) -> Expr end})). -define(lookup(Dict, Expr, Legend), gen_leader:call(Dict, {lookup, fun(D) -> Expr end})). %% dict functions that modify state: append(Key, Value, Dict) -> gen_leader:leader_call( Dict, {store, fun(D) -> dict:append(Key,Value,D) end})). then, in the callback module: handle_leader_call({store,F}, _From, Dict, _E) -> NewDict = F(Dict), {reply, ok, {store, F}, NewDict}; ^^^^ <- this is the push and here's where the workers receive it: from_leader({store,F}, Dict, _E) -> NewDict = F(Dict), {ok, NewDict}. BR, Ulf W From fig@REDACTED Tue Apr 8 00:44:21 2008 From: fig@REDACTED (Michael FIG) Date: Mon, 7 Apr 2008 16:44:21 -0600 (CST) Subject: [erlang-questions] Second try: .appup code_change timeout error In-Reply-To: <8270772.22291206380848830.JavaMail.root@zimbra> Message-ID: <26726923.50651207608261377.JavaMail.root@zimbra> Hi all, I wrote this message a while ago, but haven't received any answer. Does anybody have a workaround for this situation? Thanks, -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 ----- Forwarded Message ----- From: "Michael FIG" To: "erlang list" Sent: Monday, March 24, 2008 11:47:28 AM (GMT-0600) America/Guatemala Subject: .appup code_change timeout error Hi, all... I'm using a .appup file that uses an instruction like the following: {update, mymod, {advanced, []}} Unfortunately, running the code_change function takes longer than 5 seconds (it modifies many on-disk files), which causes the upgrade process to fail with a timeout error. I looked through the documentation, but the only specifiable update timeout is for the suspend, not for the code_change. (I tried this: {update, mymod, 60000, {advanced, []}, brutal_purge, brutal_purge, []} but it failed with the same timeout.) Is there a way I can increase the time that the code_change can run, or are there workarounds that other of you have used for this situation? Thanks, -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From jeffm@REDACTED Tue Apr 8 01:38:26 2008 From: jeffm@REDACTED (jm) Date: Tue, 08 Apr 2008 09:38:26 +1000 Subject: [erlang-questions] Vector instructions In-Reply-To: References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> Message-ID: <47FAB072.6020403@ghostgun.com> James Hague wrote: > On Sun, Apr 6, 2008 at 4:16 PM, Zvi wrote: >> With generic tuples it's impossible to implement efficient SIMD operations. > > I would hesitate to say "impossible" :) Efficiency would clearly be > better than what we have now, though not the pinnacle of performance > (and is anything in Erlang the pinnacle of performance?). How about, %% <3.1415, 1.0> V1 = <<16#40, 16#49, 16#0E, 16#56, 16#3F, 16#80, 16#00, 16#00>>, %% <1.0, 1.6180> V2 = <<16#3F, 16#80, 16#00, 16#00, 16#3F, 16#CF, 16#1A, 16#9F>>, vec:add(single, V1, V2). obviously V1 and V2 would normally be created with helper functions. The advantage of using binaries would be that you would have to add a new type to Erlang and could more easily do DSP functionality on an input stream, eg GSM codecs using for VOIP, before having to optimise with C or another lower language. The first parameter to vec:add/3 would be one of the atoms: single, double, octet, short, long, or longlong. What about matricies? list of binaries? Jeff. > I can certainly see the quirks in my proposal, and I don't ever expect > to see it in Erlang. But I don't know if adding yet another basic > data type to Erlang is the way to go. > >> Also there is many undefined/confusing behaiviors, when elements of tuple >> are not numeric. > > Not any more than you have with "1 + ok". > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From pfisher@REDACTED Tue Apr 8 04:37:00 2008 From: pfisher@REDACTED (Paul Fisher) Date: Mon, 07 Apr 2008 21:37:00 -0500 Subject: [erlang-questions] Excessive futex overhead on driver_async linked-in driver Message-ID: <1207622220.6070.147.camel@pfisher-laptop> I'm working with linked-in drivers which perform low-level text processing on files (each ~600k in size) returning a small list of tuples via driver_output_term(). I'm seeing what seems like an excessive amount of futex system call overhead when async threads are started with the emulator versus starting no async threads. Ultimately work that should scale well as async does not because of the futex overhead. The workload is basically 96 processes, each submitting a batch of 34 file processing port commands submitted all in one shot, and then receiving the list of tuples sent back for each file as the processing completes in the driver. Each file is processed as a separate a port command, which is processed via driver_async() with only term formatting and memory deallocation occurring in the ready_async() callback. Only 2 x Schedulers processes are run at a time, with each process with its own port instance. Can someone familiar with the runtime, give a description of the synchronization strategy that is used with SMP runtime with port drivers performing work via driver_async()? Since typical futexes supporting mutexes only trap to a system call when there is contention, I am assuming that there is something else going on here and guidance would be appreciated. Dual core 1.8 Ghz 32-bit laptop system: $ uname -a Linux pfisher-laptop 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux $ strace -f -o /tmp/strace.s2.a0.out -c erl +S 2 -sname <...> % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 35.34 4.950806 529 9367 586 futex 19.88 2.784180 3175 877 205 read 19.82 2.776174 277617 10 1 select 19.42 2.720171 680043 4 waitpid 3.97 0.556457 3 215328 pread64 1.45 0.202802 165 1227 poll $ strace -f -o /tmp/strace.s2.a2.out -c erl +S 2 +A 2 -sname <...> % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 30.99 6.870370 107 64256 5354 futex 15.06 3.339543 509 6561 3090 read 15.01 3.328208 332821 10 1 select 14.20 3.148197 787049 4 waitpid 12.79 2.835251 696 4073 1 poll 11.36 2.518787 10 256461 pread64 Quad core 2.4 Ghz 64-bit system: $ uname -a Linux cluster-14 2.6.18-6-amd64 #1 SMP Sun Feb 10 17:50:19 UTC 2008 x86_64 GNU/Linux $ strace -f -o /tmp/strace.s4.a4.out -c erl +S 4 +A 4 -sname <...> % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 39.90 23.980296 107 223247 33938 futex 12.85 7.721196 2316 3334 1346 read 12.84 7.720482 142972 54 1 select 12.62 7.588478 758848 10 3 wait4 11.38 6.841975 2515 2721 1 poll 8.12 4.882636 436 11201 3084 open 1.88 1.129441 2 510336 pread -- paul From ok@REDACTED Tue Apr 8 04:40:23 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 8 Apr 2008 14:40:23 +1200 Subject: [erlang-questions] Vector instructions In-Reply-To: <4AAF8F43-1F1D-4DBD-BD0A-759252BAC6D8@infoathand.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <43C63741-95D4-4CD9-8570-69DDFA8F4DE3@cs.otago.ac.nz> <4AAF8F43-1F1D-4DBD-BD0A-759252BAC6D8@infoathand.com> Message-ID: On 7 Apr 2008, at 12:34 pm, Andrew Whitehead wrote: > Hiya, > > Although I don't think you are really suggesting this, I am not only "not REALLY" suggesting it, I am not suggesting it to any degree whatsoever. > the fact that few languages have yet implemented Unicode properly is > of course no excuse to ignore the problem. Nor am I, nor could any competent reader for one moment imagine that I might be, suggesting that it is. On the contrary, I have been aware of Unicode issues since Unicode 1.0 came out and have made some specific proposals to the Prolog community about handling Unicode in Prolog. What I *AM* saying is that I am fed up to the back teeth with people who DON'T seem to have thought through the issues thoroughly suggesting that the designers of a tiny language designed for shipping BYTES around the net are somehow culpable for not coming up with a string design that has so far completely eluded the vastly larger and better funded C++, Java, Javascript, &c communities. For yet another comparison, look at SmartEiffel: CHARACTER is 8 bits, STRING is 8 bits, UNICODE_STRING elements are INTEGER_32 values, not characters, and Erlang already has more things you can do with a Unicode string. What I *AM* suggesting is that instead of slagging off Joe Armstrong & Co, people who want good Unicode support in Erlang should start writing code and/or EEPs and get it done themselves. > Using integer lists in place of explicitly marked strings was never > a good design decision. This is flat-out wrong. Remember Alan Perlis's "Epigrams in Programming", number 9: It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures. > It makes it impossible for functions to distinguish between strings > and other lists without walking through every element. This has nothing to do with the choice of lists as such and everything to do with the fact that Erlang is dynamically typed. In particular, this turned out to be one of the STRENGTHS of Erlang string support: iolists. We can build up complex texts using O(1) concatenation and then flatten in linear time to something flat if we want it. Now with Unicode, iolists turn out to be worth even more than just efficient concatenation. Think of a "string" as a sequence of "characters". Now what is a "character"? (From the viewpoint of a user.) It is *not* the same thing as a Unicode code point. The thing that the user expects to step over with a single Ctrl-F or Right Arrow keypress may well be represented by several Unicode code-points. Using lists means that we have a choice: we can represent a text as a list of Unicode codepoints, but we can ALSO represent a text as a list of things-the-user-thinks-of-as-characters, where each element might be a single code-point, or it might be a list of code-points. This second representation is more convenient for stepping over; far more convenient. But it is also easy to flatten when we've a need to. > Strings can be encapsulated of course, but this is just a workaround > for the fact that string constants are completely undistinguished, > and it means you have to unwrap them before using any of the built- > in string functions. This is in no way different from other data types in Erlang. When does {1,1} represent the pixel near the top left corner of a window, when does it represent the rational number 1 = 1/1, when does it represent a latitude/longitude pair, when does it represent the complex number 1+i, when does it represent "board 0, connector 0", &c. In *all* cases involving Erlang data, you as programmer have to KNOW what you are expecting. I will buy this as an argument for compile-time types. > How many times have developers had to explain why printed output is > showing up as a list of numbers? Do you mean developers OF Erlang or developers IN Erlang? If the first, the answer is "as many times as they have been asked by people who didn't bother to read the documentation thoroughly". If the second, the answer is "as many times as they have provided raw Erlang terms to non-developers." > How many hacks are there in the emulator in order to deal with > strings efficiently? Very few. > (I'm thinking of the binary representation of terms for example.) > Why can I tack atoms and floats and record values onto a list that > was created from a string constant, and then have io:write choke > halfway through printing it? Because Erlang has no compile-time types and you were careless. It's not a problem I've ever had in Prolog or Erlang. > > The only benefits of the current implementation are: > - There's less work required of the language designer. + There is far less for the language USER to remember; there is only one incrementally-constructible sequence type and only one set of function names to remember. If you don't think that's a problem, you've never found yourself unhappy with Scheme because STRING-LENGTH and STRING-APPEND are different functions from LENGTH and APPEND, and you've never found your program "choke halfway" because you forgot to call STRING->LIST or LIST->STRING at some point. And you have never found yourself hopping mad because there is some function that *is* available for lists but *isn't* available for strings so you have to do (list->string ... (string->list ...) ...) just to patch around this. > > - Since you can treat strings as lists, you get to reuse some of > your list processing functions. But really, the usefulness of this > is overrated. How often do you really need to reverse a string, Fairly often, actually. Tail recursive functions building a string commonly end by reversing it. > or repeat it some number of times, Fairly often, actually. In fact strings are almost the only lists I do that to. > or calculate the maximum character value.. How else would you decide whether all the characters - are BMP (maximum <= 65535) - are Latin 1 (maximum <= 255) - are ASCII (maximum <= 127) > at least with string-specific versions of the functions you need it > wouldn't be possible to corrupt your string. I've used Scheme enough to detest string-specific versions of functions. Since lists are immutable, it is impossible right now to corrupt a string. > > - It's easier to iterate through characters, for a narrow definition > of character. A Unicode-aware implementation should let you iterate > through either code points or composed characters. "composed character" is not in the Unicode glossary; I suspect you mean "combining character sequence". There is nothing about lists that prevents an Erlang unicode: library offering the facility of iterating over combining character sequences. > > > If Erlang strings were in fact lists of Unicode code points then the > situation might be more tenable, but they aren't, Precisely BECAUSE Erlang strings are nothing other than lists of numbers, there is nothing that stops you using Unicode code points in "string" data. We are agreed that Erlang needs good Unicode support. We are agreed that at the very least any places that limit "strings" to 8 bits should be relaxed. I hope we are agreed that library support for Unicode-aware operations can be at least prototyped without a special data type. Larceny's string representations are of course tuned for a language with mutable strings, which Erlang isn't. From ttmrichter@REDACTED Tue Apr 8 05:35:07 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Tue, 08 Apr 2008 11:35:07 +0800 Subject: [erlang-questions] URL parsing and construction In-Reply-To: References: <1207570175.6110.15.camel@isolde> Message-ID: <1207625708.6110.19.camel@isolde> On Mon, 2008-04-07 at 13:30 +0100, Dale Harvey wrote: > yaws provides functions for parsing urls I looked at it and it gave me the clues for writing my own. The yaws parser, however, can't cope with URLs of the form "://:@:/". Specifically it doesn't support user/password combinations. The code I wrote based on their parser handles it, but it's a bit obscenely large. I'm not sure how to make it smaller, but it works well enough for my purposes at this time. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) The only reason some people get lost in thought is because it's unfamiliar territory. (Paul Fix) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From nick@REDACTED Tue Apr 8 05:52:40 2008 From: nick@REDACTED (Nicholas Gerakines) Date: Mon, 7 Apr 2008 20:52:40 -0700 (PDT) Subject: [erlang-questions] URL parsing and construction Message-ID: <446033.79399.qm@web1014.biz.mail.sp1.yahoo.com> I'm surprised that no one has written a yecc parser for this. Any volunteers? I'd be *really* interested in one. # Nick Gerakines ----- Original Message ---- From: Michael T. Richter To: erlang-questions Sent: Monday, April 7, 2008 8:35:07 PM Subject: Re: [erlang-questions] URL parsing and construction On Mon, 2008-04-07 at 13:30 +0100, Dale Harvey wrote: yaws provides functions for parsing urls I looked at it and it gave me the clues for writing my own. The yaws parser, however, can't cope with URLs of the form "://:@:/". Specifically it doesn't support user/password combinations. The code I wrote based on their parser handles it, but it's a bit obscenely large. I'm not sure how to make it smaller, but it works well enough for my purposes at this time. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) The only reason some people get lost in thought is because it's unfamiliar territory. (Paul Fix) -----Inline Attachment Follows----- _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From cyberlync@REDACTED Tue Apr 8 06:57:40 2008 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 7 Apr 2008 21:57:40 -0700 Subject: [erlang-questions] URL parsing and construction In-Reply-To: <1207625708.6110.19.camel@isolde> References: <1207570175.6110.15.camel@isolde> <1207625708.6110.19.camel@isolde> Message-ID: There is also uri parsing app in erlware. You can get it for now by doing a git clone git://git.erlware.org/git/uri.git It probably provides what you need. 2008/4/7 Michael T. Richter : > > On Mon, 2008-04-07 at 13:30 +0100, Dale Harvey wrote: > > yaws provides functions for parsing urls > > I looked at it and it gave me the clues for writing my own. The yaws > parser, however, can't cope with URLs of the form > "://:@:/". Specifically it > doesn't support user/password combinations. > > The code I wrote based on their parser handles it, but it's a bit obscenely > large. I'm not sure how to make it smaller, but it works well enough for my > purposes at this time. > > > -- > Michael T. Richter (GoogleTalk: > ttmrichter@REDACTED) > The only reason some people get lost in thought is because it's unfamiliar > territory. (Paul Fix) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tony@REDACTED Tue Apr 8 06:12:02 2008 From: tony@REDACTED (Tony Rogvall) Date: Tue, 8 Apr 2008 06:12:02 +0200 Subject: [erlang-questions] Vector instructions In-Reply-To: <47FAB072.6020403@ghostgun.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> Message-ID: Hi! > > How about, > %% <3.1415, 1.0> > V1 = <<16#40, 16#49, 16#0E, 16#56, 16#3F, 16#80, 16#00, 16#00>>, > %% <1.0, 1.6180> > V2 = <<16#3F, 16#80, 16#00, 16#00, 16#3F, 16#CF, 16#1A, 16#9F>>, > vec:add(single, V1, V2). > This is a more promising start! Today floats are allocated as separate objects so there is no way to use SIMD instructions on tuple with floats anyway!!! > > obviously V1 and V2 would normally be created with helper functions. > The > advantage of using binaries would be that you would have to add a new > type to Erlang and could more easily do DSP functionality on an input > stream, eg GSM codecs using for VOIP, before having to optimise with C > or another lower language. The first parameter to vec:add/3 would be > one > of the atoms: single, double, octet, short, long, or longlong. > > What about matricies? list of binaries? > I suggest first to implement the operation(s) you showed, possibly adding alignment support to the allocation of the vectors since many SIMD instructions operates best when given 16 bytes aligned pointers. Rough code ahead ;-) Future binary comprehension could use an updated syntax to handle this in a neat way. [ <> || <> <- V1 ; <> <- V2 ] Note that the expression X+Y must have a special treat and that ; in this comprehension expression means "parallel". This would basically be compiled to vec:add(single, V1, V2). /Tony From chsu79@REDACTED Tue Apr 8 08:04:46 2008 From: chsu79@REDACTED (Christian S) Date: Tue, 8 Apr 2008 08:04:46 +0200 Subject: [erlang-questions] URL parsing and construction In-Reply-To: References: <1207570175.6110.15.camel@isolde> <1207625708.6110.19.camel@isolde> Message-ID: Undocumented inside otp: 2> http_uri:parse("http://l:p@REDACTED:123/goo?foo=baz"). {http,"l:p","host",123,"/goo","?foo=baz"} From jeffm@REDACTED Tue Apr 8 08:13:52 2008 From: jeffm@REDACTED (jm) Date: Tue, 08 Apr 2008 16:13:52 +1000 Subject: [erlang-questions] Vector instructions In-Reply-To: References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> Message-ID: <47FB0D20.4000707@ghostgun.com> Tony Rogvall wrote: > > This is a more promising start! Today floats are allocated as separate > objects so there > is no way to use SIMD instructions on tuple with floats anyway!!! > > > I suggest first to implement the operation(s) you showed, possibly > adding alignment support > to the allocation of the vectors since many SIMD instructions operates > best when given 16 bytes aligned > pointers. Rough code ahead ;-) > > Future binary comprehension could use an updated syntax to handle this > in a neat way. > > [ <> || <> <- V1 ; <> <- V2 ] > > Note that the expression X+Y must have a special treat and that ; in > this comprehension expression means > "parallel". This would basically be compiled to vec:add(single, V1, V2). That works for vectors. How about matricies? The reason I initially stated vec:add/3 as an example is that this could be implemented as a C-port module. Then if this proves successful the atomic could be rolled into the VM eventually and the rest moved to a normal library. At which point any changes needed to erlang syntax would be readily apparent. Where would you recommend starting? Any good references on parallel vector and matrix operations/algorithms? Jeff. From ulf.wiger@REDACTED Tue Apr 8 08:54:02 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 08 Apr 2008 08:54:02 +0200 Subject: [erlang-questions] Second try: .appup code_change timeout error In-Reply-To: <26726923.50651207608261377.JavaMail.root@zimbra> References: <26726923.50651207608261377.JavaMail.root@zimbra> Message-ID: <47FB168A.1060502@ericsson.com> Michael FIG skrev: > Hi all, > > I wrote this message a while ago, but haven't received any answer. > Does anybody have a workaround for this situation? Well, I believe you can insert something like: {load_object_code, {myapp, Vsn, [mymod]}, {suspend, [{mymod, 60000}]}, {load, {mymod, soft_purge, soft_purge}}, {code_change, {mymod, Extra}}, {apply, {mymod, transform_files, [...]}}, {resume, [mymod]}, {purge, [mymod]} If mymod represents a gen_server keeping the names of files in its internal state, you'll have to figure out how to make the transform_files() function aware of which files it should transform - it can't call the server, since it's suspended. One dirty way of doing it is to call code_change twice, using the Extra argument to tell the server to store the file names in a public ets table, and then remove the table on the second call. All is fair in love and upgrades. BR, Ulf W From ingela@REDACTED Tue Apr 8 08:56:38 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 08 Apr 2008 08:56:38 +0200 Subject: [erlang-questions] Using mod_esi:deliver() ? In-Reply-To: References: Message-ID: <47FB1726.5020506@erix.ericsson.se> On 4/7/08, Ky?sti Ranto wrote: > > Accoring to the documentation, the second argument of deliver/2 can be > > either of type string() or io_list(). I don't know about the latter > > but you can convert your parameter to string() by calling > > lists:flatten(), i.e. > > > > lists:flatten(io_lib:format(...)) > > Ha! That did it, mod_esi:deliver() works with flat strings. No that is not entirely true. The data can be a string() or an io_list() but if you want to send http-header data it has to be a string. From the documentation: "Sends data from a Erl Scheme script back to the client. Note that if any HTTP-header fields should be added by the script they must be in the first call to deliver/2 and the data in the call must be a string." Regards Ingela - OTP team From eranga.erl@REDACTED Tue Apr 8 09:31:53 2008 From: eranga.erl@REDACTED (Eranga Udesh) Date: Tue, 8 Apr 2008 13:01:53 +0530 Subject: [erlang-questions] Process memory usage Message-ID: <912a3c160804080031w7a340010w39ca00b3fd35a3f3@mail.gmail.com> Hi, I need to analyze a process memory usage in detailed. What methods do I have? What're the reasons for Old Heap to keep on growing? In my Erl node, when I do, erlang:process_info(Pid, memory). I get, {memory,119096} But when I do, erlang:process_info(Pid). I get, [{current_function,{gen_fsm,loop,7}}, {initial_call,{proc_lib,init_p,5}}, {status,waiting}, {message_queue_len,0}, {messages,[]}, {links,[<5052.19690.1>,<5052.19691.1>,<5052.19692.1>,<5052.16340.1>]}, {dictionary,[{'$ancestors',[queue5,queue_svr,<5052.476.0>,<5052.475.0>]}, {'$initial_call',{gen,init_it, [gen_fsm, <5052.16340.1>, <5052.16340.1>, test_module, {838,<5052.16340.1>}, [{spawn_opt,[{fullsweep_after,1000}]}]]}}]}, {trap_exit,true}, {error_handler,error_handler}, {priority,normal}, {group_leader,<5052.474.0>}, {heap_size,987}, {stack_size,13}, {reductions,1219}, {garbage_collection,[{fullsweep_after,1000}]}] According to that my heap and stack sizes are very small. How to analyze what's in memory used by that process? I use Erl R11B-5 Thanks, - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From alceste@REDACTED Tue Apr 8 11:56:20 2008 From: alceste@REDACTED (Alceste Scalas) Date: Tue, 08 Apr 2008 11:56:20 +0200 Subject: [erlang-questions] Vector instructions, BLAS, FFI In-Reply-To: <47FB0D20.4000707@ghostgun.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> <47FB0D20.4000707@ghostgun.com> Message-ID: <1207648580.6159.238.camel@gnatziu.crs4.it> Il giorno mar, 08/04/2008 alle 16.13 +1000, jm ha scritto: > The reason I initially stated vec:add/3 as an example is that this could > be implemented as a C-port module. Then if this proves successful the > atomic could be rolled into the VM eventually and the rest moved to a > normal library. At which point any changes needed to erlang syntax would > be readily apparent. > > Where would you recommend starting? Any good references on parallel > vector and matrix operations/algorithms? Instead of reimplementing everything, I'd suggest to start here: http://www.netlib.org/blas/ http://math-atlas.sourceforge.net/ The BLAS interface does not support integer arithmetics, but it's a well-estabished standard. Furthermore, if the Erlang VM is dynamically linked against a BLAS library (either directly or through a driver), then users/developers could choose their highly-optimized hardware-dependant implementation without recompiling everything. Here at CRS4 we are still experimenting with Erlang as a tool for developing distributed numerical applications. We've developed a BLAS binding, based on the Erlang Foreign Function Interface EEP [1,2] --- and in fact, we've created and proposed the Erlang FFI just to make it easier to interface libraries with tens or hundreds of functions. In general, if you plan to use Erlang for numerical and scientific computation, then you'll definitely need an easy way to interface to existing code. Our current BLAS interface is something like: blas:init(), %% Create an identity matrix I = blas:eye(s, % Precision: 's'ingle or 'd'ouble 3), % Rows and columns V = blas:vector(s, 3, [1.0, 2.0, 3.0]), V2 = blas:mul(blas:mul(2.0, I), V), VL = blas:to_list(blas:transpose(V2)). %% VL is: %% [[2.00000,4.00000,6.00000]] Matrices and vectors are implemented as records containing some information (dimensions, row/column ordering, transposition...) and a binary with floating point values. The BLAS binding consists of ~950 lines of Erlang code (the 'blas' module) and ~300 lines of C (various helper functions). Regards, alceste References: [1] http://muvara.org/crs4/erlang/ffi [2] http://erlang.org/eeps/eep-0007.html -- Alceste Scalas CRS4 - http://www.crs4.it/ From thomasl_erlang@REDACTED Tue Apr 8 13:15:14 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 8 Apr 2008 04:15:14 -0700 (PDT) Subject: [erlang-questions] Vector instructions In-Reply-To: <47FB0D20.4000707@ghostgun.com> Message-ID: <212077.63066.qm@web38815.mail.mud.yahoo.com> --- jm wrote: > Where would you recommend starting? Any good > references on parallel > vector and matrix operations/algorithms? I think Golub and Van Loan is a good point to get going, though the field itself is vast. Also, take a look at Fortran 90:s array syntax and how it is compiled. (Matlab is probably similar.) By the way, I also think it's quite feasible to compile a suitable Erlang-like sublanguage (with aligned binaries) into native-speed, native-space C code, including the use of SIMD/vector intrinsics. (Integration with the regular Erlang VM is another issue :-) Best, Thomas ____________________________________________________________________________________ You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com From jeffm@REDACTED Tue Apr 8 14:16:18 2008 From: jeffm@REDACTED (jm) Date: Tue, 08 Apr 2008 22:16:18 +1000 Subject: [erlang-questions] Vector instructions, BLAS, FFI In-Reply-To: <1207648580.6159.238.camel@gnatziu.crs4.it> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> <47FB0D20.4000707@ghostgun.com> <1207648580.6159.238.camel@gnatziu.crs4.it> Message-ID: <47FB6212.1030008@ghostgun.com> Alceste Scalas wrote: > Il giorno mar, 08/04/2008 alle 16.13 +1000, jm ha scritto: >> The reason I initially stated vec:add/3 as an example is that this could >> be implemented as a C-port module. Then if this proves successful the >> atomic could be rolled into the VM eventually and the rest moved to a >> normal library. At which point any changes needed to erlang syntax would >> be readily apparent. >> >> Where would you recommend starting? Any good references on parallel >> vector and matrix operations/algorithms? > > Instead of reimplementing everything, I'd suggest to start here: > > http://www.netlib.org/blas/ > http://math-atlas.sourceforge.net/ I knew of blas (from lapack) or rather had heard of it, but hadn't heard of math-atlas. Having never used it before I was browsing their website looking for a starting point to access its suitability. Trying to understand the wheel not re-invent it that is. The most I was hoping to do was the initial investigation and, at worst, write a thin bridge between Erlang and a suitable library. Any more than that and I was going to bow out. Nice to see you have saved someone else a lot of work! Not being very familar with blas: Is the license compatible with Erlang? Assuming yes, are you in a position to make any of the code public? How well does it perform? On the reimplementation front. There is something to be said for adding SIMD support at a lower level. After I asked the question about adding vector support I realised that my use of "vector" was too vague. There are actually two valid intepretation: 1) SIMD at the low level. This would mean changes to the language. 2) Vector and matrix operations. This can easily be done by calling an external library. Lastly, what are the "distributed numerical applications" that Erlang is being investigated for? thanks, very informative. Jeff. From ulf.wiger@REDACTED Tue Apr 8 14:24:08 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 08 Apr 2008 14:24:08 +0200 Subject: [erlang-questions] Vector instructions In-Reply-To: <212077.63066.qm@web38815.mail.mud.yahoo.com> References: <212077.63066.qm@web38815.mail.mud.yahoo.com> Message-ID: <47FB63E8.6020904@ericsson.com> Thomas Lindgren skrev: > --- jm wrote: >> Where would you recommend starting? Any good >> references on parallel >> vector and matrix operations/algorithms? > > I think Golub and Van Loan is a good point to get > going, though the field itself is vast. Also, take a > look at Fortran 90:s array syntax and how it is > compiled. (Matlab is probably similar.) > > By the way, I also think it's quite feasible to > compile a suitable Erlang-like sublanguage (with > aligned binaries) into native-speed, native-space C > code, including the use of SIMD/vector intrinsics. > > (Integration with the regular Erlang VM is another > issue :-) > > Best, > Thomas While we're at it, I'd like to throw in a wish to be able to handle real-time manipulation of media streams in Erlang (with good performance, that is). Think, for example, transcoding of video streams. Given Erlang's reputation as a language for telecoms, I don't think this is too far-fetched, even if it were to require some special syntax. (Just doing SIMD operations on binaries seemed too easy. ;) BR, Ulf W From chsu79@REDACTED Tue Apr 8 14:39:46 2008 From: chsu79@REDACTED (Christian S) Date: Tue, 8 Apr 2008 14:39:46 +0200 Subject: [erlang-questions] Vector instructions In-Reply-To: <47FB63E8.6020904@ericsson.com> References: <212077.63066.qm@web38815.mail.mud.yahoo.com> <47FB63E8.6020904@ericsson.com> Message-ID: > While we're at it, I'd like to throw in a wish to > be able to handle real-time manipulation of media > streams in Erlang (with good performance, that is). > > Think, for example, transcoding of video streams. > Given Erlang's reputation as a language for telecoms, > I don't think this is too far-fetched, even if it > were to require some special syntax. The ps3-platform would be an interesting target for such research. Anyone on list that run erlang on their ps3 and use the SPEs from it? From ulf.wiger@REDACTED Tue Apr 8 15:31:37 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 08 Apr 2008 15:31:37 +0200 Subject: [erlang-questions] Vector instructions In-Reply-To: <651181.27298.qm@web38804.mail.mud.yahoo.com> References: <651181.27298.qm@web38804.mail.mud.yahoo.com> Message-ID: <47FB73B9.8010104@ericsson.com> Thomas Lindgren skrev: > --- "Ulf Wiger (TN/EAB)" > wrote: >> While we're at it, I'd like to throw in a wish to >> be able to handle real-time manipulation of media >> streams in Erlang (with good performance, that is). >> >> Think, for example, transcoding of video streams. >> Given Erlang's reputation as a language for >> telecoms, >> I don't think this is too far-fetched, even if it >> were to require some special syntax. > > You mean '[not] too far-fetched [as a feature provided > to the user base]' rather than the tech work itself? > :-) Yes. (: > Anyway, I think there are plenty of interesting > applications, including many outside of the telecoms > field. I'm sure. > It's not quite in the core area of current > Erlang practice, of course. Not current Erlang practice, no, but I see it as a fairly natural evolution, especially since the bit syntax has sort of laid the ground work for bit manipulation applications. Extending it to support more complex updates with competitive performance seems like a very worthy next step. In experiments we've made in the past, Erlang offers fairly good stream relay performance, as long as one doesn't need to do any deep inspection of the data. Updating the data as well makes it likely that an Erlang-based solution fails to reach even the lowest watermark in terms of performance. This is a pity, since e.g. complex media firewalls etc. ought to be fertile ground for Erlang, even in the absence of special hardware. Right now, Erlang is Just Right for the signaling parts of such an application, but Totally Wrong for the media parts. But there's a fairly big grey area, where acceptable performance of an all- Erlang implementation would be just perfect. Cryptol, http://www.cryptol.net, might offer some inspiration, BTW. BR, Ulf W From thomasl_erlang@REDACTED Tue Apr 8 14:58:59 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 8 Apr 2008 05:58:59 -0700 (PDT) Subject: [erlang-questions] Vector instructions In-Reply-To: <47FB63E8.6020904@ericsson.com> Message-ID: <651181.27298.qm@web38804.mail.mud.yahoo.com> --- "Ulf Wiger (TN/EAB)" wrote: > While we're at it, I'd like to throw in a wish to > be able to handle real-time manipulation of media > streams in Erlang (with good performance, that is). > > Think, for example, transcoding of video streams. > Given Erlang's reputation as a language for > telecoms, > I don't think this is too far-fetched, even if it > were to require some special syntax. You mean '[not] too far-fetched [as a feature provided to the user base]' rather than the tech work itself? :-) Anyway, I think there are plenty of interesting applications, including many outside of the telecoms field. It's not quite in the core area of current Erlang practice, of course. Best, Thomas ____________________________________________________________________________________ You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com From dmorton@REDACTED Tue Apr 8 16:06:28 2008 From: dmorton@REDACTED (Damien Morton) Date: Wed, 09 Apr 2008 00:06:28 +1000 Subject: [erlang-questions] Vector instructions In-Reply-To: <47FB73B9.8010104@ericsson.com> References: <651181.27298.qm@web38804.mail.mud.yahoo.com> <47FB73B9.8010104@ericsson.com> Message-ID: <47FB7BE4.6050502@bitfurnace.com> Might be worthwhile looking at Python's NumPy module and the minor changes to the language they added to make the module nicer to use. Im thinking particularly of the array slice notation. On 4/8/2008 11:31 PM, Ulf Wiger (TN/EAB) wrote: > Thomas Lindgren skrev: > >> --- "Ulf Wiger (TN/EAB)" >> wrote: >> >>> While we're at it, I'd like to throw in a wish to >>> be able to handle real-time manipulation of media >>> streams in Erlang (with good performance, that is). >>> >>> Think, for example, transcoding of video streams. >>> Given Erlang's reputation as a language for >>> telecoms, >>> I don't think this is too far-fetched, even if it >>> were to require some special syntax. >>> >> You mean '[not] too far-fetched [as a feature provided >> to the user base]' rather than the tech work itself? >> :-) >> > > Yes. (: > > > >> Anyway, I think there are plenty of interesting >> applications, including many outside of the telecoms >> field. >> > > I'm sure. > > > > It's not quite in the core area of current > >> Erlang practice, of course. >> > > Not current Erlang practice, no, but I see it as a > fairly natural evolution, especially since the bit > syntax has sort of laid the ground work for bit > manipulation applications. Extending it to support more > complex updates with competitive performance seems like > a very worthy next step. > > In experiments we've made in the past, Erlang offers > fairly good stream relay performance, as long as one > doesn't need to do any deep inspection of the data. > Updating the data as well makes it likely that an > Erlang-based solution fails to reach even the lowest > watermark in terms of performance. This is a pity, > since e.g. complex media firewalls etc. ought to be > fertile ground for Erlang, even in the absence of > special hardware. Right now, Erlang is Just Right for > the signaling parts of such an application, but > Totally Wrong for the media parts. But there's a fairly > big grey area, where acceptable performance of an all- > Erlang implementation would be just perfect. > > Cryptol, http://www.cryptol.net, might offer some > inspiration, BTW. > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From mkurkov@REDACTED Tue Apr 8 17:01:30 2008 From: mkurkov@REDACTED (Mikl Kurkov) Date: Tue, 8 Apr 2008 08:01:30 -0700 (PDT) Subject: [erlang-questions] SSL certs as binary data Message-ID: <16559614.post@talk.nabble.com> Is it possible to use ssl with certificates and keys as binary data without saving it to some files? I see only path() options in ssl functions params. Any ideas how to do it? Thanks in advance, Mikl -- View this message in context: http://www.nabble.com/SSL-certs-as-binary-data-tp16559614p16559614.html Sent from the Erlang Questions mailing list archive at Nabble.com. From tsuraan@REDACTED Tue Apr 8 18:18:10 2008 From: tsuraan@REDACTED (tsuraan) Date: Tue, 8 Apr 2008 11:18:10 -0500 Subject: [erlang-questions] Vector instructions, BLAS, FFI In-Reply-To: <1207648580.6159.238.camel@gnatziu.crs4.it> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> <47FB0D20.4000707@ghostgun.com> <1207648580.6159.238.camel@gnatziu.crs4.it> Message-ID: <84fb38e30804080918t20b0dd25y44f7b241a6c0f287@mail.gmail.com> > Our current BLAS interface is something like: > > blas:init(), > > %% Create an identity matrix > I = blas:eye(s, % Precision: 's'ingle or 'd'ouble > 3), % Rows and columns > V = blas:vector(s, 3, [1.0, 2.0, 3.0]), > > V2 = blas:mul(blas:mul(2.0, I), V), > > VL = blas:to_list(blas:transpose(V2)). > %% VL is: > %% [[2.00000,4.00000,6.00000]] I'm curious, how much copying goes on here? With the normal port method, I would imagine that every function call would involve serializing the data from erlang to the c-port, doing the work in c, then serializing it to send back to erlang. Does the FFI allow everything to be stored as binaries, and then you can just hand the binaries from the erlang machine to atlas directly without any data munging or copying? I think I'll have to look into the ffi proposal. It sounds interesting, anyhow. From matthew@REDACTED Tue Apr 8 21:16:44 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 8 Apr 2008 12:16:44 -0700 Subject: [erlang-questions] Broken ipv6 behavior? Message-ID: It seems like erlang's IPv6 support is broken on my laptop (OS X 10.5.1). I have a publicly routable IPv6 address and can access ipv6.google.com fine, but inet:getaddr cannot resolve the IPv6 address even when asked for inet6. When I look at our DNS cache logs or tcpdump output, I only see A type queries not AAAA type queries for ipv6.google.com from my laptop. matthew@REDACTED:~$ ping6 -c 3 ipv6.google.com PING6(56=40+8+8 bytes) 2001:470:805a:1:21b:63ff:feca:36df --> 2001:4860:0:1001::68 16 bytes from 2001:4860:0:1001::68, icmp_seq=0 hlim=56 time=178.045 ms 16 bytes from 2001:4860:0:1001::68, icmp_seq=1 hlim=56 time=186.902 ms 16 bytes from 2001:4860:0:1001::68, icmp_seq=2 hlim=56 time=181.385 ms --- ipv6.l.google.com ping6 statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 178.045/182.111/186.902 ms matthew@REDACTED:~$ erl Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> inet:getaddr("ipv6.google.com", inet6). {error,nxdomain} From brian.guan@REDACTED Wed Apr 9 00:00:47 2008 From: brian.guan@REDACTED (Brian Guan) Date: Tue, 8 Apr 2008 15:00:47 -0700 Subject: [erlang-questions] Hosted Cloud Computing for Erlang Apps? Message-ID: <40a20b40804081500r40d94d17q15897c6e36f6525@mail.gmail.com> Hi all, This is my first post on the mailing list. With Amazon's AWS (language agnostic building blocks - and Simple DB is even erlang based), Google's App Engine (Python), Scalr (PHP), Heroku platform (Ruby on Rails)... is anyone planning to build such a service for Erlang apps? It would seem natural and comparatively easier than for generic PHP, ROR, J2EE apps... Just wondering. - Brian From rvirding@REDACTED Wed Apr 9 00:16:53 2008 From: rvirding@REDACTED (Robert Virding) Date: Wed, 9 Apr 2008 00:16:53 +0200 Subject: [erlang-questions] Open source licenses, which one to choose Message-ID: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Hello everyone, I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). With the last version I got some flak for my "license" and I am now wondering which license to use? GPL seems common among other Erlang projects, but how does this fit together with the normal Erlang license? The Freebsd license is short enough so even I can understand but is it valid. I have no interest in selling* LFE or prohibiting its use, I just want to make sure I receive credit for my work and that no one "steals" it in that respect. I nice courteous we are using would also be nice, good for the ego. What do people think? Robert * As if anyone would buy it. :-) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ellisonbg.net@REDACTED Wed Apr 9 00:29:45 2008 From: ellisonbg.net@REDACTED (Brian Granger) Date: Tue, 8 Apr 2008 16:29:45 -0600 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <6ce0ac130804081529x70c49aabqaffdb6b327accb01@mail.gmail.com> Unless you want the protections that the GPL offers, I think the BSD license is probably the best choice. But, if you do go the GPL route, I would recommend choosing GPLv2. Brian 2008/4/8 Robert Virding : > Hello everyone, > > I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). > With the last version I got some flak for my "license" and I am now > wondering which license to use? GPL seems common among other Erlang > projects, but how does this fit together with the normal Erlang license? The > Freebsd license is short enough so even I can understand but is it valid. I > have no interest in selling* LFE or prohibiting its use, I just want to make > sure I receive credit for my work and that no one "steals" it in that > respect. I nice courteous we are using would also be nice, good for the ego. > > What do people think? > > Robert > > * As if anyone would buy it. :-) > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tony@REDACTED Wed Apr 9 01:22:50 2008 From: tony@REDACTED (Tony Rogvall) Date: Wed, 9 Apr 2008 01:22:50 +0200 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: References: Message-ID: <275956F4-4005-4419-BEAF-0CB12F70D3A1@rogvall.se> Make sure the {inet6, Bool} in the inetrc is set to true? See ERTS User's Guide / Inet configuration. /Tony On 8 apr 2008, at 21.16, Matthew Dempsky wrote: > It seems like erlang's IPv6 support is broken on my laptop (OS X > 10.5.1). I have a publicly routable IPv6 address and can access > ipv6.google.com fine, but inet:getaddr cannot resolve the IPv6 address > even when asked for inet6. > > When I look at our DNS cache logs or tcpdump output, I only see A type > queries not AAAA type queries for ipv6.google.com from my laptop. > > > matthew@REDACTED:~$ ping6 -c 3 ipv6.google.com > PING6(56=40+8+8 bytes) 2001:470:805a:1:21b:63ff:feca:36df --> > 2001:4860:0:1001::68 > 16 bytes from 2001:4860:0:1001::68, icmp_seq=0 hlim=56 time=178.045 ms > 16 bytes from 2001:4860:0:1001::68, icmp_seq=1 hlim=56 time=186.902 ms > 16 bytes from 2001:4860:0:1001::68, icmp_seq=2 hlim=56 time=181.385 ms > > --- ipv6.l.google.com ping6 statistics --- > 3 packets transmitted, 3 packets received, 0% packet loss > round-trip min/avg/max = 178.045/182.111/186.902 ms > > matthew@REDACTED:~$ erl > Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] > [async-threads:0] [kernel-poll:false] > > Eshell V5.6.1 (abort with ^G) > 1> inet:getaddr("ipv6.google.com", inet6). > {error,nxdomain} > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From fig@REDACTED Wed Apr 9 01:24:45 2008 From: fig@REDACTED (Michael FIG) Date: Tue, 8 Apr 2008 17:24:45 -0600 (CST) Subject: [erlang-questions] Second try: .appup code_change timeout error In-Reply-To: <47FB168A.1060502@ericsson.com> Message-ID: <18535784.51841207697085341.JavaMail.root@zimbra> Hi, Thanks for the reply, Ulf. I'll try (something like) those low-level instructions and post my results to the list, in case anybody else runs into this problem. > All is fair in love and upgrades. As I'm learning, you can say that again. -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From matthew@REDACTED Wed Apr 9 01:42:47 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 8 Apr 2008 16:42:47 -0700 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: <275956F4-4005-4419-BEAF-0CB12F70D3A1@rogvall.se> References: <275956F4-4005-4419-BEAF-0CB12F70D3A1@rogvall.se> Message-ID: On Tue, Apr 8, 2008 at 4:22 PM, Tony Rogvall wrote: > Make sure the {inet6, Bool} in the inetrc is set to true? > > See ERTS User's Guide / Inet configuration. Makes no difference. DNS cache still only shows an A query. matthew@REDACTED:/tmp$ echo '{inet6, true}.' > inetrc matthew@REDACTED:/tmp$ erl -kernel inetrc '"/tmp/inetrc"' Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> inet:getaddr("ipv6.google.com", inet6). {error,nxdomain} From matthew@REDACTED Wed Apr 9 03:14:34 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 8 Apr 2008 18:14:34 -0700 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: <607B1E21-ECE7-4BF3-9FEA-A1EB5AEB246D@rogvall.se> References: <275956F4-4005-4419-BEAF-0CB12F70D3A1@rogvall.se> <607B1E21-ECE7-4BF3-9FEA-A1EB5AEB246D@rogvall.se> Message-ID: Okay, so now that breaks looking up localhost: matthew@REDACTED:/tmp$ erl -kernel inetrc '"/tmp/inetrc"' Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> inet_db:set_lookup([dns]). ok 2> inet_db:add_ns({10,0,1,40}). ok 3> inet:getaddr("ipv6.google.com", inet6). {ok,{8193,18528,0,4097,0,0,0,104}} 4> inet:getaddr("localhost", inet). {error,nxdomain} 5> inet:getaddr("localhost", inet6). {error,nxdomain} Looking at my DNS cache logs, Erlang is now sending queries for localhost.local. If I change [dns] to [files, dns], and it gives the same wrong output. (I also tried adding "9.9.9.9 localhost.local" to /etc/hosts, and it still gives nxdomain.) On Tue, Apr 8, 2008 at 5:40 PM, Tony Rogvall wrote: > I you do this: > > inet_db:set_lookup([dns]). > inet_db:add_ns({A,B,C,D}). %% Name server must be IPv4, there is a fixme > in inet_db. > > inet:getaddr("ipv6.google.com", inet6). > {ok,{8193,18528,0,4097,0,0,0,104}} > > > /Tony > > > On 9 apr 2008, at 01.42, Matthew Dempsky wrote: > > > > > On Tue, Apr 8, 2008 at 4:22 PM, Tony Rogvall wrote: > > > > > Make sure the {inet6, Bool} in the inetrc is set to true? > > > > > > See ERTS User's Guide / Inet configuration. > > > > > > > Makes no difference. DNS cache still only shows an A query. > > > > matthew@REDACTED:/tmp$ echo '{inet6, true}.' > inetrc > > matthew@REDACTED:/tmp$ erl -kernel inetrc '"/tmp/inetrc"' > > Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] > > [async-threads:0] [kernel-poll:false] > > > > Eshell V5.6.1 (abort with ^G) > > 1> inet:getaddr("ipv6.google.com", inet6). > > {error,nxdomain} > > > > From ok@REDACTED Wed Apr 9 03:29:14 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 9 Apr 2008 13:29:14 +1200 Subject: [erlang-questions] Vector instructions In-Reply-To: <16532464.post@talk.nabble.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <43C63741-95D4-4CD9-8570-69DDFA8F4DE3@cs.otago.ac.nz> <16532464.post@talk.nabble.com> Message-ID: <9020EA36-E239-4CED-9B68-C96686490D6D@cs.otago.ac.nz> On 7 Apr 2008, at 2:05 pm, Zvi wrote: > In my opinion the reason, that Erlang needs specialized datatypes > like: > binary, bitstring, string, matrix, etc. it's because it's > dynamically typed. You seem to be under the impression that adding specialised data types is cheap. It is not. It requires new tags (binaries use three tags, and I would expect strings to require at least as many, but there are only two tags unused in that block; see erl_term.h), new instructions, changes to the compiler and HiPE, backwards-incompatible changes to the binary representation of terms (which might not be a bad thing; we could do a better job than the current one), and of course a thorough check of the library to ensure that none of the code assumes that the only possible data types are, well, the only currently possible data types. I don't say it's not possible. I don't say it's never warranted. I do say it's not easy, not cheap, and had better pay off. Erlang *has* binaries (which are also bitstrings) because they do a job that (a) Erlang needs done and (b) can't be done with any combination of other data types. What needs doing of course depends on the kind of tasks a programming language was devised for: Erlang's data types would not do for Fortran's tasks, and Fortran's data types won't do for Erlang's tasks. In particular, matrices are part of Fortran's tasks. If I want Fortran, or APL, or Octave, or R, I know where to find them. If I want distributed concurrent "scientific calculations", http://www.sdl.sri.com/papers/concurrency95-preprint/ is the kind of thing I would like, and something not entirely unlike that might be a good way for Erlang to do it, IF that became part of Erlang's application domain. I note that there isn't just one kind of matrix. Dear old LINPACK distinguished between general, triangular, and banded matrices. Nowadays we have the Sparse BLAS, which distinguish between "(1) ordinary sparse matrices, (2) sparse matrices with a regular block structure, and (3) sparse matrices with a variable block structure." (ACM TOMS 28.2, the model implementation in f95 article.) All of this could be hidden from the user of course, but if you seriously care about efficient matrix calculations, *someone* has to recognise the different kinds of matrices and deal with them appropriately. If you do not care about efficient matrix calculations that much, then you don't need a matrix data type in Erlang. (Hint: when I care about matrix efficiency that much, which I sometimes do, I use Fortran 95 and the hardware vendor's heavily tuned library.) > When Erlang designers/implementers needed to process sequences of > bytes, > they for some strange reason didn't used tuples or lists of > integers, but > introduced a new datatype. Nothing strange about it. As my previous message made clear, shipping sequences of bytes around is what Erlang is *for*, and no other data type in Erlang is suited to the job. As soon as Haskell started being used in real earnest for network applications, behold, Haskell acquired a ByteString data type as well. It is a bit misleading to call binaries a "new" data type; binaries have been in Erlang since very early days. Was there _ever_ a time that Erlang was available outside Ericsson without binaries? > Same goes for recently introduced bitstring > datatype: why not to use tuples or lists of true or false atoms? :-) The bit string data type isn't really a new data type. It is just a relaxation of the binary data type. Per Gustaffson's "Programming Efficiently With Binaries and Bit Strings" explains that "Bitstrings are so called sub-binaries" and "any binary is also a bit string". My understanding of what he wrote is that while binaries are logically a special case of bit strings, the implementation is basically the old binary implementation with the "sliced" version giving size and offset in bits instead of bytes. (This is pretty much how the OCaml clone of Erlang bit strings works; see http://et.redhat.com/~rjones/bitmatch/html/Bitmatch.html which says "Internally a bitstring is stored as a normal OCaml string together with an offset and length, where the offset and length are measured in bits." Of course, OCaml is strongly statically typed.) This is not as radical a change as a new data type, and it fits perfectly with Erlang's core application area. When the trade-offs are right, I dare say Erlang *will* acquire a string data type. I note that the Unicode 5.0 book promises quite explicitly that there will be no characters allocated in top topmost plane, so I shall have to stop saying that Unicode characters are 21 bits and start saying that they are 20 bits. Three kinds of character storage will do: one byte per character (Latin 1), two bytes per character (BMP), and three bytes per character (full Unicode). Perhaps making all character strings be slices of binaries, with a new tag, and a field giving the character width, might just possibly be enough. Understand, however, that that will never be an adequate string representation for all purposes, just as the equivalent in Java (every string is a slice of an array of 'short') is not adequate for all purposes. We shall *still* want to use iolists. > I > think there is a lot of optimization behind the scenes and runtime > trying to > guess on every list if it's a string or not. Wrong. > If it's string it may use a > more compact representation. The question is why to guess, if we have > dynamically typed language, where each value tagged by a datatype > anyway? Your starting point is wrong here. The Erlang run time system never tries to guess whether a list is a string or not, only whether it is a list of bytes, and then only when encoding a term as a binary. It's done at that point in order to save some combination of space and network transmission time, just as it specially optimises the transmission of atoms, in order to try to make "symbolic" network protocols as efficient as "binary" ones. > > My point is Erlang tuples and lists are polymorphic collections and > when you > want to have homogenous collections. And the point I made in my previous message is that when you are processing text you DON'T want to have a homogeneous (NOT "homogenous", by the way) collection. > Also all datatypes mentioned above also > must provide indexing and subslicing, which is somewhat not very > effective > when underlying represntation is linked lists. At this point I have lost track of what "all datatypes mentioned above" were. It is really really important to understand that indexing into strings never did make any sense as an operation on text, except as a means of iterating through the characters. Certainly it made no sense in ISO 646 (ASCII), where the construction of composite characters using backspace was explicitly licensed by the standard. (That is, to get ? you were expected to do [e,backspace,'] or [',backspace,e].) This was explicitly disallowed in ISO Latin 1, but Unicode brought back an equivalent. If you access a randomly chosen element of a sequence of codepoints, you have no right to expect to be able to interpret it. Since 1989 C has allowed variable width encodings for characters. (For that matter, Interlisp-D was doing the same back in 1984.) If you land on U+202C, for example (Pop Directional Formatting), what are you supposed to do about it? Basically, if you expect to *interpret* Unicode, the only way that it was designed to be possible, and the only way that it IS possible, is strictly sequentially. That is, "random access indexing" is NOT a relevant operation for Unicode text, and the fact that lists are not good at it is of no importance at all. Does anyone out there understand "variation selectors"? I don't. Slicing is important, BUT there is a very simple very cheap way to represent a slice of a list: {List_Suffix, Length}. The more study I put into Unicode (and it is really quite hard to keep up: it was bad enough when Unicode added language tag characters in violation of its old core design principles, but I now find that they are "strongly discouraged" -- looks like a political battle swayed one way and then the other) the more I'm convinced that the only safe way to take Unicode strings apart is via some kind of regular expressions. And that is why I think it is more important to get a clean design for regular expressions in Erlang that can be implemented very efficiently than to jump into strings, because good string patterns are going to be absolutely essential for Unicode string processing. > > About Unicode-support in string datatype, it must be practical, not > 100% > right, so something like utf16 is good enough for me. Something which is not 100% right is not practical. There are now *more* than 100 000 characters in Unicode. (For example, the German lower case "sharp s" character now has an upper case version, which, however, you are normally not supposed to use. So lower case sharp s _is_ the lower case version of upper case sharp s, but upper case sharp s is NOT the upper case version of lower case sharp s, "SS" is.) Just at the moment I have had a surfeit of programs not working 100% correctly. I know we are human and cannot _achieve_ perfection, but that is no reason to AIM at folly. > > In Haskel you specify type of element (I do not know this language, > just > guessing the syntax, I have no idea how to represent vector in > Haskel, so > everything is a list): > > type String = [Char] This one is right. > > type Binary = [0..255] There are no subrange types like 0..255 in Haskell. As it happens, there are C-like Int8, Int16, Int32, Int64 (signed) and Word8, Word16, Word32, Word64 (unsigned) in addition to the old Int and Integer (unbounded). The actual implementation is data ByteString = PS {-# UNPACK #-} !(ForeignPtr Word8) {-# UNPACK #-} !Int -- offset {-# UNPACK #-} !Int -- length which is pretty much the same as an Erlang (sliced) binary. However, the one that is suitable for incremental calculations is Data.ByteString.Lazy, where we find newtype ByteString = LPS [P.ByteString] -- LPS for lazy packed string Both Data.ByteString and Data.ByteString.Lazy go to a great deal of trouble to look as much like lists as they can. Be it noted that Data.ByteString.Lazy does not offer constant-time indexing or slicing. > > type Bitstring = [Bool] There is no such animal. There's no particular reason why there could not be. > > type Matrix = (Int,Int,[Double]) The simplest version of Matrix would be type Matrix = Array (Int,Int) Double Nowadays Haskell offers a bewildering range of arrays: unboxed or boxed strict or lazy, pure, in the IO monad, in a state change monad, ... For efficient calculations, one would want to use Alberto Ruiz's hmatrix library, which is layered on top of the BLAS, LAPACK, and GSL. Data.Packed.Matrix and Data.Packed.Vector make good use of Haskell's type system. There are two fundamental things going on to make packages like hmatrix work well in Haskell: (1) Tight coupling with foreign code. (2) Strong static Hindley-Milner typechecking extended with type- classes. I would expect to be able to do the same kind of thing in Mercury or OCaml. If the Clean FFI were better documented, I would expect to be able to do the same kind of thing in Clean. Oh, SML fits here too. Because of the type system, they are all *expecting* to be extended with thousands of new types. Because of the tight coupling with foreign code, they are all *expecting* to be linked with untrustworthy code that they will fully trust. These days it is a perfectly reasonable thing to develop network applications in SML or Haskell or Mercury as long as you don't want hot loading and very large numbers of processes. (I don't know OCaml well enough to tell what it is like for network programming these days, although the fact that there's a package giving it a clone of Erlang's bit syntax makes me wonder...) > BTW: I think Haskel's tuples are done right. I never understood why > Erlangs' functions have arity, when every function can have single > argument > as a tuple. Well, why do C functions have arity, when any C function can have a struct as an argument? ML has a similar type system to Haskell (except for typeclasses). In Haskell, it's normal practice to use curried functions, e.g., append :: [a] -> [a] -> [a] -- really ++ In ML, it's normal practice to use uncurried functions, e.g., append : 'a list * 'a list -> 'a list (* really @ *) Having used both, I find the ML convention a pain. ML compilers have to go to some trouble to avoid actually allocating storage for these tuples, and in fact cannot always do so. Erlang's functions have multiple arguments because that's the way people like to think about them. It is a member of a group of languages including Prolog, Strand 88, Parlog, Concurrent Prolog, GHC, Janus, and others I've forgotten, not to forget Mercury. It is a coherent and useful design. We don't all have to do the same thing. (I would argue that the SML interfaces are incoherent. Why should map be curried but append not?) > Haskel tuples must have at least 2 elements. So any single > element is a tuple of 1? It's the same like in Matlab - scalar is a > matrix > of 1x1. > But in Erlang x and {x} is not the same. Probably it's because > Erlangs > tuples are both tuples AND polymorphic vectors. Matlab's treatment of scalars is a pain in the neck. R does the same thing (because S does). Much as I love R, this is not one of its best features. As in many other aspects of array crunching, APL got this right. In APL, a number has rank 0, a single-element vector has rank 1, a single-element matrix has rank 2, and so on. It does not muddle them up. Haskell had precursors, notably Lazy ML, which copied much from ML, in which tuple types are written using infix *. Where Haskell has (Int,Bool,Char), SML has int * bool * char, and you simply cannot express one-element tuple types in that syntax. Erlang owes much to Strand 88. Several other Prolog-family languages, notably Sigma Prolog and Concurrent Prolog, also have tuples with 0, 1, or more elements. For that matter, SETL (the language devised by Jack Schwartz at the Courant Institute, explicitly intended to make (finite) set theory a programming language), identifies tuples and polymorphic vectors. It's a common enough and handy enough idea. > From tony@REDACTED Wed Apr 9 03:30:06 2008 From: tony@REDACTED (Tony Rogvall) Date: Wed, 9 Apr 2008 03:30:06 +0200 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: References: <275956F4-4005-4419-BEAF-0CB12F70D3A1@rogvall.se> <607B1E21-ECE7-4BF3-9FEA-A1EB5AEB246D@rogvall.se> Message-ID: <730ADE0C-D8AE-45C8-ACB3-4B18F8B38296@rogvall.se> Ok. When you do it from the prompt you need some more things. inet_db:set_lookup([file,dns]). %% NOT files then you need to (re)load the host list: inet_db:add_hosts("/etc/hosts"). now it should work. Well I guess you want to check why the native version does not work, and possibly put the stuff in an rc file. /Tony On 9 apr 2008, at 03.14, Matthew Dempsky wrote: > Okay, so now that breaks looking up localhost: > > matthew@REDACTED:/tmp$ erl -kernel inetrc '"/tmp/inetrc"' > Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] > [async-threads:0] [kernel-poll:false] > > Eshell V5.6.1 (abort with ^G) > 1> inet_db:set_lookup([dns]). > ok > 2> inet_db:add_ns({10,0,1,40}). > ok > 3> inet:getaddr("ipv6.google.com", inet6). > {ok,{8193,18528,0,4097,0,0,0,104}} > 4> inet:getaddr("localhost", inet). > {error,nxdomain} > 5> inet:getaddr("localhost", inet6). > {error,nxdomain} > > Looking at my DNS cache logs, Erlang is now sending queries for > localhost.local. > > If I change [dns] to [files, dns], and it gives the same wrong output. > (I also tried adding "9.9.9.9 localhost.local" to /etc/hosts, and it > still gives nxdomain.) > > > On Tue, Apr 8, 2008 at 5:40 PM, Tony Rogvall wrote: >> I you do this: >> >> inet_db:set_lookup([dns]). >> inet_db:add_ns({A,B,C,D}). %% Name server must be IPv4, there is a >> fixme >> in inet_db. >> >> inet:getaddr("ipv6.google.com", inet6). >> {ok,{8193,18528,0,4097,0,0,0,104}} >> >> >> /Tony >> >> >> On 9 apr 2008, at 01.42, Matthew Dempsky wrote: >> >> >> >>> On Tue, Apr 8, 2008 at 4:22 PM, Tony Rogvall >>> wrote: >>> >>>> Make sure the {inet6, Bool} in the inetrc is set to true? >>>> >>>> See ERTS User's Guide / Inet configuration. >>>> >>> >>> Makes no difference. DNS cache still only shows an A query. >>> >>> matthew@REDACTED:/tmp$ echo '{inet6, true}.' > inetrc >>> matthew@REDACTED:/tmp$ erl -kernel inetrc '"/tmp/inetrc"' >>> Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] >>> [async-threads:0] [kernel-poll:false] >>> >>> Eshell V5.6.1 (abort with ^G) >>> 1> inet:getaddr("ipv6.google.com", inet6). >>> {error,nxdomain} >>> >> >> From bjt@REDACTED Wed Apr 9 04:23:41 2008 From: bjt@REDACTED (Benjamin Tolputt) Date: Wed, 09 Apr 2008 12:23:41 +1000 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <47FC28AD.8040004@pmp.com.au> G'day Robert (& list); Personally, I think you should use any license you're happy with. I have a small political bias against GPL3 (there are some weird restrictions in there designed to "thwart evil-doers"), but I have no hassles implementing or using GPL2. For your purposes, I would suggest the MIT license if you are just after credit being retained in derivatives, or MPL (Mozilla Public License) if you desire credit retained AND changes to remain in the open. MIT is GPL compatible (but can be modified without contributing back into the open); whereas MPL is not strictly GPL compatible (however it keeps changes in the open). --Ben Robert Virding wrote: > Hello everyone, > > I will soon be releasing the next version of LFE (Lisp Flavoured > Erlang). With the last version I got some flak for my "license" and I > am now wondering which license to use? GPL seems common among other > Erlang projects, but how does this fit together with the normal Erlang > license? The Freebsd license is short enough so even I can understand > but is it valid. I have no interest in selling* LFE or prohibiting its > use, I just want to make sure I receive credit for my work and that no > one "steals" it in that respect. I nice courteous we are using would > also be nice, good for the ego. > > What do people think? > > Robert > > * As if anyone would buy it. :-) > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ingela@REDACTED Wed Apr 9 09:05:15 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Wed, 09 Apr 2008 09:05:15 +0200 Subject: [erlang-questions] SSL certs as binary data In-Reply-To: References: Message-ID: <47FC6AAB.9000608@erix.ericsson.se> erlang-questions-request@REDACTED wrote: > Is it possible to use ssl with certificates and keys as binary data without > saving it to some files? > I see only path() options in ssl functions params. > Any ideas how to do it? > Currently the answer is no. For the new erlang implementation of ssl it would however be quite easy to add such an option, we will consider it for the upcoming ssl, but it will not be top priority and with the current work load and summer vacations not being far away don't expect it to be done in a wink. Regards Ingela - OTP team From raimo+erlang-questions@REDACTED Wed Apr 9 09:27:43 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 9 Apr 2008 09:27:43 +0200 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: References: Message-ID: <20080409072743.GA10417@erix.ericsson.se> On Tue, Apr 08, 2008 at 12:16:44PM -0700, Matthew Dempsky wrote: > It seems like erlang's IPv6 support is broken on my laptop (OS X > 10.5.1). I have a publicly routable IPv6 address and can access > ipv6.google.com fine, but inet:getaddr cannot resolve the IPv6 address > even when asked for inet6. > > When I look at our DNS cache logs or tcpdump output, I only see A type > queries not AAAA type queries for ipv6.google.com from my laptop. > > > matthew@REDACTED:~$ ping6 -c 3 ipv6.google.com > PING6(56=40+8+8 bytes) 2001:470:805a:1:21b:63ff:feca:36df --> > 2001:4860:0:1001::68 > 16 bytes from 2001:4860:0:1001::68, icmp_seq=0 hlim=56 time=178.045 ms > 16 bytes from 2001:4860:0:1001::68, icmp_seq=1 hlim=56 time=186.902 ms > 16 bytes from 2001:4860:0:1001::68, icmp_seq=2 hlim=56 time=181.385 ms > > --- ipv6.l.google.com ping6 statistics --- > 3 packets transmitted, 3 packets received, 0% packet loss > round-trip min/avg/max = 178.045/182.111/186.902 ms > > matthew@REDACTED:~$ erl > Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] > [async-threads:0] [kernel-poll:false] > > Eshell V5.6.1 (abort with ^G) > 1> inet:getaddr("ipv6.google.com", inet6). > {error,nxdomain} Give us the result of: $ uname -a $ cat /etc/resolv.conf $ erl 1> inet_gethost_native:control({debug_level,4}). 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). 3> ets:tab2list(inet_db). 4> ets:tab2list(inet_hosts). For starters. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mikpe@REDACTED Wed Apr 9 09:30:19 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 9 Apr 2008 09:30:19 +0200 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <18428.28811.544604.131769@harpo.it.uu.se> Robert Virding writes: > Hello everyone, > > I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). > With the last version I got some flak for my "license" and I am now > wondering which license to use? GPL seems common among other Erlang > projects, but how does this fit together with the normal Erlang license? The > Freebsd license is short enough so even I can understand but is it valid. I > have no interest in selling* LFE or prohibiting its use, I just want to make > sure I receive credit for my work and that no one "steals" it in that > respect. I nice courteous we are using would also be nice, good for the ego. > > What do people think? Have a look at the LGPL (library/lesser GPL). In essence, it's like the GPL for the thing you wrote, but doesn't contaminate things it gets linked to. From raimo+erlang-questions@REDACTED Wed Apr 9 09:32:59 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 9 Apr 2008 09:32:59 +0200 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <20080409073259.GB10417@erix.ericsson.se> On Wed, Apr 09, 2008 at 12:16:53AM +0200, Robert Virding wrote: > Hello everyone, > > I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). > With the last version I got some flak for my "license" and I am now > wondering which license to use? GPL seems common among other Erlang > projects, but how does this fit together with the normal Erlang license? The > Freebsd license is short enough so even I can understand but is it valid. I > have no interest in selling* LFE or prohibiting its use, I just want to make > sure I receive credit for my work and that no one "steals" it in that > respect. I nice courteous we are using would also be nice, good for the ego. > > What do people think? > If you are happy with attribution (credits), i think the FreeBSD/OpenBSD... licenses are the normal to use. In the *BSD camps the GPL is thought of as evil since it many times prohibits (at least makes harder) (commercial) use. Unfortunately it seems to be a religious thing. > Robert > > * As if anyone would buy it. :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ulf.wiger@REDACTED Wed Apr 9 09:46:52 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 09 Apr 2008 09:46:52 +0200 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <47FC746C.9000009@ericsson.com> Robert Virding skrev: > > The Freebsd license is short enough so even I can understand > but is it valid. Given that major router vendors like Juniper et al have relied on it for their own hacked versions of FreeBSD, I would assume that it's valid enough for your needs. BR, Ulf W From matthew@REDACTED Wed Apr 9 09:52:40 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 00:52:40 -0700 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: <20080409072743.GA10417@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> Message-ID: On Wed, Apr 9, 2008 at 12:27 AM, Raimo Niskanen wrote: > Give us the result of: > $ uname -a > $ cat /etc/resolv.conf > $ erl > 1> inet_gethost_native:control({debug_level,4}). > 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > 3> ets:tab2list(inet_db). > 4> ets:tab2list(inet_hosts). I'm away from the office right now so I can't test from my OS X laptop, but below is the output from an OpenBSD machine and a Linux machine there that both demonstrate the same misbehavior. (If necessary, I'll rerun the test tomorrow on OS X.) matthew@REDACTED:~$ uname -a OpenBSD golem.mochimedia.net 4.3 GENERIC.MP#1559 amd64 matthew@REDACTED:~$ cat /etc/resolv.conf search mochimedia.net nameserver 127.0.0.1 matthew@REDACTED:~$ ping6 -c 1 ipv6.google.com PING6(56=40+8+8 bytes) 2001:470:1f04:330::2 --> 2001:4860:0:1001::68 16 bytes from 2001:4860:0:1001::68, icmp_seq=0 hlim=57 time=174.165 ms --- ipv6.l.google.com ping6 statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 174.165/174.165/174.165/0.000 ms matthew@REDACTED:~$ echo '{inet6, true}.' > inetrc matthew@REDACTED:~$ erl -kernel inetrc '"./inetrc"' Erlang (BEAM) emulator version 5.6.1 [source] [64-bit] [async-threads:0] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> inet_gethost_native:control({debug_level,4}). inet_gethost[29369] (DEBUG):debug_level = 4 ok 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). inet_gethost[29369] (DEBUG):Saved domainname .google.com. inet_gethost[29369] (DEBUG):Created worker[6118] with fd 3 inet_gethost[29369] (DEBUG):Saved domainname .google.com. inet_gethost[6118] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. {error,enotsup} 3> ets:tab2list(inet_db). [{socks5_noproxy,[]}, {res_recurse,1}, {res_id,0}, {hostname,"golem"}, {res_alt_ns,[]}, {cache_refresh_interval,3600000}, {res_inet6,true}, {socks5_port,1080}, {socks5_methods,[none]}, {res_timeout,2000}, {cache_size,100}, {res_domain,"mochimedia.net"}, {res_retry,3}, {res_ns,[]}, {res_lookup,[native]}, {sctp_module,inet_sctp}, {udp_module,inet_udp}, {tcp_module,inet_tcp}, {socks5_server,[]}, {res_search,["mochimedia.net"]}, {res_usevc,false}] 4> ets:tab2list(inet_hosts). [] matthew@REDACTED:~$ uname -a Linux lol 2.6.20-16-generic #2 SMP Tue Feb 12 02:11:24 UTC 2008 x86_64 GNU/Linux matthew@REDACTED:~$ cat /etc/resolv.conf search mochimedia.net nameserver 10.0.1.40 matthew@REDACTED:~$ ping6 -c 1 ipv6.google.com PING ipv6.google.com(2001:4860:0:1001::68) 56 data bytes 64 bytes from 2001:4860:0:1001::68: icmp_seq=1 ttl=56 time=174 ms --- ipv6.google.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 174.967/174.967/174.967/0.000 ms matthew@REDACTED:~$ echo '{inet6, true}.' > inetrc matthew@REDACTED:~$ erl -kernel inetrc '"./inetrc"' Erlang (BEAM) emulator version 5.6.1 [source] [64-bit] [smp:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> inet_gethost_native:control({debug_level,4}). inet_gethost[8266] (DEBUG):debug_level = 4 ok 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). inet_gethost[8266] (DEBUG):Saved domainname .google.com. inet_gethost[8266] (DEBUG):Created worker[8268] with fd 3 inet_gethost[8266] (DEBUG):Saved domainname .google.com. inet_gethost[8268] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. {error,enotsup} 3> ets:tab2list(inet_db). [{socks5_noproxy,[]}, {res_recurse,1}, {res_id,0}, {hostname,"lol"}, {res_alt_ns,[]}, {cache_refresh_interval,3600000}, {res_inet6,true}, {socks5_port,1080}, {socks5_methods,[none]}, {res_timeout,2000}, {cache_size,100}, {res_domain,"mochimedia.net"}, {res_retry,3}, {res_ns,[]}, {res_lookup,[native]}, {sctp_module,inet_sctp}, {udp_module,inet_udp}, {tcp_module,inet_tcp}, {socks5_server,[]}, {res_search,["mochimedia.net"]}, {res_usevc,false}] 4> ets:tab2list(inet_hosts). [] From alceste@REDACTED Wed Apr 9 10:18:29 2008 From: alceste@REDACTED (Alceste Scalas) Date: Wed, 09 Apr 2008 10:18:29 +0200 Subject: [erlang-questions] Vector instructions, BLAS, FFI In-Reply-To: <47FB6212.1030008@ghostgun.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> <47FB0D20.4000707@ghostgun.com> <1207648580.6159.238.camel@gnatziu.crs4.it> <47FB6212.1030008@ghostgun.com> Message-ID: <1207729109.6159.310.camel@gnatziu.crs4.it> Il giorno mar, 08/04/2008 alle 22.16 +1000, jm ha scritto: > Not being very familar with blas: Is the license compatible with > Erlang? BLAS is just a standardized API, with several implementations. Some examples: * NetLib reference implementation: http://www.netlib.org/blas/ * ATLAS: http://math-atlas.sourceforge.net/ * AMD Core Math Library: http://developer.amd.com/acml.jsp * Intel Math Kernel Library: http://www.intel.com/cd/software/products/asmo-na/eng/266858.htm * nVIDIA CUDA: http://developer.nvidia.com/object/cuda.html Each implementation comes with its own license (Netlib and ATLAS are released under BSD-like, GPL-compatible licenses). They are usually binary compatible, so you can switch between them without recompiling (as long as you use dynamic linking and don't depend on some non-standard API extensions). > Assuming yes, are you in a position to make any of the code > public? I hope I'll be able to release the code, but it depends on the FFI patches --- so it may not be very useful, unless the FFI EEP is approved in some form. > How well does it perform? We tried several ways to integrate BLAS and Erlang. The current FFI-based implementation is slightly slower than dedicated BIFs, but definitely faster than a linked-in driver (and definitely easier to develop, since all the linked-in driver boilerplate code went away). I can't provide the benchmarks data right now, but we plan to submit a paper for the next Erlang Workshop. > Lastly, what are the "distributed numerical applications" that Erlang is > being investigated for? Simulation of mechanical and thermodynamical systems. Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From alceste@REDACTED Wed Apr 9 10:42:51 2008 From: alceste@REDACTED (Alceste Scalas) Date: Wed, 09 Apr 2008 10:42:51 +0200 Subject: [erlang-questions] Vector instructions, BLAS, FFI In-Reply-To: <84fb38e30804080918t20b0dd25y44f7b241a6c0f287@mail.gmail.com> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> <47FB0D20.4000707@ghostgun.com> <1207648580.6159.238.camel@gnatziu.crs4.it> <84fb38e30804080918t20b0dd25y44f7b241a6c0f287@mail.gmail.com> Message-ID: <1207730571.6159.333.camel@gnatziu.crs4.it> Il giorno mar, 08/04/2008 alle 11.18 -0500, tsuraan ha scritto: > Does the FFI allow everything to be stored as binaries, and then you > can just hand the binaries from the erlang machine to atlas directly > without any data munging or copying? Yes, it does. The FFI allows both to receive and return binaries and handle refcounting. Furthermore, several operations do not involve the C side at all (for example: matrix/vector transposition just changes an Erlang record field; the same goes for matrix/vector extraction from existing matrices/vectors). We developed the BLAS interface (and the FFI in the first place) trying to avoid copying, unless the data is sent between different Erlang nodes (and since matrices and vectors are just regular Erlang records, the Erlang VM can handle them without problems). Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From erlang@REDACTED Wed Apr 9 10:54:43 2008 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 9 Apr 2008 10:54:43 +0200 Subject: [erlang-questions] CBSE anybody Message-ID: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> Pardon my ignorance but ... For a long, long time I have been pondering the problem of how we glue (software) things together. The simplest of all methods is the unix pipe. cat foo | grep ... | awk ...| wc (or whatever) aside: When people say "parallel programming is difficult!" I guess they weren't thinking of the unix pipe notation - the above is (or course) a parallel program with 4 parallel processes .-) The problem with the pipe is the low level of abstraction across the pipe boundary - we just send two types of thing - individual characters and endOfStream. Erlang messaging is nicer in this respect - since we send well formed data structures (terms). This eliminates all the parsing and serializing of data that is needed with raw unix pipes. Now suppose we wish to describe a complete Erlang system in a way that abstracts away from the irrelevant detail of what goes on inside a process. The "natural" way to do this is to talk in terms of protocols and in the interconnection of components that terminate these protocols. Protocols can be elegantly described in some hastily constructed CSP like notation. Here's an example of a file server in such a notation Protocol FileServer(in, out) { Start = Operation -> Start. Operation = Get | Put | List. Get = in ? {get, file()} -> out ! {file, bin()} | out ! enofile. Put = in ? {put, filename::string(), data::bin()} -> out ! yes | out ! no } and so on -- here I've taken a few liberties with the Erlang type notation and with CSP notation - but you should get the idea. This describes a black box with ports called "in" and "out". From such a description it's easy to write a dynamic type checker that checks the the black box obeys the protocol. How do we describe the interconnections of a set of black boxes? Here *diagrams* seem very helpful. I would like therefore lie to describe the system using three levels of abstraction: 1) At the top level of the system I want to draw a diagram showing how the components are connected together 2) At the middle layer I want to *specify* the components 3) At the lower level I want to implement the components. Now it seems to me that 3) is solved very nicely in Erlang. What we therefore need is to focus on 1) and 2) I recently came across a wiki page describing "component based software engineering" (see http://en.wikipedia.org/wiki/Software_componentry) And it struck me that a) "this is what I've been doing all the time only with a different name" and b) "I've been doing this bottom up, rather than top down" (which is why level 3, is clear in my head but not 1 and 2) Reading the wiki page was interesting - it classifies Morrison's flow based programming (http://en.wikipedia.org/wiki/Flow-based_programming ) as a CBSE architecture - for a long time I've been a fan of the FBP view of the world. It seems to me that the bits are beginning to click together - and we can begin to join up the dots. I have noticed one area that seems to distinguish bad areas in projects from good - this seems to me to have to do with whether the project terminates a protocol or not. let me give an example. If I say "this software terminates the XYZ protocol as defined in RFCxxxx" (or something) then in some sense the projects seems easy and very doable. But if we say "and we need to manage the stuff" or "make it scalable" then we run into a mass of wiggly worms. "manage the stuff" is NOT a protocol, making is scalable is NOT a protocol. Things that do not have names are difficult to talk about - so the whole idea of pattern based programming is to identify common things and give them names. What we do not do in Erlang is *name protocols* - they are there implicitly but not explicitly. If we were to say the system terminates "management protocol XXX" or "scalability protocol YYY" then the problem becomes easier - suddenly the vague concept of "management" becomes a question of protocols. If I look at some code with send and receive statements I cannot "see" which particular messages "escape the black box" and contribute to the protocol and which do no. Some simple annotations to the code can solve this - as an example let's go back to the file server let's annotate the code - something like receive {a_message, X,Y} -> .... {Pid, Bin} -> event(in, "{get, "}), %% <- the annotation that links the code to the protocol spec term = binary_to_term(Bin), ... end Now when I analyze the code it corresponds to the protocol spec. Aside: Interestingly when I debug a process I use io:format but my io:format's are not placed *randomly* they are placed immediately *after* the receive patterns that correspond to interactions with the external world and immediately *before* sends that send message to the outside world. It strikes me that it would be highly beneficial to align the top two levels of Erlang to methodologies adopted in the CBSE world. Now I cannot conceive of using WSDL to describe protocols - so I think some kind of CSP'ish notation would suffice. For a transport layer I am uncertain - we could use Erlang terms (external format) for all messaging (and a type system to describe them,) but this would hinder interoperability - of the currently available formats something like JSON is not too bad - or my UBF (see http://www.sics.se/?~joe/ubf) . Possibly both JASON AND UBF. The highest level should be a drag and draw gui thingy to describe the interconnection between components. UML has a notation for this (it has a notation for *everything*) which could be cannibalized. Does anybody have experience with this kind of way of building software - there seems to be a vast literature - I search turned up book titles like - UML Components: A Simple Process for Specifying Component-Based Software (Cheesman and Daniels) ... There seem to be dozens of books of this ilk. Can anybody recommend any books here that might enlighten me or should I just buy a dozen or so and read them all? What I'm after is 1) a graphic notation showing component integration for the top level of design. 2) A formal notation for describing protocols for the middle level 3) A low level way of implementing the protocol I also want a *universal* messaging format for interprocess-communication. Any votes for Erlang external term format/JSON/UBF/list S expressions /whatever. Which bits should we invent for ourselves - and what should we borrow/adapt/steal? Comments please! /Joe Armstrong From richardc@REDACTED Wed Apr 9 10:56:19 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 09 Apr 2008 10:56:19 +0200 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <47FC84B3.7060908@it.uu.se> Robert Virding wrote: > I will soon be releasing the next version of LFE (Lisp Flavoured > Erlang). With the last version I got some flak for my "license" and I am > now wondering which license to use? Here are a couple of good resources: http://www.softwarefreedom.org/resources/2008/foss-primer.html http://www.opensource.org/licenses/category My personal recommendation would be BSD/MIT or LGPL (but not GPL). Or if you're feeling whimsical, you might like this one: http://en.wikipedia.org/wiki/WTFPL /Richard From matthew@REDACTED Wed Apr 9 11:04:54 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 02:04:54 -0700 Subject: [erlang-questions] Defining static functions in abstract modules Message-ID: It would be nice to be able to define arbitrary static functions within an abstract module. Right now you can kludge around this by exploiting that local functions named 'new' are always static and write something like new(incr, X) -> X + 1. but it would be nicer to just write -static([incr/1]). incr(X) -> X + 1. Below is a very rudimentary patch that adds support for this syntax. It's basically only enough to compile and run very simple test cases and to demonstrate that implementing this does not seem too difficult. (One problem I'm already aware of is that a static function foo/1 and an instance function foo/0 silently collide without any warning... so don't do that. ;-)) Another option would be to make the attribute statement just "-static([incr])." and then all incr functions are defined static, but that seems unnecessarily limiting. If the long-term goal is to have separate namespaces for static and instance functions (e.g., so (Mod:new(...)):module_info() works and returns something meaningful for the module instance), then maybe a syntax that actually decorates individual function definitions would be better? Are there any plans on adding static functions in a future release? --- stdlib/src/erl_parse.yrl.orig 2007-11-27 07:57:32.000000000 -0800 +++ stdlib/src/erl_parse.yrl 2008-04-09 01:25:31.000000000 -0700 @@ -627,6 +627,12 @@ {attribute,La,export,farity_list(ExpList)}; _Other -> error_bad_decl(La, export) end; +build_attribute({atom,La,static}, Val) -> + case Val of + [ExpList] -> + {attribute,La,static,farity_list(ExpList)}; + _Other -> error_bad_decl(La, static) + end; build_attribute({atom,La,import}, Val) -> case Val of [Name] -> --- compiler/src/sys_pre_expand.erl.orig 2008-02-05 05:37:09.000000000 -0800 +++ compiler/src/sys_pre_expand.erl 2008-04-09 01:26:06.000000000 -0700 @@ -38,6 +38,7 @@ parameters=undefined, %Module parameters package="", %Module package exports=[], %Exports + statics=[], %Statics imports=[], %Imports mod_imports, %Module Imports compile=[], %Compile flags @@ -109,6 +110,7 @@ end, {Fs1,Xs,Ds} = sys_expand_pmod:forms(Fs0, Ps, St0#expand.exports, + St0#expand.statics, St0#expand.defined), St1 = St0#expand{exports=Xs, defined=Ds}, {Fs2,St2} = add_instance(Ps, Fs1, St1), @@ -220,6 +222,8 @@ package = packages:strip_last(M)}; attribute(export, Es, St) -> St#expand{exports=union(from_list(Es), St#expand.exports)}; +attribute(static, Ss, St) -> + St#expand{statics=union(from_list(Ss), St#expand.statics)}; attribute(import, Is, St) -> import(Is, St); attribute(compile, C, St) when is_list(C) -> --- compiler/src/sys_expand_pmod.erl.orig 2008-02-05 05:38:12.000000000 -0800 +++ compiler/src/sys_expand_pmod.erl 2008-04-09 01:32:36.000000000 -0700 @@ -25,18 +25,19 @@ %% and 'exports'. The automatic 'new/N' function is neither added to the %% definitions nor to the 'exports'/'defines' lists yet. --export([forms/4]). +-export([forms/5]). --record(pmod, {parameters, exports, defined, predef}). +-record(pmod, {parameters, exports, statics, defined, predef}). %% TODO: more abstract handling of predefined/static functions. -forms(Fs0, Ps, Es0, Ds0) -> +forms(Fs0, Ps, Es0, Ss0, Ds0) -> PreDef = [{module_info,0},{module_info,1}], - forms(Fs0, Ps, Es0, Ds0, PreDef). + forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef). -forms(Fs0, Ps, Es0, Ds0, PreDef) -> - St0 = #pmod{parameters=Ps,exports=Es0,defined=Ds0, predef=PreDef}, +forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef) -> + St0 = #pmod{parameters=Ps,exports=Es0,statics=Ss0,defined=Ds0, + predef=PreDef}, {Fs1, St1} = forms(Fs0, St0), Es1 = update_function_names(Es0, St1), Ds1 = update_function_names(Ds0, St1), @@ -50,15 +51,22 @@ [update_function_name(E, St) || E <- Es]. update_function_name(E={F,A}, St) when F =/= new -> - case ordsets:is_element(E, St#pmod.predef) of + case ordsets:is_element(E, St#pmod.predef) orelse + ordsets:is_element(E, St#pmod.statics) of true -> E; false -> {F, A + 1} end; update_function_name(E, _St) -> E. -update_forms([{function,L,N,A,Cs}|Fs],St) when N =/= new -> - [{function,L,N,A+1,Cs}|update_forms(Fs,St)]; +update_forms([F0={function,L,N,A,Cs}|Fs],St) when N =/= new -> + F = case ordsets:is_element({N,A}, St#pmod.statics) of + true -> + F0; + false -> + {function,L,N,A+1,Cs} + end, + [F|update_forms(Fs,St)]; update_forms([F|Fs],St) -> [F|update_forms(Fs,St)]; update_forms([],_St) -> @@ -74,9 +82,14 @@ {[], St0}. %% Only function definitions are of interest here. State is not updated. -form({function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> - {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), - {{function,Line,Name,Arity,Clauses},St}; +form(F = {function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> + case ordsets:is_element({Name0, Arity0}, St#pmod.statics) of + true -> + {F,St}; + false -> + {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), + {{function,Line,Name,Arity,Clauses},St} + end; %% Pass anything else through form(F,St) -> {F,St}. @@ -362,7 +375,13 @@ expr({call,Lc,{atom,Lf,F},As0},St) -> %% Local function call - needs THIS parameter. As1 = expr_list(As0,St), - {call,Lc,{atom,Lf,F},As1 ++ [{var,0,'THIS'}]}; + As2 = case ordsets:is_element({F, length(As1)}, St#pmod.statics) of + true -> + As1; + false -> + As1 ++ [{var,0,'THIS'}] + end, + {call,Lc,{atom,Lf,F},As2}; expr({call,Line,F0,As0},St) -> %% Other function call F1 = expr(F0,St), From raimo+erlang-questions@REDACTED Wed Apr 9 11:04:11 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 9 Apr 2008 11:04:11 +0200 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> Message-ID: <20080409090411.GA11590@erix.ericsson.se> On Wed, Apr 09, 2008 at 12:52:40AM -0700, Matthew Dempsky wrote: > On Wed, Apr 9, 2008 at 12:27 AM, Raimo Niskanen > wrote: > > Give us the result of: > > $ uname -a > > $ cat /etc/resolv.conf > > $ erl > > 1> inet_gethost_native:control({debug_level,4}). > > 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > > 3> ets:tab2list(inet_db). > > 4> ets:tab2list(inet_hosts). > > I'm away from the office right now so I can't test from my OS X > laptop, but below is the output from an OpenBSD machine and a Linux > machine there that both demonstrate the same misbehavior. (If > necessary, I'll rerun the test tomorrow on OS X.) > That it does not work on new Linuxes is a known issue. Linux took another path than Solaris and removed the IPv6 resolver functions inet_gethost_native uses. And that is something that has been on our todo list for a long time now. But since no paying customer needs it it remains a not high enough priority. These functions seem to work on a MacOS X Leopard box in our lab, there I get: inet_gethost_native:gethostbyname("ipv6.google.com", inet6). inet_gethost[63317] (DEBUG):Saved domainname .google.com. inet_gethost[63317] (DEBUG):Created worker[63418] with fd 3 inet_gethost[63317] (DEBUG):Saved domainname .google.com. inet_gethost[63418] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. {error,notfound} Not strange since we do not have working IPv6 here at work. So what is the problem with your MacOS X installation is what puzzels me. > > matthew@REDACTED:~$ uname -a > OpenBSD golem.mochimedia.net 4.3 GENERIC.MP#1559 amd64 > > matthew@REDACTED:~$ cat /etc/resolv.conf > search mochimedia.net > nameserver 127.0.0.1 > > matthew@REDACTED:~$ ping6 -c 1 ipv6.google.com > PING6(56=40+8+8 bytes) 2001:470:1f04:330::2 --> 2001:4860:0:1001::68 > 16 bytes from 2001:4860:0:1001::68, icmp_seq=0 hlim=57 time=174.165 ms > > --- ipv6.l.google.com ping6 statistics --- > 1 packets transmitted, 1 packets received, 0.0% packet loss > round-trip min/avg/max/std-dev = 174.165/174.165/174.165/0.000 ms > > matthew@REDACTED:~$ echo '{inet6, true}.' > inetrc > > matthew@REDACTED:~$ erl -kernel inetrc '"./inetrc"' > Erlang (BEAM) emulator version 5.6.1 [source] [64-bit] > [async-threads:0] [kernel-poll:false] > > Eshell V5.6.1 (abort with ^G) > 1> inet_gethost_native:control({debug_level,4}). > inet_gethost[29369] (DEBUG):debug_level = 4 > ok > 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > inet_gethost[29369] (DEBUG):Saved domainname .google.com. > inet_gethost[29369] (DEBUG):Created worker[6118] with fd 3 > inet_gethost[29369] (DEBUG):Saved domainname .google.com. > inet_gethost[6118] (DEBUG):Worker got request, op = 1, proto = 2, data > = ipv6.google.com. > {error,enotsup} > 3> ets:tab2list(inet_db). > [{socks5_noproxy,[]}, > {res_recurse,1}, > {res_id,0}, > {hostname,"golem"}, > {res_alt_ns,[]}, > {cache_refresh_interval,3600000}, > {res_inet6,true}, > {socks5_port,1080}, > {socks5_methods,[none]}, > {res_timeout,2000}, > {cache_size,100}, > {res_domain,"mochimedia.net"}, > {res_retry,3}, > {res_ns,[]}, > {res_lookup,[native]}, > {sctp_module,inet_sctp}, > {udp_module,inet_udp}, > {tcp_module,inet_tcp}, > {socks5_server,[]}, > {res_search,["mochimedia.net"]}, > {res_usevc,false}] > 4> ets:tab2list(inet_hosts). > [] > > > matthew@REDACTED:~$ uname -a > Linux lol 2.6.20-16-generic #2 SMP Tue Feb 12 02:11:24 UTC 2008 x86_64 GNU/Linux > > matthew@REDACTED:~$ cat /etc/resolv.conf > search mochimedia.net > nameserver 10.0.1.40 > > matthew@REDACTED:~$ ping6 -c 1 ipv6.google.com > PING ipv6.google.com(2001:4860:0:1001::68) 56 data bytes > 64 bytes from 2001:4860:0:1001::68: icmp_seq=1 ttl=56 time=174 ms > > --- ipv6.google.com ping statistics --- > 1 packets transmitted, 1 received, 0% packet loss, time 0ms > rtt min/avg/max/mdev = 174.967/174.967/174.967/0.000 ms > > matthew@REDACTED:~$ echo '{inet6, true}.' > inetrc > > matthew@REDACTED:~$ erl -kernel inetrc '"./inetrc"' > Erlang (BEAM) emulator version 5.6.1 [source] [64-bit] [smp:4] > [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.6.1 (abort with ^G) > 1> inet_gethost_native:control({debug_level,4}). > inet_gethost[8266] (DEBUG):debug_level = 4 > ok > 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > inet_gethost[8266] (DEBUG):Saved domainname .google.com. > inet_gethost[8266] (DEBUG):Created worker[8268] with fd 3 > inet_gethost[8266] (DEBUG):Saved domainname .google.com. > inet_gethost[8268] (DEBUG):Worker got request, op = 1, proto = 2, data > = ipv6.google.com. > {error,enotsup} > 3> ets:tab2list(inet_db). > [{socks5_noproxy,[]}, > {res_recurse,1}, > {res_id,0}, > {hostname,"lol"}, > {res_alt_ns,[]}, > {cache_refresh_interval,3600000}, > {res_inet6,true}, > {socks5_port,1080}, > {socks5_methods,[none]}, > {res_timeout,2000}, > {cache_size,100}, > {res_domain,"mochimedia.net"}, > {res_retry,3}, > {res_ns,[]}, > {res_lookup,[native]}, > {sctp_module,inet_sctp}, > {udp_module,inet_udp}, > {tcp_module,inet_tcp}, > {socks5_server,[]}, > {res_search,["mochimedia.net"]}, > {res_usevc,false}] > 4> ets:tab2list(inet_hosts). > [] > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From rtrlists@REDACTED Wed Apr 9 11:17:52 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 9 Apr 2008 10:17:52 +0100 Subject: [erlang-questions] CBSE anybody In-Reply-To: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> References: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> Message-ID: <6a3ae47e0804090217p64c82704s63350e8b96bc1b40@mail.gmail.com> Hi, for the diagrams Joe mentions, I am reminded of FMC (http://www.fmc-modeling.org/), which was mentioned on this list a little while back. This has two major diagram definitions: compositional structures and dynamic structures. (It also defines diagrams for entity-relationships.) These diagrams are simple and easy to understand. And the accompanying documentation is well written and short (intro and reference = 17 pages, visual guidelines = 37 pages). Worth a quick read at the least. I've not yet used this in anger, but for my next project I want to try using this (at least to satisfy the eternal requests for "can we have a diagram"). Robby From j.bhanot@REDACTED Wed Apr 9 11:18:46 2008 From: j.bhanot@REDACTED (J Bhanot) Date: Wed, 9 Apr 2008 14:48:46 +0530 Subject: [erlang-questions] Memory Issues Message-ID: Hi, Is there any memory issues with OTP - Release 12... I am also using erl_interface and sample MG/MGC scripts.... I keep getting these error messages - *** glibc detected *** ./cnode: malloc(): memory corruption: 0x09d17fe0 *** ======= Backtrace: ========= /lib/i686/nosegneg/libc.so.6[0x3d6de3] /lib/i686/nosegneg/libc.so.6(__libc_malloc+0x82)[0x3d8772] ./cnode[0x804c91e] ./cnode[0x804cbae] ./cnode[0x804ce12] ./cnode[0x804ebb1] /lib/i686/nosegneg/libc.so.6(__libc_start_main+0xe0)[0x382390] ./cnode(__gxx_personality_v0+0x1a9)[0x804a9f1] ======= Memory map: ======== 00110000-00111000 r-xp 00110000 00:00 0 [vdso] 00111000-0011c000 r-xp 00000000 fd:00 9503003 /home/ahlawat/project/lib/libUtils.so 0011c000-0011d000 rw-p 0000a000 fd:00 9503003 /home/ahlawat/project/lib/libUtils.so 0011d000-00128000 r-xp 00000000 fd:00 3704554 /lib/libgcc_s-4.1.2-20070925.so.1 00128000-00129000 rw-p 0000a000 fd:00 3704554 /lib/libgcc_s-4.1.2-20070925.so.1 00129000-00209000 r-xp 00000000 fd:00 5701081 /usr/lib/libstdc++.so.6.0.8 00209000-0020d000 r--p 000df000 fd:00 5701081 /usr/lib/libstdc++.so.6.0.8 0020d000-0020e000 rw-p 000e3000 fd:00 5701081 /usr/lib/libstdc++.so.6.0.8 0020e000-00214000 rw-p 0020e000 00:00 0 00214000-0021e000 r-xp 00000000 fd:00 3702892 /lib/libnss_files-2.7.so 0021e000-0021f000 r--p 00009000 fd:00 3702892 /lib/libnss_files-2.7.so 0021f000-00220000 rw-p 0000a000 fd:00 3702892 /lib/libnss_files-2.7.so 002e1000-002fb000 r-xp 00000000 fd:00 10029896 /home/j.bhanot/project/src/parser/libParserh2481.so 002fb000-002fc000 rw-p 00019000 fd:00 10029896 /home/j.bhanot/project/src/parser/libParserh2481.so 0034d000-00368000 r-xp 00000000 fd:00 3704544 /lib/ld-2.7.so 00368000-00369000 r--p 0001a000 fd:00 3704544 /lib/ld-2.7.so 00369000-0036a000 rw-p 0001b000 fd:00 3704544 /lib/ld-2.7.so 0036c000-004c2000 r-xp 00000000 fd:00 3704545 /lib/i686/nosegneg/libc-2.7.so 004c2000-004c4000 r--p 00156000 fd:00 3704545 /lib/i686/nosegneg/libc-2.7.so 004c4000-004c5000 rw-p 00158000 fd:00 3704545 /lib/i686/nosegneg/libc-2.7.so 004c5000-004c8000 rw-p 004c5000 00:00 0 004ca000-004f1000 r-xp 00000000 fd:00 3704550 /lib/i686/nosegneg/libm-2.7.so 004f1000-004f2000 r--p 00026000 fd:00 3704550 /lib/i686/nosegneg/libm-2.7.so 004f2000-004f3000 rw-p 00027000 fd:00 3704550 /lib/i686/nosegneg/libm-2.7.so 004fc000-00511000 r-xp 00000000 fd:00 3704548 /lib/i686/nosegneg/libpthread-2.7.so 00511000-00512000 r--p 00014000 fd:00 3704548 /lib/i686/nosegneg/libpthread-2.7.so 00512000-00513000 rw-p 00015000 fd:00 3704548 /lib/i686/nosegneg/libpthread-2.7.so 00513000-00515000 rw-p 00513000 00:00 0 00565000-005d0000 r-xp 00000000 fd:00 9405782 /opt/xerces-c-src_2_8_0/lib/libxerces-depdom.so.28.0 005d0000-005d3000 rw-p 0006a000 fd:00 9405782 /opt/xerces-c-src_2_8_0/lib/libxerces-depdom.so.28.0 00748000-00b04000 r-xp 00000000 fd:00 9405778 /opt/xerces-c-src_2_8_0/lib/libxerces-c.so.28.0 00b04000-00b37000 rw-p 003bc000 fd:00 9405778 /opt/xerces-c-src_2_8_0/lib/libxerces-c.so.28.0 00c49000-00c5e000 r-xp 00000000 fd:00 3704565 /lib/libnsl-2.7.so 00c5e000-00c5f000 r--p 00014000 fd:00 3704565 /lib/libnsl-2.7.so 00c5f000-00c60000 rw-p 00015000 fd:00 3704565 /lib/libnsl-2.7.so 00c60000-00c62000 rw-p 00c60000 00:00 0 08048000-08064000 r-xp 00000000 fd:00 10029916 /home/j.bhanot/project/src/parser/cnode 08064000-08065000 rw-p 0001c000 fd:00 10029916 /home/j.bhanot/project/src/parser/cnode 08065000-08066000 rw-p 08065000 00:00 0 09c5d000-09d77000 rw-p 09c5d000 00:00 0 b7d00000-b7d21000 rw-p b7d00000 00:00 0 b7d21000-b7e00000 ---p b7d21000 00:00 0 b7eeb000-b7eed000 rw-p b7eeb000 00:00 0 b7f05000-b7f0a000 rw-p b7f05000 00:00 0 bfcc0000-bfcd5000 rw-p bfcc0000 00:00 0 [stack] Aborted Thanking in anticipation... Regards, Jagmohan Bhanot Tata Consultancy Services Mailto: j.bhanot@REDACTED Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Wed Apr 9 11:20:54 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 09 Apr 2008 11:20:54 +0200 Subject: [erlang-questions] CBSE anybody In-Reply-To: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> References: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> Message-ID: <47FC8A76.8000408@ericsson.com> Joe Armstrong skrev: > > let's annotate the code - something like > > receive > {a_message, X,Y} -> > .... > {Pid, Bin} -> > event(in, "{get, "}), %% <- the annotation > that links the code to the protocol spec > term = binary_to_term(Bin), > ... > > end I'd like to see a standard module in OTP that has some strategic functions like this. The main purpose of the functions would be "executable comments", and since they are executable, they are also traceable. Using them, we could produce a software equivalent to "as-builts" in run-time. As-builts, are e.g. blueprints of a house, indicating how the house was actually built - not how the architect conceived it. They can be the architectural blueprints with lots of scribbling on top. While one may argue that this is solved by round-trip engineering, the round-trip usually only extends to include hand-written code - not visualizing the dynamic behavior of the code. > Can anybody recommend any books here that might enlighten > me or should I just buy a dozen or so and read them all? I should have a copy of Schlaer-Mellor's "Object Lifecycles: Modeling the world in states" in my bookshelf at the office. http://www.amazon.com/Object-Life-Cycles-Modeling-Computing/dp/0136299407 You can leaf through it at will. BR, Ulf W From vychodil.hynek@REDACTED Wed Apr 9 11:20:54 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 9 Apr 2008 11:20:54 +0200 Subject: [erlang-questions] Defining static functions in abstract modules In-Reply-To: References: Message-ID: <4d08db370804090220i4d85589av2204315905662b02@mail.gmail.com> UGH, static functions? Where is benefit to do it? What matter? I don't understand. On Wed, Apr 9, 2008 at 11:04 AM, Matthew Dempsky wrote: > It would be nice to be able to define arbitrary static functions > within an abstract module. Right now you can kludge around this by > exploiting that local functions named 'new' are always static and > write something like > > new(incr, X) -> X + 1. > > but it would be nicer to just write > > -static([incr/1]). > incr(X) -> X + 1. > > Below is a very rudimentary patch that adds support for this syntax. > It's basically only enough to compile and run very simple test cases > and to demonstrate that implementing this does not seem too difficult. > (One problem I'm already aware of is that a static function foo/1 and > an instance function foo/0 silently collide without any warning... so > don't do that. ;-)) > > Another option would be to make the attribute statement just > "-static([incr])." and then all incr functions are defined static, but > that seems unnecessarily limiting. > > If the long-term goal is to have separate namespaces for static and > instance functions (e.g., so (Mod:new(...)):module_info() works and > returns something meaningful for the module instance), then maybe a > syntax that actually decorates individual function definitions would > be better? > > Are there any plans on adding static functions in a future release? > > > --- stdlib/src/erl_parse.yrl.orig 2007-11-27 07:57:32.000000000 > -0800 > +++ stdlib/src/erl_parse.yrl 2008-04-09 01:25:31.000000000 -0700 > @@ -627,6 +627,12 @@ > {attribute,La,export,farity_list(ExpList)}; > _Other -> error_bad_decl(La, export) > end; > +build_attribute({atom,La,static}, Val) -> > + case Val of > + [ExpList] -> > + {attribute,La,static,farity_list(ExpList)}; > + _Other -> error_bad_decl(La, static) > + end; > build_attribute({atom,La,import}, Val) -> > case Val of > [Name] -> > --- compiler/src/sys_pre_expand.erl.orig 2008-02-05 > 05:37:09.000000000 -0800 > +++ compiler/src/sys_pre_expand.erl 2008-04-09 01:26:06.000000000 > -0700 > @@ -38,6 +38,7 @@ > parameters=undefined, %Module parameters > package="", %Module package > exports=[], %Exports > + statics=[], %Statics > imports=[], %Imports > mod_imports, %Module Imports > compile=[], %Compile flags > @@ -109,6 +110,7 @@ > end, > {Fs1,Xs,Ds} = sys_expand_pmod:forms(Fs0, Ps, > St0#expand.exports, > + St0#expand.statics, > St0#expand.defined), > St1 = St0#expand{exports=Xs, defined=Ds}, > {Fs2,St2} = add_instance(Ps, Fs1, St1), > @@ -220,6 +222,8 @@ > package = packages:strip_last(M)}; > attribute(export, Es, St) -> > St#expand{exports=union(from_list(Es), St#expand.exports)}; > +attribute(static, Ss, St) -> > + St#expand{statics=union(from_list(Ss), St#expand.statics)}; > attribute(import, Is, St) -> > import(Is, St); > attribute(compile, C, St) when is_list(C) -> > --- compiler/src/sys_expand_pmod.erl.orig 2008-02-05 > 05:38:12.000000000 -0800 > +++ compiler/src/sys_expand_pmod.erl 2008-04-09 01:32:36.000000000 > -0700 > @@ -25,18 +25,19 @@ > %% and 'exports'. The automatic 'new/N' function is neither added to the > %% definitions nor to the 'exports'/'defines' lists yet. > > --export([forms/4]). > +-export([forms/5]). > > --record(pmod, {parameters, exports, defined, predef}). > +-record(pmod, {parameters, exports, statics, defined, predef}). > > %% TODO: more abstract handling of predefined/static functions. > > -forms(Fs0, Ps, Es0, Ds0) -> > +forms(Fs0, Ps, Es0, Ss0, Ds0) -> > PreDef = [{module_info,0},{module_info,1}], > - forms(Fs0, Ps, Es0, Ds0, PreDef). > + forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef). > > -forms(Fs0, Ps, Es0, Ds0, PreDef) -> > - St0 = #pmod{parameters=Ps,exports=Es0,defined=Ds0, predef=PreDef}, > +forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef) -> > + St0 = #pmod{parameters=Ps,exports=Es0,statics=Ss0,defined=Ds0, > + predef=PreDef}, > {Fs1, St1} = forms(Fs0, St0), > Es1 = update_function_names(Es0, St1), > Ds1 = update_function_names(Ds0, St1), > @@ -50,15 +51,22 @@ > [update_function_name(E, St) || E <- Es]. > > update_function_name(E={F,A}, St) when F =/= new -> > - case ordsets:is_element(E, St#pmod.predef) of > + case ordsets:is_element(E, St#pmod.predef) orelse > + ordsets:is_element(E, St#pmod.statics) of > true -> E; > false -> {F, A + 1} > end; > update_function_name(E, _St) -> > E. > > -update_forms([{function,L,N,A,Cs}|Fs],St) when N =/= new -> > - [{function,L,N,A+1,Cs}|update_forms(Fs,St)]; > +update_forms([F0={function,L,N,A,Cs}|Fs],St) when N =/= new -> > + F = case ordsets:is_element({N,A}, St#pmod.statics) of > + true -> > + F0; > + false -> > + {function,L,N,A+1,Cs} > + end, > + [F|update_forms(Fs,St)]; > update_forms([F|Fs],St) -> > [F|update_forms(Fs,St)]; > update_forms([],_St) -> > @@ -74,9 +82,14 @@ > {[], St0}. > > %% Only function definitions are of interest here. State is not updated. > -form({function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> > - {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), > - {{function,Line,Name,Arity,Clauses},St}; > +form(F = {function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> > + case ordsets:is_element({Name0, Arity0}, St#pmod.statics) of > + true -> > + {F,St}; > + false -> > + {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), > + {{function,Line,Name,Arity,Clauses},St} > + end; > %% Pass anything else through > form(F,St) -> {F,St}. > > @@ -362,7 +375,13 @@ > expr({call,Lc,{atom,Lf,F},As0},St) -> > %% Local function call - needs THIS parameter. > As1 = expr_list(As0,St), > - {call,Lc,{atom,Lf,F},As1 ++ [{var,0,'THIS'}]}; > + As2 = case ordsets:is_element({F, length(As1)}, St#pmod.statics) of > + true -> > + As1; > + false -> > + As1 ++ [{var,0,'THIS'}] > + end, > + {call,Lc,{atom,Lf,F},As2}; > expr({call,Line,F0,As0},St) -> > %% Other function call > F1 = expr(F0,St), > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Wed Apr 9 11:21:37 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 02:21:37 -0700 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <20080409090411.GA11590@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> Message-ID: On Wed, Apr 9, 2008 at 2:04 AM, Raimo Niskanen wrote: > That it does not work on new Linuxes is a known issue. > Linux took another path than Solaris and removed the > IPv6 resolver functions inet_gethost_native uses. > And that is something that has been on our todo > list for a long time now. But since no paying customer > needs it it remains a not high enough priority. Is there any technical argument for using getipnodebyname in favor of getaddrinfo? Would a patch to inet_gethost to use the latter instead be accepted? > So what is the problem with your MacOS X installation is > what puzzels me. Okay, I'll send a report tomorrow from OS X when I have a chance. From matthew@REDACTED Wed Apr 9 11:22:46 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 02:22:46 -0700 Subject: [erlang-questions] Defining static functions in abstract modules In-Reply-To: <4d08db370804090220i4d85589av2204315905662b02@mail.gmail.com> References: <4d08db370804090220i4d85589av2204315905662b02@mail.gmail.com> Message-ID: Because I want to be able to abstract away how to instantiate a module, and I want to be able to define internal helper functions to do it, and I want to be able to call them "foo(X)" instead of "new(foo, X)". On Wed, Apr 9, 2008 at 2:20 AM, Hynek Vychodil wrote: > UGH, static functions? Where is benefit to do it? What matter? I don't > understand. > > > > On Wed, Apr 9, 2008 at 11:04 AM, Matthew Dempsky > wrote: > > > > > > > > > It would be nice to be able to define arbitrary static functions > > within an abstract module. Right now you can kludge around this by > > exploiting that local functions named 'new' are always static and > > write something like > > > > new(incr, X) -> X + 1. > > > > but it would be nicer to just write > > > > -static([incr/1]). > > incr(X) -> X + 1. > > > > Below is a very rudimentary patch that adds support for this syntax. > > It's basically only enough to compile and run very simple test cases > > and to demonstrate that implementing this does not seem too difficult. > > (One problem I'm already aware of is that a static function foo/1 and > > an instance function foo/0 silently collide without any warning... so > > don't do that. ;-)) > > > > Another option would be to make the attribute statement just > > "-static([incr])." and then all incr functions are defined static, but > > that seems unnecessarily limiting. > > > > If the long-term goal is to have separate namespaces for static and > > instance functions (e.g., so (Mod:new(...)):module_info() works and > > returns something meaningful for the module instance), then maybe a > > syntax that actually decorates individual function definitions would > > be better? > > > > Are there any plans on adding static functions in a future release? > > > > > > --- stdlib/src/erl_parse.yrl.orig 2007-11-27 07:57:32.000000000 > -0800 > > +++ stdlib/src/erl_parse.yrl 2008-04-09 01:25:31.000000000 -0700 > > @@ -627,6 +627,12 @@ > > {attribute,La,export,farity_list(ExpList)}; > > _Other -> error_bad_decl(La, export) > > end; > > +build_attribute({atom,La,static}, Val) -> > > + case Val of > > + [ExpList] -> > > + {attribute,La,static,farity_list(ExpList)}; > > + _Other -> error_bad_decl(La, static) > > + end; > > build_attribute({atom,La,import}, Val) -> > > case Val of > > [Name] -> > > --- compiler/src/sys_pre_expand.erl.orig 2008-02-05 > 05:37:09.000000000 -0800 > > +++ compiler/src/sys_pre_expand.erl 2008-04-09 01:26:06.000000000 > -0700 > > @@ -38,6 +38,7 @@ > > parameters=undefined, %Module parameters > > package="", %Module package > > exports=[], %Exports > > + statics=[], %Statics > > imports=[], %Imports > > mod_imports, %Module Imports > > compile=[], %Compile flags > > @@ -109,6 +110,7 @@ > > end, > > {Fs1,Xs,Ds} = sys_expand_pmod:forms(Fs0, Ps, > > St0#expand.exports, > > + St0#expand.statics, > > St0#expand.defined), > > St1 = St0#expand{exports=Xs, defined=Ds}, > > {Fs2,St2} = add_instance(Ps, Fs1, St1), > > @@ -220,6 +222,8 @@ > > package = packages:strip_last(M)}; > > attribute(export, Es, St) -> > > St#expand{exports=union(from_list(Es), St#expand.exports)}; > > +attribute(static, Ss, St) -> > > + St#expand{statics=union(from_list(Ss), St#expand.statics)}; > > attribute(import, Is, St) -> > > import(Is, St); > > attribute(compile, C, St) when is_list(C) -> > > --- compiler/src/sys_expand_pmod.erl.orig 2008-02-05 > 05:38:12.000000000 -0800 > > +++ compiler/src/sys_expand_pmod.erl 2008-04-09 01:32:36.000000000 > -0700 > > @@ -25,18 +25,19 @@ > > %% and 'exports'. The automatic 'new/N' function is neither added to the > > %% definitions nor to the 'exports'/'defines' lists yet. > > > > --export([forms/4]). > > +-export([forms/5]). > > > > --record(pmod, {parameters, exports, defined, predef}). > > +-record(pmod, {parameters, exports, statics, defined, predef}). > > > > %% TODO: more abstract handling of predefined/static functions. > > > > -forms(Fs0, Ps, Es0, Ds0) -> > > +forms(Fs0, Ps, Es0, Ss0, Ds0) -> > > PreDef = [{module_info,0},{module_info,1}], > > - forms(Fs0, Ps, Es0, Ds0, PreDef). > > + forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef). > > > > -forms(Fs0, Ps, Es0, Ds0, PreDef) -> > > - St0 = #pmod{parameters=Ps,exports=Es0,defined=Ds0, predef=PreDef}, > > +forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef) -> > > + St0 = #pmod{parameters=Ps,exports=Es0,statics=Ss0,defined=Ds0, > > + predef=PreDef}, > > {Fs1, St1} = forms(Fs0, St0), > > Es1 = update_function_names(Es0, St1), > > Ds1 = update_function_names(Ds0, St1), > > @@ -50,15 +51,22 @@ > > [update_function_name(E, St) || E <- Es]. > > > > update_function_name(E={F,A}, St) when F =/= new -> > > - case ordsets:is_element(E, St#pmod.predef) of > > + case ordsets:is_element(E, St#pmod.predef) orelse > > + ordsets:is_element(E, St#pmod.statics) of > > true -> E; > > false -> {F, A + 1} > > end; > > update_function_name(E, _St) -> > > E. > > > > -update_forms([{function,L,N,A,Cs}|Fs],St) when N =/= new -> > > - [{function,L,N,A+1,Cs}|update_forms(Fs,St)]; > > +update_forms([F0={function,L,N,A,Cs}|Fs],St) when N =/= new -> > > + F = case ordsets:is_element({N,A}, St#pmod.statics) of > > + true -> > > + F0; > > + false -> > > + {function,L,N,A+1,Cs} > > + end, > > + [F|update_forms(Fs,St)]; > > update_forms([F|Fs],St) -> > > [F|update_forms(Fs,St)]; > > update_forms([],_St) -> > > @@ -74,9 +82,14 @@ > > {[], St0}. > > > > %% Only function definitions are of interest here. State is not updated. > > -form({function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> > > - {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), > > - {{function,Line,Name,Arity,Clauses},St}; > > +form(F = {function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> > > + case ordsets:is_element({Name0, Arity0}, St#pmod.statics) of > > + true -> > > + {F,St}; > > + false -> > > + {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), > > + {{function,Line,Name,Arity,Clauses},St} > > + end; > > %% Pass anything else through > > form(F,St) -> {F,St}. > > > > @@ -362,7 +375,13 @@ > > expr({call,Lc,{atom,Lf,F},As0},St) -> > > %% Local function call - needs THIS parameter. > > As1 = expr_list(As0,St), > > - {call,Lc,{atom,Lf,F},As1 ++ [{var,0,'THIS'}]}; > > + As2 = case ordsets:is_element({F, length(As1)}, St#pmod.statics) of > > + true -> > > + As1; > > + false -> > > + As1 ++ [{var,0,'THIS'}] > > + end, > > + {call,Lc,{atom,Lf,F},As2}; > > expr({call,Line,F0,As0},St) -> > > %% Other function call > > F1 = expr(F0,St), > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > --Hynek (Pichi) Vychodil From vychodil.hynek@REDACTED Wed Apr 9 11:37:38 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 9 Apr 2008 11:37:38 +0200 Subject: [erlang-questions] Defining static functions in abstract modules In-Reply-To: References: <4d08db370804090220i4d85589av2204315905662b02@mail.gmail.com> Message-ID: <4d08db370804090237odbc8aeai575693d25042a7b9@mail.gmail.com> Still don't understand. Internal helper functions should be internally in which? From where you want call "foo(X)"? Where you would like to define "foo(X)"? On Wed, Apr 9, 2008 at 11:22 AM, Matthew Dempsky wrote: > Because I want to be able to abstract away how to instantiate a > module, and I want to be able to define internal helper functions to > do it, and I want to be able to call them "foo(X)" instead of > "new(foo, X)". > > On Wed, Apr 9, 2008 at 2:20 AM, Hynek Vychodil > wrote: > > UGH, static functions? Where is benefit to do it? What matter? I don't > > understand. > > > > > > > > On Wed, Apr 9, 2008 at 11:04 AM, Matthew Dempsky > > wrote: > > > > > > > > > > > > > > It would be nice to be able to define arbitrary static functions > > > within an abstract module. Right now you can kludge around this by > > > exploiting that local functions named 'new' are always static and > > > write something like > > > > > > new(incr, X) -> X + 1. > > > > > > but it would be nicer to just write > > > > > > -static([incr/1]). > > > incr(X) -> X + 1. > > > > > > Below is a very rudimentary patch that adds support for this syntax. > > > It's basically only enough to compile and run very simple test cases > > > and to demonstrate that implementing this does not seem too difficult. > > > (One problem I'm already aware of is that a static function foo/1 and > > > an instance function foo/0 silently collide without any warning... so > > > don't do that. ;-)) > > > > > > Another option would be to make the attribute statement just > > > "-static([incr])." and then all incr functions are defined static, but > > > that seems unnecessarily limiting. > > > > > > If the long-term goal is to have separate namespaces for static and > > > instance functions (e.g., so (Mod:new(...)):module_info() works and > > > returns something meaningful for the module instance), then maybe a > > > syntax that actually decorates individual function definitions would > > > be better? > > > > > > Are there any plans on adding static functions in a future release? > > > > > > > > > --- stdlib/src/erl_parse.yrl.orig 2007-11-27 07:57:32.000000000 > > -0800 > > > +++ stdlib/src/erl_parse.yrl 2008-04-09 01:25:31.000000000 -0700 > > > @@ -627,6 +627,12 @@ > > > {attribute,La,export,farity_list(ExpList)}; > > > _Other -> error_bad_decl(La, export) > > > end; > > > +build_attribute({atom,La,static}, Val) -> > > > + case Val of > > > + [ExpList] -> > > > + {attribute,La,static,farity_list(ExpList)}; > > > + _Other -> error_bad_decl(La, static) > > > + end; > > > build_attribute({atom,La,import}, Val) -> > > > case Val of > > > [Name] -> > > > --- compiler/src/sys_pre_expand.erl.orig 2008-02-05 > > 05:37:09.000000000 -0800 > > > +++ compiler/src/sys_pre_expand.erl 2008-04-09 01:26:06.000000000 > > -0700 > > > @@ -38,6 +38,7 @@ > > > parameters=undefined, %Module parameters > > > package="", %Module package > > > exports=[], %Exports > > > + statics=[], %Statics > > > imports=[], %Imports > > > mod_imports, %Module Imports > > > compile=[], %Compile flags > > > @@ -109,6 +110,7 @@ > > > end, > > > {Fs1,Xs,Ds} = sys_expand_pmod:forms(Fs0, Ps, > > > St0#expand.exports, > > > + St0#expand.statics, > > > St0#expand.defined), > > > St1 = St0#expand{exports=Xs, defined=Ds}, > > > {Fs2,St2} = add_instance(Ps, Fs1, St1), > > > @@ -220,6 +222,8 @@ > > > package = packages:strip_last(M)}; > > > attribute(export, Es, St) -> > > > St#expand{exports=union(from_list(Es), St#expand.exports)}; > > > +attribute(static, Ss, St) -> > > > + St#expand{statics=union(from_list(Ss), St#expand.statics)}; > > > attribute(import, Is, St) -> > > > import(Is, St); > > > attribute(compile, C, St) when is_list(C) -> > > > --- compiler/src/sys_expand_pmod.erl.orig 2008-02-05 > > 05:38:12.000000000 -0800 > > > +++ compiler/src/sys_expand_pmod.erl 2008-04-09 01:32:36.000000000 > > -0700 > > > @@ -25,18 +25,19 @@ > > > %% and 'exports'. The automatic 'new/N' function is neither added to > the > > > %% definitions nor to the 'exports'/'defines' lists yet. > > > > > > --export([forms/4]). > > > +-export([forms/5]). > > > > > > --record(pmod, {parameters, exports, defined, predef}). > > > +-record(pmod, {parameters, exports, statics, defined, predef}). > > > > > > %% TODO: more abstract handling of predefined/static functions. > > > > > > -forms(Fs0, Ps, Es0, Ds0) -> > > > +forms(Fs0, Ps, Es0, Ss0, Ds0) -> > > > PreDef = [{module_info,0},{module_info,1}], > > > - forms(Fs0, Ps, Es0, Ds0, PreDef). > > > + forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef). > > > > > > -forms(Fs0, Ps, Es0, Ds0, PreDef) -> > > > - St0 = #pmod{parameters=Ps,exports=Es0,defined=Ds0, > predef=PreDef}, > > > +forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef) -> > > > + St0 = #pmod{parameters=Ps,exports=Es0,statics=Ss0,defined=Ds0, > > > + predef=PreDef}, > > > {Fs1, St1} = forms(Fs0, St0), > > > Es1 = update_function_names(Es0, St1), > > > Ds1 = update_function_names(Ds0, St1), > > > @@ -50,15 +51,22 @@ > > > [update_function_name(E, St) || E <- Es]. > > > > > > update_function_name(E={F,A}, St) when F =/= new -> > > > - case ordsets:is_element(E, St#pmod.predef) of > > > + case ordsets:is_element(E, St#pmod.predef) orelse > > > + ordsets:is_element(E, St#pmod.statics) of > > > true -> E; > > > false -> {F, A + 1} > > > end; > > > update_function_name(E, _St) -> > > > E. > > > > > > -update_forms([{function,L,N,A,Cs}|Fs],St) when N =/= new -> > > > - [{function,L,N,A+1,Cs}|update_forms(Fs,St)]; > > > +update_forms([F0={function,L,N,A,Cs}|Fs],St) when N =/= new -> > > > + F = case ordsets:is_element({N,A}, St#pmod.statics) of > > > + true -> > > > + F0; > > > + false -> > > > + {function,L,N,A+1,Cs} > > > + end, > > > + [F|update_forms(Fs,St)]; > > > update_forms([F|Fs],St) -> > > > [F|update_forms(Fs,St)]; > > > update_forms([],_St) -> > > > @@ -74,9 +82,14 @@ > > > {[], St0}. > > > > > > %% Only function definitions are of interest here. State is not > updated. > > > -form({function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> > > > - {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), > > > - {{function,Line,Name,Arity,Clauses},St}; > > > +form(F = {function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new > -> > > > + case ordsets:is_element({Name0, Arity0}, St#pmod.statics) of > > > + true -> > > > + {F,St}; > > > + false -> > > > + {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, > St), > > > + {{function,Line,Name,Arity,Clauses},St} > > > + end; > > > %% Pass anything else through > > > form(F,St) -> {F,St}. > > > > > > @@ -362,7 +375,13 @@ > > > expr({call,Lc,{atom,Lf,F},As0},St) -> > > > %% Local function call - needs THIS parameter. > > > As1 = expr_list(As0,St), > > > - {call,Lc,{atom,Lf,F},As1 ++ [{var,0,'THIS'}]}; > > > + As2 = case ordsets:is_element({F, length(As1)}, St#pmod.statics) > of > > > + true -> > > > + As1; > > > + false -> > > > + As1 ++ [{var,0,'THIS'}] > > > + end, > > > + {call,Lc,{atom,Lf,F},As2}; > > > expr({call,Line,F0,As0},St) -> > > > %% Other function call > > > F1 = expr(F0,St), > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > -- > > --Hynek (Pichi) Vychodil > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Wed Apr 9 02:40:59 2008 From: tony@REDACTED (Tony Rogvall) Date: Wed, 9 Apr 2008 02:40:59 +0200 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: References: <275956F4-4005-4419-BEAF-0CB12F70D3A1@rogvall.se> Message-ID: <607B1E21-ECE7-4BF3-9FEA-A1EB5AEB246D@rogvall.se> I you do this: inet_db:set_lookup([dns]). inet_db:add_ns({A,B,C,D}). %% Name server must be IPv4, there is a fixme in inet_db. inet:getaddr("ipv6.google.com", inet6). {ok,{8193,18528,0,4097,0,0,0,104}} /Tony On 9 apr 2008, at 01.42, Matthew Dempsky wrote: > On Tue, Apr 8, 2008 at 4:22 PM, Tony Rogvall wrote: >> Make sure the {inet6, Bool} in the inetrc is set to true? >> >> See ERTS User's Guide / Inet configuration. > > Makes no difference. DNS cache still only shows an A query. > > matthew@REDACTED:/tmp$ echo '{inet6, true}.' > inetrc > matthew@REDACTED:/tmp$ erl -kernel inetrc '"/tmp/inetrc"' > Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] > [async-threads:0] [kernel-poll:false] > > Eshell V5.6.1 (abort with ^G) > 1> inet:getaddr("ipv6.google.com", inet6). > {error,nxdomain} From alpar@REDACTED Wed Apr 9 11:48:45 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Wed, 09 Apr 2008 10:48:45 +0100 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <6ce0ac130804081529x70c49aabqaffdb6b327accb01@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <6ce0ac130804081529x70c49aabqaffdb6b327accb01@mail.gmail.com> Message-ID: <1207734525.4404.14.camel@piko.site> You may also want to consider using the Boost license (http://boost.org/users/license.html ). It is essentially the same as the BSD license, but the Boost people asked for help from the Berkman Cernter for Internet & Sociely at Harvard Law School to create it. The result is a simple to read and understand license that represents good legal practice in every sense. Regards, Alpar On Tue, 2008-04-08 at 16:29 -0600, Brian Granger wrote: > Unless you want the protections that the GPL offers, I think the BSD > license is probably the best choice. But, if you do go the GPL route, > I would recommend choosing GPLv2. > > Brian > > 2008/4/8 Robert Virding : > > Hello everyone, > > > > I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). > > With the last version I got some flak for my "license" and I am now > > wondering which license to use? GPL seems common among other Erlang > > projects, but how does this fit together with the normal Erlang license? The > > Freebsd license is short enough so even I can understand but is it valid. I > > have no interest in selling* LFE or prohibiting its use, I just want to make > > sure I receive credit for my work and that no one "steals" it in that > > respect. I nice courteous we are using would also be nice, good for the ego. > > > > What do people think? > > > > Robert > > > > * As if anyone would buy it. :-) > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Wed Apr 9 11:53:09 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 9 Apr 2008 11:53:09 +0200 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> Message-ID: <20080409095309.GA12130@erix.ericsson.se> On Wed, Apr 09, 2008 at 02:21:37AM -0700, Matthew Dempsky wrote: > On Wed, Apr 9, 2008 at 2:04 AM, Raimo Niskanen > wrote: > > That it does not work on new Linuxes is a known issue. > > Linux took another path than Solaris and removed the > > IPv6 resolver functions inet_gethost_native uses. > > And that is something that has been on our todo > > list for a long time now. But since no paying customer > > needs it it remains a not high enough priority. > > Is there any technical argument for using getipnodebyname in favor of > getaddrinfo? Would a patch to inet_gethost to use the latter instead > be accepted? If I recall correctly we already got a patch for that, but it broke some test cases. I think there were problems with how to find alias names for the generated hostent structs that was not supported with getaddrinfo. So there were things to consider... A new patch would be nice, or to get the old again. Otherwise I would have to find the old by myself. > > > So what is the problem with your MacOS X installation is > > what puzzels me. > > Okay, I'll send a report tomorrow from OS X when I have a chance. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From matthew@REDACTED Wed Apr 9 11:53:35 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 02:53:35 -0700 Subject: [erlang-questions] Defining static functions in abstract modules In-Reply-To: <4d08db370804090237odbc8aeai575693d25042a7b9@mail.gmail.com> References: <4d08db370804090220i4d85589av2204315905662b02@mail.gmail.com> <4d08db370804090237odbc8aeai575693d25042a7b9@mail.gmail.com> Message-ID: I have an abstract module zap. I have a client module quux. quux should not know about zap's internals, in particular the abstract module parameters. I can hide the abstract module parameters by writing a custom zap:new function to handle instantiating the zap module. However, because zap:new is not entirely trivial, I would like to define helper functions. These helper functions don't make sense outside of implementing zap, so I'd prefer to define them within the same file as zap:new. zap:new cannot call other functions in zap except for zap:new, zap:instance, and zap:module_info/{0,1}. If I want to define a static zap:foo/1 function to help in implementing zap:new/1, I can work around this by defining a zap:new/2 function with a form like "new(foo, X) -> ....". But that's gross. I could define a zap_static module for the static helper functions, but then I have to do extra work when changing the parameters to the helper functions. On Wed, Apr 9, 2008 at 2:37 AM, Hynek Vychodil wrote: > Still don't understand. Internal helper functions should be internally in > which? From where you want call "foo(X)"? Where you would like to define > "foo(X)"? > > > > On Wed, Apr 9, 2008 at 11:22 AM, Matthew Dempsky > wrote: > > > Because I want to be able to abstract away how to instantiate a > > module, and I want to be able to define internal helper functions to > > do it, and I want to be able to call them "foo(X)" instead of > > "new(foo, X)". > > > > > > > > > > On Wed, Apr 9, 2008 at 2:20 AM, Hynek Vychodil > wrote: > > > UGH, static functions? Where is benefit to do it? What matter? I don't > > > understand. > > > > > > > > > > > > On Wed, Apr 9, 2008 at 11:04 AM, Matthew Dempsky > > > wrote: > > > > > > > > > > > > > > > > > > > It would be nice to be able to define arbitrary static functions > > > > within an abstract module. Right now you can kludge around this by > > > > exploiting that local functions named 'new' are always static and > > > > write something like > > > > > > > > new(incr, X) -> X + 1. > > > > > > > > but it would be nicer to just write > > > > > > > > -static([incr/1]). > > > > incr(X) -> X + 1. > > > > > > > > Below is a very rudimentary patch that adds support for this syntax. > > > > It's basically only enough to compile and run very simple test cases > > > > and to demonstrate that implementing this does not seem too difficult. > > > > (One problem I'm already aware of is that a static function foo/1 and > > > > an instance function foo/0 silently collide without any warning... so > > > > don't do that. ;-)) > > > > > > > > Another option would be to make the attribute statement just > > > > "-static([incr])." and then all incr functions are defined static, but > > > > that seems unnecessarily limiting. > > > > > > > > If the long-term goal is to have separate namespaces for static and > > > > instance functions (e.g., so (Mod:new(...)):module_info() works and > > > > returns something meaningful for the module instance), then maybe a > > > > syntax that actually decorates individual function definitions would > > > > be better? > > > > > > > > Are there any plans on adding static functions in a future release? > > > > > > > > > > > > --- stdlib/src/erl_parse.yrl.orig 2007-11-27 07:57:32.000000000 > > > -0800 > > > > +++ stdlib/src/erl_parse.yrl 2008-04-09 01:25:31.000000000 -0700 > > > > @@ -627,6 +627,12 @@ > > > > {attribute,La,export,farity_list(ExpList)}; > > > > _Other -> error_bad_decl(La, export) > > > > end; > > > > +build_attribute({atom,La,static}, Val) -> > > > > + case Val of > > > > + [ExpList] -> > > > > + {attribute,La,static,farity_list(ExpList)}; > > > > + _Other -> error_bad_decl(La, static) > > > > + end; > > > > build_attribute({atom,La,import}, Val) -> > > > > case Val of > > > > [Name] -> > > > > --- compiler/src/sys_pre_expand.erl.orig 2008-02-05 > > > 05:37:09.000000000 -0800 > > > > +++ compiler/src/sys_pre_expand.erl 2008-04-09 01:26:06.000000000 > > > -0700 > > > > @@ -38,6 +38,7 @@ > > > > parameters=undefined, %Module parameters > > > > package="", %Module package > > > > exports=[], %Exports > > > > + statics=[], %Statics > > > > imports=[], %Imports > > > > mod_imports, %Module Imports > > > > compile=[], %Compile flags > > > > @@ -109,6 +110,7 @@ > > > > end, > > > > {Fs1,Xs,Ds} = sys_expand_pmod:forms(Fs0, Ps, > > > > St0#expand.exports, > > > > + St0#expand.statics, > > > > St0#expand.defined), > > > > St1 = St0#expand{exports=Xs, defined=Ds}, > > > > {Fs2,St2} = add_instance(Ps, Fs1, St1), > > > > @@ -220,6 +222,8 @@ > > > > package = packages:strip_last(M)}; > > > > attribute(export, Es, St) -> > > > > St#expand{exports=union(from_list(Es), St#expand.exports)}; > > > > +attribute(static, Ss, St) -> > > > > + St#expand{statics=union(from_list(Ss), St#expand.statics)}; > > > > attribute(import, Is, St) -> > > > > import(Is, St); > > > > attribute(compile, C, St) when is_list(C) -> > > > > --- compiler/src/sys_expand_pmod.erl.orig 2008-02-05 > > > 05:38:12.000000000 -0800 > > > > +++ compiler/src/sys_expand_pmod.erl 2008-04-09 01:32:36.000000000 > > > -0700 > > > > @@ -25,18 +25,19 @@ > > > > %% and 'exports'. The automatic 'new/N' function is neither added to > the > > > > %% definitions nor to the 'exports'/'defines' lists yet. > > > > > > > > --export([forms/4]). > > > > +-export([forms/5]). > > > > > > > > --record(pmod, {parameters, exports, defined, predef}). > > > > +-record(pmod, {parameters, exports, statics, defined, predef}). > > > > > > > > %% TODO: more abstract handling of predefined/static functions. > > > > > > > > -forms(Fs0, Ps, Es0, Ds0) -> > > > > +forms(Fs0, Ps, Es0, Ss0, Ds0) -> > > > > PreDef = [{module_info,0},{module_info,1}], > > > > - forms(Fs0, Ps, Es0, Ds0, PreDef). > > > > + forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef). > > > > > > > > -forms(Fs0, Ps, Es0, Ds0, PreDef) -> > > > > - St0 = #pmod{parameters=Ps,exports=Es0,defined=Ds0, > predef=PreDef}, > > > > +forms(Fs0, Ps, Es0, Ss0, Ds0, PreDef) -> > > > > + St0 = #pmod{parameters=Ps,exports=Es0,statics=Ss0,defined=Ds0, > > > > + predef=PreDef}, > > > > {Fs1, St1} = forms(Fs0, St0), > > > > Es1 = update_function_names(Es0, St1), > > > > Ds1 = update_function_names(Ds0, St1), > > > > @@ -50,15 +51,22 @@ > > > > [update_function_name(E, St) || E <- Es]. > > > > > > > > update_function_name(E={F,A}, St) when F =/= new -> > > > > - case ordsets:is_element(E, St#pmod.predef) of > > > > + case ordsets:is_element(E, St#pmod.predef) orelse > > > > + ordsets:is_element(E, St#pmod.statics) of > > > > true -> E; > > > > false -> {F, A + 1} > > > > end; > > > > update_function_name(E, _St) -> > > > > E. > > > > > > > > -update_forms([{function,L,N,A,Cs}|Fs],St) when N =/= new -> > > > > - [{function,L,N,A+1,Cs}|update_forms(Fs,St)]; > > > > +update_forms([F0={function,L,N,A,Cs}|Fs],St) when N =/= new -> > > > > + F = case ordsets:is_element({N,A}, St#pmod.statics) of > > > > + true -> > > > > + F0; > > > > + false -> > > > > + {function,L,N,A+1,Cs} > > > > + end, > > > > + [F|update_forms(Fs,St)]; > > > > update_forms([F|Fs],St) -> > > > > [F|update_forms(Fs,St)]; > > > > update_forms([],_St) -> > > > > @@ -74,9 +82,14 @@ > > > > {[], St0}. > > > > > > > > %% Only function definitions are of interest here. State is not > updated. > > > > -form({function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> > > > > - {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), > > > > - {{function,Line,Name,Arity,Clauses},St}; > > > > +form(F = {function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new > -> > > > > + case ordsets:is_element({Name0, Arity0}, St#pmod.statics) of > > > > + true -> > > > > + {F,St}; > > > > + false -> > > > > + {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, > St), > > > > + {{function,Line,Name,Arity,Clauses},St} > > > > + end; > > > > %% Pass anything else through > > > > form(F,St) -> {F,St}. > > > > > > > > @@ -362,7 +375,13 @@ > > > > expr({call,Lc,{atom,Lf,F},As0},St) -> > > > > %% Local function call - needs THIS parameter. > > > > As1 = expr_list(As0,St), > > > > - {call,Lc,{atom,Lf,F},As1 ++ [{var,0,'THIS'}]}; > > > > + As2 = case ordsets:is_element({F, length(As1)}, St#pmod.statics) > of > > > > + true -> > > > > + As1; > > > > + false -> > > > > + As1 ++ [{var,0,'THIS'}] > > > > + end, > > > > + {call,Lc,{atom,Lf,F},As2}; > > > > expr({call,Line,F0,As0},St) -> > > > > %% Other function call > > > > F1 = expr(F0,St), > > > > _______________________________________________ > > > > erlang-questions mailing list > > > > erlang-questions@REDACTED > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > > > > -- > > > --Hynek (Pichi) Vychodil > > > > > > -- > --Hynek (Pichi) Vychodil From rory@REDACTED Wed Apr 9 12:26:57 2008 From: rory@REDACTED (Rory Byrne) Date: Wed, 9 Apr 2008 12:26:57 +0200 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <20080409090411.GA11590@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> Message-ID: <20080409102657.GA31953@almeida.jinsky.com> On Wed, Apr 09, 2008 at 11:04:11AM +0200, Raimo Niskanen wrote: > > These functions seem to work on a MacOS X Leopard box > in our lab, there I get: > inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > inet_gethost[63317] (DEBUG):Created worker[63418] with fd 3 > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > inet_gethost[63418] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. > {error,notfound} > > Not strange since we do not have working IPv6 here at work. > Is this only {error,notfound} when you use an {inet6, true} configuration? There should be no problem looking up AAAA DNS records over IPv4: $ dig -4 aaaa ipv6.google.com ... ipv6.google.com. 9981 IN CNAME ipv6.l.google.com ipv6.l.google.com. 201 IN AAAA 2001:4860:0:1001::68 ... ;; SERVER: 213.133.100.100#53(213.133.100.100) ... I only run Linux, so I can't test it myself - but I am interested. Regards Rory From richardc@REDACTED Wed Apr 9 12:14:23 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 09 Apr 2008 12:14:23 +0200 Subject: [erlang-questions] Defining static functions in abstract modules In-Reply-To: References: Message-ID: <47FC96FF.20302@it.uu.se> Matthew Dempsky wrote: > It would be nice to be able to define arbitrary static functions > within an abstract module. It would, yes. > Below is a very rudimentary patch that adds support for this syntax. Thanks! > Are there any plans on adding static functions in a future release? Yes, the plan was right from the start that it should be possible to declare selected functions as static, but I never got around to implementing it. Your patch might give me enough momentum to fix this now. I can't promise how soon, though. /Richard From alpar@REDACTED Wed Apr 9 11:48:45 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Wed, 09 Apr 2008 10:48:45 +0100 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <6ce0ac130804081529x70c49aabqaffdb6b327accb01@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <6ce0ac130804081529x70c49aabqaffdb6b327accb01@mail.gmail.com> Message-ID: <1207734525.4404.14.camel@piko.site> You may also want to consider using the Boost license (http://boost.org/users/license.html ). It is essentially the same as the BSD license, but the Boost people asked for help from the Berkman Cernter for Internet & Sociely at Harvard Law School to create it. The result is a simple to read and understand license that represents good legal practice in every sense. Regards, Alpar On Tue, 2008-04-08 at 16:29 -0600, Brian Granger wrote: > Unless you want the protections that the GPL offers, I think the BSD > license is probably the best choice. But, if you do go the GPL route, > I would recommend choosing GPLv2. > > Brian > > 2008/4/8 Robert Virding : > > Hello everyone, > > > > I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). > > With the last version I got some flak for my "license" and I am now > > wondering which license to use? GPL seems common among other Erlang > > projects, but how does this fit together with the normal Erlang license? The > > Freebsd license is short enough so even I can understand but is it valid. I > > have no interest in selling* LFE or prohibiting its use, I just want to make > > sure I receive credit for my work and that no one "steals" it in that > > respect. I nice courteous we are using would also be nice, good for the ego. > > > > What do people think? > > > > Robert > > > > * As if anyone would buy it. :-) > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From matthew@REDACTED Wed Apr 9 12:29:17 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 03:29:17 -0700 Subject: [erlang-questions] Defining static functions in abstract modules In-Reply-To: <47FC96FF.20302@it.uu.se> References: <47FC96FF.20302@it.uu.se> Message-ID: On Wed, Apr 9, 2008 at 3:14 AM, Richard Carlsson wrote: > Yes, the plan was right from the start that it should be possible > to declare selected functions as static, but I never got around to > implementing it. Your patch might give me enough momentum to fix > this now. I can't promise how soon, though. Cool, that's pretty much the effect I was expecting/hoping for. :-) Let me know if I can help. From bjorn@REDACTED Wed Apr 9 12:25:42 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 09 Apr 2008 12:25:42 +0200 Subject: [erlang-questions] Erlang/OTP R12B-2 has been released Message-ID: Bug fix release : otp_src_R12B-2 Build date : 2008-04-09 This is bug fix release 2 for the R12B release. You can find the README file for the release at http://www.erlang.org/download/otp_src_R12B-2.readme The source distribution and binary distribution for Windows can be downloaded from http://www.erlang.org/download/otp_src_R12B-2.tar.gz http://www.erlang.org/download/otp_win32_R12B-2.exe Beginning with this release, the distribution can also be downloaded using the BitTorrent protocol. Use the following torrent files to download the source distribution and binary distribution for Windows: http://www.erlang.org/download/otp_src_R12B-2.tar.gz.torrent http://www.erlang.org/download/otp_win32_R12B-2.exe.torrent Note: To unpack the TAR archive you need a GNU TAR compatible program. For installation instructions please read the README file that is part of the distribution. The on-line documentation can be found at: http://www.erlang.org/doc/ You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R12B-2.tar.gz http://www.erlang.org/download/otp_doc_man_R12B-2.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From matthew@REDACTED Wed Apr 9 12:41:40 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 03:41:40 -0700 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <20080409102657.GA31953@almeida.jinsky.com> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> Message-ID: On Wed, Apr 9, 2008 at 3:26 AM, Rory Byrne wrote: > On Wed, Apr 09, 2008 at 11:04:11AM +0200, Raimo Niskanen wrote: > > > > These functions seem to work on a MacOS X Leopard box > > in our lab, there I get: > > inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > > inet_gethost[63317] (DEBUG):Created worker[63418] with fd 3 > > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > > inet_gethost[63418] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. > > {error,notfound} > > > > Not strange since we do not have working IPv6 here at work. > > > > Is this only {error,notfound} when you use an {inet6, true} > configuration? There should be no problem looking up AAAA > DNS records over IPv4: Testing at home with OS X (IPv6 link-local access only), I get {error,notfound} with or without {inet6, true}. ipv6.google.com's AAAA records still resolve fine with dig/host/etc. From tony@REDACTED Wed Apr 9 12:50:14 2008 From: tony@REDACTED (Tony Rogvall) Date: Wed, 9 Apr 2008 12:50:14 +0200 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <20080409090411.GA11590@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> Message-ID: <5F26AAA9-8512-43DC-99E2-AEA2B1AE9168@rogvall.se> > > That it does not work on new Linuxes is a known issue. > Linux took another path than Solaris and removed the > IPv6 resolver functions inet_gethost_native uses. > And that is something that has been on our todo > list for a long time now. But since no paying customer Please !!!! > > needs it it remains a not high enough priority. > Please again! I really do not think that it has anything to do with the problem and how the problem will be solved. /Tony From richardc@REDACTED Wed Apr 9 12:52:32 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 09 Apr 2008 12:52:32 +0200 Subject: [erlang-questions] Defining static functions in abstract modules In-Reply-To: References: <4d08db370804090220i4d85589av2204315905662b02@mail.gmail.com> <4d08db370804090237odbc8aeai575693d25042a7b9@mail.gmail.com> Message-ID: <47FC9FF0.3080807@it.uu.se> Matthew Dempsky wrote: > I have an abstract module zap. I have a client module quux. > > quux should not know about zap's internals, in particular the abstract > module parameters. I can hide the abstract module parameters by > writing a custom zap:new function to handle instantiating the zap > module. > > However, because zap:new is not entirely trivial, I would like to > define helper functions. These helper functions don't make sense > outside of implementing zap, so I'd prefer to define them within the > same file as zap:new. > [...] > I could define a zap_static module for the static helper functions, > but then I have to do extra work when changing the parameters to the > helper functions. One issue that should be considered, though, is that of code update. Calls M:f(...) to abstract modules are, by design, using dynamic lookup of the implementation module, just as for remote calls foo:bar(...). This is so that you can fix bugs and load a new version of the module, and all existing instances will use the updated code. However, if you decide to extend, reduce, or reorder, the module parameters of the abstract module, e.g. change -module(m, [X]) to -module(m, [X, Y]), this will break the calling conventions of existing instances of m. For this reason, I think that abstract modules should probably not be used as both implementation and client interface simultaneously. What one can do instead, is to let zap (a normal, static module, or possibly an abstract module with extremely stable module parameters) be the client interface, which in its turn instantiates the abstract module zap_impl. (Note that the client never actually sees the name zap_impl.) If you decide to rewrite zap_impl and make incompatible changes to the module parameters, you could keep your existing instances working, by naming the new implementation zap_impl_2 (or similar), and change the interface in zap to use this module instead from now on. Changing zap does not break anything, and all new instances will be using zap_impl_2. (Of course, existing instances don't get the benefits of the new code.) And you can repeat this procedure as many times as you like. A middle ground that supports code upgrade is to use a single abstract module both as interface and implementation, but make sure to include an extra module parameter that can be used for future expansions, e.g.: -module(m, [X, Y, ModOpts]). This might typically be a property list (see the proplists module), which defaults to the empty list; or even a dict or gb_tree for faster lookups. Then, you never need to physically change the calling conventions, but if many things get added over the years, it might get rather kludgy. In any case, the ability to declare static functions should be there, for when you need it. /Richard From tty.erlang@REDACTED Wed Apr 9 13:53:33 2008 From: tty.erlang@REDACTED (t ty) Date: Wed, 9 Apr 2008 07:53:33 -0400 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <5F26AAA9-8512-43DC-99E2-AEA2B1AE9168@rogvall.se> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <5F26AAA9-8512-43DC-99E2-AEA2B1AE9168@rogvall.se> Message-ID: <290b3ba10804090453w43cdacbn6eefbf228e322c3c@mail.gmail.com> On Wed, Apr 9, 2008 at 6:50 AM, Tony Rogvall wrote: > > > > That it does not work on new Linuxes is a known issue. > > Linux took another path than Solaris and removed the > > IPv6 resolver functions inet_gethost_native uses. > > And that is something that has been on our todo > > list for a long time now. But since no paying customer Doesn't this put us Linux users in a bind since AFAIK we no longer can purchase Erlang/OTP support licenses. > > > > needs it it remains a not high enough priority. > > What is needed to convince the OTP team that is is high enough. Maybe as a Linux community we could come together to make it happen. Thanks, t From discipleofranok@REDACTED Wed Apr 9 14:24:42 2008 From: discipleofranok@REDACTED (Jacob Torrey) Date: Wed, 9 Apr 2008 08:24:42 -0400 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <1207734525.4404.14.camel@piko.site> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <6ce0ac130804081529x70c49aabqaffdb6b327accb01@mail.gmail.com> <1207734525.4404.14.camel@piko.site> Message-ID: <661fe4600804090524p699c5f97u7d65284353a1b1af@mail.gmail.com> The MIT license is very good if you want it to be 'business friendly' and it's also very short and readable. It is OSI accepted and the text can be found at http://www.opensource.org/licenses/mit-license.php I choose that one for an Erlang project I'm working on so it will encourage businesses to use and contribute. My 2 cents, Jacob On Wed, Apr 9, 2008 at 5:48 AM, Alp?r J?ttner wrote: > You may also want to consider using the Boost license > (http://boost.org/users/license.html ). > > It is essentially the same as the BSD license, but the Boost people > asked for help from the Berkman Cernter for Internet & Sociely at > Harvard Law School to create it. The result is a simple to read and > understand license that represents good legal practice in every sense. > > Regards, > Alpar > > > On Tue, 2008-04-08 at 16:29 -0600, Brian Granger wrote: > > Unless you want the protections that the GPL offers, I think the BSD > > license is probably the best choice. But, if you do go the GPL route, > > I would recommend choosing GPLv2. > > > > Brian > > > > 2008/4/8 Robert Virding : > > > Hello everyone, > > > > > > I will soon be releasing the next version of LFE (Lisp Flavoured > Erlang). > > > With the last version I got some flak for my "license" and I am now > > > wondering which license to use? GPL seems common among other Erlang > > > projects, but how does this fit together with the normal Erlang > license? The > > > Freebsd license is short enough so even I can understand but is it > valid. I > > > have no interest in selling* LFE or prohibiting its use, I just want > to make > > > sure I receive credit for my work and that no one "steals" it in that > > > respect. I nice courteous we are using would also be nice, good for > the ego. > > > > > > What do people think? > > > > > > Robert > > > > > > * As if anyone would buy it. :-) > > > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ft@REDACTED Wed Apr 9 14:53:08 2008 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 09 Apr 2008 14:53:08 +0200 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: <20080409095309.GA12130@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409095309.GA12130@erix.ericsson.se> Message-ID: <47FCBC34.4020507@it.su.se> Raimo Niskanen wrote: > On Wed, Apr 09, 2008 at 02:21:37AM -0700, Matthew Dempsky wrote: >> On Wed, Apr 9, 2008 at 2:04 AM, Raimo Niskanen >> wrote: >>> That it does not work on new Linuxes is a known issue. >>> Linux took another path than Solaris and removed the >>> IPv6 resolver functions inet_gethost_native uses. >>> And that is something that has been on our todo >>> list for a long time now. But since no paying customer >>> needs it it remains a not high enough priority. >> Is there any technical argument for using getipnodebyname in favor of >> getaddrinfo? Would a patch to inet_gethost to use the latter instead >> be accepted? > > If I recall correctly we already got a patch for that, > but it broke some test cases. I think there were > problems with how to find alias names for the generated > hostent structs that was not supported with > getaddrinfo. So there were things to consider... > > A new patch would be nice, or to get the old > again. Otherwise I would have to find the old > by myself. Even though it was not me who wrote it (credits due to Love H?rnquist-?strand) I was the one who sent you the getaddrinfo patch, in private e-mail on 2005-01-13 (so I would actually object to saying it is a problem with "new Linuxes" - a Linux from 2005 isn't exactly new in my book, just like Erlang R10B-3 isn't even close to being a new release of Erlang). I attached the patch again, but yes - it broke some of your test cases. From what I can recall the problem was with the h_aliases in hostent structs. When you used getipnodebyname() on Solaris, you would get aliases from your NIS database (yuck!) that you would not get using getaddrinfo(). /Fredrik -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: use_getaddrinfo-patch1 URL: From bjorn@REDACTED Wed Apr 9 15:23:23 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 09 Apr 2008 15:23:23 +0200 Subject: [erlang-questions] [bug] zip archives in memory (patch incl.) In-Reply-To: <47F36D99.1030403@e-fractal.cz> References: <47F36D99.1030403@e-fractal.cz> Message-ID: Thanks for the bug report and patch. Martin Dvo??k writes: > Hi, > > I've found two bugs regarding handling zip archives in memory. The > attached patch solves both of them, it has been tested with R11B5 and > should work with R12B1 as well. While writing the missing test cases to cover the bugs you have found, we found more potential bugs in the zip module. We didn't have time to fully investigate the problems before R12B-2, so we will do it for R12B-3. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Wed Apr 9 15:16:13 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 9 Apr 2008 06:16:13 -0700 (PDT) Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <20080409090411.GA11590@erix.ericsson.se> Message-ID: <626126.85646.qm@web38803.mail.mud.yahoo.com> --- Raimo Niskanen wrote: > And that is something that has been on our todo > list for a long time now. But since no paying > customer > needs it it remains a not high enough priority. Whenever I see this sort of thing, which is basically overload, I think: instead of waiting for , can't the rest of us help somehow? (Perhaps back to that git repository, thus? But writing and running lots of test suites on different platforms would be needed too.) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From rory@REDACTED Wed Apr 9 17:05:56 2008 From: rory@REDACTED (Rory Byrne) Date: Wed, 9 Apr 2008 17:05:56 +0200 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> Message-ID: <20080409150556.GA336@almeida.jinsky.com> On Wed, Apr 09, 2008 at 03:41:40AM -0700, Matthew Dempsky wrote: > On Wed, Apr 9, 2008 at 3:26 AM, Rory Byrne wrote: > > On Wed, Apr 09, 2008 at 11:04:11AM +0200, Raimo Niskanen wrote: > > > > > > These functions seem to work on a MacOS X Leopard box > > > in our lab, there I get: > > > inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > > > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > > > inet_gethost[63317] (DEBUG):Created worker[63418] with fd 3 > > > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > > > inet_gethost[63418] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. > > > {error,notfound} > > > > > > Not strange since we do not have working IPv6 here at work. > > > > > > > Is this only {error,notfound} when you use an {inet6, true} > > configuration? There should be no problem looking up AAAA > > DNS records over IPv4: > > Testing at home with OS X (IPv6 link-local access only), I get > {error,notfound} with or without {inet6, true}. > > ipv6.google.com's AAAA records still resolve fine with dig/host/etc. > Might be a problem. I'm guessing that most people are going to expect to resolve all their DNS queries over IPv4 for many years to come. I would have assumed the following: . Using {inet6, false} should mean: only query IPv4 DNS servers. It shouldn't effect what you can query, so you should be able to get AAAA records without a problem. . Using {inet6, true} should mean: use an IPv6 DNS server to resolve queries if one is configured. Failing that, use any IPv4 DNS servers that are configured. Again, the content of your query should not be effected. Not saying that this is the way it should be, just that this would have been my initial assumption. Anyway, it appears that the problem is on the link between erlang and the local resolver. However, if your planning on doing any elaborate debugging on this stuff, it might be worth keeping in mind that none of google's DNS servers have IPv6 addresses, so all queries to them will ultimately go over IPv4. The DNS servers for kame.net do have IPv6 addresses (eg: dig -6 aaaa www.kame.net @orange.kame.net). Good luck, Rory From raimo+erlang-questions@REDACTED Wed Apr 9 18:03:41 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 9 Apr 2008 18:03:41 +0200 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: <20080409150556.GA336@almeida.jinsky.com> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> <20080409150556.GA336@almeida.jinsky.com> Message-ID: <20080409160341.GA16741@erix.ericsson.se> On Wed, Apr 09, 2008 at 05:05:56PM +0200, Rory Byrne wrote: > On Wed, Apr 09, 2008 at 03:41:40AM -0700, Matthew Dempsky wrote: > > On Wed, Apr 9, 2008 at 3:26 AM, Rory Byrne wrote: > > > On Wed, Apr 09, 2008 at 11:04:11AM +0200, Raimo Niskanen wrote: > > > > > > > > These functions seem to work on a MacOS X Leopard box > > > > in our lab, there I get: > > > > inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > > > > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > > > > inet_gethost[63317] (DEBUG):Created worker[63418] with fd 3 > > > > inet_gethost[63317] (DEBUG):Saved domainname .google.com. > > > > inet_gethost[63418] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. > > > > {error,notfound} > > > > > > > > Not strange since we do not have working IPv6 here at work. > > > > > > > > > > Is this only {error,notfound} when you use an {inet6, true} > > > configuration? There should be no problem looking up AAAA > > > DNS records over IPv4: > > > > Testing at home with OS X (IPv6 link-local access only), I get > > {error,notfound} with or without {inet6, true}. > > > > ipv6.google.com's AAAA records still resolve fine with dig/host/etc. > > > > Might be a problem. I'm guessing that most people are > going to expect to resolve all their DNS queries over > IPv4 for many years to come. I would have assumed the > following: > > . Using {inet6, false} should mean: only query IPv4 DNS > servers. It shouldn't effect what you can query, so you > should be able to get AAAA records without a problem. > > . Using {inet6, true} should mean: use an IPv6 DNS server > to resolve queries if one is configured. Failing that, > use any IPv4 DNS servers that are configured. Again, > the content of your query should not be effected. > > Not saying that this is the way it should be, just that > this would have been my initial assumption. > > Anyway, it appears that the problem is on the link > between erlang and the local resolver. However, if Or the local resolver configuration. > your planning on doing any elaborate debugging on > this stuff, it might be worth keeping in mind that > none of google's DNS servers have IPv6 addresses, > so all queries to them will ultimately go over IPv4. > The DNS servers for kame.net do have IPv6 addresses > (eg: dig -6 aaaa www.kame.net @orange.kame.net). In that case I can report that: 1> inet:gethostbyname("orange.kame.net", inet6). {ok,{hostent,"orange.kame.net",[],inet6,16, [{0,0,0,0,0,65535,52146,36290}]}} works on: Darwin hostname 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386 Which should be MacOS X Leopard > > Good luck, > > Rory > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Wed Apr 9 18:12:37 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 9 Apr 2008 18:12:37 +0200 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: <626126.85646.qm@web38803.mail.mud.yahoo.com> References: <20080409090411.GA11590@erix.ericsson.se> <626126.85646.qm@web38803.mail.mud.yahoo.com> Message-ID: <20080409161237.GB16741@erix.ericsson.se> On Wed, Apr 09, 2008 at 06:16:13AM -0700, Thomas Lindgren wrote: > > --- Raimo Niskanen > wrote: > > > And that is something that has been on our todo > > list for a long time now. But since no paying > > customer > > needs it it remains a not high enough priority. > > Whenever I see this sort of thing, which is basically > overload, I think: instead of waiting for , > can't the rest of us help somehow? > > (Perhaps back to that git repository, thus? But > writing and running lots of test suites on different > platforms would be needed too.) > In this particular case there has to be an investigation in if the test suites are wrong or the implementation, or the test site (DNS vs NIS). Would it be acceptable that there are no hostent aliases on getaddrinfo hosts but there are on getipnodebyname hosts? Or since there is alias information in DNS, should the inet_gethost_native code be able to find alias information also on getaddrinfo hosts? And how? EEP? > Best, > Thomas > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ellisonbg.net@REDACTED Wed Apr 9 19:02:59 2008 From: ellisonbg.net@REDACTED (Brian Granger) Date: Wed, 9 Apr 2008 11:02:59 -0600 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <20080409073259.GB10417@erix.ericsson.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> Message-ID: <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> > If you are happy with attribution (credits), i think > the FreeBSD/OpenBSD... licenses are the normal to use. > > In the *BSD camps the GPL is thought of as evil since it > many times prohibits (at least makes harder) (commercial) use. > Unfortunately it seems to be a religious thing. Being in the *BSD camp myself, I have to disagree with this statement (about us not liking the GPL because of the commercial applications). The biggest problem is that GPL code can't be used in open source BSD style projects (the GPL would require releasing the resulting work under the GPL license). Perfect example: Erlang is not GPL. Thus Erlang cannot be distributed with code that links to or uses GPL code: readline and FFTW begin examples. If you were to release your project under the GPL, anyone who wants to use it may have to release their code under the GPL (even if it is open source (BSD, MIT, etc.)) (unless you include a special runtime exception, but that gets pretty subtle). Bottom line: if you want your code to play well with other open source project that don't use the GPL, pick something like the BSD/MIT/MPL. Brian From vladdu55@REDACTED Wed Apr 9 19:28:27 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 9 Apr 2008 19:28:27 +0200 Subject: [erlang-questions] r12b-2 torrents don't work Message-ID: <95be1d3b0804091028n5185c57epa787a747a5d88d4f@mail.gmail.com> Hi, The torrent files can't be accessed, the server gives a timeout. regards, Vlad -- .......__o .......\<, ....( )/ ( )... From vladdu55@REDACTED Wed Apr 9 19:33:06 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 9 Apr 2008 19:33:06 +0200 Subject: [erlang-questions] r12b-2 torrents don't work In-Reply-To: <95be1d3b0804091028n5185c57epa787a747a5d88d4f@mail.gmail.com> References: <95be1d3b0804091028n5185c57epa787a747a5d88d4f@mail.gmail.com> Message-ID: <95be1d3b0804091033i1e20c8acpb832d718e0e92d47@mail.gmail.com> On Wed, Apr 9, 2008 at 7:28 PM, Vlad Dumitrescu wrote: > The torrent files can't be accessed, the server gives a timeout. Hmm, the windows exe started to work right after I sent the above :-) /Vlad -- .......__o .......\<, ....( )/ ( )... From matthew@REDACTED Wed Apr 9 20:08:55 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 11:08:55 -0700 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <20080409150556.GA336@almeida.jinsky.com> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> <20080409150556.GA336@almeida.jinsky.com> Message-ID: On Wed, Apr 9, 2008 at 8:05 AM, Rory Byrne wrote: > Might be a problem. I'm guessing that most people are > going to expect to resolve all their DNS queries over > IPv4 for many years to come. I would have assumed the > following: Setting {inet6, true} only changes inet:gethostbyname/1 to default to asking for an inet6 address before falling back to inet. It doesn't affect what network layer Erlang uses to communicate with the DNS cache. From matthew@REDACTED Wed Apr 9 20:13:31 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 11:13:31 -0700 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: <20080409160341.GA16741@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> <20080409150556.GA336@almeida.jinsky.com> <20080409160341.GA16741@erix.ericsson.se> Message-ID: On Wed, Apr 9, 2008 at 9:03 AM, Raimo Niskanen wrote: > In that case I can report that: > 1> inet:gethostbyname("orange.kame.net", inet6). > {ok,{hostent,"orange.kame.net",[],inet6,16, > [{0,0,0,0,0,65535,52146,36290}]}} > works on: > Darwin hostname 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386 > Which should be MacOS X Leopard That's not the correct result though. That's an IPv4 mapped address for a node name that has actual IPv6 addresses. Having IPv6 support is silly if the only hosts you can access are ones that also have IPv4. From matthew@REDACTED Wed Apr 9 20:23:46 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 9 Apr 2008 11:23:46 -0700 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> Message-ID: On Wed, Apr 9, 2008 at 3:41 AM, Matthew Dempsky wrote: > Testing at home with OS X (IPv6 link-local access only), I get > {error,notfound} with or without {inet6, true}. > > ipv6.google.com's AAAA records still resolve fine with dig/host/etc. I see the same behavior with a globally routable local IPv6 address. matthew@REDACTED:~$ erl Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> inet_gethost_native:control({debug_level,4}). ok 2> inet_gethost[68255] (DEBUG):debug_level = 4 inet_gethost_native:gethostbyname("ipv6.google.com", inet6). inet_gethost[68255] (DEBUG):Saved domainname .google.com. inet_gethost[68255] (DEBUG):Created worker[68256] with fd 3 inet_gethost[68255] (DEBUG):Saved domainname .google.com. inet_gethost[68256] (DEBUG):Worker got request, op = 1, proto = 2, data = ipv6.google.com. {error,notfound} 3> ets:tab2list(inet_db). [{socks5_noproxy,[]}, {res_recurse,1}, {res_id,0}, {hostname,"pollux"}, {res_alt_ns,[]}, {cache_refresh_interval,3600000}, {res_inet6,false}, {socks5_port,1080}, {socks5_methods,[none]}, {res_timeout,2000}, {cache_size,100}, {res_domain,"local"}, {res_retry,3}, {res_ns,[]}, {res_lookup,[native,file]}, {sctp_module,inet_sctp}, {udp_module,inet_udp}, {tcp_module,inet_tcp}, {socks5_server,[]}, {res_search,["local"]}, {res_usevc,false}] 4> ets:tab2list(inet_hosts). [{{10,0,1,195},inet,["pollux.local","pollux"]}] From pyritz@REDACTED Wed Apr 9 20:09:23 2008 From: pyritz@REDACTED (William H Pyritz) Date: Wed, 09 Apr 2008 13:09:23 -0500 Subject: [erlang-questions] Erlang concurreny on Windows Message-ID: <47FD0653.8090507@alcatel-lucent.com> Hello, I hope you can help me understand some results from an Erlnag concurrency test I recently performed. I am using a dual core Intel T2500 CPU @ 2GHz with 1G RAM running Windows XP Pro. erl -version: Erlang (ASYNC_THREADS) (BEAM) emulator version 5.5.5 I was watching the CPU monitor and noticed that one core was at nearly 100% and the other at ~80% for both of the following tests. I expected to see a significant difference in the times (marked as OUTPUT below). Is there something I am doing wrong that might explain the reults, or is Windows doing some optimizations on the first test? Thanks, Bill Pyritz ------------------------------------------------------------- test_concurrency1() -> statistics(runtime), statistics(wall_clock), for( 1, 100000000, fun(Index) -> Index * 10 end ), {_, Time1} = statistics(runtime), {_, Time2} = statistics(wall_clock), io:format("~p ~p ~n", [Time1, Time2]). OUTPUT => 15781 15797 test_concurrency2() -> statistics(runtime), statistics(wall_clock), S = self(), spawn( fun() -> for( 1, 50000000, fun(Index) -> Index * 10 end ), S ! done end ), spawn( fun() -> for( 1, 50000000, fun(Index) -> Index * 10 end ), S ! done end ), for( 1, 2, fun(_) -> receive done -> done end end ), {_, Time3} = statistics(runtime), {_, Time4} = statistics(wall_clock), io:format("~p ~p ~n", [Time3, Time4]). OUTPUT => 15531 15531 From tsuraan@REDACTED Wed Apr 9 21:48:47 2008 From: tsuraan@REDACTED (tsuraan) Date: Wed, 9 Apr 2008 14:48:47 -0500 Subject: [erlang-questions] Vector instructions, BLAS, FFI In-Reply-To: <1207730571.6159.333.camel@gnatziu.crs4.it> References: <47F4739B.5020303@ghostgun.com> <16529946.post@talk.nabble.com> <47FAB072.6020403@ghostgun.com> <47FB0D20.4000707@ghostgun.com> <1207648580.6159.238.camel@gnatziu.crs4.it> <84fb38e30804080918t20b0dd25y44f7b241a6c0f287@mail.gmail.com> <1207730571.6159.333.camel@gnatziu.crs4.it> Message-ID: <84fb38e30804091248n3c0a9d91t473abc9872e609f0@mail.gmail.com> > We developed the BLAS interface (and the FFI in the first place) trying > to avoid copying, unless the data is sent between different Erlang nodes > (and since matrices and vectors are just regular Erlang records, the > Erlang VM can handle them without problems). That sounds really nice. I sure hope this FFI gets approved soon, or at least merged into the official Erlang source as an unsupported feature in testing. From rory@REDACTED Wed Apr 9 22:16:34 2008 From: rory@REDACTED (Rory Byrne) Date: Wed, 9 Apr 2008 22:16:34 +0200 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> <20080409150556.GA336@almeida.jinsky.com> Message-ID: <20080409201634.GA1301@almeida.jinsky.com> On Wed, Apr 09, 2008 at 11:08:55AM -0700, Matthew Dempsky wrote: > On Wed, Apr 9, 2008 at 8:05 AM, Rory Byrne wrote: > > Might be a problem. I'm guessing that most people are > > going to expect to resolve all their DNS queries over > > IPv4 for many years to come. I would have assumed the > > following: > > Setting {inet6, true} only changes inet:gethostbyname/1 to default to > asking for an inet6 address before falling back to inet. It doesn't > affect what network layer Erlang uses to communicate with the DNS > cache. I should of tapped the source on that one - less of this speculation stuff. Cheers! From vances@REDACTED Wed Apr 9 22:17:41 2008 From: vances@REDACTED (Vance Shipley) Date: Wed, 9 Apr 2008 16:17:41 -0400 Subject: [erlang-questions] CBSE anybody In-Reply-To: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> References: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> Message-ID: <20080409201740.GB12224@h216-235-12-173.host.egate.net> Joe, Exactly my thinking: http://www.erlang.org/pipermail/erlang-questions/2005-July/016287.html -Vance On Wed, Apr 09, 2008 at 10:54:43AM +0200, Joe Armstrong wrote: } Here *diagrams* seem very helpful. I would like therefore lie to } describe the system using three levels of abstraction: } } 1) At the top level of the system I want to draw a diagram } showing how the components are connected together } 2) At the middle layer I want to *specify* the components } 3) At the lower level I want to implement the components. } } Now it seems to me that 3) is solved very nicely in Erlang. } } What we therefore need is to focus on 1) and 2) From chsu79@REDACTED Wed Apr 9 22:18:11 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 9 Apr 2008 22:18:11 +0200 Subject: [erlang-questions] r12b-2 torrents don't work In-Reply-To: <95be1d3b0804091033i1e20c8acpb832d718e0e92d47@mail.gmail.com> References: <95be1d3b0804091028n5185c57epa787a747a5d88d4f@mail.gmail.com> <95be1d3b0804091033i1e20c8acpb832d718e0e92d47@mail.gmail.com> Message-ID: They seem to have the wrong content-type. I'm getting application/x-tar for otp_src and application/octet-stream for otp_win. Perhaps an application/x-bittorrent mime-mapping is missing for *.torrent? On Wed, Apr 9, 2008 at 7:33 PM, Vlad Dumitrescu wrote: > On Wed, Apr 9, 2008 at 7:28 PM, Vlad Dumitrescu wrote: > > The torrent files can't be accessed, the server gives a timeout. > > Hmm, the windows exe started to work right after I sent the above :-) > > /Vlad From massimo.cesaro@REDACTED Wed Apr 9 22:19:23 2008 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: Wed, 9 Apr 2008 22:19:23 +0200 Subject: [erlang-questions] CBSE anybody In-Reply-To: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> References: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> Message-ID: <7ae16d50804091319n7477fa46m82e29e4d1fdaf34d@mail.gmail.com> On Wed, Apr 9, 2008 at 10:54 AM, Joe Armstrong wrote: > > Now I cannot conceive of using WSDL to describe protocols - so I think > some kind of > CSP'ish notation would suffice. For a transport layer I am uncertain - > we could use > Erlang terms (external format) for all messaging (and a type system to > describe them,) but this > would hinder interoperability - of the currently available formats > something like JSON is not > too bad - or my UBF (see http://www.sics.se/?~joe/ubf) . Possibly both > JASON AND UBF. > > The highest level should be a drag and draw gui thingy to describe the > interconnection > between components. UML has a notation for this (it has a notation for > *everything*) which could be cannibalized. > > > Does anybody have experience with this kind of way of building > software - there seems to be a vast > literature - I search turned up book titles like > - > UML Components: A Simple Process for Specifying Component-Based > Software (Cheesman and Daniels) > ... > A long time ago, I remember using Z.100 SDL for this kind of development ( http://www.sdl-forum.org/). > > What I'm after is > > 1) a graphic notation showing component integration for the top > level of design. > 2) A formal notation for describing protocols for the middle level > 3) A low level way of implementing the protocol > If I remember correctly, SDL + MSC tool we developed in house were just meeting these requirements. > > I also want a *universal* messaging format for > interprocess-communication. Any votes for Erlang external term > format/JSON/UBF/list S expressions > /whatever. > > Which bits should we invent for ourselves - and what should we > borrow/adapt/steal? > > Comments please! > I think that a fresh view to SDL 2007 language could lead to interesting findings. Massimo > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Apr 9 22:21:19 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 9 Apr 2008 22:21:19 +0200 Subject: [erlang-questions] r12b-2 torrents don't work In-Reply-To: References: <95be1d3b0804091028n5185c57epa787a747a5d88d4f@mail.gmail.com> <95be1d3b0804091033i1e20c8acpb832d718e0e92d47@mail.gmail.com> Message-ID: In the mean everyone can access the previousliy linked to: http://erlang.org:6969/ From roger.larsson@REDACTED Tue Apr 8 21:24:31 2008 From: roger.larsson@REDACTED (Roger Larsson) Date: Tue, 8 Apr 2008 21:24:31 +0200 Subject: [erlang-questions] Sony Vector library with BSD license In-Reply-To: References: <212077.63066.qm@web38815.mail.mud.yahoo.com> <47FB63E8.6020904@ericsson.com> Message-ID: <200804082124.31777.roger.larsson@e-gatan.se> Sony library with BSD license. For x86, PowerPC PPU, Cell SPE http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?p=4884&f=&t= Read the "overview document" as it has some very interesting thoughts about data layout - AoS (Array of Structures) and SoA (Structure of Arrays). The library supports both layouts. /RogerL On tisdag 08 april 2008, Christian S wrote: > > While we're at it, I'd like to throw in a wish to > > be able to handle real-time manipulation of media > > streams in Erlang (with good performance, that is). > > > > Think, for example, transcoding of video streams. > > Given Erlang's reputation as a language for telecoms, > > I don't think this is too far-fetched, even if it > > were to require some special syntax. > > The ps3-platform would be an interesting target for such research. > > Anyone on list that run erlang on their ps3 and use the SPEs from it? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jeffm@REDACTED Thu Apr 10 03:18:36 2008 From: jeffm@REDACTED (jm) Date: Thu, 10 Apr 2008 11:18:36 +1000 Subject: [erlang-questions] Vector instructions In-Reply-To: <212077.63066.qm@web38815.mail.mud.yahoo.com> References: <212077.63066.qm@web38815.mail.mud.yahoo.com> Message-ID: <47FD6AEC.6030504@ghostgun.com> Thomas Lindgren wrote: > --- jm wrote: >> Where would you recommend starting? Any good >> references on parallel >> vector and matrix operations/algorithms? > > I think Golub and Van Loan is a good point to get > going, though the field itself is vast. Also, take a > look at Fortran 90:s array syntax and how it is > compiled. (Matlab is probably similar.) Got five minutes and tracked it down. Thought I'd post the full citation for anyone else interested http://www.citeulike.org/user/sprite/article/252315 G. H. Golub & C. F. Van Loan (1996). Matrix Computations (Johns Hopkins Studies in Mathematical Sciences). The Johns Hopkins University Press. Jeff. From romain.lenglet@REDACTED Thu Apr 10 04:50:58 2008 From: romain.lenglet@REDACTED (Romain Lenglet) Date: Thu, 10 Apr 2008 11:50:58 +0900 Subject: [erlang-questions] erlounge: Erlounge in Shibuya, Tokyo Message-ID: <200804101150.58718.romain.lenglet@berabera.info> Hi ??????? ! Some time ago, I proposed to organize an Erlounge in Shibuya, Tokyo, on April 22. Several persons answered, so this will take place! Unfortunately, I will be in California at that time, so I will not attend. Joe Norton (norton@REDACTED) will take care of the Erlounge organization. So if you interested to come, please contact him directly. Have fun! -- Romain Lenglet From tty.erlang@REDACTED Thu Apr 10 06:43:00 2008 From: tty.erlang@REDACTED (t ty) Date: Thu, 10 Apr 2008 00:43:00 -0400 Subject: [erlang-questions] erlounge: Erlounge in Ottawa, Canada, Wednesday May 7th? Message-ID: <290b3ba10804092143w2820e0b2v83f1340be6be4b0f@mail.gmail.com> I propose to meet for an "Erlounge" in Ottawa, Canada, during the first week of May, with Wednesday the 7th as a tentative date. College Square or Downtown/Byward Market would be two possible areas. Please respond if you can attend and make a location suggestion, or even an alternate date. Prior estimate on individuals a week before would help determine if we need to reserve a table. Regards Tee From dnm@REDACTED Thu Apr 10 07:44:21 2008 From: dnm@REDACTED (Dan Moniz) Date: Thu, 10 Apr 2008 01:44:21 -0400 Subject: [erlang-questions] CBSE anybody References: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> Message-ID: <6t8rv3p0egqn1vmkepkgm36lprch2aro38@4ax.com> On Wed, 9 Apr 2008 10:54:43 +0200, "Joe Armstrong" wrote: >What I'm after is > > 1) a graphic notation showing component integration for the top >level of design. > 2) A formal notation for describing protocols for the middle level > 3) A low level way of implementing the protocol > >I also want a *universal* messaging format for >interprocess-communication. Any votes for Erlang external term >format/JSON/UBF/list S expressions >/whatever. > >Which bits should we invent for ourselves - and what should we >borrow/adapt/steal? > >Comments please! I just discovered TTCN-3[1] a little more than a month ago and I've been looking more into it. This investigation was originally motivated after seeing TTCN-3 mentioned in connection with some telecom protocols I was doing preliminary reading on. Briefly, TTCN-3 is a ETSI standard language for black box protocol conformance testing. It also adopts ASN.1 for relevant needs. Interestingly, previous versions of TTCN, notably TTCN-2 and TTCN-1 (from what I understand, TTCN-2 was the most popular version and is still widely used, TTCN-3 is catching up), were used entirely inside specialized graphical editors which were diagram based. I haven't seen any of these editors myself, but there are descriptions of them, and the book I ordered on TTCN-3[2] descibes them and gives an idealized picture of what they user interface looked like (see footnote below; Amazon's preview of the book shows most of the first chapter, I think the picture representations are in there). The real sea change in TTCN-3 is that graphical editors are no longer needed; TTCN-3 is now enitrely writeable in a standard text editor, and usable along with a TTCN-3 compiler and runtime tools. As far as I can tell right now, all the TTCN-3 compilers, interpreters, runtimes, and bindings, etc. are commercial in nature. What TTCN-3 gets you is #2, though from what I've read and understand so far, while TTCN-3 is widely accepted (in certain communities, natch) as being great at specifying protocol test suites for use in black box testing, it's not widely seen as being good for software testing in general[3]. To me this is fine, but this view may be colored by my intended use of TTCN-3. In theory it ought to be trivial to derive a graphical representation of a TTCN-3 speficiation, though I've done no work on this myself yet. This is still kind of the reverse of the order you want to go in though; from #2 to #1, whereas you want #1 to #2. Still, using TTCN-3 as a base, implementing a graphical UML-esque editor which emits or merely provides a different rendering of a TTCN-3 specification sounds feasible. Because I've only found commercial TTCN-3 implementations, I've been trying to figure out how I'm going to get my hands on something useful to understand the language in practice. One idea that came to me this week was to hijack the TTCN-3 parser (implemented in ANTLR 2) that's in TRex[4], which is an open source Eclipse-based TTCN-3 editor/IDE, and maybe bolt it on to something. Footnotes: [1] http://www.ttcn-3.org/ [2] http://www.amazon.com/dp/0470012242 [3] http://wiki.openttcn.com/media/index.php/OpenTTCN/Language_reference [4] http://www.trex.informatik.uni-goettingen.de/trac/wiki/WikiStart -- Dan Moniz [http://pobox.com/~dnm/] From ft@REDACTED Thu Apr 10 08:45:14 2008 From: ft@REDACTED (Fredrik Thulin) Date: Thu, 10 Apr 2008 08:45:14 +0200 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: <20080409161237.GB16741@erix.ericsson.se> References: <20080409090411.GA11590@erix.ericsson.se> <626126.85646.qm@web38803.mail.mud.yahoo.com> <20080409161237.GB16741@erix.ericsson.se> Message-ID: <47FDB77A.5030300@it.su.se> Raimo Niskanen wrote: ... > In this particular case there has to be an investigation > in if the test suites are wrong or the implementation, > or the test site (DNS vs NIS). > > Would it be acceptable that there are no hostent aliases > on getaddrinfo hosts but there are on getipnodebyname > hosts? It sounds icky to have different results based on what the libc you are using supports, but NIS is as far as I'm concerned totally irrelevant (today) - the world runs on DNS! ;) So to put it differently - I'd rather have working IPv6 hostname resolving, than support for struct hostent aliases at all. > Or since there is alias information in DNS, > should the inet_gethost_native code be able to > find alias information also on getaddrinfo hosts? > And how? How do you mean? In DNS, aliases are CNAMEs, DNAMEs (not very widely used) or if you stretch the definition a bit - multiple A records pointing at the same IP address. There is no way to ask DNS "what is all the aliases for host www.example.com?" or "what is all the names for IP 192.0.2.2?". The reason for this? There is no central place to ask, so you can't know if someone far far away has created an alias pointing at you. To illustrate - you have a CNAME pointing www3.erlang.org at erlang.mirrors.su.se (which in turn happens to be an alias for afs-ftp1.it.su.se). There can be aliases to one of _my_ hosts in _any_ domain on the internet. /Fredrik From raimo+erlang-questions@REDACTED Thu Apr 10 09:45:11 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 10 Apr 2008 09:45:11 +0200 Subject: [erlang-questions] : r12b-2 torrents don't work In-Reply-To: References: <95be1d3b0804091028n5185c57epa787a747a5d88d4f@mail.gmail.com> <95be1d3b0804091033i1e20c8acpb832d718e0e92d47@mail.gmail.com> Message-ID: <20080410074511.GA16850@erix.ericsson.se> On Wed, Apr 09, 2008 at 10:18:11PM +0200, Christian S wrote: > They seem to have the wrong content-type. I'm getting > application/x-tar for otp_src and application/octet-stream for > otp_win. > > Perhaps an application/x-bittorrent mime-mapping is missing for *.torrent? Oh yes! Thank you for pointing this out. Now the mapping is supposed to be there. Do try again. > > On Wed, Apr 9, 2008 at 7:33 PM, Vlad Dumitrescu wrote: > > On Wed, Apr 9, 2008 at 7:28 PM, Vlad Dumitrescu wrote: > > > The torrent files can't be accessed, the server gives a timeout. > > > > Hmm, the windows exe started to work right after I sent the above :-) > > > > /Vlad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From alceste@REDACTED Thu Apr 10 10:07:18 2008 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 10 Apr 2008 10:07:18 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> Message-ID: <1207814838.6159.390.camel@gnatziu.crs4.it> Il giorno mer, 09/04/2008 alle 11.02 -0600, Brian Granger ha scritto: > The biggest problem is that GPL code can't be used in open source BSD > style projects (the GPL would require releasing the resulting work > under the GPL license). Perfect example: Erlang is not GPL. Thus > Erlang cannot be distributed with code that links to or uses GPL code: > readline and FFTW begin examples. > > If you were to release your project under the GPL, anyone who wants to > use it may have to release their code under the GPL (even if it is > open source (BSD, MIT, etc.)) (unless you include a special runtime > exception, but that gets pretty subtle). This is wrong. In general, when you create a software product that depends on existing libraries, then you must comply with *all* the licenses of these libraries --- MIT, GNU GPL, BSD, proprietary, whatever. Otherwise, you are not allowed to use them at all. The GNU GPL does *not* require that the linked software is released (or re-licensed) under the terms of the GNU GPL itself. But the copyright law *does* require that the final product (new code + libraries) complies with all the involved software licenses. And since the GNU GPL (either v2 or v3) prohibits that additional restrictions are placed on resulting software, then the final product cannot be distributed under a proprietary, restrictive license. If there are no such additional restrictions, then there are no problems at all; and if the final product is composed by GNU GPL-compatible licenses, then there are no such additional restrictions. Practical example: * "libfoo" is GNU GPL'ed; * program "bar" depends on libfoo; * therefore, "bar" must be released under *any* GNU GPL-compatible license --- otherwise the "libfoo+bar" bundle is not legally usable/distributable at all. "bar" could thus be released under the terms of the MIT or BSD license. If someone modifies it and removes the "libfoo" dependency, or replaces "libfoo" with a non-GPL'ed version, then the GNU GPL conditions do not apply anymore, and future users of "bar" will be able to make it proprietary, add restrictive licensing terms, etc. In other words, the GNU GPL is not "viral" (as someone else wrote on this thread), or at least is not any more viral than any other software license. > Bottom line: if you want your code to play well with other open > source project that don't use the GPL, pick something like the > BSD/MIT/MPL. ...or, in general, choose any GNU GPL-compatible license :-) Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From xrfang@REDACTED Thu Apr 10 10:09:10 2008 From: xrfang@REDACTED (Xiangrong Fang) Date: Thu, 10 Apr 2008 16:09:10 +0800 Subject: [erlang-questions] Erlang version Message-ID: Hi There, How do I get the version of erlang I am running now? there seems no --version or similar switch to erl or erlc. erl reported Eshell 5.6.1, but where I can get the main version number such as R12B... Thanks! Shannon From rory@REDACTED Thu Apr 10 10:26:39 2008 From: rory@REDACTED (Rory Byrne) Date: Thu, 10 Apr 2008 10:26:39 +0200 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: <20080409160341.GA16741@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <20080409090411.GA11590@erix.ericsson.se> <20080409102657.GA31953@almeida.jinsky.com> <20080409150556.GA336@almeida.jinsky.com> <20080409160341.GA16741@erix.ericsson.se> Message-ID: <20080410082639.GA2995@almeida.jinsky.com> On Wed, Apr 09, 2008 at 06:03:41PM +0200, Raimo Niskanen wrote: > On Wed, Apr 09, 2008 at 05:05:56PM +0200, Rory Byrne wrote: > > > > Anyway, it appears that the problem is on the link > > between erlang and the local resolver. However, if > > Or the local resolver configuration. > Yeah, fair point. It's a good puzzle! I look forward to the Linux edition. :-) Regards, Rory From vladdu55@REDACTED Thu Apr 10 10:19:50 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 10 Apr 2008 10:19:50 +0200 Subject: [erlang-questions] Erlang version In-Reply-To: References: Message-ID: <95be1d3b0804100119w1ab73a64hdb10fcd52c3ba52e@mail.gmail.com> Hi, On Thu, Apr 10, 2008 at 10:09 AM, Xiangrong Fang wrote: > How do I get the version of erlang I am running now? there seems no > --version or similar switch to erl or erlc. > > erl reported Eshell 5.6.1, but where I can get the main version number > such as R12B... Try init:script_id(). regards, Vlad From raimo+erlang-questions@REDACTED Thu Apr 10 10:30:27 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 10 Apr 2008 10:30:27 +0200 Subject: [erlang-questions] Erlang version In-Reply-To: References: Message-ID: <20080410083027.GD8173@erix.ericsson.se> On Thu, Apr 10, 2008 at 04:09:10PM +0800, Xiangrong Fang wrote: > Hi There, > > How do I get the version of erlang I am running now? there seems no > --version or similar switch to erl or erlc. > > erl reported Eshell 5.6.1, but where I can get the main version number > such as R12B... > 1> erlang:system_info(otp_release). "R12B" > Thanks! > Shannon > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From richardc@REDACTED Thu Apr 10 10:45:13 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 10 Apr 2008 10:45:13 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207814838.6159.390.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> Message-ID: <47FDD399.8070803@it.uu.se> Alceste Scalas wrote: > The GNU GPL does *not* require that the linked software is released (or > re-licensed) under the terms of the GNU GPL itself. Really? Here's what the GPL (v2) says: "You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) [...]" As far as I can see, this is rather clear: *if* you distribute the derived work, then all of it *has* to be provided under the GPL ("this License"), There are some exceptions, such as if you distribute only the parts you have written: "These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it." The LGPL differs in that it does not consider code that merely links to your program to be a derived work. Is that what you meant? /Richard From alpar@REDACTED Thu Apr 10 11:05:01 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 10 Apr 2008 10:05:01 +0100 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207814838.6159.390.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> Message-ID: <1207818301.4462.16.camel@piko.site> > The GNU GPL does *not* require that the linked software is released (or > re-licensed) under the terms of the GNU GPL itself. In fact, there there is a paragraph in GNU GPL that seems to define when it is not necessary to use GPL in your work using a GPL software: A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an ?aggregate? if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. Assume that Erlang is linked against a GPL lib. Is that an aggregation? (Then no GPL is necessary) Or it "is combined with it such as to form a larger program" (Then Erlang seems to be requested to use GPL)? It is far too fuzzy for me. > But the copyright law *does* require that the final product (new code + > libraries) complies with all the involved software licenses. And since > the GNU GPL (either v2 or v3) prohibits that additional restrictions are > placed on resulting software, then the final product cannot be > distributed under a proprietary, restrictive license. > > If there are no such additional restrictions, then there are no problems > at all; and if the final product is composed by GNU GPL-compatible > licenses, then there are no such additional restrictions. > > Practical example: > > * "libfoo" is GNU GPL'ed; > * program "bar" depends on libfoo; > * therefore, "bar" must be released under *any* GNU GPL-compatible > license --- otherwise the "libfoo+bar" bundle is not legally > usable/distributable at all. > > "bar" could thus be released under the terms of the MIT or BSD license. > If someone modifies it and removes the "libfoo" dependency, or replaces > "libfoo" with a non-GPL'ed version, then the GNU GPL conditions do not > apply anymore, and future users of "bar" will be able to make it > proprietary, add restrictive licensing terms, etc. > > In other words, the GNU GPL is not "viral" (as someone else wrote on > this thread), or at least is not any more viral than any other software > license. > > > > Bottom line: if you want your code to play well with other open > > source project that don't use the GPL, pick something like the > > BSD/MIT/MPL. > > ...or, in general, choose any GNU GPL-compatible license :-) > > Regards, > > alceste From xrfang@REDACTED Thu Apr 10 11:11:12 2008 From: xrfang@REDACTED (Xiangrong Fang) Date: Thu, 10 Apr 2008 17:11:12 +0800 Subject: [erlang-questions] Erlang version In-Reply-To: <20080410083027.GD8173@erix.ericsson.se> References: <20080410083027.GD8173@erix.ericsson.se> Message-ID: Thanks! On Thu, Apr 10, 2008 at 4:30 PM, Raimo Niskanen wrote: > > On Thu, Apr 10, 2008 at 04:09:10PM +0800, Xiangrong Fang wrote: > > Hi There, > > > > How do I get the version of erlang I am running now? there seems no > > --version or similar switch to erl or erlc. > > > > erl reported Eshell 5.6.1, but where I can get the main version number > > such as R12B... > > > > 1> erlang:system_info(otp_release). > "R12B" > > > Thanks! > > Shannon > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > From alceste@REDACTED Thu Apr 10 11:11:07 2008 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 10 Apr 2008 11:11:07 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FDD399.8070803@it.uu.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> Message-ID: <1207818667.6159.419.camel@gnatziu.crs4.it> Il giorno gio, 10/04/2008 alle 10.45 +0200, Richard Carlsson ha scritto: > Alceste Scalas wrote: > > The GNU GPL does *not* require that the linked software is released (or > > re-licensed) under the terms of the GNU GPL itself. > > Really? Here's what the GPL (v2) says: > > b) You must cause any work that you distribute or publish, that in > whole or in part contains or is derived from the Program or any part > thereof, to be licensed as a whole at no charge to all third parties > under the terms of this License. > > As far as I can see, this is rather clear: *if* you distribute the derived > work, then all of it *has* to be provided under the GPL ("this License"), "As a whole" refers to the final product (as I called it in my previous email) taken in its entirety. But it may be composed by parts (e.g. code portions) that, taken alone, have different (albeit GNU GPL-compatible) licenses. In fact, as you report, the GNU GPL v2 also says that: > "These requirements apply to the modified work as a whole. If identifiable > sections of that work are not derived from the Program, and can be > reasonably considered independent and separate works in themselves, then > this License, and its terms, do not apply to those sections when you > distribute them as separate works. But when you distribute the same sections > as part of a whole which is a work based on the Program, the distribution of > the whole must be on the terms of this License, whose permissions for other > licensees extend to the entire whole, and thus to each and every part > regardless of who wrote it." The GNU GPL v3 has the same conditions with different wording. > The LGPL differs in that it does not consider code that merely links to > your program to be a derived work. Well, not exactly. Under the copyright law, a program that depends/links to a library *is* a derived work, and thus it must observe the licensing requirements of the library itself. Unlike the GNU GPL, the GNU LGPL does *not* require that the derived product is released "as a whole" under compatible licensing terms --- even if it *does* require that modifications to the library itself are released under compatible licensing terms. Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From alpar@REDACTED Thu Apr 10 11:18:36 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 10 Apr 2008 10:18:36 +0100 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207818301.4462.16.camel@piko.site> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <1207818301.4462.16.camel@piko.site> Message-ID: <1207819116.4462.18.camel@piko.site> > > The GNU GPL does *not* require that the linked software is released (or > > re-licensed) under the terms of the GNU GPL itself. > > In fact, there there is a paragraph in GNU GPL that seems to define when > it is not necessary to use GPL in your work using a GPL software: To be clear, this is a quotation from GNU GPL (v3). > > A compilation of a covered work with other separate and > independent works, which are not by their nature extensions of > the covered work, and which are not combined with it such as to > form a larger program, in or on a volume of a storage or > distribution medium, is called an ?aggregate? if the compilation > and its resulting copyright are not used to limit the access or > legal rights of the compilation's users beyond what the > individual works permit. Inclusion of a covered work in an > aggregate does not cause this License to apply to the other > parts of the aggregate. > > Assume that Erlang is linked against a GPL lib. Is that an aggregation? > (Then no GPL is necessary) Or it "is combined with it such as to form a > larger program" (Then Erlang seems to be requested to use GPL)? It is > far too fuzzy for me. > > > But the copyright law *does* require that the final product (new code + > > libraries) complies with all the involved software licenses. And since > > the GNU GPL (either v2 or v3) prohibits that additional restrictions are > > placed on resulting software, then the final product cannot be > > distributed under a proprietary, restrictive license. > > > > If there are no such additional restrictions, then there are no problems > > at all; and if the final product is composed by GNU GPL-compatible > > licenses, then there are no such additional restrictions. > > > > Practical example: > > > > * "libfoo" is GNU GPL'ed; > > * program "bar" depends on libfoo; > > * therefore, "bar" must be released under *any* GNU GPL-compatible > > license --- otherwise the "libfoo+bar" bundle is not legally > > usable/distributable at all. > > > > "bar" could thus be released under the terms of the MIT or BSD license. > > If someone modifies it and removes the "libfoo" dependency, or replaces > > "libfoo" with a non-GPL'ed version, then the GNU GPL conditions do not > > apply anymore, and future users of "bar" will be able to make it > > proprietary, add restrictive licensing terms, etc. > > > > In other words, the GNU GPL is not "viral" (as someone else wrote on > > this thread), or at least is not any more viral than any other software > > license. > > > > > > > Bottom line: if you want your code to play well with other open > > > source project that don't use the GPL, pick something like the > > > BSD/MIT/MPL. > > > > ...or, in general, choose any GNU GPL-compatible license :-) > > > > Regards, > > > > alceste > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From alceste@REDACTED Thu Apr 10 11:33:49 2008 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 10 Apr 2008 11:33:49 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207818301.4462.16.camel@piko.site> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <1207818301.4462.16.camel@piko.site> Message-ID: <1207820029.6159.434.camel@gnatziu.crs4.it> Il giorno gio, 10/04/2008 alle 10.05 +0100, Alp?r J?ttner ha scritto: > > The GNU GPL does *not* require that the linked software is released (or > > re-licensed) under the terms of the GNU GPL itself. > > In fact, there there is a paragraph in GNU GPL that seems to define when > it is not necessary to use GPL in your work using a GPL software: > A compilation of a covered work with other separate and > independent works, which are not by their nature extensions of > the covered work, and which are not combined with it such as to > form a larger program, in or on a volume of a storage or > distribution medium, is called an ?aggregate? if the compilation > and its resulting copyright are not used to limit the access or > legal rights of the compilation's users beyond what the > individual works permit. Inclusion of a covered work in an > aggregate does not cause this License to apply to the other > parts of the aggregate. It's a different matter: it refers to programs that do *not* depend/link with GNU GPL'ed software. I.e. if you want to distribute a GNU GPL'ed program in a compilation of programs with incompatible licenses, then you are allowed to (as long as you respect the GNU GPL, of course). > Assume that Erlang is linked against a GPL lib. Is that an aggregation? > (Then no GPL is necessary) Or it "is combined with it such as to form a > larger program" (Then Erlang seems to be requested to use GPL)? It is > far too fuzzy for me. If it was not fuzzy, we would not have lawyers around :-) If the Erlang functionality depends on some GNU GPL'ed library (example: GNU Readline), then the resulting program is a derived work that must respect the terms of all the licenses involved --- including the GNU GPL. Thus, *all* of its parts must be covered by GNU GPL-compatible licenses. I know (but I've not verified) that the Erlang Public License is *not* GNU GPL-compatible, because it includes some restriction that the GNU GPL does not impose. If this is true, then you are not legally allowed to create a "whole" by linking EPL'ed code and GNU Readline, because you would not be able to distribute that "whole" under the terms of the GNU GPL. (NOTE: "distributing under the terms of the GNU GPL" does *not* mean "relicense all the components under the GNU GPL"). Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From richardc@REDACTED Thu Apr 10 12:43:39 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 10 Apr 2008 12:43:39 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207818301.4462.16.camel@piko.site> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <1207818301.4462.16.camel@piko.site> Message-ID: <47FDEF5B.9080006@it.uu.se> Alp?r J?ttner wrote: > In fact, there there is a paragraph in GNU GPL that seems to define when > it is not necessary to use GPL in your work using a GPL software: > > A compilation of a covered work with other separate and > independent works, which are not by their nature extensions of > the covered work, and which are not combined with it such as to > form a larger program, in or on a volume of a storage or > distribution medium, is called an ?aggregate? if the compilation > and its resulting copyright are not used to limit the access or > legal rights of the compilation's users beyond what the > individual works permit. Inclusion of a covered work in an > aggregate does not cause this License to apply to the other > parts of the aggregate. > > Assume that Erlang is linked against a GPL lib. Is that an aggregation? > (Then no GPL is necessary) Or it "is combined with it such as to form a > larger program" (Then Erlang seems to be requested to use GPL)? It is > far too fuzzy for me. I haven't looked at the GLP v3 until now, but interestingly, they've removed the use of the term "derived work", and are now referring only to "a modified version of the earlier work" or "a work based on the earlier work", and it's harder to see exactly what this means, but the main clues are 1) your quote above, in particular the part "separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program", and 2) the last paragraph of the license: "The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License." From that, I'd say it's not very fuzzy: you can't link with a GPL library (neither statically nor dynamically) without creating a "work based on" the library, and hence, the rest of the work needs to be made available under the GPL. An aggregation, on the other hand, would be e.g. to include a standalone GNU program (with sources), such as gcc, along with the OTP distribution. /Richard From frank@REDACTED Thu Apr 10 13:21:47 2008 From: frank@REDACTED (Frank Mueller) Date: Thu, 10 Apr 2008 13:21:47 +0200 (CEST) Subject: [erlang-questions] R12B at CEAN? Message-ID: <41797.80.228.111.17.1207826507.squirrel@secure.mworld.biz> Hello, does anyone know when I can expect R12B at CEAN. There hase been a mail which said that it will be with R12B-1. I don't want to compile it on my own. *g* Regards mue -- ** ** Frank Mueller / Oldenburg / Germany ** ** http://frank.mweb.de and http://mue.tideland.biz ** From richardc@REDACTED Thu Apr 10 13:39:29 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 10 Apr 2008 13:39:29 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207818667.6159.419.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> Message-ID: <47FDFC71.7060308@it.uu.se> Alceste Scalas wrote: >> Really? Here's what the GPL (v2) says: >> >> b) You must cause any work that you distribute or publish, that in >> whole or in part contains or is derived from the Program or any part >> thereof, to be licensed as a whole at no charge to all third parties >> under the terms of this License. >> >> As far as I can see, this is rather clear: *if* you distribute the derived >> work, then all of it *has* to be provided under the GPL ("this License"), > > "As a whole" refers to the final product (as I called it in my previous > email) taken in its entirety. But it may be composed by parts (e.g. > code portions) that, taken alone, have different (albeit GNU > GPL-compatible) licenses. > > In fact, as you report, the GNU GPL v2 also says that: > >> "These requirements apply to the modified work as a whole. If identifiable >> sections of that work are not derived from the Program, and can be >> reasonably considered independent and separate works in themselves, then >> this License, and its terms, do not apply to those sections when you >> distribute them as separate works. But when you distribute the same sections >> as part of a whole which is a work based on the Program, the distribution of >> the whole must be on the terms of this License, whose permissions for other >> licensees extend to the entire whole, and thus to each and every part >> regardless of who wrote it." > > The GNU GPL v3 has the same conditions with different wording. Yes, and they mean that *if* you distribute the work, *including* the GPL parts, then *all* parts, including those that come under non-GPL (but compatible) licenses, must be made available *under the GPL*. (Assuming all involved licenses allow the combination to be made.) Hence, the only way a license can be GPL-compatible is if it allows redistribution under GPL. Quoted from www.gnu.org GPL-faq: "What does it mean to say a license is ?compatible with the GPL?? - It means that the other license and the GNU GPL are compatible; you can combine code released under the other license with code released under the GNU GPL in one larger program. All GNU GPL versions permit such combinations privately; they also permit distribution of such combinations provided the combination is released under the same GNU GPL version. The other license is compatible with the GPL if it permits this too." Note: "provided the combination is released under the same GNU GPL version". *Not* just any "GNU GPL-compatible licenses" as you wrote. The EPL is not GPL-compatible, and Erlang modules are dynamically linked, so it is not possible to use GPL:ed Erlang modules if you want to distribute the result. LGPL should be ok for Erlang code, however. >> The LGPL differs in that it does not consider code that merely links to >> your program to be a derived work. > > Well, not exactly. Under the copyright law, a program that > depends/links to a library *is* a derived work, Which "the copyright law"? Quote, please. > Unlike the GNU GPL, the GNU LGPL does *not* require that the derived product > is released "as a whole" under compatible licensing terms No, in fact the LGPL quite explicitly says what a derived work is: 'Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.' and 'A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License.' So, if something qualifies as a "derived work" under the LGPL, then it *must* be licensed under LGPL. Examples are: 1) modifications/extensions to the library itself, and 2) a statically linked/combined program. Otherwise, the code is "a work that uses the Library", and in that case the LGPL does not affect it: "...is not a derivative work of the Library, and therefore falls outside the scope of this License". Example: code that links dynamically to a separately compiled LGPL library. (E.g., tricks like compile-time module merging are technically not allowed.) The bottom line is that the GPL most definitely is "viral" (but in a good way). It divides code into two distinct worlds: The GPL code is free forever, and you can only build on it if you agree to keeping the results free. Otherwise, you must go find some other code to build on if you want a free ride. GPL is not what everyone wants, but there are other licenses. /Richard From alceste@REDACTED Thu Apr 10 14:37:04 2008 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 10 Apr 2008 14:37:04 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FDFC71.7060308@it.uu.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> Message-ID: <1207831024.6159.466.camel@gnatziu.crs4.it> Il giorno gio, 10/04/2008 alle 13.39 +0200, Richard Carlsson ha scritto: > Yes, and they mean that *if* you distribute the work, *including* the GPL > parts, then *all* parts, including those that come under non-GPL (but > compatible) licenses, must be made available *under the GPL*. (Assuming > all involved licenses allow the combination to be made.) > > Hence, the only way a license can be GPL-compatible is if it allows > redistribution under GPL. Yes. Maybe we were trying to say the same thing. There is one point that I wanted to clarify, though (based on the wrong GNU GPL assumptions that started this sub-thread): the GNU GPL does *not* require you to license (or re-license) your code under the GNU GPL itself. If your code is under a MIT-like license, it won't be "infected". > "What does it mean to say a license is ?compatible with the GPL?? > - It means that the other license and the GNU GPL are compatible; you > can combine code released under the other license with code released > under the GNU GPL in one larger program. > > All GNU GPL versions permit such combinations privately; they also > permit distribution of such combinations provided the combination is > released under the same GNU GPL version. The other license is compatible > with the GPL if it permits this too." > > Note: "provided the combination is released under the same GNU GPL version". > *Not* just any "GNU GPL-compatible licenses" as you wrote. Yes, it refers to the combination "as a whole". But, as I wrote, its parts taken alone may be covered by different, GNU GPL-compatible licenses. If program "bar" is under MIT and depends on the GNU GPL'ed "libfoo", then "bar + libfoo" must be distributed complying with the terms of the GNU GPL. This fact, however, does not require to change/infect the license of "bar" taken alone. > The EPL is not GPL-compatible, and Erlang modules are dynamically linked, > so it is not possible to use GPL:ed Erlang modules if you want to distribute > the result. LGPL should be ok for Erlang code, however. But Erlang does *not* derive/depend on GNU GPL'ed modules: it just has the capability to load them and make them available to Erlang programs. The GNU GPL FAQ suggests a different conclusion about GNU GPL'ed Erlang modules: If a programming language interpreter is released under the GPL, does that mean programs written to be interpreted by it must be under GPL-compatible licenses? [...] [W]hen the interpreter is extended to provide ?bindings? to other facilities (often, but not necessarily, libraries), the interpreted program is effectively linked to the facilities it uses through these bindings. So if these facilities are released under the GPL, the interpreted program that uses them must be released in a GPL-compatible way. The JNI or Java Native Interface is an example of such a binding mechanism; libraries that are accessed in this way are linked dynamically with the Java programs that call them. These libraries are also linked with the interpreter. If the interpreter is linked statically with these libraries, or if it is designed to link dynamically with these specific libraries, then it too needs to be released in a GPL-compatible way. Thus, you *can* develop GNU GPL'ed Erlang modules, or modules that link to GNU GPL libraries, and load them on the Erlang VM. But the Erlang programs that actually link/depend on them must be released under a GNU GPL-compatible license. > > Under the copyright law, a program that depends/links to a library > > *is* a derived work, > > Which "the copyright law"? Quote, please. > > > Unlike the GNU GPL, the GNU LGPL does *not* require that the derived > > product is released "as a whole" under compatible licensing terms > > No, in fact the LGPL quite explicitly says what a derived work is: [...] D'oh, you're right. I did not check the license, and remembered it wrong... Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From ellisonbg.net@REDACTED Thu Apr 10 16:43:41 2008 From: ellisonbg.net@REDACTED (Brian Granger) Date: Thu, 10 Apr 2008 08:43:41 -0600 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207831024.6159.466.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> Message-ID: <6ce0ac130804100743i189c2033pcb64e45b0aae3d9d@mail.gmail.com> Just for reference: http://www.gnu.org/licenses/gpl-faq.html#IfLibraryIsGPL But, mind you, I don't think that everyone agrees with this interpretation and it this (as far as I know) has not been tested in court. This is one of the problems I have with the GPL though - it is complicated enough that I am not sure what it says exactly. Cheers, Brian On Thu, Apr 10, 2008 at 6:37 AM, Alceste Scalas wrote: > Il giorno gio, 10/04/2008 alle 13.39 +0200, Richard Carlsson ha scritto: > > > Yes, and they mean that *if* you distribute the work, *including* the GPL > > parts, then *all* parts, including those that come under non-GPL (but > > compatible) licenses, must be made available *under the GPL*. (Assuming > > all involved licenses allow the combination to be made.) > > > > Hence, the only way a license can be GPL-compatible is if it allows > > redistribution under GPL. > > Yes. Maybe we were trying to say the same thing. > > There is one point that I wanted to clarify, though (based on the wrong > GNU GPL assumptions that started this sub-thread): the GNU GPL does > *not* require you to license (or re-license) your code under the GNU GPL > itself. If your code is under a MIT-like license, it won't be > "infected". > > > > > "What does it mean to say a license is "compatible with the GPL?" > > - It means that the other license and the GNU GPL are compatible; you > > can combine code released under the other license with code released > > under the GNU GPL in one larger program. > > > > All GNU GPL versions permit such combinations privately; they also > > permit distribution of such combinations provided the combination is > > released under the same GNU GPL version. The other license is compatible > > with the GPL if it permits this too." > > > > Note: "provided the combination is released under the same GNU GPL version". > > *Not* just any "GNU GPL-compatible licenses" as you wrote. > > Yes, it refers to the combination "as a whole". But, as I wrote, its > parts taken alone may be covered by different, GNU GPL-compatible > licenses. If program "bar" is under MIT and depends on the GNU GPL'ed > "libfoo", then "bar + libfoo" must be distributed complying with the > terms of the GNU GPL. This fact, however, does not require to > change/infect the license of "bar" taken alone. > > > > > The EPL is not GPL-compatible, and Erlang modules are dynamically linked, > > so it is not possible to use GPL:ed Erlang modules if you want to distribute > > the result. LGPL should be ok for Erlang code, however. > > But Erlang does *not* derive/depend on GNU GPL'ed modules: it just has > the capability to load them and make them available to Erlang programs. > > The GNU GPL FAQ suggests a different conclusion about GNU GPL'ed Erlang > modules: > > If a programming language interpreter is released under the GPL, > does that mean programs written to be interpreted by it must be > under GPL-compatible licenses? > > [...] > [W]hen the interpreter is extended to provide "bindings" > to other facilities (often, but not necessarily, > libraries), the interpreted program is effectively > linked to the facilities it uses through these bindings. > So if these facilities are released under the GPL, the > interpreted program that uses them must be released in a > GPL-compatible way. The JNI or Java Native Interface is > an example of such a binding mechanism; libraries that > are accessed in this way are linked dynamically with the > Java programs that call them. These libraries are also > linked with the interpreter. If the interpreter is > linked statically with these libraries, or if it is > designed to link dynamically with these specific > libraries, then it too needs to be released in a > GPL-compatible way. > > Thus, you *can* develop GNU GPL'ed Erlang modules, or modules that link > to GNU GPL libraries, and load them on the Erlang VM. But the Erlang > programs that actually link/depend on them must be released under a GNU > GPL-compatible license. > > > > > > Under the copyright law, a program that depends/links to a library > > > *is* a derived work, > > > > Which "the copyright law"? Quote, please. > > > > > Unlike the GNU GPL, the GNU LGPL does *not* require that the derived > > > product is released "as a whole" under compatible licensing terms > > > > No, in fact the LGPL quite explicitly says what a derived work is: [...] > > D'oh, you're right. I did not check the license, and remembered it > wrong... > > > Regards, > > alceste > -- > Alceste Scalas > CRS4 - http://www.crs4.it/ > > _______________________________________________ > > > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jao@REDACTED Thu Apr 10 15:47:37 2008 From: jao@REDACTED (Jack Orenstein) Date: Thu, 10 Apr 2008 09:47:37 -0400 (EDT) Subject: [erlang-questions] erlounge: Erlounge in Ottawa, Canada, Wednesday May 7th? In-Reply-To: <290b3ba10804092143w2820e0b2v83f1340be6be4b0f@mail.gmail.com> References: <290b3ba10804092143w2820e0b2v83f1340be6be4b0f@mail.gmail.com> Message-ID: <61768.207.190.221.98.1207835257.squirrel@geophile.com> On Thu, April 10, 2008 12:43 am, t ty wrote: > I propose to meet for an "Erlounge" in Ottawa, Canada, during the > first week of May, with Wednesday the 7th as a tentative date. > > College Square or Downtown/Byward Market would be two possible areas. > > Please respond if you can attend and make a location suggestion, or > even an alternate date. Prior estimate on individuals a week before > would help determine if we need to reserve a table. The annual Postgres conference, PGCon 2008 is in Ottawa, May 20-23 (http://www.pgcon.org/2008). I don't know that there's a lot of overlap, but I'm attending PGCon and would attend the Erlounge if it overlapped. Jack Orenstein From tty.erlang@REDACTED Thu Apr 10 18:36:36 2008 From: tty.erlang@REDACTED (t ty) Date: Thu, 10 Apr 2008 12:36:36 -0400 Subject: [erlang-questions] erlounge: Erlounge in Ottawa, Canada, Wednesday May 7th? In-Reply-To: <61768.207.190.221.98.1207835257.squirrel@geophile.com> References: <290b3ba10804092143w2820e0b2v83f1340be6be4b0f@mail.gmail.com> <61768.207.190.221.98.1207835257.squirrel@geophile.com> Message-ID: <290b3ba10804100936i1d9da7b7q5ab9c03d476d4fca@mail.gmail.com> Lets change it to the 21th then. Tee On Thu, Apr 10, 2008 at 9:47 AM, Jack Orenstein wrote: > > On Thu, April 10, 2008 12:43 am, t ty wrote: > > I propose to meet for an "Erlounge" in Ottawa, Canada, during the > > first week of May, with Wednesday the 7th as a tentative date. > > > > College Square or Downtown/Byward Market would be two possible areas. > > > > Please respond if you can attend and make a location suggestion, or > > even an alternate date. Prior estimate on individuals a week before > > would help determine if we need to reserve a table. > > The annual Postgres conference, PGCon 2008 is in Ottawa, May 20-23 > (http://www.pgcon.org/2008). I don't know that there's a lot of > overlap, but I'm attending PGCon and would attend the Erlounge > if it overlapped. > > Jack Orenstein > > > From dnew@REDACTED Thu Apr 10 19:16:55 2008 From: dnew@REDACTED (Darren New) Date: Thu, 10 Apr 2008 10:16:55 -0700 Subject: [erlang-questions] Erlang version In-Reply-To: References: Message-ID: <47FE4B87.5040004@san.rr.com> Xiangrong Fang wrote: > How do I get the version of erlang I am running now? there seems no > --version or similar switch to erl or erlc. I was looking for that in the permuted index yesterday and couldn't find it. (I find the documentation, as I'm learning Erlang, to be fairly frustrating. :-) It would probably be a good idea to either add this to the FAQ or get the word "version" into the description of something somewhere. Even google didn't find anything useful for me. -- Darren New / San Diego, CA, USA (PST) "That's pretty. Where's that?" "It's the Age of Channelwood." "We should go there on vacation some time." From david.hopwood@REDACTED Thu Apr 10 19:24:52 2008 From: david.hopwood@REDACTED (David-Sarah Hopwood) Date: Thu, 10 Apr 2008 18:24:52 +0100 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207831024.6159.466.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> Message-ID: <47FE4D64.4010305@industrial-designers.co.uk> Alceste Scalas wrote: > But Erlang does *not* derive/depend on GNU GPL'ed modules: it just has > the capability to load them and make them available to Erlang programs. > > The GNU GPL FAQ suggests a different conclusion about GNU GPL'ed Erlang > modules: > > If a programming language interpreter is released under the GPL,, > does that mean programs written to be interpreted by it must be > under GPL-compatible licenses? Erlang/OTP isn't released under the GPL, so this FAQ answer does not apply. (Note that for the Java Native Interface example, Sun's main implementations of the JVM are currently released under GPLv2.) To answer Brian Granger's point that started this subthread: > The biggest problem is that GPL code can't be used in open source BSD > style projects (the GPL would require releasing the resulting work > under the GPL license). Perfect example: Erlang is not GPL. Thus > Erlang cannot be distributed with code that links to or uses GPL code: > readline and FFTW begin examples. a more relevant FAQ answer is the following one: > I'm writing a Windows application with Microsoft Visual C++ (or Visual Basic) > and I will be releasing it under the GPL. Is dynamically linking my program > with the Visual C++ (or Visual Basic) run-time library permitted under the GPL? > > The GPL permits this because that run-time library normally accompanies > the compiler or interpreter you are using. The run-time libraries here > are ?System Libraries? as GPLv3 defines them, and as such they are not > considered part of the Corresponding Source. GPLv2 has a similar exception > in section 3. The GPLv3 definition of "System Libraries" is: The ?System Libraries? of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A ?Major Component?, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. An Erlang/OTP runtime is clearly "an object code interpreter used to run" the program, therefore it is a Major Component of the program. So there is no problem with linking parts of GPLv3-licensed Erlang programs, such as drivers, with the relevant components of Erlang/OTP that they need to be linked with, even when Erlang/OTP is not acting as a pure interpreter for those programs. Also, GPL code can be distributed with a copy of the Erlang/OTP runtime if the result is only an "aggregate" of the code and the runtime (although this is a slightly grey area because it could be argued in some cases that they have been "combined [...] such as to form a larger program"). However, if a GPL-licensed program required a patch to Erlang/OTP in order to work correctly, for example, it would not be legal to distribute the patched Erlang/OTP source with the program. IANAL, HTH. -- David-Sarah Hopwood From richardc@REDACTED Thu Apr 10 22:08:41 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 10 Apr 2008 22:08:41 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FE4D64.4010305@industrial-designers.co.uk> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE4D64.4010305@industrial-designers.co.uk> Message-ID: <47FE73C9.5030008@it.uu.se> David-Sarah Hopwood wrote: > An Erlang/OTP runtime is clearly "an object code interpreter used to run" > the program, therefore it is a Major Component of the program. So there is > no problem with linking parts of GPLv3-licensed Erlang programs, such as > drivers, with the relevant components of Erlang/OTP that they need to be > linked with, even when Erlang/OTP is not acting as a pure interpreter for > those programs. Yes, I think there can be very little doubt that the Erlang/OTP runtime system and the included standard library modules are not affected by compiling and running GPL:ed modules, or packaging the OTP distribution with GPL:ed code, any more than a JVM+libraries would be affected by being shipped along with a GPL Java application. Hence, the compatibility of GPL with the EPL as used in the runtime system and libraries is simply not an issue. But if some people are using the EPL for their own Erlang projects, and want to call GPL:ed modules, any (in)compatibility would have to be considered. > Also, GPL code can be distributed with a copy of the Erlang/OTP runtime > if the result is only an "aggregate" of the code and the runtime (although > this is a slightly grey area because it could be argued in some cases that > they have been "combined [...] such as to form a larger program"). As long as the Erlang/OTP runtime is just a general infrastructure that the GPL code happens to run on, I think it is fairly clear that they are not considered to be combined (but I'm no lawyer either). > However, if a GPL-licensed program required a patch to Erlang/OTP in order > to work correctly, for example, it would not be legal to distribute the > patched Erlang/OTP source with the program. Quite. And a linked-in port driver, providing e.g. a Qt-binding or somesuch, which is published (the driver code) under GPL, would force Erlang modules that depend on the port driver to also be GPL:ed. /Richard From richardc@REDACTED Thu Apr 10 22:17:48 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 10 Apr 2008 22:17:48 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207831024.6159.466.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> Message-ID: <47FE75EC.7010102@it.uu.se> Alceste Scalas wrote: > Il giorno gio, 10/04/2008 alle 13.39 +0200, Richard Carlsson ha scritto: >> Yes, and they mean that *if* you distribute the work, *including* the GPL >> parts, then *all* parts, including those that come under non-GPL (but >> compatible) licenses, must be made available *under the GPL*. (Assuming >> all involved licenses allow the combination to be made.) >> >> Hence, the only way a license can be GPL-compatible is if it allows >> redistribution under GPL. > > Yes. Maybe we were trying to say the same thing. > > There is one point that I wanted to clarify, though (based on the wrong > GNU GPL assumptions that started this sub-thread): the GNU GPL does > *not* require you to license (or re-license) your code under the GNU GPL > itself. If your code is under a MIT-like license, it won't be > "infected". This is only true in the completely uninteresting (for this discussion) case when you *do not distribute* the combined work. As soon as you do, however, you *must* make the whole work available under the GPL. If some parts are (only) distributed under an incompatible license (that does not allow re-licensing or adds restrictions), they *cannot* be combined and distributed. (I suppose that it is allowed to combine them for personal or company-internal purposes, but I can't be bothered to research that point right now.) If you are a software company, and one of your employees by sheer ignorance uses GPL software in your product, and you ship that product, then the only way you can avoid violating the GPL is to publish all your source code for that product. It is most definitely "viral" in that sense. If you don't want people to see your code, you need to be fairly careful about using free software. (I'm not condoning any particular behaviour here, just describing some realities of software companies. There are many reasons, good and bad, for not wanting to show your code to the world.) > Yes, it refers to the combination "as a whole". But, as I wrote, its > parts taken alone may be covered by different, GNU GPL-compatible > licenses. If program "bar" is under MIT and depends on the GNU GPL'ed > "libfoo", then "bar + libfoo" must be distributed complying with the > terms of the GNU GPL. This fact, however, does not require to > change/infect the license of "bar" taken alone. That is entirely uninteresting, because it *does* force you to distribute "bar" under the GPL (when you ship it with libfoo). Once you've done that, it is officially free software, and anyone can keep using and modifying that source code (under the GPL). But it does not force the copyright owner of "bar" to publish that work only under the GPL from now on, that much is true; and if he modifies "bar" to "bar2" which does not use libfoo, then bar2 does not have to be GPL:ed if it is distributed. But this is really of minor interest. The main thing is that if you don't *want* your code to be licensed under GPL at all, then you *cannot* link it with GPL software. > But Erlang does *not* derive/depend on GNU GPL'ed modules: it just has > the capability to load them and make them available to Erlang programs. > [...] Anyhow, the text you quoted does not apply here (the Erlang interpreter is not published under GPL), but the paragraphs that followed is just as valid for Erlang as for Perl or Java: "Another similar and very common case is to provide libraries with the interpreter which are themselves interpreted. For instance, Perl comes with many Perl modules, and a Java implementation comes with many Java classes. These libraries and the programs that call them are always dynamically linked together. A consequence is that if you choose to use GPL'd Perl modules or Java classes in your program, you must release the program in a GPL-compatible way, regardless of the license used in the Perl or Java interpreter that the combined Perl or Java program will run on." A language interpreter and its runtime system and libraries are not affected by the code running under it, just like an operating system (Windows does not violate the GPL just because you run Gimp on it), but the modules being interpreted are considered as programs being linked to each other. > Thus, you *can* develop GNU GPL'ed Erlang modules, or modules that > link to GNU GPL libraries, and load them on the Erlang VM. But the > Erlang programs that actually link/depend on them must be released > under a GNU GPL-compatible license. Just so. But the status of the Erlang/OTP distribution in relation to the code that runs on it was never much questioned here. /Richard From klacke@REDACTED Thu Apr 10 23:14:55 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 10 Apr 2008 23:14:55 +0200 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <47FE834F.9040507@hyber.org> Robert Virding wrote: > Hello everyone, > > I will soon be releasing the next version of LFE (Lisp Flavoured For yaws I choose the BSD license, similar goals to yours. I wanted the cred - but also wanted people to use it, also (actually particularly) commercial users. /klacke From dnew@REDACTED Thu Apr 10 23:38:21 2008 From: dnew@REDACTED (Darren New) Date: Thu, 10 Apr 2008 14:38:21 -0700 Subject: [erlang-questions] Erlang version In-Reply-To: <47FE4B87.5040004@san.rr.com> References: <47FE4B87.5040004@san.rr.com> Message-ID: <47FE88CD.4040108@san.rr.com> Darren New wrote: > either add this to the FAQ Huh. It *is* in the FAQ. I wonder why I didn't see that before. Is there a public bug-tracker? I don't see Erlang itself hosted on source forge, nor do I see any obvious link on erlang.org, but maybe I'm missing something? -- Darren New / San Diego, CA, USA (PST) "That's pretty. Where's that?" "It's the Age of Channelwood." "We should go there on vacation some time." From mats.cronqvist@REDACTED Fri Apr 11 08:42:33 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 11 Apr 2008 08:42:33 +0200 Subject: [erlang-questions] Erlang version In-Reply-To: <47FE88CD.4040108@san.rr.com> References: <47FE4B87.5040004@san.rr.com> <47FE88CD.4040108@san.rr.com> Message-ID: <47FF0859.8050406@kreditor.se> Darren New wrote: > Darren New wrote: > >> either add this to the FAQ >> > > Huh. It *is* in the FAQ. I wonder why I didn't see that before. > > Is there a public bug-tracker? I don't see Erlang itself hosted on > source forge, nor do I see any obvious link on erlang.org, but maybe I'm > missing something? > > the bug tracker is top secret, since it potentially contains sensitive ericsson info. -------------- next part -------------- A non-text attachment was scrubbed... Name: mats_cronqvist.vcf Type: text/x-vcard Size: 179 bytes Desc: not available URL: From chsu79@REDACTED Fri Apr 11 09:14:43 2008 From: chsu79@REDACTED (Christian S) Date: Fri, 11 Apr 2008 09:14:43 +0200 Subject: [erlang-questions] Erlang version In-Reply-To: <47FF0859.8050406@kreditor.se> References: <47FE4B87.5040004@san.rr.com> <47FE88CD.4040108@san.rr.com> <47FF0859.8050406@kreditor.se> Message-ID: > the bug tracker is top secret, since it potentially contains sensitive > ericsson info. I sense irony here. Should I? PS Would OTP follow tickets in a community-driven bug-tracker if the community set one up and maintained it? From mats.cronqvist@REDACTED Fri Apr 11 09:52:31 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 11 Apr 2008 09:52:31 +0200 Subject: [erlang-questions] Erlang version In-Reply-To: References: <47FE4B87.5040004@san.rr.com> <47FE88CD.4040108@san.rr.com> <47FF0859.8050406@kreditor.se> Message-ID: <47FF18BF.7010208@kreditor.se> Christian S wrote: >> the bug tracker is top secret, since it potentially contains sensitive >> ericsson info. >> > > I sense irony here. Should I? > that's always the safe bet. alas, in this case it's reality that's ironic. my personal opinion is that a public bug tracker would improve the quality and usability of OTP, and hence the ericsson products that are based on OTP. otoh, it would require an initial cost for OTP, both technically and politically. so the cost/benefit analysis is not trivial. mats -------------- next part -------------- A non-text attachment was scrubbed... Name: mats_cronqvist.vcf Type: text/x-vcard Size: 179 bytes Desc: not available URL: From alceste@REDACTED Fri Apr 11 10:23:46 2008 From: alceste@REDACTED (Alceste Scalas) Date: Fri, 11 Apr 2008 10:23:46 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FE75EC.7010102@it.uu.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> Message-ID: <1207902226.6159.521.camel@gnatziu.crs4.it> Il giorno gio, 10/04/2008 alle 22.17 +0200, Richard Carlsson ha scritto: > Alceste Scalas wrote: > > There is one point that I wanted to clarify, though (based on the wrong > > GNU GPL assumptions that started this sub-thread): the GNU GPL does > > *not* require you to license (or re-license) your code under the GNU GPL > > itself. If your code is under a MIT-like license, it won't be > > "infected". > > This is only true in the completely uninteresting (for this discussion) > case when you *do not distribute* the combined work. It *is* interesting for this discussion, because (I repeat) I started this sub-thread in order to correct a very specific misconception: http://erlang.org/pipermail/erlang-questions/2008-April/034274.html If you were to release your project under the GPL, anyone who wants to use it may have to release their code under the GPL (even if it is open source (BSD, MIT, etc.)) (unless you include a special runtime exception, but that gets pretty subtle). This is actually wrong. People are free to provide their code under any GNU GPL-compatible license (BSD, MIT, etc.). The program "as a whole" will need to follow the terms of the GNU GPL, *but* its parts taken alone will retain their (GNU GPL-compatible) license. Anyone will be free to take them, remove dependencies from GNU GPL'ed code and, thus, ignore GNU GPL terms. In other words, the code is not "tainted" or "infected" by the GNU GPL. It seems to me that we agreed on this point since the beginning, so the discussion on it should be over. I also agree (of course) with the rest of your email about proprietary software that conflicts with the GNU GPL, but it's not related with the subject of this sub-thread. > The status of the Erlang/OTP distribution in relation to the code that > runs on it was never much questioned here. Ok, then maybe I misunderstood the following sentence: http://erlang.org/pipermail/erlang-questions/2008-April/034307.html The EPL is not GPL-compatible, and Erlang modules are dynamically linked, so it is not possible to use GPL:ed Erlang modules if you want to distribute the result. LGPL should be ok for Erlang code, however. I interpreted it as: "you cannot develop GNU GPL'ed Erlang modules, or modules that depend on them, because they would be incompatible with the EPL'ed Erlang runtime". I was explaining why it was not the case (and the end of the GNU GPL FAQ passage I quoted referred to this specific problem). But maybe you just meant that EPL'ed modules cannot depend on GNU GPL'ed libraries/drivers/modules... If this is the case, then (of course) I do agree with you. Regards, alceste -- Alceste Scalas CRS4 - http://www.crs4.it/ From hans.bolinder@REDACTED Fri Apr 11 10:40:43 2008 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Fri, 11 Apr 2008 10:40:43 +0200 Subject: [erlang-questions] Weird pg2 behavior In-Reply-To: References: Message-ID: <18431.9227.133848.989614@gargle.gargle.HOWL> [Matthew Dempsky:] > We're seeing weird behavior with pg2, namely that dead pids are not > getting cleared from the pg2:get_members table. E.g. > > 250> [X || X <- pg2:get_members(Group) -- > pg2:get_local_members(Group), node(X) =:= node()]. > [<0.795.0>,<0.794.0>,<0.793.0>,<0.792.0>,<0.791.0>, > <0.790.0>,<0.789.0>,<0.773.0>] > > Am I correct that this is a bug in pg2? It seems that pg2:leave() assumes that the pid is a member of the group. The patch below should solve that problem ('ok' is returned if the group exists but the pid is not a member of the group). Best regards, Hans Bolinder, Erlang OTP/team *** /usr/local/otp/releases/otp_beam_solaris8_r12b_patched/lib/kernel-2.12.1.2/src/pg2.erl Tue Mar 4 13:37:04 2008 --- pg2.erl Tue Apr 8 09:53:10 2008 *************** *** 193,207 **** node(Pid) =:= node() -> [{_, LocalMembers}] = ets:lookup(pg2_table, {local_members, Name}), ! ets:insert(pg2_table, ! {{local_members, Name}, ! lists:delete(Pid, LocalMembers)}), ! NLinks = lists:delete(Pid, S#state.links), ! case lists:member(Pid, NLinks) of ! true -> ok; ! false -> unlink(Pid) ! end, ! NLinks; true -> S#state.links end, --- 193,212 ---- node(Pid) =:= node() -> [{_, LocalMembers}] = ets:lookup(pg2_table, {local_members, Name}), ! case lists:member(Pid, LocalMembers) of ! true -> ! ets:insert(pg2_table, ! {{local_members, Name}, ! lists:delete(Pid, LocalMembers)}), ! NLinks = lists:delete(Pid, S#state.links), ! case lists:member(Pid, NLinks) of ! true -> ok; ! false -> unlink(Pid) ! end, ! NLinks; ! false -> ! S#state.links ! end; true -> S#state.links end, From matthew@REDACTED Fri Apr 11 12:02:10 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 11 Apr 2008 03:02:10 -0700 Subject: [erlang-questions] [erlang-bugs] Weird pg2 behavior In-Reply-To: <18431.9227.133848.989614@gargle.gargle.HOWL> References: <18431.9227.133848.989614@gargle.gargle.HOWL> Message-ID: On Fri, Apr 11, 2008 at 1:40 AM, Hans Bolinder wrote: > It seems that pg2:leave() assumes that the pid is a member of the > group. The patch below should solve that problem ('ok' is returned if > the group exists but the pid is not a member of the group). Ah, good find. I'm curious though, in one of the gen_servers affected, in the module's init/1 we call pg2:create(?GROUP) and then pg2:join(?GROUP, self()), but then we never call pg2:leave (leaving it to pg2 to clean up if the process crashes). How would this issue affect this server? Looking at the R12B-1 Erlang source, the only module that uses pg2 is disk_log_sup. Looking at modules in OTP that mention disk_log, the only one that might possibly affect us is mnesia, but the above described server process only uses mnesia:dirty_read and only on a ram_copies table. (It also updates this table, but only indirectly by cast'ing a request to another gen_server to handle it.) It would seem like either mnesia's disk_log usage is broken or there's another pg2 bug to be discovered. :( From richardc@REDACTED Fri Apr 11 13:07:42 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 11 Apr 2008 13:07:42 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207902226.6159.521.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> Message-ID: <47FF467E.5070701@it.uu.se> Alceste Scalas wrote: > It *is* interesting for this discussion, because (I repeat) I started > this sub-thread in order to correct a very specific misconception: > > http://erlang.org/pipermail/erlang-questions/2008-April/034274.html > If you were to release your project under the GPL, > anyone who wants to use it may have to release their > code under the GPL (even if it is open source (BSD, MIT, > etc.)) (unless you include a special runtime exception, > but that gets pretty subtle). > > This is actually wrong. People are free to provide their code under any > GNU GPL-compatible license (BSD, MIT, etc.). The program "as a whole" > will need to follow the terms of the GNU GPL, *but* its parts taken > alone will retain their (GNU GPL-compatible) license. Anyone will be > free to take them, remove dependencies from GNU GPL'ed code and, thus, > ignore GNU GPL terms. In other words, the code is not "tainted" or > "infected" by the GNU GPL. I see now more exactly what it is you are saying: that the GPL would apply only to the combined software as a whole. But here is what the license (v2) actually says: "These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it." Note in particular: "the entire whole, and thus to each and every part". This means that if such a part was previously only published under e.g. an MIT license, it (the particular version used by the combined software) must now also be published *also* under the GPL, and can from that point on be used by anyone under the GPL even as an isolated component, *even if this is not what you as the author of the MIT-licensed part would like*. As far as I can tell, this is precisely what the original post means with "anyone who wants to use it may have to release their code under the GPL", and you claim that that is wrong. > Ok, then maybe I misunderstood the following sentence: > > http://erlang.org/pipermail/erlang-questions/2008-April/034307.html > The EPL is not GPL-compatible, and Erlang modules are > dynamically linked, so it is not possible to use GPL:ed > Erlang modules if you want to distribute the result. > LGPL should be ok for Erlang code, however. > > I interpreted it as: "you cannot develop GNU GPL'ed Erlang modules, or > modules that depend on them, because they would be incompatible with the > EPL'ed Erlang runtime". I was explaining why it was not the case (and > the end of the GNU GPL FAQ passage I quoted referred to this specific > problem). Well, I was not making a very clear statement. When I wrote that, I wasn't referring to the Erlang/OTP distribution itself, but about third-party code that uses the EPL (for some reason) and would like to use your code. Sorry about the confusion. /Richard From alceste@REDACTED Fri Apr 11 15:10:22 2008 From: alceste@REDACTED (Alceste Scalas) Date: Fri, 11 Apr 2008 15:10:22 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FF467E.5070701@it.uu.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> Message-ID: <1207919422.6159.590.camel@gnatziu.crs4.it> Il giorno ven, 11/04/2008 alle 13.07 +0200, Richard Carlsson ha scritto: > "These requirements apply to the modified work as a whole. If identifiable > sections of that work are not derived from the Program, and can be > reasonably considered independent and separate works in themselves, then > this License, and its terms, do not apply to those sections when you > distribute them as separate works. But when you distribute the same > sections as part of a whole which is a work based on the Program, the > distribution of the whole must be on the terms of this License, whose > permissions for other licensees extend to the entire whole, and thus to > each and every part regardless of who wrote it." > > Note in particular: "the entire whole, and thus to each and every part". > This means that if such a part was previously only published under e.g. > an MIT license, it (the particular version used by the combined software) > must now also be published *also* under the GPL, and can from that point on > be used by anyone under the GPL even as an isolated component, *even if this > is not what you as the author of the MIT-licensed part would like*. As > far as I can tell, this is precisely what the original post means with > "anyone who wants to use it may have to release their code under the GPL", > and you claim that that is wrong. Yes, I am pretty sure that this is wrong. Maybe it is necessary to specify what "on the terms of the GNU GPL" means in the passage above. Let's say that I have a file bar.c, released by some third party under the (GPL-compatible) BSD license. I modify it and make it depend on libfoo, which is GNU GPL'ed, in order to create the application gplbar. What does it happen? Let's make two hypothesis: A. the bar.c license is overwritten/substituted by the GNU GPL for further redistributions, even when separated from "the whole" gplbar; B. the (GPL-compatible) bar.c license remains the same, except (maybe) for the changes I made for linking libfoo. Anyway, the resulting application must now also respect the license of the new component (i.e. libfoo). And thus, "the whole" gplbar application must now be distributed on the terms of the GNU GPL. If someone later removes my changes, however, the bar.c code will not be bound to the GNU GPL anymore. If I understood correctly, you think that "A" is correct, while I think that "B" is correct. The GNU GPL passage you quoted is totally compatible with "B": it just says that, when I distribute "the whole" gplbar, then "each and every part" of it must give to the recipient/licensee all the permissions given by the GNU GPL. And since every GNU GPL-compatible license *does* offer, by definition, these permissions, then a change of license "of each and every part" is not required [1]. The same GNU GPL passage is also compatible with "A". But, as explained above, it does *not* *require* that the original license "of each and every part" is substituted/overwritten by the GNU GPL, "even if this is not what the author of the part would like". And the lack of this requirement is good, because the substitution/overwriting of the original license may be *illegal*: under the copyright law of every country I know about, only the author has the right to decide the usage conditions of the code he/she wrote --- and, for example, the BSD license does *not* allow such relicensing [2]. The MIT license, OTOH, does allow "sublicensing", so the scenario you've described *may* be possible for code under that license. However, it is *not* mandatory because of some GNU GPL requirement. Therefore, saying that GNU GPL'ed software requires to change the license of every other code it touches/links to is *not* correct. It is a "viral" property that the license simply does not have, and would make it incompatible with most of the "GNU GPL-compatible" licenses (!). Regards, alceste Notes: [1] The main pourpose of that GNU GPL paragraph is to clarify that, for example, I can't decide to distribute "the whole" gplbar with some binary-only parts just because their original source files, taken alone, are under a BSD-like license: if I do this, then I'm not guaranteeing the GNU GPL permissions "for each and every part" to the recipient/licensee. [2] BSD-licensed software, however, can be "proprietarized" because the license does allow redistribution in binary form, without sources --- provided that the proper credit is given to the original author(s). -- Alceste Scalas CRS4 - http://www.crs4.it/ From david.hopwood@REDACTED Fri Apr 11 15:35:15 2008 From: david.hopwood@REDACTED (David-Sarah Hopwood) Date: Fri, 11 Apr 2008 14:35:15 +0100 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FF467E.5070701@it.uu.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> Message-ID: <47FF6913.8080209@industrial-designers.co.uk> Richard Carlsson wrote: [...] > I see now more exactly what it is you are saying: that the GPL would apply > only to the combined software as a whole. But here is what the license (v2) > actually says: > "These requirements apply to the modified work as a whole. If identifiable > sections of that work are not derived from the Program, and can be > reasonably considered independent and separate works in themselves, then > this License, and its terms, do not apply to those sections when you > distribute them as separate works. But when you distribute the same > sections as part of a whole which is a work based on the Program, the > distribution of the whole must be on the terms of this License, whose > permissions for other licensees extend to the entire whole, and thus to > each and every part regardless of who wrote it." > > Note in particular: "the entire whole, and thus to each and every part". > This means that if such a part was previously only published under e.g. > an MIT license, it (the particular version used by the combined software) > must now also be published *also* under the GPL, and can from that point on > be used by anyone under the GPL even as an isolated component, *even if this > is not what you as the author of the MIT-licensed part would like*. Actually this is only true because the MIT license allows such publication (and similarly for other GPL-compatible licenses). That is, the MIT license does not limit republication under a more restrictive license, whether that is the GPL or something else. This is not a problem. -- David-Sarah Hopwood From david.hopwood@REDACTED Fri Apr 11 15:52:52 2008 From: david.hopwood@REDACTED (David-Sarah Hopwood) Date: Fri, 11 Apr 2008 14:52:52 +0100 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207919422.6159.590.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> Message-ID: <47FF6D34.8010107@industrial-designers.co.uk> Alceste Scalas wrote: > Il giorno ven, 11/04/2008 alle 13.07 +0200, Richard Carlsson ha scritto: >> "These requirements apply to the modified work as a whole. If identifiable >> sections of that work are not derived from the Program, and can be >> reasonably considered independent and separate works in themselves, then >> this License, and its terms, do not apply to those sections when you >> distribute them as separate works. But when you distribute the same >> sections as part of a whole which is a work based on the Program, the >> distribution of the whole must be on the terms of this License, whose >> permissions for other licensees extend to the entire whole, and thus to >> each and every part regardless of who wrote it." >> >> Note in particular: "the entire whole, and thus to each and every part". >> This means that if such a part was previously only published under e.g. >> an MIT license, it (the particular version used by the combined software) >> must now also be published *also* under the GPL, and can from that point on >> be used by anyone under the GPL even as an isolated component, *even if this >> is not what you as the author of the MIT-licensed part would like*. As >> far as I can tell, this is precisely what the original post means with >> "anyone who wants to use it may have to release their code under the GPL", >> and you claim that that is wrong. > > Yes, I am pretty sure that this is wrong. Maybe it is necessary to > specify what "on the terms of the GNU GPL" means in the passage above. > > Let's say that I have a file bar.c, released by some third party under > the (GPL-compatible) BSD license. I modify it and make it depend on > libfoo, which is GNU GPL'ed, in order to create the application gplbar. > What does it happen? Let's make two hypothesis: > > A. the bar.c license is overwritten/substituted by the GNU GPL for > further redistributions, even when separated from "the whole" > gplbar; > B. the (GPL-compatible) bar.c license remains the same, except > (maybe) for the changes I made for linking libfoo. Anyway, the > resulting application must now also respect the license of the > new component (i.e. libfoo). And thus, "the whole" gplbar > application must now be distributed on the terms of the GNU GPL. > If someone later removes my changes, however, the bar.c code > will not be bound to the GNU GPL anymore. > > If I understood correctly, you think that "A" is correct, while I think > that "B" is correct. "A" is correct. But the GPL is a red herring here. I can take any MIT-licensed code and redistribute it with the additional license term "to use this code, you must give me your first-born child", for example [*] (enforcability aside). This is not a problem, primarily because someone can still use the code distributed under the original license, and not give me their first-born child. The fact that the original copyright holder(s) chose an MIT or BSD-like license entails that they accepted the possibility of redistribution under any more restrictive license. [*] http://en.wikipedia.org/wiki/Rumpelstiltskin -- David-Sarah Hopwood From dgud@REDACTED Fri Apr 11 16:30:44 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 11 Apr 2008 16:30:44 +0200 Subject: [erlang-questions] wxErlang Message-ID: <47FF7614.3030002@erix.ericsson.se> I've made a new release. http://www.erlang.org/~dgud/wxerlang Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and re-wrote the connect/event api, so it's now incompatible with previous releases :-) NOTE it requires OTP-R12-2 though. Basically bigger, better and faster. Regards /Dan From richardc@REDACTED Fri Apr 11 16:33:19 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 11 Apr 2008 16:33:19 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <1207919422.6159.590.camel@gnatziu.crs4.it> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> Message-ID: <47FF76AF.1030809@it.uu.se> Alceste Scalas wrote: > Yes, I am pretty sure that this is wrong. Maybe it is necessary to > specify what "on the terms of the GNU GPL" means in the passage above. I think that is clear: the entire GNU GPL, every word of it, applies. > Let's say that I have a file bar.c, released by some third party under > the (GPL-compatible) BSD license. I modify it and make it depend on > libfoo, which is GNU GPL'ed, in order to create the application gplbar. > What does it happen? Let's make two hypothesis: > > A. the bar.c license is overwritten/substituted by the GNU GPL for > further redistributions, even when separated from "the whole" > gplbar; > B. the (GPL-compatible) bar.c license remains the same, except > (maybe) for the changes I made for linking libfoo. Anyway, the > resulting application must now also respect the license of the > new component (i.e. libfoo). And thus, "the whole" gplbar > application must now be distributed on the terms of the GNU GPL. > If someone later removes my changes, however, the bar.c code > will not be bound to the GNU GPL anymore. > > If I understood correctly, you think that "A" is correct, while I think > that "B" is correct. Not quite, I think that C is correct: C. The GNU GPL is *added* to the licensing of bar.c (the version shipped in the combined work gplbar). It does not invalidate the existing licenses. This is why license compatibility is an issue. The previous licenses must not contain restrictions that go against the GPL, otherwise the programs cannot be combined and distributed. If someone breaks out bar.c from gplbar, he must have the right to use and distribute it under the combined licenses including GPL. If this bar.c, modified or not, is identical to the bar.c published separately under some other license, then it is of course legal to also keep distributing it without GPL attached, but that does not take away the right of people to use it *with* GPL if they want. > a change of license "of each and every part" is not required. Not a change, but the addition, of a GPL license is required. This is exactly what the phrase "under the terms of this License" means. It says nothing about replacing any existing licenses. Here's a hint from the FAQ: "If there is no way to satisfy both licenses at once, they are incompatible." > And the lack of this requirement is good, because the > substitution/overwriting of the original license may be *illegal*: under > the copyright law of every country I know about, only the author has the > right to decide the usage conditions of the code he/she wrote --- and, > for example, the BSD license does *not* allow such relicensing [2]. Naturally, if the person who combines the programs and distributes them *has no right to do so*, either because the involved licenses are incompatible, or because that person is not allowed to relicense some of the involved parts, then the result has no legal effect; the act would be illegal. The "viral" part happens when you *do* have the right to relicense the non-GPL parts: in that case you *must* relicense them if you distribute the combined work, otherwise it is a violation of the GPL. > Therefore, saying that GNU GPL'ed software requires to change the > license of every other code it touches/links to is *not* correct. > > It is a "viral" property that the license simply does not have, and > would make it incompatible with most of the "GNU GPL-compatible" > licenses (!). On the contrary, the only way a license *can* be GPL-compatible is if it allows such relicensing. The MIT and Rodified BSD licenses, for example, both allow this (mainly because they do not *disallow* relicensing as long as it is in a compatible way), while the original BSD license with its "banner" clauses is incompatible due to its extra restrictions. /Richard From richardc@REDACTED Fri Apr 11 16:46:54 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 11 Apr 2008 16:46:54 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FF6D34.8010107@industrial-designers.co.uk> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> <47FF6D34.8010107@industrial-designers.co.uk> Message-ID: <47FF79DE.7070704@it.uu.se> David-Sarah Hopwood wrote: > "A" is correct. But the GPL is a red herring here. I can take any > MIT-licensed code and redistribute it with the additional license term > "to use this code, you must give me your first-born child", for example [*] > (enforcability aside). This is not a problem, primarily because someone > can still use the code distributed under the original license, and not > give me their first-born child. The fact that the original copyright > holder(s) chose an MIT or BSD-like license entails that they accepted > the possibility of redistribution under any more restrictive license. Yes, MIT was perhaps not the best example, but it seemed to be the most uncomplicated. A better example (to our tormented readers) would be: You are the copyright holder of product X, which you license under the MPL (not GPL-compatible) and you don't (for some reason) want your code to slip into GPL-land for love or money. But some way or another, you use a GPL:ed library Y in your product, and ship it. Some third party browses your code, sees your use of Y, and now demands that you release all of X (at least the version that uses Y) under the GPL. If your refuse to do that (you do have the right to do it if you want to), you would be violating the GPL. But that would be way too much to write. :-) /Richard From theczintheroc2007@REDACTED Fri Apr 11 17:04:06 2008 From: theczintheroc2007@REDACTED (Colin Z) Date: Fri, 11 Apr 2008 11:04:06 -0400 Subject: [erlang-questions] Good architecture principals Message-ID: As an exercise, I'm working on putting together a simple physics and collision detection library for a video game and I'm looking for some advice on good Erlang architecture. Right now I have the concept of a cell which uses gen_event and acts as a sort of hub for physics processes to communicate. A physics process is spawned with a cell PID to talk to and uses timer:send_interval to send itself update messages at a certain resolution (ie: every 33ms for a 30 frames per second simulation). When it gets an update message, it applies physics calculations to get its new position and then sends a {moved, self(), NewPosition} message to the cell which uses gen_event to notify all the other interested physics processes. When a physics process gets a "moved" message, it can compare the EntityPosition with its own position to see if a collision has occurred and act accordingly. How is something like this usually handled in Erlang? Given that a simulation might have thousands of physics processes, is it bad that I'm using a timer for each one? Would it be better to have a single process with a single timer and a list of physics records to partition and update? -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Fri Apr 11 18:23:04 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 11 Apr 2008 09:23:04 -0700 Subject: [erlang-questions] [erlang-bugs] Weird pg2 behavior In-Reply-To: References: <18431.9227.133848.989614@gargle.gargle.HOWL> Message-ID: On Fri, Apr 11, 2008 at 3:02 AM, Matthew Dempsky wrote: > It would seem like either mnesia's disk_log usage is broken or there's > another pg2 bug to be discovered. :( The other reason I don't think this is the bug we're looking for is that it doesn't show the symptoms we've experienced. In particular, it leaves the dead pid in both the local_members and the members tables. Our problem is that the pid stays around in only the members table, not the local_members table. matthew@REDACTED:~$ erl Erlang (BEAM) emulator version 5.6.1 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.1 (abort with ^G) 1> {pg2:create(foo), pg2:create(bar)}. {ok,ok} 2> spawn(fun() -> pg2:join(foo, self()), pg2:leave(bar, self()) end). <0.35.0> 3> pg2:get_local_members(foo). [<0.35.0>] 4> pg2:get_members(foo). [<0.35.0>] From torben.lehoff@REDACTED Fri Apr 11 21:06:44 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Fri, 11 Apr 2008 21:06:44 +0200 Subject: [erlang-questions] Good architecture principals In-Reply-To: References: Message-ID: Maybe one of these can give you some ideas: - http://osmirrors.cerias.purdue.edu/pub/FreeBSD/ports/local-distfiles/o1441144lgeni/master_thesis_patterns.pdf - http://www.diit.unict.it/users/csanto/exat/whats.html Cheers, Torben 2008/4/11 Colin Z : > As an exercise, I'm working on putting together a simple physics and > collision detection library for a video game and I'm looking for some advice > on good Erlang architecture. > > Right now I have the concept of a cell which uses gen_event and acts as a > sort of hub for physics processes to communicate. > > A physics process is spawned with a cell PID to talk to and uses > timer:send_interval to send itself update messages at a certain resolution > (ie: every 33ms for a 30 frames per second simulation). When it gets an > update message, it applies physics calculations to get its new position and > then sends a {moved, self(), NewPosition} message to the cell which uses > gen_event to notify all the other interested physics processes. > > When a physics process gets a "moved" message, it can compare the > EntityPosition with its own position to see if a collision has occurred and > act accordingly. > > How is something like this usually handled in Erlang? > > Given that a simulation might have thousands of physics processes, is it > bad that I'm using a timer for each one? Would it be better to have a single > process with a single timer and a list of physics records to partition and > update? > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jilani@REDACTED Fri Apr 11 23:00:21 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Fri, 11 Apr 2008 23:00:21 +0200 Subject: [erlang-questions] How to write this code better? Message-ID: <47FFD165.9030301@cheapnet.it> Hi All, I am translating this Pascal code: t := 2*3.14159*((JD - 1) / 365.0); declination := (0.322003 - 22.971 * cos(t) - 0.357898 * cos(2*t) - 0.14398 * cos(3*t) + 3.94638 * sin(t) + 0.019334 * sin(2*t) + 0.05928 * sin(3*t)); // Check it if (declination > 89.99) then declination := 89.99; if (declination < -89.99) then declination := -89.99; to Erlang: T1 = 2*3.14159*((JD - 1) / 365.0), Declination1 = (0.322003-22.971*cos(T1) -0.357898*cos(2*T1) -0.14398*cos(3*T1) +3.94638*sin(T1) +0.019334*sin(2*T1) +0.05928*sin(3*T1)), % Check it if (Declination1 > 89.99) -> Declination2 = 89.99; true -> Declination2 = Declination1 end, if (Declination1 < -89.99) -> Declination2 = -89.99; true -> Declination2 = Declination1 end, Declination2. The Erlang code works but I think there is at least one way to write it better. Thank you! -- *** Jilani KHALDI http://www.dotpas.org From paul-trapexit@REDACTED Fri Apr 11 23:22:05 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Fri, 11 Apr 2008 14:22:05 -0700 (PDT) Subject: [erlang-questions] optimizing mnesia record size Message-ID: hi. i'm trying to decrease the memory footprint of an mnesia database. i turned some strings into binaries and got some space savings. past this, i'm sure how to proceed. one thing that would help is, is there a way to compute what the record size will be (maybe within a constant factor?). i've been playing around at the shell calling size/1 on erlang:term_to_binary/1 but i'm not even sure this is indicative. also, are there some guidelines? i was a bit surprised to discover that replacing an atom with binary_to_list/1 composed with list_to_atom/1 actually made things bigger (by previous paragraph's metric). i was also surprised to discover that really short strings are actually better as lists rather than binaries. any pointers would be greatly appreciated. thanks, -- p In an artificial world, only extremists live naturally. -- Paul Graham From dmercer@REDACTED Fri Apr 11 23:32:14 2008 From: dmercer@REDACTED (David Mercer) Date: Fri, 11 Apr 2008 16:32:14 -0500 Subject: [erlang-questions] How to write this code better? In-Reply-To: <47FFD165.9030301@cheapnet.it> References: <47FFD165.9030301@cheapnet.it> Message-ID: <000d01c89c1b$83575d50$891ea8c0@SSI.CORP> I'd write it something like: . . . % Check it Declination2 = if Declination1 > 89.99 -> 89.99; Declination1 < -89.99 -> -89.99; true -> Declination1 end. Cheers, DBM -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Jilani Khaldi Sent: Friday, April 11, 2008 16:00 To: Erlang Questions List Subject: [erlang-questions] How to write this code better? Hi All, I am translating this Pascal code: t := 2*3.14159*((JD - 1) / 365.0); declination := (0.322003 - 22.971 * cos(t) - 0.357898 * cos(2*t) - 0.14398 * cos(3*t) + 3.94638 * sin(t) + 0.019334 * sin(2*t) + 0.05928 * sin(3*t)); // Check it if (declination > 89.99) then declination := 89.99; if (declination < -89.99) then declination := -89.99; to Erlang: T1 = 2*3.14159*((JD - 1) / 365.0), Declination1 = (0.322003-22.971*cos(T1) -0.357898*cos(2*T1) -0.14398*cos(3*T1) +3.94638*sin(T1) +0.019334*sin(2*T1) +0.05928*sin(3*T1)), % Check it if (Declination1 > 89.99) -> Declination2 = 89.99; true -> Declination2 = Declination1 end, if (Declination1 < -89.99) -> Declination2 = -89.99; true -> Declination2 = Declination1 end, Declination2. The Erlang code works but I think there is at least one way to write it better. Thank you! -- *** Jilani KHALDI http://www.dotpas.org _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Fri Apr 11 23:40:09 2008 From: vances@REDACTED (Vance Shipley) Date: Fri, 11 Apr 2008 17:40:09 -0400 Subject: [erlang-questions] How to write this code better? In-Reply-To: <47FFD165.9030301@cheapnet.it> References: <47FFD165.9030301@cheapnet.it> Message-ID: <20080411214008.GJ21184@h216-235-12-173.host.egate.net> On Fri, Apr 11, 2008 at 11:00:21PM +0200, Jilani Khaldi wrote: } The Erlang code works but I think there is at least one way to write it } better. T1 = 2*3.14159*((JD - 1) / 365.0), case (0.322003-22.971*cos(T1) -0.357898*cos(2*T1) -0.14398*cos(3*T1) +3.94638*sin(T1) +0.019334*sin(2*T1) +0.05928*sin(3*T1)) of Declination when Declination > 89.99 -> 89.99; Declination when Declination < -89.99) -> -89.99; Declination -> Declination end. From nick@REDACTED Sat Apr 12 00:42:06 2008 From: nick@REDACTED (Nick Gerakines) Date: Fri, 11 Apr 2008 15:42:06 -0700 Subject: [erlang-questions] Documenting Erlang project(s) Message-ID: Subject: Documenting Erlang project(s) I'm getting ready to hand of an erlang project to another engineer and *shame on me* my documentation isn't as organized as I'd like it to be. I've been writing a lot lately about the different parts, components, modules and configurations and now its time to organize it all. My documentation goals cover several areas: - A user guide that explains what the service does and how it operates - Module documentation - An overview of the module documentation - Configuration documentation - Build, package and deployment documentation I've read extensively on both edoc and docbuilder and I've tried generating documentation with both of them. The issue is that both have quirks and I'm not really getting what I want out of them. This is what I've gone through to get where I am: Attempt 1: edoc I've used edoc to build html documentation from Erlang modules and an overview, but I can't for the life of me figure out how to create something like the a user guide. It also seems to not allow me to create individual documents for configuration files and build instructions. Good: module docs, overview docs, really pretty, clean xhtml, code and docs are right next to each other Bad: config docs, build/deploy docs, user guide Attempt 2: docbuilder docb_gen + docb_transform This route lets me go a little farther with generating docbuilder xml from module documentation, but that seems like its about it. With that I can at least create separate xml files for the other components. Good: module docs, overview docs, config docs, build/deploy docs, user guide Bad: Managing multiple files, sort of a pain in the ass Attempt 3: docbuilder manual xml + docb_transform This is the last step although its not ideal. Instead of generating all of my documentation from .erl or .edoc files, I only create .xml files that are fed into docb_transform. Good: Documentation coverage for everything. Bad: Documentation is completely separate from actual code, not xhtml, no easy way to do things like macros and change notes/warnings. So, down to my question: I really like edoc and the way I can document my modules and generate (pretty) documentation from it. I don't like the way it doesn't seem to be able to do as much as docbuilder. Is there a way that I can have the best of both worlds? Is there a way to have all of my documentation from inline .erl or .edoc files without having to manage 10+ xml files? Related: How are the docs on erlang.org/doc built? Is there a special version of docbuilder used? # Nick Gerakines From mikma264@REDACTED Wed Apr 9 22:00:42 2008 From: mikma264@REDACTED (Mikael Magnusson) Date: Wed, 09 Apr 2008 22:00:42 +0200 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: <20080409072743.GA10417@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> Message-ID: <47FD206A.7050804@gmail.com> Raimo Niskanen wrote: > Give us the result of: > $ uname -a > $ cat /etc/resolv.conf > $ erl > 1> inet_gethost_native:control({debug_level,4}). > 2> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). > 3> ets:tab2list(inet_db). > 4> ets:tab2list(inet_hosts). > > For starters. > It looks beautiful on Debian Lenny/Sid GNU/Linux, which contains my IPv6 patch: 1> inet_gethost_native:gethostbyname("ipv6.google.com", inet6). {ok,{hostent,"ipv6.l.google.com", ["ipv6.google.com"], inet6,16, [{8193,18528,0,4097,0,0,0,104}]}} (The patch is also used in Ubuntu.) /Mikael From yarivsadan@REDACTED Sat Apr 12 06:38:46 2008 From: yarivsadan@REDACTED (Yariv Sadan) Date: Fri, 11 Apr 2008 21:38:46 -0700 Subject: [erlang-questions] Mnesia or memcached? Message-ID: <17244f480804112138o3d0b16demf49d1c6111ac84e9@mail.gmail.com> Hi, I need for an Erlang app a caching solution that does essentially what memcached does: 1. You tell it the max memory it can use or each node. 2. You insert, lookup and remove objects by primary key. 3. When you look up an object its time stamp is updated to the current time. 4. When you insert an object and the max memory is exceeded, the oldest object(s) is (are) removed to make room for the new object. 5. The cache is distributed. Each key/value pair exists on only one node in a cluster and is accessible by all nodes. Should I try to use Mnesia for this (I don't need transactions -- dirty operations are fine) or should I go with memcached? I know Mnesia can take care of 1, 3 and 5 but I'm not sure about 1 and 4. I'll appreciate any feedback. Thanks, Yariv From rvirding@REDACTED Sat Apr 12 12:10:59 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 12 Apr 2008 12:10:59 +0200 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> Message-ID: <3dbc6d1c0804120310uf908f60we6c6154d01219cd6@mail.gmail.com> Well that opened a discussion; apparently I am not the only one who has wondered about this. I finally decided to go with the simplified BSD copyright, as used for example by FreeBSD. This OSI approved and according to them more or less compatible with the MIT copyright. Also according to the pundits there it does infringe upon the GPL (at least the *simplified* BSD doesn't) so there should not be any compatibility problems, and it protects the work as mine but does not restrict usage. Thanks for all the help, Robert On 09/04/2008, Robert Virding wrote: > > Hello everyone, > > I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). > With the last version I got some flak for my "license" and I am now > wondering which license to use? GPL seems common among other Erlang > projects, but how does this fit together with the normal Erlang license? The > Freebsd license is short enough so even I can understand but is it valid. I > have no interest in selling* LFE or prohibiting its use, I just want to make > sure I receive credit for my work and that no one "steals" it in that > respect. I nice courteous we are using would also be nice, good for the ego. > > What do people think? > > Robert > > * As if anyone would buy it. :-) > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yg@REDACTED Sat Apr 12 13:36:25 2008 From: yg@REDACTED (Yuri Ginsburg) Date: Sat, 12 Apr 2008 04:36:25 -0700 Subject: [erlang-questions] How to write this code better? In-Reply-To: <47FFD165.9030301@cheapnet.it> References: <47FFD165.9030301@cheapnet.it> Message-ID: <7add27fb0804120436n73846393kc64519f2cd9441c6@mail.gmail.com> I'd probably white a separate function for the sum Fourier series, just for the case if I have to calculate another series. Something like this: fourier(A, B, X) -> fourier(A, B, X, 1, 0). fourier([], [], _, _, Acc) -> Acc; fourier([H1|T1], [H2|T2], X, Pos, Acc) -> Arg = Pos * X, fourier(T1, T2, X, Pos+1, Acc + H1 * math:cos(Arg) + H2 * math:sin(Arg)). --yg 2008/4/11, Jilani Khaldi : > > Hi All, > I am translating this Pascal code: > > t := 2*3.14159*((JD - 1) / 365.0); > declination := (0.322003 - 22.971 * cos(t) > - 0.357898 * cos(2*t) > - 0.14398 * cos(3*t) > + 3.94638 * sin(t) > + 0.019334 * sin(2*t) > + 0.05928 * sin(3*t)); > > // Check it > if (declination > 89.99) then declination := 89.99; > if (declination < -89.99) then declination := -89.99; > > to Erlang: > > T1 = 2*3.14159*((JD - 1) / 365.0), > Declination1 = (0.322003-22.971*cos(T1) > -0.357898*cos(2*T1) > -0.14398*cos(3*T1) > +3.94638*sin(T1) > +0.019334*sin(2*T1) > +0.05928*sin(3*T1)), > > % Check it > if (Declination1 > 89.99) -> > Declination2 = 89.99; > true -> > Declination2 = Declination1 > end, > if (Declination1 < -89.99) -> > Declination2 = -89.99; > true -> > Declination2 = Declination1 > end, > Declination2. > > The Erlang code works but I think there is at least one way to write it > better. > Thank you! > > -- > *** > Jilani KHALDI > http://www.dotpas.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From viraptor@REDACTED Sat Apr 12 16:57:55 2008 From: viraptor@REDACTED (=?ISO-8859-2?Q?Stanis=B3aw_Pitucha?=) Date: Sat, 12 Apr 2008 15:57:55 +0100 Subject: [erlang-questions] 2 indexes Message-ID: <717e7cba0804120757s187f6e31s6191a882c91e0d72@mail.gmail.com> Hi I'm trying to do something that will effectively work as 2 indexes in ets. I'm writing a proxy for connections so my connection list is {IdForSide1, IdForSide2, OtherStuff}. I'd like to find that tuple by any of ids quickly... is there a way to do it with only one tuple, or should I split it to 3 tables {IdForSide1, ConnectionRef}, {IdForSide2, ConnectionRef}, {ConnectionRef, OtherStuff} ? That seems like rather heavy solution, or maybe not... I don't have that much experience with ets. Thanks for any ideas. From bob@REDACTED Sat Apr 12 17:58:07 2008 From: bob@REDACTED (Bob Cowdery) Date: Sat, 12 Apr 2008 16:58:07 +0100 Subject: [erlang-questions] wxErlang In-Reply-To: <47FF7614.3030002@erix.ericsson.se> References: <47FF7614.3030002@erix.ericsson.se> Message-ID: <1208015887.5465.1.camel@ubuntu-life-vm> Dan That's good news, the new classes are gratefully received. I'm having a few issues with the new release which I hope you can help with. The code below should demonstrate. 1. In the previous release if I connected to 'paint' I received a message {wx,_,{wx_ref,_,wxFrame},{wxNcPaint,paint}}. In this release I think I correctly receive {wx,_,{wx_ref,_,wxFrame},_,{wxPaint,paint}}. However, these events fire continuously and take my processor to 100%. I found however that I could connect to 'nc_event' and receive {wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} and these events only fire when they should do. However, I think NC means the non-client area and the wrong thing to attach to. 2. In the code I have commented out a call to drawLines/2. Although this draws correctly my processor goes up to 50% and the window hangs (i.e 'not responding' in the title bar). I used this call a lot in the previous release without any problems. Regards Bob ------------------------------------ -module(test_ui). -include("..\\include\\wx.hrl"). -export([start/0, server_process/0]). start() -> spawn(?MODULE, server_process, []). server_process() -> _WX = wx:new(), GrFrame = wxFrame:new(wx:null(), 1, "Window",[{style,?wxFRAME_TOOL_WINDOW bor ?wxCAPTION}]), wxFrame:connect(GrFrame, nc_paint), wxFrame:show(GrFrame, []), B = wxBrush:new(?wxBLACK, []), server_loop(GrFrame, B). server_loop(GrFrame, B) -> receive {wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} -> CDc = wxClientDC:new(GrFrame), Dc = wxBufferedDC:new(CDc), wxDC:setBackground(Dc, B), {W,H} = wxWindow:getSize(GrFrame), wxDC:drawRoundedRectangle(Dc, {2,2}, {W-4,H-4}, 3.0), %wxDC:drawLines(Dc, [{10,10},{20,10},{20,20},{10,20}]), wxBufferedDC:destroy(Dc), wxClientDC:destroy(CDc), server_loop(GrFrame, B) end. -------------------------------------- On Fri, 2008-04-11 at 16:30 +0200, Dan Gudmundsson wrote: > I've made a new release. > http://www.erlang.org/~dgud/wxerlang > > Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and > re-wrote the connect/event api, so it's now incompatible with previous releases :-) > > NOTE it requires OTP-R12-2 though. > > Basically bigger, better and faster. > > Regards > /Dan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vychodil.hynek@REDACTED Sat Apr 12 19:50:04 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sat, 12 Apr 2008 19:50:04 +0200 Subject: [erlang-questions] 2 indexes In-Reply-To: <717e7cba0804120757s187f6e31s6191a882c91e0d72@mail.gmail.com> References: <717e7cba0804120757s187f6e31s6191a882c91e0d72@mail.gmail.com> Message-ID: <4d08db370804121050x10536c1cv45599c21d37012a9@mail.gmail.com> You can use for example this: {{IdForSide1, IdForSide2}, OtherStuff} On Sat, Apr 12, 2008 at 4:57 PM, Stanis?aw Pitucha wrote: > Hi > I'm trying to do something that will effectively work as 2 indexes in > ets. I'm writing a proxy for connections so my connection list is > {IdForSide1, IdForSide2, OtherStuff}. I'd like to find that tuple by > any of ids quickly... is there a way to do it with only one tuple, or > should I split it to 3 tables {IdForSide1, ConnectionRef}, > {IdForSide2, ConnectionRef}, {ConnectionRef, OtherStuff} ? > That seems like rather heavy solution, or maybe not... I don't have > that much experience with ets. > Thanks for any ideas. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.hinde@REDACTED Sat Apr 12 20:21:05 2008 From: sean.hinde@REDACTED (Sean Hinde) Date: Sat, 12 Apr 2008 19:21:05 +0100 Subject: [erlang-questions] 2 indexes In-Reply-To: <717e7cba0804120757s187f6e31s6191a882c91e0d72@mail.gmail.com> References: <717e7cba0804120757s187f6e31s6191a882c91e0d72@mail.gmail.com> Message-ID: On 12 Apr 2008, at 15:57, Stanis?aw Pitucha wrote: > Hi > I'm trying to do something that will effectively work as 2 indexes in > ets. I'm writing a proxy for connections so my connection list is > {IdForSide1, IdForSide2, OtherStuff}. I'd like to find that tuple by > any of ids quickly... is there a way to do it with only one tuple, or > should I split it to 3 tables {IdForSide1, ConnectionRef}, > {IdForSide2, ConnectionRef}, {ConnectionRef, OtherStuff} ? > That seems like rather heavy solution, or maybe not... I don't have > that much experience with ets. You are correct. There is no way to have multiple indexes within a single ets table. I would probably split it into 2 tables: {Id1, {Id2, Stuff}} {Id2, Id1} If there is some bias towards the number of lookups for Id1 or Id2 then I would make that one the one with a direct lookup to Stuff. The extra entry for Id2 in the first table would be to support deletions from either Id. Sean From nick@REDACTED Sat Apr 12 20:31:01 2008 From: nick@REDACTED (Nick Gerakines) Date: Sat, 12 Apr 2008 11:31:01 -0700 Subject: [erlang-questions] Mnesia or memcached? In-Reply-To: <17244f480804112138o3d0b16demf49d1c6111ac84e9@mail.gmail.com> References: <17244f480804112138o3d0b16demf49d1c6111ac84e9@mail.gmail.com> Message-ID: Yariv, If you use ram + disc backing can't you use the size of the disc from dets:info(Table, memory)? Having a process periodically look at this value and cleanup based on the file size could work. For the cleanup process to work your record would have to store the time the time the record was inserted as well as the expiration time. I could see how under large amounts of read/write load when the system is constantly at its max this could strain the app. Food for thought. # Nick Gerakines On Fri, Apr 11, 2008 at 9:38 PM, Yariv Sadan wrote: > Hi, > > I need for an Erlang app a caching solution that does essentially what > memcached does: > > 1. You tell it the max memory it can use or each node. > 2. You insert, lookup and remove objects by primary key. > 3. When you look up an object its time stamp is updated to the current time. > 4. When you insert an object and the max memory is exceeded, the > oldest object(s) is (are) removed to make room for the new object. > 5. The cache is distributed. Each key/value pair exists on only one > node in a cluster and is accessible by all nodes. > > Should I try to use Mnesia for this (I don't need transactions -- > dirty operations are fine) or should I go with memcached? I know > Mnesia can take care of 1, 3 and 5 but I'm not sure about 1 and 4. > I'll appreciate any feedback. > > Thanks, > Yariv > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bob@REDACTED Sat Apr 12 21:10:24 2008 From: bob@REDACTED (Bob Ippolito) Date: Sat, 12 Apr 2008 12:10:24 -0700 Subject: [erlang-questions] Open source licenses, which one to choose In-Reply-To: <3dbc6d1c0804120310uf908f60we6c6154d01219cd6@mail.gmail.com> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <3dbc6d1c0804120310uf908f60we6c6154d01219cd6@mail.gmail.com> Message-ID: <6a36e7290804121210t64d88f35ma9ce9a0d11c75249@mail.gmail.com> I didn't want to participate in the flamewars, but good choice! :) I like BSD/MIT licensed software because I don't have to think very hard about whether I can combine it with whatever else we're doing. -bob 2008/4/12 Robert Virding : > Well that opened a discussion; apparently I am not the only one who has > wondered about this. > > I finally decided to go with the simplified BSD copyright, as used for > example by FreeBSD. This OSI approved and according to them more or less > compatible with the MIT copyright. Also according to the pundits there it > does infringe upon the GPL (at least the *simplified* BSD doesn't) so there > should not be any compatibility problems, and it protects the work as mine > but does not restrict usage. > > Thanks for all the help, > > Robert > > > > On 09/04/2008, Robert Virding wrote: > > Hello everyone, > > > > I will soon be releasing the next version of LFE (Lisp Flavoured Erlang). > With the last version I got some flak for my "license" and I am now > wondering which license to use? GPL seems common among other Erlang > projects, but how does this fit together with the normal Erlang license? The > Freebsd license is short enough so even I can understand but is it valid. I > have no interest in selling* LFE or prohibiting its use, I just want to make > sure I receive credit for my work and that no one "steals" it in that > respect. I nice courteous we are using would also be nice, good for the ego. > > > > What do people think? > > > > Robert > > > > * As if anyone would buy it. :-) > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jilani@REDACTED Sat Apr 12 23:07:49 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Sat, 12 Apr 2008 23:07:49 +0200 Subject: [erlang-questions] Scientific & Technical Programming in Erlang Message-ID: <480124A5.1040004@cheapnet.it> Hi All, I just have created a small web site for the subject. http://www.dotpas.org/estp I already have written some (small but very useful) civil engineering applications that I will (next days) clean up and put in the site. Some hints? Thank you. -- *** Jilani KHALDI http://www.dotpas.org From gleber.p@REDACTED Sun Apr 13 00:25:59 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Sun, 13 Apr 2008 00:25:59 +0200 Subject: [erlang-questions] Mnesia or memcached? In-Reply-To: References: <17244f480804112138o3d0b16demf49d1c6111ac84e9@mail.gmail.com> Message-ID: <14f0e3620804121525x3d3bf8cch4ce19cdbd80e3846@mail.gmail.com> Yariv, take a look at cacherl: http://code.google.com/p/cacherl/ Disclaimer: I'm a project member. It is an implementation of memcache protocol in erlang (with addition of optional persistancy for some items). Still in alpha/beta state, but it is already used by me in a production system without significant issues. Probably it can be tuned a little bit to meet your needs. There is an initial support of "namespaces" - one may improve it by implementing memory limits for some namespaces (or for whole storage space). Feel free to send me patches :) On 4/12/08, Nick Gerakines wrote: > Yariv, > > If you use ram + disc backing can't you use the size of the disc from > dets:info(Table, memory)? Having a process periodically look at this value > and cleanup based on the file size could work. For the cleanup process to > work your record would have to store the time the time the record was > inserted as well as the expiration time. > > I could see how under large amounts of read/write load when the system is > constantly at its max this could strain the app. > > Food for thought. > > # Nick Gerakines > > On Fri, Apr 11, 2008 at 9:38 PM, Yariv Sadan wrote: > > Hi, > > > > I need for an Erlang app a caching solution that does essentially what > > memcached does: > > > > 1. You tell it the max memory it can use or each node. > > 2. You insert, lookup and remove objects by primary key. > > 3. When you look up an object its time stamp is updated to the current > time. > > 4. When you insert an object and the max memory is exceeded, the > > oldest object(s) is (are) removed to make room for the new object. > > 5. The cache is distributed. Each key/value pair exists on only one > > node in a cluster and is accessible by all nodes. > > > > Should I try to use Mnesia for this (I don't need transactions -- > > dirty operations are fine) or should I go with memcached? I know > > Mnesia can take care of 1, 3 and 5 but I'm not sure about 1 and 4. > > I'll appreciate any feedback. > > > > Thanks, > > Yariv > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Sent from Gmail for mobile | mobile.google.com Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From anders.nygren@REDACTED Sun Apr 13 04:03:21 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Sat, 12 Apr 2008 21:03:21 -0500 Subject: [erlang-questions] Mnesia or memcached? In-Reply-To: <17244f480804112138o3d0b16demf49d1c6111ac84e9@mail.gmail.com> References: <17244f480804112138o3d0b16demf49d1c6111ac84e9@mail.gmail.com> Message-ID: On Fri, Apr 11, 2008 at 11:38 PM, Yariv Sadan wrote: > Hi, > > I need for an Erlang app a caching solution that does essentially what > memcached does: > > 1. You tell it the max memory it can use or each node. > 2. You insert, lookup and remove objects by primary key. > 3. When you look up an object its time stamp is updated to the current time. > 4. When you insert an object and the max memory is exceeded, the > oldest object(s) is (are) removed to make room for the new object. > 5. The cache is distributed. Each key/value pair exists on only one > node in a cluster and is accessible by all nodes. > > Should I try to use Mnesia for this (I don't need transactions -- > dirty operations are fine) or should I go with memcached? I know > Mnesia can take care of 1, 3 and 5 but I'm not sure about 1 and 4. > I'll appreciate any feedback. > > Thanks, > Yariv Take a look at this paper Concurrent Caching by Jay Nelson http://www.duomark.com/erlang/publications/acm2006.pdf /Anders From dnew@REDACTED Sun Apr 13 04:29:58 2008 From: dnew@REDACTED (Darren New) Date: Sat, 12 Apr 2008 19:29:58 -0700 Subject: [erlang-questions] Looking for the wisdon of experience... Message-ID: <48017026.90004@san.rr.com> Hi! I'm new to Erlang, but experienced with many other languages. I've read Joe Armstrong's book a couple times and most of the man pages at least once, I think. The language doesn't throw me, but many of the libraries are unobvious to me in their use. This is kind of long, because I'm asking a bunch of questions about the best place to learn how to use the libraries. Basically, a big "Which M to RTF?" here. I read most, but many are so general that the "right" way to use them and the interrelationships between them aren't obvious to me. Right now, I have a system that has a central server that communicates (invisibly to the customers) with geographically distributed clusters in various cities. (www.skyclix.com, or www.poundsky.com for the consumer site, if you care. Works best in San Diego, Los Angelos, and San Jose right now.) Basically, you call in on your cell phone, we process the audio, figure out what broadcast source or prerecorded audio you might be listening to, and send you back a URL to a web page that lets you do stuff with the audio (buy the song, talk to the DJ, driving directions to the advertiser you recorded, etc.) I've implemented various functions using SQL databases and custom code for distributed communication. (Mostly Tcl, PHP for web pages, MySql, a bit of C++ for the audio processing, if you care.) I'm looking for clues like which modules/functional blocks handle the things I already implemented for myself, and whether my reading of Mnesia functionality means I need to handle my large datasets the way I think I do. Anyway, my problem with understanding how to use this technology seems to be in how to apply the powerful and generic functionality in a way that will keep working in the face of failures. I'm hoping those who have used Erlang to build systems already could point me in the right directions. I hope it's appropriate to ask this sort of thing here. So, to the questions.... * * 1 * * Right now, we have geographically-distributed clusters of servers. For example, in each city, we have a rack of machines, each of which is running a monitor and a program to listen to radio channels. (The monitor monitors temp, disk status, etc, as well as machine-specific stuff like "are we getting audio that sounds clear?") One in each cluster is running an audio server and a SQL server and a monitor and a "query engine", which is what the GC contacts to see if you were listening to any of the radio stations in that city. I'm assuming the monitor, the query engine, the thing listening to the radio stations, etc would likely each be one "node", rather than putting them all into one node? So I'd be running 'qe@REDACTED' and 'qe@REDACTED' and 'radio@REDACTED' and 'radio@REDACTED', rather than having all the processing on one machine all in the same server, right? That's a better way to go? Right now, each running process logs a "heartbeat" to the central "ground control" server, so I know if something died or I lost ISP connectivity. I'm assuming the right way to do this in Erlang is to watch for nodeup and nodedown messages. Yes? If this is the case, and connectivity fails and then comes back, does the Erlang runtime try to reestablish connectivity automatically? (Some of our ISPs have been less than wonderful.) Also, I'm wondering whether it would be better to have a specific TCP server communicating between cities (i.e., a custom gen_tcp server) or whether it would be sufficient to simply use the normal inter-node commuincation stuff? Or would something like Mr Armstrong's "lib_chan" be a better start? It looks like with even trivial abstraction, this wouldn't really be a problem either way, considering how easy it is to ship terms over TCP. * * 2 * * Right now, when something fails (anywhere), it logs a "failure" message, which propagates to Ground Control, which sends me a page. If the problem clears up before I get to it, it logs a "clear" message, which GC also pages to me. (In addition, there are warnings and notices that get summarized and emailed appropriately.) Also, I log various statistics (like how many ads we served, to match against the ad network's accounting), messages about intermittent programs succeeding, progress messages for the bits that can take hours to run, etc. I also log debug messages (like print statements) and "info" messages (which get logged even if debugging is off, and which I can easily search for in admin reports). My first guess, from reading, is that the Event Tracer modules would be the appropriate way of shipping most of this information back to the central servers. In particular, providing fairly complex terms to et:phone_home (snicker) would be sufficient, along with arranging to have the event collector/selector/viewer back at ground control talking to a web server with its results. How well does this work with unreliable communication between nodes? It looks like it would be OK for me to log debugging info and such, but I wouldn't want auditing logs done this way, right? Is it efficient enough to filter things at the local nodes? Is event tracing efficient enough to leave on all the time? Does it do the filtering at the local nodes, or is it going to ship back all traced processes and then filter out everything but phone_home? Or would the tools working with the standard error_logger module be the best way to replicate these things? Mr Armstrong's book implies that's the way to go, but the example given is textbook oversimplified. I'd like to have these messages all interlaced, so I can see when (for example) the processing at the node taking the phone calls fails because the node listening to the radio was restarting or some such. I didn't see anything in the error_logger documentation that implied it was easy to merge widely distributed messages into one log; do I need to read closer? I also didn't see any good examples of searchable custom messages, where I could (for example) pull out all the messages caused by a particular phone number and put them in order and see why the result wasn't what was expected, or even to find all the messages with a particular term or combinations of terms in their tags. The "rb" module looks like it really only works with the "standard" error_logger terms. Would I be better off with a custom event handler (which, like the current one, takes the event, saves it locally, and then specifically propagates it with appropriate timestamp to Ground Control) and only looking at error_logger for actual crashes? Or is it pretty easy to build a custom handler, hook it into the local error_logger, log more complex terms than just info/warn/error, and have it send the records to the central database when appropriate? How do people handle this in real systems, I guess I'm asking? It just doesn't seem like one would want to be looking at each machine individually when tracking down a fault. * * 3 * * Cron-like functionality: How is this best handled? If I have some Erlang task I want to do once a day, or once a week, or to retry something every couple of hours until it succeeds then sleep for a few days... Do people just set this up as a separate process? Or is there something like "cron" written already inside of the Erlang libraries that I just haven't found? Clearly it wouldn't be difficult to implement. Or do people fire up a separate node via cron to run something like this, then let it shut itself down when it's done? I saw the "hibernate" BIF, which looks like the sort of thing useful for this. * * 4 * * Part of the problem I forsee using Erlang in general and Mnesia in particular for this is the lack of a convenient ordered index for data. Ordered tables have to fit in memory. (Seems odd to me that nobody already needed this, but there ya go. :-) It looks like you can tell Mnesia to make an index on an element of a tuple, but it doesn't look like you can tell Mnesia that you want an ordered index of an element on a table that's otherwise too big to fit in memory? Have I missed something in TFM? Basically, I have lots of places in my current code where the SQL says SELECT * FROM table WHERE blah blah AND timestamp < '...' ORDER BY timestamp DESC LIMIT 1 so I'm looking for the one most recent event before the provided time that matches some set of conditions. (Sometimes the conditions are empty, i.e., "true".) I guess what the rambling below distills down to is "how do you best handle ordered columns on Mnesia tables too big to fit in RAM conveniently?" Obviously the table needs to be split up, but does one do that by maintaining links and indecies oneself, updating linked lists of records as they're inserted? Or maintaining a second table with just the timestamps and "where" conditions? Or keeping such in memory when one can, and flushing out lists as separate records? (Actually, I guess that would be hard in Mnesia, since it wants the same format for every record. You would have to use a separate table just for that, wouldn't you?) Is there a best way to handle this in Mnesia? Does that mechanism work when the tables get arbitrarily large? I'm thinking that I could build a (or several) linked list(s), and each time I insert a record, I add the predicessor and successor record IDs into the record. I could also keep a copy of just the timestamp/ID pairs for the most recent records in memory as a set or a Mnesia ordered_set table, rebuilding it from the linked lists on disk if I need to. When I close out the table, I would write the head and tail links (and maybe some intermediate, like "first of the day" links) into a specific record (maybe in another table) just for that purpose. Alternately, I could store each week/month/whatever as a separate disc-copy ordered set, and load each separately as needed. My only concern there is when 20 different customers all ask for information from 20 different tables at once. Alternately, each month I could have a separate process that runs through the disc-copy table and builds a disc-only table with a separate index of just the chronology as one of the records. I.e., suck the table in, build an in-memory ordered list for each index, and write it back out as a unique record I can load later if I need it. Or add the links of the linked list at that time so I'm not maintaining them on every insert. Also, the pre-recorded audio bits are (so far) several million records occupying dozens of gigabytes. We expect this to grow one or two more orders of magnitude. However, since most of that is "data" (i.e., binaries even I don't know the internals of), and we only really index that by a code number, I don't see that being a problem, other than the sheer bandwidth of shipping it around. Having them on a disk and being able to open the file remotely would suffice for getting them into the custom audio match servers. I'm thinking I'm likely going to have to split things up into lots of tables. The customer table would have the recognition event details for all the events inside the record as a list, but I would have a process that iterates over the customers with new events and takes any events unlikely to be referenced soon (too old, too many, etc) and moves them into a file keyed by recognition event number, and trims the details out of the customer record. This keeps the rebuild time for the customer records short, and keeps me from sucking up too much memory when we pull in someone who has done hundreds or thousands of events. Are these the sorts of things other folks do when working with databases too large for memory (i.e., >2G tables)? Or am I missing something, either obvious or clever, that would make it more straightforward? This is the most vexing bit, because it seems like the hardest part to roll-my-own with. The tracing and logging and such I could easily do custom if I didn't want to try to do it the "usual" way, but this seems like it *should* have a known solution that I'm not finding. Oh, and yes, I saw the ODBC driver. Right now, stuff isn't too fast, isn't easy to split across servers, and needs downtime for things like changing the schema. That's what I'm trying to avoid, or I'd just keep the same database we have. :-) * * * * Thanks in advance for any words of wisdom you might feel like providing! And thanks for reading this far. ;-) -- Darren New / San Diego, CA, USA (PST) "That's pretty. Where's that?" "It's the Age of Channelwood." "We should go there on vacation some time." From Raymond.Xiong@REDACTED Thu Apr 10 10:34:57 2008 From: Raymond.Xiong@REDACTED (Raymond Xiong) Date: Thu, 10 Apr 2008 16:34:57 +0800 Subject: [erlang-questions] Erlang version In-Reply-To: References: Message-ID: <20080410083456.GA1236@Sun.Com> On 04/10/08, Xiangrong Fang wrote: > Hi There, > > How do I get the version of erlang I am running now? there seems no > --version or similar switch to erl or erlc. One way I use is checking $ERL_ROOT/lib/erlang/release/RELEASE, it contains detailed release information and can be read by Erlang programs(ERL_ROOT is the dir where Erlang is installed on your machine) > > erl reported Eshell 5.6.1, but where I can get the main version number > such as R12B... > > Thanks! > Shannon > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Regards, Raymond From matthew@REDACTED Sun Apr 13 08:43:02 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Sat, 12 Apr 2008 23:43:02 -0700 Subject: [erlang-questions] Looking for the wisdon of experience... In-Reply-To: <48017026.90004@san.rr.com> References: <48017026.90004@san.rr.com> Message-ID: On Sat, Apr 12, 2008 at 7:29 PM, Darren New wrote: > I'm assuming the monitor, the query engine, the thing listening to > the radio stations, etc would likely each be one "node", rather than > putting them all into one node? So I'd be running 'qe@REDACTED' and > 'qe@REDACTED' and 'radio@REDACTED' and 'radio@REDACTED', rather > than having all the processing on one machine all in the same server, > right? That's a better way to go? It's a matter of personal preference. We use separate erl nodes for each service/host because sometimes the easiest way for us to resolve a problem is to restart Erlang and it's less of a problem when that only affects one service rather than multiple. > Right now, each running process logs a "heartbeat" to the central > "ground control" server, so I know if something died or I lost > ISP connectivity. I'm assuming the right way to do this in Erlang > is to watch for nodeup and nodedown messages. Yes? Yes. Be sure to request those messages with erlang:monitor_node or net_kernel:monitor_nodes though. > If this is the > case, and connectivity fails and then comes back, does the Erlang > runtime try to reestablish connectivity automatically? (Some of > our ISPs have been less than wonderful.) See the documentation for the dist_auto_connect setting in the kernel(6) man page. > Also, I'm wondering whether it would be better to have a > specific TCP server communicating between cities (i.e., > a custom gen_tcp server) or whether it would be sufficient > to simply use the normal inter-node commuincation stuff? > Or would something like Mr Armstrong's "lib_chan" be a > better start? It looks like with even trivial abstraction, > this wouldn't really be a problem either way, considering > how easy it is to ship terms over TCP. That's (again) mostly a matter of personal preference. There are some technical issues to consider like security (if one site is compromised, the Erlang distribution layer would let the nodes there take over other sites). For the most part though, if you're just planning on using binary_to_term and term_to_binary then you might as well use Erlang's distribution layer. If you'd like to be able to interoperate with other languages without too much difficulty, HTTP typically makes a decent (if slightly heavier) solution. > [Questions about error logging.] I don't have much experience with Erlang's built-in error logging stuff, so I can't really answer these questions. For the most part, we run erlang nodes in a screen session or using runit so the console output is logged to disk, and then we have monitoring software that alerts us to problems that we should consult the logs for. > Cron-like functionality: How is this best handled? If I have some Erlang > task I want to do once a day, or once a week, or to retry something every > couple of hours until it succeeds then sleep for a few days... Do people > just set this up as a separate process? Or is there something like "cron" > written already inside of the Erlang libraries that I just haven't found? > Clearly it wouldn't be difficult to implement. Or do people fire > up a separate node via cron to run something like this, then let it > shut itself down when it's done? I saw the "hibernate" BIF, which > looks like the sort of thing useful for this. Most of our code only needs to be run ever N seconds/minutes/hours, so we just have a gen_server call timer:send_interval in its init/1 function and then add an appropriate handle_info clause. > [Questions about mnesia.] We mostly use mnesia only as a distributed hash table, so I don't have anything original to add to the ideas you've already suggested. From matthew@REDACTED Sun Apr 13 09:24:22 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Sun, 13 Apr 2008 00:24:22 -0700 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FF76AF.1030809@it.uu.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> <47FF76AF.1030809@it.uu.se> Message-ID: On Fri, Apr 11, 2008 at 7:33 AM, Richard Carlsson wrote: > On the contrary, the only way a license *can* be GPL-compatible is > if it allows such relicensing. The MIT and Rodified BSD licenses, > for example, both allow this (mainly because they do not *disallow* > relicensing as long as it is in a compatible way), while the original > BSD license with its "banner" clauses is incompatible due to its extra > restrictions. The MIT license explicitly permits sublicensing, but the Modified BSD license does not. I don't think your argument is legally sound. From matthew@REDACTED Sun Apr 13 09:42:05 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Sun, 13 Apr 2008 00:42:05 -0700 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FF6D34.8010107@industrial-designers.co.uk> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> <47FF6D34.8010107@industrial-designers.co.uk> Message-ID: On Fri, Apr 11, 2008 at 6:52 AM, David-Sarah Hopwood wrote: > "A" is correct. But the GPL is a red herring here. I can take any > MIT-licensed code and redistribute it with the additional license term > "to use this code, you must give me your first-born child", for example [*] > (enforcability aside). This is not a problem, primarily because someone > can still use the code distributed under the original license, and not > give me their first-born child. The fact that the original copyright > holder(s) chose an MIT or BSD-like license entails that they accepted > the possibility of redistribution under any more restrictive license. The BSD license only grants use, redistribution, and modification. The recipient of BSD licensed code is granted those rights by the copyright owner, not by the distributor. The MIT license also grants sublicensing (among some other rights), but otherwise the same idea applies. From ali.yakout@REDACTED Sun Apr 13 10:54:11 2008 From: ali.yakout@REDACTED (Ali Yakout) Date: Sun, 13 Apr 2008 10:54:11 +0200 Subject: [erlang-questions] set node name and escript rpc_call to anothernode In-Reply-To: <1218d6a50802281536p31838159n85b318e6bf5fb3bb@mail.gmail.com> References: <1218d6a50802281536p31838159n85b318e6bf5fb3bb@mail.gmail.com> Message-ID: Hi Ralph, I know its too late to reply :), but I noticed that no one answered this. Just want to inform you that I do the same thing you wish to do using escript and shell script. First make sure you start the nodes with the same cookie $ erl -sname mynode -setcookie mycookie ... The escript should look like: #!/usr/bin/env escript %% -*- erlang -*- main(_Args) -> net_kernel:start([shell, shortnames]), erlang:set_cookie(node(), mycookie), rpc:call('mynode@REDACTED' , conf_server, reload, []). I have tried this script with sasl in my .erlang as you do and got the same result "started_at: nonode@REDACTED", seems that the erlang shell is started before the escript is executed. Another way is to do it in shell script where we needn't hard code the hostname as above, and the sasl will show "started_at: shell@REDACTED " #! /bin/sh -fup NODENAME=\'mynode@$HOSTNAME\' erl -sname shell -setcookie mycookie > /dev/null << ! rpc:call($NODENAME, conf_server, reload, []). halt(). ! OR #! /bin/sh -fup NODENAME=\'mynode@$HOSTNAME\' CMD=rpc:call\($NODENAME,conf_server,reload,[]\). erl -sname shell -setcookie mycookie -eval $CMD -s init stop Regards, Ali Yakout ________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of db Sent: Friday, February 29, 2008 1:37 AM To: erlang-questions@REDACTED Subject: [erlang-questions] set node name and escript rpc_call to anothernode Would I be able to make rpc_call to another node from escript? When I start escript, erl node which escript start, is called nonode@REDACTED Is there a way for this node to join the pool, so I can perform rpc call? I have tried set the following in my escript: net_kernel:start([foobar, shortnames]) When I ran the escript, sasl is automatically started up. This is my default setup in .erlang file. Even though, with net_kernel:start([foobar, shortnames]) in escript, sasl application is running on nonode@REDACTED, but the node never assigned the name "foobar". Why is this? Here is the sasl output: =PROGRESS REPORT==== 28-Feb-2008::15:44:03 === supervisor: {local,sasl_sup} started: [{pid,<0.32.0>}, {name,sasl_safe_sup}, {mfa, {supervisor,start_link, [{local,sasl_safe_sup},sasl,safe]}}, {restart_type,permanent}, {shutdown,infinity}, {child_type,supervisor}] =PROGRESS REPORT==== 28-Feb-2008::15:44:03 === supervisor: {local,sasl_sup} started: [{pid,<0.35.0>}, {name,release_handler}, {mfa,{release_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 28-Feb-2008::15:44:03 === application: sasl started_at: nonode@REDACTED =PROGRESS REPORT==== 28-Feb-2008::15:44:03 === supervisor: {local,net_sup} started: [{pid,<0.39.0>}, {name,erl_epmd}, {mfa,{erl_epmd,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 28-Feb-2008::15:44:03 === supervisor: {local,net_sup} started: [{pid,<0.40.0>}, {name,auth}, {mfa,{auth,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 28-Feb-2008::15:44:03 === supervisor: {local,net_sup} started: [{pid,<0.41.0>}, {name,net_kernel}, {mfa,{net_kernel,start_link,[[foobar,shortnames]]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 28-Feb-2008::15:44:03 === supervisor: {local,kernel_sup} started: [{pid,<0.38.0>}, {name,net_sup_dynamic}, {mfa, {erl_distribution,start_link, [[foobar,shortnames]]}}, {restart_type,permanent}, {shutdown,1000}, {child_type,supervisor}] -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sun Apr 13 11:20:15 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 13 Apr 2008 11:20:15 +0200 Subject: [erlang-questions] optimizing mnesia record size In-Reply-To: References: Message-ID: <8209f740804130220o27141ca2o59c2a7dc9445fd04@mail.gmail.com> You might try this one: Eshell V5.5.4 (abort with ^G) 1> erts_debug:flat_size(lists:seq(1,100)). 200 (It will actually tell you how big the term will be once it has been "flattened" during copying.) BR, Ulf W 2008/4/11, Paul Mineiro : > hi. > > i'm trying to decrease the memory footprint of an mnesia database. i > turned some strings into binaries and got some space savings. past this, > i'm sure how to proceed. > > one thing that would help is, is there a way to compute what the record > size will be (maybe within a constant factor?). i've been playing around > at the shell calling size/1 on erlang:term_to_binary/1 but i'm not even > sure this is indicative. > > also, are there some guidelines? i was a bit surprised to discover that > replacing an atom with binary_to_list/1 composed with list_to_atom/1 > actually made things bigger (by previous paragraph's metric). i was also > surprised to discover that really short strings are actually better as > lists rather than binaries. > > any pointers would be greatly appreciated. > > thanks, > > -- p > > In an artificial world, only extremists live naturally. > > -- Paul Graham > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From richardc@REDACTED Sun Apr 13 12:50:05 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 13 Apr 2008 12:50:05 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> <47FF76AF.1030809@it.uu.se> Message-ID: <4801E55D.9030301@it.uu.se> Matthew Dempsky wrote: > On Fri, Apr 11, 2008 at 7:33 AM, Richard Carlsson wrote: >> On the contrary, the only way a license *can* be GPL-compatible is >> if it allows such relicensing. The MIT and Rodified BSD licenses, >> for example, both allow this (mainly because they do not *disallow* >> relicensing as long as it is in a compatible way), while the original >> BSD license with its "banner" clauses is incompatible due to its extra >> restrictions. > > The MIT license explicitly permits sublicensing, but the Modified BSD > license does not. I don't think your argument is legally sound. Yeah, probably not in the case of BSD: it actually only allows "redistribution and use in source and binary forms, with or without modification", while the MIT license allows you "to deal in the Software without restriction, [...]". Thanks for the correction. /Richard PS. "Rodified" was a fun word; I must use it more often. From masterofquestions@REDACTED Sun Apr 13 15:01:43 2008 From: masterofquestions@REDACTED (db) Date: Sun, 13 Apr 2008 09:01:43 -0400 Subject: [erlang-questions] noob gen_leader question In-Reply-To: <47FA881B.2060304@ericsson.com> References: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> <47FA881B.2060304@ericsson.com> Message-ID: <1218d6a50804130601g1602a316o2f2f34205677cb50@mail.gmail.com> Does worker instance of gen_leader spawn separate processes to perform a task concurrently like in pool module? On Mon, Apr 7, 2008 at 4:46 PM, Ulf Wiger (TN/EAB) wrote: > db skrev: > > > I have looked at gdict example. Storing values into global dict goes to > > the leader and lookup is done by workers on the local gen_leader instance. > > > > It seems gen_leader works by having worker pull task rather than master > > push task. Am I right? > > > > No, the leader pushes the whole dictionary when elected, and > then each update function, as all updates go through the > leader process. > > So, for example (expanding the macro definition): > > -define(store(Dict,Expr,Legend), > gen_leader:leader_call(Dict, {store, fun(D) -> > Expr > end})). > > -define(lookup(Dict, Expr, Legend), > gen_leader:call(Dict, {lookup, fun(D) -> > Expr > end})). > > %% dict functions that modify state: > append(Key, Value, Dict) -> > gen_leader:leader_call( > Dict, {store, fun(D) -> > dict:append(Key,Value,D) > end})). > > then, in the callback module: > > handle_leader_call({store,F}, _From, Dict, _E) -> > NewDict = F(Dict), > {reply, ok, {store, F}, NewDict}; > ^^^^ <- this is the push > > > and here's where the workers receive it: > > from_leader({store,F}, Dict, _E) -> > NewDict = F(Dict), > {ok, NewDict}. > > > > BR, > Ulf W > Thank you, -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.hopwood@REDACTED Sun Apr 13 15:54:10 2008 From: david.hopwood@REDACTED (David Hopwood) Date: Sun, 13 Apr 2008 14:54:10 +0100 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> <47FF6D34.8010107@industrial-designers.co.uk> Message-ID: <48021082.5060903@industrial-designers.co.uk> Matthew Dempsky wrote: > On Fri, Apr 11, 2008 at 6:52 AM, David-Sarah Hopwood > wrote: >> "A" is correct. But the GPL is a red herring here. I can take any >> MIT-licensed code and redistribute it with the additional license term >> "to use this code, you must give me your first-born child", for example [*] >> (enforcability aside). This is not a problem, primarily because someone >> can still use the code distributed under the original license, and not >> give me their first-born child. The fact that the original copyright >> holder(s) chose an MIT or BSD-like license entails that they accepted >> the possibility of redistribution under any more restrictive license. > > The BSD license only grants use, redistribution, and modification. > The recipient of BSD licensed code is granted those rights by the > copyright owner, not by the distributor. > > The MIT license also grants sublicensing (among some other rights), > but otherwise the same idea applies. The above paragraph was written in the context of distributing a derived work; "I" in that case refers to a (non-exclusive) copyright holder. But this is not on-topic for the Erlang list, I think. -- David Hopwood From bob@REDACTED Sun Apr 13 19:44:44 2008 From: bob@REDACTED (Bob Cowdery) Date: Sun, 13 Apr 2008 18:44:44 +0100 Subject: [erlang-questions] wxErlang In-Reply-To: <1208023493.5465.3.camel@ubuntu-life-vm> References: <47FF7614.3030002@erix.ericsson.se> <1208023493.5465.3.camel@ubuntu-life-vm> Message-ID: <1208108684.6119.5.camel@ubuntu-life-vm> I've sussed this one out. For some reason I need to now explicitly set focus on the panel which I didn't have to do before. It's not enough that the frame has focus, the panel connected to the events must have focus. Bob On Sat, 2008-04-12 at 19:04 +0100, Bob Cowdery wrote: > Dan > > Also the mousewheel events seem to have stopped working. It's not that > the message has changed, I'm not getting any messages at all. > > Thanks > Bob > > On Fri, 2008-04-11 at 16:30 +0200, Dan Gudmundsson wrote: > > I've made a new release. > > http://www.erlang.org/~dgud/wxerlang > > > > Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and > > re-wrote the connect/event api, so it's now incompatible with previous releases :-) > > > > NOTE it requires OTP-R12-2 though. > > > > Basically bigger, better and faster. > > > > Regards > > /Dan > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf.wiger@REDACTED Sun Apr 13 21:57:14 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sun, 13 Apr 2008 21:57:14 +0200 Subject: [erlang-questions] noob gen_leader question In-Reply-To: <1218d6a50804130601g1602a316o2f2f34205677cb50@mail.gmail.com> References: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> <47FA881B.2060304@ericsson.com> <1218d6a50804130601g1602a316o2f2f34205677cb50@mail.gmail.com> Message-ID: <4802659A.6010601@ericsson.com> db skrev: > Does worker instance of gen_leader spawn separate processes to perform a > task concurrently like in pool module? Not by default, no. If you want to spawn processes, you can of course do that in the callbacks. BR, Ulf W From viraptor@REDACTED Sun Apr 13 23:58:48 2008 From: viraptor@REDACTED (=?ISO-8859-2?Q?Stanis=B3aw_Pitucha?=) Date: Sun, 13 Apr 2008 22:58:48 +0100 Subject: [erlang-questions] logging from gen_server Message-ID: <717e7cba0804131458h12dd9799l88f3a682e23e7841@mail.gmail.com> Hi all, I'm trying to add some more tracing to a process using gen_server behaviour. I'd like to use dbg_opts() of that gen_server - so that it prints trace only if sys:trace(name, true) was called for registered 'name' of that process. What I've found is that I can probably do: {status, _, _, [_,_,_,DbgOpts,_]} = sys:get_status(name) sys:handle_debug(DbgOpts, .....) but that looks horrible and also returns whole PDict :/ (or maybe it isn't that slow?) Is there some easier way to do it? Couldn't find anything like that in docs. From dgud@REDACTED Mon Apr 14 08:59:07 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 14 Apr 2008 08:59:07 +0200 Subject: [erlang-questions] wxErlang In-Reply-To: <1208108684.6119.5.camel@ubuntu-life-vm> References: <47FF7614.3030002@erix.ericsson.se> <1208023493.5465.3.camel@ubuntu-life-vm> <1208108684.6119.5.camel@ubuntu-life-vm> Message-ID: <480300BB.80005@erix.ericsson.se> Famous last words. But I haven't knowingly changed anything that should alter that behavior :-) If you got a couple of minutes take a look at my driver code and see if I do something stupid, it's the switch cases in wxe_funcs.cpp and wxe_event.cpp. /Dan Bob Cowdery wrote: > I've sussed this one out. For some reason I need to now explicitly set > focus on the panel which I didn't have to do before. It's not enough > that the frame has focus, the panel connected to the events must have > focus. > > Bob > > On Sat, 2008-04-12 at 19:04 +0100, Bob Cowdery wrote: >> Dan >> >> Also the mousewheel events seem to have stopped working. It's not that >> the message has changed, I'm not getting any messages at all. >> >> Thanks >> Bob >> >> On Fri, 2008-04-11 at 16:30 +0200, Dan Gudmundsson wrote: >>> I've made a new release. >>> http://www.erlang.org/~dgud/wxerlang >>> >>> Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and >>> re-wrote the connect/event api, so it's now incompatible with previous releases :-) >>> >>> NOTE it requires OTP-R12-2 though. >>> >>> Basically bigger, better and faster. >>> >>> Regards >>> /Dan >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions > From hans.bolinder@REDACTED Mon Apr 14 09:21:29 2008 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Mon, 14 Apr 2008 09:21:29 +0200 Subject: [erlang-questions] [erlang-bugs] Weird pg2 behavior In-Reply-To: References: <18431.9227.133848.989614@gargle.gargle.HOWL> Message-ID: <18435.1529.209488.50485@gargle.gargle.HOWL> [Matthew Dempsky:] > > It would seem like either mnesia's disk_log usage is broken or there's > > another pg2 bug to be discovered. :( Mnesia doesn't use pg2 since all its logs are local disk logs. In fact, pg2 isn't used by OTP at all. > Our problem is that the pid stays around in only the members table, > not the local_members table. I've tried to find more bugs, but so far without success. Best regards, Hans Bolinder, Erlang/OTP team From alceste@REDACTED Mon Apr 14 09:47:38 2008 From: alceste@REDACTED (Alceste Scalas) Date: Mon, 14 Apr 2008 09:47:38 +0200 Subject: [erlang-questions] GNU GPL, MIT, BSD and compatibility In-Reply-To: <47FF76AF.1030809@it.uu.se> References: <3dbc6d1c0804081516m35cc7c68r495602da0e44029b@mail.gmail.com> <20080409073259.GB10417@erix.ericsson.se> <6ce0ac130804091002h4aa9fb1cyda6f1a3910a420f4@mail.gmail.com> <1207814838.6159.390.camel@gnatziu.crs4.it> <47FDD399.8070803@it.uu.se> <1207818667.6159.419.camel@gnatziu.crs4.it> <47FDFC71.7060308@it.uu.se> <1207831024.6159.466.camel@gnatziu.crs4.it> <47FE75EC.7010102@it.uu.se> <1207902226.6159.521.camel@gnatziu.crs4.it> <47FF467E.5070701@it.uu.se> <1207919422.6159.590.camel@gnatziu.crs4.it> <47FF76AF.1030809@it.uu.se> Message-ID: <1208159258.7030.44.camel@gnatziu.crs4.it> Il giorno ven, 11/04/2008 alle 16.33 +0200, Richard Carlsson ha scritto: > Alceste Scalas wrote: > > Yes, I am pretty sure that this is wrong. Maybe it is necessary to > > specify what "on the terms of the GNU GPL" means in the passage above. > > I think that is clear: the entire GNU GPL, every word of it, applies. But *all* software released under a GNU GPL-compatible license can, by definition, be distributed "on the terms of the GNU GPL": you just need to apply the GNU GPL terms and abstain from further permissions. In the case of BSD-licensed software, you should just avoid the binary-only distribution. If you choose to do so, you're still complying with the terms of *both* licenses, and you *don't* need relicensing at all. However, you and the recipients of that software will still be free to use all the permissions given by the BSD license, and redistribute in binary-only format. But if you choose the latter, then you won't be allowed to distribute that software as part of a GNU GPL'ed "whole" product. That's why I emphasized that "distributing under the terms of the GNU GPL" is *not* equivalent to a license change/addition/whatever, as long as you deal with GNU GPL-compatible software. > I think that C is correct: > > C. The GNU GPL is *added* to the licensing of bar.c (the > version shipped in the combined work gplbar). It does > not invalidate the existing licenses. This is why > license compatibility is an issue. The previous > licenses must not contain restrictions that go against > the GPL, otherwise the programs cannot be combined and > distributed. "Adding" the GNU GPL terms to software developed by others is equivalent to relicensing it. You need an explicit permission to do it. > The MIT and Rodified BSD licenses, for example, both allow this > [relicensing under the GNU GPL] (mainly because they do not > *disallow* relicensing as long as it is in a compatible way) But under the copyright law of every country I know about, everything that is not explicitly permitted by the author (or the copyright holder in general) is forbidden [1]. And the BSD license does *not* permit such relicensing. On the contrary, the BSD license explicitly *forbids* it, because it says that the distribution in source form must "retain the above copyright notice, this list of conditions and the following disclaimer". When you "add" the GNU GPL terms to BSD-licensed software, you're basically nullifying the 2nd condition (i.e. the one that allows binary-only distribution). I repeat: under your interpretation of the GNU GPL, most of the GNU GPL-compatible licenses suddenly become incompatible. Only MIT-licensed and public domain software could be considered compatible (maybe). The explanations I've given so far just solve all these problems: when you combine code and libraries for developing an application, *all* the licenses are preserved, and the final product "as a whole" must be distributed complying with the terms of *all* of them. And since the GNU GPL is the stricter license in the lot, then the final product, in all its parts, must be distributed under its terms. But nothing is relicensed at all: when single parts of the product are taken alone and don't depend on GNU GPL'ed software, then the GNU GPL simply does not apply. Regards, alceste Notes: [1] Except for "fair use" clauses, when/where they apply. -- Alceste Scalas CRS4 - http://www.crs4.it/ From bob@REDACTED Sat Apr 12 20:04:53 2008 From: bob@REDACTED (Bob Cowdery) Date: Sat, 12 Apr 2008 19:04:53 +0100 Subject: [erlang-questions] wxErlang In-Reply-To: <47FF7614.3030002@erix.ericsson.se> References: <47FF7614.3030002@erix.ericsson.se> Message-ID: <1208023493.5465.3.camel@ubuntu-life-vm> Dan Also the mousewheel events seem to have stopped working. It's not that the message has changed, I'm not getting any messages at all. Thanks Bob On Fri, 2008-04-11 at 16:30 +0200, Dan Gudmundsson wrote: > I've made a new release. > http://www.erlang.org/~dgud/wxerlang > > Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and > re-wrote the connect/event api, so it's now incompatible with previous releases :-) > > NOTE it requires OTP-R12-2 though. > > Basically bigger, better and faster. > > Regards > /Dan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ttmrichter@REDACTED Mon Apr 14 10:28:22 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Mon, 14 Apr 2008 16:28:22 +0800 Subject: [erlang-questions] RLang Message-ID: <1208161702.31278.2.camel@isolde> I've been toying (to the point of researching) with the idea of making a Ruby<->Erlang binding along the lines of erl_interface or jinterface. Before I go beyond toying and into the realm of actually doing, I'd like to quickly know two things: 1. Is there any point to this? Would there in fact be any interest? 2. Has/is someone already done/already doing such? (I did a quick search on this on Google and hit a few projects, none of which seemed to be as complete as, say, jinterface at first blush.) -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) A well-designed and humane interface does not need to be split into beginner and expert subsystems. (Jef Raskin) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From jilani@REDACTED Mon Apr 14 11:11:36 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Mon, 14 Apr 2008 11:11:36 +0200 Subject: [erlang-questions] How to write this code better? In-Reply-To: <23D56F7D-34D7-4B2C-A2E3-BB5F6F513822@cs.otago.ac.nz> References: <47FFD165.9030301@cheapnet.it> <23D56F7D-34D7-4B2C-A2E3-BB5F6F513822@cs.otago.ac.nz> Message-ID: <48031FC8.40507@cheapnet.it> > 0. Never write a literal value for pi. > 3.14159 is *wrong*. Use math:pi() instead. Even math:pi() is *absolutely wrong* too and every numerical value you give to Pi is wrong. I have learnt this when I were, decades ago, a student in physics (yes, I have had a degres in physics before becoming architect!). However, the correctness of a number depends on the context where you are using it. > So where does 89.99 come from? Why is it 89.99 rather than 89.999? > Just how accurate *is* this formula anyway? In many real world applications 89.9, 89.99 and 9.999 give the same pratical results! See this image: http://www.dotpas.org/software/shams1.jpg It is the snapshop of a program I wrote many years ago using a very sophisticated sun position algorithm taking in consideration many factors. I normaly use it in my job to find the better orientation of a building and the positions and the dimensions of windows. The results are very accurated. However using the small and very simple program written in Erlang (I translated it on the fly from Javascript to Pascal and after to Erlang) gives results that are very similar to those given by the sophisticated one and could be applied for real world applications :-) For doing practical applications like daylight, sunlight, reinforced concrete calculations and many many others, I find writing small and simple applications (as set of functions) in Erlang using its interpreter as a calculator helps me very much during design and preliminary calculations (architecture and civil engineering speaking). In many architecture applications an error even equal to 10% is to be considered technically correct :-). *I am an architect which means a practical man and I find Erlang really helpful to be used this way*. However, thank you for you advices! -- *** Jilani KHALDI http://www.dotpas.org From ulf.wiger@REDACTED Mon Apr 14 11:24:30 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 14 Apr 2008 11:24:30 +0200 Subject: [erlang-questions] Documenting Erlang project(s) In-Reply-To: References: Message-ID: <480322CE.4060508@ericsson.com> Nick Gerakines skrev: > Subject: Documenting Erlang project(s) > > > I've read extensively on both edoc and docbuilder and > I've tried generating documentation with both of them. > The issue is that both have quirks and I'm not really > getting what I want out of them. > > This is what I've gone through to get where I am: > > [...] Good questions/observations and good work! Don't let the lack of responses get you down. I'm sure many, like me, are hoping that someone else will know more about how best to do this. (: Often, in long-running projects (which Erlang/OTP certainly is), you tend to fix the integration issues once and for all in some near-magical build script. Since docbuilder was just recently released to the world, it's reasonable to suspect that such quirks will surface, and early adopters (like you) get to take the hit. Of course, that's just my guess. I wish I could be of more help. BR, Ulf W From dgud@REDACTED Mon Apr 14 11:55:57 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 14 Apr 2008 11:55:57 +0200 Subject: [erlang-questions] wxErlang In-Reply-To: <1208015887.5465.1.camel@ubuntu-life-vm> References: <47FF7614.3030002@erix.ericsson.se> <1208015887.5465.1.camel@ubuntu-life-vm> Message-ID: <48032A2D.1020104@erix.ericsson.se> Comments below. Bob Cowdery wrote: > Dan > > That's good news, the new classes are gratefully received. > > I'm having a few issues with the new release which I hope you can help > with. > > The code below should demonstrate. > > 1. In the previous release if I connected to 'paint' I received a > message {wx,_,{wx_ref,_,wxFrame},{wxNcPaint,paint}}. In this release I > think I correctly receive {wx,_,{wx_ref,_,wxFrame},_,{wxPaint,paint}}. > However, these events fire continuously and take my processor to 100%. I > found however that I could connect to 'nc_event' and receive > {wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} and these events only > fire when they should do. However, I think NC means the non-client area > and the wrong thing to attach to. Yes I fixed the nc_paint <-> paint, which was a bug in previous releases, I noticed that it changed how often the events was fired I don't know the reason, but I solved it by using a buffered-DC, which you are already using, and set the appropriate skip option in the connect call. I wonder if you have to use callbacks for those events? > 2. In the code I have commented out a call to drawLines/2. Although this > draws correctly my processor goes up to 50% and the window hangs (i.e > 'not responding' in the title bar). I used this call a lot in the > previous release without any problems. I will take a look at wxDc:drawLines and see if I've introduced a bug or two, I'll email you privately. Thanks /Dan > Regards > Bob > > ------------------------------------ > -module(test_ui). > > -include("..\\include\\wx.hrl"). > > -export([start/0, server_process/0]). > > start() -> > spawn(?MODULE, server_process, []). > > server_process() -> > _WX = wx:new(), > GrFrame = wxFrame:new(wx:null(), 1, > "Window",[{style,?wxFRAME_TOOL_WINDOW bor ?wxCAPTION}]), > wxFrame:connect(GrFrame, nc_paint), > wxFrame:show(GrFrame, []), > B = wxBrush:new(?wxBLACK, []), > server_loop(GrFrame, B). > > server_loop(GrFrame, B) -> > receive > {wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} -> > CDc = wxClientDC:new(GrFrame), > Dc = wxBufferedDC:new(CDc), > wxDC:setBackground(Dc, B), > {W,H} = wxWindow:getSize(GrFrame), > wxDC:drawRoundedRectangle(Dc, {2,2}, {W-4,H-4}, 3.0), > %wxDC:drawLines(Dc, [{10,10},{20,10},{20,20},{10,20}]), > wxBufferedDC:destroy(Dc), > wxClientDC:destroy(CDc), > server_loop(GrFrame, B) > end. > -------------------------------------- > > On Fri, 2008-04-11 at 16:30 +0200, Dan Gudmundsson wrote: >> I've made a new release. >> http://www.erlang.org/~dgud/wxerlang >> >> Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and >> re-wrote the connect/event api, so it's now incompatible with previous releases :-) >> >> NOTE it requires OTP-R12-2 though. >> >> Basically bigger, better and faster. >> >> Regards >> /Dan >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > From exta7@REDACTED Mon Apr 14 13:56:29 2008 From: exta7@REDACTED (Zvi) Date: Mon, 14 Apr 2008 04:56:29 -0700 (PDT) Subject: [erlang-questions] binary alignment Message-ID: <16676932.post@talk.nabble.com> Hi, I wander if it's possible either to create binaries already aligned, say by 512 bytes. Or somehow get actual address of the binary and calculate offset aligned by 512 bytes (512 bytes is just an example). In C++ code I doing something like this: const int ALIGNMENT_SIZE = 512; const int BUFFER_SIZE = 16384; unsigned char *pBuffer = new unsigned char[ALIGNMENT_SIZE + BUFFER_SIZE]; unsigned char *pAlignedBuffer = (unsigned char*)( (unsigned int)(pBuffer+ALIGNMENT_SIZE) & ~(ALIGNMENT_SIZE-1) ); Thanks in advance, Zvi -- View this message in context: http://www.nabble.com/binary-alignment-tp16676932p16676932.html Sent from the Erlang Questions mailing list archive at Nabble.com. From jachym.holecek@REDACTED Mon Apr 14 14:25:38 2008 From: jachym.holecek@REDACTED (Jachym Holecek) Date: Mon, 14 Apr 2008 14:25:38 +0200 Subject: [erlang-questions] binary alignment In-Reply-To: <16676932.post@talk.nabble.com> References: <16676932.post@talk.nabble.com> Message-ID: On Mon, 14 Apr 2008 13:56:29 +0200, Zvi wrote: > I wander if it's possible either to create binaries already aligned, say > by > 512 bytes. Or somehow get actual address of the binary and calculate > offset aligned by 512 bytes (512 bytes is just an example). Just curious: why do you want to do something like that? > In C++ code I doing something like this: > > const int ALIGNMENT_SIZE = 512; > const int BUFFER_SIZE = 16384; > unsigned char *pBuffer = new unsigned char[ALIGNMENT_SIZE + BUFFER_SIZE]; > unsigned char *pAlignedBuffer = (unsigned char*)( (unsigned > int)(pBuffer+ALIGNMENT_SIZE) & ~(ALIGNMENT_SIZE-1) ); This will lose when sizeof(void *) > sizeof(int). -- Jachym From francesco@REDACTED Mon Apr 14 15:40:56 2008 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 14 Apr 2008 14:40:56 +0100 Subject: [erlang-questions] Stockholm - Erlang User Group ( First Presentation, 22/4) Message-ID: <48035EE8.8080805@erlang-consulting.com> Hi All, Please pass this on to those you think might be interested: The Stockholm Erlang User Group is slowly taking form. We have put up a preliminary page where we will list the events: http://www.erlang-consulting.com/erlang/usergroup/erlangstockholm.html We are following a format similar to the one in London, where, depending on the subject, we have between 20 - 50 people attending every meeting. I have set up a yahoo groups mailing list which will be used to announce all of the events, offloading the Erlang Mailing list. You can subscribe to it in the top right of the page or by sending an email to erlangstockholm-subscribe@REDACTED The goal is to have one or more talks at host companies. That means we need * Host Companies * Speakers Please volunteer for both before I start chasing and nagging you. It would be great if we can have the next session planned before the next meeting, and announce it there. We kick off the first Stockholm Erlang User Group meetig with a talk by Prof. Kostis Sagonas about the ongoing research of the HIPE team from Uppsala University. The presentation will on the 22nd of April and start at 18.30 in Kreditor 's new offices on S:t Eriksgatan 117 in Stockholm. The doors will be open from 18.00 onwards. To join the Erlang Stockholm User Group mailing list and receive future updates and events, join in the Stockholm Erlang User Group page: http://www.erlang-consulting.com/erlang/usergroup/erlangstockholm.html If you are interested in attending this free event, you have to register here: http://www.erlang-consulting.com/erlang/usergroup/erlangstockholm/sugregister.html By registering, you will enable us to plan room size and refreshments accordingly, provide Security with the name list of participants, and in those extreme cases where the number of places are limited, close registration as soon as we have reached the maximum room capacity or find a larger room. * Type-based tools for sustainable development of Erlang programs **Abstract:*In this talk/demo combination we will review how three different type-based tools can be used to detect bugs in Erlang programs, document data structures and application interfaces, (in)validate hidden programming assumptions, and retrofit Erlang applications. In the process, we will also discuss the associated Erlang Enhancement Proposal (EEP8) which aims to add a type and specification language on top of Erlang. Two of the tools that will be reviewed (dialyzer & typer) are already part of the Erlang distribution. The third is yet to be named but is slowly maturing nonetheless. *Biography:*Kostis Sagonas is a travelling scientist interested in programming languages and software development. He an Associate Professor at the National Technical University of Athens, where the students occasionally allow him to work. He is also a Docent at Uppsala University leading the HiPE group where he has occasionally managed to convince its members to do what he thinks it's best for the project and for Erlang. In the last two years he has been obsessed with enriching Erlang with success (typings, that is) and contracts. I look forward to your feedback. Francesco -- http://www.erlang-consulting.com From ttmrichter@REDACTED Mon Apr 14 17:54:08 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Mon, 14 Apr 2008 23:54:08 +0800 Subject: [erlang-questions] Erlang External Format Message-ID: <1208188448.31278.18.camel@isolde> Where is this documented these days? I found ancient references to /erts/internal_doc, but investigating that directory in my copy of R12B-2 gives me an empty directory. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny..." (Isaac Asimov) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From kenneth.lundin@REDACTED Mon Apr 14 18:36:02 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 14 Apr 2008 18:36:02 +0200 Subject: [erlang-questions] Erlang External Format In-Reply-To: <1208188448.31278.18.camel@isolde> References: <1208188448.31278.18.camel@isolde> Message-ID: Hi, It is now part of the html documentation. You find it ERTS User's Guide chapter 8 and 9 http://www.erlang.org/doc/apps/erts/part_frame.html /Kenneth Erlang/OTP team , Ericsson On 4/14/08, Michael T. Richter wrote: > > Where is this documented these days? I found ancient references to > /erts/internal_doc, but investigating that directory in my copy of > R12B-2 gives me an empty directory. > > -- > *Michael T. Richter* (*GoogleTalk:* > ttmrichter@REDACTED) > *The most exciting phrase to hear in science - the one that heralds new > discoveries - is not "Eureka!" but "That's funny..." (Isaac Asimov)* > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fig@REDACTED Mon Apr 14 21:04:30 2008 From: fig@REDACTED (Michael FIG) Date: Mon, 14 Apr 2008 13:04:30 -0600 (CST) Subject: [erlang-questions] NIL_EXT [was: Erlang External Format] In-Reply-To: Message-ID: <27456268.54351208199870017.JavaMail.root@zimbra> Hi, One question... the LIST_EXT documentation on the website states the following: Length is the number of elements that follows in the Elements section. Tail is the final tail of the list; it is LARGE_TUPLE_EXT for a proper list, but may be anything type if the list is improper (for instance [a|b]). By my investigation, proper lists should be described as ending in NIL_EXT instead of LARGE_TUPLE_EXT. Could somebody please update the documentation accordingly? Thanks, -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From kenneth.lundin@REDACTED Mon Apr 14 22:04:01 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 14 Apr 2008 22:04:01 +0200 Subject: [erlang-questions] NIL_EXT [was: Erlang External Format] In-Reply-To: <27456268.54351208199870017.JavaMail.root@zimbra> References: <27456268.54351208199870017.JavaMail.root@zimbra> Message-ID: Hi, Thanks for pointing out the error. The documentation will be corrected in the the next release (R12B-3) /Kenneth Erlang/OTP team, Ericsson On 4/14/08, Michael FIG wrote: > Hi, > > One question... the LIST_EXT documentation on the website states the following: > > Length is the number of elements that follows in the Elements section. Tail is the final tail of the list; it is LARGE_TUPLE_EXT for a proper list, but may be anything type if the list is improper (for instance [a|b]). > > By my investigation, proper lists should be described as ending in NIL_EXT instead of LARGE_TUPLE_EXT. Could somebody please update the documentation accordingly? > > Thanks, > > -- > Michael FIG , PMP > MarkeTel Multi-Line Dialing Systems, Ltd. > Phone: (306) 359-6893 ext. 528 > > From monch1962@REDACTED Mon Apr 14 22:24:22 2008 From: monch1962@REDACTED (David Mitchell) Date: Tue, 15 Apr 2008 06:24:22 +1000 Subject: [erlang-questions] RLang In-Reply-To: <1208161702.31278.2.camel@isolde> References: <1208161702.31278.2.camel@isolde> Message-ID: I'd be interested, mainly because Erlang and Ruby are the two languages I work with most and it's quite possible I might want to work with the two together at some point (e.g. use Rails to build a Web front end onto an Erlang app). I don't have any specific requirement in mind though. Regards Dave M. On 14/04/2008, Michael T. Richter wrote: > > I've been toying (to the point of researching) with the idea of making a > Ruby<->Erlang binding along the lines of erl_interface or jinterface. > Before I go beyond toying and into the realm of actually doing, I'd like to > quickly know two things: > > 1. Is there any point to this? Would there in fact be any interest? > > 2. Has/is someone already done/already doing such? (I did a quick > search on this on Google and hit a few projects, none of which seemed to be > as complete as, say, jinterface at first blush.) > > -- > *Michael T. Richter* (*GoogleTalk:* > ttmrichter@REDACTED) > *A well-designed and humane interface does not need to be split into > beginner and expert subsystems. (Jef Raskin)* > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pfisher@REDACTED Mon Apr 14 23:54:22 2008 From: pfisher@REDACTED (Paul Fisher) Date: Mon, 14 Apr 2008 16:54:22 -0500 Subject: [erlang-questions] erlang distribution on SCTP? Message-ID: <1208210062.6077.178.camel@pfisher-laptop> Has anyone attempted to recast erlang distribution to run over SCTP? It seems that erlang distribution would benefit from many of the feature SCTP offers over TCP (multipathing/multihoming, multiple message-oriented streams, rich SACK, etc.) Just a personal project i'm considering and am interested if anyone else has done work/research in this direction. -- paul From lcoquelle@REDACTED Tue Apr 15 02:44:19 2008 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Tue, 15 Apr 2008 08:44:19 +0800 Subject: [erlang-questions] RLang In-Reply-To: References: <1208161702.31278.2.camel@isolde> Message-ID: There is the project erlectricity. It's not an jinterface-like interface, but it may be of interest. ludo 2008/4/15 David Mitchell : > I'd be interested, mainly because Erlang and Ruby are the two languages I > work with most and it's quite possible I might want to work with the two > together at some point (e.g. use Rails to build a Web front end onto an > Erlang app). I don't have any specific requirement in mind though. > > Regards > > Dave M. > > On 14/04/2008, Michael T. Richter wrote: > > > I've been toying (to the point of researching) with the idea of making > > a Ruby<->Erlang binding along the lines of erl_interface or jinterface. > > Before I go beyond toying and into the realm of actually doing, I'd like to > > quickly know two things: > > > > 1. Is there any point to this? Would there in fact be any > > interest? > > 2. Has/is someone already done/already doing such? (I did a quick > > search on this on Google and hit a few projects, none of which seemed to be > > as complete as, say, jinterface at first blush.) > > > > -- > > *Michael T. Richter* (*GoogleTalk:* > > ttmrichter@REDACTED) > > *A well-designed and humane interface does not need to be split into > > beginner and expert subsystems. (Jef Raskin)* > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgud@REDACTED Tue Apr 15 09:19:35 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Tue, 15 Apr 2008 09:19:35 +0200 Subject: [erlang-questions] wxErlang In-Reply-To: <48032A2D.1020104@erix.ericsson.se> References: <47FF7614.3030002@erix.ericsson.se> <1208015887.5465.1.camel@ubuntu-life-vm> <48032A2D.1020104@erix.ericsson.se> Message-ID: <48045707.8060901@erix.ericsson.se> I have made a new release, slogan: "now without eternal loops". /Dan Dan Gudmundsson wrote: > Comments below. > > Bob Cowdery wrote: >> Dan >> >> That's good news, the new classes are gratefully received. >> >> I'm having a few issues with the new release which I hope you can help >> with. >> >> The code below should demonstrate. >> >> 1. In the previous release if I connected to 'paint' I received a >> message {wx,_,{wx_ref,_,wxFrame},{wxNcPaint,paint}}. In this release I >> think I correctly receive {wx,_,{wx_ref,_,wxFrame},_,{wxPaint,paint}}. >> However, these events fire continuously and take my processor to 100%. I >> found however that I could connect to 'nc_event' and receive >> {wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} and these events only >> fire when they should do. However, I think NC means the non-client area >> and the wrong thing to attach to. > > Yes I fixed the nc_paint <-> paint, which was a bug in previous releases, > I noticed that it changed how often the events was fired I don't know > the reason, but I solved it by using a buffered-DC, which you are already > using, and set the appropriate skip option in the connect call. > > I wonder if you have to use callbacks for those events? > >> 2. In the code I have commented out a call to drawLines/2. Although this >> draws correctly my processor goes up to 50% and the window hangs (i.e >> 'not responding' in the title bar). I used this call a lot in the >> previous release without any problems. > > I will take a look at wxDc:drawLines and see if I've introduced a bug or two, > I'll email you privately. > > Thanks > /Dan > >> Regards >> Bob >> >> ------------------------------------ >> -module(test_ui). >> >> -include("..\\include\\wx.hrl"). >> >> -export([start/0, server_process/0]). >> >> start() -> >> spawn(?MODULE, server_process, []). >> >> server_process() -> >> _WX = wx:new(), >> GrFrame = wxFrame:new(wx:null(), 1, >> "Window",[{style,?wxFRAME_TOOL_WINDOW bor ?wxCAPTION}]), >> wxFrame:connect(GrFrame, nc_paint), >> wxFrame:show(GrFrame, []), >> B = wxBrush:new(?wxBLACK, []), >> server_loop(GrFrame, B). >> >> server_loop(GrFrame, B) -> >> receive >> {wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} -> >> CDc = wxClientDC:new(GrFrame), >> Dc = wxBufferedDC:new(CDc), >> wxDC:setBackground(Dc, B), >> {W,H} = wxWindow:getSize(GrFrame), >> wxDC:drawRoundedRectangle(Dc, {2,2}, {W-4,H-4}, 3.0), >> %wxDC:drawLines(Dc, [{10,10},{20,10},{20,20},{10,20}]), >> wxBufferedDC:destroy(Dc), >> wxClientDC:destroy(CDc), >> server_loop(GrFrame, B) >> end. >> -------------------------------------- >> >> On Fri, 2008-04-11 at 16:30 +0200, Dan Gudmundsson wrote: >>> I've made a new release. >>> http://www.erlang.org/~dgud/wxerlang >>> >>> Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and >>> re-wrote the connect/event api, so it's now incompatible with previous releases :-) >>> >>> NOTE it requires OTP-R12-2 though. >>> >>> Basically bigger, better and faster. >>> >>> Regards >>> /Dan >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jilani@REDACTED Tue Apr 15 09:39:44 2008 From: jilani@REDACTED (Jilani Khaldi) Date: Tue, 15 Apr 2008 09:39:44 +0200 Subject: [erlang-questions] How to write this code better? In-Reply-To: <33663520-252A-4206-A1F9-A466800C60A0@cs.otago.ac.nz> References: <47FFD165.9030301@cheapnet.it> <23D56F7D-34D7-4B2C-A2E3-BB5F6F513822@cs.otago.ac.nz> <48031FC8.40507@cheapnet.it> <33663520-252A-4206-A1F9-A466800C60A0@cs.otago.ac.nz> Message-ID: <48045BC0.1060409@cheapnet.it> > Some are wronger than others. > In particular, using a value for pi that doesn't agree with the > trig functions you are using can give serious trouble. > (Yes, I have known real, simple, programs crash because they used > a 64-bit value for pi while the trig functions used an 80-bit value.) Very true. I think the serious problem is when the value has the wrong sign (due to some approximations) and not a less approximated value. > My M.Sc. is in underwater acoustics. Great! I know some abovewater acoustics :-), precisely inside buildings which are really very complicated to solve them (in all senses). > An error analysis is always appropriate. > > The Wikipedia article for "Declination" gives > > delta = (180/pi)*( 0.006918 > + 0.070257 sin( g) - 0.399912 cos( g) > + 0.000907 sin(2g) - 0.006758 cos(2g) > + 0.001480 sin(3g) - 0.002697 cos(3g) ) > where g = (2pi/365)(N-1) > > Turning that into code and running it over N = 1..365, I found the > range of delta to be [-23.426039, 23.455569], which means that the > checks for delta > 89.99 or < -89.99 are utterly pointless. I took the code (written in Javascript) from this page: http://squ1.org/wiki/Solar_Position_Calculator I have seen that it gives roughly the same result as Shams (*) so I didn't mind about the rest. To write Shams I used the contents of the technical report from this page: http://rredc.nrel.gov/solar/codesandalgorithms/spa/ > This addresses most of the issues I mentioned. The coefficients are given > to the same precision, and the source is shown, so that it is possible to > check them. Ok, I will update the code. Thank you! However, for me all this is only an exercice to learn Erlang remaining in my domain. My real applications that I use at work (for ages) are written in (Object) Pascal and/or in Ada (now 2005 GNAT) and they are very mature. I think that Erlang has the "feet short" (an italian translation) to walk in scientific and technical applications, but long enough to do many useful little things in this field. Just a request. Could you joint us at http://groups.google.com/group/erlstp so we can discuss there? I just have begun to write EMath, a small math module with few but useful routines (the module already has almost all the maths you need for reinforced concrete calculations and many other kinds of civil engineering structural analysis!). http://www.dotpas.org/estp/emath.erl >> In many real world applications 89.9, 89.99 and 9.999 give the same >> pratical results! > > Presumably 9.999 should have been 89.999. Anyway, you are right, because > for this problem that range clipping never has any effect whatever. In > fact, it is BETTER not to do that clipping, lest it disguise some error. >> >> See this image: >> http://www.dotpas.org/software/shams1.jpg > > When I click on that I get > Not Found > The requested URL /software/shams1.jpg was not found on this server. > Yaws 1.76 Server at deneb Glad to know that my old Deneb still works well! Sorry it is: http://www.dotpas.org/software/shams1.png -- *** Jilani KHALDI http://www.dotpas.org From ken@REDACTED Tue Apr 15 10:56:04 2008 From: ken@REDACTED (Ken Corey) Date: Tue, 15 Apr 2008 09:56:04 +0100 Subject: [erlang-questions] NEWBIE: GUI tookit binaries for windows? Message-ID: <48046DA4.40402@kencorey.com> Hi All, I'm a long-time unix user running Windows on my boxes at home, interested in learning erlang. I'm on XP, and recently downloaded R12B. Erlang certainly seems a language worth a bit of study. I was looking at the example for the bouncing ball between a linux and windows 95 box. Very intriguing, yet I can't seem to find binaries for either etk or erlgtk. all the links to binaries seem to have dried up. When I went to the erlgtk page on sourceforge, there's simply a tarball of the source files. Building it under windows doesn't sound particularly fun to me. Should I simply be playing with Erlang on a linux box via a virtual machine where I can build whatever is needed? Can anyone point me at binaries of the widget libraries? Thanks, -Ken From rsaccon@REDACTED Tue Apr 15 16:54:11 2008 From: rsaccon@REDACTED (Roberto Saccon) Date: Tue, 15 Apr 2008 11:54:11 -0300 Subject: [erlang-questions] NEWBIE: GUI tookit binaries for windows? In-Reply-To: <48046DA4.40402@kencorey.com> References: <48046DA4.40402@kencorey.com> Message-ID: have you tried wxErlang ? http://www.erlang.org/~dgud/wxerlang/ haven't tried it myself on Windows, but made good experience with wxWidgtes itself on Windows in the past. On Tue, Apr 15, 2008 at 5:56 AM, Ken Corey wrote: > Hi All, > > I'm a long-time unix user running Windows on my boxes at home, > interested in learning erlang. I'm on XP, and recently downloaded R12B. > > Erlang certainly seems a language worth a bit of study. I was looking > at the example for the bouncing ball between a linux and windows 95 > box. Very intriguing, yet I can't seem to find binaries for either etk > or erlgtk. all the links to binaries seem to have dried up. > > When I went to the erlgtk page on sourceforge, there's simply a tarball > of the source files. Building it under windows doesn't sound > particularly fun to me. > > Should I simply be playing with Erlang on a linux box via a virtual > machine where I can build whatever is needed? > > Can anyone point me at binaries of the widget libraries? > > Thanks, > > -Ken > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From masterofquestions@REDACTED Tue Apr 15 18:21:55 2008 From: masterofquestions@REDACTED (db) Date: Tue, 15 Apr 2008 12:21:55 -0400 Subject: [erlang-questions] DHT in erlang In-Reply-To: <1205508244.6404.7.camel@macbook> References: <7629cacc0803111145r2dfd1002ybad89e60a813b046@mail.gmail.com> <47D8A68C.2080502@ghostgun.com> <1205508244.6404.7.camel@macbook> Message-ID: <1218d6a50804150921i5ba5db5al3a498f43863c906@mail.gmail.com> I am also interested in erlang distributed hash table. Is there a public link for the project available? On Fri, Mar 14, 2008 at 11:24 AM, Henrique Ferreiro < henrique.ferreiro@REDACTED> wrote: > I implemented the chord DHT for an end of degree project. Let me now if > you have any questions. > > O Xov, 13-03-2008 ?s 14:59 +1100, jm escribiu: > > Ashish Sharma wrote: > > > Hi > > > > > > Has anyone implemented some DHT (standard or custom) distributed hash > > > table in erlang or has seen such implementation. > > > > > > > I've thought about it in passing but had to start working on something > > else. I was looking at it from the bit torrent perspective though. The > > intent was more trying to optimise local network traffic than to > > actually run a tracker or bt client. Where you thinking of something > > specific algorithm (eg chord http://pdos.csail.mit.edu/chord/), purpose, > > etc? > > > > > > Jeff. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsaccon@REDACTED Tue Apr 15 18:26:32 2008 From: rsaccon@REDACTED (Roberto Saccon) Date: Tue, 15 Apr 2008 13:26:32 -0300 Subject: [erlang-questions] abstract/static modules, multicast, and best practices Message-ID: I just received a direct mail from someone, who tried to post on the Erlang Mailing list, he tried everything ("I tryied posting directly the list site on google groups and sending an email. I also mailed the list owner, but never got a reply."), but did not get through,so I am posting this on behalf of: Lasaro Camargos : =================================== Subject: abstract/static modules, multicast, and best practices. Hi all, I am newbie in erlang with some doubts that I couldn't clarify with google's help. Hope you can help me with those. First, I would like to know if there is any formal description of Mnesia's commit protocols. Any paper, page, manual? Second, recently I saw some discussion about abstract and static modules in erlang. The only material that I found seems to be an outdated academic paper (Parameterized modules in Erlang). Is there where I can learn more about these abstract and static modules and parameterized modules? Is the paper what has been implemented in erlang? Third, is there a way to use multicast in the erlang messaging system? I know I could use IP Multicast, but I simply love the ! and receive constructs. Fourth, a more practical question. I use TLA+ to describe distributed protocols and would like to stay as close as possible to it when implementing these protocols. TLA+ looks more or less like this, Action def when CondA(State) and (CondB(State) or CondC(State)) do state transition. When I saw the guarded receives of erlang, it seemed like it would be the perfect match since in my protocols, most actions are triggered by a message receipt. I though would be able to write: loop(State) -> receive {M} when CondA(State) andalso CondB(State) -> StateN = doStateTransition1(State) loop(StateN) {M} when CondA(State) andalso CondC(State) -> StateN = doStateTransition2(State) loop(StateN) end. I saw from the many emails about guard expressions that you do not plan to accept more complex functions as guards, so I won't even argue that it would be awesome. Instead, I will just ask how would you rewrite such a code knowing that the CondX functions not complex but not too simple. Moreover, I would not like to take {M} out of the queue unless it matches one of the receive clauses (messages that do not match a clause may later match, if another message is processed first). Last, is there anyway of delegating the task of reception of a message to another process? I will explain: I create a process to handle every instance of my protocol. When an instance becomes too old and mostly inactive, I would like to swap it off and delegate the task of the receiving late messages to another process. This process would be responsible for receiving messages for all the old instances and, in rare case in which a message actually arrives, waking the instance handler up. Can this be done? I would not like to have a proxy receiving messages before any active instance process, though. Best regards, L?saro =================================== -- Roberto Saccon http://rsaccon.com From matthew@REDACTED Tue Apr 15 18:47:47 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 15 Apr 2008 09:47:47 -0700 Subject: [erlang-questions] abstract/static modules, multicast, and best practices In-Reply-To: References: Message-ID: On Tue, Apr 15, 2008 at 9:26 AM, Roberto Saccon wrote: > First, I would like to know if there is any formal description of > Mnesia's commit protocols. Any paper, page, manual? I don't know of any. > Second, recently I saw some discussion about abstract and static > modules in erlang. The only material that I found seems to be an > outdated academic paper (Parameterized modules in Erlang). Is there > where I can learn more about these abstract and static modules and > parameterized modules? Is the paper what has been implemented in > erlang? That paper's the only reference I know of other than the source (compiler/src/sys_expand_pmod.erl handles rewriting abstract forms from a parameterized module). > Third, is there a way to use multicast in the erlang messaging system? > I know I could use IP Multicast, but I simply love the ! and receive > constructs. Erlang's standard distribution protocol uses TCP, which can't run over IP multicast. There's an API for writing your own distribution modules, but it's non-trivial and I don't know off hand if the API would allow for multicast anyways. > I saw from the many emails about guard expressions that you do not > plan to accept more complex functions as guards, so I won't even argue > that it would be awesome. Instead, I will just ask how would you > rewrite such a code knowing that the CondX functions not complex but > not too simple. Moreover, I would not like to take {M} out of the > queue unless it matches one of the receive clauses (messages that do > not match a clause may later match, if another message is processed > first). Depending on the situation, you could write a macro for ?condx or something. Otherwise you'd probably have to pull out all of the M messages and maintain your own mailbox. > Last, is there anyway of delegating the task of reception of a message > to another process? I will explain: I create a process to handle every > instance of my protocol. When an instance becomes too old and mostly > inactive, I would like to swap it off and delegate the task of the > receiving late messages to another process. This process would be > responsible for receiving messages for all the old instances and, in > rare case in which a message actually arrives, waking the instance > handler up. Can this be done? I would not like to have a proxy > receiving messages before any active instance process, though. I don't know of anything other than manually relaying messages. From richardc@REDACTED Tue Apr 15 20:30:55 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 15 Apr 2008 20:30:55 +0200 Subject: [erlang-questions] abstract/static modules, multicast, and best practices In-Reply-To: References: Message-ID: <4804F45F.5090502@it.uu.se> Roberto Saccon wrote: > I just received a direct mail from someone, who tried to post on the > Erlang Mailing list, he tried everything ("I tryied posting directly > the list site on google groups and sending an email. I also mailed the > list owner, but never got a reply."), but did not get through,so I am > posting this on behalf of: Lasaro Camargos : > > =================================== > [...] > Second, recently I saw some discussion about abstract and static > modules in erlang. The only material that I found seems to be an > outdated academic paper (Parameterized modules in Erlang). Is there > where I can learn more about these abstract and static modules and > parameterized modules? Is the paper what has been implemented in > erlang? Yes, the implementation pretty much follows the paper. You can also look at the slides on inheritance, to see some of the latest changes: http://www.erlang.se/euc/07/papers/1700Carlsson.pdf All of this is available in the latest R12 releases of Erlang. Note that these are experimental features, not officially supported yet. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From matthew@REDACTED Tue Apr 15 21:41:37 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 15 Apr 2008 12:41:37 -0700 Subject: [erlang-questions] [erlang-bugs] Weird pg2 behavior In-Reply-To: <18435.1529.209488.50485@gargle.gargle.HOWL> References: <18431.9227.133848.989614@gargle.gargle.HOWL> <18435.1529.209488.50485@gargle.gargle.HOWL> Message-ID: On Mon, Apr 14, 2008 at 12:21 AM, Hans Bolinder wrote: > I've tried to find more bugs, but so far without success. I think I came up with a race condition scenario for pg2: Node1 and Node2 are running and communicating. Pid is on Node1, and a member of pg2 group Group. Node3 starts up and connects to Node2 first. Node3 and Node2's pg2 processes exchange their group tables, and Node3 ends up with Pid in the Group table. Node1 goes down before Node3 connects to it. A nodedown message is sent to Node2, who clears Pid from Group. Node1 restarts and exchanges group tables with Node2 and Node3 again, and Pid remains in the Group table. I'm thinking a possible solution would be when a pg2 process receives a {nodeup, Node} message, it first removes all pids from Node in its ets tables and relies on the exchange to reinstate them. From lcoquelle@REDACTED Wed Apr 16 04:51:14 2008 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 16 Apr 2008 10:51:14 +0800 Subject: [erlang-questions] Erlang External Format In-Reply-To: References: <1208188448.31278.18.camel@isolde> Message-ID: This is really nice! will sure use this to check my code! Found a (critical) missing detail in EPMD section, here: http://www.erlang.org.sharedcopy.com/doc/apps/erts/0d0537825a9cd57d0f18c61caffa24f5.html#shcp0 2008/4/15 Kenneth Lundin : > Hi, > > It is now part of the html documentation. > You find it ERTS User's Guide chapter 8 and 9 > http://www.erlang.org/doc/apps/erts/part_frame.html > > /Kenneth Erlang/OTP team , Ericsson > > On 4/14/08, Michael T. Richter wrote: > > > Where is this documented these days? I found ancient references to > > /erts/internal_doc, but investigating that directory in my copy of > > R12B-2 gives me an empty directory. > > > > -- > > *Michael T. Richter* (*GoogleTalk:* > > ttmrichter@REDACTED) > > *The most exciting phrase to hear in science - the one that heralds new > > discoveries - is not "Eureka!" but "That's funny..." (Isaac Asimov)* > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Apr 16 05:01:29 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 16 Apr 2008 15:01:29 +1200 Subject: [erlang-questions] abstract/static modules, multicast, and best practices In-Reply-To: References: Message-ID: On 16 Apr 2008, at 4:26 am, Roberto Saccon wrote: > on behalf of: Lasaro Camargos : > When I saw the guarded receives of erlang, it seemed like it would be > the perfect match since in my protocols, most actions are triggered by > a message receipt. I though would be able to write: > loop(State) -> > receive > {M} when CondA(State) andalso CondB(State) -> > StateN = doStateTransition1(State) > loop(StateN) > {M} when CondA(State) andalso CondC(State) -> > StateN = doStateTransition2(State) > loop(StateN) > end. I want to make a slightly different point. There are a number of CSP-ish languages, including Occam and arguably including Ada, where the guards on receive clauses are tested *before* announcing willingness to accept a communication. Ada 95 LRM 9.7.1 "Selective Accept", the "dynamic semantics" section makes it clear that FIRST the guards are evaluated to determine which alternatives are really on offer, and AFTER that a communication may take place involving one of the open alternatives. The Ada syntax makes the order relatively clear: when Guard => accept Entry; ... The Erlang syntax makes Erlang's order relatively clear: Pattern when Guard -> ... If the Guard doesn't mention any variables bound in the Pattern, the Erlang version effectively gives you the desired result. But this does _in principle_ still leave the pattern matched against every message in the mailbox. I don't suppose it's likely to be a problem. The reason I mention this is that not knowing TLA+, and given the "CondX(State)" mentions on the e-message, I found that I couldn't tell whether the original poster wanted test-before-accept or test-after-tentative-accept. From dnew@REDACTED Wed Apr 16 07:15:22 2008 From: dnew@REDACTED (Darren New) Date: Tue, 15 Apr 2008 22:15:22 -0700 Subject: [erlang-questions] DHT in erlang In-Reply-To: <1218d6a50804150921i5ba5db5al3a498f43863c906@mail.gmail.com> References: <7629cacc0803111145r2dfd1002ybad89e60a813b046@mail.gmail.com> <47D8A68C.2080502@ghostgun.com> <1205508244.6404.7.camel@macbook> <1218d6a50804150921i5ba5db5al3a498f43863c906@mail.gmail.com> Message-ID: <48058B6A.2080109@san.rr.com> db wrote: > I am also interested in erlang distributed hash table. Is there a > public link for the project available? I just ran across this, which might be a better choice than DHT for some things. http://www.cs.yale.edu/homes/aspnes/skip-graphs-abstract.html HTH. -- Darren New / San Diego, CA, USA (PST) "That's pretty. Where's that?" "It's the Age of Channelwood." "We should go there on vacation some time." From vik@REDACTED Wed Apr 16 07:48:06 2008 From: vik@REDACTED (Vik Olliver) Date: Wed, 16 Apr 2008 17:48:06 +1200 Subject: [erlang-questions] [Beginner]How do I find out if ibrowse:send_req/5 has timed out? Message-ID: <1208324886.12040.234.camel@kereru.wgtn.cat-it.co.nz> Hello Erlangers. I'm still at the "struggling bravely" phase and peering at code which is still somewhat over my head. Part of this uses ibrowse:send_req/5, which doesn't have a timeout. Or at least none it owns up to. Will it timeout eventually, and if so how do I tell that it did? If it doesn't time out, same basic question applies should I use ibrowse:send_req/6 - how do I tell? Vik :v) From ulf.wiger@REDACTED Wed Apr 16 08:56:04 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 16 Apr 2008 08:56:04 +0200 Subject: [erlang-questions] abstract/static modules, multicast, and best practices In-Reply-To: References: Message-ID: <4805A304.4040206@ericsson.com> Roberto Saccon skrev: > > First, I would like to know if there is any formal description of > Mnesia's commit protocols. Any paper, page, manual? I don't know of any formal description. This is probably the most thorough description around: http://www.erlang.org/~hakan/mnesia_internals_slides.pdf Of course, if you count patent speak as "formal" there is this: http://www.google.com/patents/pdf/Lingering_locks_for_replicated_data_obje.pdf?id=W_YWAAAAEBAJ&output=pdf&sig=RgrIO6CjQX-7Y-i8Eb9L2PdTr9U ...which describes a certain part - "sticky locks", I think (I haven't read the patent). BR, Ulf W From adam@REDACTED Wed Apr 16 09:09:02 2008 From: adam@REDACTED (Adam Lindberg) Date: Wed, 16 Apr 2008 09:09:02 +0200 Subject: [erlang-questions] Current working directory Message-ID: <6344005f0804160009n176d3a1ay772030bda19ab657@mail.gmail.com> Hi all! I'm writing an escript and is trying to figure out which directory it's being run in. However, I can't seem to find a function to get the current working directory (pwd on *NIX) in Erlang. There is one in the module 'c', but it just returns 'ok' and prints the directory instead of returning it! How can I get the current working directory in Erlang? Cheers! Adam -- Adam Lindberg http://www.erlang-consulting.com From adam@REDACTED Wed Apr 16 09:13:21 2008 From: adam@REDACTED (Adam Lindberg) Date: Wed, 16 Apr 2008 09:13:21 +0200 Subject: [erlang-questions] Current working directory In-Reply-To: <6344005f0804160009n176d3a1ay772030bda19ab657@mail.gmail.com> References: <6344005f0804160009n176d3a1ay772030bda19ab657@mail.gmail.com> Message-ID: <6344005f0804160013l771b1521n1c67cd48e4c5c864@mail.gmail.com> Sorry, I was too hasty! It just came to me after sending the email: 1> filename:absname(""). "/home/alind" 2> But it was not that intuitive. ;-) Cheers! Adam -- Adam Lindberg http://www.erlang-consulting.com On Wed, Apr 16, 2008 at 9:09 AM, Adam Lindberg wrote: > Hi all! > > I'm writing an escript and is trying to figure out which directory > it's being run in. However, I can't seem to find a function to get the > current working directory (pwd on *NIX) in Erlang. There is one in the > module 'c', but it just returns 'ok' and prints the directory instead > of returning it! How can I get the current working directory in > Erlang? > > Cheers! > Adam > -- > Adam Lindberg > http://www.erlang-consulting.com > From ulf.wiger@REDACTED Wed Apr 16 09:15:22 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 16 Apr 2008 09:15:22 +0200 Subject: [erlang-questions] Current working directory In-Reply-To: <6344005f0804160013l771b1521n1c67cd48e4c5c864@mail.gmail.com> References: <6344005f0804160009n176d3a1ay772030bda19ab657@mail.gmail.com> <6344005f0804160013l771b1521n1c67cd48e4c5c864@mail.gmail.com> Message-ID: <4805A78A.4030101@ericsson.com> Adam Lindberg skrev: > Sorry, I was too hasty! It just came to me after sending the email: > > 1> filename:absname(""). > "/home/alind" > 2> > > But it was not that intuitive. ;-) Then, perhaps this one will appeal to you more: file:get_cwd() -> {ok, Dir} | {error, Reason} BR, Ulf W From ratmapper@REDACTED Wed Apr 16 09:26:05 2008 From: ratmapper@REDACTED (Raimo Niskanen) Date: Wed, 16 Apr 2008 00:26:05 -0700 (PDT) Subject: [erlang-questions] Test from Google Groups Message-ID: <396e5715-efa4-43fc-aba7-19ac62484e57@a22g2000hsc.googlegroups.com> Test from Google Groups From adam@REDACTED Wed Apr 16 09:39:53 2008 From: adam@REDACTED (Adam Lindberg) Date: Wed, 16 Apr 2008 09:39:53 +0200 Subject: [erlang-questions] Current working directory In-Reply-To: <4805A78A.4030101@ericsson.com> References: <6344005f0804160009n176d3a1ay772030bda19ab657@mail.gmail.com> <6344005f0804160013l771b1521n1c67cd48e4c5c864@mail.gmail.com> <4805A78A.4030101@ericsson.com> Message-ID: <6344005f0804160039q3476875bnd87a7b91c99d6d05@mail.gmail.com> Yes, using that one is not "abuse". :-) Although I'll stick with my version because it's more easily combined: CurrentDirName = filename:basename(filename:absname(""). vs {ok, Dir} = file:get_cwd(), CurrentDirName = filename:basename(Dir). Cheers! Adam -- Adam Lindberg http://www.erlang-consulting.com On Wed, Apr 16, 2008 at 9:15 AM, Ulf Wiger (TN/EAB) wrote: > Adam Lindberg skrev: > > > > Sorry, I was too hasty! It just came to me after sending the email: > > > > 1> filename:absname(""). > > "/home/alind" > > 2> > > > > But it was not that intuitive. ;-) > > > > Then, perhaps this one will appeal to you more: > > file:get_cwd() -> {ok, Dir} | {error, Reason} > > BR, > Ulf W > From raimo+erlang-questions@REDACTED Wed Apr 16 09:54:50 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 16 Apr 2008 09:54:50 +0200 Subject: [erlang-questions] Test from Google Groups In-Reply-To: <396e5715-efa4-43fc-aba7-19ac62484e57@a22g2000hsc.googlegroups.com> References: <396e5715-efa4-43fc-aba7-19ac62484e57@a22g2000hsc.googlegroups.com> Message-ID: <20080416075450.GA18431@erix.ericsson.se> To anyone posting from Google Groups (especially Lasaro); it at least works if your gmail address is registered as member (e.g nomail member) at erlang-questions. Please register on: http://www.erlang.org/mailman/listinfo/erlang-questions then edit your options to disable mail delivery. On Wed, Apr 16, 2008 at 12:26:05AM -0700, Raimo Niskanen wrote: > Test from Google Groups > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kranto@REDACTED Wed Apr 16 10:16:01 2008 From: kranto@REDACTED (=?ISO-8859-1?Q?Ky=F6sti_Ranto?=) Date: Wed, 16 Apr 2008 01:16:01 -0700 (PDT) Subject: [erlang-questions] Test from Google Groups In-Reply-To: <20080416075450.GA18431@erix.ericsson.se> References: <396e5715-efa4-43fc-aba7-19ac62484e57@a22g2000hsc.googlegroups.com> <20080416075450.GA18431@erix.ericsson.se> Message-ID: <8af75b8c-cc9d-44c6-b93c-dabaf444fd86@2g2000hsn.googlegroups.com> Another test. Earlier I haven't been able to post to this group. I now registered at erlang-questions and let's see if this post gets through. cheers, Ky?sti On Apr 16, 10:54 am, Raimo Niskanen wrote: > To anyone posting from Google Groups (especially Lasaro); > it at least works if your gmail address is registered as > member (e.g nomail member) at erlang-questions. > > Please register on:http://www.erlang.org/mailman/listinfo/erlang-questions > then edit your options to disable mail delivery. > > On Wed, Apr 16, 2008 at 12:26:05AM -0700, Raimo Niskanen wrote: > > Test from Google Groups > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From dirk.vleugels@REDACTED Wed Apr 16 10:24:40 2008 From: dirk.vleugels@REDACTED (Dirk Vleugels) Date: Wed, 16 Apr 2008 10:24:40 +0200 Subject: [erlang-questions] tuxedo/atmi? Message-ID: <1127506c0804160124u5aa515a3s3327f8ba0c6ad13f@mail.gmail.com> Hi, anyone knows about erlang bindings / port driver for bea tuxedo (atmi / fml) native libraries? Cheers, Dirk From wenewboy@REDACTED Wed Apr 16 10:32:31 2008 From: wenewboy@REDACTED (wenew zhang) Date: Wed, 16 Apr 2008 16:32:31 +0800 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! Message-ID: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> On gen_server:call descriptions,we can call a process like : *ServerRef = Name | {Name,Node} | {global,GlobalName} | pid() i have some questions:* ** *1.if my application have many local register,how to use {name,node} call a Pid?* *such as i run many process register as {local,?MODULE}* *2.I try gen_fsm:sync_send_event({Pid,Node},{Data}),it's doesn't work.* *3.I try gen_fsm:sync_send_event({Name,Node},{Data}),it's doesn't work.* ** *How can i fix this problem without register a globalName?* *How to use {Name,Node}?* *Best Regards* ** *Wenew Zhang* ** ** -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed Apr 16 10:39:34 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 16 Apr 2008 10:39:34 +0200 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! In-Reply-To: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> References: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> Message-ID: <95be1d3b0804160139t4c184ca6k837192e3289274c4@mail.gmail.com> Hi, 2008/4/16 wenew zhang : > On gen_server:call descriptions,we can call a process like : > ServerRef = Name | {Name,Node} | {global,GlobalName} | pid() > i have some questions: > > 1.if my application have many local register,how to use {name,node} call a > Pid? > such as i run many process register as {local,?MODULE} > 2.I try gen_fsm:sync_send_event({Pid,Node},{Data}),it's doesn't work. > 3.I try gen_fsm:sync_send_event({Name,Node},{Data}),it's doesn't work. I'm not sure if this answers your question, but if you have a pid, then you can just use it, it doesn't matter if it is a local one or a remote one. You don't need to write {Pid, Node}, just Pid is enough. best regards, Vlad From hans.bolinder@REDACTED Wed Apr 16 10:46:22 2008 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Wed, 16 Apr 2008 10:46:22 +0200 Subject: [erlang-questions] [erlang-bugs] Weird pg2 behavior In-Reply-To: References: <18431.9227.133848.989614@gargle.gargle.HOWL> <18435.1529.209488.50485@gargle.gargle.HOWL> Message-ID: <18437.48350.271334.980195@gargle.gargle.HOWL> [Matthew Dempsky:] > I think I came up with a race condition scenario for pg2: > > Node1 and Node2 are running and communicating. > Pid is on Node1, and a member of pg2 group Group. > Node3 starts up and connects to Node2 first. > Node3 and Node2's pg2 processes exchange their group tables, > and Node3 ends up with Pid in the Group table. > Node1 goes down before Node3 connects to it. > A nodedown message is sent to Node2, who clears Pid from Group. > Node1 restarts and exchanges group tables with Node2 and Node3 again, > and Pid remains in the Group table. > > I'm thinking a possible solution would be when a pg2 process receives > a {nodeup, Node} message, it first removes all pids from Node in its > ets tables and relies on the exchange to reinstate them. This solution probably works most of the time. But if Global doesn't maintain a fully connected network, or Global encounters problems while connecting nodes, it probably won't work. I think pg2 should monitor all pids rather than link to local pids only. Carefully setting up monitors, like Global does since R11B-4, should work. Best regards, Hans Bolinder, Erlang/OTP team From lemenkov@REDACTED Wed Apr 16 10:56:45 2008 From: lemenkov@REDACTED (Peter Lemenkov) Date: Wed, 16 Apr 2008 12:56:45 +0400 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! In-Reply-To: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> References: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> Message-ID: Hello! 2008/4/16, wenew zhang : > On gen_server:call descriptions,we can call a process like : > ServerRef = Name | {Name,Node} | {global,GlobalName} | pid() > i have some questions: > > 1.if my application have many local register,how to use {name,node} call a > Pid? Using Pid would be enough. But first you need a valid one. Assume you want to start application at some other node and you want to send message to it. You need to start application using rpc:call(SomeNode, yourapp, startfun, [Params]). It returns {ok, Pid} in case of success. This Pid you may use as any other local pids. -- With best regards! From litaocheng@REDACTED Wed Apr 16 10:57:23 2008 From: litaocheng@REDACTED (=?GB2312?B?s8nBoszO?=) Date: Wed, 16 Apr 2008 16:57:23 +0800 Subject: [erlang-questions] about tail-recursive Message-ID: Hi everyone. Recently I read http://www.erlang.org/download/armstrong_thesis_2003.pdf. In this paper 3.3.8, the author talk about tail-recursive: "Firstly the non tail-recursive way: factorial(0) -> 1; factorial(N) -> N * factorial(N-1). " I see this section is non tail-recursive. In my mind, the tail-recursive is the better, because it do not consuming stack! When I read OTP src, I find in the stdlib lists.erl. the map/2 write in this style: "map(F, [H|T]) -> [F(H)|map(F, T)]; map(F, []) when is_function(F, 1) -> []. " I think it's non tail-recursive? realy? and why not ? tanks ! -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Wed Apr 16 11:27:48 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 16 Apr 2008 11:27:48 +0200 Subject: [erlang-questions] about tail-recursive In-Reply-To: References: Message-ID: "???" writes: > Hi everyone. > Recently I read http://www.erlang.org/download/armstrong_thesis_2003.pdf. > In this paper 3.3.8, the author talk about tail-recursive: > "Firstly the non tail-recursive way: > factorial(0) -> 1; > factorial(N) -> N * factorial(N-1). > " > I see this section is non tail-recursive. In my mind, the tail-recursive is > the better, because it do not consuming stack! Yes, it is. > When I read OTP src, I find in the stdlib lists.erl. the map/2 write in this > style: > "map(F, [H|T]) -> > [F(H)|map(F, T)]; > map(F, []) when is_function(F, 1) -> []. Correct! It is not tail-recursive. The tail-recursive version would not consume any stack, but it would have to build a list in reverse order, which it would have to reverse by calling lists:reverse/1. The stack space and the list consumes exactly the same amount of memory (in R12B). See http://www.erlang.org/doc/efficiency_guide/myths.html#2.3 /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From lemenkov@REDACTED Wed Apr 16 11:27:54 2008 From: lemenkov@REDACTED (Peter Lemenkov) Date: Wed, 16 Apr 2008 13:27:54 +0400 Subject: [erlang-questions] about tail-recursive In-Reply-To: References: Message-ID: Hello All! 2008/4/16, ??? : > Hi everyone. > Recently I read > http://www.erlang.org/download/armstrong_thesis_2003.pdf. > In this paper 3.3.8, the author talk about tail-recursive: > "Firstly the non tail-recursive way: > factorial(0) -> 1; > factorial(N) -> N * factorial(N-1). > " > I see this section is non tail-recursive. In my mind, the tail-recursive is > the better, because it do not consuming stack! Don't be afraid of non-tail recursions. There are practical user-cases there people claims that tail-recursion is less suitable than non-tail-recursive realizations. For example, if we look into ejabberd sources we may find something like this piece of code: ================= %tolower(S) -> % lists:map(fun tolower_c/1, S). %tolower(S) -> % [?LOWER(Char) || Char <- S]. % Not tail-recursive but it seems works faster than variants above tolower([C | Cs]) -> if C >= $A, C =< $Z -> [C + 32 | tolower(Cs)]; true -> [C | tolower(Cs)] end; tolower([]) -> []. ================= Summarizing things - if your recursion won't take *very big* (infinite) number of steps then you may find that non-tail recursion will be more suitable. -- With best regards! From nitin.rai@REDACTED Tue Apr 15 11:02:46 2008 From: nitin.rai@REDACTED (nitin rai) Date: Tue, 15 Apr 2008 14:32:46 +0530 Subject: [erlang-questions] ERROR REPORT::Got invalid data on distribution channel Message-ID: HiI have established a connection between an erlang node and java program using the jinterface.It works fine most of the time but sometimes i get the following error report =ERROR REPORT==== 14-Apr-2008::09:18:33 === Got invalid data on distribution channel, offending packet is: <<112,131,104,4,97,6,103,100,0,41,108,111,99,97,108,104,111,115,116,45,57, 49,48,55,49,56,48,48,49,53,55,57,55,51,56,52,48,55,55,64,99,97,114,100,115,97,108,108,100,97,121,0,0,0,1,0,0,0,0,0,100,0,0,100,0,3,114, 101,120,131,104,2,103,100,0,41,108,111,99,97,108,104,111,115, 116,45,57,49,48,55,49,56,48,48,49,53,55,57,55,51,56,52,48,55,55,64,99,97,114,100,115,97,108,108,100,97,121,0,0,0,1,0,0,0,0,0,104,5,100, 0,4,99,97,108,108,100,0,6,116,95,117,116,105,108,100,0,17,97,100,100,95,108,101,118,101,108,95,100,101,116,97,105,108,115,108,0,0,0,1,1 04,32,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,48,48,48,48,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,49,0,0,0,0,0,99,50,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 101,43,48,49,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,53,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 101,43,48,49,0,0,0,0,0,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,49,0,0,0,0,0,99,48,69,45,50,48,10 1,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 101,43,48,48,0,0,0,0,0,99,50,46,53,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,49,0,0,0,0,0,99,53,46,48,48,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,49,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,53,46,48,48,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,49,0,0,0,0,0,99,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,101,43,48,50,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,55,46,53,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,101,43,48,49,0,0,0,0,0,99,49,46,53,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,48,69,45,50 ,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,101,43,48,48,0,0,0,0,0,99,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,50,46,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,53,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,101,43,48,50,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,50,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,101,43,48,50,0,0,0,0,0,99,52,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,48,69 ,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,101,43,48,48,0,0,0,0,0,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,54,46 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,52,46 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,56,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,54,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99,49,46,50,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99 ,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,56,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,50,0,0,0,0,0,99 ,49,46,54,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99 ,45,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,99,45,49,46,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,99,45,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0 ,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,48,48,48,48,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,50,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,101,43,48,51,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,53,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,101,43,48,51,0,0,0,0,0,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,48,69,45,50,48,1 01,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,101,43,48,48,0,0,0,0,0,99,50,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,52,46,48,48,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,51,46,48,48,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,54,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,101,43,48,51,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,52,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,101,43,48,51,0,0,0,0,0,99,56,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,48,69,45,5 0,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,101,43,48,48,0,0,0,0,0,99,54,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,49,46,50,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,56,46,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,51,0,0,0,0,0,99,49,46,54,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,101,43,48,52,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,101,43,48,52,0,0,0,0,0,99,50,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,48,6 9,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,53,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,51,4 6,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,50,4 6,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,52,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,4 6,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,50,46,53,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,53,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,9 9,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,9 9,54,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,9 9,45,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,99,45,49,46,48,48,48,48,48,48,48,48,48,48,4 8,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,99,45,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48, 0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,52,46,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,56,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,4 8,101,43,48,52,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,53,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,4 8,101,43,48,52,0,0,0,0,0,99,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,53,0,0,0,0,0,99,48,69,45,50,48, 101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,101,43,48,48,0,0,0,0,0,99,54,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,49,46,50,48,48, 48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,53,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,55,46,48,48,4 8,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,52,0,0,0,0,0,99,49,46,52,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,4 8,48,48,48,101,43,48,53,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48 ,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,56,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48 ,48,48,48,48,101,43,48,52,0,0,0,0,0,99,49,46,54,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,53,0,0,0,0,0,99,48, 69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,5,97,2,99,51,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48, 48,48,48,48,48,101,43,48,48,0,0,0,0,0,99,49,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,53,0,0,0,0,0,99,5 0,46,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,53,0,0,0,0,0,99,48,69,45,50,48,101,43,48,48,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,106,100,0,4,117,115,101,114>> removing the first '112' and performing a binary_to_term on the above gives :: {6,<6638.1.0>,'',rex}In a previous thread I read that getting a mutex on the calling method will solve this problem but am not ableto figure out what is causing the problem randomly??Any help will be much appreciated.Thanks,Nitin _________________________________________________________________ Video: Get a glimpse of the latest in Cricket, Bollywood, News and Fashion. Only on MSN videos. http://video.msn.com/?mkt=en-in -------------- next part -------------- An HTML attachment was scrubbed... URL: From litaocheng@REDACTED Wed Apr 16 11:48:47 2008 From: litaocheng@REDACTED (=?GB2312?B?s8nBoszO?=) Date: Wed, 16 Apr 2008 17:48:47 +0800 Subject: [erlang-questions] about tail-recursive In-Reply-To: References: Message-ID: 16 Apr 2008 11:27:48 +0200, Bjorn Gustavsson : > > "???" writes: > > > Hi everyone. > > Recently I read http://www.erlang.org/download/armstrong_thesis_2003.pdf > . > > In this paper 3.3.8, the author talk about tail-recursive: > > "Firstly the non tail-recursive way: > > factorial(0) -> 1; > > factorial(N) -> N * factorial(N-1). > > " > > I see this section is non tail-recursive. In my mind, the tail-recursive > is > > the better, because it do not consuming stack! > > > Yes, it is. > > > > When I read OTP src, I find in the stdlib lists.erl. the map/2 write in > this > > style: > > "map(F, [H|T]) -> > > [F(H)|map(F, T)]; > > map(F, []) when is_function(F, 1) -> []. > > > Correct! It is not tail-recursive. > > The tail-recursive version would not consume any stack, but it would have > to > build a list in reverse order, which it would have to reverse by calling > lists:reverse/1. > The stack space and the list consumes exactly the same amount of memory > (in R12B). > > See > > http://www.erlang.org/doc/efficiency_guide/myths.html#2.3 > > /Bjorn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Thank you very much! Bjorn! :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From olopierpa@REDACTED Wed Apr 16 12:23:57 2008 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Wed, 16 Apr 2008 12:23:57 +0200 Subject: [erlang-questions] about tail-recursive In-Reply-To: References: Message-ID: <7352e43a0804160323n6d1da3f9o6e2dd3de4d21ff7c@mail.gmail.com> On 16 Apr 2008 11:27:48 +0200, Bjorn Gustavsson wrote: > The tail-recursive version would not consume any stack, but it would have to > build a list in reverse order, which it would have to reverse by calling lists:reverse/1. > The stack space and the list consumes exactly the same amount of memory (in R12B). > > See > > http://www.erlang.org/doc/efficiency_guide/myths.html#2.3 BTW, the efficiency guide says: "It depends. On Solaris/Sparc, the body-recursive function seems to be slightly faster, even for lists with very many elements. On the x86 architecture, tail-recursion was up to about 30 percent faster." In this case I found lists:map to be slightly faster than my tail recursive map on a pentium M760 (centrino, single core, 2Ghz, slow bus) Any explanation? Cheers P. ====== Eshell V5.6.2 (abort with ^G) 33> testmap:test(1000000). {{stdlib,94000},{tailrec,172000}} 34> testmap:test(1000000). {{stdlib,203000},{tailrec,282000}} 35> testmap:test(1000000). {{stdlib,141000},{tailrec,187000}} 36> testmap:test(1000000). {{stdlib,125000},{tailrec,156000}} 37> testmap:test(1000000). {{stdlib,141000},{tailrec,156000}} Code: ==== -module(testmap). -compile(export_all). %% A tail recursive version of map trmap(Fun, List) -> trmap(Fun, List, []). trmap(_Fun, [], Acc) -> lists:reverse(Acc); trmap(Fun, [A|Z], Acc) -> trmap(Fun, Z, [Fun(A)|Acc]). test(N) -> List = lists:duplicate(N, foo), T0 = now(), _List1 = lists:map(fun(X)-> X end, List), T1 = now(), _List2 = trmap(fun(X)-> X end, List), T2 = now(), { { stdlib, timer:now_diff(T1, T0)}, { tailrec, timer:now_diff(T2, T1)} }. %% EOF From richardc@REDACTED Wed Apr 16 13:03:17 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 16 Apr 2008 13:03:17 +0200 Subject: [erlang-questions] about tail-recursive In-Reply-To: <7352e43a0804160323n6d1da3f9o6e2dd3de4d21ff7c@mail.gmail.com> References: <7352e43a0804160323n6d1da3f9o6e2dd3de4d21ff7c@mail.gmail.com> Message-ID: <4805DCF5.3020809@it.uu.se> Pierpaolo Bernardi wrote: > On 16 Apr 2008 11:27:48 +0200, Bjorn Gustavsson wrote: > >> The tail-recursive version would not consume any stack, but it would have to >> build a list in reverse order, which it would have to reverse by calling lists:reverse/1. >> The stack space and the list consumes exactly the same amount of memory (in R12B). >> >> See >> >> http://www.erlang.org/doc/efficiency_guide/myths.html#2.3 > > BTW, the efficiency guide says: > > "It depends. On Solaris/Sparc, the body-recursive function seems to be > slightly faster, even for lists with very many elements. On the x86 > architecture, tail-recursion was up to about 30 percent faster." > > In this case I found lists:map to be slightly faster than my tail recursive > map on a pentium M760 (centrino, single core, 2Ghz, slow bus) > > Any explanation? Not as such, but how you test can make a difference. The tail recursive version puts more pressure on the garbage collector, since the memory used for the temporary list cannot be reused immediately by the next call to map (which it can in the body-recursive version). So things like initial heap size affects the measurements. /Richard From kenneth.lundin@REDACTED Wed Apr 16 13:09:26 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 16 Apr 2008 13:09:26 +0200 Subject: [erlang-questions] NEWBIE: GUI tookit binaries for windows? In-Reply-To: <48046DA4.40402@kencorey.com> References: <48046DA4.40402@kencorey.com> Message-ID: Hi Ken, We are step by step refreshing the example pages since they contain very old material which might not work in the more modern versions of Erlang. The bouncinig ball example makes use of etk which is no longer part of the distribution. I have just recently removed this example because of that. When it comes to graphics in Erlang that is currently not one of our strenghts. The included graphics library is called "gs" and it is based on TCL/TK. This library is not suitable for making professional looking and behaving GUI applications and we just try to keep it working as is. We are working on a new better GUI library based on WxWidgets. You can fetch and try out the latest version of that work at http://www.erlang.org/~dgud/wxerlang /Regards Kenneth On 4/15/08, Ken Corey wrote: > Hi All, > > I'm a long-time unix user running Windows on my boxes at home, > interested in learning erlang. I'm on XP, and recently downloaded R12B. > > Erlang certainly seems a language worth a bit of study. I was looking > at the example for the bouncing ball between a linux and windows 95 > box. Very intriguing, yet I can't seem to find binaries for either etk > or erlgtk. all the links to binaries seem to have dried up. > > When I went to the erlgtk page on sourceforge, there's simply a tarball > of the source files. Building it under windows doesn't sound > particularly fun to me. > > Should I simply be playing with Erlang on a linux box via a virtual > machine where I can build whatever is needed? > > Can anyone point me at binaries of the widget libraries? > > Thanks, > > -Ken > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From chandrashekhar.mullaparthi@REDACTED Wed Apr 16 14:10:34 2008 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 16 Apr 2008 13:10:34 +0100 Subject: [erlang-questions] [Beginner]How do I find out if ibrowse:send_req/5 has timed out? In-Reply-To: <1208324886.12040.234.camel@kereru.wgtn.cat-it.co.nz> References: <1208324886.12040.234.camel@kereru.wgtn.cat-it.co.nz> Message-ID: Hi Vik, On 16/04/2008, Vik Olliver wrote: > Hello Erlangers. I'm still at the "struggling bravely" phase and peering > at code which is still somewhat over my head. > > Part of this uses ibrowse:send_req/5, which doesn't have a timeout. Or > at least none it owns up to. Will it timeout eventually, and if so how > do I tell that it did? > > If it doesn't time out, same basic question applies should I use > ibrowse:send_req/6 - how do I tell? If you don't specify a timeout, a default value of 30 seconds applies. regards, Chandru From twoggle@REDACTED Wed Apr 16 14:16:11 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Wed, 16 Apr 2008 05:16:11 -0700 (PDT) Subject: [erlang-questions] RLang In-Reply-To: <1208161702.31278.2.camel@isolde> References: <1208161702.31278.2.camel@isolde> Message-ID: <2dfce448-ca41-44be-bccf-31e09e368193@m36g2000hse.googlegroups.com> > ? ? ?2. Has/is someone already done/already doing such? ?(I did a quick > ? ? ? ? search on this on Google and hit a few projects, none of which > ? ? ? ? seemed to be as complete as, say, jinterface at first blush.) Hot off the press: http://ola-bini.blogspot.com/2008/04/connecting-languages-or-polyglot.html From twoggle@REDACTED Wed Apr 16 14:18:29 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Wed, 16 Apr 2008 05:18:29 -0700 (PDT) Subject: [erlang-questions] RLang In-Reply-To: <1208161702.31278.2.camel@isolde> References: <1208161702.31278.2.camel@isolde> Message-ID: <1d9a55f4-6363-415c-a136-2b274979c89e@b1g2000hsg.googlegroups.com> > ? ? ?2. Has/is someone already done/already doing such? ?(I did a quick > ? ? ? ? search on this on Google and hit a few projects, none of which > ? ? ? ? seemed to be as complete as, say, jinterface at first blush.) http://ola-bini.blogspot.com/2008/04/connecting-languages-or-polyglot.html From lasaro@REDACTED Wed Apr 16 14:32:52 2008 From: lasaro@REDACTED (Lasaro) Date: Wed, 16 Apr 2008 05:32:52 -0700 (PDT) Subject: [erlang-questions] abstract/static modules, multicast, and best practices In-Reply-To: References: Message-ID: <34039ab1-325f-4aa2-b30c-7cbd5549fd13@t54g2000hsg.googlegroups.com> On Apr 16, 12:01?am, "Richard A. O'Keefe" wrote: > On 16 Apr 2008, at 4:26 am, Roberto Saccon wrote: > > > on behalf of: Lasaro Camargos : > > When I saw the guarded receives of erlang, it seemed like it would be > > the perfect match since in my protocols, most actions are triggered by > > a message receipt. I though would be able to write: > > loop(State) -> > > receive > > {M} when CondA(State) andalso CondB(State) -> > > ? ? ? StateN = doStateTransition1(State) > > ? ? ? loop(StateN) > > {M} when CondA(State) andalso CondC(State) -> > > ? ? ? StateN = doStateTransition2(State) > > ? ? ? loop(StateN) > > end. > > I want to make a slightly different point. > There are a number of CSP-ish languages, including Occam and > arguably including Ada, where the guards on receive clauses > are tested *before* announcing willingness to accept a communication. > Ada 95 LRM 9.7.1 "Selective Accept", the "dynamic semantics" section > makes it clear that FIRST the guards are evaluated to determine > which alternatives are really on offer, and AFTER that a communication > may take place involving one of the open alternatives. > > The Ada syntax makes the order relatively clear: > ? ? ? ? when Guard => accept Entry; ... > The Erlang syntax makes Erlang's order relatively clear: > ? ? ? ? Pattern when Guard -> ... > > If the Guard doesn't mention any variables bound in the Pattern, > the Erlang version effectively gives you the desired result. ?But > this does _in principle_ still leave the pattern matched against > every message in the mailbox. ?I don't suppose it's likely to be > a problem. > > The reason I mention this is that not knowing TLA+, and given the > "CondX(State)" mentions on the e-message, I found that I couldn't > tell whether the original poster wanted test-before-accept or > test-after-tentative-accept. Just to clarify, in the Temporal Logic of Actions (TLA+) language, the conditions may be any logic expression and hence may also include the contents of the message being received (e.g., message is not too old). On another reply someone mentioned that I might use macros instead of the CondX functions. If fact, I tried to do that, but because I was also using macros to "instantiate" modules, there was a problem defining macros on top of other macros. I don't remember what exactly it was but, anyway, as soon as I start using abstract modules (if I really understand what they mean), then I will probably be able to replace some conditions for macros. Thanks for all the other replies, mainly the stuff about mnesia's commit. L?saro From lemenkov@REDACTED Wed Apr 16 14:44:48 2008 From: lemenkov@REDACTED (Peter Lemenkov) Date: Wed, 16 Apr 2008 16:44:48 +0400 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! In-Reply-To: <4eaa09eb0804160238w1d567e2as6d386ec352d2e1bc@mail.gmail.com> References: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> <4eaa09eb0804160238w1d567e2as6d386ec352d2e1bc@mail.gmail.com> Message-ID: 2008/4/16, wenew zhang : > thanks for your reply, > i see a example like you said on Joe 's book, > can i use gen_server as a rpc:call()'s Arg ?How can i do that? > tks Sure you can. rpc:call(Node, yourgenserver, start, [Params]). BTW don't top-post and don't forget to CC to erlang-questions :) -- With best regards! From henrique.ferreiro@REDACTED Wed Apr 16 09:06:14 2008 From: henrique.ferreiro@REDACTED (Henrique Ferreiro) Date: Wed, 16 Apr 2008 09:06:14 +0200 Subject: [erlang-questions] DHT in erlang In-Reply-To: <1218d6a50804150921i5ba5db5al3a498f43863c906@mail.gmail.com> References: <7629cacc0803111145r2dfd1002ybad89e60a813b046@mail.gmail.com> <47D8A68C.2080502@ghostgun.com> <1205508244.6404.7.camel@macbook> <1218d6a50804150921i5ba5db5al3a498f43863c906@mail.gmail.com> Message-ID: <1208329574.7486.1.camel@macbook> I'm working on it. I'll let you now when it's ready. O Mar, 15-04-2008 ?s 12:21 -0400, db escribiu: > I am also interested in erlang distributed hash table. Is there a > public link for the project available? > > On Fri, Mar 14, 2008 at 11:24 AM, Henrique Ferreiro > wrote: > I implemented the chord DHT for an end of degree project. Let > me now if > you have any questions. > > O Xov, 13-03-2008 ?s 14:59 +1100, jm escribiu: > > > Ashish Sharma wrote: > > > Hi > > > > > > Has anyone implemented some DHT (standard or custom) > distributed hash > > > table in erlang or has seen such implementation. > > > > > > > I've thought about it in passing but had to start working on > something > > else. I was looking at it from the bit torrent perspective > though. The > > intent was more trying to optimise local network traffic > than to > > actually run a tracker or bt client. Where you thinking of > something > > specific algorithm (eg chord > http://pdos.csail.mit.edu/chord/), purpose, > > etc? > > > > > > Jeff. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > rk > > That which we persist in doing becomes easier for us to do; not that > the nature of the thing itself is changed, but that our power to do is > increased. > -Ralph Waldo Emerson -- Henrique Ferreiro From ttmrichter@REDACTED Wed Apr 16 15:30:21 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Wed, 16 Apr 2008 21:30:21 +0800 Subject: [erlang-questions] RLang In-Reply-To: <2dfce448-ca41-44be-bccf-31e09e368193@m36g2000hse.googlegroups.com> References: <1208161702.31278.2.camel@isolde> <2dfce448-ca41-44be-bccf-31e09e368193@m36g2000hse.googlegroups.com> Message-ID: <1208352621.2557.8.camel@isolde> On Wed, 2008-04-16 at 05:16 -0700, Tim Fletcher wrote: > > 2. Has/is someone already done/already doing such? (I did a quick > > search on this on Google and hit a few projects, none of which > > seemed to be as complete as, say, jinterface at first blush.) > > Hot off the press: > > http://ola-bini.blogspot.com/2008/04/connecting-languages-or-polyglot.html That's very interesting, but it's for Jruby -- a Ruby implemented in Java. So really it's a paper-thin ruby wrapper around JInterface. (An idea I already experimented with because I dreaded the thought of replicating all of JInterface in Ruby. :D). Unfortunately JRuby, while a very good platform, doesn't quite replace Ruby proper. Specifically all the C-based extension gems don't work with JRuby (for obvious reasons). A native Ruby implementation is still necessary. At this point I'm toying with either putting a wrapper around erl_interface as a Ruby extension or hand-coding everything in Ruby. The former has the advantage of being the quicker to hit "market" (so to speak) but the disadvantage of not being portable to any other Ruby implementation (JRuby, Rubinius, IronRuby, etc.). The latter would be a sizable job to write, but would work on any remotely-compatible Ruby implementation. Decisions, decisions. :) -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) In his errors a man is true to type. Observe the errors and you will know the man. (???) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From saleyn@REDACTED Wed Apr 16 19:28:32 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 16 Apr 2008 13:28:32 -0400 Subject: [erlang-questions] erlang distribution on SCTP? In-Reply-To: <1208210062.6077.178.camel@pfisher-laptop> References: <1208210062.6077.178.camel@pfisher-laptop> Message-ID: <48063740.10703@gmail.com> AFAIK, replacing transport for Erlang distribution is an "all-or-nothing" option. Unfortunately it's not possible to force connection to node A using one transport and the rest of the nodes using TCP. This somewhat diminishes the value of this option. Additionally, SCTP is a pretty rich protocol for delivering out-of-band data, whereas the alternative carrier protocol in Erlang's distribution is very simple, so it might be a challenge to take advantage of some useful features of SCTP (such as one-to-many connections) without extending the internal API... Serge Paul Fisher wrote: > Has anyone attempted to recast erlang distribution to run over SCTP? It > seems that erlang distribution would benefit from many of the feature > SCTP offers over TCP (multipathing/multihoming, multiple > message-oriented streams, rich SACK, etc.) Just a personal project i'm > considering and am interested if anyone else has done work/research in > this direction. > > From waqner@REDACTED Wed Apr 16 19:15:59 2008 From: waqner@REDACTED (Alexander Wagner) Date: Wed, 16 Apr 2008 19:15:59 +0200 Subject: [erlang-questions] tab-expandable modules in the shell Message-ID: <200804161915.59585.waqner@gmx.net> Hi, I have a potentially silly Question about tab-expand in the erlang shell: Which Modules are expandable? On my fresh install of R12B-2 (self-compiled on gentoo) it seems to work only for a limited number of modules (a full list is at the end of this email). I can tab-complete functions in ets, but nothing from mnesia. My own modules are missing too (except for user_default). How can I fix this? I have found no mention of tab-expansion in the online documentation (like here: http://www.erlang.org/doc/apps/erts/tty.html ) Gesundheit Alexander Wagner PS: hitting tab in a fresh erl shell gives me this $ erl Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.2 (abort with ^G) 1> application application_controller application_master beam_lib c code code_aux code_server dict edlin edlin_expand epp erl_distribution erl_eval erl_lint erl_parse erl_prim_loader erl_scan erlang error_handler error_logger error_logger_tty_h ets file file_io_server file_server filelib filename gb_sets gb_trees gen gen_event gen_server global global_group group heart hipe_unified_loader inet inet_config inet_db inet_gethost_native inet_parse inet_udp init io io_lib io_lib_format kernel kernel_config lists net_kernel orddict ordsets os otp_ring0 packages prim_file prim_inet proc_lib proplists ram_file rpc sets shell supervisor supervisor_bridge sys user_default user_drv user_sup 1> -- John and Mary had never met. They were like two hummingbirds who had also never met. From ulf.wiger@REDACTED Wed Apr 16 20:24:38 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 16 Apr 2008 20:24:38 +0200 Subject: [erlang-questions] tab-expandable modules in the shell In-Reply-To: <200804161915.59585.waqner@gmx.net> References: <200804161915.59585.waqner@gmx.net> Message-ID: <48064466.3010709@ericsson.com> Alexander Wagner skrev: > Hi, > I have a potentially silly Question about tab-expand in the erlang shell: > Which Modules are expandable? As far as I know, all the loaded ones. In your example, you will only be able to expand the modules that are always loaded. Note also that only a core set of modules are loaded automatically. The other ones are loaded on-demand. You can, if you want to, use the flag -mode embedded to make sure that all modules in the boot script are loaded at startup: $ erl -boot start_clean Erlang (BEAM) emulator version 5.5.5.5 [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5.5 (abort with ^G) 1> application application_controller application_master beam_lib c code code_aux code_server dict edlin edlin_expand erl_distribution erl_eval erl_internal erl_lint erl_parse erl_prim_loader erl_scan erlang error_handler error_logger error_logger_tty_h ets eval_bits file file_io_server file_server filename gb_sets gb_trees gen gen_event gen_server global global_group group heart hipe_unified_loader inet inet_config inet_db inet_gethost_native inet_parse inet_udp init io io_lib io_lib_format kernel kernel_config lists net_kernel orddict ordsets os otp_internal otp_ring0 packages prim_file prim_inet proc_lib proplists ram_file rpc sets shell supervisor supervisor_bridge sys user_drv user_sup 1> BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution a $ erl -boot start_sasl Erlang (BEAM) emulator version 5.5.5.5 [async-threads:0] [hipe] [kernel-poll:false] =PROGRESS REPORT==== 16-Apr-2008::20:21:06 === ... Eshell V5.5.5.5 (abort with ^G) 1> alarm_handler application application_controller application_master beam_lib c calendar code code_aux code_server dict edlin edlin_expand erl_distribution erl_eval erl_internal erl_lint erl_parse erl_prim_loader erl_scan erlang error_handler error_logger error_logger_tty_h ets eval_bits file file_io_server file_server filename gb_sets gb_trees gen gen_event gen_server global global_group group heart hipe_unified_loader inet inet_config inet_db inet_gethost_native inet_parse inet_udp init io io_lib io_lib_format io_lib_pretty kernel kernel_config lists net_kernel orddict ordsets os otp_internal otp_ring0 overload packages prim_file prim_inet proc_lib proplists ram_file release_handler rpc sasl sasl_report sasl_report_tty_h sets shell supervisor supervisor_bridge sys user_drv user_sup 1> BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution a $ erl -boot start_sasl -mode embedded Erlang (BEAM) emulator version 5.5.5.5 [async-threads:0] [hipe] [kernel-poll:false] =PROGRESS REPORT==== 16-Apr-2008::20:23:38 === ... Eshell V5.5.5.5 (abort with ^G) 1> alarm_handler application application_controller application_master application_starter auth base64 beam_lib c calendar code code_aux code_server dets dets_server dets_sup dets_utils dets_v8 dets_v9 dict digraph digraph_utils disk_log disk_log_1 disk_log_server disk_log_sup dist_ac dist_util edlin edlin_expand epp erl_bits erl_boot_server erl_compile erl_ddll erl_distribution erl_epmd erl_eval erl_expand_records erl_internal erl_lint erl_parse erl_posix_msg erl_pp erl_prim_loader erl_reply erl_scan erl_tar erlang erlsrv error_handler error_logger error_logger_file_h error_logger_tty_h erts_debug escript ets eval_bits file file_io_server file_server file_sorter filelib filename format_lib_supp gb_sets gb_trees gen gen_event gen_fsm gen_sctp gen_server gen_tcp gen_udp global global_group global_search group heart hipe_unified_loader inet inet6_tcp inet6_tcp_dist inet6_udp inet_config inet_db inet_dns inet_gethost_native inet_hosts inet_parse inet_res inet_sctp inet_tcp inet_tcp_dist inet_udp init io io_lib io_lib_format io_lib_fread io_lib_pretty kernel kernel_config lib lists log_mf_h math misc_supp ms_transform net net_adm net_kernel orddict ordsets os otp_internal otp_ring0 overload packages pg pg2 pool prim_file prim_inet proc_lib proplists qlc qlc_pt queue ram_file random rb rb_format_supp regexp release_handler release_handler_1 rpc sasl sasl_report sasl_report_file_h sasl_report_tty_h seq_trace sets shell shell_default slave sofs string supervisor supervisor_bridge sys systools systools_lib systools_make systools_rc systools_relup timer user user_drv user_sup win32reg wrap_log_reader zip zlib 1> BR, Ulf W From matthew@REDACTED Wed Apr 16 20:50:07 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 16 Apr 2008 11:50:07 -0700 Subject: [erlang-questions] Broken ipv6 behavior? In-Reply-To: <47FD206A.7050804@gmail.com> References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> Message-ID: On Wed, Apr 9, 2008 at 1:00 PM, Mikael Magnusson wrote: > It looks beautiful on Debian Lenny/Sid GNU/Linux, which contains my IPv6 > patch: I applied the patch attached to http://www.erlang.org/pipermail/erlang-questions/2006-November/024099.html (needed to change www2 to www in the URL), but it doesn't work for me on OS X. OS X has getipnodebyname so the previous #ifdef runs first, but it returns the wrong results (e.g., not finding ipv6.google.com and returning an IPv4-mapped address instead of a native IPv6 address for www.kame.net). If I move the gethostbyname2 block first, then it works fine for me. From waqner@REDACTED Wed Apr 16 21:42:50 2008 From: waqner@REDACTED (Alexander Wagner) Date: Wed, 16 Apr 2008 21:42:50 +0200 Subject: [erlang-questions] tab-expandable modules in the shell In-Reply-To: <48064466.3010709@ericsson.com> References: <200804161915.59585.waqner@gmx.net> <48064466.3010709@ericsson.com> Message-ID: <200804162142.51042.waqner@gmx.net> > > Which Modules are expandable? > > As far as I know, all the loaded ones. That clears some things up. However, my real problem seems to be that a shell connected with -remsh ignores the modules loaded on the node it connects to (yaws is my case). 1> l(mnesia). makes mnesia expandable on a plain erl shell, but not with -remsh, where it affects the node being connected to, not the remote shell. So if I start yaws on a node named yaws@REDACTED, -remsh to it from shell@REDACTED, I can -remsh another shell to shell@REDACTED and load modules there, so they tab-expand while I'm working on yaws. Does anyone know a less silly way to affect the shell-node off the top of his head? > You can, if you want to, use the flag -mode embedded to make sure that all > modules in the boot script are loaded at startup: This should work, it definately affects the modules loaded on the -remsh node. Now I just need to read up on how to write my own boot scripts. thanks Alexander Wagner -- Who the hell wants to hear actors talk? - Harry Warner, 1927 From matthew@REDACTED Wed Apr 16 21:49:37 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 16 Apr 2008 12:49:37 -0700 Subject: [erlang-questions] tab-expandable modules in the shell In-Reply-To: <200804162142.51042.waqner@gmx.net> References: <200804161915.59585.waqner@gmx.net> <48064466.3010709@ericsson.com> <200804162142.51042.waqner@gmx.net> Message-ID: On 4/16/08, Alexander Wagner wrote: > However, my real problem seems to be that a shell connected with -remsh > ignores the modules loaded on the node it connects to (yaws is my case). I can say this has been a fair annoyance for us as well. It would be much nicer if remote shell tab completion consulted loaded modules on the remote node, rather than the local one. From exta7@REDACTED Wed Apr 16 23:27:46 2008 From: exta7@REDACTED (Zvi) Date: Wed, 16 Apr 2008 14:27:46 -0700 (PDT) Subject: [erlang-questions] tab-expandable modules in the shell In-Reply-To: References: <200804161915.59585.waqner@gmx.net> <48064466.3010709@ericsson.com> <200804162142.51042.waqner@gmx.net> Message-ID: <16733861.post@talk.nabble.com> another usefull thing for development is expanding names of atoms (since there is already atom table in memory). Zvi -- View this message in context: http://www.nabble.com/tab-expandable-modules-in-the-shell-tp16730670p16733861.html Sent from the Erlang Questions mailing list archive at Nabble.com. From vinoski@REDACTED Thu Apr 17 09:00:13 2008 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 17 Apr 2008 03:00:13 -0400 Subject: [erlang-questions] small build Message-ID: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> Seems that if you turn on OTP_SMALL_BUILD when building, you get a very minimal system, but if you leave it out, you get everything. Makes sense, but what if you want something in between? Is there a way to use OTP_SMALL_BUILD first, do a build and install, and then individually build and install any extra packages you might want on top of that? Or is it better to do a full build but tell configure to leave out the packages you don't want, assuming that's possible via --with-package=no? Leaving out Megaco and the ORB seems like it would cut out a lot of stuff that I don't need, for example. Also, how does one build from source (I'm on Linux, BTW) in such a way to ensure that C object files, libraries, and executables are not debuggable (and are maybe even stripped), erlang sources are compiled without +debug_info, etc. in order to minimize system size? I've searched and searched for answers to these questions, but have found very little. All pointers appreciated. thanks, --steve From matthias@REDACTED Thu Apr 17 09:36:14 2008 From: matthias@REDACTED (Matthias Lang) Date: Thu, 17 Apr 2008 09:36:14 +0200 Subject: [erlang-questions] small build In-Reply-To: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> References: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> Message-ID: <18438.65006.812191.165973@antilipe.corelatus.se> Steve Vinoski writes: > Also, how does one build from source (I'm on Linux, BTW) in such a way > to ensure that C object files, libraries, and executables are not > debuggable (and are maybe even stripped), erlang sources are compiled > without +debug_info, etc. in order to minimize system size? As far as I know, there is no canned way. I hack otp.mk.in to change the ERL_COMPILE_FLAGS (to cut .beam size) and run strip from outside the OTP build process (to cut executable size). Then there's the related problem of "how do I get rid of all the .beams I never use". xref is a useful tool, but ultimately the process is mostly manual. The OTP libraries aren't layered. Matt From wenewboy@REDACTED Thu Apr 17 09:38:55 2008 From: wenewboy@REDACTED (wenew zhang) Date: Thu, 17 Apr 2008 15:38:55 +0800 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! In-Reply-To: References: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> <4eaa09eb0804160238w1d567e2as6d386ec352d2e1bc@mail.gmail.com> Message-ID: <4eaa09eb0804170038j53472c41q18b07acfe4811aa1@mail.gmail.com> Yes,it's could create a process and use Pid!{Message} send message, but i use gen_server behavior so i want to use gen_server:call(Pid,{Message}) to send message, in my situation, create process successfully,but can't use gen_server:call() 1.why i get the "exception exit: {noproc," message like below? 2.when i use appmon:start() ,i neither find the pid on AuthserverNode nor SocketServerNode. (socketservernode@REDACTED)4> Pid=spawn( authservernode@REDACTED,authserver1,start,[]). <5805.82.0> Authserver start_link (socketservernode@REDACTED)5> Pid. <5805.82.0> (socketservernode@REDACTED)6> gen_server:call(Pid,{213,"root","123456"}). ** exception exit: {noproc, {gen_server,call,[<5805.82.0>,{213,"root","123456"}]}} in function gen_server:call/2 > > > thanks for your reply, > > i see a example like you said on Joe 's book, > > can i use gen_server as a rpc:call()'s Arg ?How can i do that? > > tks > > > Sure you can. > > rpc:call(Node, yourgenserver, start, [Params]). > > > BTW don't top-post and don't forget to CC to erlang-questions :) > > -- > With best regards! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Thu Apr 17 09:49:41 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 Apr 2008 09:49:41 +0200 Subject: [erlang-questions] small build In-Reply-To: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> References: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> Message-ID: "Steve Vinoski" writes: > Seems that if you turn on OTP_SMALL_BUILD when building, you get a > very minimal system, but if you leave it out, you get everything. > Makes sense, but what if you want something in between? > > Is there a way to use OTP_SMALL_BUILD first, do a build and install, > and then individually build and install any extra packages you might > want on top of that? Or is it better to do a full build but tell > configure to leave out the packages you don't want, assuming that's > possible via --with-package=no? Leaving out Megaco and the ORB seems > like it would cut out a lot of stuff that I don't need, for example. If you first do export ERL_TOP=`pwd` (from the top-level directory of the source-code tree), you can then cd to any application and run 'make' to build it. > Also, how does one build from source (I'm on Linux, BTW) in such a way > to ensure that C object files, libraries, and executables are not > debuggable (and are maybe even stripped), erlang sources are compiled > without +debug_info, etc. in order to minimize system size? You can strip out debug_info afterwards by running beam_lib:strip/1. That's what I do in Wings 3D (http://wings3d.com). The source code package for Wings 3D contains scripts and Erlang code to package the Wings 3D application and the necessary part of Erlang/OTP into as small package as possible (for Mac OS X, Linux, and Windows). Those scripts could be an useful starting point for packaging your application. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Thu Apr 17 10:03:29 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 17 Apr 2008 10:03:29 +0200 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> Message-ID: <20080417080329.GA23742@erix.ericsson.se> On Wed, Apr 16, 2008 at 11:50:07AM -0700, Matthew Dempsky wrote: > On Wed, Apr 9, 2008 at 1:00 PM, Mikael Magnusson wrote: > > It looks beautiful on Debian Lenny/Sid GNU/Linux, which contains my IPv6 > > patch: > > I applied the patch attached to > http://www.erlang.org/pipermail/erlang-questions/2006-November/024099.html > (needed to change www2 to www in the URL), but it doesn't work for me > on OS X. > That patch uses gethostbyname2, which is just as or even more obsoleted than getipnodebyname. I wonder when I (finally) have added getaddrinfo support if there is need for gethostbyname2 support too? > OS X has getipnodebyname so the previous #ifdef runs first, but it > returns the wrong results (e.g., not finding ipv6.google.com and > returning an IPv4-mapped address instead of a native IPv6 address for > www.kame.net). If I move the gethostbyname2 block first, then it > works fine for me. It is strange getipnodebyname works so differently from gethostbyname2 on OS X. They should do the same job. The flags to getipnodebyname are (AF_V4MAPPED | AI_ADDRINFO), which means that it should return mapped v4 addresses only if no IPv6 addresses are found and that it should return IPv6 addresses only if the machine runs IPv6 ("Only if IPv6 configured" according to Solaris 10 headers, "Only if there is an interface on the host that is not a loopback interface that has an IPv6 address" according to Steven's Unix Network Programming). So maybe gethostbyname2 returns IPv6 records even though your machine has no external IPv6 interface? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From matthew@REDACTED Thu Apr 17 10:18:06 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 17 Apr 2008 01:18:06 -0700 Subject: [erlang-questions] : Broken ipv6 behavior? In-Reply-To: <20080417080329.GA23742@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> <20080417080329.GA23742@erix.ericsson.se> Message-ID: On Thu, Apr 17, 2008 at 1:03 AM, Raimo Niskanen wrote: > That patch uses gethostbyname2, which is just as or even more obsoleted > than getipnodebyname. I wonder when I (finally) have added > getaddrinfo support if there is need for gethostbyname2 support too? I tested that patch because the author suggested it worked for him on Linux, and it's a relatively non-intrusive change. (I don't particularly care what functions are used for IPv6 support as long as they work.) > It is strange getipnodebyname works so differently from gethostbyname2 > on OS X. They should do the same job. Yeah. > The flags to getipnodebyname > are (AF_V4MAPPED | AI_ADDRINFO), which means that it should return > mapped v4 addresses only if no IPv6 addresses are found and > that it should return IPv6 addresses only if the machine runs > IPv6 ("Only if IPv6 configured" according to Solaris 10 headers, > "Only if there is an interface on the host that is not a loopback > interface that has an IPv6 address" according to Steven's > Unix Network Programming). On OS X, AI_DEFAULT is defined to (AI_V4MAPPED_CFG | AI_ADDRCONFIG). I tested various a few different flags options, and ipv6.google.com would only resolve when AI_V4MAPPED(_CFG) was *not* set. 0 and AI_ADDRCONFIG both returned an IPv6 hostent structure. > So maybe gethostbyname2 returns IPv6 records even though your > machine has no external IPv6 interface? No, every test I have run regarding Erlang and IPv6 in this thread has involved a machine with a globally routable IPv6 address configured. From andreas.hillqvist@REDACTED Thu Apr 17 10:44:45 2008 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Thu, 17 Apr 2008 10:44:45 +0200 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! In-Reply-To: <4eaa09eb0804170038j53472c41q18b07acfe4811aa1@mail.gmail.com> References: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> <4eaa09eb0804160238w1d567e2as6d386ec352d2e1bc@mail.gmail.com> <4eaa09eb0804170038j53472c41q18b07acfe4811aa1@mail.gmail.com> Message-ID: <8268eea30804170144y723373a5v2e502ffcb17d3527@mail.gmail.com> It sounds like the process of the PID has died. How do you start your gen_server? Kind regars Andreas Hillqvist 2008/4/17, wenew zhang : > Yes,it's could create a process and use Pid!{Message} send message, > > but i use gen_server behavior so i want to use > gen_server:call(Pid,{Message}) to send message, > > in my situation, create process successfully,but can't use gen_server:call() > > 1.why i get the "exception exit: {noproc," message like below? > 2.when i use appmon:start() ,i neither find the pid on AuthserverNode nor > SocketServerNode. > > > > (socketservernode@REDACTED)4> > Pid=spawn(authservernode@REDACTED,authserver1,start,[]). > <5805.82.0> > Authserver start_link > (socketservernode@REDACTED)5> Pid. > <5805.82.0> > (socketservernode@REDACTED)6> > gen_server:call(Pid,{213,"root","123456"}). > ** exception exit: {noproc, > > {gen_server,call,[<5805.82.0>,{213,"root","123456"}]}} > in function gen_server:call/2 > > > > > > > > > > > thanks for your reply, > > > i see a example like you said on Joe 's book, > > > can i use gen_server as a rpc:call()'s Arg ?How can i do that? > > > tks > > > > > > Sure you can. > > > > rpc:call(Node, yourgenserver, start, [Params]). > > > > > > BTW don't top-post and don't forget to CC to erlang-questions :) > > > > -- > > With best regards! > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From wenewboy@REDACTED Thu Apr 17 11:21:04 2008 From: wenewboy@REDACTED (wenew zhang) Date: Thu, 17 Apr 2008 17:21:04 +0800 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! In-Reply-To: <8268eea30804170144y723373a5v2e502ffcb17d3527@mail.gmail.com> References: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> <4eaa09eb0804160238w1d567e2as6d386ec352d2e1bc@mail.gmail.com> <4eaa09eb0804170038j53472c41q18b07acfe4811aa1@mail.gmail.com> <8268eea30804170144y723373a5v2e502ffcb17d3527@mail.gmail.com> Message-ID: <4eaa09eb0804170221o6058930eoe0c7dded78475fca@mail.gmail.com> the source code as below,on the first time start the two nodes,i get output like this: (socketservernode@REDACTED)2> spawn( authservernode@REDACTED,authserver1,start,[]). <5869.52.0> Authserver start Authserver init with [] and then i start i again, (socketservernode@REDACTED)3> Pid=spawn( authservernode@REDACTED,authserver1,start,[]). Authserver start <5869.54.0> No" Authserver init with [] " output on the Init parts, on the terminate: io:format("Terminating...~n"), can't find this output, i use rb nether find log-message on the socketservernode no authservernode Best Regards Wenew Zhang %%%%%%%%%%%%Begin%%%%%%%%%%%%%%%%%%%% -module(authserver1). -behaviour(gen_server). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -export([start_link/0,start/0]). start_link() -> io:format("Authserver start_link~n"), gen_server:start_link({global, ?MODULE}, ?MODULE, [],[]). start() -> io:format("Authserver start~n"), gen_server:start({global, ?MODULE}, ?MODULE, [],[]). init([]) -> process_flag(trap_exit, true), io:format("Authserver init with []~n"), {ok,0}. handle_call({213,Uid,Pwd},_From,State) -> io:format("PLLogin id:~w Uid:~w Pwd:~w~n",[213,Uid,Pwd]), {reply,213, State}. handle_cast(_Msg, State) -> {noreply, State}. handle_info({213,Uid,Pwd},State) -> io:format("PLLogin id:~w Uid:~w Pwd:~w~n",[213,Uid,Pwd]), {noreply, State}. terminate(_Reason, _N) -> io:format("Terminating...~n"), ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. %%%%%%%%%%The end%%%%%%%%%%%%%%%%%%% 2008/4/17, Andreas Hillqvist : > > It sounds like the process of the PID has died. > How do you start your gen_server? > > > Kind regars > Andreas Hillqvist > > 2008/4/17, wenew zhang : > > > Yes,it's could create a process and use Pid!{Message} send message, > > > > but i use gen_server behavior so i want to use > > gen_server:call(Pid,{Message}) to send message, > > > > in my situation, create process successfully,but can't use > gen_server:call() > > > > 1.why i get the "exception exit: {noproc," message like below? > > 2.when i use appmon:start() ,i neither find the pid on AuthserverNode > nor > > SocketServerNode. > > > > > > > > (socketservernode@REDACTED)4> > > Pid=spawn(authservernode@REDACTED > ,authserver1,start,[]). > > <5805.82.0> > > Authserver start_link > > (socketservernode@REDACTED)5> Pid. > > <5805.82.0> > > (socketservernode@REDACTED)6> > > gen_server:call(Pid,{213,"root","123456"}). > > ** exception exit: {noproc, > > > > {gen_server,call,[<5805.82.0>,{213,"root","123456"}]}} > > in function gen_server:call/2 > > > > > > > > > > > > > > > > > > thanks for your reply, > > > > i see a example like you said on Joe 's book, > > > > can i use gen_server as a rpc:call()'s Arg ?How can i do that? > > > > tks > > > > > > > > > Sure you can. > > > > > > rpc:call(Node, yourgenserver, start, [Params]). > > > > > > > > > BTW don't top-post and don't forget to CC to erlang-questions :) > > > > > > -- > > > With best regards! > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Thu Apr 17 11:48:33 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 17 Apr 2008 11:48:33 +0200 Subject: [erlang-questions] : : Broken ipv6 behavior? In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> <20080417080329.GA23742@erix.ericsson.se> Message-ID: <20080417094833.GC27385@erix.ericsson.se> On Thu, Apr 17, 2008 at 01:18:06AM -0700, Matthew Dempsky wrote: > On Thu, Apr 17, 2008 at 1:03 AM, Raimo Niskanen > wrote: > > That patch uses gethostbyname2, which is just as or even more obsoleted > > than getipnodebyname. I wonder when I (finally) have added > > getaddrinfo support if there is need for gethostbyname2 support too? > > I tested that patch because the author suggested it worked for him on > Linux, and it's a relatively non-intrusive change. (I don't > particularly care what functions are used for IPv6 support as long as > they work.) > I am working on getaddrinfo support. When it seems to work I will publish a source patch for OTP_R12B-2 and then start on the test cases, to get feedback for a final version. > > It is strange getipnodebyname works so differently from gethostbyname2 > > on OS X. They should do the same job. > > Yeah. > > > The flags to getipnodebyname > > are (AF_V4MAPPED | AI_ADDRINFO), which means that it should return > > mapped v4 addresses only if no IPv6 addresses are found and > > that it should return IPv6 addresses only if the machine runs > > IPv6 ("Only if IPv6 configured" according to Solaris 10 headers, > > "Only if there is an interface on the host that is not a loopback > > interface that has an IPv6 address" according to Steven's > > Unix Network Programming). > > On OS X, AI_DEFAULT is defined to (AI_V4MAPPED_CFG | AI_ADDRCONFIG). > > I tested various a few different flags options, and ipv6.google.com > would only resolve when AI_V4MAPPED(_CFG) was *not* set. 0 and > AI_ADDRCONFIG both returned an IPv6 hostent structure. > The header files on MacOS X 10.5.2 says: #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ Would that indicate that the kernel does not support mapped IPv4 addresses or what does it not support? Is this a MacOS X support question? Or just wait for the getaddrinfo patch and see if it works better. > > So maybe gethostbyname2 returns IPv6 records even though your > > machine has no external IPv6 interface? > > No, every test I have run regarding Erlang and IPv6 in this thread has > involved a machine with a globally routable IPv6 address configured. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From andreas.hillqvist@REDACTED Thu Apr 17 11:53:55 2008 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Thu, 17 Apr 2008 11:53:55 +0200 Subject: [erlang-questions] How to call a locally Pid cross node on Distributed Application! In-Reply-To: <4eaa09eb0804170221o6058930eoe0c7dded78475fca@mail.gmail.com> References: <4eaa09eb0804160132i7c6aa2d4wb2e234fe3336d7ca@mail.gmail.com> <4eaa09eb0804160238w1d567e2as6d386ec352d2e1bc@mail.gmail.com> <4eaa09eb0804170038j53472c41q18b07acfe4811aa1@mail.gmail.com> <8268eea30804170144y723373a5v2e502ffcb17d3527@mail.gmail.com> <4eaa09eb0804170221o6058930eoe0c7dded78475fca@mail.gmail.com> Message-ID: <8268eea30804170253r6782999ah8a53f5d5bdded8df@mail.gmail.com> Now you create two processes on the node. A process that starts the gen_server. You should use gen_server:start_link/4: start_link(ServerName, Module, Args, Options) and/or gen_server:start/4: start(ServerName, Module, Args, Options) Wher you can specify in ServerName which node the server should be started. If you still want to start the server on the node by spawning a process, I guess you will have to somhow return the PID (Is a PID local?) from the proess you spawned. Because the spawn/4 you use: Pid=spawn(authservernode@REDACTED,authserver1,start,[]). Returns the spawnde processs. It dose not return the PID to the gen_server it starts. Kind regards Andreas Hillqvist 2008/4/17, wenew zhang : > the source code as below,on the first time start the two nodes,i get output > like this: > (socketservernode@REDACTED)2> > spawn(authservernode@REDACTED,authserver1,start,[]). > <5869.52.0> > Authserver start > Authserver init with [] > > and then i start i again, > (socketservernode@REDACTED)3> > Pid=spawn(authservernode@REDACTED,authserver1,start,[]). > Authserver start > <5869.54.0> > > No" Authserver init with [] " output on the Init parts, > on the terminate: io:format("Terminating...~n"), > can't find this output, > i use rb nether find log-message on the socketservernode no authservernode > > Best Regards > > Wenew Zhang > %%%%%%%%%%%%Begin%%%%%%%%%%%%%%%%%%%% > > -module(authserver1). > > -behaviour(gen_server). > > %% gen_server callbacks > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, > code_change/3]). > -export([start_link/0,start/0]). > > start_link() -> > io:format("Authserver start_link~n"), > gen_server:start_link({global, ?MODULE}, ?MODULE, [],[]). > > start() -> > io:format("Authserver start~n"), > gen_server:start({global, ?MODULE}, ?MODULE, [],[]). > > init([]) -> > process_flag(trap_exit, true), > io:format("Authserver init with []~n"), > {ok,0}. > > > > handle_call({213,Uid,Pwd},_From,State) -> > io:format("PLLogin id:~w Uid:~w Pwd:~w~n",[213,Uid,Pwd]), > {reply,213, State}. > > handle_cast(_Msg, State) -> > {noreply, State}. > > handle_info({213,Uid,Pwd},State) -> > io:format("PLLogin id:~w Uid:~w Pwd:~w~n",[213,Uid,Pwd]), > {noreply, State}. > > terminate(_Reason, _N) -> > io:format("Terminating...~n"), > ok. > > > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > %%%%%%%%%%The end%%%%%%%%%%%%%%%%%%% > > > > 2008/4/17, Andreas Hillqvist : > > It sounds like the process of the PID has died. > > How do you start your gen_server? > > > > > > Kind regars > > Andreas Hillqvist > > > > 2008/4/17, wenew zhang : > > > > > Yes,it's could create a process and use Pid!{Message} send message, > > > > > > but i use gen_server behavior so i want to use > > > gen_server:call(Pid,{Message}) to send message, > > > > > > in my situation, create process successfully,but can't use > gen_server:call() > > > > > > 1.why i get the "exception exit: {noproc," message like below? > > > 2.when i use appmon:start() ,i neither find the pid on AuthserverNode > nor > > > SocketServerNode. > > > > > > > > > > > > (socketservernode@REDACTED)4> > > > > Pid=spawn(authservernode@REDACTED,authserver1,start,[]). > > > <5805.82.0> > > > Authserver start_link > > > (socketservernode@REDACTED)5> Pid. > > > <5805.82.0> > > > (socketservernode@REDACTED)6> > > > gen_server:call(Pid,{213,"root","123456"}). > > > ** exception exit: {noproc, > > > > > > {gen_server,call,[<5805.82.0>,{213,"root","123456"}]}} > > > in function gen_server:call/2 > > > > > > > > > > > > > > > > > > > > > > > > > thanks for your reply, > > > > > i see a example like you said on Joe 's book, > > > > > can i use gen_server as a rpc:call()'s Arg ?How can i do that? > > > > > tks > > > > > > > > > > > > Sure you can. > > > > > > > > rpc:call(Node, yourgenserver, start, [Params]). > > > > > > > > > > > > BTW don't top-post and don't forget to CC to erlang-questions :) > > > > > > > > -- > > > > With best regards! > > > > > > > > > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > From wenewboy@REDACTED Thu Apr 17 12:39:30 2008 From: wenewboy@REDACTED (wenew zhang) Date: Thu, 17 Apr 2008 18:39:30 +0800 Subject: [erlang-questions] erlang-questions Digest, Vol 11, Issue 52 In-Reply-To: References: Message-ID: <4eaa09eb0804170339k3199262q56fe466cbc4264c6@mail.gmail.com> >>Wher you can specify in ServerName which node the server should be started. gen_server:start/start_link(ServerName,..) only have two options: {local,Name}| {global,GlobalName}, in my project, i want communicate between two process cross nodes without use global option, if can't do that,i think i must use a global mid- transfer the message like this:pid1---->global Server->pid2 Pid2---->global server ->Pid1 but i think pid1->Pid2 more faster than above! any suggestion is very appreciate Best Regards wenew Zhang 2008/4/17, erlang-questions-request@REDACTED < erlang-questions-request@REDACTED>: > > Send erlang-questions mailing list submissions to > erlang-questions@REDACTED > > To subscribe or unsubscribe via the World Wide Web, visit > http://www.erlang.org/mailman/listinfo/erlang-questions > or, via email, send a message with subject or body 'help' to > erlang-questions-request@REDACTED > > You can reach the person managing the list at > erlang-questions-owner@REDACTED > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of erlang-questions digest..." > > > Today's Topics: > > 1. Re: : : Broken ipv6 behavior? (Raimo Niskanen) > 2. Re: How to call a locally Pid cross node on Distributed > Application! (Andreas Hillqvist) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 17 Apr 2008 11:48:33 +0200 > From: Raimo Niskanen > > > Subject: Re: [erlang-questions] : : Broken ipv6 behavior? > To: Matthew Dempsky , erlang-questions@REDACTED > Message-ID: <20080417094833.GC27385@REDACTED> > Content-Type: text/plain; charset=us-ascii > > On Thu, Apr 17, 2008 at 01:18:06AM -0700, Matthew Dempsky wrote: > > On Thu, Apr 17, 2008 at 1:03 AM, Raimo Niskanen > > > > wrote: > > > That patch uses gethostbyname2, which is just as or even more > obsoleted > > > than getipnodebyname. I wonder when I (finally) have added > > > getaddrinfo support if there is need for gethostbyname2 support too? > > > > I tested that patch because the author suggested it worked for him on > > Linux, and it's a relatively non-intrusive change. (I don't > > particularly care what functions are used for IPv6 support as long as > > they work.) > > > > I am working on getaddrinfo support. When it seems to work I will publish > a source patch for OTP_R12B-2 and then start on the test cases, > to get feedback for a final version. > > > > It is strange getipnodebyname works so differently from > gethostbyname2 > > > on OS X. They should do the same job. > > > > Yeah. > > > > > The flags to getipnodebyname > > > are (AF_V4MAPPED | AI_ADDRINFO), which means that it should return > > > mapped v4 addresses only if no IPv6 addresses are found and > > > that it should return IPv6 addresses only if the machine runs > > > IPv6 ("Only if IPv6 configured" according to Solaris 10 headers, > > > "Only if there is an interface on the host that is not a loopback > > > interface that has an IPv6 address" according to Steven's > > > Unix Network Programming). > > > > On OS X, AI_DEFAULT is defined to (AI_V4MAPPED_CFG | AI_ADDRCONFIG). > > > > I tested various a few different flags options, and ipv6.google.com > > would only resolve when AI_V4MAPPED(_CFG) was *not* set. 0 and > > AI_ADDRCONFIG both returned an IPv6 hostent structure. > > > > The header files on MacOS X 10.5.2 says: > #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel > supports */ > > Would that indicate that the kernel does not support > mapped IPv4 addresses or what does it not support? > > Is this a MacOS X support question? > > Or just wait for the getaddrinfo patch and see if it works better. > > > > So maybe gethostbyname2 returns IPv6 records even though your > > > machine has no external IPv6 interface? > > > > No, every test I have run regarding Erlang and IPv6 in this thread has > > involved a machine with a globally routable IPv6 address configured. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > ------------------------------ > > Message: 2 > Date: Thu, 17 Apr 2008 11:53:55 +0200 > From: "Andreas Hillqvist" > Subject: Re: [erlang-questions] How to call a locally Pid cross node > on Distributed Application! > To: "wenew zhang" > Cc: erlang-questions@REDACTED > Message-ID: > <8268eea30804170253r6782999ah8a53f5d5bdded8df@REDACTED> > Content-Type: text/plain; charset=ISO-8859-1 > > Now you create two processes on the node. A process that starts the > gen_server. > > You should use gen_server:start_link/4: > start_link(ServerName, Module, Args, Options) > and/or gen_server:start/4: > start(ServerName, Module, Args, Options) > Wher you can specify in ServerName which node the server should be > started. > > If you still want to start the server on the node by spawning a > process, I guess you will have to somhow return the PID (Is a PID > local?) from the proess you spawned. > > Because the spawn/4 you use: > Pid=spawn(authservernode@REDACTED > ,authserver1,start,[]). > Returns the spawnde processs. It dose not return the PID to the > gen_server it starts. > > > Kind regards > Andreas Hillqvist > > 2008/4/17, wenew zhang : > > the source code as below,on the first time start the two nodes,i get > output > > like this: > > (socketservernode@REDACTED)2> > > spawn(authservernode@REDACTED,authserver1,start,[]). > > <5869.52.0> > > Authserver start > > Authserver init with [] > > > > and then i start i again, > > (socketservernode@REDACTED)3> > > Pid=spawn(authservernode@REDACTED > ,authserver1,start,[]). > > Authserver start > > <5869.54.0> > > > > No" Authserver init with [] " output on the Init parts, > > on the terminate: io:format("Terminating...~n"), > > can't find this output, > > i use rb nether find log-message on the socketservernode no > authservernode > > > > Best Regards > > > > Wenew Zhang > > %%%%%%%%%%%%Begin%%%%%%%%%%%%%%%%%%%% > > > > -module(authserver1). > > > > -behaviour(gen_server). > > > > %% gen_server callbacks > > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > terminate/2, > > code_change/3]). > > -export([start_link/0,start/0]). > > > > start_link() -> > > io:format("Authserver start_link~n"), > > gen_server:start_link({global, ?MODULE}, ?MODULE, [],[]). > > > > start() -> > > io:format("Authserver start~n"), > > gen_server:start({global, ?MODULE}, ?MODULE, [],[]). > > > > init([]) -> > > process_flag(trap_exit, true), > > io:format("Authserver init with []~n"), > > {ok,0}. > > > > > > > > handle_call({213,Uid,Pwd},_From,State) -> > > io:format("PLLogin id:~w Uid:~w Pwd:~w~n",[213,Uid,Pwd]), > > {reply,213, State}. > > > > handle_cast(_Msg, State) -> > > {noreply, State}. > > > > handle_info({213,Uid,Pwd},State) -> > > io:format("PLLogin id:~w Uid:~w Pwd:~w~n",[213,Uid,Pwd]), > > {noreply, State}. > > > > terminate(_Reason, _N) -> > > io:format("Terminating...~n"), > > ok. > > > > > > code_change(_OldVsn, State, _Extra) -> > > {ok, State}. > > %%%%%%%%%%The end%%%%%%%%%%%%%%%%%%% > > > > > > > > 2008/4/17, Andreas Hillqvist : > > > It sounds like the process of the PID has died. > > > How do you start your gen_server? > > > > > > > > > Kind regars > > > Andreas Hillqvist > > > > > > 2008/4/17, wenew zhang : > > > > > > > Yes,it's could create a process and use Pid!{Message} send message, > > > > > > > > but i use gen_server behavior so i want to use > > > > gen_server:call(Pid,{Message}) to send message, > > > > > > > > in my situation, create process successfully,but can't use > > gen_server:call() > > > > > > > > 1.why i get the "exception exit: {noproc," message like below? > > > > 2.when i use appmon:start() ,i neither find the pid on > AuthserverNode > > nor > > > > SocketServerNode. > > > > > > > > > > > > > > > > (socketservernode@REDACTED)4> > > > > > > Pid=spawn(authservernode@REDACTED > ,authserver1,start,[]). > > > > <5805.82.0> > > > > Authserver start_link > > > > (socketservernode@REDACTED)5> Pid. > > > > <5805.82.0> > > > > (socketservernode@REDACTED)6> > > > > gen_server:call(Pid,{213,"root","123456"}). > > > > ** exception exit: {noproc, > > > > > > > > {gen_server,call,[<5805.82.0>,{213,"root","123456"}]}} > > > > in function gen_server:call/2 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > thanks for your reply, > > > > > > i see a example like you said on Joe 's book, > > > > > > can i use gen_server as a rpc:call()'s Arg ?How can i do that? > > > > > > tks > > > > > > > > > > > > > > > Sure you can. > > > > > > > > > > rpc:call(Node, yourgenserver, start, [Params]). > > > > > > > > > > > > > > > BTW don't top-post and don't forget to CC to erlang-questions :) > > > > > > > > > > -- > > > > > With best regards! > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > erlang-questions mailing list > > > > erlang-questions@REDACTED > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > > ------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > End of erlang-questions Digest, Vol 11, Issue 52 > ************************************************ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lenartlad@REDACTED Thu Apr 17 15:46:34 2008 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 17 Apr 2008 15:46:34 +0200 Subject: [erlang-questions] [Q] erlang:check_process_code/2 Message-ID: <480754BA.3010708@volny.cz> Hello, I think I run into trouble with code purge/delete machinery. To solve this puzzle, I need to understand how erlang:check_process_code/2 works. Could anyone please tell me under which circumstances this function returns true? I know that it is "when a process is executing old code" but what does that really mean (for example, what if the process references a Fun from that module,...)? Thanks, Ladislav Lenart From vladdu55@REDACTED Thu Apr 17 16:03:50 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 17 Apr 2008 16:03:50 +0200 Subject: [erlang-questions] erlang-questions Digest, Vol 11, Issue 52 In-Reply-To: <4eaa09eb0804170339k3199262q56fe466cbc4264c6@mail.gmail.com> References: <4eaa09eb0804170339k3199262q56fe466cbc4264c6@mail.gmail.com> Message-ID: <95be1d3b0804170703m36bf1665q874f0d77a25e042c@mail.gmail.com> Hi, 2008/4/17 wenew zhang : > >>Wher you can specify in ServerName which node the server should be > started. > gen_server:start/start_link(ServerName,..) only have two options: > {local,Name}| {global,GlobalName}, > > in my project, > i want communicate between two process cross nodes without use global > option, > if can't do that,i think i must use a global mid- transfer the message > like this:pid1---->global Server->pid2 > Pid2---->global server ->Pid1 > but i think pid1->Pid2 more faster than above! You need *some* kind of global server in any case, so that you can tell process #1 about pid2 and process #2 about pid1. The good news is that rpc:call uses the global 'rex' process and works nicely for this purpose. So you have process#1 on node#1 with pid1 and process#2 on node#2 with pid2. Write and load on node#1 a module with a function like set_pid(Pid) -> Pid1 = get_process1_pid(), %% implement this to get the right value Pid1 ! {peer, Pid}, Pid1. >From node#2 call from process#2 Pid1 = rpc:call('node#1', mymodule, set_pid, [Pid2]). Process#1 should wait for a {peer, Pid} message before attempting to talk to process#2. This way, the processes get the other process' pid and can use it directly. The method can be extended to several peers. I hope this helps. best regards, Vlad From bjorn@REDACTED Thu Apr 17 16:50:08 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 Apr 2008 16:50:08 +0200 Subject: [erlang-questions] [Q] erlang:check_process_code/2 In-Reply-To: <480754BA.3010708@volny.cz> References: <480754BA.3010708@volny.cz> Message-ID: Ladislav Lenart writes: > Hello, > > I think I run into trouble with code purge/delete machinery. To solve > this puzzle, I need to understand how erlang:check_process_code/2 > works. Could anyone please tell me under which circumstances this > function returns true? I know that it is "when a process is executing > old code" but what does that really mean (for example, what if the > process references a Fun from that module,...)? Yes, if a fun references old code, erlang:check_process_code/2 will return true. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From golubovsky@REDACTED Thu Apr 17 17:16:09 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Thu, 17 Apr 2008 11:16:09 -0400 Subject: [erlang-questions] Erlang Core question: nested expressions vs. let? Message-ID: Hi, Would be there any difference in compilation/execution of bytecode of these two Erlang Core expressions: 1. foo(bar(_a)) 2. let _b = bar(_a) in foo(_b) In other words, does putting nested expressions in `let' make any difference for the compiler? Assume that both `foo' and `bar' functions do not have side effects. Thanks. PS The nested form compiles fine by erlc, however when I look at what erlc produces when run with +to_core on an Erlang source, there are only `let' forms in the generated Core. My Core files are either hand-written or auto-generated. -- Dimitry Golubovsky Anywhere on the Web From kenneth.lundin@REDACTED Thu Apr 17 17:28:01 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 17 Apr 2008 17:28:01 +0200 Subject: [erlang-questions] small build In-Reply-To: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> References: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> Message-ID: What you get when you fetch, build and install the Erlang/OTP distribution from www.erlang.org is a development system for Erlang. With this you can develop your own SW product and bundle this in a way that suit you. When doing so you just select the runtime system and the components from OTP you need together with your own code and package it, possibly making an installer to be used by the user. In the packaging step there is no need to build any of the OTP components or the Erlang runtime system it is just a matter of copying the needed parts and possibly strip the executables and the .beam files if you want to minimize the package. Note that I am assuming that the development system and the target system runs on the same CPU architecture and OS. The principle of how to do this can be read here:http://www.erlang.org/doc/system_principles/part_frame.html (chapter 3, Creating a first target system) (we have in our plans to make better support for this (i.e provide SW that does this based on your input). Picking the necessary OTP applications is quite easy if you pick full applications since they are layered like this (with a few exceptions) ERTS (stdlib,kernel) (compiler,mnesia, orber, ssh, inets, ssl, asn1, snmp, megaco, ....) I.e. 3 layers. If you try to minimize by excluding modules from the applications it will be trickier but you will have good help from xref (in tools) /Kenneth Erlang/OTP team , Ericsson On 4/17/08, Steve Vinoski wrote: > Seems that if you turn on OTP_SMALL_BUILD when building, you get a > very minimal system, but if you leave it out, you get everything. > Makes sense, but what if you want something in between? > > Is there a way to use OTP_SMALL_BUILD first, do a build and install, > and then individually build and install any extra packages you might > want on top of that? Or is it better to do a full build but tell > configure to leave out the packages you don't want, assuming that's > possible via --with-package=no? Leaving out Megaco and the ORB seems > like it would cut out a lot of stuff that I don't need, for example. > > Also, how does one build from source (I'm on Linux, BTW) in such a way > to ensure that C object files, libraries, and executables are not > debuggable (and are maybe even stripped), erlang sources are compiled > without +debug_info, etc. in order to minimize system size? > > I've searched and searched for answers to these questions, but have > found very little. All pointers appreciated. > > thanks, > --steve > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rvirding@REDACTED Thu Apr 17 17:56:32 2008 From: rvirding@REDACTED (Robert Virding) Date: Thu, 17 Apr 2008 17:56:32 +0200 Subject: [erlang-questions] Erlang Core question: nested expressions vs. let? In-Reply-To: References: Message-ID: <3dbc6d1c0804170856t4c7b8e37l33e7150ef4a095b2@mail.gmail.com> On 17/04/2008, Dimitry Golubovsky wrote: > > Hi, > > Would be there any difference in compilation/execution of bytecode of > these two Erlang Core expressions: > > 1. foo(bar(_a)) > > 2. let _b = bar(_a) in foo(_b) > > In other words, does putting nested expressions in `let' make any > difference for the compiler? > > Assume that both `foo' and `bar' functions do not have side effects. One reason (the main reason :-)) the compiler does this is to make explicit the evaluation order of called functions. Erlang is defined to evaluate in a left-to-right order while in Core, if I remember correctly, the order is undefined; therefore the need of explicit ordering. Note that Core has no problems in compiling the nested forms, as you have noticed. For LFE I don't bother to un-nest it, although I probably should. You should at the resultant code when you deep nesting interlaced with list/tuple creation, the result is quite good. Robert Thanks. > > PS The nested form compiles fine by erlc, however when I look at what > erlc produces when run with +to_core on an Erlang source, there are > only `let' forms in the generated Core. My Core files are either > hand-written or auto-generated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Thu Apr 17 17:59:05 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 17 Apr 2008 17:59:05 +0200 Subject: [erlang-questions] Erlang Core question: nested expressions vs. let? In-Reply-To: References: Message-ID: <480773C9.5070703@it.uu.se> Dimitry Golubovsky wrote: > Would be there any difference in compilation/execution of bytecode of > these two Erlang Core expressions: > > 1. foo(bar(_a)) > > 2. let _b = bar(_a) in foo(_b) > > In other words, does putting nested expressions in `let' make any > difference for the compiler? No, the resulting BEAM code or native code will be the same. Variables are just temporary names and have no fixed correspondence with storage cells in memory. The compiler splits them into separate let-expressions for various reasons, but that has no effect on performance. > Assume that both `foo' and `bar' functions do not have side effects. That makes no difference in this case. /Richard From stondage123@REDACTED Thu Apr 17 17:24:21 2008 From: stondage123@REDACTED (Andrew Stone) Date: Thu, 17 Apr 2008 08:24:21 -0700 (PDT) Subject: [erlang-questions] net_kernel: start() Message-ID: <544534.36663.qm@web35906.mail.mud.yahoo.com> Hi, Is there any reason that I cannot reliably run net_kernel:start(['somelongname@REDACTED']) from within my code. It works fine from the erl shell, but not from compiled source. Yet sometimes it does work from compiled code. It's really strange. I posted my code below. net_kernel:start(['c1@REDACTED']). Thanks, Andrew From vinoski@REDACTED Thu Apr 17 19:32:54 2008 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 17 Apr 2008 13:32:54 -0400 Subject: [erlang-questions] small build In-Reply-To: References: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> Message-ID: <65b2728e0804171032w7d5d89a0kd3679ebb8be6fb9b@mail.gmail.com> On 4/17/08, Kenneth Lundin wrote: > What you get when you fetch, build and install the Erlang/OTP > distribution from www.erlang.org is a development system for Erlang. Thanks Kenneth, this is great info, and thanks also to Matthias and Bjorn for their very useful responses as well. One other question: where can I learn more about cross-compilation? Not sure if this qualifies as "real" cross-compilation, but I'm trying to get a 64-bit x86_64 Redhat Linux box to build for a 32-bit i686 Linux system, and either I'm doing something wrong or it's not easy. After much trial and error I've ended up running configure like this (using the bash shell): $ CC='gcc -m32' LD='gcc -m32' ./configure [other options] --build=i686-redhat-linux-gnu and then running make like this: $ TARGET=i686-redhat-linux-gnu make which kind of sort of seems to work -- this didn't seem to work with R11B-5, specifically for hipe, but it does appear to work with R12B-2. But this seems awfully obscure to be the right way of doing this. I've searched quite a bit but have come up empty. Is there a better way, and if so, what is it? All pointers to docs, prior emails, etc. appreciated. thanks, --steve From stondage123@REDACTED Thu Apr 17 18:59:23 2008 From: stondage123@REDACTED (Andrew Stone) Date: Thu, 17 Apr 2008 09:59:23 -0700 (PDT) Subject: [erlang-questions] net_kernel: start() Message-ID: <466483.91776.qm@web35905.mail.mud.yahoo.com> I found the problem. Epmd is started automatically from the shell when this command is issued but not from a compiled module. Starting epmd before running my code fixes the issue. -Andrew ----- Original Message ---- From: Andrew Stone To: erlang questions Sent: Thursday, April 17, 2008 11:24:21 AM Subject: [erlang-questions] net_kernel: start() Hi, Is there any reason that I cannot reliably run net_kernel:start(['somelongname@REDACTED']) from within my code. It works fine from the erl shell, but not from compiled source. Yet sometimes it does work from compiled code. It's really strange. I posted my code below. net_kernel:start(['c1@REDACTED']). Thanks, Andrew _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From sten@REDACTED Thu Apr 17 20:55:58 2008 From: sten@REDACTED (Sten Kvamme) Date: Thu, 17 Apr 2008 20:55:58 +0200 Subject: [erlang-questions] ex11 example for read_jpeg wanted Message-ID: <9A1BF3AC-4B28-45FD-AB7C-77D2FC7E219A@kvamme.se> Hello, Where can I find some example code on how to use ex11_lib_read_jpeg? Running ex11_lib_read_jpeg:test() gives me a {ok,{74,90,[<<"\374 \373..... I suppose this is width, height, and an array of binary image rows. ePutImage(Draw, GC, Width, Ht, X, Y, Pad, Depth, Data) could be used but it would be nice to have an example, so if someone have an example deep down in the harddrive backyard? I can understand if you guys thinks ex11 sucks, and don't want to deal with it anymore, but where I use it it shines. /Sten Kvamme From matthias@REDACTED Thu Apr 17 20:08:13 2008 From: matthias@REDACTED (Matthias Lang) Date: Thu, 17 Apr 2008 20:08:13 +0200 Subject: [erlang-questions] small build In-Reply-To: <65b2728e0804171032w7d5d89a0kd3679ebb8be6fb9b@mail.gmail.com> References: <65b2728e0804170000o74f17d91m319763504cdc310d@mail.gmail.com> <65b2728e0804171032w7d5d89a0kd3679ebb8be6fb9b@mail.gmail.com> Message-ID: <18439.37389.553716.225963@antilipe.corelatus.se> Steve Vinoski writes: > One other question: where can I learn more about cross-compilation? Cross-compiling in general: I vaguely recall reading a GNU guide to cross compiling, but I can't find it now. Maybe it's part of the autotools manual. I also recall feeling more confused after reading it than before. Cross-compiling Erlang specifically: http://www.trapexit.org/Cross_compiling I haven't updated that note for R12B. It wouldn't surprise me if there were some new hurdles. > Not sure if this qualifies as "real" cross-compilation, but I'm trying > to get a 64-bit x86_64 Redhat Linux box to build for a 32-bit i686 > Linux system, and either I'm doing something wrong or it's not easy. > After much trial and error I've ended up running configure like this > (using the bash shell): > > $ CC='gcc -m32' LD='gcc -m32' ./configure [other options] > --build=i686-redhat-linux-gnu > > and then running make like this: > > $ TARGET=i686-redhat-linux-gnu make > > which kind of sort of seems to work -- this didn't seem to work with > R11B-5, specifically for hipe, but it does appear to work with R12B-2. That all looks right. I haven't tried to get HIPE to work for my target, it'd be pointless anyway since HIPE has no MIPS backend. Besides, our code is fast enough. (More generally, I'd just take the path of least resistance and find a 32-bit machine to compile on. But you probably have reasons. Comparing the config.h files to the ones made on a 32-bit system would be prudent.) Matt From fritchie@REDACTED Fri Apr 18 00:26:43 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 17 Apr 2008 17:26:43 -0500 Subject: [erlang-questions] RLang In-Reply-To: Message of "Mon, 14 Apr 2008 16:28:22 +0800." <1208161702.31278.2.camel@isolde> Message-ID: <35098.1208471203@snookles.snookles.com> Michael T. Richter wrote: mtr> I've been toying (to the point of researching) with the idea of mtr> making a Ruby<->Erlang binding along the lines of erl_interface or mtr> jinterface. This may or may not be helpful ... last month I gave a short presentation on a couple of different Erlang <-> Ruby packages, rbridge and erlectricity. The bits can be found at: http://www.snookles.com/erlang/ruby.mn-Mar2008/RUMPresentationMarch2008.html The most interesting part for the Ruby crowd was at the end, using a Ruby gem called "fuzed" that allows Yaws to be the HTTP server front-end for a Rails application (rather than Mongrel or Apache + FastCGI). -Scott From vik@REDACTED Fri Apr 18 04:13:59 2008 From: vik@REDACTED (Vik Olliver) Date: Fri, 18 Apr 2008 14:13:59 +1200 Subject: [erlang-questions] Underscore prefixes Message-ID: <1208484839.12040.371.camel@kereru.wgtn.cat-it.co.nz> Underscores before a variable indicate it's basically optional, right? So why would someone do: _Result = module:function(X), {response, ok}. in their code? Vik :v) From matthew@REDACTED Fri Apr 18 04:38:54 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 17 Apr 2008 19:38:54 -0700 Subject: [erlang-questions] Underscore prefixes In-Reply-To: <1208484839.12040.371.camel@kereru.wgtn.cat-it.co.nz> References: <1208484839.12040.371.camel@kereru.wgtn.cat-it.co.nz> Message-ID: On Thu, Apr 17, 2008 at 7:13 PM, Vik Olliver wrote: > Underscores before a variable indicate it's basically optional, right? It simply tells the compiler not to issue a warning if the variable is not otherwise used. > So why would someone do: > > _Result = module:function(X), > {response, ok}. > > in their code? Style maybe. When matching elements of a tuple, I'll often still write "_Foo" and "_Bar" (but actually meaningful names) even if I don't need those elements in case I later need to change the code and it saves me a little bit of time looking up what the other elements are again. This particular case though, it's kinda silly. Obviously the return value of a function is its result. :-) From masterofquestions@REDACTED Fri Apr 18 06:21:52 2008 From: masterofquestions@REDACTED (db) Date: Fri, 18 Apr 2008 00:21:52 -0400 Subject: [erlang-questions] noob gen_leader question In-Reply-To: <4802659A.6010601@ericsson.com> References: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> <47FA881B.2060304@ericsson.com> <1218d6a50804130601g1602a316o2f2f34205677cb50@mail.gmail.com> <4802659A.6010601@ericsson.com> Message-ID: <1218d6a50804172121n45fcba33qb2e0c66693342035@mail.gmail.com> My erlang nodes are setup to connect to each other automatically. Patched version of gen_leader states that it was modified to start only on local mode and user has to trigger the election mode. This means each instance of gen_leader is myopic and is contained within a single node that it is running on. How does a user trigger the election mode so that all other the instances of gen_leader know the existence of each other? It starts off with global mode: elected([], {election,<0.64.0>,global,aname,a@REDACTED, Then it goes into local mode: initial call: gen:init_it(gen_leader,<0.62.0>,self, {local,aname}, On Sun, Apr 13, 2008 at 3:57 PM, Ulf Wiger (TN/EAB) wrote: > db skrev: > > > > Does worker instance of gen_leader spawn separate processes to perform a task concurrently like in pool module? > > > > Not by default, no. If you want to spawn processes, you > can of course do that in the callbacks. > > BR, > Ulf W > -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From dgud@REDACTED Fri Apr 18 08:31:32 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 18 Apr 2008 08:31:32 +0200 Subject: [erlang-questions] Underscore prefixes In-Reply-To: References: <1208484839.12040.371.camel@kereru.wgtn.cat-it.co.nz> Message-ID: <48084044.9070501@erix.ericsson.se> My guess is debugging: _Result = module:function(X), io:format("DBG: ~p ~n", [_Result]), {response, ok}. Than you can delete the debug io:format. Matthew Dempsky wrote: > On Thu, Apr 17, 2008 at 7:13 PM, Vik Olliver wrote: >> Underscores before a variable indicate it's basically optional, right? > > It simply tells the compiler not to issue a warning if the variable is > not otherwise used. > >> So why would someone do: >> >> _Result = module:function(X), >> {response, ok}. >> >> in their code? > > Style maybe. When matching elements of a tuple, I'll often still > write "_Foo" and "_Bar" (but actually meaningful names) even if I > don't need those elements in case I later need to change the code and > it saves me a little bit of time looking up what the other elements > are again. > > This particular case though, it's kinda silly. Obviously the return > value of a function is its result. :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf@REDACTED Fri Apr 18 08:52:27 2008 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 18 Apr 2008 08:52:27 +0200 Subject: [erlang-questions] noob gen_leader question In-Reply-To: <1218d6a50804172121n45fcba33qb2e0c66693342035@mail.gmail.com> References: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> <47FA881B.2060304@ericsson.com> <1218d6a50804130601g1602a316o2f2f34205677cb50@mail.gmail.com> <4802659A.6010601@ericsson.com> <1218d6a50804172121n45fcba33qb2e0c66693342035@mail.gmail.com> Message-ID: <8209f740804172352m3ac4acffy12f712b85a721b69@mail.gmail.com> The local-only mode was a way to allow the process to start before the distribution was activated. In gproc, I allowed only local registrations until a leader was elected, and I provided no function for going back to local mode, once activated. BR, Ulf W 2008/4/18, db : > My erlang nodes are setup to connect to each other automatically. > Patched version of gen_leader states that it was modified to start > only on local mode and user has to trigger the election mode. This > means each instance of gen_leader is myopic and is contained within a > single node that it is running on. How does a user trigger the > election mode so that all other the instances of gen_leader know the > existence of each other? > > It starts off with global mode: > elected([], {election,<0.64.0>,global,aname,a@REDACTED, > > Then it goes into local mode: > initial call: gen:init_it(gen_leader,<0.62.0>,self, > {local,aname}, > > On Sun, Apr 13, 2008 at 3:57 PM, Ulf Wiger (TN/EAB) > wrote: > > db skrev: > > > > > > > Does worker instance of gen_leader spawn separate processes to perform a > task concurrently like in pool module? > > > > > > > Not by default, no. If you want to spawn processes, you > > can of course do that in the callbacks. > > > > BR, > > Ulf W > > > > > > -- > rk > > That which we persist in doing becomes easier for us to do; not that > the nature of the thing itself is changed, but that our power to do is > increased. > -Ralph Waldo Emerson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From lenartlad@REDACTED Fri Apr 18 10:16:28 2008 From: lenartlad@REDACTED (Ladislav Lenart) Date: Fri, 18 Apr 2008 10:16:28 +0200 Subject: [erlang-questions] [Q] erlang:check_process_code/2 In-Reply-To: References: <480754BA.3010708@volny.cz> Message-ID: <480858DC.1040601@volny.cz> Bjorn Gustavsson wrote: > Ladislav Lenart writes: > >> Hello, >> >> I think I run into trouble with code purge/delete machinery. To solve >> this puzzle, I need to understand how erlang:check_process_code/2 >> works. Could anyone please tell me under which circumstances this >> function returns true? I know that it is "when a process is executing >> old code" but what does that really mean (for example, what if the >> process references a Fun from that module,...)? > > Yes, if a fun references old code, erlang:check_process_code/2 will > return true. Thanks. I understand it this way: If a process holds in its internal state a reference to a fun that itself references old code, check_process_code/2 will return true for it. The process does not have to be evaluating the fun. To confirm this, I implemented a trivial process that can store a Fun sent to it and did the following "test": 1. P = fun_proc:start(), 2. P ! {'fun', SomeFun}, 3. code:purge(SomeMod), 4. code:delete(SomeMod), % make current version of SomeMod old 5. false = erlang:check_process_code(P, SomeMod). I tried the above for `SomeFun = fun SomeMod:f/0' and also for `fun f/0' (using another function from `SomeMod'). But both return false. So I either misunderstood you or my above "test case" is wrong. Could you please shed some light on this for me? Thanks again, Ladislav Lenart From matthew@REDACTED Fri Apr 18 10:23:04 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 18 Apr 2008 01:23:04 -0700 Subject: [erlang-questions] [erlang-bugs] Weird pg2 behavior In-Reply-To: <18437.48350.271334.980195@gargle.gargle.HOWL> References: <18431.9227.133848.989614@gargle.gargle.HOWL> <18435.1529.209488.50485@gargle.gargle.HOWL> <18437.48350.271334.980195@gargle.gargle.HOWL> Message-ID: On Wed, Apr 16, 2008 at 1:46 AM, Hans Bolinder wrote: > I think pg2 should monitor all pids rather than link to local pids > only. Carefully setting up monitors, like Global does since R11B-4, > should work. Sounds good to me. Can we hope to see this in R12B-3? :-) From bjorn@REDACTED Fri Apr 18 11:15:46 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 18 Apr 2008 11:15:46 +0200 Subject: [erlang-questions] [Q] erlang:check_process_code/2 In-Reply-To: <480858DC.1040601@volny.cz> References: <480754BA.3010708@volny.cz> <480858DC.1040601@volny.cz> Message-ID: Ladislav Lenart writes: > I tried the above for `SomeFun = fun SomeMod:f/0' and also for `fun f/0' > (using another function from `SomeMod'). But both return false. My answer was slightly wrong. When I said "fun", I should have said "internal fun". fun SomeMod:f/0 is an external fun, which is implemented differently from an internal fun (fun f/0). External funs do not refer directly to the code for the module, but use an additional level of indirection, so it is perfectly safe to purge a module even if external funs reference the module. Therefore, erlang:check_process_code/2 does not consider external funs at all. > So I either misunderstood you or my above "test case" is wrong. Could you > please shed some light on this for me? I can't tell, because you didn't show the code for your test case. Maybe your code didn't actually hold the fun. Using my own code (below), everything works as expected: Erlang (BEAM) emulator version 5.6.2 [async-threads:0] [kernel-poll:false] Eshell V5.6.2 (abort with ^G) 1> P = fun_proc:start(). <0.32.0> 2> P ! {'fun',some_mod:some_fun()}. {'fun',#Fun} 3> code:purge(some_mod). false 4> code:delete(some_mod). true 5> erlang:check_process_code(P, some_mod). true /Bjorn -module(some_mod). -compile(export_all). some_fun() -> fun() -> ok end. -module(fun_proc). -compile([export_all]). start() -> spawn_link(fun hold_fun/0). hold_fun() -> receive {'fun',Fun} -> hold_fun(Fun) end. hold_fun(Fun) -> receive {get_fun,Pid} -> Pid ! Fun end. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From lenartlad@REDACTED Fri Apr 18 11:42:35 2008 From: lenartlad@REDACTED (Ladislav Lenart) Date: Fri, 18 Apr 2008 11:42:35 +0200 Subject: [erlang-questions] [Q] erlang:check_process_code/2 In-Reply-To: References: <480754BA.3010708@volny.cz> <480858DC.1040601@volny.cz> Message-ID: <48086D0B.9040601@volny.cz> Hello again, the only difference is that I tried `fun Mod:f/0' and `f/0' but did not try `fun () -> ok end' which I assume is the only "internal fun" from the three, right? Thanks a lot. Ladislav Lenart From bjorn@REDACTED Fri Apr 18 13:04:26 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 18 Apr 2008 13:04:26 +0200 Subject: [erlang-questions] [Q] erlang:check_process_code/2 In-Reply-To: <48086D0B.9040601@volny.cz> References: <480754BA.3010708@volny.cz> <480858DC.1040601@volny.cz> <48086D0B.9040601@volny.cz> Message-ID: Ladislav Lenart writes: > Hello again, > > the only difference is that I tried `fun Mod:f/0' and `f/0' but did not > try `fun () -> ok end' which I assume is the only "internal fun" from the > three, right? fun f/0 is also an internal fun. erlang:check_process_code(P, some_mod) still returns true if I change some_mod to: -module(some_mod). -compile(export_all). some_fun() -> fun f/0. f() -> ok. What if you run my code? Do you get the same result as I did? /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From lenartlad@REDACTED Fri Apr 18 14:18:17 2008 From: lenartlad@REDACTED (Ladislav Lenart) Date: Fri, 18 Apr 2008 14:18:17 +0200 Subject: [erlang-questions] [Q] erlang:check_process_code/2 In-Reply-To: References: <480754BA.3010708@volny.cz> <480858DC.1040601@volny.cz> <48086D0B.9040601@volny.cz> Message-ID: <48089189.1000603@volny.cz> Bjorn Gustavsson wrote: > What if you run my code? Do you get the same result as I did? I just did it and got the same results as you, so I must have done something wrong in my own experiments. However, with your kind help, I was able to track down the cause of my problem and solve it by using `fun M:F/X' instead of `fun F/X' in the right place. Thanks again, Ladislav Lenart From erlang@REDACTED Fri Apr 18 15:49:38 2008 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 18 Apr 2008 15:49:38 +0200 Subject: [erlang-questions] Underscore prefixes In-Reply-To: <48084044.9070501@erix.ericsson.se> References: <1208484839.12040.371.camel@kereru.wgtn.cat-it.co.nz> <48084044.9070501@erix.ericsson.se> Message-ID: <9b08084c0804180649r4a719e39u5f743e8d099381ec@mail.gmail.com> _X behaves just like X as regards pattern matching. It is not an anonymous variable like "_" Thus {_X, _X} matches {a,a} but not {a,b} The difference between X and _X shows up in the compiler diagnostics for unused variables. If X occurs only in a pattern and is never used, then the compiler issues a warning. If _X is used instead, then no warning is issued. Thus in Dan's code if the io:format line is commented out there will be no compiler warning. If the program used Result instead of _Result then there would be a warning. So use "_Var" in debug statements that are intended to be commented out. /Joe Armstrong On Fri, Apr 18, 2008 at 8:31 AM, Dan Gudmundsson wrote: > My guess is debugging: > > _Result = module:function(X), > io:format("DBG: ~p ~n", [_Result]), > {response, ok}. > > Than you can delete the debug io:format. > > > > Matthew Dempsky wrote: > > On Thu, Apr 17, 2008 at 7:13 PM, Vik Olliver wrote: > >> Underscores before a variable indicate it's basically optional, right? > > > > It simply tells the compiler not to issue a warning if the variable is > > not otherwise used. > > > >> So why would someone do: > >> > >> _Result = module:function(X), > >> {response, ok}. > >> > >> in their code? > > > > Style maybe. When matching elements of a tuple, I'll often still > > write "_Foo" and "_Bar" (but actually meaningful names) even if I > > don't need those elements in case I later need to change the code and > > it saves me a little bit of time looking up what the other elements > > are again. > > > > This particular case though, it's kinda silly. Obviously the return > > value of a function is its result. :-) > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kenneth.flanagan@REDACTED Fri Apr 18 16:29:40 2008 From: kenneth.flanagan@REDACTED (Kenneth Flanagan) Date: Fri, 18 Apr 2008 16:29:40 +0200 Subject: [erlang-questions] Multiple SCTP associations Message-ID: <120FDEAC96A65F47933985A3AB00DC1A05CCEEBD@esealmw116.eemea.ericsson.se> Hello, I have written a very simple H.248/SCTP Media Gateway application for loading up our Gateway Controller. Initially I had a lot of problems getting SCTP working, and finally it did with Debian Linux and Erlang OTP R11B-5. It works fine simulating one MGW, accepting over a 1000 calls/second, but I need to simulate multiple MGWs (to show calls between MGWs, and I have enough processor capacity & bandwidth to do it). There is only 1 network card available for SCTP, and I have multiple virtual interfaces. The problem is when I open another association and try to send data I get error "epipe". It does not matter if I open another erlang node, or try it on the same node. The IP addresses work individually, i.e. it's not the address that has the problem. I would appreciate any help/comments on this, Best Regards, Ken. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ----------------------------------------------------------------------- LM Ericsson Limited Registered Office: Beech Hill, Clonskeagh, Dublin 4 Registered Number in Ireland : 21679 This communication is confidential and intended solely for the addressee(s). Any unauthorised review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you. LM Ericsson Limited does not enter into contracts or contractual obligations via electronic mail, unless otherwise agreed in writing between the parties concerned. E-mail including attachments is susceptible to data corruption, interruption, unauthorised amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof. -------------- next part -------------- An HTML attachment was scrubbed... URL: From masterofquestions@REDACTED Fri Apr 18 19:13:15 2008 From: masterofquestions@REDACTED (db) Date: Fri, 18 Apr 2008 13:13:15 -0400 Subject: [erlang-questions] noob gen_leader question In-Reply-To: <8209f740804172352m3ac4acffy12f712b85a721b69@mail.gmail.com> References: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> <47FA881B.2060304@ericsson.com> <1218d6a50804130601g1602a316o2f2f34205677cb50@mail.gmail.com> <4802659A.6010601@ericsson.com> <1218d6a50804172121n45fcba33qb2e0c66693342035@mail.gmail.com> <8209f740804172352m3ac4acffy12f712b85a721b69@mail.gmail.com> Message-ID: <1218d6a50804181013w277215d2k9dc0f3c444910676@mail.gmail.com> I reran the gdict example and election record shows b@REDACTED as down. Even though this is not the case, but simply b@REDACTED is not the current leader. There is no distinction made between node being down and nodes that aren't elected leader in actual election record/tuple. Also, what is buffered field in the election record definition? On Fri, Apr 18, 2008 at 2:52 AM, Ulf Wiger wrote: > The local-only mode was a way to allow the process to start before > the distribution was activated. In gproc, I allowed only local > registrations until a leader was elected, and I provided no function > for going back to local mode, once activated. > > BR, > Ulf W > Thank you, -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From masterofquestions@REDACTED Fri Apr 18 20:45:23 2008 From: masterofquestions@REDACTED (db) Date: Fri, 18 Apr 2008 14:45:23 -0400 Subject: [erlang-questions] noob gen_leader question In-Reply-To: <1218d6a50804181013w277215d2k9dc0f3c444910676@mail.gmail.com> References: <1218d6a50804071154v76bff786h9ba3e661ca2228aa@mail.gmail.com> <47FA881B.2060304@ericsson.com> <1218d6a50804130601g1602a316o2f2f34205677cb50@mail.gmail.com> <4802659A.6010601@ericsson.com> <1218d6a50804172121n45fcba33qb2e0c66693342035@mail.gmail.com> <8209f740804172352m3ac4acffy12f712b85a721b69@mail.gmail.com> <1218d6a50804181013w277215d2k9dc0f3c444910676@mail.gmail.com> Message-ID: <1218d6a50804181145m27e5fdcala77e845e75fa1884@mail.gmail.com> Here is the module used to run gdict and it's corresponding output: -module(gen_leader_for_dummies). -export([main/0]). -define(DUMP(X), io:format("~p:~p - ~p = ~p~n", [?MODULE, ? LINE, ??X, X])). main() -> ?DUMP(node()), ?DUMP(nodes()), %CandidateNodes and WorkerNodes are disjoint set of nodes CandidateNodes = [a@REDACTED,b@REDACTED], WorkerNodes = [wa@REDACTED,wb@REDACTED], ?DUMP(CandidateNodes), ?DUMP(WorkerNodes), {ok, D} = gdict:new(dummy, CandidateNodes, WorkerNodes), ?DUMP(D), ?DUMP(gdict:append(a, 1, D)), ?DUMP(gdict:append(b, 2, D)), ?DUMP(gdict:append(c, 3, D)), ?DUMP(gdict:find(a, D)), ?DUMP(gdict:find(b, D)), ?DUMP(gdict:find(c, D)). (a@REDACTED)1> gen_leader_for_dummies:main(). gen_leader_for_dummies:9 - "node ( )" = a@REDACTED gen_leader_for_dummies:10 - "nodes ( )" = [wb@REDACTED,wa@REDACTED,b@REDACTED] gen_leader_for_dummies:15 - "CandidateNodes" = [a@REDACTED,b@REDACTED] gen_leader_for_dummies:16 - "WorkerNodes" = [wa@REDACTED,wb@REDACTED] init({dict,0,16,16,8,80,48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}) gen_leader_for_dummies:18 - "D" = <0.72.0> elected([], {election,<0.72.0>,global,dummy,a@REDACTED, [a@REDACTED,b@REDACTED], [wa@REDACTED,wb@REDACTED], [], {[],1}, [b@REDACTED], [{#Ref<0.0.0.197>,wb@REDACTED},{#Ref<0.0.0.196>,wa@REDACTED}], []}) gen_leader_for_dummies:19 - "gdict : append ( a , 1 , D )" = ok gen_leader_for_dummies:20 - "gdict : append ( b , 2 , D )" = ok gen_leader_for_dummies:21 - "gdict : append ( c , 3 , D )" = ok gen_leader_for_dummies:22 - "gdict : find ( a , D )" = {ok,[1]} gen_leader_for_dummies:23 - "gdict : find ( b , D )" = {ok,[2]} gen_leader_for_dummies:24 - "gdict : find ( c , D )" = {ok,[3]} ok On Fri, Apr 18, 2008 at 1:13 PM, db wrote: > I reran the gdict example and election record shows b@REDACTED as down. > Even though this is not the case, but simply b@REDACTED is not the > current leader. There is no distinction made between node being down > and nodes that aren't elected leader in actual election record/tuple. > > Also, what is buffered field in the election record definition? - rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From bob@REDACTED Fri Apr 18 21:08:15 2008 From: bob@REDACTED (Bob Cowdery) Date: Fri, 18 Apr 2008 20:08:15 +0100 Subject: [erlang-questions] wxerlang and linux Message-ID: <1208545695.5947.11.camel@ubuntu-life-vm> Hi Has anyone set up wxwidgets on Ubuntu? I'm trying to port my wxerlang code to Linux and I just get an enoent error from wx:new(). As far as I can see everything wx wise is installed correctly in /usr/lib and wx-config reports sensible things. Any help appreciated. Bob From richardc@REDACTED Fri Apr 18 22:46:24 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 18 Apr 2008 22:46:24 +0200 Subject: [erlang-questions] wxerlang and linux In-Reply-To: <1208545695.5947.11.camel@ubuntu-life-vm> References: <1208545695.5947.11.camel@ubuntu-life-vm> Message-ID: <480908A0.7050808@it.uu.se> Bob Cowdery wrote: > Hi > > Has anyone set up wxwidgets on Ubuntu? I'm trying to port my wxerlang > code to Linux and I just get an enoent error from wx:new(). As far as I > can see everything wx wise is installed correctly in /usr/lib and > wx-config reports sensible things. I can at least report that it does work on Ubuntu (8.04 beta); after installing a bunch of dev-packages for WxWidgets and OpenGL, I was able to compile it and run a couple of the demo programs, but I have not had any time to experiment any further. (See the screenshot; I've no idea why the frame is missing though - seems to be a bug in the Gnome screenshot utility.) /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot-Sudoku.png Type: image/png Size: 16643 bytes Desc: not available URL: From rodrigobamboo@REDACTED Fri Apr 18 23:07:13 2008 From: rodrigobamboo@REDACTED (Rodrigo B. de Oliveira) Date: Fri, 18 Apr 2008 18:07:13 -0300 Subject: [erlang-questions] latest erlide plugin crashing eclipse on macosx leopard Message-ID: <5917478b0804181407h1dd7cd8dyc807cf3a0e82f6de@mail.gmail.com> Hi, After installing the latest version of erlide on a fresh eclipse install (latest official eclipse release), eclipse won't start anymore. I've found this in the eclipse log file: 17:52:33,914 FINER: (ErlideBackend.java:187) : null java.lang.NullPointerException at erlang.ErlideBackend.generateRpcStub(ErlideBackend.java:183) at org.erlide.runtime.backend.BackendUtil.generateRpcStub(BackendUtil.java:78) at org.erlide.runtime.backend.BackendUtil.generateRpcStub(BackendUtil.java:72) at org.erlide.runtime.backend.internal.CodeManager.loadPluginCode(CodeManager.java:317) My environment is: * Mac OS X 10.5.2 (9C7010) * java version "1.5.0_13" * erlang R12B-2 installed through port (erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.6.2) My next move will probably be checkout the source code and try to debug it but maybe someone already experienced it and solved it. Any ideas? Thanks for the great work! Rodrigo From bob@REDACTED Fri Apr 18 23:35:15 2008 From: bob@REDACTED (Bob Cowdery) Date: Fri, 18 Apr 2008 22:35:15 +0100 Subject: [erlang-questions] latest erlide plugin crashing eclipse on macosx leopard In-Reply-To: <5917478b0804181407h1dd7cd8dyc807cf3a0e82f6de@mail.gmail.com> References: <5917478b0804181407h1dd7cd8dyc807cf3a0e82f6de@mail.gmail.com> Message-ID: <1208554515.5947.16.camel@ubuntu-life-vm> Its no help but I'm trying to do the same on Ubuntu Linux and it's crashing with different traceback or locking up. I was thinking I had a bad erlang install as I'm also having trouble with wxerlang but now I'm not sure how many issues there are. Bob On Fri, 2008-04-18 at 18:07 -0300, Rodrigo B. de Oliveira wrote: > Hi, > > After installing the latest version of erlide on a fresh eclipse > install (latest official eclipse release), eclipse won't start > anymore. > > I've found this in the eclipse log file: > > 17:52:33,914 FINER: (ErlideBackend.java:187) : null > java.lang.NullPointerException > at erlang.ErlideBackend.generateRpcStub(ErlideBackend.java:183) > at org.erlide.runtime.backend.BackendUtil.generateRpcStub(BackendUtil.java:78) > at org.erlide.runtime.backend.BackendUtil.generateRpcStub(BackendUtil.java:72) > at org.erlide.runtime.backend.internal.CodeManager.loadPluginCode(CodeManager.java:317) > > My environment is: > > * Mac OS X 10.5.2 (9C7010) > * java version "1.5.0_13" > * erlang R12B-2 installed through port (erlang (ASYNC_THREADS,HIPE) > (BEAM) emulator version 5.6.2) > > My next move will probably be checkout the source code and try to > debug it but maybe someone already experienced it and solved it. Any > ideas? > > Thanks for the great work! > Rodrigo > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From luismarianoguerra@REDACTED Sat Apr 19 05:50:11 2008 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Sat, 19 Apr 2008 00:50:11 -0300 Subject: [erlang-questions] wxerlang and linux In-Reply-To: <480908A0.7050808@it.uu.se> References: <1208545695.5947.11.camel@ubuntu-life-vm> <480908A0.7050808@it.uu.se> Message-ID: 2008/4/18 Richard Carlsson : > Bob Cowdery wrote: > > > Hi > > > > Has anyone set up wxwidgets on Ubuntu? I'm trying to port my wxerlang > > code to Linux and I just get an enoent error from wx:new(). As far as I > > can see everything wx wise is installed correctly in /usr/lib and > > wx-config reports sensible things. > > > > I can at least report that it does work on Ubuntu (8.04 beta); > after installing a bunch of dev-packages for WxWidgets and OpenGL, > I was able to compile it and run a couple of the demo programs, but > I have not had any time to experiment any further. (See the screenshot; > I've no idea why the frame is missing though - seems to be a bug in > the Gnome screenshot utility.) gnome-screenshot --window --include-border --delay=5 :) From vladdu55@REDACTED Sat Apr 19 10:06:34 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 19 Apr 2008 10:06:34 +0200 Subject: [erlang-questions] latest erlide plugin crashing eclipse on macosx leopard In-Reply-To: <5917478b0804181407h1dd7cd8dyc807cf3a0e82f6de@mail.gmail.com> References: <5917478b0804181407h1dd7cd8dyc807cf3a0e82f6de@mail.gmail.com> Message-ID: <95be1d3b0804190106m114d59b8s1424625abcd6d91@mail.gmail.com> Hi, Could you please send me the whole log? Also, version is that, exactly? regards, Vlad On Fri, Apr 18, 2008 at 11:07 PM, Rodrigo B. de Oliveira < rodrigobamboo@REDACTED> wrote: > Hi, > > After installing the latest version of erlide on a fresh eclipse > install (latest official eclipse release), eclipse won't start > anymore. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Sat Apr 19 10:56:33 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 19 Apr 2008 10:56:33 +0200 Subject: [erlang-questions] wxerlang and linux In-Reply-To: References: <1208545695.5947.11.camel@ubuntu-life-vm> <480908A0.7050808@it.uu.se> Message-ID: <4809B3C1.7040202@it.uu.se> Mariano Guerra wrote: >> I've no idea why the frame is missing though - seems to be a bug in >> the Gnome screenshot utility.) > > gnome-screenshot --window --include-border --delay=5 The problem was that I used the GUI tool, and it didn't include the border even though the 'include border' box was ticked. /Richard From saleyn@REDACTED Sun Apr 20 04:02:19 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 19 Apr 2008 22:02:19 -0400 Subject: [erlang-questions] Multiple SCTP associations In-Reply-To: <120FDEAC96A65F47933985A3AB00DC1A05CCEEBD@esealmw116.eemea.ericsson.se> References: <120FDEAC96A65F47933985A3AB00DC1A05CCEEBD@esealmw116.eemea.ericsson.se> Message-ID: <480AA42B.2000806@gmail.com> I am not able to reproduce your problem on Fedora Core 8, R11B-5. Note that for the sake of example I opened the multi-homed server socket on two IPs, though this works even if you augment the IPs (e.g. gen_sctp:open(1234)). NodeA: 4> f(S), {ok, S} = gen_sctp:open([{port,1234},{ip,{192,168,0,14}},{ip,{192,168,0,13}}]). {ok,#Port<0.97>} 5> gen_sctp:listen(S, true). ok 6> gen_sctp:recv(S). {ok,{{192,168,0,14},32785,[],{sctp_assoc_change,comm_up,0,10,10,4}}} 7> gen_sctp:recv(S). {ok,{{192,168,0,13},32786,[],{sctp_assoc_change,comm_up,0,10,10,7}}} 8> gen_sctp:recv(S). {ok,{{192,168,0,14}, 32785, [{sctp_sndrcvinfo,3,0,[],0,0,0,2115484281,0,4}], <<"Test">>}} NodeB: 1> f(S), {ok, S} = gen_sctp:open([{ip, {192,168,0,14}}]). {ok,#Port<0.100>} 2> f(A), {ok, A} = gen_sctp:connect(S, {192,168,0,13}, 1234, []). {ok,{sctp_assoc_change,comm_up,0,10,10,2}} NodeC: 1> f(S), {ok, S} = gen_sctp:open([{ip,{192,168,0,13}}]). {ok,#Port<0.101>} 2> f(A), {ok, A} = gen_sctp:connect(S, {192,168,0,13}, 1234, []). {ok,{sctp_assoc_change,comm_up,0,10,10,6}} NodeB: 3> gen_sctp:send(S, A, 3, <<"Test">>). ok Kenneth Flanagan wrote: > Hello, > I have written a very simple H.248/SCTP Media Gateway application for > loading up our Gateway Controller. Initially I had a lot of problems > getting SCTP working, and finally it did with Debian Linux and Erlang > OTP R11B-5. It works fine simulating one MGW, accepting over a 1000 > calls/second, but I need to simulate multiple MGWs (to show calls > between MGWs, and I have enough processor capacity & bandwidth to do > it). > > There is only 1 network card available for SCTP, and I have multiple > virtual interfaces. The problem is when I open another association and > try to send data I get error "epipe". It does not matter if I open > another erlang node, or try it on the same node. The IP addresses work > individually, i.e. it's not the address that has the problem. > > I would appreciate any help/comments on this, > Best Regards, > Ken. > > ------------------------------------------------------------------------ > ------------------------------------------------------------------------ > ----------------------------------------------------------------------- > LM Ericsson Limited > Registered Office: Beech Hill, Clonskeagh, Dublin 4 > Registered Number in Ireland : 21679 From petr.sturc@REDACTED Sun Apr 20 13:35:20 2008 From: petr.sturc@REDACTED (Petr Sturc) Date: Sun, 20 Apr 2008 13:35:20 +0200 Subject: [erlang-questions] aborted, bad_type when creating Mnesia disc only table Message-ID: <73b10e5b0804200435p57b0661cy1dda33579d49596e@mail.gmail.com> Hello, beginners question - when doing mnesia:create_table(order,[{disc_only_copies, [node()]},{attributes,[id,customerid,inputfile,creationdate, finisheddate, duedate, quantity]}]) I am getting error {aborted,{bad_type,order,disc_only_copies,nonode@REDACTED}} I am not able to spot the problem. Any idea? Thanks in advance, Petr From masterofquestions@REDACTED Sun Apr 20 16:26:01 2008 From: masterofquestions@REDACTED (db) Date: Sun, 20 Apr 2008 10:26:01 -0400 Subject: [erlang-questions] gen_server noproc when trying to stop Message-ID: <1218d6a50804200726x73e2be8bk6744eec32a5aeb28@mail.gmail.com> Can someone tell me why can't stop the gen_server? 9> myclnt:start(). {ok,<0.90.0>} 10> myclnt:stop(). ** exception exit: {noproc,{gen_server,call,[mysrvr,stop]}} in function gen_server:call/2 -module(myclnt). -export([ start/0, stop/0 ]). -define(SERVER, mysrvr). start()-> gen_server:start_link({global, ?SERVER}, ?SERVER, [],[]). stop()-> gen_server:call(?SERVER, stop). -module(mysrvr). -behaviour(gen_server). -export([start_link/0]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -define(SERVER, ?MODULE). start_link() -> gen_server:start_link({global, ?SERVER}, ?MODULE, [], []). init([]) -> {ok,some}. handle_call({lookup}, _From, State) -> Reply = ok, io:format("_From: ~p State: ~p ~n",[_From, State]), {reply, Reply, State}; handle_call(stop, _From, State)-> io:format("_From: ~p State: ~p ~n",[_From, State]), {stop, normal, stopped, State}. handle_cast(_Msg, State) -> {noreply, State}. handle_info(_Info, State) -> {noreply, State}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. Thank you, -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From vladdu55@REDACTED Sun Apr 20 16:36:14 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 20 Apr 2008 16:36:14 +0200 Subject: [erlang-questions] gen_server noproc when trying to stop In-Reply-To: <1218d6a50804200726x73e2be8bk6744eec32a5aeb28@mail.gmail.com> References: <1218d6a50804200726x73e2be8bk6744eec32a5aeb28@mail.gmail.com> Message-ID: <95be1d3b0804200736o19a7e732p5a56ad2a1cf1d062@mail.gmail.com> Hi, On Sun, Apr 20, 2008 at 4:26 PM, db wrote: > Can someone tell me why can't stop the gen_server? > > start()-> > gen_server:start_link({global, ?SERVER}, ?SERVER, [],[]). > > stop()-> > gen_server:call(?SERVER, stop). > > Try stop()-> gen_server:call({global, ?SERVER}, stop). best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Sun Apr 20 16:40:27 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 20 Apr 2008 10:40:27 -0400 Subject: [erlang-questions] gen_server noproc when trying to stop In-Reply-To: <1218d6a50804200726x73e2be8bk6744eec32a5aeb28@mail.gmail.com> References: <1218d6a50804200726x73e2be8bk6744eec32a5aeb28@mail.gmail.com> Message-ID: <480B55DB.4020703@gmail.com> Since you use global registration, you have to address the server in this way: gen_server:call({global, ?SERVER}, Request). In order to use the gen_server:call(?SERVER, Request) convention, use locally registered servers: gen_server:start_link({local, ?SERVER}, ?SERVER, [],[]). db wrote: > Can someone tell me why can't stop the gen_server? > > 9> myclnt:start(). > {ok,<0.90.0>} > 10> myclnt:stop(). > ** exception exit: {noproc,{gen_server,call,[mysrvr,stop]}} > in function gen_server:call/2 > > > -module(myclnt). > > -export([ > start/0, > stop/0 > ]). > > -define(SERVER, mysrvr). > > start()-> > gen_server:start_link({global, ?SERVER}, ?SERVER, [],[]). > > stop()-> > gen_server:call(?SERVER, stop). > > > > > -module(mysrvr). > > -behaviour(gen_server). > > -export([start_link/0]). > > > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > terminate/2, code_change/3]). > > -define(SERVER, ?MODULE). > > start_link() -> > gen_server:start_link({global, ?SERVER}, ?MODULE, [], []). > > init([]) -> > {ok,some}. > > handle_call({lookup}, _From, State) -> > Reply = ok, > io:format("_From: ~p State: ~p ~n",[_From, State]), > {reply, Reply, State}; > > handle_call(stop, _From, State)-> > io:format("_From: ~p State: ~p ~n",[_From, State]), > {stop, normal, stopped, State}. > > handle_cast(_Msg, State) -> > {noreply, State}. > > handle_info(_Info, State) -> > {noreply, State}. > > terminate(_Reason, _State) -> > ok. > > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > > Thank you, From dnew@REDACTED Sun Apr 20 18:07:42 2008 From: dnew@REDACTED (Darren New) Date: Sun, 20 Apr 2008 09:07:42 -0700 Subject: [erlang-questions] aborted, bad_type when creating Mnesia disc only table In-Reply-To: <73b10e5b0804200435p57b0661cy1dda33579d49596e@mail.gmail.com> References: <73b10e5b0804200435p57b0661cy1dda33579d49596e@mail.gmail.com> Message-ID: <480B6A4E.3040404@san.rr.com> Petr Sturc wrote: > {aborted,{bad_type,order,disc_only_copies,nonode@REDACTED}} I believe you're not allowed to have ordered tables that are only on disk. If you're going to sort the table, it has to fit in RAM. I've been vexed by this too, trying to design a replacement for our current system (based on MySql). I'm thinking either an ordered RAM-only copy of just the keys as a secondary table, or building a second table with a column for each attribute I want to sort on, maintaining a skiplist in each column. (My ordering criteria don't change once the record is written, but it gets messier if you want to be updating the key it's ordered on.) (Sorry if you get that twice.) -- Darren New / San Diego, CA, USA (PST) "That's pretty. Where's that?" "It's the Age of Channelwood." "We should go there on vacation some time." From nc@REDACTED Sun Apr 20 18:54:20 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Sun, 20 Apr 2008 18:54:20 +0200 Subject: [erlang-questions] aborted, bad_type when creating Mnesia disc only table In-Reply-To: <73b10e5b0804200435p57b0661cy1dda33579d49596e@mail.gmail.com> References: <73b10e5b0804200435p57b0661cy1dda33579d49596e@mail.gmail.com> Message-ID: <480B753C.2060903@charpi.net> Petr Sturc wrote: > Hello, > > beginners question - when doing > > mnesia:create_table(order,[{disc_only_copies, > [node()]},{attributes,[id,customerid,inputfile,creationdate, > finisheddate, duedate, quantity]}]) > > I am getting error > > {aborted,{bad_type,order,disc_only_copies,nonode@REDACTED}} > > I am not able to spot the problem. Any idea? > Thanks in advance, > Hi, I succeed to reproduce your problem. You might have a problem with your schema. As you want to create a disc_only_copies you have to tell mnesia where to store table on disc. Basically, this is done with: - a mnesia environement variable: mnesia dir. It's the location of your tables on disk. - the schema creation: mnesia:create_schema/1. Here are the command to create your table $ erl -mnesia dir my_location Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) 1> mnesia:create_schema([node()]). ok 2> mnesia:start(). ok 3> mnesia:create_table(order,[{disc_copies,[node()]},{attributes,[id,customerid,inputfile,creationdate, finisheddate,duedate,quantity]}]). {atomic,ok} 4> Look at mnesia user's guide for my information about schema operations. http://www.erlang.org/doc/apps/mnesia/part_frame.html Regards, Nicolas Charpentier From dgud@REDACTED Mon Apr 21 09:52:18 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 21 Apr 2008 09:52:18 +0200 Subject: [erlang-questions] wxerlang and linux In-Reply-To: <1208545695.5947.11.camel@ubuntu-life-vm> References: <1208545695.5947.11.camel@ubuntu-life-vm> Message-ID: <480C47B2.2050406@erix.ericsson.se> Arrgh, The installer doesn't install the driver on unix :-( Copy the priv dir to wherever you installed it. Thanks for the bug report. /Dan Bob Cowdery wrote: > Hi > > Has anyone set up wxwidgets on Ubuntu? I'm trying to port my wxerlang > code to Linux and I just get an enoent error from wx:new(). As far as I > can see everything wx wise is installed correctly in /usr/lib and > wx-config reports sensible things. > > Any help appreciated. > > Bob > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raimo+erlang-questions@REDACTED Mon Apr 21 12:19:48 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 21 Apr 2008 12:19:48 +0200 Subject: [erlang-questions] otp_win32_R12B-2.exe "Trojan horse Generic 10.MHB" Message-ID: <20080421101948.GA17047@erix.ericsson.se> We currently get reports about http://www.erlang.org/download/otp_win32_R12B-2.exe being infected with "Trojan horse Generic 10.MHB", the contained file Uninstall.exe. It is the antivirus programs AVG 7.5 and AVG 8 that report this. The file scans fine with Symantec Antivirus 8.1, so it is probably a false positive. We are trying to get a response from AVG Techologies. When you download, check the MD5 sum to be sure you got what you wanted. And if you want to be sure, wait and see if this is a real problem. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From shehan@REDACTED Mon Apr 21 14:51:07 2008 From: shehan@REDACTED (shehan) Date: Mon, 21 Apr 2008 18:21:07 +0530 Subject: [erlang-questions] SSL+HTTPS programming Message-ID: <20080421125516.3487619DC16E@mail.wavenet.lk> Hi all, I am beginner of SSL programming with HTTP. Basically I want to send data through https using inet module. So if someone has guide or tutor with examples, pls send that. That is big help to me. BR, Shehan -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablo.polvorin@REDACTED Mon Apr 21 15:41:49 2008 From: pablo.polvorin@REDACTED (Pablo Polvorin) Date: Mon, 21 Apr 2008 10:41:49 -0300 Subject: [erlang-questions] wxerlang and linux In-Reply-To: <480C47B2.2050406@erix.ericsson.se> References: <1208545695.5947.11.camel@ubuntu-life-vm> <480C47B2.2050406@erix.ericsson.se> Message-ID: <1ffe809c0804210641y199c8f94y8a4c87e639e038e@mail.gmail.com> Hi, I've got some problems to compile wxerlang with gcc 4.1.3 in a amd64 box. The problem was: wxe_impl.cpp:205: error: cast from 'wxeMemEnv*' to 'int' loses precision wxe_impl.cpp:205: error: cast from 'wxeMemEnv*' to 'int' loses precision The (possible wrong, I'm not a c guru) solution I found to work was to change those cast in line 205 to look like this: (int)(intptr_t) cb_mem (int)(intptr_t) app->call_back_mem cheers! 2008/4/21, Dan Gudmundsson : > Arrgh, The installer doesn't install the driver on unix :-( > Copy the priv dir to wherever you installed it. > > Thanks for the bug report. > > > /Dan > > > Bob Cowdery wrote: > > Hi > > > > Has anyone set up wxwidgets on Ubuntu? I'm trying to port my wxerlang > > code to Linux and I just get an enoent error from wx:new(). As far as I > > can see everything wx wise is installed correctly in /usr/lib and > > wx-config reports sensible things. > > > > Any help appreciated. > > > > Bob > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- -- pablo http://ppolv.wordpress.com ---- From kenneth.flanagan@REDACTED Mon Apr 21 16:07:51 2008 From: kenneth.flanagan@REDACTED (Kenneth Flanagan) Date: Mon, 21 Apr 2008 16:07:51 +0200 Subject: [erlang-questions] Multiple SCTP associations In-Reply-To: <480AA42B.2000806@gmail.com> References: <120FDEAC96A65F47933985A3AB00DC1A05CCEEBD@esealmw116.eemea.ericsson.se> <480AA42B.2000806@gmail.com> Message-ID: <120FDEAC96A65F47933985A3AB00DC1A05D18B58@esealmw116.eemea.ericsson.se> Hi Serge, Thanks for that. It's multiple single homed I trying to use and I've worked out what I'm doing wrong. Initially I had problems sending h.248 because I couldn't find hrl's for record #sctp_sndrcvinfo where you need to change the ppid (7 for h.248). I eventually copied in the structure to my own hrl and set assoc_id = 1 by default, so every instance of my MGW tried to use the same. Once I make assoc_id dynamic (i.e. different for every instance of the MGW) it works fine. Thanks again for the mail. I've muddled my own way with SCTP_o_erlang up to now. Nice to know someone can help out :) Best Regards, Ken. -----Original Message----- From: Serge Aleynikov [mailto:saleyn@REDACTED] Sent: 20 April 2008 03:02 To: Kenneth Flanagan Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Multiple SCTP associations I am not able to reproduce your problem on Fedora Core 8, R11B-5. Note that for the sake of example I opened the multi-homed server socket on two IPs, though this works even if you augment the IPs (e.g. gen_sctp:open(1234)). NodeA: 4> f(S), {ok, S} = gen_sctp:open([{port,1234},{ip,{192,168,0,14}},{ip,{192,168,0,13}}]). {ok,#Port<0.97>} 5> gen_sctp:listen(S, true). ok 6> gen_sctp:recv(S). {ok,{{192,168,0,14},32785,[],{sctp_assoc_change,comm_up,0,10,10,4}}} 7> gen_sctp:recv(S). {ok,{{192,168,0,13},32786,[],{sctp_assoc_change,comm_up,0,10,10,7}}} 8> gen_sctp:recv(S). {ok,{{192,168,0,14}, 32785, [{sctp_sndrcvinfo,3,0,[],0,0,0,2115484281,0,4}], <<"Test">>}} NodeB: 1> f(S), {ok, S} = gen_sctp:open([{ip, {192,168,0,14}}]). {ok,#Port<0.100>} 2> f(A), {ok, A} = gen_sctp:connect(S, {192,168,0,13}, 1234, []). {ok,{sctp_assoc_change,comm_up,0,10,10,2}} NodeC: 1> f(S), {ok, S} = gen_sctp:open([{ip,{192,168,0,13}}]). {ok,#Port<0.101>} 2> f(A), {ok, A} = gen_sctp:connect(S, {192,168,0,13}, 1234, []). {ok,{sctp_assoc_change,comm_up,0,10,10,6}} NodeB: 3> gen_sctp:send(S, A, 3, <<"Test">>). ok Kenneth Flanagan wrote: > Hello, > I have written a very simple H.248/SCTP Media Gateway application for > loading up our Gateway Controller. Initially I had a lot of problems > getting SCTP working, and finally it did with Debian Linux and Erlang > OTP R11B-5. It works fine simulating one MGW, accepting over a 1000 > calls/second, but I need to simulate multiple MGWs (to show calls > between MGWs, and I have enough processor capacity & bandwidth to do > it). > > There is only 1 network card available for SCTP, and I have multiple > virtual interfaces. The problem is when I open another association and > try to send data I get error "epipe". It does not matter if I open > another erlang node, or try it on the same node. The IP addresses work > individually, i.e. it's not the address that has the problem. > > I would appreciate any help/comments on this, Best Regards, Ken. > > ---------------------------------------------------------------------- > -- > ---------------------------------------------------------------------- > -- > ---------------------------------------------------------------------- > - > LM Ericsson Limited > Registered Office: Beech Hill, Clonskeagh, Dublin 4 Registered Number > in Ireland : 21679 From Martin.Logan@REDACTED Mon Apr 21 18:04:27 2008 From: Martin.Logan@REDACTED (Logan, Martin) Date: Mon, 21 Apr 2008 11:04:27 -0500 Subject: [erlang-questions] [Beginner]How do I find out ifibrowse:send_req/5 has timed out? In-Reply-To: <1208324886.12040.234.camel@kereru.wgtn.cat-it.co.nz> References: <1208324886.12040.234.camel@kereru.wgtn.cat-it.co.nz> Message-ID: Online docs for iBrowse can be found here: http://erlware.org/erlware/repository_applications.html Looking at the documentation for send_req/5 I don't see anything about a timeout specified. Chandru perhaps it would be a good idea to release a patch version bump to 1.4 with that clarification? Cheers, Martin -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Vik Olliver Sent: Wednesday, April 16, 2008 12:48 AM To: erlang-questions@REDACTED Subject: [erlang-questions] [Beginner]How do I find out ifibrowse:send_req/5 has timed out? Hello Erlangers. I'm still at the "struggling bravely" phase and peering at code which is still somewhat over my head. Part of this uses ibrowse:send_req/5, which doesn't have a timeout. Or at least none it owns up to. Will it timeout eventually, and if so how do I tell that it did? If it doesn't time out, same basic question applies should I use ibrowse:send_req/6 - how do I tell? Vik :v) _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From erlangy@REDACTED Mon Apr 21 19:04:41 2008 From: erlangy@REDACTED (Michael McDaniel) Date: Mon, 21 Apr 2008 10:04:41 -0700 Subject: [erlang-questions] SSL+HTTPS programming In-Reply-To: <20080421125516.3487619DC16E@mail.wavenet.lk> References: <20080421125516.3487619DC16E@mail.wavenet.lk> Message-ID: <20080421170441.GG7439@delora.autosys.us> On Mon, Apr 21, 2008 at 06:21:07PM +0530, shehan wrote: > Hi all, > > I am beginner of SSL programming with HTTP. Basically I want to send data > through https using inet module. So if someone has guide or tutor with > examples, pls send that. That is big help to me. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Though you probably won't need everything in it, this may be useful: http://www.trapexit.org/index.php/Distributed_erlang_using_ssl_through_firewalls Also contains a reference to the ssl_distribution documentation in Erlang. ~M > > BR, > > Shehan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From cyberlync@REDACTED Mon Apr 21 19:53:35 2008 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 21 Apr 2008 17:53:35 +0000 Subject: [erlang-questions] Erlounge: Seattle 04/25 @ 6:30 Message-ID: Seattle 04/25 6:30 @ Barca's in Capital Hill - http://www.barcaseattle.com/ Everyone, It just so happens that three of the five Erlware maintainers are going to be in Seattle for the weekend of the 25th. That sounds like a good excuse for us to get a group together and talk about Erlang, maybe Erlware too, for a few hours. Feel free to come down to Barca's that friday night for some decent beer and conversation thats at least a little related to Erlang. Thanks, Eric From nbajamah@REDACTED Mon Apr 21 23:52:50 2008 From: nbajamah@REDACTED (Nageshwar Bajamahal) Date: Mon, 21 Apr 2008 14:52:50 -0700 Subject: [erlang-questions] compile error in LINUX 2.6 : "Fatal, could not get clock_monotonic value!, errno = 22" Message-ID: HI I am trying to compile erlang source code on a linux box ---------------------- details of my machine -------------------- Linux lxlogin-3-300 2.6.22.4 #1 SMP Tue Aug 21 17:47:29 PDT 2007 i686 Dual-Core AMD Opteron(tm) Processor 2212 AuthenticAMD GNU/Linux ---------------------- compile error ----------------------------------- erlc -W +debug_info +warn_obsolete_guard -I/home/nbajamah/utils/otp_src_R12B-2/lib/stdlib/include -o../ebin yecc.erl Fatal, could not get clock_monotonic value!, errno = 22 make[3]: *** [../ebin/yecc.beam] Aborted make[3]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools/src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib' make: *** [secondary_bootstrap_build] Error 2 Please let me know how I could resolve this issue. Thank you, Nageshwar -------------- next part -------------- An HTML attachment was scrubbed... URL: From masterofquestions@REDACTED Tue Apr 22 01:27:07 2008 From: masterofquestions@REDACTED (db) Date: Mon, 21 Apr 2008 19:27:07 -0400 Subject: [erlang-questions] Match Made In Heaven: proc_lib:spawnlink(Node, M, F, A) & gen_server:call({global, ?SERVER}, a marriage? Message-ID: <1218d6a50804211627x66b4456ej742aec490783ffe@mail.gmail.com> I have a global gen_server on nodeA and the clients are spawned on remote nodes(B,C,...) from nodeA by a another gen_server. Common supervisor that supervise both gen_server for client and global gen_server on NodeA. nodeA |-supervisor |-global_gen_server |-client_gen_server (this gen_server uses proc_lib:spawn_link(Node, M, F, A) to spawn clients on remote nodes and respawn client onto remote nodes if they die). If the supervisor on nodeA sends terminate signal to global_gen_server and client_gen_server, I need the remote clients to also die. I use proc_lib to spawn the client on remote node. Proc_lib:spawn_link(Node, M, F, A) has looping structure as follows: loop(...) -> receive ... {'EXIT', Parent, Reason} -> ..maybe some cleaning up here.. exit(Reason); ... end. How can I call gen_server:call({global, ?SERVER} inside this loop, so that the reply from the gen_server hits one of the receive condition. Is proc_lib:spawn_link and gen_server:call({global, ?SERVER} a match made in heaven or I have to go with proc_lib:spawn_link and gen_server:cast({global, ?SERVER}? Thank you. -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From saleyn@REDACTED Tue Apr 22 03:48:00 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 21 Apr 2008 21:48:00 -0400 Subject: [erlang-questions] Multiple SCTP associations In-Reply-To: <120FDEAC96A65F47933985A3AB00DC1A05D18B58@esealmw116.eemea.ericsson.se> References: <120FDEAC96A65F47933985A3AB00DC1A05CCEEBD@esealmw116.eemea.ericsson.se> <480AA42B.2000806@gmail.com> <120FDEAC96A65F47933985A3AB00DC1A05D18B58@esealmw116.eemea.ericsson.se> Message-ID: <480D43D0.2090104@gmail.com> All SCTP message types are defined in sctp_inet.hrl. I also recall we had quite some trouble a couple of years ago getting our M3UA implementation working before figuring out that ppid needed to be set... In SCTP an association is a unique identity of an endpoint. A single socket can have a large number of associations, and they are dynamically assigned by the stack when a new client is connected. Please share your experience with the throughput involving multiple client associations on a single SCTP socket. I expect it to be not worse than of TCP. Regards, Serge Kenneth Flanagan wrote: > Hi Serge, > Thanks for that. It's multiple single homed I trying to use and I've > worked out what I'm doing wrong. Initially I had problems sending h.248 > because I couldn't find hrl's for record #sctp_sndrcvinfo where you need > to change the ppid (7 for h.248). I eventually copied in the structure > to my own hrl and set assoc_id = 1 by default, so every instance of my > MGW tried to use the same. > > Once I make assoc_id dynamic (i.e. different for every instance of the > MGW) it works fine. Thanks again for the mail. I've muddled my own way > with SCTP_o_erlang up to now. Nice to know someone can help out :) > > Best Regards, > Ken. > > -----Original Message----- > From: Serge Aleynikov [mailto:saleyn@REDACTED] > Sent: 20 April 2008 03:02 > To: Kenneth Flanagan > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Multiple SCTP associations > > I am not able to reproduce your problem on Fedora Core 8, R11B-5. Note > that for the sake of example I opened the multi-homed server socket on > two IPs, though this works even if you augment the IPs (e.g. > gen_sctp:open(1234)). > > NodeA: > > 4> f(S), {ok, S} = > gen_sctp:open([{port,1234},{ip,{192,168,0,14}},{ip,{192,168,0,13}}]). > {ok,#Port<0.97>} > 5> gen_sctp:listen(S, true). > ok > 6> gen_sctp:recv(S). > {ok,{{192,168,0,14},32785,[],{sctp_assoc_change,comm_up,0,10,10,4}}} > 7> gen_sctp:recv(S). > {ok,{{192,168,0,13},32786,[],{sctp_assoc_change,comm_up,0,10,10,7}}} > 8> gen_sctp:recv(S). > {ok,{{192,168,0,14}, > 32785, > [{sctp_sndrcvinfo,3,0,[],0,0,0,2115484281,0,4}], > <<"Test">>}} > > > NodeB: > 1> f(S), {ok, S} = gen_sctp:open([{ip, {192,168,0,14}}]). > {ok,#Port<0.100>} > 2> f(A), {ok, A} = gen_sctp:connect(S, {192,168,0,13}, 1234, []). > {ok,{sctp_assoc_change,comm_up,0,10,10,2}} > > NodeC: > 1> f(S), {ok, S} = gen_sctp:open([{ip,{192,168,0,13}}]). > {ok,#Port<0.101>} > 2> f(A), {ok, A} = gen_sctp:connect(S, {192,168,0,13}, 1234, []). > {ok,{sctp_assoc_change,comm_up,0,10,10,6}} > > NodeB: > 3> gen_sctp:send(S, A, 3, <<"Test">>). > ok > > > Kenneth Flanagan wrote: >> Hello, >> I have written a very simple H.248/SCTP Media Gateway application for >> loading up our Gateway Controller. Initially I had a lot of problems >> getting SCTP working, and finally it did with Debian Linux and Erlang >> OTP R11B-5. It works fine simulating one MGW, accepting over a 1000 >> calls/second, but I need to simulate multiple MGWs (to show calls >> between MGWs, and I have enough processor capacity & bandwidth to do >> it). >> >> There is only 1 network card available for SCTP, and I have multiple >> virtual interfaces. The problem is when I open another association and > >> try to send data I get error "epipe". It does not matter if I open >> another erlang node, or try it on the same node. The IP addresses work > >> individually, i.e. it's not the address that has the problem. >> >> I would appreciate any help/comments on this, Best Regards, Ken. >> >> ---------------------------------------------------------------------- >> -- >> ---------------------------------------------------------------------- >> -- >> ---------------------------------------------------------------------- >> - >> LM Ericsson Limited >> Registered Office: Beech Hill, Clonskeagh, Dublin 4 Registered Number >> in Ireland : 21679 > From masterofquestions@REDACTED Tue Apr 22 05:01:18 2008 From: masterofquestions@REDACTED (db) Date: Mon, 21 Apr 2008 23:01:18 -0400 Subject: [erlang-questions] Match Made In Heaven: proc_lib:spawnlink(Node, M, F, A) & gen_server:call({global, ?SERVER}, a marriage? In-Reply-To: <1218d6a50804211627x66b4456ej742aec490783ffe@mail.gmail.com> References: <1218d6a50804211627x66b4456ej742aec490783ffe@mail.gmail.com> Message-ID: <1218d6a50804212001s444246cdhded8f73695fca394@mail.gmail.com> If anyone of OTP's gen_* spawns a process on a remote machine using proc_lib:spawn_link(Node, M, F, A), and supervisor terminates the gen_*, then do I have to explicitly catch the termination signal from the gen_* within the process spawned by the proc_lib:spawn_link(Node, M, F, A) like so? receive ... {'EXIT', Parent, Reason} -> ..maybe some cleaning up here.. exit(Reason); ... end. Or does a remotely spawned proc_lib process also get terminated by OTP's gen_* whenever supervisor terminates any one of the OTP's gen_*? On Mon, Apr 21, 2008 at 7:27 PM, db wrote: > I have a global gen_server on nodeA and the clients are spawned on > remote nodes(B,C,...) from nodeA by a another gen_server. Common > supervisor that supervise both gen_server for client and global > gen_server on NodeA. > > nodeA > |-supervisor > |-global_gen_server > |-client_gen_server (this gen_server uses > proc_lib:spawn_link(Node, M, F, A) to spawn clients on remote nodes > and respawn client onto remote nodes if they die). > > If the supervisor on nodeA sends terminate signal to global_gen_server > and client_gen_server, I need the remote clients to also die. > > I use proc_lib to spawn the client on remote node. > Proc_lib:spawn_link(Node, M, F, A) has looping structure as follows: > > loop(...) -> > receive > ... > > {'EXIT', Parent, Reason} -> > ..maybe some cleaning up here.. > exit(Reason); > ... > end. > > How can I call gen_server:call({global, ?SERVER} inside this loop, so > that the reply from the gen_server hits one of the receive condition. > Is proc_lib:spawn_link and gen_server:call({global, ?SERVER} a match > made in heaven or I have to go with proc_lib:spawn_link and > gen_server:cast({global, ?SERVER}? > > Thank you. > -- > rk > > That which we persist in doing becomes easier for us to do; not that > the nature of the thing itself is changed, but that our power to do is > increased. > -Ralph Waldo Emerson > -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From matthew@REDACTED Tue Apr 22 10:37:42 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 22 Apr 2008 01:37:42 -0700 Subject: [erlang-questions] compile error in LINUX 2.6 : "Fatal, could not get clock_monotonic value!, errno = 22" In-Reply-To: References: Message-ID: 2008/4/21 Nageshwar Bajamahal : > erlc -W +debug_info +warn_obsolete_guard > -I/home/nbajamah/utils/otp_src_R12B-2/lib/stdlib/include -o../ebin yecc.erl > > Fatal, could not get clock_monotonic value!, errno = 22 Is this repeatable? What if you just run "erlc"? If so, what's the output of "strace erlc" (particularly calls to the clock_gettime syscalls)? Is there anything unusual about this Linux host? E.g., is it using any virtualization or an embedded system without a real-time clock? What Linux distribution are you using? From gleber.p@REDACTED Tue Apr 22 11:35:56 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 22 Apr 2008 11:35:56 +0200 Subject: [erlang-questions] Sending big messages to self() Message-ID: <14f0e3620804220235j6f5914calef83bf8044517fe@mail.gmail.com> Hello all, Is it efficient to send quite big messages to self() ? In my case message may consist of a list of few thousand integers (not bigints). Of course i may use state variable for this, but it is simpler for me to send this message (because exacly the same messages are to be send to other processes). Best regards, -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From raimo+erlang-questions@REDACTED Tue Apr 22 12:06:38 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 22 Apr 2008 12:06:38 +0200 Subject: [erlang-questions] otp_win32_R12B-2.exe "Trojan horse Generic 10.MHB" In-Reply-To: <20080421101948.GA17047@erix.ericsson.se> References: <20080421101948.GA17047@erix.ericsson.se> Message-ID: <20080422100638.GA24216@erix.ericsson.se> On Mon, Apr 21, 2008 at 12:19:48PM +0200, Raimo Niskanen wrote: > We currently get reports about > http://www.erlang.org/download/otp_win32_R12B-2.exe > being infected with "Trojan horse Generic 10.MHB", > the contained file Uninstall.exe. > > It is the antivirus programs AVG 7.5 and AVG 8 that > report this. The file scans fine with Symantec > Antivirus 8.1, so it is probably a false positive. > > We are trying to get a response from AVG Techologies. > > When you download, check the MD5 sum to be sure you > got what you wanted. And if you want to be sure, > wait and see if this is a real problem. > I have now got a confirmation from AVG that it was a false positive: On Tue, 22 Apr 2008 10:44:02 +0200 (CEST) AVG Technical Support wrote: > > Dear Sir/Madam, > > thank you for your email. > > Unfortunately, the previous virus database might have detected the > mentioned virus on some legitimate applications. We can confirm that > it was a false alarm. We will release a new virus update that removes > the false positive detection on this file soon. Please update your AVG > and check your files again. > > If you need to restore deleted files from AVG Virus Vault you can do > it this way: > - Open AVG Virus Vault (Start -> Programs -> AVG 7.5 -> AVG Virus > Vault). > - Locate the file that was incorrectly removed. > - Right click on it and choose the "Restore File(s)" option. > > We are sorry for the inconvenience. > > Best regards, > > David Rohlik > AVG Technical Support > > website: http://www.avg.com > mailto: support@REDACTED You do not have to take my word for it, just await the new virus database... This was not the first time. There was a short thread about R12B-0 at dec 8, but an other false positive and just one affected user. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From bjorn@REDACTED Tue Apr 22 12:13:20 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 22 Apr 2008 12:13:20 +0200 Subject: [erlang-questions] Sending big messages to self() In-Reply-To: <14f0e3620804220235j6f5914calef83bf8044517fe@mail.gmail.com> References: <14f0e3620804220235j6f5914calef83bf8044517fe@mail.gmail.com> Message-ID: "Gleb Peregud" writes: > Hello all, > > Is it efficient to send quite big messages to self() ? In my case > message may consist of a list of few thousand integers (not bigints). Sending to self() is specially handled, so that the message will not be copied. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From C.Grasl@REDACTED Tue Apr 22 13:08:12 2008 From: C.Grasl@REDACTED (Grasl Christoph) Date: Tue, 22 Apr 2008 13:08:12 +0200 Subject: [erlang-questions] driver monitor problem Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CD1F@srvkeyx01.KEYTRONIX.local> Hi all, i?ve the following problem regarding driver monitors and some hints would be very helpful I?ve written a linked in driver in C and want to use the ?process_exit? callback handler to inform the driver if the connected process exited. Therefore I installed a driver monitor with if(driver_monitor_process(port,driver_connected(port),&monitor)) erl_err_msg("no monitor callback function or process alive\r\n"); The problem is now that if I exit the connected process the callback function ?process_exit? doesn't get triggered Have I missed something or did I catch it wrong ??? Best regards, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Tue Apr 22 13:10:27 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 22 Apr 2008 13:10:27 +0200 Subject: [erlang-questions] Sending big messages to self() In-Reply-To: References: <14f0e3620804220235j6f5914calef83bf8044517fe@mail.gmail.com> Message-ID: <14f0e3620804220410q2330f047s1357a576b2bbc27d@mail.gmail.com> Thanks a lot. Is it also true for sending to some Pid, which accidentally is equal to self() ? Just to be sure :) On 22 Apr 2008 12:13:20 +0200, Bjorn Gustavsson wrote: > "Gleb Peregud" writes: > > > Hello all, > > > > Is it efficient to send quite big messages to self() ? In my case > > message may consist of a list of few thousand integers (not bigints). > > Sending to self() is specially handled, so that the message will not be > copied. > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From bjorn@REDACTED Tue Apr 22 14:32:52 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 22 Apr 2008 14:32:52 +0200 Subject: [erlang-questions] Sending big messages to self() In-Reply-To: <14f0e3620804220410q2330f047s1357a576b2bbc27d@mail.gmail.com> References: <14f0e3620804220235j6f5914calef83bf8044517fe@mail.gmail.com> <14f0e3620804220410q2330f047s1357a576b2bbc27d@mail.gmail.com> Message-ID: "Gleb Peregud" writes: > Thanks a lot. Is it also true for sending to some Pid, which > accidentally is equal to self() ? Just to be sure :) Yes. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From j.bhanot@REDACTED Tue Apr 22 15:13:46 2008 From: j.bhanot@REDACTED (J Bhanot) Date: Tue, 22 Apr 2008 18:43:46 +0530 Subject: [erlang-questions] syntax problem Message-ID: Hi, In following code: cNode=nodes(connected), %gives node connected to e6 - should get c6@REDACTED here cNode=hd(Nodes), {any, [cNode]}!{Msgtype,AcReply}. % have tried it with {any, cNode}!{Msgtype,AcReply}. but got the error I am getting - {error,{{badmatch,c6@REDACTED}, but when I am hardcoding it as {any,c6@REDACTED}!{Msgtype,AcReply}. It is working fine... What could be the problem in first scenario Thanking in anticipation Regards, jb =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From C.Grasl@REDACTED Tue Apr 22 15:30:55 2008 From: C.Grasl@REDACTED (Grasl Christoph) Date: Tue, 22 Apr 2008 15:30:55 +0200 Subject: [erlang-questions] syntax problem References: Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CD21@srvkeyx01.KEYTRONIX.local> hi jb trying code in a shell reveals a lot, coz: variables in erlang start with a capital, which leads to a bad match when binding values to an atom, so try the following: CNode=nodes(connected), CNode=hd(Nodes), {any, [CNode]}!{Msgtype,AcReply}. cheers, chris original message: Von: erlang-questions-bounces@REDACTED im Auftrag von J Bhanot Gesendet: Di 22.04.2008 15:13 An: erlang-questions@REDACTED Betreff: [erlang-questions] syntax problem Hi, In following code: cNode=nodes(connected), %gives node connected to e6 - should get c6@REDACTED here cNode=hd(Nodes), {any, [cNode]}!{Msgtype,AcReply}. % have tried it with {any, cNode}!{Msgtype,AcReply}. but got the error I am getting - {error,{{badmatch,c6@REDACTED}, but when I am hardcoding it as {any,c6@REDACTED}!{Msgtype,AcReply}. It is working fine... What could be the problem in first scenario Thanking in anticipation Regards, jb =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Tue Apr 22 15:36:54 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 22 Apr 2008 15:36:54 +0200 Subject: [erlang-questions] syntax problem In-Reply-To: References: Message-ID: <480DE9F6.3000205@it.uu.se> J Bhanot wrote: < cNode=nodes(connected), %gives node connected to e6 < cNode=hd(Nodes), ---- > Nodes=nodes(connected), %gives nodes connected to e6 < cNode=hd(Nodes), /Richard From richardc@REDACTED Tue Apr 22 16:00:14 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 22 Apr 2008 16:00:14 +0200 Subject: [erlang-questions] syntax problem In-Reply-To: <480DE9F6.3000205@it.uu.se> References: <480DE9F6.3000205@it.uu.se> Message-ID: <480DEF6E.20806@it.uu.se> Oops. This is more like it: < cNode=nodes(connected), %gives node connected to e6 < cNode=hd(Nodes), < {any, [cNode]}!{Msgtype,AcReply}. ---- > Nodes=nodes(connected), %gives nodes connected to e6 > Node=hd(Nodes), > {any, [Node]}!{Msgtype,AcReply}. Variables can't begin with lowercase. But also, you can't assign to the same variable twice, so Nodes and Node must be different variables. /Richard From sten@REDACTED Tue Apr 22 20:56:23 2008 From: sten@REDACTED (Sten Kvamme) Date: Tue, 22 Apr 2008 20:56:23 +0200 Subject: [erlang-questions] ex11 ePutImage Message-ID: <514C0485-20C7-4BC5-932C-A81AF393ED40@kvamme.se> Hi, I can't get this ePutImage to put any image on screen. When I think I have all parameters right I get: {error,6291463,14,{length, 72,0,<<>>}} from the X server. I am using: {ok,{Wbin,Hbin,Data}} = ex11_lib_read_jpeg:file("joe.jpg"), xDo(Pid, ePutImage(Win, GC, Wbin, Hbin, 1, 1, 0, 24, list_to_binary (Data))), BR, Sten From gleber.p@REDACTED Tue Apr 22 22:54:05 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 22 Apr 2008 22:54:05 +0200 Subject: [erlang-questions] [clarify] Are private ets optimized? Message-ID: <14f0e3620804221354w2d3d100bm2dfed421ae50c67f@mail.gmail.com> Hello 1) As far as i know, data from ets'es is copied from ets to process heap every time it is accessed. Are ets'es with private flag optimized - do VM still copy data back and forth? 2) How data saved with set() behaves when accessed with get() ? Does it need copying? If there is any difference: in my case i'm talking about quite large lists of integers (not bigints). Best regards, -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From gleber.p@REDACTED Tue Apr 22 22:55:55 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 22 Apr 2008 22:55:55 +0200 Subject: [erlang-questions] [clarify] Are private ets optimized? In-Reply-To: <14f0e3620804221354w2d3d100bm2dfed421ae50c67f@mail.gmail.com> References: <14f0e3620804221354w2d3d100bm2dfed421ae50c67f@mail.gmail.com> Message-ID: <14f0e3620804221355pf49e85fi4830496e041d57e6@mail.gmail.com> On 4/22/08, Gleb Peregud wrote: > Hello > > 1) As far as i know, data from ets'es is copied from ets to process > heap every time it is accessed. Are ets'es with private flag optimized > - do VM still copy data back and forth? > > 2) How data saved with set() behaves when accessed with get() ? Does > it need copying? Sorry, i've sent it to hasty. I meant put() for putting data into process dictionary not set() :) > > If there is any difference: in my case i'm talking about quite large > lists of integers (not bigints). > > Best regards, > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From nbajamah@REDACTED Tue Apr 22 23:53:45 2008 From: nbajamah@REDACTED (Nageshwar Bajamahal) Date: Tue, 22 Apr 2008 14:53:45 -0700 Subject: [erlang-questions] compile error in LINUX 2.6 : "Fatal, could not get clock_monotonic value!, errno = 22" In-Reply-To: References: Message-ID: Hi Mattew, Yes, this problem is happening all the time when I am trying to compile. When I type erlc, I do not get any erl prompt or any erl shell prompt? I am not sure if I am missing some thing here. Please see the output of strace erlc below and let me know how I could get erlang up and running. Thank you, Nageshwar The Linux distribution that I have is Gentoo Base System version 1.6.13 >>>>>>>>>>>>>>>>>>>> UNAME -a output <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -> Linux lxlogin-3-300 2.6.22.4 #1 SMP Tue Aug 21 17:47:29 PDT 2007 i686 Dual Core AMD Opteron(tm) Processor 2212 AuthenticAMD GNU/Linux >>>>>>>>>>>>>>>>>>>> strace -c erlc output <<<<<<<<<<<<<<<<<<<<<<<<<<<<< lxlogin-3-300:/home/nbajamah/utils/otp_src_R12B-2> strace -c erlc Process 14931 detached % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- nan 0.000000 0 5 read nan 0.000000 0 7 1 open nan 0.000000 0 6 close nan 0.000000 0 1 execve nan 0.000000 0 4 brk nan 0.000000 0 1 munmap nan 0.000000 0 1 uname nan 0.000000 0 1 getcwd nan 0.000000 0 12 mmap2 nan 0.000000 0 5 fstat64 ------ ----------- ----------- --------- --------- ---------------- 100.00 0.000000 43 1 total lxlogin-3-300:/home/nbajamah/utils/otp_src_R12B-2> >>>>>>>>>>>>>>>>>>>> strace erlc <<<<<<<<<<<<<<<<<<<<<<<<<<<<< lxlogin-3-300:/home/nbajamah/utils/otp_src_R12B-2> strace erlc execve("/home/nbajamah/utils/otp_src_R12B-2/bin/i686-pc-linux-gnu/erlc", ["erlc"], [/* 37 vars */]) = 0 uname({sys="Linux", node="lxlogin-3-300", ...}) = 0 brk(0) = 0x804b000 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f6c000 open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=167968, ...}) = 0 mmap2(NULL, 167968, PROT_READ, MAP_PRIVATE, 3, 0) = 0xf7f42000 close(3) = 0 open("/lib/libutil.so.1", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\r\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=11057, ...}) = 0 mmap2(NULL, 10588, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xf7f3f000 mmap2(0xf7f41000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1) = 0xf7f41000 close(3) = 0 open("/lib/libdl.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\33"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=13704, ...}) = 0 mmap2(NULL, 12248, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xf7f3c000 mmap2(0xf7f3e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1) = 0xf7f3e000 close(3) = 0 open("/lib/libm.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\3004\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=187087, ...}) = 0 mmap2(NULL, 137120, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xf7f1a000 mmap2(0xf7f3b000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x20) = 0xf7f3b000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200^\1"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=1488107, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f19000 mmap2(NULL, 1251492, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xf7de7000 mmap2(0xf7f13000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12b) = 0xf7f13000 mmap2(0xf7f16000, 10404, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xf7f16000 close(3) = 0 munmap(0xf7f42000, 167968) = 0 open("/dev/urandom", O_RDONLY) = 3 read(3, "\337,\263a\0373\317\231\374\274\f\267\224\3\306\223\377"..., 32) = 32 close(3) = 0 brk(0) = 0x804b000 brk(0x806c000) = 0x806c000 brk(0) = 0x806c000 getcwd("/home/nbajamah/utils/otp_src_R12B-2", 4096) = 36 _exit(0) = ? Process 15608 detached >>>>>>>>>>>>>>>>>>>>>>>>>>>>> compile error <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< make[2]: Entering directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools' === Entering application parsetools make[3]: Entering directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools/src' erlc -W +debug_info +warn_obsolete_guard -I/home/nbajamah/utils/otp_src_R12B-2/lib/stdlib/include -o../ebin yecc.erl Fatal, could not get clock_monotonic value!, errno = 22 make[3]: *** [../ebin/yecc.beam] Aborted make[3]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools/src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib' make: *** [secondary_bootstrap_build] Error 2 -----Original Message----- From: Matthew Dempsky [mailto:matthew@REDACTED] Sent: Tuesday, April 22, 2008 1:38 AM To: Nageshwar Bajamahal Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] compile error in LINUX 2.6 : "Fatal, could not get clock_monotonic value!, errno = 22" 2008/4/21 Nageshwar Bajamahal : > erlc -W +debug_info +warn_obsolete_guard > -I/home/nbajamah/utils/otp_src_R12B-2/lib/stdlib/include -o../ebin yecc.erl > > Fatal, could not get clock_monotonic value!, errno = 22 Is this repeatable? What if you just run "erlc"? If so, what's the output of "strace erlc" (particularly calls to the clock_gettime syscalls)? Is there anything unusual about this Linux host? E.g., is it using any virtualization or an embedded system without a real-time clock? What Linux distribution are you using? -------------- next part -------------- An HTML attachment was scrubbed... URL: From icfp.publicity@REDACTED Wed Apr 23 00:30:02 2008 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Tue, 22 Apr 2008 17:30:02 -0500 Subject: [erlang-questions] Haskell08: Call for papers (co-located w/ ICFP08) Message-ID: <53ff55480804221530i7158ff74h95204f42d190901b@mail.gmail.com> Haskell 08 ACM SIGPLAN 2008 Haskell Symposium Victoria, British Columbia, Canada Thursday, 25th September, 2008 FIRST CALL FOR PAPERS http://haskell.org/haskell-symposium/2008 The Haskell Symposium 2008 is part of the 2008 International Conference on Functional Programming (ICFP) as an associated ACM SIGPLAN sponsored symposium. The purpose of the Haskell Symposium is to discuss experience with Haskell, and future developments for the language. The scope of the symposium includes all aspects of the design, semantics, theory, application, implementation, and teaching of Haskell. Topics of interest include, but are not limited to, the following: * Language Design, with a focus on possible extensions and modifications of Haskell as well as critical discussions of the status quo; * Theory, in the form of a formal treatment of the semantics of the present language or future extensions, type systems, and foundations for program analysis and transformation; * Implementations, including program analysis and transformation, static and dynamic compilation for sequential, parallel, and distributed architectures, memory management as well as foreign function and component interfaces; * Tools, in the form of profilers, tracers, debuggers, pre-processors, and so forth; * Applications, Practice, and Experience, with Haskell for scientific and symbolic computing, database, multimedia and Web applications, and so forth as well as general experience with Haskell in education and industry; * Functional Pearls, being elegant, instructive examples of using Haskell. Papers in the latter two categories need not necessarily report original research results; they may instead, for example, report practical experience that will be useful to others, re-usable programming idioms, or elegant new ways of approaching a problem. The key criterion for such a paper is that it makes a contribution from which other practitioners can benefit. It is not enough simply to describe a program! Before 2008, the Haskell Symposium was known as the Haskell Workshop. The name change reflects the steady increase of influence of the Haskell Workshop on the wider community, as well as an increasing numbers of high quality submissions making the acceptance process highly competitive. Previously, Haskell Workshops have been held in La Jolla (1995), Amsterdam (1997), Paris (1999), Montreal (2000), Firenze (2001), Pittsburgh (2002), Uppsala (2003), Snowbird (2004), Tallinn (2005), Portland, Oregon (2006), Freiburg (2007). Submission Details * Submission Deadline: Monday, June 23rd 2008 (9:00 am, Samoa Standard Time, UTC -11) * Author Notification: Friday, July 18th 2008 * Final Papers Due: Monday, July 28th 2008 Submitted papers should be in portable document format (PDF), formatted using the ACM SIGPLAN style guidelines (http://www.acm.org/sigs/sigplan/authorInformation.htm). The length is restricted to 12 pages, and the font size 9pt. Each submission must adhere to SIGPLAN's republication policy, as explained on the web. Violation risks summary rejection of the offending submission. Paper submissions can be made via the easychair webpage http://www.easychair.org/conferences/?conf=haskell08 Accepted papers will be published by the ACM and will appear in the ACM Digital Library. If there is sufficient demand, we will try to organize a time slot for system or tool demonstrations. If you are interested in demonstrating a Haskell related tool or application, please send a brief demo proposal to Andy Gill, andy@REDACTED Links * http://haskell.org/haskell-symposium, the permanent homepage of the Haskell Symposium. * http://haskell.org/haskell-symposium/2008, the 2008 Haskell Symposium web page. * http://www.icfpconference.org/icfp2008, the ICFP 2008 web page. Program Committee * Arthur Baars, Instituto Tecnologico de Informatica, Valencia, Spain * Jeremy Gibbons, Oxford University, UK * Andy Gill, Galois, USA (Program Chair) * William Harrison, University of Missouri, Columbia, USA * Roman Leshchinskiy, University of New South Wales, Australia * Bernie Pope, University of Melbourne, Australia * Colin Runciman, University of York, UK * Tim Sheard, Portland State University, USA * Mary Sheeran, Chalmers University of Technology, Sweden * Satnam Singh, Microsoft Research, UK * Wouter Swierstra, Nottingham University, UK * Varmo Vene, University of Tartu, Estonia From dgud@REDACTED Wed Apr 23 08:11:33 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Wed, 23 Apr 2008 08:11:33 +0200 Subject: [erlang-questions] wxerlang and linux In-Reply-To: <1ffe809c0804210641y199c8f94y8a4c87e639e038e@mail.gmail.com> References: <1208545695.5947.11.camel@ubuntu-life-vm> <480C47B2.2050406@erix.ericsson.se> <1ffe809c0804210641y199c8f94y8a4c87e639e038e@mail.gmail.com> Message-ID: <480ED315.4010408@erix.ericsson.se> Thanks, I have not had time to test on 64bits machines yet, I'll take a look when I have time. /Dan Pablo Polvorin wrote: > Hi, I've got some problems to compile wxerlang with gcc 4.1.3 in a amd64 box. > The problem was: > wxe_impl.cpp:205: error: cast from 'wxeMemEnv*' to 'int' loses precision > wxe_impl.cpp:205: error: cast from 'wxeMemEnv*' to 'int' loses precision > > The (possible wrong, I'm not a c guru) solution I found to work was to > change those cast in line 205 to look like this: > (int)(intptr_t) cb_mem > (int)(intptr_t) app->call_back_mem > > cheers! > > > > 2008/4/21, Dan Gudmundsson : >> Arrgh, The installer doesn't install the driver on unix :-( >> Copy the priv dir to wherever you installed it. >> >> Thanks for the bug report. >> >> >> /Dan >> >> >> Bob Cowdery wrote: >> > Hi >> > >> > Has anyone set up wxwidgets on Ubuntu? I'm trying to port my wxerlang >> > code to Linux and I just get an enoent error from wx:new(). As far as I >> > can see everything wx wise is installed correctly in /usr/lib and >> > wx-config reports sensible things. >> > >> > Any help appreciated. >> > >> > Bob >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > From bengt.kleberg@REDACTED Wed Apr 23 08:12:31 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 23 Apr 2008 08:12:31 +0200 Subject: [erlang-questions] compile error in LINUX 2.6 : "Fatal, could not get clock_monotonic value!, errno = 22" In-Reply-To: References: Message-ID: <1208931151.18875.22.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Just to make things clear: erlc is only a compiler. It will not give you a shell. To compile from the erlang shell you could use the shell builtin c() or compile:file/1 bengt On Tue, 2008-04-22 at 14:53 -0700, Nageshwar Bajamahal wrote: > Hi Mattew, > > > > Yes, this problem is happening all the time when I am trying to > compile. > > > > When I type erlc, I do not get any erl prompt or any erl shell prompt? > > I am not sure if I am missing some thing here. > > > > Please see the output of strace erlc below and let me know how I could > get erlang up and running. > > > > Thank you, > > Nageshwar > > > > The Linux distribution that I have is Gentoo Base System version > 1.6.13 > > > > >>>>>>>>>>>>>>>>>>>> UNAME ?a output <<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > -> Linux lxlogin-3-300 2.6.22.4 #1 SMP Tue Aug 21 17:47:29 PDT 2007 > i686 Dual Core AMD Opteron(tm) Processor 2212 AuthenticAMD GNU/Linux > > > > >>>>>>>>>>>>>>>>>>>> strace ?c erlc output > <<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > lxlogin-3-300:/home/nbajamah/utils/otp_src_R12B-2> strace -c erlc > > Process 14931 detached > > % time seconds usecs/call calls errors syscall > > ------ ----------- ----------- --------- --------- ---------------- > > nan 0.000000 0 5 read > > nan 0.000000 0 7 1 open > > nan 0.000000 0 6 close > > nan 0.000000 0 1 execve > > nan 0.000000 0 4 brk > > nan 0.000000 0 1 munmap > > nan 0.000000 0 1 uname > > nan 0.000000 0 1 getcwd > > nan 0.000000 0 12 mmap2 > > nan 0.000000 0 5 fstat64 > > ------ ----------- ----------- --------- --------- ---------------- > > 100.00 0.000000 43 1 total > > lxlogin-3-300:/home/nbajamah/utils/otp_src_R12B-2> > > > > >>>>>>>>>>>>>>>>>>>> strace erlc <<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > lxlogin-3-300:/home/nbajamah/utils/otp_src_R12B-2> strace erlc > > execve("/home/nbajamah/utils/otp_src_R12B-2/bin/i686-pc-linux-gnu/erlc", ["erlc"], [/* 37 vars */]) = 0 > > uname({sys="Linux", node="lxlogin-3-300", ...}) = 0 > > brk(0) = 0x804b000 > > mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0xf7f6c000 > > open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or > directory) > > open("/etc/ld.so.cache", O_RDONLY) = 3 > > fstat64(3, {st_mode=S_IFREG|0644, st_size=167968, ...}) = 0 > > mmap2(NULL, 167968, PROT_READ, MAP_PRIVATE, 3, 0) = 0xf7f42000 > > close(3) = 0 > > open("/lib/libutil.so.1", O_RDONLY) = 3 > > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\r\0"..., > 512) = 512 > > fstat64(3, {st_mode=S_IFREG|0755, st_size=11057, ...}) = 0 > > mmap2(NULL, 10588, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = > 0xf7f3f000 > > mmap2(0xf7f41000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, > 3, 0x1) = 0xf7f41000 > > close(3) = 0 > > open("/lib/libdl.so.2", O_RDONLY) = 3 > > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\33"..., > 512) = 512 > > fstat64(3, {st_mode=S_IFREG|0755, st_size=13704, ...}) = 0 > > mmap2(NULL, 12248, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = > 0xf7f3c000 > > mmap2(0xf7f3e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, > 3, 0x1) = 0xf7f3e000 > > close(3) = 0 > > open("/lib/libm.so.6", O_RDONLY) = 3 > > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\3004\0"..., > 512) = 512 > > fstat64(3, {st_mode=S_IFREG|0755, st_size=187087, ...}) = 0 > > mmap2(NULL, 137120, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = > 0xf7f1a000 > > mmap2(0xf7f3b000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, > 3, 0x20) = 0xf7f3b000 > > close(3) = 0 > > open("/lib/libc.so.6", O_RDONLY) = 3 > > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200^\1"..., > 512) = 512 > > fstat64(3, {st_mode=S_IFREG|0755, st_size=1488107, ...}) = 0 > > mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0xf7f19000 > > mmap2(NULL, 1251492, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = > 0xf7de7000 > > mmap2(0xf7f13000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, > 3, 0x12b) = 0xf7f13000 > > mmap2(0xf7f16000, 10404, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED| > MAP_ANONYMOUS, -1, 0) = 0xf7f16000 > > close(3) = 0 > > munmap(0xf7f42000, 167968) = 0 > > open("/dev/urandom", O_RDONLY) = 3 > > read(3, "\337,\263a\0373\317\231\374\274\f\267\224\3\306\223\377"..., > 32) = 32 > > close(3) = 0 > > brk(0) = 0x804b000 > > brk(0x806c000) = 0x806c000 > > brk(0) = 0x806c000 > > getcwd("/home/nbajamah/utils/otp_src_R12B-2", 4096) = 36 > > _exit(0) = ? > > Process 15608 detached > > > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>> compile error > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > > > make[2]: Entering directory > `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools' > > === Entering application parsetools > > make[3]: Entering directory > `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools/src' > > erlc -W +debug_info +warn_obsolete_guard > -I/home/nbajamah/utils/otp_src_R12B-2/lib/stdlib/include -o../ebin > yecc.erl > > Fatal, could not get clock_monotonic value!, errno = 22 > > make[3]: *** [../ebin/yecc.beam] Aborted > > make[3]: Leaving directory > `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools/src' > > make[2]: *** [opt] Error 2 > > make[2]: Leaving directory > `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools' > > make[1]: *** [opt] Error 2 > > make[1]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib' > > make: *** [secondary_bootstrap_build] Error 2 > > > > > > > > > > -----Original Message----- > From: Matthew Dempsky [mailto:matthew@REDACTED] > Sent: Tuesday, April 22, 2008 1:38 AM > To: Nageshwar Bajamahal > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] compile error in LINUX 2.6 : "Fatal, > could not get clock_monotonic value!, errno = 22" > > > > 2008/4/21 Nageshwar Bajamahal : > > > erlc -W +debug_info +warn_obsolete_guard > > > -I/home/nbajamah/utils/otp_src_R12B-2/lib/stdlib/include -o../ebin > yecc.erl > > > > > > Fatal, could not get clock_monotonic value!, errno = 22 > > > > Is this repeatable? What if you just run "erlc"? If so, what's the > > output of "strace erlc" (particularly calls to the clock_gettime > > syscalls)? > > > > Is there anything unusual about this Linux host? E.g., is it using > > any virtualization or an embedded system without a real-time clock? > > What Linux distribution are you using? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bjorn@REDACTED Wed Apr 23 09:38:08 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Apr 2008 09:38:08 +0200 Subject: [erlang-questions] [clarify] Are private ets optimized? In-Reply-To: <14f0e3620804221354w2d3d100bm2dfed421ae50c67f@mail.gmail.com> References: <14f0e3620804221354w2d3d100bm2dfed421ae50c67f@mail.gmail.com> Message-ID: "Gleb Peregud" writes: > Hello > > 1) As far as i know, data from ets'es is copied from ets to process > heap every time it is accessed. Are ets'es with private flag optimized > - do VM still copy data back and forth? No, there is no optimization. Data is copied. > 2) How data saved with set() behaves when accessed with get() ? Does > it need copying? No copying is done. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Wed Apr 23 09:47:49 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Apr 2008 09:47:49 +0200 Subject: [erlang-questions] compile error in LINUX 2.6 : "Fatal, could not get clock_monotonic value!, errno = 22" In-Reply-To: References: Message-ID: Nageshwar Bajamahal writes: > HI > > I am trying to compile erlang source code on a linux box > > ---------------------- details of my machine -------------------- > Linux lxlogin-3-300 2.6.22.4 #1 SMP Tue Aug 21 17:47:29 PDT 2007 i686 Dual-Core AMD Opteron(tm) Processor 2212 AuthenticAMD GNU/Linux > > ---------------------- compile error ----------------------------------- > erlc -W +debug_info +warn_obsolete_guard -I/home/nbajamah/utils/otp_src_R12B-2/lib/stdlib/include -o../ebin yecc.erl > Fatal, could not get clock_monotonic value!, errno = 22 > make[3]: *** [../ebin/yecc.beam] Aborted > make[3]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools/src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib/parsetools' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/home/nbajamah/utils/otp_src_R12B-2/lib' > make: *** [secondary_bootstrap_build] Error 2 Disabling the compensation for sudden changes in system time will probably resolve this issue. It can be done like this: erl +c To make erlc start with the 'erl' with the +c flag, either do export ERLC_EMULATOR='erl +c' OR export ERL_FLAGS='+c' /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From alexander.lamb@REDACTED Wed Apr 23 10:53:36 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 23 Apr 2008 10:53:36 +0200 Subject: [erlang-questions] Sorting a list according to another list Message-ID: <317C5A94-FE70-4BFE-BDB2-8D6F2545D41A@rodanotech.ch> Hello List, I have a list of tuples: [ {Type,Item,Value}, ... ] that I would like to sort according to another list of tuples, using Type and Item as keys. I didn't manage to use two keys so here is how I did it: ps_sort_features(Features,Template) -> Find = fun(F,Acc) -> {_Type,Item,_Value} = F, case lists:keytake(Item,2,Features) of {value, Feature, _Remaining} -> lists:append(Acc,[Feature]); false -> Acc end end, lists:foldl(Find,[],Template). Does this seem ok? I basically take the Template (my reference list) and use a foldl function to Find occurences of Features from Template. Features can be a subset of Template. Also, Value may be different so my resulting list has to be a reordered Features list. In summary, I am reordering Features by following the order of Type and Item in Template. Isn't this a very common situation? Thanks, Alex From ulf.wiger@REDACTED Wed Apr 23 11:12:12 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 23 Apr 2008 11:12:12 +0200 Subject: [erlang-questions] Sorting a list according to another list In-Reply-To: <317C5A94-FE70-4BFE-BDB2-8D6F2545D41A@rodanotech.ch> References: <317C5A94-FE70-4BFE-BDB2-8D6F2545D41A@rodanotech.ch> Message-ID: <480EFD6C.1030807@ericsson.com> Alexander Lamb skrev: > Hello List, > > I have a list of tuples: > > [ {Type,Item,Value}, ... ] > > that I would like to sort according to another list of tuples, using > Type and Item as keys. [...] > > Isn't this a very common situation? I've come across it every once in a while... I guess there are a few different scenarios: A The unsorted list must only contain keys that are in the reference list B Items not found in the reference list can be appended to the sorted list C The list to be sorted is "semi-sorted", in that the algorithm should preserve order as far as possible ... A fairly complex version of C can be found in systools_make:sort_appls/1 in OTP's SASL application. It tries to sort a list of applications, preserving the existing order as far as possible, while still preserving dependency restrictions. A version of B could be (not tested or compiled): sort(L, Keys, KeyPos) -> {Sorted, Tail} = lists:foldl( fun(K, {L1, Rest}) -> {L1 ++ [X || X <- Rest, element(KeyPos,X) == K], [X || X <- Rest, element(KeyPos,X) =/= K]} end, {[], L}, Keys), Sorted ++ Tail. AFAIK, lists:keytake/3 only exists in OTP R12B. lists:keydelete/3 only deletes the first occurrence of the key. BR, Ulf W From ulf.wiger@REDACTED Wed Apr 23 11:31:12 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 23 Apr 2008 11:31:12 +0200 Subject: [erlang-questions] CBSE anybody In-Reply-To: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> References: <9b08084c0804090154p7b1cfd7egb1466c052c9e6d84@mail.gmail.com> Message-ID: <480F01E0.8020103@ericsson.com> Joe Armstrong skrev: > Pardon my ignorance but ... [...] > The highest level should be a drag and draw gui thingy to describe the > interconnection > between components. UML has a notation for this (it has a notation for > *everything*) which could be cannibalized. > > > Does anybody have experience with this kind of way of building > software - there seems to be a vast > literature - I search turned up book titles like > - > UML Components: A Simple Process for Specifying Component-Based > Software (Cheesman and Daniels) > ... I found this paper from 1999 on using UML for describing system architecture: Describing Software Architecture with UML - Hofmeister, Nord et al. http://citeseer.ist.psu.edu/cache/papers/cs/15435/http:zSzzSzwww.scr.siemens.comzSzpdfzSzUsingUML-unix.pdf/hofmeister99describing.pdf A quote from the summary of Hofmeister's paper: "An important concern we have about using UML to describe software architecture is that the same notation can have a wide range of semantics. We use the same basic diagram, the UML Class/Object diagram to show most of the aspects of the architecture. We use stereotypes and special symbols to minimize the confusion between different views. "The more traditional use of UML is for the design of implementation classes for a system. We are also concerned that by using the same notation to describe the software architecture, we run the risk of further blurring the distinction between the architecture and the implementation. This is another reason to consistently use particular conventions, stereotypes, and special symbols for these architecture diagrams. "In summary, we found UML deficient in describing: ? correspondences: A graphical notation is too cumbersome for straightforward mappings such as the correspondence between elements in different views. This information is more efficiently described in a table (e.g.Table 3). ? protocols: The ability to show peer-to-peer communication is missing from UML. We used ROOM to describe protocols (e.g. Figure 2). ? ports on components: We used nesting to show the relationship between ports and components, but this is visually somewhat misleading. We would prefer a notation more similar to the lollipop notation for the interfaces of a module. ? dynamic aspects of the structure ? a general sequence of activities "UML worked well for describing: ? the static structure of the architecture ? variability: e.g. the conceptual configuration in Figure 1 describes the structure of a set of pipelines. ? a particular sequence of activities: e.g. the start-up behavior of an Image Pipeline (Figure 6)." This corresponds well with my own impression of UML, but a lot has happened in UML 2.0. Does anyone have a good reference to experiences on how these deficiencies are addressed by UML 2.0? Here's a short paper on FMC by Frank Keller: FMC: An Approach towards Architecture-Centric System Development (2003) Frank Keller, Siegfried Wendt http://citeseer.ist.psu.edu/keller03fmc.html Keller's paper included the following note on model consistency: "The problem of keeping architecture and design models in a synchronous state with the ?real world? artefacts is often mentioned. Our experiences show that the low level design models of the software and the hardware categories should reflect the current state of the development. Those models serve the purpose of detailed communication among the developers or engineers. If they are not aligned with the sources or the hardware implementation, they do not fulfill their purpose. This is in contrast to conceptual models on higher levels of abstraction. Once those models are in place, they usually do not change drastically over time. Experience shows that the integrity and consistency of architecture models can be sufficiently ensured by an appropriate development process [37]. Nevertheless, a well suited tool support would help to keep the architectural models up to date." (pg 9) This got me thinking: model consistency is often touted as a very big thing, but most Erlang projects tend to maintain their models by hand, for lack of a better tool. If we think that the type of modeling most needed for Erlang projects is something like FMC, and FMC gurus claim that this particular type of models are unlikely to change over time, one might conclude that the current practice of manually maintaining models for Erlang is not such a disaster after all... (: Assuming this is true, the first priority should be to establish an agreement on how best to describe the architecture of Erlang programs. We shouldn't be too worried about round-trip engineering support - at least not for now. BR, Ulf W From wenewboy@REDACTED Wed Apr 23 12:03:21 2008 From: wenewboy@REDACTED (wenew zhang) Date: Wed, 23 Apr 2008 18:03:21 +0800 Subject: [erlang-questions] ets:select_count & ets:fun2ms problems Message-ID: <4eaa09eb0804230303y53b11d1es5aaf8918733157b2@mail.gmail.com> In the erl shell,i input as below *********begin******************* Tab=ets:new(client,[set,{keypos,1}]). ets:insert(Tab,{1,1}). ets:insert(Tab,{2,2}). ets:insert(Tab,{5,5}). ets:insert(Tab,{3,3}). ets:insert(Tab,{4,4}). ets:fun2ms(fun({M,N}) when N>3 ->M,N end). ets:select_count(Tab,[{{'$1','$2'},[{'>','$2',1}],['$1','$2']}]). *********end******************* the last line return 0, i want get the count of the ets:Tab when column 2>1, if i want get Max column2's record([5,5]),how to do ? Best Regards Wenew Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.lamb@REDACTED Wed Apr 23 12:06:35 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 23 Apr 2008 12:06:35 +0200 Subject: [erlang-questions] Sorting a list according to another list In-Reply-To: <480EFD6C.1030807@ericsson.com> References: <317C5A94-FE70-4BFE-BDB2-8D6F2545D41A@rodanotech.ch> <480EFD6C.1030807@ericsson.com> Message-ID: <29058B37-69B5-49D5-ABAB-66312FBE1556@rodanotech.ch> Thanks a lot, (you code is obviously much more efficient than mine:-) My situation is clearly B from your examples. So I tried your code. It works (except I changed the "==" with "=:=" under the assumption that "when not certain, use =:=" But now I tried to be smart and add a second test (I would like to test key at position 1 and 2 in the tuples). So here is what I did: ps_sort_features2(Features,Template) -> {Sorted, Tail} = lists:foldl( fun(Feature, {L1, Rest}) -> {L1 ++ [X || X <- Rest, element(1,X) =:= element(1,Feature) , element(2,X) =:= element(2,Feature)], [X || X <- Rest, element(1,X) =/= element(1,Feature) or element(2,X) =/= element(2,Feature)]} end, {[], Features}, Template), Sorted ++ Tail. Now this does not work. It doens't like the "or" in the second list comprehension. What I was trying to do is accumulate in L1 all element which match keypos 1 and 2 (using the comma) and accumulate in Rest all elements which don't match either keypos1 or keypos2. So, how do I express a "or" in a list comprehension? Alex Le 23 avr. 08 ? 11:12, Ulf Wiger (TN/EAB) a ?crit : > Alexander Lamb skrev: >> Hello List, >> I have a list of tuples: >> [ {Type,Item,Value}, ... ] >> that I would like to sort according to another list of tuples, >> using Type and Item as keys. > [...] >> Isn't this a very common situation? > > I've come across it every once in a while... > > I guess there are a few different scenarios: > > A The unsorted list must only contain keys that are > in the reference list > B Items not found in the reference list can be appended > to the sorted list > C The list to be sorted is "semi-sorted", in that the > algorithm should preserve order as far as possible > ... > > A fairly complex version of C can be found in > systools_make:sort_appls/1 in OTP's SASL application. > It tries to sort a list of applications, preserving > the existing order as far as possible, while still > preserving dependency restrictions. > > A version of B could be (not tested or compiled): > > sort(L, Keys, KeyPos) -> > {Sorted, Tail} = > lists:foldl( > fun(K, {L1, Rest}) -> > {L1 ++ [X || X <- Rest, > element(KeyPos,X) == K], > [X || X <- Rest, > element(KeyPos,X) =/= K]} > end, {[], L}, Keys), > Sorted ++ Tail. > > AFAIK, lists:keytake/3 only exists in OTP R12B. > lists:keydelete/3 only deletes the first occurrence > of the key. > > BR, > Ulf W > From rodrigobamboo@REDACTED Wed Apr 23 12:26:45 2008 From: rodrigobamboo@REDACTED (Rodrigo B. de Oliveira) Date: Wed, 23 Apr 2008 07:26:45 -0300 Subject: [erlang-questions] Sorting a list according to another list In-Reply-To: <29058B37-69B5-49D5-ABAB-66312FBE1556@rodanotech.ch> References: <317C5A94-FE70-4BFE-BDB2-8D6F2545D41A@rodanotech.ch> <480EFD6C.1030807@ericsson.com> <29058B37-69B5-49D5-ABAB-66312FBE1556@rodanotech.ch> Message-ID: <5917478b0804230326g27a5a389r13d51f2fd6b90aa8@mail.gmail.com> On Wed, Apr 23, 2008 at 7:06 AM, Alexander Lamb wrote: > ... > So, how do I express a "or" in a list comprehension? > Using parens around 'or' operands seems to work. From alexander.lamb@REDACTED Wed Apr 23 12:32:56 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 23 Apr 2008 12:32:56 +0200 Subject: [erlang-questions] Sorting a list according to another list In-Reply-To: <5917478b0804230326g27a5a389r13d51f2fd6b90aa8@mail.gmail.com> References: <317C5A94-FE70-4BFE-BDB2-8D6F2545D41A@rodanotech.ch> <480EFD6C.1030807@ericsson.com> <29058B37-69B5-49D5-ABAB-66312FBE1556@rodanotech.ch> <5917478b0804230326g27a5a389r13d51f2fd6b90aa8@mail.gmail.com> Message-ID: Yes, perfect, a simple question of operands precedence! Now it all works fine!! Alex Le 23 avr. 08 ? 12:26, Rodrigo B. de Oliveira a ?crit : > On Wed, Apr 23, 2008 at 7:06 AM, Alexander Lamb > wrote: >> ... >> So, how do I express a "or" in a list comprehension? >> > > Using parens around 'or' operands seems to work. > From saleyn@REDACTED Wed Apr 23 12:35:31 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 23 Apr 2008 06:35:31 -0400 Subject: [erlang-questions] ets:select_count & ets:fun2ms problems In-Reply-To: <4eaa09eb0804230303y53b11d1es5aaf8918733157b2@mail.gmail.com> References: <4eaa09eb0804230303y53b11d1es5aaf8918733157b2@mail.gmail.com> Message-ID: <480F10F3.4060605@gmail.com> For select_count you need to use a different MatchSpec: ets:fun2ms(fun({M,N}) when N>3 -> true end). wenew zhang wrote: > In the erl shell,i input as below > *********begin******************* > Tab=ets:new(client,[set,{keypos,1}]). > ets:insert(Tab,{1,1}). > ets:insert(Tab,{2,2}). > ets:insert(Tab,{5,5}). > ets:insert(Tab,{3,3}). > ets:insert(Tab,{4,4}). > ets:fun2ms(fun({M,N}) when N>3 ->M,N end). > ets:select_count(Tab,[{{'$1','$2'},[{'>','$2',1}],['$1','$2']}]). > *********end******************* > the last line return 0, > i want get the count of the ets:Tab when column 2>1, > if i want get Max column2's record([5,5]),how to do ? > > Best Regards > > Wenew Zhang > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From wenewboy@REDACTED Wed Apr 23 12:48:12 2008 From: wenewboy@REDACTED (wenew zhang) Date: Wed, 23 Apr 2008 18:48:12 +0800 Subject: [erlang-questions] ets:select_count & ets:fun2ms problems In-Reply-To: <480F10F3.4060605@gmail.com> References: <4eaa09eb0804230303y53b11d1es5aaf8918733157b2@mail.gmail.com> <480F10F3.4060605@gmail.com> Message-ID: <4eaa09eb0804230348w9f50576jaf93a50442af21fc@mail.gmail.com> 13> ets:select_count(Tab,[{{'$1','$2'},[{'>','$2',1}],[true]}]). 4 yes,it's works,thank you very much! Best Regards Wenew Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitriid@REDACTED Wed Apr 23 14:10:20 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Wed, 23 Apr 2008 15:10:20 +0300 Subject: [erlang-questions] Sending email from erlang Message-ID: <99374689-2A3F-48C6-AFBE-0A1664187404@gmail.com> Hi all. What do you use to send email from Erlang? Especially when smtp requires authorization? From ulf.wiger@REDACTED Wed Apr 23 14:26:44 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 23 Apr 2008 14:26:44 +0200 Subject: [erlang-questions] Sending email from erlang In-Reply-To: <99374689-2A3F-48C6-AFBE-0A1664187404@gmail.com> References: <99374689-2A3F-48C6-AFBE-0A1664187404@gmail.com> Message-ID: <480F2B04.3060702@ericsson.com> Dmitrii Dimandt skrev: > Hi all. > > What do you use to send email from Erlang? Especially when smtp > requires authorization? Have you tried smtpc in erlmail? http://code.google.com/p/erlmail/source/browse/trunk/src/smtpc.erl (I haven't, and am curious to know how well it works.) BR, Ulf W From dmitriid@REDACTED Wed Apr 23 14:58:49 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Wed, 23 Apr 2008 15:58:49 +0300 Subject: [erlang-questions] Sending email from erlang In-Reply-To: <480F2B04.3060702@ericsson.com> References: <99374689-2A3F-48C6-AFBE-0A1664187404@gmail.com> <480F2B04.3060702@ericsson.com> Message-ID: On Apr 23, 2008, at 3:26 PM, Ulf Wiger (TN/EAB) wrote: > Dmitrii Dimandt skrev: >> Hi all. >> What do you use to send email from Erlang? Especially when smtp >> requires authorization? > > Have you tried smtpc in erlmail? > > http://code.google.com/p/erlmail/source/browse/trunk/src/smtpc.erl > > (I haven't, and am curious to know how well it works.) > > BR, > Ulf W I haven't tried it yet. I aw that none of the smtp libs support authentication, so I'm battling postfix on my Macbook trying to make it work From alexander.lamb@REDACTED Wed Apr 23 14:59:38 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 23 Apr 2008 14:59:38 +0200 Subject: [erlang-questions] Strategies to connect from Java Message-ID: Hello List, Now that I have my first 3 Erlang modules (I think I may have reached the "aha point") and looking forward to the conference in London in June where I hope I will gain some OTP knowledge, I would like to connect to those modules from Java. Yes, since we live in an non perfect world, we are using Java with Tapestry as our Web environnement (a very powerfull library, but that is another matter). Each user, when login in, will create a session and start working. I am therefore writing some Java classes to call my Erlang functions. The Java api is the one supplied with R12 version of Erlang. Now, I imagine there are 3 possibilities: A) Each time I call a function, create a new OtpConnection to the Erlang node, once done, close the connection. B) The first time I call a function, create a new OtpConnection to the Erlang node, leave it open until the app is stoped. The scope of the connection would be for the entire application deployed in a container (e.g. Tomcat). In a situation with more than one app server (for a cluster for example), there would be one OtpConnection per server. C) The first time I call a function from a session, create a new OtpConnection. Close the connection when the user logs out or the session times out. Solution A is obviously the most "no side effects compatible" but might be really slow. In addition, I need to be carefull when trying to create two connections at the same time from two separate Java threads... so either I create a connection per thread or I lock (defeats the purpose of Erlang). Solution B is maybe slightly better since I could create the connection when starting the Java server. I still have the locking issues, though. Solution C seems good and scales in terms of parallelism, but it leads to 2 questions: 1) How many connections can I make from Java before running out of file descriptors or whatever is needed to handle connections? In our current business, I don't see more than 200 concurent users before many months... 2) If I only need to initiate function calls (e.g. the Erlang modules don't need to call me), I don't need to create (I assume) a node for the Java client. However, if at some point, I need to be called from Erlang, I will need to generate a new node name (and a new OtpSelf) for each new session. Is this correct? Thanks for any hints... Alex -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From raimo+erlang-questions@REDACTED Wed Apr 23 16:00:23 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 23 Apr 2008 16:00:23 +0200 Subject: [erlang-questions] Strategies to connect from Java In-Reply-To: References: Message-ID: <20080423140023.GA31459@erix.ericsson.se> On Wed, Apr 23, 2008 at 02:59:38PM +0200, Alexander Lamb wrote: > Hello List, > > Now that I have my first 3 Erlang modules (I think I may have reached > the "aha point") and looking forward to the conference in London in > June where I hope I will gain some OTP knowledge, I would like to > connect to those modules from Java. > > Yes, since we live in an non perfect world, we are using Java with > Tapestry as our Web environnement (a very powerfull library, but that > is another matter). > Each user, when login in, will create a session and start working. > > I am therefore writing some Java classes to call my Erlang functions. > The Java api is the one supplied with R12 version of Erlang. > The Java api (Jinterface) is modelled after how Erlang itself handles nodes and connections. The node map is supposed to be static and rather few nodes. There has e.g been a bug with auto generated node names that did not allow more than some 250 external node names ever from a node's point of view. That was a memory leak that has been fixed, but it was no problem for many years since the applications simply did not use many node names. So, few nodes. They connect when started and disconnect when they die. Nodes are long lived. Jinterface mailboxes corresponds to Pids in Erlang. They can be created and destroyed rather frequently while the connection between the nodes remain. > Now, I imagine there are 3 possibilities: > > A) > Each time I call a function, create a new OtpConnection to the Erlang > node, once done, close the connection. > Very expensive. > B) > The first time I call a function, create a new OtpConnection to the > Erlang node, leave it open until the app is stoped. The scope of the > connection would be for the entire application deployed in a container > (e.g. Tomcat). In a situation with more than one app server (for a > cluster for example), there would be one OtpConnection per server. > Sounds nice. Long lived nodes. > C) > The first time I call a function from a session, create a new > OtpConnection. Close the connection when the user logs out or the > session times out. > One OtpNode per session. You will have to auto generate the node names as seen from Erlang. A rather unnatural mapping. > > Solution A is obviously the most "no side effects compatible" but > might be really slow. In addition, I need to be carefull when trying > to create two connections at the same time from two separate Java > threads... so either I create a connection per thread or I lock > (defeats the purpose of Erlang). > > Solution B is maybe slightly better since I could create the > connection when starting the Java server. I still have the locking > issues, though. > I do not know if Jinterface has been written with thread locking in mind. This sounds as the most natural mapping, though; a few static OtpNodes. > Solution C seems good and scales in terms of parallelism, but it leads > to 2 questions: > > 1) > How many connections can I make from Java before running out of file > descriptors or whatever is needed to handle connections? In our > current business, I don't see more than 200 concurent users before > many months... > The OS sets the limit. The Java machine may have a say too. Each created OtpNode will use at least 1 socket to the Erlang node, and probably 1 towards the local Epmd. > 2) > If I only need to initiate function calls (e.g. the Erlang modules > don't need to call me), I don't need to create (I assume) a node for > the Java client. However, if at some point, I need to be called from > Erlang, I will need to generate a new node name (and a new OtpSelf) > for each new session. Is this correct? > No. Erlang will only communicate with other nodes. And a node is long lived. Even to just send a message it goes from Jinterface Mailbox to Erlang pid and the Jinterface Mailbox exists only in an OtpNode just as the Erlang pid exists only in an Erlang node. > Thanks for any hints... > > Alex > -- > Alexander Lamb > Founding Associate > RODANOTECH S?rl > > 4 ch. de la Tour de Champel > 1206 Geneva > Switzerland > > Tel: 022 347 77 37 > Fax: 022 347 77 38 > > http://www.rodanotech.ch > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From gleber.p@REDACTED Wed Apr 23 16:41:18 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 23 Apr 2008 16:41:18 +0200 Subject: [erlang-questions] [clarify] Are private ets optimized? In-Reply-To: References: <14f0e3620804221354w2d3d100bm2dfed421ae50c67f@mail.gmail.com> <14f0e3620804230352q4c428d7h73d410dcbaed2aa3@mail.gmail.com> Message-ID: <14f0e3620804230741r3e35589cg6d9143e8c307db51@mail.gmail.com> On Wed, Apr 23, 2008 at 4:09 PM, Bjorn Gustavsson wrote: > "Gleb Peregud" writes: > > May I ask is it doable (in finite and reasonable time) to introduce > > such optimization for private ets'es? Probably it will speed up some > > sort of tasks, eg. in data mining, where a lot of records is to be > > analyzed. > > We have tried it and we could not find any significant improvements > in performance; in many cases it was slower. The reason is that there > will be copying when the process is garbage-collected (the garbage collector > is generational, so all of the data will not be copied every time, but > often enough to eliminate the potential performance benefits). Thanks a lot for the clarification. I'll Cc to EQ for others to get benefit of this information :) > > > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From sten@REDACTED Wed Apr 23 16:58:07 2008 From: sten@REDACTED (Sten Kvamme) Date: Wed, 23 Apr 2008 16:58:07 +0200 Subject: [erlang-questions] ex11 ePutImage In-Reply-To: <514C0485-20C7-4BC5-932C-A81AF393ED40@kvamme.se> References: <514C0485-20C7-4BC5-932C-A81AF393ED40@kvamme.se> Message-ID: Hi, It's a bad habit to answer mail from self() but I have solved the ePutImage problem, so you can stop look for old example code now ;-) I simply implemented a getimage function and got a ZPixmap to study. I have never been happier looking at joe smiling from his portrait. Thanks, Sten On Apr 22, 2008, at 20:56 , Sten Kvamme wrote: > Hi, > > I can't get this ePutImage to put any image on screen. When I think I > have all parameters right I get: {error,6291463,14,{length, > 72,0,<<>>}} from the X server. > > I am using: > {ok,{Wbin,Hbin,Data}} = ex11_lib_read_jpeg:file("joe.jpg"), > xDo(Pid, ePutImage(Win, GC, Wbin, Hbin, 1, 1, 0, 24, list_to_binary > (Data))), > > BR, > Sten > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From alexander.lamb@REDACTED Wed Apr 23 18:17:07 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 23 Apr 2008 18:17:07 +0200 Subject: [erlang-questions] Strategies to connect from Java In-Reply-To: <20080423140023.GA31459@erix.ericsson.se> References: <20080423140023.GA31459@erix.ericsson.se> Message-ID: <9DB92E64-3033-4406-8DD9-FB6D43C1C734@rodanotech.ch> Thanks for the details. I will therefore go with solution B (one OtpConnection per app server). We don't have such trafic that we would need more probably. I will check the code to understand if there are threading issues. Not really for performance issues but more to avoid collisions if two user sessions try at the same time to send a message... Alex Le 23 avr. 08 ? 16:00, Raimo Niskanen a ?crit : > On Wed, Apr 23, 2008 at 02:59:38PM +0200, Alexander Lamb wrote: >> Hello List, >> >> Now that I have my first 3 Erlang modules (I think I may have reached >> the "aha point") and looking forward to the conference in London in >> June where I hope I will gain some OTP knowledge, I would like to >> connect to those modules from Java. >> >> Yes, since we live in an non perfect world, we are using Java with >> Tapestry as our Web environnement (a very powerfull library, but that >> is another matter). >> Each user, when login in, will create a session and start working. >> >> I am therefore writing some Java classes to call my Erlang functions. >> The Java api is the one supplied with R12 version of Erlang. >> > > The Java api (Jinterface) is modelled after how Erlang itself > handles nodes and connections. > > The node map is supposed to be static and rather few nodes. > There has e.g been a bug with auto generated node names > that did not allow more than some 250 external node names ever > from a node's point of view. That was a memory leak that > has been fixed, but it was no problem for many years > since the applications simply did not use many node names. > > So, few nodes. They connect when started and disconnect > when they die. Nodes are long lived. > > Jinterface mailboxes corresponds to Pids in Erlang. > They can be created and destroyed rather frequently > while the connection between the nodes remain. > >> Now, I imagine there are 3 possibilities: >> >> A) >> Each time I call a function, create a new OtpConnection to the Erlang >> node, once done, close the connection. >> > > Very expensive. > >> B) >> The first time I call a function, create a new OtpConnection to the >> Erlang node, leave it open until the app is stoped. The scope of the >> connection would be for the entire application deployed in a >> container >> (e.g. Tomcat). In a situation with more than one app server (for a >> cluster for example), there would be one OtpConnection per server. >> > > Sounds nice. Long lived nodes. > >> C) >> The first time I call a function from a session, create a new >> OtpConnection. Close the connection when the user logs out or the >> session times out. >> > > One OtpNode per session. You will have to auto generate the > node names as seen from Erlang. A rather unnatural mapping. > >> >> Solution A is obviously the most "no side effects compatible" but >> might be really slow. In addition, I need to be carefull when trying >> to create two connections at the same time from two separate Java >> threads... so either I create a connection per thread or I lock >> (defeats the purpose of Erlang). >> >> Solution B is maybe slightly better since I could create the >> connection when starting the Java server. I still have the locking >> issues, though. >> > > I do not know if Jinterface has been written with thread locking > in mind. This sounds as the most natural mapping, though; > a few static OtpNodes. > >> Solution C seems good and scales in terms of parallelism, but it >> leads >> to 2 questions: >> >> 1) >> How many connections can I make from Java before running out of file >> descriptors or whatever is needed to handle connections? In our >> current business, I don't see more than 200 concurent users before >> many months... >> > > The OS sets the limit. The Java machine may have a say too. > Each created OtpNode will use at least 1 socket > to the Erlang node, and probably 1 towards the local Epmd. > >> 2) >> If I only need to initiate function calls (e.g. the Erlang modules >> don't need to call me), I don't need to create (I assume) a node for >> the Java client. However, if at some point, I need to be called from >> Erlang, I will need to generate a new node name (and a new OtpSelf) >> for each new session. Is this correct? >> > > No. Erlang will only communicate with other nodes. And a node is > long lived. Even to just send a message it goes from Jinterface > Mailbox to Erlang pid and the Jinterface Mailbox exists only > in an OtpNode just as the Erlang pid exists only in an Erlang node. > >> Thanks for any hints... >> >> Alex >> -- >> Alexander Lamb >> Founding Associate >> RODANOTECH S?rl >> >> 4 ch. de la Tour de Champel >> 1206 Geneva >> Switzerland >> >> Tel: 022 347 77 37 >> Fax: 022 347 77 38 >> >> http://www.rodanotech.ch >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From alexander.lamb@REDACTED Wed Apr 23 18:49:26 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 23 Apr 2008 18:49:26 +0200 Subject: [erlang-questions] JInterface and multi-threading Message-ID: <28F58275-08BF-4904-BA77-0488256394BD@rodanotech.ch> Hello, Now I have a better understanding of JInterface (from previous post answer), I looked into the Java code. It it is not clear to me if rpc from Jinterface is thread safe. Or, in other words, will this be a bottleneck for an application in an app server with many concurent users. Indeed, having only one OtpConnection (which seems logical now), I will need to do rpc calls from potentially simultanious threads. How will this be handled? If one call is taking longer than expected, I will block on connection.receiveRPC(). Is there a correct way to handle this problem? Do I need for example to create a mailbox in a thread for each session in my server? This would allow my Java sesions to run regardless of any other session blocking on a call to the erlang server. Now, obviously, my Erlang server might be blocked but I could create an Erlang process on the server for each client process connecting from Java. What is the correct way to handle those issues. Thanks Alex -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From exta7@REDACTED Wed Apr 23 19:14:25 2008 From: exta7@REDACTED (Zvi) Date: Wed, 23 Apr 2008 10:14:25 -0700 (PDT) Subject: [erlang-questions] Setting node name from the shell started withou -name or -sname Message-ID: <16834718.post@talk.nabble.com> It's possible to set cookie name programmatically, using erlang:set_cookie/2, even if BEAM started without -setcookie flag or .erlang.cookie file. How to set a node name for BEAM started without -name or -sname flags? There is undocumented erlang:setnode/2 BIF, I guess that it's: setnode(NodeName::node(),PortNumber::int()) but still have no idea how to use it. TIA, Zvi -- View this message in context: http://www.nabble.com/Setting-node-name-from-the-shell-started-withou--name-or--sname-tp16834718p16834718.html Sent from the Erlang Questions mailing list archive at Nabble.com. From patrickdlogan@REDACTED Wed Apr 23 19:22:40 2008 From: patrickdlogan@REDACTED (Patrick Logan) Date: Wed, 23 Apr 2008 10:22:40 -0700 Subject: [erlang-questions] xmpp _client_ code in erlang? Message-ID: I am aware of jabberlang, and its replacement exmpp is in the works but I think it is not yet available. Is there any other erlang source around for connecting to an arbitrary xmpp server as a client? i.e. not ejabberd specific - I think jabberlang was tied to ejabberd? Thanks -Patrick From tty.erlang@REDACTED Wed Apr 23 19:26:00 2008 From: tty.erlang@REDACTED (t ty) Date: Wed, 23 Apr 2008 13:26:00 -0400 Subject: [erlang-questions] Setting node name from the shell started withou -name or -sname In-Reply-To: <16834718.post@talk.nabble.com> References: <16834718.post@talk.nabble.com> Message-ID: <290b3ba10804231026r5eda6fbawdd8bc427920aed6e@mail.gmail.com> See net_kernel:start/1 t On Wed, Apr 23, 2008 at 1:14 PM, Zvi wrote: > > It's possible to set cookie name programmatically, using erlang:set_cookie/2, > even if BEAM started without -setcookie flag or .erlang.cookie file. > How to set a node name for BEAM started without -name or -sname flags? > There is undocumented erlang:setnode/2 BIF, I guess that it's: > setnode(NodeName::node(),PortNumber::int()) > but still have no idea how to use it. > > TIA, > Zvi > > -- > View this message in context: http://www.nabble.com/Setting-node-name-from-the-shell-started-withou--name-or--sname-tp16834718p16834718.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From gleber.p@REDACTED Wed Apr 23 19:30:52 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 23 Apr 2008 19:30:52 +0200 Subject: [erlang-questions] Setting node name from the shell started withou -name or -sname In-Reply-To: <16834718.post@talk.nabble.com> References: <16834718.post@talk.nabble.com> Message-ID: <14f0e3620804231030i7e763f2bw40298b88f29f0625@mail.gmail.com> It is enough to: gleber@REDACTED:~$ erl Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.2 (abort with ^G) 1> net_kernel:start([foo, shortnames]). {ok,<0.31.0>} (foo@REDACTED)2> erlang:set_cookie(node(), 'super_secret_cookie'). true (foo@REDACTED)3> On 4/23/08, Zvi wrote: > > It's possible to set cookie name programmatically, using > erlang:set_cookie/2, > even if BEAM started without -setcookie flag or .erlang.cookie file. > How to set a node name for BEAM started without -name or -sname flags? > There is undocumented erlang:setnode/2 BIF, I guess that it's: > setnode(NodeName::node(),PortNumber::int()) > but still have no idea how to use it. > > TIA, > Zvi > > -- > View this message in context: > http://www.nabble.com/Setting-node-name-from-the-shell-started-withou--name-or--sname-tp16834718p16834718.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From maarten@REDACTED Wed Apr 23 19:37:48 2008 From: maarten@REDACTED (Maarten Koopmans) Date: Wed, 23 Apr 2008 19:37:48 +0200 Subject: [erlang-questions] Securing remote spawning Message-ID: <480F73EC.6040201@vrijheid.net> Hi, New to this list and Erlang, and I have a simple question that I couldn't find an answer to in any of the docs: is it possible to restrict the possibility of remote spawning or rpc on a given set of nodes to only a subset of the functions? Because if I think "trust no one" then only cookies for SaaS applications imply that I loose a layer of defense (and have only the firewall left). Especially because the Big Plus with Erlang woudl be using Mnesia as well - but this implies moving all code busines + Db) in the same zone. The only option I can think of is doing all communication socket based with custom protocols/DSLs that limit what you can do. Any help/insights greatly appreciated! --Maarten From maarten@REDACTED Wed Apr 23 16:18:53 2008 From: maarten@REDACTED (Maarten Koopmans) Date: Wed, 23 Apr 2008 16:18:53 +0200 Subject: [erlang-questions] Securing remote spawning Message-ID: <480F454D.1010405@vrijheid.net> Hi, New to this list and Erlang, and I have a simple question that I couldn't find an answer to in any of the docs: is it possible to restrict the possibility of remote spawning or rpc on a given set of nodes to only a subset of the functions? Because if I think "trust no one" then only cookies for SaaS applications imply that I loose a layer of defense (and have only the firewall left). Especially because the Big Plus with Erlang woudl be using Mnesia as well - but this implies moving all code busines + Db) in the same zone. The only option I can think of is doing all communication socket based with custom protocols/DSLs that limit what you can do. Any help/insights greatly appreciated! --Maarten From gleber.p@REDACTED Wed Apr 23 19:59:53 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 23 Apr 2008 19:59:53 +0200 Subject: [erlang-questions] Securing remote spawning In-Reply-To: <480F73EC.6040201@vrijheid.net> References: <480F73EC.6040201@vrijheid.net> Message-ID: <14f0e3620804231059p49b87e8fw72aa0fdbbe8e0ed8@mail.gmail.com> Hi, No. At this moment there is no such mechanism (at least none i heard of). Erlang security is based on simple concept of "secret cookie". If one knows cookie of running node then he gets absolute power over this node. Same goes to inter-node communication - if two nodes share the same cookie they trust each other fully. If it differs - they do not communicate at all. For details see http://www.erlang.org/doc/reference_manual/distributed.html#11.7 Of course you can roll out your own mechanism. For specific task with term_to_binary/1 and binary_to_term/1 is should not be too hard. Also you may want to read this: http://www.trapexit.org/Distributed_erlang_using_ssl_through_firewalls Best regards. On 4/23/08, Maarten Koopmans wrote: > Hi, > > New to this list and Erlang, and I have a simple question that I > couldn't find an answer to in any of the docs: is it possible to > restrict the possibility of remote spawning or rpc on a given set of > nodes to only a subset of the functions? > > Because if I think "trust no one" then only cookies for SaaS > applications imply that I loose a layer of defense (and have only the > firewall left). Especially because the Big Plus with Erlang woudl be > using Mnesia as well - but this implies moving all code busines + Db) in > the same zone. > > The only option I can think of is doing all communication socket based > with custom protocols/DSLs that limit what you can do. > > Any help/insights greatly appreciated! > > --Maarten > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From maarten@REDACTED Wed Apr 23 20:39:36 2008 From: maarten@REDACTED (maarten@REDACTED) Date: Wed, 23 Apr 2008 18:39:36 GMT Subject: [erlang-questions] Securing remote spawning Message-ID: Hi, Thanks, but basically that means that I have to trust the firewall. If somebody gets past the first "layer of defense", they can do more damage. With great power..... --Maarten ---------------------------------- From: "Gleb Peregud" Date: 4/23/08 17:53Subject: Re: [erlang-questions] Securing remote spawning Hi, No. At this moment there is no such mechanism (at least none i heard of). Erlang security is based on simple concept of "secret cookie". If one knows cookie of running node then he gets absolute power over this node. Same goes to inter-node communication - if two nodes share the same cookie they trust each other fully. If it differs - they do not communicate at all. For details see http://www.erlang.org/doc/reference_manual/distributed.html#11.7 Of course you can roll out your own mechanism. For specific task with term_to_binary/1 and binary_to_term/1 is should not be too hard. Also you may want to read this: http://www.trapexit.org/Distributed_erlang_using_ssl_through_firewalls Best regards. On 4/23/08, Maarten Koopmans wrote: > Hi, > > New to this list and Erlang, and I have a simple question that I > couldn't find an answer to in any of the docs: is it possible to > restrict the possibility of remote spawning or rpc on a given set of > nodes to only a subset of the functions? > > Because if I think "trust no one" then only cookies for SaaS > applications imply that I loose a layer of defense (and have only the > firewall left). Especially because the Big Plus with Erlang woudl be > using Mnesia as well - but this implies moving all code busines + Db) in > the same zone. > > The only option I can think of is doing all communication socket based > with custom protocols/DSLs that limit what you can do. > > Any help/insights greatly appreciated! > > --Maarten > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From stondage123@REDACTED Wed Apr 23 19:46:00 2008 From: stondage123@REDACTED (Andrew Stone) Date: Wed, 23 Apr 2008 10:46:00 -0700 (PDT) Subject: [erlang-questions] Setting node name from the shell started withou -name or -sname Message-ID: <589594.52438.qm@web35908.mail.mud.yahoo.com> Hi Zvi, You can set the node name with net_kernel:start(atom()). You must however make sure that epmd is running on your system. You can do this with os:cmd("epmd -daemon"). You may want to put a timer:sleep() after this though, as I'm not sure it is ready immediately after return. You are correct that you can set the cookie with erlang:set_cookie/2. -Andrew ----- Original Message ---- From: Zvi To: erlang-questions@REDACTED Sent: Wednesday, April 23, 2008 1:14:25 PM Subject: [erlang-questions] Setting node name from the shell started withou -name or -sname It's possible to set cookie name programmatically, using erlang:set_cookie/2, even if BEAM started without -setcookie flag or .erlang.cookie file. How to set a node name for BEAM started without -name or -sname flags? There is undocumented erlang:setnode/2 BIF, I guess that it's: setnode(NodeName::node(),PortNumber::int()) but still have no idea how to use it. TIA, Zvi -- View this message in context: http://www.nabble.com/Setting-node-name-from-the-shell-started-withou--name-or--sname-tp16834718p16834718.html Sent from the Erlang Questions mailing list archive at Nabble.com. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Wed Apr 23 21:26:35 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 23 Apr 2008 21:26:35 +0200 Subject: [erlang-questions] erlide release Message-ID: <95be1d3b0804231226v7c974d34sf80a08482b29386d@mail.gmail.com> Hi all, Sorry for the noise, but this is still the best way to reach all interested parties. There have been reports about Eclipse crashing with the latest erlide release and I have built and published a new release 0.3.49.200804231154. I'd like to ask all who had problems to try it and send me (privately) the results. best regards, Vlad -- .......__o .......\<, ....( )/ ( )... -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.hinde@REDACTED Wed Apr 23 21:29:11 2008 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 23 Apr 2008 20:29:11 +0100 Subject: [erlang-questions] Securing remote spawning In-Reply-To: References: Message-ID: Hi, No it doesn't mean you have to trust the firewall, all it means is that you cannot use the built in erlang distribution for communication with untrusted clients. It is very easy to roll your own RPC: call(Sock, M,F,A) -> gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). Then at the other end: receive {tcp, Sock, Data} -> case erlang:term_to_binary(Data) of {M, F, A} when is_list(A) -> case lists:member({M,F,length(A)}, Allowed_funcs) of true -> apply(M,F,A); false -> ignore end; _ -> ignore end etc Sean On 23 Apr 2008, at 19:39, wrote: > Hi, > > Thanks, but basically that means that I have to trust the firewall. > If somebody gets past the first "layer of defense", they can do more > damage. With great power..... > > --Maarten > > > > ---------------------------------- > From: "Gleb Peregud" > Date: 4/23/08 17:53Subject: Re: [erlang-questions] Securing > remote spawning > > Hi, > > No. At this moment there is no such mechanism (at least none i heard > of). Erlang security is based on simple concept of "secret cookie". If > one knows cookie of running node then he gets absolute power over this > node. Same goes to inter-node communication - if two nodes share the > same cookie they trust each other fully. If it differs - they do not > communicate at all. > > For details see http://www.erlang.org/doc/reference_manual/distributed.html#11.7 > > Of course you can roll out your own mechanism. For specific task with > term_to_binary/1 and binary_to_term/1 is should not be too hard. > > Also you may want to read this: > http://www.trapexit.org/Distributed_erlang_using_ssl_through_firewalls > > Best regards. > > On 4/23/08, Maarten Koopmans wrote: >> Hi, >> >> New to this list and Erlang, and I have a simple question that I >> couldn't find an answer to in any of the docs: is it possible to >> restrict the possibility of remote spawning or rpc on a given set of >> nodes to only a subset of the functions? >> >> Because if I think "trust no one" then only cookies for SaaS >> applications imply that I loose a layer of defense (and have only the >> firewall left). Especially because the Big Plus with Erlang woudl be >> using Mnesia as well - but this implies moving all code busines + >> Db) in >> the same zone. >> >> The only option I can think of is doing all communication socket >> based >> with custom protocols/DSLs that limit what you can do. >> >> Any help/insights greatly appreciated! >> >> --Maarten >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From cw@REDACTED Wed Apr 23 22:25:19 2008 From: cw@REDACTED (Christian Westbrook) Date: Wed, 23 Apr 2008 16:25:19 -0400 Subject: [erlang-questions] xmpp _client_ code in erlang? In-Reply-To: References: Message-ID: <480F9B2F.2010708@wellohorld.com> Patrick, Have you checked out Tsung? It may be able to hold you over until exmpp displaces jabberlang as P1's xmpp client. The docs include this sample xmpp config: http://tsung.erlang-projects.org/user_manual.html#htoc40 Otherwise, if you find anything else, keep us posted! ;) Best of luck, Christian Patrick Logan wrote: > I am aware of jabberlang, and its replacement exmpp is in the works > but I think it is not yet available. > > Is there any other erlang source around for connecting to an arbitrary > xmpp server as a client? i.e. not ejabberd specific - I think > jabberlang was tied to ejabberd? > > Thanks > -Patrick > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Christian Westbrook Co-Founder / CTO Wello Horld, Inc. cw@REDACTED "Buy the ticket, take the ride." -- Hunter S. Thompson From matthias@REDACTED Wed Apr 23 22:28:33 2008 From: matthias@REDACTED (Matthias Lang) Date: Wed, 23 Apr 2008 22:28:33 +0200 Subject: [erlang-questions] Securing remote spawning In-Reply-To: References: Message-ID: <18447.39921.712132.787489@antilipe.corelatus.se> Sean Hinde writes: > It is very easy to roll your own RPC: > > call(Sock, M,F,A) -> > gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). > > Then at the other end: > > receive > {tcp, Sock, Data} -> > case erlang:term_to_binary(Data) of > {M, F, A} when is_list(A) -> > case lists:member({M,F,length(A)}, Allowed_funcs) of > true -> > apply(M,F,A); > false -> > ignore > end; > _ -> ignore > end > > etc This example illustrates the general idea, and you can (and should!) robustify it in practice if you want to deal with potentially malicious clients. A starting point would be to eliminate binary_to_term/1 (which is what Sean meant to write in the 'receive' above, where he wrote 'term_to_binary'). binary_to_term/1 is too general and too powerful. Not only can a client launch a DOS attack using it (by overflowing the atom table), but there have been quite a few examples of how to crash the emulator with it: http://www.erlang.org/pipermail/erlang-questions/2001-June/003332.html http://www.erlang.org/pipermail/erlang-questions/2006-February/018901.html http://www.erlang.org/pipermail/erlang-bugs/2008-February/000634.html Matt From tobbe@REDACTED Wed Apr 23 22:40:13 2008 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 23 Apr 2008 22:40:13 +0200 Subject: [erlang-questions] Securing remote spawning In-Reply-To: <18447.39921.712132.787489@antilipe.corelatus.se> References: <18447.39921.712132.787489@antilipe.corelatus.se> Message-ID: Couldn't the ssh lib be used in order to do authenticated rpc calls ? --Tobbe Matthias Lang wrote: > Sean Hinde writes: > > > It is very easy to roll your own RPC: > > > > call(Sock, M,F,A) -> > > gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). > > > > Then at the other end: > > > > receive > > {tcp, Sock, Data} -> > > case erlang:term_to_binary(Data) of > > {M, F, A} when is_list(A) -> > > case lists:member({M,F,length(A)}, Allowed_funcs) of > > true -> > > apply(M,F,A); > > false -> > > ignore > > end; > > _ -> ignore > > end > > > > etc > > This example illustrates the general idea, and you can (and should!) > robustify it in practice if you want to deal with potentially > malicious clients. > > A starting point would be to eliminate binary_to_term/1 (which is what > Sean meant to write in the 'receive' above, where he wrote > 'term_to_binary'). binary_to_term/1 is too general and too > powerful. Not only can a client launch a DOS attack using it (by > overflowing the atom table), but there have been quite a few examples > of how to crash the emulator with it: > > http://www.erlang.org/pipermail/erlang-questions/2001-June/003332.html > http://www.erlang.org/pipermail/erlang-questions/2006-February/018901.html > http://www.erlang.org/pipermail/erlang-bugs/2008-February/000634.html > > Matt From matthias@REDACTED Wed Apr 23 22:42:20 2008 From: matthias@REDACTED (Matthias Lang) Date: Wed, 23 Apr 2008 22:42:20 +0200 Subject: [erlang-questions] Stockholm User Group presentation yesterday Message-ID: <18447.40748.259254.850991@antilipe.corelatus.se> Hi, yesterday, a couple of dozen of us visited one of the newer Erlang companies in Stockholm, Kreditor*, to listen to Kostis' presentation about some of the type-based development/verification/testing/documentation tools his group has been working on as well as some innovative ways to use editors in live demonstrations. Thanks to Erik and Francesco for organising it, and to Kostis for presenting a lucid and practical session. Matt * www.kreditor.se, there's a little flag up the top right to switch languages) From maarten@REDACTED Wed Apr 23 22:59:21 2008 From: maarten@REDACTED (maarten@REDACTED) Date: Wed, 23 Apr 2008 20:59:21 GMT Subject: [erlang-questions] Securing remote spawning Message-ID: <140f7ce9ec44427b89524730a37f3996@b71f679f294f4de985b7b4a25cbe3e4c> That was what I was expecting (as a mechanism). This looks like Erlang is vey powerful but the power cannot be contained easily in non-closed (or non-trusted) environments. Because if I understand correctly, I'd also have to shut down the "default" remote spawning mechanism on the receiving side. --Maarten --------------------------------------------------------- From: Torbjorn Tornkvist Date: 4/23/08 20:49Subject: Re: [erlang-questions] Securing remote spawning Couldn't the ssh lib be used in order to do authenticated rpc calls ? --Tobbe Matthias Lang wrote: > Sean Hinde writes: > > > It is very easy to roll your own RPC: > > > > call(Sock, M,F,A) -> > > gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). > > > > Then at the other end: > > > > receive > > {tcp, Sock, Data} -> > > case erlang:term_to_binary(Data) of > > {M, F, A} when is_list(A) -> > > case lists:member({M,F,length(A)}, Allowed_funcs) of > > true -> > > apply(M,F,A); > > false -> > > ignore > > end; > > _ -> ignore > > end > > > > etc > > This example illustrates the general idea, and you can (and should!) > robustify it in practice if you want to deal with potentially > malicious clients. > > A starting point would be to eliminate binary_to_term/1 (which is what > Sean meant to write in the 'receive' above, where he wrote > 'term_to_binary'). binary_to_term/1 is too general and too > powerful. Not only can a client launch a DOS attack using it (by > overflowing the atom table), but there have been quite a few examples > of how to crash the emulator with it: > > http://www.erlang.org/pipermail/erlang-questions/2001-June/003332.html > http://www.erlang.org/pipermail/erlang-questions/2006-February/018901.html > http://www.erlang.org/pipermail/erlang-bugs/2008-February/000634.html > > Matt _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From exta7@REDACTED Wed Apr 23 23:15:42 2008 From: exta7@REDACTED (Zvi) Date: Wed, 23 Apr 2008 14:15:42 -0700 (PDT) Subject: [erlang-questions] Location options in file:pread/2 and /3 Message-ID: <16834826.post@talk.nabble.com> Are all these options are still supported in file:pread/2 and file:pread/3 ? >From my tests, only file:position accepts them. file:pread/2 and /3 only accepts Offset and giving {error,badarg} for the rest. "Offset The same as {bof, Offset}. {bof, Offset} Absolute offset. {cur, Offset} Offset from the current position. {eof, Offset} Offset from the end of file. bof | cur | eof The same as above with Offset 0." I using R12-0 on Windows. TiA, Zvi -- View this message in context: http://www.nabble.com/Location-options-in-file%3Apread-2-and--3-tp16834826p16834826.html Sent from the Erlang Questions mailing list archive at Nabble.com. From sean.hinde@REDACTED Wed Apr 23 23:16:27 2008 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 23 Apr 2008 22:16:27 +0100 Subject: [erlang-questions] Securing remote spawning In-Reply-To: <140f7ce9ec44427b89524730a37f3996@b71f679f294f4de985b7b4a25cbe3e4c> References: <140f7ce9ec44427b89524730a37f3996@b71f679f294f4de985b7b4a25cbe3e4c> Message-ID: <0ACB35AB-74F8-4FF7-BD5B-238F3E569FAA@gmail.com> If you allow authentication and connection via the normal erlang distribution then everything is wide open. If you do not allow this connection (e.g. by forewall, and having a secret cookie), and hence only allow a custom protocol then you can control it completely. There is no "default" remote spawning over my proposed protocol, or HTTP or... Sean On 23 Apr 2008, at 21:59, wrote: > That was what I was expecting (as a mechanism). This looks like > Erlang is vey powerful but the power cannot be contained easily in > non-closed (or non-trusted) environments. > > Because if I understand correctly, I'd also have to shut down the > "default" remote spawning mechanism on the receiving side. > > --Maarten > > --------------------------------------------------------- > > > From: Torbjorn Tornkvist > Date: 4/23/08 20:49Subject: Re: [erlang-questions] Securing > remote spawning > > > Couldn't the ssh lib be used in order to do authenticated rpc calls ? > > --Tobbe > > > Matthias Lang wrote: >> Sean Hinde writes: >> >>> It is very easy to roll your own RPC: >>> >>> call(Sock, M,F,A) -> >>> gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). >>> >>> Then at the other end: >>> >>> receive >>> {tcp, Sock, Data} -> >>> case erlang:term_to_binary(Data) of >>> {M, F, A} when is_list(A) -> >>> case lists:member({M,F,length(A)}, Allowed_funcs) of >>> true -> >>> apply(M,F,A); >>> false -> >>> ignore >>> end; >>> _ -> ignore >>> end >>> >>> etc >> >> This example illustrates the general idea, and you can (and should!) >> robustify it in practice if you want to deal with potentially >> malicious clients. >> >> A starting point would be to eliminate binary_to_term/1 (which is >> what >> Sean meant to write in the 'receive' above, where he wrote >> 'term_to_binary'). binary_to_term/1 is too general and too >> powerful. Not only can a client launch a DOS attack using it (by >> overflowing the atom table), but there have been quite a few examples >> of how to crash the emulator with it: >> >> http://www.erlang.org/pipermail/erlang-questions/2001-June/003332.html >> http://www.erlang.org/pipermail/erlang-questions/2006-February/018901.html >> http://www.erlang.org/pipermail/erlang-bugs/2008-February/ >> 000634.html >> >> Matt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From masterofquestions@REDACTED Thu Apr 24 03:21:41 2008 From: masterofquestions@REDACTED (db) Date: Wed, 23 Apr 2008 21:21:41 -0400 Subject: [erlang-questions] what is trap_exit business, process_flag(trap_exit, true) Message-ID: <1218d6a50804231821x733689e2yca58e56691eb917f@mail.gmail.com> In my gen_server:init function, I spawn client processes onto remote nodes using proc_lib:spawn_link(N, M, F, A). Before I spawn any process on to remote nodes, I have placed process_flag(trap_exit, true). But when I do exit kill/shutdown in the shell, my gen_server and all the remote client processes are terminated mercilessly. I thought process_flag(trap_exit, true) supposed to prevent the whole thing from crashing. Are these kill/shutdown type of exits trappable or only 'EXIT'? (b@REDACTED)8> exit(pid(0,147,0)). ** exception exit: <0.147.0> in function exit/1 called as exit(<0.147.0>) (b@REDACTED)9> exit(pid(0,147,0), kill). true (b@REDACTED)10> exit(pid(0,182,0), shutdown). true (a@REDACTED)9> =ERROR REPORT==== 23-Apr-2008::19:54:52 === ** Generic server clnt_sup terminating ** Last message in was {'EXIT',<5679.182.0>,shutdown} ** When Server state == {ets_pid,{clnt,loop,[<0.6396.0>]}} ** Reason for termination == ** {'module could not be loaded',[{ets_pid,tab2list,[]}, {clnt_sup,terminate,2}, {gen_server,terminate,6}, {proc_lib,init_p,5}]} Thank you, hoping to get some answers from erlang mailing list, people in IRC are very helpful. -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From erlangy@REDACTED Thu Apr 24 07:19:17 2008 From: erlangy@REDACTED (Michael McDaniel) Date: Wed, 23 Apr 2008 22:19:17 -0700 Subject: [erlang-questions] Securing remote spawning In-Reply-To: References: Message-ID: <20080424051917.GE19346@delora.autosys.us> On Wed, Apr 23, 2008 at 08:29:11PM +0100, Sean Hinde wrote: > Hi, > > No it doesn't mean you have to trust the firewall, all it means is > that you cannot use the built in erlang distribution for communication > with untrusted clients. It is very easy to roll your own RPC: > > call(Sock, M,F,A) -> > gen_tcp:send(Sock, erlang:term_to_binary(M,F,A)). > > Then at the other end: > > receive > {tcp, Sock, Data} -> > case erlang:term_to_binary(Data) of > {M, F, A} when is_list(A) -> > case lists:member({M,F,length(A)}, Allowed_funcs) of > true -> > apply(M,F,A); > false -> > ignore > end; > _ -> ignore > end > > etc > > Sean ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... which is then communicated via a secure SSL channel to reduce the possibility of third party eavesdropping ~Michael > > > On 23 Apr 2008, at 19:39, > wrote: > > Hi, > > > > Thanks, but basically that means that I have to trust the firewall. > > If somebody gets past the first "layer of defense", they can do more > > damage. With great power..... > > > > --Maarten > > > > > > > > ---------------------------------- > > From: "Gleb Peregud" > > Date: 4/23/08 17:53Subject: Re: [erlang-questions] Securing > > remote spawning > > > > Hi, > > > > No. At this moment there is no such mechanism (at least none i heard > > of). Erlang security is based on simple concept of "secret cookie". If > > one knows cookie of running node then he gets absolute power over this > > node. Same goes to inter-node communication - if two nodes share the > > same cookie they trust each other fully. If it differs - they do not > > communicate at all. > > > > For details see http://www.erlang.org/doc/reference_manual/distributed.html#11.7 > > > > Of course you can roll out your own mechanism. For specific task with > > term_to_binary/1 and binary_to_term/1 is should not be too hard. > > > > Also you may want to read this: > > http://www.trapexit.org/Distributed_erlang_using_ssl_through_firewalls > > > > Best regards. > > > > On 4/23/08, Maarten Koopmans wrote: > >> Hi, > >> > >> New to this list and Erlang, and I have a simple question that I > >> couldn't find an answer to in any of the docs: is it possible to > >> restrict the possibility of remote spawning or rpc on a given set of > >> nodes to only a subset of the functions? > >> > >> Because if I think "trust no one" then only cookies for SaaS > >> applications imply that I loose a layer of defense (and have only the > >> firewall left). Especially because the Big Plus with Erlang woudl be > >> using Mnesia as well - but this implies moving all code busines + > >> Db) in > >> the same zone. > >> > >> The only option I can think of is doing all communication socket > >> based > >> with custom protocols/DSLs that limit what you can do. > >> > >> Any help/insights greatly appreciated! > >> > >> --Maarten > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > > > > -- > > Gleb Peregud > > http://gleber.pl/ > > > > Every minute is to be grasped. > > Time waits for nobody. > > -- Inscription on a Zen Gong > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From hzerlang@REDACTED Thu Apr 24 07:40:53 2008 From: hzerlang@REDACTED (=?iso-8859-1?Q?Horv=E1th_zolt=E1n_-Erlang_lev=2Elist=E1hoz?=) Date: Thu, 24 Apr 2008 07:40:53 +0200 (CEST) Subject: [erlang-questions] CFP Erlang Workshop 2008 Message-ID: Second Call for papers Seventh ACM SIGPLAN Erlang Workshop Victoria, British Columbia, Canada, September 27, 2008 http://www.erlang.org/workshop/2008/ Satellite event of ACM SIGPLAN International Conference on Functional Programming, September 22-24, 2008 The Erlang workshop will take place during one day (September 27) in connection with ICFP'08 (see http://www.icfpconference.org/icfp2008/) Important Dates Submission deadline - Midnight GMT June 10 Author notification - Midnight GMT June 30 Final submission - Midnight GMT July 14 Erlang is a concurrent, distributed functional programming language aimed at systems with requirements on massive concurrency, soft real time response, fault tolerance, and high availability. It has been available as open source for several years creating a community that actively contributes to its already existing rich set of libraries and applications. Originally created for telecom applications, its usage has spread to other domains including e-commerce, banking, and computer telephony. Erlang programs are today among the largest applications written in any functional programming language. These applications offer new opportunities to evaluate functional programming and functional programming methods on a very large scale and suggest new problems for the research community to solve. This workshop will bring together the open source, academic, and industrial programming communities of Erlang. It will enable participants to familiarize themselves with recent developments on new techniques and tools tailored to Erlang, novel applications, draw lessons from users' experiences and identify research problems and common areas relevant to the practice of Erlang and functional programming. Submission and publication information The workshop will have printed proceedings which will be distributed to the participants at the time of the workshop. Subsequently, the papers will be included in the ACM Digital Library. Authors are therefore advised to use the Author Information for SIGPLAN Conferences when preparing their submissions. Authors should submit provisional full papers. Submissions will be accepted electronically; the submission page is not yet ready. The length should be restricted to 12 pages in standard ACM format. In previous workshops we have had a mix of papers representing academic research and industrial experiences with Erlang. We particularly welcome papers describing new and novel application of Erlang - if you have any doubts about the suitability of a paper please feel free to contact the Program Chair for advice. Authors should submit their papers using the submission website. In case of technical problems, please contact erlangws08@REDACTED Workshop Chair Tee Teoh, Canadian Bank Note, Ottawa, Canada Program Chair Zolt?n Horv?th, Department of Programming Languages and Programming, Faculty of Informatics, E?tv?s Lor?nd University, Budapest, Hungary Program Committee Thomas Arts, IT University, G?teborg, Sweden Francesco Cesarini, Erlang Training and Consulting, London, UK Clara Benac Earle, University Carlos III, Madrid, Spain John Hughes, Chalmers University of Technology, G?teborg, Sweden Erik Stenman, Kreditor, Stockholm, Sweden Zolt?n Theisz, Ericsson, Ireland Simon Thompson, University of Kent,Canterbury, UK Rex Page, University of Oklahoma, USA For Venue and registration, please see the ICFP web site Related Links Erlang Workshop web site: http://www.erlang.org/workshop/2008/ ICFP 2008 web site: http://www.icfpconference.org/icfp2008/ Past ACM SIGPLAN Erlang workshops http://www.erlang.se/workshop Open Source Erlang http://www.erlang.org/ From lneitman@REDACTED Thu Apr 24 07:53:35 2008 From: lneitman@REDACTED (Ludmila Neitman) Date: Thu, 24 Apr 2008 15:53:35 +1000 Subject: [erlang-questions] Please help with MediaDescriptor using Erlang MEGACO Message-ID: <4810205F.104@fastwire-group.com> Hi, I would like to use Erlang MEGACO stack for the MG emulation in our testing environment. I've been playing with it for about 2 weeks and can compose simple messages and send them between MGC and MG (I am using simple example provided within the megaco library as a framework). The version I am working with is OTP-R12B-2, megaco-3.7.4. However, I am stuck with the composing a MediaDescriptor within an AddReq. It looks like there is a problem with _decompose_StreamParms_ function clause. Could you please point to what is wrong with the following code: add_req((ConnHandle, Version) -> TermID = {megaco_term_id, false, [[$r, $1], [$1, $0, $1], [$1]]}, PPV = #'PropertyParm'{name= "v", value = [["0\r\r"]]}, PPC = #'PropertyParm'{name= "c", value = ["IN\s\tIP4\s\t10.70.80.50\r\n"]}, PPM = #'PropertyParm'{name= "m", value= ["audio\s\t4444\s\tRTP\/AVP\s\t0\r\n"]}, PropertyParmGroup = [PPV, PPC, PPM], RemoteDesc = #'LocalRemoteDescriptor'{propGrps = [PropertyParmGroup]}, StreamParms = #'StreamParms'{remoteDescriptor=RemoteDesc}, MediaDesc = #'MediaDescriptor'{streams={oneStream,SP1}}, AMMR = #'AmmRequest'{terminationID = [TermID], descriptors = [{mediaDescriptor, MediaDesc}, {eventsDescriptor, EventsDesc}]}, CR = #'CommandRequest'{command = {addReq, AMMR}}, AR = #'ActionRequest'{contextId = ?megaco_choose_context_id, commandRequests = [CR]}, case megaco:cast(ConnHandle, [AR], [{protocol_version, Version}]) of {error, Reason} -> d("start -> cast failed, Error: ~n~p Reason: ~n~p", [error, Reason]); _ -> ok end. Also, as simple MediaDescriptor as the one containing only LocalControlDescriptor with a SendMode =recvOnly, does not work...: ... LCD1 = #'LocalControlDescriptor'{streamMode=recvOnly}, SP1 = #'StreamParms'{localControlDescriptor=LCD1}, MediaDesc = #'MediaDescriptor'{streams={oneStream,SP1}}, .... I get the following error when I try to run it: error Reason: {megaco_pretty_text_encoder, [[], {'MegacoMessage',asn1_NOVALUE, {'Message',3, {deviceName,"controller"}, {transactions, [{transactionRequest, {'TransactionRequest',1, [{'ActionRequest',4294967294,asn1_NOVALUE,asn1_NOVALUE, [{'CommandRequest', {addReq, {'AmmRequest', [{megaco_term_id,false,["r1","101","1"]}], [{mediaDescriptor, {'MediaDescriptor',asn1_NOVALUE, {oneStream, {'StreamDescriptor',1, {'StreamParms',asn1_NOVALUE,asn1_NOVALUE, {'LocalRemoteDescriptor', [[{'PropertyParm',"v",["0\r\r"],asn1_NOVALUE}, {'PropertyParm',"c", ["IN \tIP4 \t10.70.80.50\r\r"], asn1_NOVALUE}, {'PropertyParm',"m", ["audio \t4444 \tRTP/AVP \t0\r\r"], asn1_NOVALUE}]]}}}}}}, {eventsDescriptor, {'EventsDescriptor',1, [{'RequestedEvent', ["al/of"], asn1_NOVALUE,asn1_NOVALUE, [{'EventParameter',"strict",["exact"],asn1_NOVALUE}]}]}}]}}, asn1_NOVALUE,asn1_NOVALUE}]}]}}]}}}], {function_clause, [{megaco_pretty_text_encoder_v3,decompose_StreamParms, [{'StreamDescriptor',1, {'StreamParms',asn1_NOVALUE,asn1_NOVALUE, {'LocalRemoteDescriptor', [[{'PropertyParm',"v",["0\r\r"],asn1_NOVALUE}, {'PropertyParm',"c", ["IN \tIP4 \t10.70.80.50\r\r"], asn1_NOVALUE}, {'PropertyParm',"m", ["audio \t4444 \tRTP/AVP \t0\r\r"], asn1_NOVALUE}]]}}}]}, {megaco_pretty_text_encoder_v3,enc_MediaDescriptor,2}, {megaco_pretty_text_encoder_v3,do_enc_list,5}, {megaco_pretty_text_encoder_v3,enc_list,4}, {megaco_pretty_text_encoder_v3,enc_AmmRequest,2}, {megaco_pretty_text_encoder_v3,enc_Command,2}, {megaco_pretty_text_encoder_v3,enc_CommandRequest,2}, {megaco_pretty_text_encoder_v3,do_enc_list,5}]}} In addition, I tried to put the PropertyParms in the following way: ... CI = #megaco_sdp_c{ connection_addr="224.2.17.12" }, ML= #megaco_sdp_m{ media="audio", port=6003, num_ports=1, transport="RTP/AVP", fmt_list = ["8", "0"] }, PropertyParmGroup = [CI, ML], ... But, it seems to me that the problem is even before coming to these params. Thank you, Ludmila From zerthurd@REDACTED Thu Apr 24 08:20:13 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Thu, 24 Apr 2008 13:20:13 +0700 Subject: [erlang-questions] Please help with MediaDescriptor using Erlang MEGACO In-Reply-To: <4810205F.104@fastwire-group.com> References: <4810205F.104@fastwire-group.com> Message-ID: Hello You can use megaco:encode_sdp/1 and megaco:decode_sdp/1. Also, you cannot use such symbols, as 0x00 (Nul), 0x0a (ASCII newline) and 0x0d (ASCII carriage return) in SDP, according to rfc2327 (Session Description Protocol) --- Maxim Treskin On 24/04/2008, Ludmila Neitman wrote: > Hi, > > I would like to use Erlang MEGACO stack for the MG emulation in our > testing environment. > I've been playing with it for about 2 weeks and can compose simple > messages and send them between MGC and MG (I am using simple example > provided within the megaco library as a framework). The version I am > working with is OTP-R12B-2, megaco-3.7.4. > > However, I am stuck with the composing a MediaDescriptor within an > AddReq. It looks like there is a problem with _decompose_StreamParms_ > function clause. > Could you please point to what is wrong with the following code: > > add_req((ConnHandle, Version) -> > > TermID = {megaco_term_id, false, [[$r, $1], [$1, $0, $1], [$1]]}, > > PPV = #'PropertyParm'{name= "v", value = [["0\r\r"]]}, > PPC = #'PropertyParm'{name= "c", value = ["IN\s\tIP4\s\t10.70.80.50\r\n"]}, > PPM = #'PropertyParm'{name= "m", value= > ["audio\s\t4444\s\tRTP\/AVP\s\t0\r\n"]}, > > PropertyParmGroup = [PPV, PPC, PPM], > RemoteDesc = #'LocalRemoteDescriptor'{propGrps = [PropertyParmGroup]}, > > StreamParms = #'StreamParms'{remoteDescriptor=RemoteDesc}, > > MediaDesc = #'MediaDescriptor'{streams={oneStream,SP1}}, > > AMMR = #'AmmRequest'{terminationID = [TermID], > descriptors = > [{mediaDescriptor, MediaDesc}, > > {eventsDescriptor, EventsDesc}]}, > CR = #'CommandRequest'{command = {addReq, AMMR}}, > > AR = #'ActionRequest'{contextId = ?megaco_choose_context_id, > commandRequests = [CR]}, > > case megaco:cast(ConnHandle, [AR], [{protocol_version, Version}]) of > {error, Reason} -> > d("start -> cast failed, Error: ~n~p Reason: ~n~p", [error, > Reason]); > _ -> > ok > end. > > Also, as simple MediaDescriptor as the one containing only > LocalControlDescriptor with a SendMode =recvOnly, does not work...: > ... > LCD1 = #'LocalControlDescriptor'{streamMode=recvOnly}, > SP1 = #'StreamParms'{localControlDescriptor=LCD1}, > MediaDesc = #'MediaDescriptor'{streams={oneStream,SP1}}, > .... > > I get the following error when I try to run it: > > error Reason: > {megaco_pretty_text_encoder, > [[], > {'MegacoMessage',asn1_NOVALUE, > {'Message',3, > {deviceName,"controller"}, > {transactions, > [{transactionRequest, > {'TransactionRequest',1, > [{'ActionRequest',4294967294,asn1_NOVALUE,asn1_NOVALUE, > [{'CommandRequest', > {addReq, > {'AmmRequest', > [{megaco_term_id,false,["r1","101","1"]}], > [{mediaDescriptor, > {'MediaDescriptor',asn1_NOVALUE, > {oneStream, > {'StreamDescriptor',1, > {'StreamParms',asn1_NOVALUE,asn1_NOVALUE, > {'LocalRemoteDescriptor', > [[{'PropertyParm',"v",["0\r\r"],asn1_NOVALUE}, > {'PropertyParm',"c", > ["IN \tIP4 \t10.70.80.50\r\r"], > asn1_NOVALUE}, > {'PropertyParm',"m", > ["audio \t4444 \tRTP/AVP \t0\r\r"], > asn1_NOVALUE}]]}}}}}}, > {eventsDescriptor, > {'EventsDescriptor',1, > [{'RequestedEvent', > ["al/of"], > asn1_NOVALUE,asn1_NOVALUE, > > [{'EventParameter',"strict",["exact"],asn1_NOVALUE}]}]}}]}}, > asn1_NOVALUE,asn1_NOVALUE}]}]}}]}}}], > {function_clause, > [{megaco_pretty_text_encoder_v3,decompose_StreamParms, > [{'StreamDescriptor',1, > {'StreamParms',asn1_NOVALUE,asn1_NOVALUE, > {'LocalRemoteDescriptor', > [[{'PropertyParm',"v",["0\r\r"],asn1_NOVALUE}, > {'PropertyParm',"c", > ["IN \tIP4 \t10.70.80.50\r\r"], > asn1_NOVALUE}, > {'PropertyParm',"m", > ["audio \t4444 \tRTP/AVP \t0\r\r"], > asn1_NOVALUE}]]}}}]}, > {megaco_pretty_text_encoder_v3,enc_MediaDescriptor,2}, > {megaco_pretty_text_encoder_v3,do_enc_list,5}, > {megaco_pretty_text_encoder_v3,enc_list,4}, > {megaco_pretty_text_encoder_v3,enc_AmmRequest,2}, > {megaco_pretty_text_encoder_v3,enc_Command,2}, > {megaco_pretty_text_encoder_v3,enc_CommandRequest,2}, > {megaco_pretty_text_encoder_v3,do_enc_list,5}]}} > > In addition, I tried to put the PropertyParms in the following way: > ... > CI = #megaco_sdp_c{ connection_addr="224.2.17.12" }, > ML= #megaco_sdp_m{ media="audio", > port=6003, > num_ports=1, > transport="RTP/AVP", > fmt_list = ["8", "0"] }, > > PropertyParmGroup = [CI, ML], > ... > But, it seems to me that the problem is even before coming to these params. > > Thank you, > Ludmila > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Maxim Treskin From johanmon@REDACTED Thu Apr 24 12:22:25 2008 From: johanmon@REDACTED (Johan Montelius) Date: Thu, 24 Apr 2008 12:22:25 +0200 Subject: [erlang-questions] Securing remote spawning In-Reply-To: <140f7ce9ec44427b89524730a37f3996@b71f679f294f4de985b7b4a25cbe3e4c> References: <140f7ce9ec44427b89524730a37f3996@b71f679f294f4de985b7b4a25cbe3e4c> Message-ID: I've also been thinking about these issues: how to make use of Erlang distributed features but more adaptable than the all-or-nothing cookie. The lib_chan modules in Joe's book describe one way of implementing password protected access to server processes that are listening on specified ports. It would of course be nice to have similar functionality but in the Erlang machinery. I'm thinking of a Erlang node that is open for remote messages but only from nodes that have been authenticated and authorized. Starting to think in these terms is of course opening a big box of questions: is authorization tied to a node or a process, can a process delegate rights, can a registered process send any pid in a reply message and can this pid be used even if that process has not been registered, what happens if we send functions in messages, will these functions have access to any module on the receiving side, can we provide a sand-box with limited computational resources, ... not to mention the different authorization schemes that one could use. I'll hope to have more time to look at this so if anyone have ideas on what functionality is desired I'm interested. Johan -- KTH ICT Johan Montelius From raimo+erlang-questions@REDACTED Thu Apr 24 14:02:43 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 24 Apr 2008 14:02:43 +0200 Subject: [erlang-questions] JInterface and multi-threading In-Reply-To: <28F58275-08BF-4904-BA77-0488256394BD@rodanotech.ch> References: <28F58275-08BF-4904-BA77-0488256394BD@rodanotech.ch> Message-ID: <20080424120243.GA17022@erix.ericsson.se> On Wed, Apr 23, 2008 at 06:49:26PM +0200, Alexander Lamb wrote: > Hello, > > Now I have a better understanding of JInterface (from previous post > answer), I looked into the Java code. > > It it is not clear to me if rpc from Jinterface is thread safe. Or, in > other words, will this be a bottleneck for an application in an app > server with many concurent users. It seems the code is written to be thread safe. It synchronizes on the socket writes and reads. The socket to the other (Erlang) node will always be a bottleneck (absolutely not necessarily the smallest). > > Indeed, having only one OtpConnection (which seems logical now), I > will need to do rpc calls from potentially simultanious threads. > How will this be handled? If one call is taking longer than expected, > I will block on connection.receiveRPC(). Ok. I have now started to read the Jinterface documentation for this. It seems OtpConnection and OtpSelf are conveniance classes for a node with only one "Erlang" process that is only one OtpMbox. The more Erlanghish way is to create an OtpNode and in that create many OtpMbox:es. Each OtpMbox could be used in a dedicated Java thread and call servers, e.g the rpc server 'rex' or one of your own. A few conveniance function in OtpConnection, that is sendRPC and receiveRPC can be used as a template for doing RPC calls from an OtpMbox. sendRPC sends: {self(), {call, Mod, Fun, ArgList, user}} to {rex,OtherNode} receiveRPC receives: {rex,Result} and returns Result. This is a sneak way to call the RPC server. If you do it from Erlang rpc:call uses gen_server calls, but that should also be possible to do from Jinterface. > > Is there a correct way to handle this problem? Do I need for example > to create a mailbox in a thread for each session in my server? This > would allow my Java sesions to run regardless of any other session > blocking on a call to the erlang server. Now, obviously, my Erlang > server might be blocked but I could create an Erlang process on the > server for each client process connecting from Java. > > What is the correct way to handle those issues. > Since OtpSelf and OtpConnection only have one OtpMbox (internally), OtpConnection.sendRPC and OtpConnection.receiveRPC will only do one RPC call at the time, for that OtpSelf object. If you create one OtpNode per app server, and one OtpMbox per user session, the sending of RPC calls from several OtpMbox:es will compete for the connection between the Java node (OtpNode) and the Erlang node, but the RPC server in Erlang will spawn a new process for each new RPC call, so one RPC call in progress will not block other RPC calls. That is, while receiving one RPC reply in one OtpMbox, other OtpMbox:es can do RPC sends and receives. > Thanks > > Alex > -- > Alexander Lamb > Founding Associate > RODANOTECH S?rl > > 4 ch. de la Tour de Champel > 1206 Geneva > Switzerland > > Tel: 022 347 77 37 > Fax: 022 347 77 38 > > http://www.rodanotech.ch > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Thu Apr 24 14:11:03 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 24 Apr 2008 14:11:03 +0200 Subject: [erlang-questions] what is trap_exit business, process_flag(trap_exit, true) In-Reply-To: <1218d6a50804231821x733689e2yca58e56691eb917f@mail.gmail.com> References: <1218d6a50804231821x733689e2yca58e56691eb917f@mail.gmail.com> Message-ID: <20080424121103.GB17022@erix.ericsson.se> On Wed, Apr 23, 2008 at 09:21:41PM -0400, db wrote: > In my gen_server:init function, I spawn client processes onto remote > nodes using proc_lib:spawn_link(N, M, F, A). Before I spawn any > process on to remote nodes, I have placed process_flag(trap_exit, > true). But when I do exit kill/shutdown in the shell, my gen_server > and all the remote client processes are terminated mercilessly. I > thought process_flag(trap_exit, true) supposed to prevent the whole > thing from crashing. Are these kill/shutdown type of exits trappable > or only 'EXIT'? > It is the spawned processes that need to execute process_flag(trap_exit, true). That property is not inherited at spawn. See http://www.erlang.org/doc/reference_manual/part_frame.html, section 10, esp. 10.4-7. > (b@REDACTED)8> exit(pid(0,147,0)). > ** exception exit: <0.147.0> > in function exit/1 > called as exit(<0.147.0>) > > (b@REDACTED)9> exit(pid(0,147,0), kill). > true > > (b@REDACTED)10> exit(pid(0,182,0), shutdown). > true > > (a@REDACTED)9> > =ERROR REPORT==== 23-Apr-2008::19:54:52 === > ** Generic server clnt_sup terminating > ** Last message in was {'EXIT',<5679.182.0>,shutdown} > ** When Server state == {ets_pid,{clnt,loop,[<0.6396.0>]}} > ** Reason for termination == > ** {'module could not be loaded',[{ets_pid,tab2list,[]}, > {clnt_sup,terminate,2}, > {gen_server,terminate,6}, > {proc_lib,init_p,5}]} > Thank you, > hoping to get some answers from erlang mailing list, people in IRC are > very helpful. > -- > rk > > That which we persist in doing becomes easier for us to do; not that > the nature of the thing itself is changed, but that our power to do is > increased. > -Ralph Waldo Emerson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Thu Apr 24 16:17:05 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 24 Apr 2008 16:17:05 +0200 Subject: [erlang-questions] IPv6 name resolver patch for R12B-2 In-Reply-To: <20080417094833.GC27385@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> <20080417080329.GA23742@erix.ericsson.se> <20080417094833.GC27385@erix.ericsson.se> Message-ID: <20080424141704.GA22245@erix.ericsson.se> On Thu, Apr 17, 2008 at 11:48:33AM +0200, Raimo Niskanen wrote: : > > I am working on getaddrinfo support. When it seems to work I will publish > a source patch for OTP_R12B-2 and then start on the test cases, > to get feedback for a final version. I now have a solution running in our daily builds. I attach a patch for R12B-2. Please try it! > : > > On OS X, AI_DEFAULT is defined to (AI_V4MAPPED_CFG | AI_ADDRCONFIG). > > > > I tested various a few different flags options, and ipv6.google.com > > would only resolve when AI_V4MAPPED(_CFG) was *not* set. 0 and > > AI_ADDRCONFIG both returned an IPv6 hostent structure. > > ipv6.google.com has no IPv4 address hence there can not exist an IPv6 mapped IPv4 address for it. AI_V4MAPPED_CFG should not affect pure IPv6 addresses. > > The header files on MacOS X 10.5.2 says: > #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ > > Would that indicate that the kernel does not support > mapped IPv4 addresses or what does it not support? > > Is this a MacOS X support question? > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB -------------- next part -------------- A non-text attachment was scrubbed... Name: OTP-5382.patch Type: text/x-patch Size: 16070 bytes Desc: not available URL: From cdsmith@REDACTED Thu Apr 24 21:06:32 2008 From: cdsmith@REDACTED (Chris Smith) Date: Thu, 24 Apr 2008 13:06:32 -0600 Subject: [erlang-questions] Looking for presenters for Colorado Springs, CO group Message-ID: <1209063993.14568.66.camel@godel> Hope you don't mind my message here. I'm looking for someone interested in giving a short language tutorial on the Erlang programming language in Colorado Springs, CO (US). This is a new user group I'm starting for people interested in learning new programming languages. We have upcoming meetings on June 10, July 22, and Aug 12, or could plan something further in the future. You'd have to be relatively local. We don't have a budget for travel expenses, though we can probably work out something for relatively small expenses, like gasoline and one night's worth of a hotel. If anyone knows Erlang fairly well and is interested in doing this, please shoot me an email. Thanks, Chris From matthew@REDACTED Thu Apr 24 22:10:22 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 24 Apr 2008 13:10:22 -0700 Subject: [erlang-questions] IPv6 name resolver patch for R12B-2 In-Reply-To: <20080424141704.GA22245@erix.ericsson.se> References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> <20080417080329.GA23742@erix.ericsson.se> <20080417094833.GC27385@erix.ericsson.se> <20080424141704.GA22245@erix.ericsson.se> Message-ID: On Thu, Apr 24, 2008 at 7:17 AM, Raimo Niskanen wrote: > I now have a solution running in our daily builds. > I attach a patch for R12B-2. Please try it! Awesome! I applied it to an R12B-3 snapshot (from yesterday or so) and it works great on OS X 10.5.2: matthew@REDACTED:~/src/otp_src_R12B-3$ ./bin/erl Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.3 (abort with ^G) 1> inet:getaddr("ipv6.google.com", inet6). {ok,{8193,18528,0,8193,0,0,0,104}} 2> inet:getaddr("www.kame.net", inet6). {ok,{8193,512,0,32770,515,18431,65189,12421}} From matthew@REDACTED Fri Apr 25 00:44:37 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Thu, 24 Apr 2008 15:44:37 -0700 Subject: [erlang-questions] IPv6 name resolver patch for R12B-2 In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> <20080417080329.GA23742@erix.ericsson.se> <20080417094833.GC27385@erix.ericsson.se> <20080424141704.GA22245@erix.ericsson.se> Message-ID: On Thu, Apr 24, 2008 at 1:10 PM, Matthew Dempsky wrote: > Awesome! I applied it to an R12B-3 snapshot (from yesterday or so) > and it works great on OS X 10.5.2: I just noticed this patch is already included in the latest R12B-3 snapshot. Just to be clear, the snapshot I used must have been from before when this patch was merged, because the diff applied cleanly and without needing to be reversed. From j.bhanot@REDACTED Fri Apr 25 06:55:52 2008 From: j.bhanot@REDACTED (J Bhanot) Date: Fri, 25 Apr 2008 10:25:52 +0530 Subject: [erlang-questions] Connection Timeout between Cnode and Erlang node Message-ID: Hi, Connection between cNode and Erlang node times out after some time... Is there a way in which this never times out. Cheers, jb ____________________________________________ =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbarker@REDACTED Fri Apr 25 05:37:37 2008 From: dbarker@REDACTED (Deryk Barker) Date: Thu, 24 Apr 2008 20:37:37 -0700 Subject: [erlang-questions] Where does io:format's output go? Or where SHOULD it go? Message-ID: <48115201.1060607@camosun.bc.ca> Excuse me if this is a dim question; although I am a fan of Erlang, my experience is limited: I teach at a college and this will be only the second time I've introduced the language (and the FP paradigm) into our Network Programming course. While setting up a demo for my students to show them how simple it is to load code into another Erlang node and to start processes in another node, when I do this - I start a shell on two systems in two windows, load code from one node to the other and start it - it doesn't matter whether I start the process on the second node via spawn/4 or rpc:call/4, the output, written via io:format by the process on the second node always appears on the first node. Is this a feature of the shell? And a related question: when I run the shell with the -detached flag and start a process via -eval where does the io:format output go then? -- Deryk Barker, Computer Science Dept. Music does not have to be understood Camosun College, Victoria, BC, Canada It has to be listened to. email: dbarker@REDACTED phone: +1 250 370 4452 Hermann Scherchen. From tuncer.ayaz@REDACTED Fri Apr 25 09:02:34 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Fri, 25 Apr 2008 09:02:34 +0200 Subject: [erlang-questions] [OT] Concurrent Programming in Erlang still available Message-ID: <4ac8254d0804250002h7859c84ep527531eb51f3072a@mail.gmail.com> I wanted to inform you guys that I was able to grab a copy off of the German amazon.de via an external merchant. http://www.amazon.de/dp/013508301X/ I'm not sure how many copies are still available but there's at least two merchants selling used copies at a very expensive price and one selling a new copy at a moderate price which is still as expensive as the unused copy I got from the merchant who doesn't seem to have any copies anymore. Naturally the book doesn't talk about Mnesia and other "newer" additions. Hey, it was written between 1993 and 1996. From vlm@REDACTED Fri Apr 25 09:23:25 2008 From: vlm@REDACTED (Lev Walkin) Date: Fri, 25 Apr 2008 00:23:25 -0700 Subject: [erlang-questions] [OT] Concurrent Programming in Erlang still available In-Reply-To: <4ac8254d0804250002h7859c84ep527531eb51f3072a@mail.gmail.com> References: <4ac8254d0804250002h7859c84ep527531eb51f3072a@mail.gmail.com> Message-ID: <481186ED.1090708@lionet.info> Tuncer Ayaz wrote: > I wanted to inform you guys that I was able to grab a copy off of the > German amazon.de via an external merchant. > > http://www.amazon.de/dp/013508301X/ > > I'm not sure how many copies are still available but there's at least two > merchants selling used copies at a very expensive price and one selling > a new copy at a moderate price which is still as expensive as the unused > copy I got from the merchant who doesn't seem to have any copies anymore. > > Naturally the book doesn't talk about Mnesia and other "newer" additions. > Hey, it was written between 1993 and 1996. I've managed to buy it for $140 by just "offering my price" right there on Amazon. Before that, the cost was $531.97: http://lionet.info/ljimg/amazon-erl-price.png The book was valuable for me because it talked about things new book doesn't: ASN.1 and the like. -- vlm From richardc@REDACTED Fri Apr 25 09:27:37 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 25 Apr 2008 09:27:37 +0200 Subject: [erlang-questions] Where does io:format's output go? Or where SHOULD it go? In-Reply-To: <48115201.1060607@camosun.bc.ca> References: <48115201.1060607@camosun.bc.ca> Message-ID: <481187E9.20005@it.uu.se> Deryk Barker wrote: > While setting up a demo for my students to show them how simple it is to > load code into another Erlang node and to start processes in another > node, when I do this - I start a shell on two systems in two windows, > load code from one node to the other and start it - it doesn't matter > whether I start the process on the second node via spawn/4 or > rpc:call/4, the output, written via io:format by the process on the > second node always appears on the first node. > > Is this a feature of the shell? Not the of shell, but of the IO system as a whole. Every Erlang process has an associated "group leader" process, that represents the standard-IO output and input. The group leader is inherited, so new processes get the same standard output as their parent (this is generally what you want), but it can be reassigned. So even though your new processes are spawned on a remote node, their standard IO is still sent to the original group leader on the initial node (a great example of transparency, actually). You could make a neat demonstration by letting the remote process read a local file (i.e. on the remote node) and print the contents on stdout, which will then show up on the caller's terminal. To show some activity on the remote node, you can explicitly write to 'user' instead of stdout, as in `io:fwrite(user,"the result is ~w\n",[X])'. /Richard From tuncer.ayaz@REDACTED Fri Apr 25 09:32:47 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Fri, 25 Apr 2008 09:32:47 +0200 Subject: [erlang-questions] [OT] Concurrent Programming in Erlang still available In-Reply-To: <481186ED.1090708@lionet.info> References: <4ac8254d0804250002h7859c84ep527531eb51f3072a@mail.gmail.com> <481186ED.1090708@lionet.info> Message-ID: <4ac8254d0804250032x7d8a2a76sb7dbd1f352342aed@mail.gmail.com> On Fri, Apr 25, 2008 at 9:23 AM, Lev Walkin wrote: > > Tuncer Ayaz wrote: > > > I wanted to inform you guys that I was able to grab a copy off of the > > German amazon.de via an external merchant. > > > > http://www.amazon.de/dp/013508301X/ > > > > I'm not sure how many copies are still available but there's at least two > > merchants selling used copies at a very expensive price and one selling > > a new copy at a moderate price which is still as expensive as the unused > > copy I got from the merchant who doesn't seem to have any copies anymore. > > > > Naturally the book doesn't talk about Mnesia and other "newer" additions. > > Hey, it was written between 1993 and 1996. > > > > > I've managed to buy it for $140 by just "offering my price" right there > on Amazon. Before that, the cost was $531.97: > > http://lionet.info/ljimg/amazon-erl-price.png > > The book was valuable for me because it talked about things new book > doesn't: ASN.1 and the like. Yep, and they write about implementing a database. From raimo+erlang-questions@REDACTED Fri Apr 25 09:33:21 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 25 Apr 2008 09:33:21 +0200 Subject: [erlang-questions] : IPv6 name resolver patch for R12B-2 In-Reply-To: References: <20080409072743.GA10417@erix.ericsson.se> <47FD206A.7050804@gmail.com> <20080417080329.GA23742@erix.ericsson.se> <20080417094833.GC27385@erix.ericsson.se> <20080424141704.GA22245@erix.ericsson.se> Message-ID: <20080425073321.GA6300@erix.ericsson.se> On Thu, Apr 24, 2008 at 03:44:37PM -0700, Matthew Dempsky wrote: > On Thu, Apr 24, 2008 at 1:10 PM, Matthew Dempsky wrote: > > Awesome! I applied it to an R12B-3 snapshot (from yesterday or so) > > and it works great on OS X 10.5.2: > Great to hear! > I just noticed this patch is already included in the latest R12B-3 > snapshot. Just to be clear, the snapshot I used must have been from > before when this patch was merged, because the diff applied cleanly > and without needing to be reversed. It appears our R12B-3 snapshots are of our nightly build view spec, that is all patch branches that we developers deem worthy of testing on all build machines, an not the r12b-3_dev branch (that contain the patch branches that has passed the nightly build tests) as I though. Very well. I think I inserted the patch branch for Wednesday nightbuilds that start around 1900 (CET,DST), so Thursday morning snapshot (around 0300) and later should contain the patch. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Fri Apr 25 09:49:05 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 25 Apr 2008 09:49:05 +0200 Subject: [erlang-questions] Where does io:format's output go? Or where SHOULD it go? In-Reply-To: <48115201.1060607@camosun.bc.ca> References: <48115201.1060607@camosun.bc.ca> Message-ID: <20080425074905.GB6300@erix.ericsson.se> On Thu, Apr 24, 2008 at 08:37:37PM -0700, Deryk Barker wrote: > Excuse me if this is a dim question; although I am a fan of Erlang, my > experience is limited: I teach at a college and this will be only the > second time I've introduced the language (and the FP paradigm) into our > Network Programming course. > > While setting up a demo for my students to show them how simple it is to > load code into another Erlang node and to start processes in another > node, when I do this - I start a shell on two systems in two windows, > load code from one node to the other and start it - it doesn't matter > whether I start the process on the second node via spawn/4 or > rpc:call/4, the output, written via io:format by the process on the > second node always appears on the first node. > > Is this a feature of the shell? Not really. Every erlang process has a "group leader", and that is a process that io:format/2,3 per default use as IO server for output. Check out erlang:group_leader/0,1. spawn/4 makes the spawned process inherit the parent's group leader. rpc:call/4 passes the caller's group leader to the RPC server, and the RPC server sets the group leader of spawned process that executes the RPC call. And since it does not matter much if a process is local or remote remote it works just fine with a remote group leader. If you instead call erlang:display/1 via RPC you will see the argument is displayed on the executing node's terminal. > > And a related question: when I run the shell with the -detached flag and > start a process via -eval where does the io:format output go then? > The erlang node detaches from its terminal and all io:format output (that goes to the default group leader (that prints on STDOUT)) goes to /dev/null. > -- > > Deryk Barker, Computer Science Dept. Music does not have to be > understood > Camosun College, Victoria, BC, Canada It has to be listened to. > email: dbarker@REDACTED > phone: +1 250 370 4452 Hermann > Scherchen. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From adam@REDACTED Fri Apr 25 16:56:17 2008 From: adam@REDACTED (Adam Lindberg) Date: Fri, 25 Apr 2008 16:56:17 +0200 Subject: [erlang-questions] Compiling R12B-2 on Ubuntu 7.10 Message-ID: <6344005f0804250756j1a54f5bar9e7b3ba4734bdb74@mail.gmail.com> Hi! I'm trying to compile Erlang R12B-2 on Ubuntu 7.10 with the following configuration: ./configure --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll However, when compiling Dialyzer I get the following error: === Entering application dialyzer make[2]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src' Dialyzer will now build auxiliary information needed for subsequent analyses... A PLT for following libs will be built: [kernel,mnesia,stdlib] To select a different set please edit the file /home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src/Makefile /home/alind/Applications/otp_src_R12B-2/bin/dialyzer --check_init_plt {"init terminating in do_boot",{undef,[{dialyzer,plain_cl,[]},{init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () make[2]: *** [/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/plt/dialyzer_init_plt] Error 1 make[2]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer' make: *** [dialyzer] Error 2 Anybody encountered this before? The undef suggests that the module dialyzer cannot be found? I'd appreciate any help! Cheers! Adam -- Adam Lindberg Erlang Training & Consulting, http://www.erlang-consulting.com From rvirding@REDACTED Fri Apr 25 17:02:28 2008 From: rvirding@REDACTED (Robert Virding) Date: Fri, 25 Apr 2008 17:02:28 +0200 Subject: [erlang-questions] New version of LFE, Lisp Flavoured Erlang Message-ID: <3dbc6d1c0804250802i4cf2d031ifa3cb67396c3f3c0@mail.gmail.com> I have just released a new version of LFE, Lisp Flavoured Erlang. New features in LFE 0.2 are: - The really *BIG* change is that LFE is now Lisp-2 like Common Lisp, i.e. functions and variables reside in different name spaces, instead being a Lisp-1 like Scheme where they reside in the same name space. The reason for this change is that the ErlangVM does keep variables and functions separate and while Core Erlang tries to hide this fact it does not fully succeed. In fact, it is actually impossible to do this given Erlang's property of being able to have many functions of the same name but with different arites. While this is not as elegant and forces the use of funcall to call functions bound to variables it works better. It is not an irrevocable change but I would need really convincing arguments to change it back. - Being a Lisp-2 has introduced some new core forms to handle them: flet, flet*, fletrec and funcall. Letrec has been removed. - The handling of macros has been cleaned up. - Schemes, R5RS, handling of ellipsis '...' in syntax-rules has been added. This really simplifies writing some macros in a elegant way. - The interpreter, lfe_eval, can now handle the complete language. - In patterns both tuples and binaries/bitstrings use the general constructor form, the constant form now only matches a literal tuple or binary. For example: (tuple 'ok a b) - is eqivalent to {ok,A,B} #('ok a b) - is eqivalent to {[quote,ok],a,b} (binary (f float (size 32)) (rest binary)) - is eqivalent to <> Even though this may be longer and, in some cases, more difficult to "see" I prefer it as it is consistent. - Patterns can now have aliases, (= pat-1 pat-2). These are checked in the linter and non-matching patterns are classed as an error. In future releases they should become warnings. - There is now an LFE shell which evaluates expressions and prints the results. It is still a bit primitive and doesn't use processes as it should in the same manner as the standard Erlang shell does. But it does have one very nice feature, you can slurp in a source file and run evaluate all the functions in the shell. Any macros defined in the file are also available. It is not yet possible to define functions/macros in the shell but that should use soon be possible. You should also then be able to do regurg?tate which would write all the definitions out to a file. - Running a shell other than the standard erlang one is a bit difficult so I have included a patched version of user_drv.erl from the standard kernel app which allows you to start specific shells, both local and remote. You can either put it into the distribution or leave it where you run the LFE system and it will be picked up. As far as I can see it is "safe" to use. - There are two versions of the interpreter, one written in Erlang, the standard, and a compatible one written in LFE. Lfe_eval.lfe is not written in a consistent manner and can be seen as an example of the various styles of LFE programming, for example using match-lambda or lambda/case. - As before there are a number of test files included as example code in lieu of better documentation. They are also useful to see the Core code generated by the LFE compiler, just add an option [dcore]. N.B. Not all the test files compile, but this is on purpose to test linter. - There is now a lisp prettyprinter in lfe_io. Unfortunately the io functions in lfe_io are not always obviously named from a lisp viewpoint. The system can be found in the "User Contributions" section at trapexit.org, http://forum.trapexit.org/viewtopic.php?p=43887#43887 . -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: user_guide.txt URL: From cyberlync@REDACTED Fri Apr 25 20:42:37 2008 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 25 Apr 2008 18:42:37 +0000 Subject: [erlang-questions] Seattle Erlounge Tonight! Message-ID: Everyone, Just a quick reminder that there will be an erlounge at Barca's in Capitol Hill tonight at 6:30. See privious emails for more info. Thanks, Eric From kostis@REDACTED Fri Apr 25 21:24:53 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 25 Apr 2008 22:24:53 +0300 Subject: [erlang-questions] Compiling R12B-2 on Ubuntu 7.10 In-Reply-To: <6344005f0804250756j1a54f5bar9e7b3ba4734bdb74@mail.gmail.com> References: <6344005f0804250756j1a54f5bar9e7b3ba4734bdb74@mail.gmail.com> Message-ID: <48123005.3080909@cs.ntua.gr> Adam Lindberg wrote: > Hi! > > I'm trying to compile Erlang R12B-2 on Ubuntu 7.10 with the following > configuration: > > ./configure --enable-hipe --enable-smp-support --enable-threads > --enable-kernel-poll > > However, when compiling Dialyzer I get the following error: > > === Entering application dialyzer > make[2]: Entering directory > `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src' > Dialyzer will now build auxiliary information needed for subsequent analyses... > A PLT for following libs will be built: I've never seen this happening, but it does look weird. After the === Entering ... line you should be seeing some lines which read as: === Entering application dialyzer make[2]: Entering directory `/home/kostis/HiPE/otp/lib/dialyzer/src' erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer.erl erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer_analysis_callgraph.erl erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer_callgraph.erl erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer_cl.erl .... If you do not see these lines (and the .beam files do exist under "lib/dialyzer/ebin") then it's no wonder you get the error you reported. Hope this helps. Kostis From kostis@REDACTED Fri Apr 25 21:25:19 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 25 Apr 2008 22:25:19 +0300 Subject: [erlang-questions] Compiling R12B-2 on Ubuntu 7.10 In-Reply-To: <6344005f0804250756j1a54f5bar9e7b3ba4734bdb74@mail.gmail.com> References: <6344005f0804250756j1a54f5bar9e7b3ba4734bdb74@mail.gmail.com> Message-ID: <4812301F.1080608@cs.ntua.gr> Adam Lindberg wrote: > Hi! > > I'm trying to compile Erlang R12B-2 on Ubuntu 7.10 with the following > configuration: > > ./configure --enable-hipe --enable-smp-support --enable-threads > --enable-kernel-poll > > However, when compiling Dialyzer I get the following error: > > === Entering application dialyzer > make[2]: Entering directory > `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src' > Dialyzer will now build auxiliary information needed for subsequent analyses... > A PLT for following libs will be built: I've never seen this happening, but it does look weird. After the === Entering ... line you should be seeing some lines which read as: === Entering application dialyzer make[2]: Entering directory `/home/kostis/HiPE/otp/lib/dialyzer/src' erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer.erl erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer_analysis_callgraph.erl erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer_callgraph.erl erlc -W +debug_info +warn_unused_import +warn_obsolete_guard +warn_untyped_record +warn_missing_spec_exported -o../ebin dialyzer_cl.erl .... If you do not see these lines (and the .beam files do exist under "lib/dialyzer/ebin") then it's no wonder you get the error you reported. Hope this helps. Kostis From fritchie@REDACTED Fri Apr 25 23:15:39 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 25 Apr 2008 16:15:39 -0500 Subject: [erlang-questions] Record initializer work-around for smart_exceptions? Message-ID: <96687.1209158139@snookles.snookles.com> Hi. I suppose this question could be directed to Thomas Lindren, but I thought I'd share with a wider audience. Is there a way to avoid these errors (due to introducing temp variables by the parse transform) when a record initializer contains something other than a simple term? ./foo.erl:0: variable '_0' in record definition ./foo.erl:0: variable '_1' in record definition ... in a module like this (using the R11B-5 compiler, at least): -module(foo). -compile(export_all). %% -record(foo, { item = 0 }). % works -record(foo, { item = -1 }). % doesn't work %% -record(foo, { item = erlang:now() }). % doesn't work %% -record(foo, { item = now() }). % works func() -> #foo{}. "Simple term" is a bit misleading, because -1 appears to be a simple term in my book, but the hyphen confuses the parse transform. Much of the code I'd like to use with smart_exceptions uses negative constants, unfortunately. -Scott From exta7@REDACTED Sat Apr 26 00:44:49 2008 From: exta7@REDACTED (Zvi) Date: Fri, 25 Apr 2008 15:44:49 -0700 (PDT) Subject: [erlang-questions] binary elements greater than 255 Message-ID: <16906944.post@talk.nabble.com> Is this a bug? Zvi ------------------------------------------------------------ Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0] Eshell V5.6 (abort with ^G) 1> 1> <<0,255>>. <<0,255>> 2> <<0,256>>. <<0,0>> 3> <<0,257>>. <<0,1>> 4> <<0,65536>>. <<0,0>> 5> <<0,1111111111>>. <<0,199>> 6> -- View this message in context: http://www.nabble.com/binary-elements-greater-than-255-tp16906944p16906944.html Sent from the Erlang Questions mailing list archive at Nabble.com. From igorrs@REDACTED Sat Apr 26 01:11:06 2008 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Fri, 25 Apr 2008 20:11:06 -0300 Subject: [erlang-questions] binary elements greater than 255 In-Reply-To: <16906944.post@talk.nabble.com> References: <16906944.post@talk.nabble.com> Message-ID: No. If you use integers in a binary, each must be in the range [0, 255] (1-byte). Igor. On Fri, Apr 25, 2008 at 7:44 PM, Zvi wrote: > > Is this a bug? > Zvi > ------------------------------------------------------------ > Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0] > > Eshell V5.6 (abort with ^G) > 1> > 1> <<0,255>>. > <<0,255>> > 2> <<0,256>>. > <<0,0>> > 3> <<0,257>>. > <<0,1>> > 4> <<0,65536>>. > <<0,0>> > 5> <<0,1111111111>>. > <<0,199>> > 6> > -- > View this message in context: http://www.nabble.com/binary-elements-greater-than-255-tp16906944p16906944.html > Sent from the Erlang Questions mailing list archive at Nabble.com. From masterofquestions@REDACTED Sat Apr 26 01:24:30 2008 From: masterofquestions@REDACTED (db) Date: Fri, 25 Apr 2008 19:24:30 -0400 Subject: [erlang-questions] distributed application sync_nodes_mandatory circular dependency Message-ID: <1218d6a50804251624i51a7d0aj98231521307fb9f5@mail.gmail.com> I am trying to setup distributed application on multiple erlang nodes so that when one node goes down, control of the application then moved to another node. What would the config file for node B and C look like so that possibility to handle node down/rejoin situation? According OTP documentation,http://erlang.org/doc/design_principles/part_frame.html, section 9.2, where it mentions the following setup for distributed application. Content of node A config file, a.config is: [{kernel, [{distributed, [{myapp, 5000, [a@REDACTED, {b@REDACTED, c@REDACTED}]}]}, {sync_nodes_mandatory, [b@REDACTED, c@REDACTED]}, {sync_nodes_timeout, 5000} ] } ]. Content of node B, config file, b.config is: [{kernel, [{distributed, [{myapp, 5000, [b@REDACTED, {a@REDACTED, c@REDACTED}]}]}, {sync_nodes_mandatory, [b@REDACTED, a@REDACTED]}, {sync_nodes_timeout, 5000} ] } ]. Content of node C, config file, c.config is: [{kernel, [{distributed, [{myapp, 5000, [c@REDACTED, {a@REDACTED, b@REDACTED}]}]}, {sync_nodes_mandatory, [a@REDACTED, b@REDACTED]}, {sync_nodes_timeout, 5000} ] } ]. I tried starting the nodes manually, meaning I can do one node at a time. Starting node A without starting node B or C won't work. Basically, we have circular dependency. -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From exta7@REDACTED Sat Apr 26 03:01:23 2008 From: exta7@REDACTED (Zvi) Date: Fri, 25 Apr 2008 18:01:23 -0700 (PDT) Subject: [erlang-questions] binary elements greater than 255 In-Reply-To: References: <16906944.post@talk.nabble.com> Message-ID: <16908144.post@talk.nabble.com> Hi Igor, I know that lately computer industry decided to switch from 6-bit to 8-bit bytes :), which when unsigned can hold values in range 0..255. But this wasn't my question. I asked, why Erlang compiler didn't return error, when you give it input like <<256>>. I think it's a bug. Zvi Igor Ribeiro Sucupira wrote: > > No. > If you use integers in a binary, each must be in the range [0, 255] > (1-byte). > > Igor. > > On Fri, Apr 25, 2008 at 7:44 PM, Zvi wrote: >> >> Is this a bug? >> Zvi >> ------------------------------------------------------------ >> Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0] >> >> Eshell V5.6 (abort with ^G) >> 1> >> 1> <<0,255>>. >> <<0,255>> >> 2> <<0,256>>. >> <<0,0>> >> 3> <<0,257>>. >> <<0,1>> >> 4> <<0,65536>>. >> <<0,0>> >> 5> <<0,1111111111>>. >> <<0,199>> >> 6> >> -- >> View this message in context: >> http://www.nabble.com/binary-elements-greater-than-255-tp16906944p16906944.html >> Sent from the Erlang Questions mailing list archive at Nabble.com. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/binary-elements-greater-than-255-tp16906944p16908144.html Sent from the Erlang Questions mailing list archive at Nabble.com. From igorrs@REDACTED Sat Apr 26 04:02:37 2008 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Fri, 25 Apr 2008 23:02:37 -0300 Subject: [erlang-questions] binary elements greater than 255 In-Reply-To: <16908144.post@talk.nabble.com> References: <16906944.post@talk.nabble.com> <16908144.post@talk.nabble.com> Message-ID: I think this is the classic situation "If you do it wrong, the behaviour is undefined". :-) (On the case at hand, it looks it's just taking the least significant byte from the number) In fact, maybe it should raise a warning when compiling a module with this kind of code... (?) On Fri, Apr 25, 2008 at 10:01 PM, Zvi wrote: > > Hi Igor, > > I know that lately computer industry decided to switch from 6-bit to 8-bit > bytes :), which when unsigned can hold values in range 0..255. But this > wasn't my question. I asked, why Erlang compiler didn't return error, when > you give it input like <<256>>. I think it's a bug. > > Zvi > > > Igor Ribeiro Sucupira wrote: > > > > No. > > If you use integers in a binary, each must be in the range [0, 255] > > (1-byte). > > > > Igor. > > > > On Fri, Apr 25, 2008 at 7:44 PM, Zvi wrote: > >> > >> Is this a bug? > >> Zvi > >> ------------------------------------------------------------ > >> Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0] > >> > >> Eshell V5.6 (abort with ^G) > >> 1> > >> 1> <<0,255>>. > >> <<0,255>> > >> 2> <<0,256>>. > >> <<0,0>> > >> 3> <<0,257>>. > >> <<0,1>> > >> 4> <<0,65536>>. > >> <<0,0>> > >> 5> <<0,1111111111>>. > >> <<0,199>> > >> 6> From erlang@REDACTED Sat Apr 26 07:04:58 2008 From: erlang@REDACTED (Peter Lund) Date: Sat, 26 Apr 2008 07:04:58 +0200 Subject: [erlang-questions] binary elements greater than 255 In-Reply-To: References: <16906944.post@talk.nabble.com> <16908144.post@talk.nabble.com> Message-ID: <4812B7FA.1010306@lundata.se> Please observe that this is just how the shell works... In any erlang program you make, you would use the list_to_binary/1 function. Eshell V5.3 (abort with ^G) 1> <<0,1111111111>>. <<0,199>> 2> list_to_binary([0,1111111111]). =ERROR REPORT==== 26-Apr-2008::07:02:13 === Error in process <0.24.0> with exit value: {badarg,[{erlang,list_to_binary,[[0,16#423A35C7]]},{erl_eval,do_apply1,5},{shell,eval_loop,2}]} ** exited: {badarg,[{erlang,list_to_binary,[[0,1111111111]]}, {erl_eval,do_apply1,5}, {shell,eval_loop,2}]} ** And here you get a proper crash With correct indata you get good output. 3> list_to_binary([0,111,255]). <<0,111,255>> /Peter Igor Ribeiro Sucupira skrev: > I think this is the classic situation "If you do it wrong, the > behaviour is undefined". :-) > (On the case at hand, it looks it's just taking the least significant > byte from the number) > > In fact, maybe it should raise a warning when compiling a module with > this kind of code... (?) > > On Fri, Apr 25, 2008 at 10:01 PM, Zvi wrote: > >> Hi Igor, >> >> I know that lately computer industry decided to switch from 6-bit to 8-bit >> bytes :), which when unsigned can hold values in range 0..255. But this >> wasn't my question. I asked, why Erlang compiler didn't return error, when >> you give it input like <<256>>. I think it's a bug. >> >> Zvi >> >> >> Igor Ribeiro Sucupira wrote: >> > >> > No. >> > If you use integers in a binary, each must be in the range [0, 255] >> > (1-byte). >> > >> > Igor. >> > >> > On Fri, Apr 25, 2008 at 7:44 PM, Zvi wrote: >> >> >> >> Is this a bug? >> >> Zvi >> >> ------------------------------------------------------------ >> >> Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0] >> >> >> >> Eshell V5.6 (abort with ^G) >> >> 1> >> >> 1> <<0,255>>. >> >> <<0,255>> >> >> 2> <<0,256>>. >> >> <<0,0>> >> >> 3> <<0,257>>. >> >> <<0,1>> >> >> 4> <<0,65536>>. >> >> <<0,0>> >> >> 5> <<0,1111111111>>. >> >> <<0,199>> >> >> 6> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From mog-lists@REDACTED Sat Apr 26 07:39:37 2008 From: mog-lists@REDACTED (Matthew O'Gorman) Date: Sat, 26 Apr 2008 00:39:37 -0500 Subject: [erlang-questions] binary elements greater than 255 In-Reply-To: <4812B7FA.1010306@lundata.se> References: <16906944.post@talk.nabble.com> <16908144.post@talk.nabble.com> <4812B7FA.1010306@lundata.se> Message-ID: <550d55060804252239v3d6d6201g63c776845d8d3cd@mail.gmail.com> > > > >> I know that lately computer industry decided to switch from 6-bit to > 8-bit > >> bytes :), which when unsigned can hold values in range 0..255. But > this > >> wasn't my question. I asked, why Erlang compiler didn't return error, > when > >> you give it input like <<256>>. I think it's a bug. > >> > >> Zvi > I hope I am not the only person but I think this is the exact right behavior. If you over flow a binary digit it rolls over, in many cases this an intended behavior. Now why an int isn't 4 bytes instead of 1 that does seem a bit wrong, but not to shocking. Mog -------------- next part -------------- An HTML attachment was scrubbed... URL: From valentin@REDACTED Sat Apr 26 08:40:02 2008 From: valentin@REDACTED (Valentin Micic) Date: Sat, 26 Apr 2008 08:40:02 +0200 Subject: [erlang-questions] binary elements greater than 255 References: <16906944.post@talk.nabble.com> <16908144.post@talk.nabble.com> <4812B7FA.1010306@lundata.se> Message-ID: <002301c8a768$66b4c720$6701a8c0@moneymaker2> Well... is it only shell? Say I write a function like: F=fun(A) -> <<0, A>> end. and then do: > F( 10 ). > <<0, 10>> ... > F(100). > <<0, 100>> ... > F(1000). > <<0, 232>> ... > F(10000000). > <<0, 128>> ... > F(1111111111). > <<0, 199>> I've been under impression that functional objects are implicitly compiled, therefore behave like any ERLANG program, thus, should generate exception for, say, F(1000). I suppose, one should not assume anything, eh? V. PS This does not seem to be a new thing, as I can trace the same behaviour back to R9C. ----- Original Message ----- From: "Peter Lund" To: "Igor Ribeiro Sucupira" Cc: ; "Zvi" Sent: Saturday, April 26, 2008 7:04 AM Subject: Re: [erlang-questions] binary elements greater than 255 > Please observe that this is just how the shell works... > > In any erlang program you make, you would use the list_to_binary/1 > function. > > Eshell V5.3 (abort with ^G) > 1> <<0,1111111111>>. > <<0,199>> > 2> list_to_binary([0,1111111111]). > > =ERROR REPORT==== 26-Apr-2008::07:02:13 === > Error in process <0.24.0> with exit value: > {badarg,[{erlang,list_to_binary,[[0,16#423A35C7]]},{erl_eval,do_apply1,5},{shell,eval_loop,2}]} > > ** exited: {badarg,[{erlang,list_to_binary,[[0,1111111111]]}, > {erl_eval,do_apply1,5}, > {shell,eval_loop,2}]} ** > > And here you get a proper crash > > With correct indata you get good output. > > 3> list_to_binary([0,111,255]). > <<0,111,255>> > > /Peter > > > Igor Ribeiro Sucupira skrev: >> I think this is the classic situation "If you do it wrong, the >> behaviour is undefined". :-) >> (On the case at hand, it looks it's just taking the least significant >> byte from the number) >> >> In fact, maybe it should raise a warning when compiling a module with >> this kind of code... (?) >> >> On Fri, Apr 25, 2008 at 10:01 PM, Zvi wrote: >> >>> Hi Igor, >>> >>> I know that lately computer industry decided to switch from 6-bit to >>> 8-bit >>> bytes :), which when unsigned can hold values in range 0..255. But this >>> wasn't my question. I asked, why Erlang compiler didn't return error, >>> when >>> you give it input like <<256>>. I think it's a bug. >>> >>> Zvi >>> >>> >>> Igor Ribeiro Sucupira wrote: >>> > >>> > No. >>> > If you use integers in a binary, each must be in the range [0, 255] >>> > (1-byte). >>> > >>> > Igor. >>> > >>> > On Fri, Apr 25, 2008 at 7:44 PM, Zvi wrote: >>> >> >>> >> Is this a bug? >>> >> Zvi >>> >> ------------------------------------------------------------ >>> >> Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0] >>> >> >>> >> Eshell V5.6 (abort with ^G) >>> >> 1> >>> >> 1> <<0,255>>. >>> >> <<0,255>> >>> >> 2> <<0,256>>. >>> >> <<0,0>> >>> >> 3> <<0,257>>. >>> >> <<0,1>> >>> >> 4> <<0,65536>>. >>> >> <<0,0>> >>> >> 5> <<0,1111111111>>. >>> >> <<0,199>> >>> >> 6> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From kostis@REDACTED Sat Apr 26 10:15:56 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 26 Apr 2008 11:15:56 +0300 Subject: [erlang-questions] binary elements greater than 255 In-Reply-To: <16906944.post@talk.nabble.com> References: <16906944.post@talk.nabble.com> Message-ID: <4812E4BC.9090107@cs.ntua.gr> Zvi wrote: > Is this a bug? > ------------------------------------------------------------ > Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0] > > Eshell V5.6 (abort with ^G) > 1> > 1> <<0,255>>. > <<0,255>> > 2> <<0,256>>. > <<0,0>> > 3> <<0,257>>. > <<0,1>> > 4> <<0,65536>>. > <<0,0>> No, this is not a bug. This is how binary construction is defined. The think that confuses you is that when you e.g. write <<0,256>> you are most probably forgetting that this is just a shorthand for the construct <<0:8/integer-unsigned,256:8/integer-unsigned>> so you are effectively telling the Erlang system: I want you to consider 0 and 256 as unsigned integers take the last 8 bits of each of them and form a 16 bit binary. Hence the results. This is consistent with 1> <<255:4>>. <<15:4>> 2> <<-255:4>>. <<1:4>> 3> <<-1:5>>. <<31:5>> Hope this explains things. Kostis From matthew@REDACTED Sat Apr 26 10:24:32 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Sat, 26 Apr 2008 01:24:32 -0700 Subject: [erlang-questions] Record initializer work-around for smart_exceptions? In-Reply-To: <96687.1209158139@snookles.snookles.com> References: <96687.1209158139@snookles.snookles.com> Message-ID: On Fri, Apr 25, 2008 at 2:15 PM, Scott Lystig Fritchie wrote: > -module(foo). > -compile(export_all). > > %% -record(foo, { item = 0 }). % works > -record(foo, { item = -1 }). % doesn't work > %% -record(foo, { item = erlang:now() }). % doesn't work > %% -record(foo, { item = now() }). % works > > func() -> #foo{}. This module compiles fine for me with R11B-2 and R12B-1. Can you give a more complete test case that is failing for you? From golubovsky@REDACTED Sat Apr 26 17:49:08 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sat, 26 Apr 2008 11:49:08 -0400 Subject: [erlang-questions] Flooring integer division in Erlang? Message-ID: Hi, Is there any Erlang library around that contains an integer division function that rounds negative quotient down (towards negative infunity, flooring division)? I am trying to implement Haskell-style division which for (-5) `div` (3) yields -2 while Erlang's (-5) div (3) yields -1 Thanks. PS The Erlang specification (rather old, of 1999 http://www.erlang.org/download/erl_spec47.ps.gz), mentions on page 15 that at some moment, operations // and mod were added, which round to negative infinity (as oposite to div and rem). Were these ever implemented? -- Dimitry Golubovsky Anywhere on the Web From richardc@REDACTED Sat Apr 26 18:17:07 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 26 Apr 2008 18:17:07 +0200 Subject: [erlang-questions] Flooring integer division in Erlang? In-Reply-To: References: Message-ID: <48135583.1020600@it.uu.se> Dimitry Golubovsky wrote: > PS The Erlang specification (rather old, of 1999 > http://www.erlang.org/download/erl_spec47.ps.gz), mentions on page 15 > that at some moment, operations // and mod were added, which round to > negative infinity (as oposite to div and rem). Were these ever > implemented? No. /Richard From igorrs@REDACTED Sat Apr 26 19:37:01 2008 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Sat, 26 Apr 2008 14:37:01 -0300 Subject: [erlang-questions] Flooring integer division in Erlang? In-Reply-To: References: Message-ID: Are you just in need of some (any) high-level implementation? Or you're after some really efficient operator? Igor. On Sat, Apr 26, 2008 at 12:49 PM, Dimitry Golubovsky wrote: > Hi, > > Is there any Erlang library around that contains an integer division > function that rounds negative quotient down (towards negative > infunity, flooring division)? > > I am trying to implement Haskell-style division which for > > (-5) `div` (3) yields -2 > > while Erlang's (-5) div (3) yields -1 > > Thanks. > > PS The Erlang specification (rather old, of 1999 > http://www.erlang.org/download/erl_spec47.ps.gz), mentions on page 15 > that at some moment, operations // and mod were added, which round to > negative infinity (as oposite to div and rem). Were these ever > implemented? > > -- > Dimitry Golubovsky > > Anywhere on the Web From ulf@REDACTED Sat Apr 26 22:33:00 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 26 Apr 2008 22:33:00 +0200 Subject: [erlang-questions] distributed application sync_nodes_mandatory circular dependency In-Reply-To: <1218d6a50804251624i51a7d0aj98231521307fb9f5@mail.gmail.com> References: <1218d6a50804251624i51a7d0aj98231521307fb9f5@mail.gmail.com> Message-ID: <8209f740804261333g26f1853dwed9626a9fd63b4e8@mail.gmail.com> It's typical that you would have a circular dependency, if the nodes are standby for each other. If you would like A to be able to continue alone if B or C haven't appeared within the specified timeout, change sync_nodes_mandatory to sync_nodes_optional. BR, Ulf W 2008/4/26 db : > I am trying to setup distributed application on multiple erlang nodes > so that when one node goes down, control of the application then moved > to another node. What would the config file for node B and C look like > so that possibility to handle node down/rejoin situation? > > According OTP documentation,http://erlang.org/doc/design_principles/part_frame.html, > section 9.2, where it mentions the following setup for distributed > application. Content of node A config file, a.config is: > > [{kernel, > [{distributed, [{myapp, 5000, [a@REDACTED, {b@REDACTED, c@REDACTED}]}]}, > {sync_nodes_mandatory, [b@REDACTED, c@REDACTED]}, > {sync_nodes_timeout, 5000} > ] > } > ]. > > Content of node B, config file, b.config is: > [{kernel, > [{distributed, [{myapp, 5000, [b@REDACTED, {a@REDACTED, c@REDACTED}]}]}, > {sync_nodes_mandatory, [b@REDACTED, a@REDACTED]}, > {sync_nodes_timeout, 5000} > ] > } > ]. > > Content of node C, config file, c.config is: > > [{kernel, > [{distributed, [{myapp, 5000, [c@REDACTED, {a@REDACTED, b@REDACTED}]}]}, > {sync_nodes_mandatory, [a@REDACTED, b@REDACTED]}, > {sync_nodes_timeout, 5000} > ] > } > ]. > > I tried starting the nodes manually, meaning I can do one node at a > time. Starting node A without starting node B or C won't work. > Basically, we have circular dependency. > > -- > rk > > That which we persist in doing becomes easier for us to do; not that > the nature of the thing itself is changed, but that our power to do is > increased. > -Ralph Waldo Emerson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From golubovsky@REDACTED Sun Apr 27 00:58:06 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sat, 26 Apr 2008 18:58:06 -0400 Subject: [erlang-questions] Flooring integer division in Erlang? In-Reply-To: References: Message-ID: Hi, I am implementing a program that converts intermediate output from a Haskell compiler (Yhc Core) to Erlang Core. Therefore it is desirable to emulate behavior of Haskell operations as closely as possible. So whatever could be used, would be good, either high level, or low level implementation. Low level could probably be done at the virtual machine level, but this does not seem to be the best way as would result in custom version of the VM. If there is a high level implementation I'd appreciate if you provide a link. Thanks. On Sat, Apr 26, 2008 at 1:37 PM, Igor Ribeiro Sucupira wrote: > Are you just in need of some (any) high-level implementation? Or > you're after some really efficient operator? > > Is there any Erlang library around that contains an integer division > > function that rounds negative quotient down (towards negative > > infunity, flooring division)? -- Dimitry Golubovsky Anywhere on the Web From igorrs@REDACTED Sun Apr 27 01:59:13 2008 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Sat, 26 Apr 2008 20:59:13 -0300 Subject: [erlang-questions] Flooring integer division in Erlang? In-Reply-To: References: Message-ID: You could use, for example, the BIF trunc/1. Something like this: floorDiv(A, B) -> Quotient = A / B, Truncated = trunc(Quotient), case Truncated > Quotient of true -> Truncated - 1; false -> Truncated end. On Sat, Apr 26, 2008 at 7:58 PM, Dimitry Golubovsky wrote: > Hi, > > I am implementing a program that converts intermediate output from a > Haskell compiler (Yhc Core) to Erlang Core. Therefore it is desirable > to emulate behavior of Haskell operations as closely as possible. So > whatever could be used, would be good, either high level, or low level > implementation. Low level could probably be done at the virtual > machine level, but this does not seem to be the best way as would > result in custom version of the VM. If there is a high level > implementation I'd appreciate if you provide a link. > > Thanks. > > > On Sat, Apr 26, 2008 at 1:37 PM, Igor Ribeiro Sucupira wrote: > > Are you just in need of some (any) high-level implementation? Or > > you're after some really efficient operator? > > > > > Is there any Erlang library around that contains an integer division > > > function that rounds negative quotient down (towards negative > > > infunity, flooring division)? > > -- > > > Dimitry Golubovsky > > Anywhere on the Web > From rvirding@REDACTED Sun Apr 27 02:13:21 2008 From: rvirding@REDACTED (Robert Virding) Date: Sun, 27 Apr 2008 02:13:21 +0200 Subject: [erlang-questions] Flooring integer division in Erlang? In-Reply-To: References: Message-ID: <3dbc6d1c0804261713x7ae140asd64744a9e3874687@mail.gmail.com> 2008/4/27 Dimitry Golubovsky : > Hi, > > I am implementing a program that converts intermediate output from a > Haskell compiler (Yhc Core) to Erlang Core. Therefore it is desirable > to emulate behavior of Haskell operations as closely as possible. So > whatever could be used, would be good, either high level, or low level > implementation. Low level could probably be done at the virtual > machine level, but this does not seem to be the best way as would > result in custom version of the VM. If there is a high level > implementation I'd appreciate if you provide a link. > > Thanks. I don't quite understand. Will you then compile Erlang Core to the Erlang VM and in that way get a Haskell running on Erlang? In that case cool. How are you representing Haskell data types in erlang? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From golubovsky@REDACTED Sun Apr 27 03:52:18 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sat, 26 Apr 2008 21:52:18 -0400 Subject: [erlang-questions] Haskell on Erlang was: Flooring integer division in Erlang? Message-ID: Robert, On Sat, Apr 26, 2008 at 8:13 PM, Robert Virding wrote: > 2008/4/27 Dimitry Golubovsky : > > I am implementing a program that converts intermediate output from a > > Haskell compiler (Yhc Core) to Erlang Core. Therefore it is desirable > I don't quite understand. Will you then compile Erlang Core to the Erlang VM > and in that way get a Haskell running on Erlang? In that case cool. How are > you representing Haskell data types in erlang? Yes, Haskell programs running on Erlang runtime and VM is the goal. I use some parts of Haskerl in my code, plus some pieces of the Yhc -> Javascript converter. Not much to publish right now though. As of now, Haskell objects are represented as tagged tuples (tag is an atom, the first member of tuple). Basically, data types do not exist (almost) in Yhc Core. Numeric values are represented by themselves. Data constructors and unevaluated thunks are tuples. like this: {'@dt','.CONS',_v23624,_v23625} is application of the (:) constructor to two arguments {'@ap',{'hs_test1','.5_c'},1,[_v26406|[]]} is a thunk - application of the 'hs_test1':'.5_c'/1 to one argument Lists are nested tuples (as they are nested applications of : and [] constructors). Strings may be in "compact" form (tuple consisting of a special tag and an Erlang string), lazily converted to Haskell lists, etc. {'@lst',"ABCDEF"} is a compact form of a string. After the first evaluation it would become: {'@dt','.CONS', 65, {'@lst',"BCDEF"}} and so on. I will definitely provide more information as things get finalized. As a brief example: Erlang factorial function: fac(0) -> 0; fac(1) -> 1; fac(N) -> N * fac(N - 1). yields this: 'fac'/1 = %% Line 17 fun (_cor0) -> case _cor0 of <0> when 'true' -> 0 %% Line 18 <1> when 'true' -> 1 %% Line 19 when 'true' -> let <_cor1> = call 'erlang':'-' (N, 1) in let <_cor2> = apply 'fac'/1 (_cor1) in call 'erlang':'*' (N, _cor2) end while Haskell function: fac :: Int -> Int fac 0 = 0 fac 1 = 1 fac n = n * fac (n - 1) yields this: 'fac'/1 = fun (_v252_f) -> let <_v252> = in let <_v252_c> = in case <_v252_c> of <0> when 'true' -> 0 <1> when 'true' -> 1 <_> when 'true' -> call 'erlang':'*'(_v252_c,call 'hs_test1':'fac'(call 'hs_test1':'.3'(_v252_c,1))) end Although this example is a bit artificial, it shows that sometimes there is not so much difference between core generated from Erlang and form Haskell. -- Dimitry Golubovsky Anywhere on the Web From golubovsky@REDACTED Sun Apr 27 04:06:28 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sat, 26 Apr 2008 22:06:28 -0400 Subject: [erlang-questions] Flooring integer division in Erlang? In-Reply-To: References: Message-ID: Igor, Thanks for the suggestion, but it does not work as needed with large numbers. I tried similar things just like floor(A/B) (floor/1 was found somewhere on TrapExit). Say we want to print a factorial of 40. Each digit is obtained by taking a quot and rem from division by 10. What I compute is equivalent to (show . fac) in Haskell With your function instead of div, in Haskell compiled to Erlang: 11> hserl:hslist((hserl:force(hs_test1:main()))(40)). "815915283247897600060660666066242068688062066800" Same in ghci: Prelude> let fac 1 = 1; fac n = n * fac (n - 1) Prelude> (show . fac) 40 "815915283247897734345611269596115894272000000000" And when I use the standard div, in Haskell compiled to Erlang: 13> hserl:hslist((hserl:force(hs_test1:main()))(40)). "815915283247897734345611269596115894272000000000" Thanks. On Sat, Apr 26, 2008 at 7:59 PM, Igor Ribeiro Sucupira wrote: > You could use, for example, the BIF trunc/1. > Something like this: > > floorDiv(A, B) -> > Quotient = A / B, > Truncated = trunc(Quotient), > case Truncated > Quotient of > true -> Truncated - 1; > false -> Truncated > end. > > -- Dimitry Golubovsky Anywhere on the Web From igorrs@REDACTED Sun Apr 27 09:28:05 2008 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Sun, 27 Apr 2008 04:28:05 -0300 Subject: [erlang-questions] Flooring integer division in Erlang? In-Reply-To: References: Message-ID: Hum... I see. Maybe this other implementation? floorDiv(A, B) -> case ((A < 0 andalso B >= 0) orelse (A >= 0 andalso B < 0)) andalso A rem B =/= 0 of true -> (A div B) - 1; false -> A div B end. On Sat, Apr 26, 2008 at 11:06 PM, Dimitry Golubovsky wrote: > Igor, > > Thanks for the suggestion, but it does not work as needed with large > numbers. I tried similar things just like floor(A/B) (floor/1 was > found somewhere on TrapExit). > > Say we want to print a factorial of 40. Each digit is obtained by > taking a quot and rem from division by 10. What I compute is > equivalent to (show . fac) in Haskell > > With your function instead of div, in Haskell compiled to Erlang: > > 11> hserl:hslist((hserl:force(hs_test1:main()))(40)). > "815915283247897600060660666066242068688062066800" > > Same in ghci: > > Prelude> let fac 1 = 1; fac n = n * fac (n - 1) > Prelude> (show . fac) 40 > "815915283247897734345611269596115894272000000000" > > And when I use the standard div, in Haskell compiled to Erlang: > > 13> hserl:hslist((hserl:force(hs_test1:main()))(40)). > "815915283247897734345611269596115894272000000000" > > Thanks. > > > On Sat, Apr 26, 2008 at 7:59 PM, Igor Ribeiro Sucupira wrote: > > You could use, for example, the BIF trunc/1. > > Something like this: > > > > floorDiv(A, B) -> > > Quotient = A / B, > > Truncated = trunc(Quotient), > > case Truncated > Quotient of > > true -> Truncated - 1; > > false -> Truncated > > end. > > > > > -- > > > Dimitry Golubovsky > > Anywhere on the Web > From sgolovan@REDACTED Sun Apr 27 13:15:05 2008 From: sgolovan@REDACTED (Sergei Golovan) Date: Sun, 27 Apr 2008 15:15:05 +0400 Subject: [erlang-questions] Problems with timer at HP PA-RISC architecture (R12B-2) Message-ID: Hi! The latest release (R12B-2) fails to build from source (actually, erts is built fine but rebuilding beams leads to random crashes) on Debian GNU/Linux on HP PA-RISC architecture. The error message is "Unexpected behaviour from operating system high resolution timer". It seems to me that there's either some race condition during erlang VM start or there's a monotonic clock skew (but the latter reason seems unlikely to be the case). R12B-1 works fine. Could you point me where to start searching this bug? Or may be there's something obvious which I miss? The full build logs are available at http://buildd.debian.org/build.php?&pkg=erlang&arch=hppa&file=log -- Sergei Golovan From rvirding@REDACTED Sun Apr 27 23:35:43 2008 From: rvirding@REDACTED (Robert Virding) Date: Sun, 27 Apr 2008 23:35:43 +0200 Subject: [erlang-questions] Another question on Open source licenses Message-ID: <3dbc6d1c0804271435r4ee60bedxa22cb957875c6768@mail.gmail.com> I now have another question on open source licenses. I am now planning to do some work on leex and fix a bug which some one has finally definitely found. At the same time I might as well fix up the licensing and add a simplified BSD copyright to it as well. There is no problem with the leex source code. What do I do however with an include file which is included into the generated tokeniser. I would like to include a copyright in the include file but then that would be included into generated tokeniser which is not my intention. I am interested in copyrighting *my* code not what is generated by it, which I consider to be *there* code. Yecc does it this way so yecc generated parsers include the erlang copyright notice. Any suggestions on how to handle this? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.regen@REDACTED Mon Apr 28 00:31:57 2008 From: michael.regen@REDACTED (Michael Regen) Date: Mon, 28 Apr 2008 00:31:57 +0200 Subject: [erlang-questions] bug under windows? -detached just exits Message-ID: <9b59d0270804271531x174ffa05o67d161b978441464@mail.gmail.com> Hi, When I try to do the following: erl -detached under Windows R12B-2 the erl.exe process just exits. The same under R11B-5 leads to a running erlang process in the background. Same result if I try to start something meaningful: erl -detached -name db@REDACTED -mnesia dir '"db"' -s mnesia Checked this on two different Windows systems. So, I am currently scratching my head how to start an Erlang daemon. What about ejabberd, etc.? And yes, I know, daemons are supposed to run under Unix... ;) Is this a new bug or did I miss something? Thank you and regards, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From arnaudsj@REDACTED Mon Apr 28 03:48:06 2008 From: arnaudsj@REDACTED (=?UTF-8?Q?S=C3=A9bastien_Arnaud?=) Date: Sun, 27 Apr 2008 20:48:06 -0500 Subject: [erlang-questions] Compile errors with hipe with R12B-2 Message-ID: <99fdce3b0804271848y5d9e04d6v1b755c1b43c6976f@mail.gmail.com> Hi, I am trying to compile R12B-2 on my home linux server but I am running into a weird compile error/crash dump. I am running ArchLinux the following gcc version: $ gcc -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/usr --enable-shared --enable-languages=c,c++,fortran,objc,obj-c++,treelang --enable-threads=posix --mandir=/usr/share/man --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch --with-tune=generic Thread model: posix gcc version 4.3.0 (GCC) Here is the error trail: [...] === Entering application hipe make[3]: Entering directory `/var/abs/local/erlang/src/otp_src_R12B-2/lib/hipe/rtl' /var/abs/local/erlang/src/otp_src_R12B-2/bin/x86_64-unknown-linux-gnu/hipe_mkliterals -e > hipe_literals.hrl erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_rtl_arch.erl {error_logger,{{2008,4,27},{18,34,11}},crash_report,[[{pid,<0.14.0>},{registered_name,[]},{error_info,{exit,{{case_clause,{'EXIT',{badarg,[{ets,match,[ac_tab,{{application_master,'$1'},<0.7.0>}]},{application_controller,get_pid_env,2},{kernel_config,get_sync_timeout,0},{kernel_config,get_sync_data,0},{kernel_config,sync_nodes,0},{kernel_config,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}}},[{kernel_config,sync_nodes,0},{kernel_config,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]},[{gen_server,init_it,6},{proc_lib,init_p,5}]}},{initial_call,{gen,init_it,[gen_server,<0.9.0>,<0.9.0>,kernel_config,[],[]]}},{ancestors,[kernel_sup,<0.8.0>]},{messages,[]},{links,[<0.9.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,377},{stack_size,23},{reductions,115}],[]]} debug2: channel 0: window 998700 sent adjust 49876 {error_logger,{{2008,4,27},{18,34,11}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{{case_clause,{'EXIT',{badarg,[{ets,match,[ac_tab,{{application_master,'$1'},<0.7.0>}]},{application_controller,get_pid_env,2},{kernel_config,get_sync_timeout,0},{kernel_config,get_sync_data,0},{kernel_config,sync_nodes,0},{kernel_config,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}}},[{kernel_config,sync_nodes,0},{kernel_config,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}},{offender,[{pid,undefined},{name,kernel_config},{mfa,{kernel_config,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2008,4,27},{18,34,12}},crash_report,[[{pid,<0.7.0>},{registered_name,[]},{error_info,{exit,{shutdown,{kernel,start,[normal,[]]}},[{application_master,init,4},{proc_lib,init_p,5}]}},{initial_call,{application_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_controller,erl_reply,auth,boot_server,code_server,disk_log_server,disk_log_sup,erl_prim_loader,error_logger,file_server_2,fixtable_server,global_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,net_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel,[]},[application,application_controller,application_master,application_starter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_distribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file,file_server,file_io_server,prim_file,global,global_group,global_search,group,heart,hipe_unified_loader,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_hosts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_adm,net_kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp,gen_sctp,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,inet_sctp,pg2,seq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{ancestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,23},{reductions,127}],[]]} {error_logger,{{2008,4,27},{18,34,12}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"} Crash dump was written to: erl_crash.dump Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}) make[3]: *** [../ebin/hipe_rtl_arch.beam] Error 1 make[3]: Leaving directory `/var/abs/local/erlang/src/otp_src_R12B-2/lib/hipe/rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/var/abs/local/erlang/src/otp_src_R12B-2/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/var/abs/local/erlang/src/otp_src_R12B-2/lib' make: *** [secondary_bootstrap_build] Error 2 BTW I tried compiling without hipe support, but I then get undefined errors leading me to believe that some part of the code still need HIPE header libraries to compile. FYI, R12B-1 compiles fine on the same system. Any ideas? Thanks! S?bastien -------------- next part -------------- An HTML attachment was scrubbed... URL: From dking@REDACTED Mon Apr 28 06:45:22 2008 From: dking@REDACTED (David King) Date: Sun, 27 Apr 2008 21:45:22 -0700 Subject: [erlang-questions] Slave nodes without proxied I/O? Message-ID: By default, nodes started as slave nodes with slave:start/1 have their I/O proxied through the master node that started them. (That is, I/O operations done with the 'file' module are done on the master's filesystem, not the slaves'). Is there any way to turn this off? From kode@REDACTED Mon Apr 28 08:56:33 2008 From: kode@REDACTED (Bhasker Kode) Date: Mon, 28 Apr 2008 12:26:33 +0530 Subject: [erlang-questions] Attempting to rewrite headers, obstacles faced Message-ID: <3935b63b0804272356l359d8740tba0563d13a87aa6c@mail.gmail.com> Hello, i've been trying to research how to rewrite request headers (from yaws), when I remember that there folks on these lists, who have written substantial code that works with header. Cheers to that... I have tried the following 3 methods to try and rewrite the headers (more specificaly the #headers{referer} Attempt [1] hacked within yaws.erl, only to find that the Referer when edited, was only being used in yaws_log:accesslogs. ( http://paste.lisp.org/display/59461 ) Result: No change in arg structure , no change in document.referrer. Attempt [2] tried setting within out(A) http://paste.lisp.org/display/59461#1 Result: No chagne in arg structure, no change in document.referrer. Attempt [3] rewriting the referer, just as arg_rewrite rewrites path, but instead return an Arg with different referer . Result: interestingly this worked in editing the Arg record, and when asked to yaws_api:reformat_headers, to show the headers, it did show the newly set referer. But...no change in document.referrer.. : / . The browser's document.referrer still showed the old one. ( http://paste.lisp.org/display/59461#2 ) Please do have look into http://paste.lisp.org/display/59461 for the snippets of the three attempts. My questions are ... Q1. Is is possible to rewrite headers such as referer within yaws ? Q2. Would you know of any explanation as to why the Arg showed referer as X, but the browser still takes Y. I've heard Apache2 (using curl) has support for manipulating request headers such as referrer, but i'm committed to doing the same in yaws as well. Keep Clicking, Bosky ( bosky101 on #erlang) -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Mon Apr 28 09:08:57 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Mon, 28 Apr 2008 00:08:57 -0700 Subject: [erlang-questions] Another question on Open source licenses In-Reply-To: <3dbc6d1c0804271435r4ee60bedxa22cb957875c6768@mail.gmail.com> References: <3dbc6d1c0804271435r4ee60bedxa22cb957875c6768@mail.gmail.com> Message-ID: 2008/4/27 Robert Virding : > Any suggestions on how to handle this? I don't really see a problem if your header file is under a permissive copyright license like BSD or MIT. If you're really worried, you can just place the header file into the public domain while maintaining copyright on the rest of the code. From alexander.lamb@REDACTED Mon Apr 28 10:11:12 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Mon, 28 Apr 2008 10:11:12 +0200 Subject: [erlang-questions] JInterface and multi-threading In-Reply-To: <20080424120243.GA17022@erix.ericsson.se> References: <28F58275-08BF-4904-BA77-0488256394BD@rodanotech.ch> <20080424120243.GA17022@erix.ericsson.se> Message-ID: >> Hello, Thanks a lot for the answer (sorry to be late, I was without connexion for 3 day...) >> It it is not clear to me if rpc from Jinterface is thread safe. Or, >> in >> other words, will this be a bottleneck for an application in an app >> server with many concurent users. > > It seems the code is written to be thread safe. It synchronizes > on the socket writes and reads. The socket to the other (Erlang) > node will always be a bottleneck (absolutely not necessarily the > smallest). Indeed, the read and write process should really be fast enough in our situation. I am not trying to optimize as if I were Google, I just want to avoid one function call to block others for example because of an exception. So it is more a question of reliability and scalability than a question of speed. > > The more Erlanghish way is to create an OtpNode and in that > create many OtpMbox:es. Each OtpMbox could be used in a dedicated > Java thread and call servers, e.g the rpc server 'rex' or > one of your own. > > A few conveniance function in OtpConnection, that is > sendRPC and receiveRPC can be used as a template for > doing RPC calls from an OtpMbox. > > sendRPC sends: > {self(), {call, Mod, Fun, ArgList, user}} > to {rex,OtherNode} > > receiveRPC receives: > {rex,Result} and returns Result. > > This is a sneak way to call the RPC server. If you do it from > Erlang rpc:call uses gen_server calls, but that should also > be possible to do from Jinterface. > Ok, what this means is that my Java code which created a JInterface mbox will wait on mbox.receive() Normally, If I am in a servlet session, I will not block my other sessions while waiting for the reply, since each servlet session is in a thread. > > > If you create one OtpNode per app server, and one OtpMbox > per user session, the sending of RPC calls from several > OtpMbox:es will compete for the connection between the > Java node (OtpNode) and the Erlang node, but the RPC > server in Erlang will spawn a new process for each > new RPC call, so one RPC call in progress will not > block other RPC calls. That is, while receiving one > RPC reply in one OtpMbox, other OtpMbox:es can > do RPC sends and receives. > Now this touches on the Erlang server part. For the time being (writing my first real Erlang app), I wrote something which will block on each call (I guess) because I wrote simple functions in a module which call a single process spawned at the initialisation of the module (as the examples given by Amstrong in his book). A better way of doing this would be to spawn a process just for the handling of the call and returning immediately. From what I read in your reply, either "rex" or OTP do this for you "out of the box". Now, I didn't want to dive into OTP before my class in London in June, but it looks like OTP could solve the bottleneck problem on the Erlang server side. Thanks again, Alex -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From ahmed.nawras@REDACTED Mon Apr 28 14:00:34 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Mon, 28 Apr 2008 16:00:34 +0400 Subject: [erlang-questions] Question: Limiting size of result set in mnesia Message-ID: Hi All, Does anyone have an idea of how to limit size of result set in mnesia similar to the effect of LIMIT clause in the SQL query below in MySQL? SELECT * FROM Topic LIMIT 5; Best regards, Ahmed Al-Issaei From vychodil.hynek@REDACTED Mon Apr 28 14:23:11 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 28 Apr 2008 14:23:11 +0200 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: References: Message-ID: <4d08db370804280523r19bb3ac8o4fc53f1b306a7107@mail.gmail.com> mnesia:select/4 On Mon, Apr 28, 2008 at 2:00 PM, Ahmed Ali wrote: > Hi All, > > Does anyone have an idea of how to limit size of result set in mnesia > similar to the effect of LIMIT clause in the SQL query below in MySQL? > > SELECT * FROM Topic LIMIT 5; > > Best regards, > > Ahmed Al-Issaei > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From zerthurd@REDACTED Mon Apr 28 14:27:27 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 28 Apr 2008 19:27:27 +0700 Subject: [erlang-questions] Old school exceptions vs. new age one Message-ID: Hello According Pragmatic Programming Erlang there is two syntax of exceptions: Old-style:
case (catch foo(...)) of
    {'EXIT', Why} ->
        ...
    Val ->
       ...
end
and new-style:
try foo(...) of
    Val -> ...
catch
    exit: Why ->
         ...
end
If I use new-style syntax, I have not detailed exception cause explanation, like this:
3> try lists:sort([1,2,3]) catch exit:Why -> io:format("~p~n", [Why]) end.
[1,2,3]
4> try lists:sort(abc) catch exit:Why -> io:format("~p~n", [Why]) end.
** exception error: function_clause
But if I use old-style syntax, I have this:
5> case (catch lists:sort(abc)) of {'EXIT', Why} -> io:format("~p~n",
[Why]) end.
{function_clause,[{lists,sort,[abc]},
                  {erl_eval,do_apply,5},
                  {erl_eval,expr,5},
                  {erl_eval,expr,5},
                  {shell,exprs,6},
                  {shell,eval_exprs,6},
                  {shell,eval_loop,3}]}
ok
Can you say me, why is new-style better than old? Thank you -- Maxim Treskin From kenneth.lundin@REDACTED Mon Apr 28 14:32:31 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 28 Apr 2008 14:32:31 +0200 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: References: Message-ID: Hi, You can use qlc http://www.erlang.org/doc/man/qlc.html or you can use mnesia:select/4 in combination with mnesia:select/1 http://www.erlang.org/doc/man/mnesia.html#select-4 /Kenneth Erlang/OTP, Ericsson On 4/28/08, Ahmed Ali wrote: > Hi All, > > Does anyone have an idea of how to limit size of result set in mnesia > similar to the effect of LIMIT clause in the SQL query below in MySQL? > > SELECT * FROM Topic LIMIT 5; > > Best regards, > > Ahmed Al-Issaei > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vychodil.hynek@REDACTED Mon Apr 28 14:39:25 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 28 Apr 2008 14:39:25 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: References: Message-ID: <4d08db370804280539g11d36d60x1009aa11be8cda0b@mail.gmail.com> Because you should use: > try lists:sort(abc) catch error:Why -> io:format("~p~n", [{Why, erlang:get_stacktrace()}]) end. {function_clause,[{lists,sort,[abc]}, {erl_eval,do_apply,5}, {erl_eval,try_clauses,8}, {shell,exprs,6}, {shell,eval_loop,3}]} ok On Mon, Apr 28, 2008 at 2:27 PM, Maxim Treskin wrote: > Hello > > According Pragmatic Programming Erlang there is two syntax of exceptions: > Old-style: >
> case (catch foo(...)) of
>    {'EXIT', Why} ->
>        ...
>    Val ->
>       ...
> end
> 
> > and new-style: >
> try foo(...) of
>    Val -> ...
> catch
>    exit: Why ->
>         ...
> end
> 
> > If I use new-style syntax, I have not detailed exception cause > explanation, like this: >
> 3> try lists:sort([1,2,3]) catch exit:Why -> io:format("~p~n", [Why]) end.
> [1,2,3]
> 4> try lists:sort(abc) catch exit:Why -> io:format("~p~n", [Why]) end.
> ** exception error: function_clause
> 
> > But if I use old-style syntax, I have this: >
> 5> case (catch lists:sort(abc)) of {'EXIT', Why} -> io:format("~p~n",
> [Why]) end.
> {function_clause,[{lists,sort,[abc]},
>                  {erl_eval,do_apply,5},
>                  {erl_eval,expr,5},
>                  {erl_eval,expr,5},
>                  {shell,exprs,6},
>                  {shell,eval_exprs,6},
>                  {shell,eval_loop,3}]}
> ok
> 
> > Can you say me, why is new-style better than old? > > Thank you > > -- > Maxim Treskin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From ahmed.nawras@REDACTED Mon Apr 28 14:42:37 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Mon, 28 Apr 2008 16:42:37 +0400 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: References: Message-ID: Thanks Hynek and Kenneth for the quick response. Just to confirm, for qlc, I should write the query first and then run qlc:info/2 on it in order to do the limiting, as the example below shows. Is this it? e.g.: Q = qlc:q(...), qlc:info(Q, [{n_elements, 5}] Best regards, Ahmed Al-Issaei On Mon, Apr 28, 2008 at 4:32 PM, Kenneth Lundin wrote: > Hi, > > You can use qlc > http://www.erlang.org/doc/man/qlc.html > or you can use > mnesia:select/4 in combination with mnesia:select/1 > http://www.erlang.org/doc/man/mnesia.html#select-4 > > /Kenneth Erlang/OTP, Ericsson > > > > > On 4/28/08, Ahmed Ali wrote: > > Hi All, > > > > Does anyone have an idea of how to limit size of result set in mnesia > > similar to the effect of LIMIT clause in the SQL query below in MySQL? > > > > SELECT * FROM Topic LIMIT 5; > > > > Best regards, > > > > Ahmed Al-Issaei > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From zerthurd@REDACTED Mon Apr 28 14:59:30 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 28 Apr 2008 19:59:30 +0700 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: <4d08db370804280539g11d36d60x1009aa11be8cda0b@mail.gmail.com> References: <4d08db370804280539g11d36d60x1009aa11be8cda0b@mail.gmail.com> Message-ID: Thank you very much, Hynek -- Maxim Treskin From richardc@REDACTED Mon Apr 28 15:07:57 2008 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 28 Apr 2008 15:07:57 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: References: Message-ID: <4815CC2D.7080903@it.uu.se> Maxim Treskin wrote: > If I use new-style syntax, I have not detailed exception cause > explanation, like this: > > 3> try lists:sort([1,2,3]) catch exit:Why -> io:format("~p~n", [Why]) end. > [1,2,3] > 4> try lists:sort(abc) catch exit:Why -> io:format("~p~n", [Why]) end. > ** exception error: function_clause > > But if I use old-style syntax, I have this: > > 5> case (catch lists:sort(abc)) of {'EXIT', Why} -> io:format("~p~n", > [Why]) end. > {function_clause,[{lists,sort,[abc]}, > {erl_eval,do_apply,5}, > {erl_eval,expr,5}, > {erl_eval,expr,5}, > {shell,exprs,6}, > {shell,eval_exprs,6}, > {shell,eval_loop,3}]} > ok Your try-catch code is not actually catching the exception. "exit:Why" only matches if the exception is caused by exit(Reason). "error:Why" matches if you get a runtime error such as function_clause. "throw:What" matches if the exception is caused by throw(Something). If you want to catch *all* exceptions, use "Type:Why" or just "_:_". Also note that using just "Why" is the same as "throw:Why". When you have caught the exception, you can call erlang:get_stacktrace() to look at the stack trace if you want to. New-style syntax is better because the old-style made different kinds of exception look the same, so you could not separate them. (And it also had other problems; it could not catch only some exceptions and re-throw all the others, etc.) /Richard From zerthurd@REDACTED Mon Apr 28 15:11:42 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 28 Apr 2008 20:11:42 +0700 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: <4815CC2D.7080903@it.uu.se> References: <4815CC2D.7080903@it.uu.se> Message-ID: > Your try-catch code is not actually catching the exception. > ... skipped... > Yes, I know. It is just short example of code > When you have caught the exception, you can call erlang:get_stacktrace() > to look at the stack trace if you want to. > > New-style syntax is better because the old-style made different kinds > of exception look the same, so you could not separate them. (And it also > had other problems; it could not catch only some exceptions and re-throw > all the others, etc.) > Thank you for this explanation, Richard -- Maxim Treskin From jachym.holecek@REDACTED Mon Apr 28 15:12:26 2008 From: jachym.holecek@REDACTED (Jachym Holecek) Date: Mon, 28 Apr 2008 15:12:26 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: References: Message-ID: On Mon, 28 Apr 2008 14:27:27 +0200, Maxim Treskin wrote: > Can you say me, why is new-style better than old? The 'try ... [of ...] catch ... end' construct is more general and makes it clear whether or not an exception occured. With just 'catch' consider: case catch foo() of {'EXIT', Reason} -> %% Exception occured. ...; Result -> %% All is fine. ... end. Now if 'foo()' evaluates to {'EXIT', whatever} without throwing an exception, our 'case' will still take the error-treatment branch which is not quite what we wanted... HTH, -- Jachym From chsu79@REDACTED Mon Apr 28 15:22:09 2008 From: chsu79@REDACTED (Christian S) Date: Mon, 28 Apr 2008 15:22:09 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: References: <4815CC2D.7080903@it.uu.se> Message-ID: This paper on exceptions is a very good read for those that have been confused by "new style" erlang exceptions. http://www.erlang.se/workshop/2004/exception.pdf It explains * problems with the "old style" exceptions * why the new style exceptions had to work the way they do * usable variations on the try-catch clauses * nice understandable examples And all in only 10 pages. You got to love small but complete and well written papers! Thanks Richard, Bj?rn, Patrik! From vychodil.hynek@REDACTED Mon Apr 28 15:26:54 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 28 Apr 2008 15:26:54 +0200 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: References: Message-ID: <4d08db370804280626o76865574g4bf80c625276a016@mail.gmail.com> No, qlc:info just returns info. You should use cursor and next_answers. Just from documentation: C = qlc:cursor(qlc:q([X || X <- qlc:append(QH1, QH2)],{unique,true})), R = qlc:next_answers(C, 5), ok = qlc:delete_cursor(C), R. On Mon, Apr 28, 2008 at 2:42 PM, Ahmed Ali wrote: > Thanks Hynek and Kenneth for the quick response. > > Just to confirm, for qlc, I should write the query first and then run > qlc:info/2 on it in order to do the limiting, as the example below > shows. Is this it? > > e.g.: > Q = qlc:q(...), > qlc:info(Q, [{n_elements, 5}] > > Best regards, > > Ahmed Al-Issaei > > On Mon, Apr 28, 2008 at 4:32 PM, Kenneth Lundin > wrote: > > Hi, > > > > You can use qlc > > http://www.erlang.org/doc/man/qlc.html > > or you can use > > mnesia:select/4 in combination with mnesia:select/1 > > http://www.erlang.org/doc/man/mnesia.html#select-4 > > > > /Kenneth Erlang/OTP, Ericsson > > > > > > > > > > On 4/28/08, Ahmed Ali wrote: > > > Hi All, > > > > > > Does anyone have an idea of how to limit size of result set in mnesia > > > similar to the effect of LIMIT clause in the SQL query below in > MySQL? > > > > > > SELECT * FROM Topic LIMIT 5; > > > > > > Best regards, > > > > > > Ahmed Al-Issaei > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Mon Apr 28 15:31:38 2008 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 28 Apr 2008 15:31:38 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: References: <4815CC2D.7080903@it.uu.se> Message-ID: Christian S wrote: > This paper on exceptions is a very good read for those that have been > confused by "new style" erlang exceptions. > > http://www.erlang.se/workshop/2004/exception.pdf Yes, apparently it was written by some great minds :-) http://wadler.blogspot.com/2008/02/great-minds-think-alike.html -- Tobbe > > It explains > * problems with the "old style" exceptions > * why the new style exceptions had to work the way they do > * usable variations on the try-catch clauses > * nice understandable examples > > And all in only 10 pages. You got to love small but complete and well > written papers! > > Thanks Richard, Bj?rn, Patrik! From ahmed.nawras@REDACTED Mon Apr 28 15:51:15 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Mon, 28 Apr 2008 17:51:15 +0400 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: <4d08db370804280626o76865574g4bf80c625276a016@mail.gmail.com> References: <4d08db370804280626o76865574g4bf80c625276a016@mail.gmail.com> Message-ID: Hi Hynek, Thanks for the clarification. However, I still don't understand what's the point of n_elements in qlc:info(Q,[{n_elements,N}]). In QLC documentation, it names 2 kinds of options, "Option = EvalOption | ReturnOption" which suggests that qlc:info/2 can be used to set evaluation time options. Also, I'm assuming I can remove {unique, true} option from qlc:append/2 and the result is still the same. Best regards, Ahmed Al-Issaei On Mon, Apr 28, 2008 at 5:26 PM, Hynek Vychodil wrote: > No, qlc:info just returns info. You should use cursor and next_answers. > > Just from documentation: > C = qlc:cursor(qlc:q([X || X <- qlc:append(QH1, QH2)],{unique,true})), > R = qlc:next_answers(C, 5), > ok = qlc:delete_cursor(C), > > R. > > > > On Mon, Apr 28, 2008 at 2:42 PM, Ahmed Ali wrote: > > Thanks Hynek and Kenneth for the quick response. > > > > Just to confirm, for qlc, I should write the query first and then run > > qlc:info/2 on it in order to do the limiting, as the example below > > shows. Is this it? > > > > e.g.: > > Q = qlc:q(...), > > qlc:info(Q, [{n_elements, 5}] > > > > > > Best regards, > > > > Ahmed Al-Issaei > > > > > > > > > > On Mon, Apr 28, 2008 at 4:32 PM, Kenneth Lundin > > wrote: > > > Hi, > > > > > > You can use qlc > > > http://www.erlang.org/doc/man/qlc.html > > > or you can use > > > mnesia:select/4 in combination with mnesia:select/1 > > > http://www.erlang.org/doc/man/mnesia.html#select-4 > > > > > > /Kenneth Erlang/OTP, Ericsson > > > > > > > > > > > > > > > On 4/28/08, Ahmed Ali wrote: > > > > Hi All, > > > > > > > > Does anyone have an idea of how to limit size of result set in mnesia > > > > similar to the effect of LIMIT clause in the SQL query below in > MySQL? > > > > > > > > SELECT * FROM Topic LIMIT 5; > > > > > > > > Best regards, > > > > > > > > Ahmed Al-Issaei > > > > > > > > > > _______________________________________________ > > > > erlang-questions mailing list > > > > erlang-questions@REDACTED > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > --Hynek (Pichi) Vychodil From jiri.sofka@REDACTED Mon Apr 28 16:13:44 2008 From: jiri.sofka@REDACTED (=?UTF-8?B?SmnFmcOtIMWgb2ZrYQ==?=) Date: Mon, 28 Apr 2008 16:13:44 +0200 Subject: [erlang-questions] [Doc] lists:keytake/3 & lists:keystore/4 Message-ID: <4815DB98.3060709@e-fractal.cz> Hello, lists:keytake/3 & lists:keystore/4 are described in documentation ( http://www.erlang.org/doc/man/lists.html ) but no longer available. It seems that lists' module documentation is a bit outdated. Best Regards, Jiri Sofka From vychodil.hynek@REDACTED Mon Apr 28 16:34:35 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 28 Apr 2008 16:34:35 +0200 Subject: [erlang-questions] [Doc] lists:keytake/3 & lists:keystore/4 In-Reply-To: <4815DB98.3060709@e-fractal.cz> References: <4815DB98.3060709@e-fractal.cz> Message-ID: <4d08db370804280734u429c13a0ud75aaf4ce1e4e2c5@mail.gmail.com> No they are new functions in R12B. Check your version. On Mon, Apr 28, 2008 at 4:13 PM, Ji?? ?ofka wrote: > Hello, > > lists:keytake/3 & lists:keystore/4 are described in documentation ( > http://www.erlang.org/doc/man/lists.html ) but no longer available. It > seems that lists' module documentation is a bit outdated. > > Best Regards, > Jiri Sofka > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Mon Apr 28 17:22:25 2008 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 28 Apr 2008 11:22:25 -0400 Subject: [erlang-questions] [Erlyaws-list] Attempting to rewrite headers, obstacles faced In-Reply-To: <3935b63b0804272356l359d8740tba0563d13a87aa6c@mail.gmail.com> References: <3935b63b0804272356l359d8740tba0563d13a87aa6c@mail.gmail.com> Message-ID: <65b2728e0804280822uaad707ev54e91f6fa415de41@mail.gmail.com> On 4/28/08, Bhasker Kode wrote: > Hello, > > i've been trying to research how to rewrite request headers (from yaws), > when I remember that there folks on these lists, who have written > substantial code that works with header. Cheers to that... > > I have tried the following 3 methods to try and rewrite the headers (more > specificaly the #headers{referer} > > Attempt [1] > hacked within yaws.erl, only to find that the Referer when edited, was only > being used in yaws_log:accesslogs. ( > http://paste.lisp.org/display/59461 ) > Result: No change in arg structure , no change in document.referrer. For this attempt did you try {header,["Referer", "http://subdomain.localhost/page1.yaws"]} --steve From thomasl_erlang@REDACTED Mon Apr 28 16:25:01 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 28 Apr 2008 07:25:01 -0700 (PDT) Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: Message-ID: <521254.57783.qm@web38807.mail.mud.yahoo.com> --- Torbjorn Tornkvist wrote: > Christian S wrote: > > This paper on exceptions is a very good read for > those that have been > > confused by "new style" erlang exceptions. > > > > http://www.erlang.se/workshop/2004/exception.pdf > > Yes, apparently it was written by some great minds > :-) Another part of the effort to turn Erlang into ML, eh? :-) I have to note that I nearly always use 'catch' rather than 'try', and even consider 'catch' taking care of all cases in a great big mess the usually desired behaviour. But since I so clearly Don't Get It, I'm wondering: what properties of 'try' do people consider great _in practice_? What has saved your bacon in switching from old to new school? * ability to differentiate between exception kinds? * ignoring the exception handler on mismatch? * the 'finally' clause? * syntax is nicer? * something else? if so, what Best, Thomas ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ From launoja@REDACTED Mon Apr 28 14:35:08 2008 From: launoja@REDACTED (Jani Launonen) Date: Mon, 28 Apr 2008 15:35:08 +0300 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: References: Message-ID: ----- Alkuper?inen viesti ----- L?hett?j?: Ahmed Ali P?iv?ys: maanantai, huhtikuu 28, 2008 3:21 pm Aihe: [erlang-questions] Question: Limiting size of result set in mnesia Vastaanottaja: "Erlang-Questions (E-mail)" > > Hi All, > > Does anyone have an idea of how to limit size of result set in mnesia > similar to the effect of LIMIT clause in the SQL query below in MySQL? > > SELECT * FROM Topic LIMIT 5; >From Mnesia Reference Manual (http://www.erlang.org/doc/man/mnesia.html) : "select(Tab, MatchSpec, NObjects, Lock) -> transaction abort | {[Object],Cont} | '$end_of_table' Matches the objects in the table Tab using a match_spec as described in ERTS users guide, and returns a chunk of terms and a continuation, the wanted number of returned terms is specified by the NObjects argument. The lock argument can be read or write. The continuation should be used as argument to mnesia:select/1, if more or all answers are needed. Note: for best performance select should be used before any modifying operations are done on that table in the same transaction, i.e. don't use mnesia:write or mnesia:delete before a mnesia:select. For efficiency the NObjects is a recommendation only and the result may contain anything from an empty list to all available results. select(Cont) -> transaction abort | {[Object],Cont} | '$end_of_table' Selects more objects with the match specification initiated by mnesia:select/4. Note: Any modifying operations, i.e. mnesia:write or mnesia:delete, that are done between the mnesia:select/4 and mnesia:select/1 calls will not be visible in the result. " Cheers, Jani Launonen > Best regards, > > Ahmed Al-Issaei > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Mon Apr 28 16:36:23 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 28 Apr 2008 07:36:23 -0700 (PDT) Subject: [erlang-questions] Record initializer work-around for smart_exceptions? In-Reply-To: <96687.1209158139@snookles.snookles.com> Message-ID: <710225.53211.qm@web38805.mail.mud.yahoo.com> --- Scott Lystig Fritchie wrote: > Hi. I suppose this question could be directed to > Thomas Lindren, but I > thought I'd share with a wider audience. > > Is there a way to avoid these errors (due to > introducing temp variables > by the parse transform) when a record initializer > contains something > other than a simple term? ... > "Simple term" is a bit misleading, because -1 > appears to be a simple > term in my book, but the hyphen confuses the parse > transform. Much of > the code I'd like to use with smart_exceptions uses > negative constants, > unfortunately. I'll take a look at it. Presumably the negative constant is parsed as -(1), which is why it's not considered simple, but I'll have to check. The current transformation is pretty straightforward because it relies on the compiler to take care of code simplification, but there are at least two ways to get rid of such errors: 1. Recognize and simplify -(c) into -c before transforming the code; 2. More generally, detecting that some expression can't trigger an exception and not emitting handler code for those. Takes care of -(1) among other things. Regarding variables appearing in a record declaration, perhaps one could, as another option, hide the variable in a closure, the old (fun() -> ... _X ... end)() trick. I'll have to look at that too. Finally, the best solution is probably to replace smart_exceptions with compiler support. Best, Thomas ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ From adam@REDACTED Mon Apr 28 19:04:14 2008 From: adam@REDACTED (Adam Lindberg) Date: Mon, 28 Apr 2008 19:04:14 +0200 Subject: [erlang-questions] Compiling R12B-2 on Ubuntu 7.10 In-Reply-To: <4812301F.1080608@cs.ntua.gr> References: <6344005f0804250756j1a54f5bar9e7b3ba4734bdb74@mail.gmail.com> <4812301F.1080608@cs.ntua.gr> Message-ID: <6344005f0804281004s41c786b8x8e55bd7078190655@mail.gmail.com> On Fri, Apr 25, 2008 at 9:25 PM, Kostis Sagonas wrote: > If you do not see these lines (and the .beam files do exist under > "lib/dialyzer/ebin") then it's no wonder you get the error you reported. > > Hope this helps. I don't see these lines and am still at loss of what to do about it. :-) Here's a bit longer output: %%%%%%%%%%% BEGINNING OF OUTPUT %%%%%%%%%%%%%%%%% === Leaving application percept make[2]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/percept' make[2]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe' Makefile:35: warning: overriding commands for target `docs' /home/alind/Applications/otp_src_R12B-2/make/otp_subdir.mk:28: warning: ignoring old commands for target `docs' === Entering application hipe make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/rtl' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/rtl' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/misc' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/misc' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/main' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/main' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/cerl' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/cerl' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/icode' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/icode' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/flow' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/flow' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/util' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/util' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/regalloc' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/regalloc' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/sparc' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/sparc' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/ppc' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/ppc' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/x86' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/x86' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/amd64' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/amd64' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/arm' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/arm' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/opt' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/opt' make[3]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/tools' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe/tools' === Leaving application hipe make[2]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/hipe' make[1]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib' make[1]: Entering directory `/home/alind/Applications/otp_src_R12B-2/erts' make[2]: Entering directory `/home/alind/Applications/otp_src_R12B-2/erts/start_scripts' make[2]: Nothing to be done for `debug'. make[2]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/erts/start_scripts' make[2]: Entering directory `/home/alind/Applications/otp_src_R12B-2/erts/start_scripts' /usr/bin/install -c -d /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/tmp ( cd /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/tmp && \ erlc -W -I/home/alind/Applications/otp_src_R12B-2/lib/kernel/ebin -I/home/alind/Applications/otp_src_R12B-2/lib/stdlib/ebin -I/home/alind/Applications/otp_src_R12B-2/lib/sasl/ebin +otp_build -o /home/alind/Applications/otp_src_R12B-2/bin/start.script /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/start_clean.rel ) /usr/bin/install -c -d /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/tmp ( cd /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/tmp && \ erlc -W -I/home/alind/Applications/otp_src_R12B-2/lib/kernel/ebin -I/home/alind/Applications/otp_src_R12B-2/lib/stdlib/ebin -I/home/alind/Applications/otp_src_R12B-2/lib/sasl/ebin +otp_build -o /home/alind/Applications/otp_src_R12B-2/bin/start_sasl.script /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/start_sasl.rel ) /usr/bin/install -c -d /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/tmp ( cd /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/tmp && \ erlc -W -I/home/alind/Applications/otp_src_R12B-2/lib/kernel/ebin -I/home/alind/Applications/otp_src_R12B-2/lib/stdlib/ebin -I/home/alind/Applications/otp_src_R12B-2/lib/sasl/ebin +otp_build -o /home/alind/Applications/otp_src_R12B-2/bin/start_clean.script /home/alind/Applications/otp_src_R12B-2/erts/start_scripts/start_clean.rel ) make[2]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/erts/start_scripts' make[1]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/erts' make[1]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer' === Entering application dialyzer make[2]: Entering directory `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src' Dialyzer will now build auxiliary information needed for subsequent analyses... A PLT for following libs will be built: [kernel,mnesia,stdlib] To select a different set please edit the file /home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src/Makefile /home/alind/Applications/otp_src_R12B-2/bin/dialyzer --check_init_plt {"init terminating in do_boot",{undef,[{dialyzer,plain_cl,[]},{init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () make[2]: *** [/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/plt/dialyzer_init_plt] Error 1 make[2]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer/src' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/alind/Applications/otp_src_R12B-2/lib/dialyzer' make: *** [dialyzer] Error 2 alind@REDACTED:~/Applications/otp_src_R12B-2$ %%%%% END OF OUTPUT %%%%%%%%%%% Cheers! Adam -- Adam Lindberg Erlang Training & Consulting, http://www.erlang-consulting.com From sten@REDACTED Mon Apr 28 20:12:59 2008 From: sten@REDACTED (Sten Kvamme) Date: Mon, 28 Apr 2008 20:12:59 +0200 Subject: [erlang-questions] D-Bus Message-ID: <3CB66AB7-0F19-465B-9D6E-ECFF62D19405@kvamme.se> Is there a D-Bus implementation written in erlang? Link to D-Bus home page is: http://www.freedesktop.org/wiki/Software/ dbus Link to the D-Bus spec is http://dbus.freedesktop.org/doc/dbus- specification.html#message-protocol /Sten From ulf@REDACTED Mon Apr 28 20:38:02 2008 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 28 Apr 2008 20:38:02 +0200 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: References: <4d08db370804280626o76865574g4bf80c625276a016@mail.gmail.com> Message-ID: <8209f740804281138h12b18d2ai5c77f51099f091e7@mail.gmail.com> When selecting over a very large set, you may want QLC to retrieve the data in chunks. Then, n_elements can be used to instruct the table generators to return only a number of elements at a time. This is something that might specify when implementing a QLC table generator, I think. This can have a beneficial effect on garbage collection, as the process may be able to perform the work with a fairly small heap. In simple queries (no joins or complex filter expressions), it's not likely to help much, but it can improve memory characteristics in some cases. BR, Ulf W 2008/4/28 Ahmed Ali : > Hi Hynek, > > Thanks for the clarification. However, I still don't understand what's > the point of n_elements in qlc:info(Q,[{n_elements,N}]). In QLC > documentation, it names 2 kinds of options, "Option = EvalOption | > ReturnOption" which suggests that qlc:info/2 can be used to set > evaluation time options. > > Also, I'm assuming I can remove {unique, true} option from > qlc:append/2 and the result is still the same. > > > Best regards, > > Ahmed Al-Issaei > > > > On Mon, Apr 28, 2008 at 5:26 PM, Hynek Vychodil > wrote: > > No, qlc:info just returns info. You should use cursor and next_answers. > > > > Just from documentation: > > C = qlc:cursor(qlc:q([X || X <- qlc:append(QH1, QH2)],{unique,true})), > > R = qlc:next_answers(C, 5), > > ok = qlc:delete_cursor(C), > > > > R. > > > > > > > > On Mon, Apr 28, 2008 at 2:42 PM, Ahmed Ali wrote: > > > Thanks Hynek and Kenneth for the quick response. > > > > > > Just to confirm, for qlc, I should write the query first and then run > > > qlc:info/2 on it in order to do the limiting, as the example below > > > shows. Is this it? > > > > > > e.g.: > > > Q = qlc:q(...), > > > qlc:info(Q, [{n_elements, 5}] > > > > > > > > > Best regards, > > > > > > Ahmed Al-Issaei > > > > > > > > > > > > > > > On Mon, Apr 28, 2008 at 4:32 PM, Kenneth Lundin > > > wrote: > > > > Hi, > > > > > > > > You can use qlc > > > > http://www.erlang.org/doc/man/qlc.html > > > > or you can use > > > > mnesia:select/4 in combination with mnesia:select/1 > > > > http://www.erlang.org/doc/man/mnesia.html#select-4 > > > > > > > > /Kenneth Erlang/OTP, Ericsson > > > > > > > > > > > > > > > > > > > > On 4/28/08, Ahmed Ali wrote: > > > > > Hi All, > > > > > > > > > > Does anyone have an idea of how to limit size of result set in mnesia > > > > > similar to the effect of LIMIT clause in the SQL query below in > > MySQL? > > > > > > > > > > SELECT * FROM Topic LIMIT 5; > > > > > > > > > > Best regards, > > > > > > > > > > Ahmed Al-Issaei > > > > > > > > > > > > > _______________________________________________ > > > > > erlang-questions mailing list > > > > > erlang-questions@REDACTED > > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > -- > > --Hynek (Pichi) Vychodil > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From richardc@REDACTED Mon Apr 28 18:04:16 2008 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 28 Apr 2008 18:04:16 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: <521254.57783.qm@web38807.mail.mud.yahoo.com> References: <521254.57783.qm@web38807.mail.mud.yahoo.com> Message-ID: <4815F580.2060308@it.uu.se> Thomas Lindgren wrote: > Another part of the effort to turn Erlang into ML, eh? > :-) On the contrary - the exception handling in ML lacks the success-case branch that you get in Erlang with try...of... (hence, it is ML that needs to be turned into Erlang). :-) > I have to note that I nearly always use 'catch' rather > than 'try', and even consider 'catch' taking care of > all cases in a great big mess the usually desired > behaviour. It does handle the "I just want to catch everything" case pretty well, and that was one of the main things we had to work out when designing the try-construct: there shouldn't be cases that 'catch' did more efficiently/compactly than 'try'. (In some cases the equivalent 'try' is a bit more verbose, but it's just a matter of a few more characters to type - it's not a completely different control flow.) > But since I so clearly Don't Get It, I'm > wondering: what properties of 'try' do people consider > great _in practice_? What has saved your bacon in > switching from old to new school? Personally, I've 1) benefited from being able to catch only some particular exceptions and letting all the rest be re-thrown, passing them through unchanged (this is just not possible with 'catch'), and 2) used 'after' quite a lot - e.g. the core of EUnit relies very much on being able to do 'after'-stuff regardless of how the test terminated and without modifying the information in exceptions that pass through. And splitting the clauses into 'of...' and 'catch...' sections makes for more readable code, so the syntax is nicer, in my (totally objective) opinion. ;-) /Richard From mikma264@REDACTED Mon Apr 28 22:56:32 2008 From: mikma264@REDACTED (Mikael Magnusson) Date: Mon, 28 Apr 2008 22:56:32 +0200 Subject: [erlang-questions] D-Bus In-Reply-To: <3CB66AB7-0F19-465B-9D6E-ECFF62D19405@kvamme.se> References: <3CB66AB7-0F19-465B-9D6E-ECFF62D19405@kvamme.se> Message-ID: <48163A00.9030709@gmail.com> Sten Kvamme wrote: > Is there a D-Bus implementation written in erlang? > > Link to D-Bus home page is: http://www.freedesktop.org/wiki/Software/ > dbus > Link to the D-Bus spec is http://dbus.freedesktop.org/doc/dbus- > specification.html#message-protocol > > /Sten > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions http://sourceforge.net/projects/dbus-erlang/ Mikael From joelr1@REDACTED Mon Apr 28 23:59:00 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 28 Apr 2008 22:59:00 +0100 Subject: [erlang-questions] Growing LATEST.LOG Message-ID: <5E8312BB-B89A-43A6-99EB-2ADA542A556F@gmail.com> Folks, I hacked Mnesia to save to Amazon S3 a while ago and just found out that LATEST.LOG keeps growing when data is written to my s3_copies table. The log looks like this and consists of 657 entries. {{continuation,<0.35.0>,65510,116}, [{log_header,trans_log, "4.3", "4.3.5", 's3cache@REDACTED', {1209,323599,650325}}, {decision,{tid,116,<5290.105.0>},unclear,[],['s3cache@REDACTED ']}, {decision,{tid,116,<5290.105.0>},committed,[],[]}, {decision,{tid,117,<5290.105.0>},unclear,[],['s3cache@REDACTED ']}, {decision,{tid,117,<5290.105.0>},committed,[],[]}, {decision,{tid,118,<5290.105.0>},unclear,[],['s3cache@REDACTED ']}, {decision,{tid,118,<5290.105.0>},committed,[],[]}, ... Any obvious things that I may have missed in my s3_copies implementation that prevent the log from shrinking? Thanks, Joel -- wagerlabs.com From joelr1@REDACTED Tue Apr 29 01:17:44 2008 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 29 Apr 2008 00:17:44 +0100 Subject: [erlang-questions] Growing LATEST.LOG In-Reply-To: <5E8312BB-B89A-43A6-99EB-2ADA542A556F@gmail.com> References: <5E8312BB-B89A-43A6-99EB-2ADA542A556F@gmail.com> Message-ID: <5F47F5DC-886B-4EE3-8EFD-0D4ACF87A659@gmail.com> Please disregard. I found the problem. On Apr 28, 2008, at 10:59 PM, Joel Reymont wrote: > Folks, > > I hacked Mnesia to save to Amazon S3 a while ago > and just found out that LATEST.LOG keeps growing > when data is written to my s3_copies table. > > The log looks like this and consists of 657 entries. > > {{continuation,<0.35.0>,65510,116}, > [{log_header,trans_log, > "4.3", > "4.3.5", > 's3cache@REDACTED', > {1209,323599,650325}}, > {decision,{tid,116,<5290.105.0>},unclear,[],['s3cache@REDACTED > ']}, > {decision,{tid,116,<5290.105.0>},committed,[],[]}, > {decision,{tid,117,<5290.105.0>},unclear,[],['s3cache@REDACTED > ']}, > {decision,{tid,117,<5290.105.0>},committed,[],[]}, > {decision,{tid,118,<5290.105.0>},unclear,[],['s3cache@REDACTED > ']}, > {decision,{tid,118,<5290.105.0>},committed,[],[]}, > ... > > Any obvious things that I may have missed in my > s3_copies implementation that prevent the log > from shrinking? > > Thanks, Joel -- wagerlabs.com From ahmed.nawras@REDACTED Tue Apr 29 08:19:48 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 29 Apr 2008 10:19:48 +0400 Subject: [erlang-questions] Question: Limiting size of result set in mnesia In-Reply-To: <8209f740804281138h12b18d2ai5c77f51099f091e7@mail.gmail.com> References: <4d08db370804280626o76865574g4bf80c625276a016@mail.gmail.com> <8209f740804281138h12b18d2ai5c77f51099f091e7@mail.gmail.com> Message-ID: Thanks All. Now it is more clear to me. On Mon, Apr 28, 2008 at 10:38 PM, Ulf Wiger wrote: > When selecting over a very large set, you may want QLC to retrieve > the data in chunks. Then, n_elements can be used to instruct the > table generators to return only a number of elements at a time. > This is something that might specify when implementing a QLC > table generator, I think. > > This can have a beneficial effect on garbage collection, as the > process may be able to perform the work with a fairly small > heap. In simple queries (no joins or complex filter expressions), > it's not likely to help much, but it can improve memory > characteristics in some cases. > > BR, > Ulf W > > 2008/4/28 Ahmed Ali : > > > > Hi Hynek, > > > > Thanks for the clarification. However, I still don't understand what's > > the point of n_elements in qlc:info(Q,[{n_elements,N}]). In QLC > > documentation, it names 2 kinds of options, "Option = EvalOption | > > ReturnOption" which suggests that qlc:info/2 can be used to set > > evaluation time options. > > > > Also, I'm assuming I can remove {unique, true} option from > > qlc:append/2 and the result is still the same. > > > > > > Best regards, > > > > Ahmed Al-Issaei > > > > > > > > On Mon, Apr 28, 2008 at 5:26 PM, Hynek Vychodil > > wrote: > > > No, qlc:info just returns info. You should use cursor and next_answers. > > > > > > Just from documentation: > > > C = qlc:cursor(qlc:q([X || X <- qlc:append(QH1, QH2)],{unique,true})), > > > R = qlc:next_answers(C, 5), > > > ok = qlc:delete_cursor(C), > > > > > > R. > > > > > > > > > > > > On Mon, Apr 28, 2008 at 2:42 PM, Ahmed Ali wrote: > > > > Thanks Hynek and Kenneth for the quick response. > > > > > > > > Just to confirm, for qlc, I should write the query first and then run > > > > qlc:info/2 on it in order to do the limiting, as the example below > > > > shows. Is this it? > > > > > > > > e.g.: > > > > Q = qlc:q(...), > > > > qlc:info(Q, [{n_elements, 5}] > > > > > > > > > > > > Best regards, > > > > > > > > Ahmed Al-Issaei > > > > > > > > > > > > > > > > > > > > On Mon, Apr 28, 2008 at 4:32 PM, Kenneth Lundin > > > > wrote: > > > > > Hi, > > > > > > > > > > You can use qlc > > > > > http://www.erlang.org/doc/man/qlc.html > > > > > or you can use > > > > > mnesia:select/4 in combination with mnesia:select/1 > > > > > http://www.erlang.org/doc/man/mnesia.html#select-4 > > > > > > > > > > /Kenneth Erlang/OTP, Ericsson > > > > > > > > > > > > > > > > > > > > > > > > > On 4/28/08, Ahmed Ali wrote: > > > > > > Hi All, > > > > > > > > > > > > Does anyone have an idea of how to limit size of result set in mnesia > > > > > > similar to the effect of LIMIT clause in the SQL query below in > > > MySQL? > > > > > > > > > > > > SELECT * FROM Topic LIMIT 5; > > > > > > > > > > > > Best regards, > > > > > > > > > > > > Ahmed Al-Issaei > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > erlang-questions mailing list > > > > > > erlang-questions@REDACTED > > > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > > > _______________________________________________ > > > > erlang-questions mailing list > > > > erlang-questions@REDACTED > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > > > > -- > > > --Hynek (Pichi) Vychodil > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From gleber.p@REDACTED Tue Apr 29 11:05:38 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 29 Apr 2008 11:05:38 +0200 Subject: [erlang-questions] [link] X10 by IBM - interesting approach to concurrency Message-ID: <14f0e3620804290205m1cd5501fw5ecc74fd0f475107@mail.gmail.com> Hello, I've stumbled across some quite interesting approach to concurrency in new programming language named X10 by IBM, with academics and DARPA involved: http://domino.research.ibm.com/comm/research_projects.nsf/pages/x10.index.html -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From kode@REDACTED Tue Apr 29 11:06:44 2008 From: kode@REDACTED (Bhasker Kode) Date: Tue, 29 Apr 2008 14:36:44 +0530 Subject: [erlang-questions] [Erlyaws-list] Attempting to rewrite headers, obstacles faced In-Reply-To: <65b2728e0804280822uaad707ev54e91f6fa415de41@mail.gmail.com> References: <3935b63b0804272356l359d8740tba0563d13a87aa6c@mail.gmail.com> <65b2728e0804280822uaad707ev54e91f6fa415de41@mail.gmail.com> Message-ID: <3935b63b0804290206l7845a3fcq7ca11b00f94c634c@mail.gmail.com> On Mon, Apr 28, 2008 at 8:52 PM, Steve Vinoski wrote: > For this attempt did you try > > {header,["Referer", "http://subdomain.localhost/page1.yaws"]} > > --steve > Yes, i tried using both the allheader tuple as well as the header, alone. Using header infact did change the arg structure's referer, but the document.referrer still was'nt bein rewritten. Same with the arg_rewrite method. The Arg was definitely being edited, without forcing a change in the document.referer. I suppose the only explanation is that the browser itself sets the request referrer , and thus overriding any manipulation headers. : / Keep Clicking, ~Bosky -------------- next part -------------- An HTML attachment was scrubbed... URL: From francisstephens@REDACTED Tue Apr 29 13:09:42 2008 From: francisstephens@REDACTED (Francis Stephens) Date: Tue, 29 Apr 2008 23:09:42 +1200 Subject: [erlang-questions] Module dependencies - from newbie Message-ID: <1630bf30804290409g51bfd56ase58cad4550517319@mail.gmail.com> I am currently having a problem finding a good way to manage some module dependencies. I have a single module which called 'formula'. It looks very similar to the core dict module which allows users to create, query and modify their dict datastructures. My formula module allows users to create, query and modify boolean formula. However, I am currently experimenting with different internal data structures for the formula module and would like to be able to swap them in and out of my program easily. Currently there are a number of different modules which make function calls to the formula module and it seems that I would have to go and edit each function prefix for every call. My current options seem to be to me 1: Add a macro which will change the prefix for me at compile time. 2: Write each prefix as a Variable (Prefix:fun()) and pass in the appropriate module with each function call. I believe those calls are significantly slower than non-variable prefixed function calls. 3: reorganise my code in a more sensible way. Currently I am still thinking about the code organisation in a very OO way and if there is a good Erlang approach to this kind of problem I would love to learn about it. Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Apr 29 13:24:51 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 29 Apr 2008 13:24:51 +0200 Subject: [erlang-questions] Module dependencies - from newbie In-Reply-To: <1630bf30804290409g51bfd56ase58cad4550517319@mail.gmail.com> References: <1630bf30804290409g51bfd56ase58cad4550517319@mail.gmail.com> Message-ID: <1209468291.5359.32.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Have you considered using the same module name for the different implementations and hot load the different modules when you want to try them? bengt On Tue, 2008-04-29 at 23:09 +1200, Francis Stephens wrote: > I am currently having a problem finding a good way to manage some > module dependencies. > > I have a single module which called 'formula'. It looks very similar > to the core dict module which allows users to create, query and modify > their dict datastructures. My formula module allows users to create, > query and modify boolean formula. > > However, I am currently experimenting with different internal data > structures for the formula module and would like to be able to swap > them in and out of my program easily. Currently there are a number of > different modules which make function calls to the formula module and > it seems that I would have to go and edit each function prefix for > every call. > > My current options seem to be to me > > 1: Add a macro which will change the prefix for me at compile time. > 2: Write each prefix as a Variable (Prefix:fun()) and pass in the > appropriate module with each function call. I believe those calls are > significantly slower than non-variable prefixed function calls. > > 3: reorganise my code in a more sensible way. > > Currently I am still thinking about the code organisation in a very OO > way and if there is a good Erlang approach to this kind of problem I > would love to learn about it. > > Thanks in advance. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dot@REDACTED Tue Apr 29 15:27:52 2008 From: dot@REDACTED (Tony Finch) Date: Tue, 29 Apr 2008 14:27:52 +0100 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: <4815F580.2060308@it.uu.se> References: <521254.57783.qm@web38807.mail.mud.yahoo.com> <4815F580.2060308@it.uu.se> Message-ID: On Mon, 28 Apr 2008, Richard Carlsson wrote: > Thomas Lindgren wrote: > > > > Another part of the effort to turn Erlang into ML, eh? > > :-) > > On the contrary - the exception handling in ML lacks the > success-case branch that you get in Erlang with try...of... > (hence, it is ML that needs to be turned into Erlang). :-) You have probably seen this paper which does just that: http://research.microsoft.com/~akenn/sml/ExceptionalSyntax.pdf Tony. -- f.anthony.n.finch http://dotat.at/ WIGHT PORTLAND: SOUTH VEERING SOUTHWEST 5 TO 7, BECOMING CYCLONIC FOR A TIME, PERHAPS GALE 8 LATER. SLIGHT BECOMING MODERATE. SHOWERS, RAIN LATER. MODERATE OR GOOD. From mark.geib@REDACTED Tue Apr 29 16:45:57 2008 From: mark.geib@REDACTED (Mark Geib) Date: Tue, 29 Apr 2008 08:45:57 -0600 Subject: [erlang-questions] Notes/Findings on building R12B-1 on AIX 5.3 Message-ID: <1209480357.5739.23.camel@geib-desktop> I just spent the last 5-6 days building R12B-1 on AIX 5.3. I tried to make notes along the way just in case someone ever again needs to do this. The build environment was AIX 5.3 with gcc 4.2.3 and automake 1.8.5-1. If there are any questions regarding the versions of other packages I can provide that as well. Mostly I used the most recent version of RPM from perzl.org or the Linux toolkit cd supplied with AIX. Most of the problems were in the autoconf/automake files. I have not used automake before so I am not sure the proper files to make changes in, so I usually made the same edit in all configure files with the offending code. o aix4* had to be changed to aix* Did this in all places I found it, don't know where to make the proper change. o in the configure.in or configure files in the erlang root I had to add a case for aix* where the install program is chosen. The current version only had a case for osf* and *. The install program therefor was /usr/ucb/install, which does not support -d. The choice for aix* is now .../erts/autoconf/install-sh. This was missed in my search for aix4*. o in the configure or configure.in files I had to modify the tests for libgd. The test was for libgd.so only, so I added libgd.a. I only had the choice of the static lib. o finally, I had to change the #define of "events" in erts/emulator/beam/erl_driver.h. The #define conflicted with a #define of events in another header file. Did not take any time to track this down. "events" was only used in a few places so no big deal. After these changes I then could do.. #./configure --with-ssl=/opt/freeware --with-odbc=/opt/freeware --with-gd=/opt/freeware #gmake #gmake install With these few changes I think the next release will be much closer to building out-of-the-box on AIX. Of course this ignores gathering all the dependent package. Mark. From richardc@REDACTED Tue Apr 29 16:59:40 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 29 Apr 2008 16:59:40 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: References: <521254.57783.qm@web38807.mail.mud.yahoo.com> <4815F580.2060308@it.uu.se> Message-ID: <481737DC.6000808@it.uu.se> Tony Finch wrote: >> On the contrary - the exception handling in ML lacks the >> success-case branch that you get in Erlang with try...of... >> (hence, it is ML that needs to be turned into Erlang). :-) > > You have probably seen this paper which does just that: > http://research.microsoft.com/~akenn/sml/ExceptionalSyntax.pdf Yes. I hadn't seen it when we did our work on try/catch and wrote our paper, though, and Phil Wadler who was on the Workshop committee didn't recall the Benton & Kennedy paper either, until some months afterwards (he then pointed me to their paper and vice versa, which was very nice of him). The background is that B&K was published in 2001, and by then we had been talking about try/catch for a couple of years - practically since the C++-like suggestion by Barklund in ~1998 (which turned out to be problematic when we tried to implement it), and we weren't on the lookout for papers with sudden, new solutions to a rather old problem. I can trace the "try...of..." syntax in our repository to January 2003 (if anyone's interested - It's not that I feel that I need to defend anything). I can remember drawing a diagram of the control flows on my whiteboard and thinking "what is missing in this picture", and going "hey...". And then I realized that the corresponding syntax was much like what a chap had suggested in passing during a workshop a couple of years before (maybe he had read B&K?), which I had dismissed as "easy to do using a temporary constructor". Sometimes, it seems, it's just that the time for an idea has arrived. Reading B&K could have saved me some work, though. /Richard From lenartlad@REDACTED Tue Apr 29 17:15:51 2008 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 29 Apr 2008 17:15:51 +0200 Subject: [erlang-questions] Module dependencies - from newbie In-Reply-To: <1630bf30804290409g51bfd56ase58cad4550517319@mail.gmail.com> References: <1630bf30804290409g51bfd56ase58cad4550517319@mail.gmail.com> Message-ID: <48173BA7.7070306@volny.cz> Francis Stephens wrote: > I am currently having a problem finding a good way to manage some module > dependencies. > > I have a single module which called 'formula'. It looks very similar to > the core dict module which allows users to create, query and modify > their dict datastructures. My formula module allows users to create, > query and modify boolean formula. > > However, I am currently experimenting with different internal data > structures for the formula module and would like to be able to swap them > in and out of my program easily. Currently there are a number of > different modules which make function calls to the formula module and it > seems that I would have to go and edit each function prefix for every call. > > My current options seem to be to me > > 1: Add a macro which will change the prefix for me at compile time. > 2: Write each prefix as a Variable (Prefix:fun()) and pass in the > appropriate module with each function call. I believe those calls are > significantly slower than non-variable prefixed function calls. > > 3: reorganise my code in a more sensible way. > > Currently I am still thinking about the code organisation in a very OO > way and if there is a good Erlang approach to this kind of problem I > would love to learn about it. Hello, I am not sure I understood you correctly so I rephrase your question using an example: You are about to write a module M that uses a dictionary as part of its internal structure. Erlang library already provides two dictionary implementations: dict and orddict. You want to make it easy for M to change from one to another providing that both dictionary modules have the same interface (so the only changing bit is the module name). If your problem is similar to the one described above, I usually solve it with macro because I am really interesting only in one implementation at a time. If you want to use both implementations at the same time however, I would suggest that part of the internal data representation associated with module M is a dictionary module name and dictionary related functions are invoked using it. I wouldn't worry about slowness until it is measured that it is the bottleneck. HTH, Ladislav Lenart From paul-trapexit@REDACTED Tue Apr 29 18:44:38 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Tue, 29 Apr 2008 09:44:38 -0700 (PDT) Subject: [erlang-questions] new mnesia storage type question Message-ID: hi. we're bumping into the "no ordered sets on disk" problem with mnesia alot and we're considering trying to use libmysqld to make a new table type. i'm assuming mnesia_access is the method for integration. however, it looks like mnesia_access only covers reads and writes. so for instance it appears we would have to make our own analog to mnesia_schema to handle operations like create_table, add_table_copy, etc. if we want location transparency on reads and writes, we'll have to roll our own; and we can't reuse mnesia's locking strategy since it dovetails into dirty_reads on the primitive table types. so it comes down to, the advantage over just running mysql is that the Erlang precursor API would make it easier to do things like distributed locking, location transparency, or moving a table (fragment); but we'd still have to write alot of code. is there another option for adding a table type to mnesia? -- p From raould@REDACTED Tue Apr 29 21:32:06 2008 From: raould@REDACTED (Raoul Duke) Date: Tue, 29 Apr 2008 12:32:06 -0700 Subject: [erlang-questions] [link] X10 by IBM - interesting approach to concurrency In-Reply-To: <14f0e3620804290205m1cd5501fw5ecc74fd0f475107@mail.gmail.com> References: <14f0e3620804290205m1cd5501fw5ecc74fd0f475107@mail.gmail.com> Message-ID: <91a2ba3e0804291232t7667ac3em75250d41b99e96f@mail.gmail.com> > new programming language named X10 by IBM, with academics and DARPA X10 makes some effort to address deadlock & races, as in providing some guarantees if you follow certain rules. Of course even with shared mutable state you can have rules to follow which avoid such problems, it just happens to be hard to follow them. I've seen other languages / systems have approaches to avoiding deadlock or at least detecting it statically, like Timber or I think CSP. Does anybody know of an overview of approaches taken by sundry languages to providing guarantees re: deadlocks and races statically? thanks. From joelr1@REDACTED Tue Apr 29 21:33:04 2008 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 29 Apr 2008 20:33:04 +0100 Subject: [erlang-questions] new mnesia storage type question In-Reply-To: References: Message-ID: <7DC2F16A-9997-419B-AEA0-EC6CA4AC5B52@gmail.com> On Apr 29, 2008, at 5:44 PM, Paul Mineiro wrote: > is there another option for adding a table type to mnesia? Hack the Mnesia code to add your mysql_copies. You will then be able to take advantage of all the Mnesia goodness while implementing just the bits of code that are relevant to your table type. I did this for s3_copies and it works fine. -joel -- wagerlabs.com From masterofquestions@REDACTED Wed Apr 30 05:03:25 2008 From: masterofquestions@REDACTED (db) Date: Tue, 29 Apr 2008 23:03:25 -0400 Subject: [erlang-questions] once again gen_leader question patched vs non-patched version Message-ID: <1218d6a50804292003w480fde67ka0a7eab713d850f@mail.gmail.com> I am currently running gen_leader instances only on candidate nodes. My worker and candidate nodes are follows: Candidate Nodes: [a@REDACTED,b@REDACTED] Worker Nodes: [wa@REDACTED,wb@REDACTED] Call is made from node c@REDACTED, which is neither candidate/worker, causes noproc error. See below. If a node wants to call gen_leader:leader_call, does it have to run a gen_leader instance? I tried running gen_leader instance on the workers also, but it crashed both the gen_leader instances on node a@REDACTED and b@REDACTED I ran both versions of gen_leader, patched version and non-patched version. On patched version, I couldn't run gen_leader instance on worker nodes (this crashed all instances of gen_leader on all nodes), but was able to run it on non-patched version. Which is the desired behavior, in regards to gen_leader instance running on worker nodes? Also, what is the actual steps to run the gen_leader, so that the remote nodes (neither worker/candidate) can communicate with elected leader to send task, which then pushed down to the worker nodes? (c@REDACTED)3> gen_leader:leader_call(leader_boo, {lookup, "dummy"}). ** exception exit: {{gen_leader,leader_call,2}, {line,246}, {noproc, {gen_leader,leader_call, [leader_boo,{lookup,"dummy"}]}}} in function gen_leader:leader_call/2 Thank you, -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From sand@REDACTED Wed Apr 30 06:15:47 2008 From: sand@REDACTED (sand@REDACTED) Date: Tue, 29 Apr 2008 21:15:47 -0700 Subject: [erlang-questions] Calling halt() only after I/O has completed. Message-ID: <18455.62067.38036.380032@priss.frightenedpiglet.com> I have small escript that reads a bunch of files, scans them for data, and prints the matches to stdout ('standard_io', to be precise, going to the 'user' process under the hood). If there were any matches, then we have an error condition and the escript needs to return a status of 1 to the shell. If there are only a few matches, things work. If there are many matches, then the main process calls halt(1) while the I/O process is still sending the text to the terminal and the output gets truncated. The only way I have found to work around this is to insert a delay scaled by the number of records (100 ms seems to work). Calling file:close(user) to synchronously close the port and flush the output doesn't work. The top-level process just hangs. What's the best solution for guaranteeing that all the data gets printed before the program exits? This is with ERTS 5.5.4 on Linux. Thanks, Derek -- Derek Upham sand@REDACTED From ayman_abolfadl@REDACTED Wed Apr 30 08:48:32 2008 From: ayman_abolfadl@REDACTED (ayman abolfadl) Date: Tue, 29 Apr 2008 23:48:32 -0700 (PDT) Subject: [erlang-questions] escript Message-ID: <140075.38883.qm@web53109.mail.re2.yahoo.com> Hi, I am running a very simple escript but receiving an error as follows escript: Internal error: {badmatch,{error,enoent}} The escript just performs an io:format and the content of the escript is as follows. #! /usr/local/bin/escript escript main(_) -> io:format("Hello world\n" ). Thanks Ayman Abolfadl --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Wed Apr 30 09:16:05 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 30 Apr 2008 09:16:05 +0200 Subject: [erlang-questions] Calling halt() only after I/O has completed. In-Reply-To: <18455.62067.38036.380032@priss.frightenedpiglet.com> References: <18455.62067.38036.380032@priss.frightenedpiglet.com> Message-ID: <48181CB5.60200@it.uu.se> sand@REDACTED wrote: > I have small escript that reads a bunch of files, scans them for data, > and prints the matches to stdout ('standard_io', to be precise, going > to the 'user' process under the hood). If there were any matches, > then we have an error condition and the escript needs to return a > status of 1 to the shell. > > If there are only a few matches, things work. If there are many > matches, then the main process calls halt(1) while the I/O process is > still sending the text to the terminal and the output gets truncated. > The only way I have found to work around this is to insert a delay > scaled by the number of records (100 ms seems to work). Calling > > file:close(user) > > to synchronously close the port and flush the output doesn't work. > The top-level process just hangs. > > What's the best solution for guaranteeing that all the data gets > printed before the program exits? This is with ERTS 5.5.4 on Linux. init:stop() Also see Magnus Fr?berg's patch posted just a few days ago, to add a function init:stop(Status), which has been sorely missing. /Richard From tuncer.ayaz@REDACTED Wed Apr 30 09:42:16 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Wed, 30 Apr 2008 09:42:16 +0200 Subject: [erlang-questions] escript In-Reply-To: <140075.38883.qm@web53109.mail.re2.yahoo.com> References: <140075.38883.qm@web53109.mail.re2.yahoo.com> Message-ID: <4ac8254d0804300042s5b99253sf8033469fa6280fc@mail.gmail.com> 2008/4/30 ayman abolfadl : > Hi, > > I am running a very simple escript but receiving an error as follows > > escript: Internal error: {badmatch,{error,enoent}} > > The escript just performs an io:format and the content of the escript is as > follows. > > #! /usr/local/bin/escript escript > main(_) -> > io:format("Hello world\n" ). What about the following: #! /usr/local/bin/escript main(_) -> io:format("Hello world\n" ). From tuncer.ayaz@REDACTED Wed Apr 30 09:43:10 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Wed, 30 Apr 2008 09:43:10 +0200 Subject: [erlang-questions] escript In-Reply-To: <4ac8254d0804300042s5b99253sf8033469fa6280fc@mail.gmail.com> References: <140075.38883.qm@web53109.mail.re2.yahoo.com> <4ac8254d0804300042s5b99253sf8033469fa6280fc@mail.gmail.com> Message-ID: <4ac8254d0804300043w547f77f6ie0581afe56db4e07@mail.gmail.com> On Wed, Apr 30, 2008 at 9:42 AM, Tuncer Ayaz wrote: > 2008/4/30 ayman abolfadl : > > > Hi, > > > > I am running a very simple escript but receiving an error as follows > > > > escript: Internal error: {badmatch,{error,enoent}} > > > > The escript just performs an io:format and the content of the escript is as > > follows. > > > > #! /usr/local/bin/escript escript > > main(_) -> > > io:format("Hello world\n" ). > > What about the following: > #! /usr/local/bin/escript > > > main(_) -> > io:format("Hello world\n" ). > Forgot to add: That one should work :) From bjorn@REDACTED Tue Apr 29 09:02:19 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 29 Apr 2008 09:02:19 +0200 Subject: [erlang-questions] Old school exceptions vs. new age one In-Reply-To: <521254.57783.qm@web38807.mail.mud.yahoo.com> References: <521254.57783.qm@web38807.mail.mud.yahoo.com> Message-ID: Thomas Lindgren writes: > I have to note that I nearly always use 'catch' rather > than 'try', and even consider 'catch' taking care of > all cases in a great big mess the usually desired > behaviour. But since I so clearly Don't Get It, I'm > wondering: what properties of 'try' do people consider > great _in practice_? What has saved your bacon in > switching from old to new school? For me, the ability to catch some sorts of exceptions and ignore others. Especially if I want to catch throws, but want any errors to terminate the process. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Mon Apr 28 16:56:21 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 28 Apr 2008 16:56:21 +0200 Subject: [erlang-questions] [Doc] lists:keytake/3 & lists:keystore/4 In-Reply-To: <4815DB98.3060709@e-fractal.cz> References: <4815DB98.3060709@e-fractal.cz> Message-ID: Ji?? ?ofka writes: > Hello, > > lists:keytake/3 & lists:keystore/4 are described in documentation ( > http://www.erlang.org/doc/man/lists.html ) but no longer available. As far as I can see, they do exist in R12B. > It > seems that lists' module documentation is a bit outdated. In what way? /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Wed Apr 30 12:20:12 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 30 Apr 2008 12:20:12 +0200 Subject: [erlang-questions] : Old school exceptions vs. new age one In-Reply-To: <521254.57783.qm@web38807.mail.mud.yahoo.com> References: <521254.57783.qm@web38807.mail.mud.yahoo.com> Message-ID: <20080430102012.GB17328@erix.ericsson.se> On Mon, Apr 28, 2008 at 07:25:01AM -0700, Thomas Lindgren wrote: > : > > I have to note that I nearly always use 'catch' rather > than 'try', and even consider 'catch' taking care of > all cases in a great big mess the usually desired > behaviour. But since I so clearly Don't Get It, I'm > wondering: what properties of 'try' do people consider > great _in practice_? What has saved your bacon in > switching from old to new school? > > * ability to differentiate between exception kinds? In any kind of library'ish code it is invaluable do be able to distinguish between a return value of {'EXIT', _} and a real exception. Using catch is simply not an option since it can be spoofed and you can not guarantee what your library is doing. > * ignoring the exception handler on mismatch? > * the 'finally' clause? > * syntax is nicer? > * something else? if so, what > > Best, > Thomas > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mailparmalat@REDACTED Wed Apr 30 13:19:33 2008 From: mailparmalat@REDACTED (Chih-Wei Yu) Date: Wed, 30 Apr 2008 13:19:33 +0200 Subject: [erlang-questions] R12B-1 runtime-errors Message-ID: <673036f20804300419r5f62abd5pa498b1d8f88be251@mail.gmail.com> Hi everyone, I'm having some issues with Erlang 12B-1 getting errors such as 'size_object: bad tag for 0x528' in the nohup.out file. I'm running SMP on Solaris 10 platform. Can anyone advise on the cause of the error? Thanks Regards, Chih-Wei Yu -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiri.sofka@REDACTED Wed Apr 30 12:16:58 2008 From: jiri.sofka@REDACTED (=?UTF-8?B?SmnFmcOtIMWgb2ZrYQ==?=) Date: Wed, 30 Apr 2008 12:16:58 +0200 Subject: [erlang-questions] [Doc] lists:keytake/3 & lists:keystore/4 In-Reply-To: References: <4815DB98.3060709@e-fractal.cz> Message-ID: <4818471A.9040000@e-fractal.cz> Hi, sorry, that was my mistake. I didn't realize they were added in R12 and tested it on a machine still running R11. JS Bjorn Gustavsson wrote: > Ji?? ofka writes: > > >> Hello, >> >> lists:keytake/3 & lists:keystore/4 are described in documentation ( >> http://www.erlang.org/doc/man/lists.html ) but no longer available. >> > > As far as I can see, they do exist in R12B. > > >> It >> seems that lists' module documentation is a bit outdated. >> > > In what way? > > /Bjorn > From dloutrein.lists@REDACTED Wed Apr 30 15:50:06 2008 From: dloutrein.lists@REDACTED (denis) Date: Wed, 30 Apr 2008 09:50:06 -0400 Subject: [erlang-questions] R12B-1 runtime-errors In-Reply-To: <673036f20804300419r5f62abd5pa498b1d8f88be251@mail.gmail.com> Message-ID: <005501c8aac9$2043ecd0$b029030a@mtl.ubisoft.org> Do you use binary pattern matching in your program ? I already had the same kind of errors (at random) in a program which did pattern matching on binaries. It was a bug in R12B1. It?s fixed in R12B2. Regards Denis _____ De : erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] De la part de Chih-Wei Yu Envoy? : mercredi 30 avril 2008 07:20 ? : erlang-questions@REDACTED Objet : [erlang-questions] R12B-1 runtime-errors Hi everyone, I'm having some issues with Erlang 12B-1 getting errors such as 'size_object: bad tag for 0x528' in the nohup.out file. I'm running SMP on Solaris 10 platform. Can anyone advise on the cause of the error? Thanks Regards, Chih-Wei Yu -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailparmalat@REDACTED Wed Apr 30 17:14:09 2008 From: mailparmalat@REDACTED (Chih-Wei Yu) Date: Wed, 30 Apr 2008 17:14:09 +0200 Subject: [erlang-questions] R12B-1 runtime-errors In-Reply-To: <005501c8aac9$2043ecd0$b029030a@mtl.ubisoft.org> References: <673036f20804300419r5f62abd5pa498b1d8f88be251@mail.gmail.com> <005501c8aac9$2043ecd0$b029030a@mtl.ubisoft.org> Message-ID: <673036f20804300814m15ee3869xb11875f6a0a0046b@mail.gmail.com> Hi, We have binary matching yes. Did your runtime produce a crash dump or core? Regards, Chih-Wei Yu On 4/30/08, denis wrote: > > Do you use binary pattern matching in your program ? > > I already had the same kind of errors (at random) in a program which did > pattern matching on binaries. It was a bug in R12B1. > > It's fixed in R12B2. > > > > Regards > > Denis > > > ------------------------------ > > *De :* erlang-questions-bounces@REDACTED [mailto: > erlang-questions-bounces@REDACTED] *De la part de* Chih-Wei Yu > *Envoy? :* mercredi 30 avril 2008 07:20 > *? :* erlang-questions@REDACTED > *Objet :* [erlang-questions] R12B-1 runtime-errors > > > > Hi everyone, > > > > I'm having some issues with Erlang 12B-1 getting errors such as > 'size_object: bad tag for 0x528' in the nohup.out file. I'm running SMP on > Solaris 10 platform. Can anyone advise on the cause of the error? Thanks > > > > Regards, > > Chih-Wei Yu > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dloutrein.lists@REDACTED Wed Apr 30 17:23:28 2008 From: dloutrein.lists@REDACTED (denis) Date: Wed, 30 Apr 2008 11:23:28 -0400 Subject: [erlang-questions] R12B-1 runtime-errors In-Reply-To: <673036f20804300814m15ee3869xb11875f6a0a0046b@mail.gmail.com> Message-ID: <006001c8aad6$29925bc0$b029030a@mtl.ubisoft.org> If I?m remember well, no. We are developing on windows, and the result was a crash of werl, but no crash dump. I tried on linux, and got the same kind of errors. But I can?t remember if we had a core and/or crash dump. The error was random, sometime bad tag, sometimes otherwise. _____ De : Chih-Wei Yu [mailto:mailparmalat@REDACTED] Envoy? : mercredi 30 avril 2008 11:14 ? : denis Cc : erlang-questions@REDACTED Objet : Re: [erlang-questions] R12B-1 runtime-errors Hi, We have binary matching yes. Did your runtime produce a crash dump or core? Regards, Chih-Wei Yu On 4/30/08, denis wrote: Do you use binary pattern matching in your program ? I already had the same kind of errors (at random) in a program which did pattern matching on binaries. It was a bug in R12B1. It's fixed in R12B2. Regards Denis _____ De : erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] De la part de Chih-Wei Yu Envoy? : mercredi 30 avril 2008 07:20 ? : erlang-questions@REDACTED Objet : [erlang-questions] R12B-1 runtime-errors Hi everyone, I'm having some issues with Erlang 12B-1 getting errors such as 'size_object: bad tag for 0x528' in the nohup.out file. I'm running SMP on Solaris 10 platform. Can anyone advise on the cause of the error? Thanks Regards, Chih-Wei Yu -------------- next part -------------- An HTML attachment was scrubbed... URL: From jarrod@REDACTED Wed Apr 30 19:55:40 2008 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 30 Apr 2008 13:55:40 -0400 Subject: [erlang-questions] what is the correct syntax to spawm a MFA with no arguments? Message-ID: start() -> spawn(fun loop/0). I want to convert the above code snippet into a MFA, what is the correct syntax to do this. I tried start() -> spawn(?MODULE, fun loop/0, []). and all I get when I call it is ** exception error: bad function 'area_server.start' -------------- next part -------------- An HTML attachment was scrubbed... URL: From mog-lists@REDACTED Wed Apr 30 20:11:01 2008 From: mog-lists@REDACTED (mog) Date: Wed, 30 Apr 2008 13:11:01 -0500 Subject: [erlang-questions] what is the correct syntax to spawm a MFA with no arguments? In-Reply-To: References: Message-ID: <4818B635.203@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jarrod Roberson wrote: > start() -> spawn(fun loop/0). > > I want to convert the above code snippet into a MFA, what is the > correct syntax to do this. > > I tried start() -> spawn(?MODULE, fun loop/0, []). and all I get > when I call it is ** exception error: bad function 'area_server.start' why arent you doing spawn(fun loop() end) or spawn(mod, loop, []) ? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIGLY0eq+tARrxhnsRAjXkAJ9Kac0rnJmyvGMj5aBEFg1KDMnqYgCfbETU CnQVOwMecrPNKI+7gV9hH+8= =PNFc -----END PGP SIGNATURE----- From jarrod@REDACTED Wed Apr 30 21:22:17 2008 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 30 Apr 2008 15:22:17 -0400 Subject: [erlang-questions] what is the correct syntax to spawm a MFA with no arguments? In-Reply-To: References: Message-ID: On Wed, Apr 30, 2008 at 1:55 PM, Jarrod Roberson wrote: > start() -> spawn(fun loop/0). > > I want to convert the above code snippet into a MFA, what is the correct > syntax to do this. > > I tried start() -> spawn(?MODULE, fun loop/0, []). and all I get when I > call it is ** exception error: bad function 'area_server.start' > > I have also tried spawn(?MODULE, loop, []) and I get a warning that loop/0 is unused. 1> c(area_server). ./area_server.erl:16: Warning: function loop/0 is unused {ok,area_server} 2> P = area_server:start(). <0.40.0> =ERROR REPORT==== 30-Apr-2008::15:20:53 === Error in process <0.40.0> with exit value: {undef,[{area_server,loop,[]}]} 3> here is the entire program. -module(area_server). -export([start/0, area/2]). start() -> spawn(area_server, loop, []). area(Pid, What) -> rpc(Pid, What). rpc(Pid, Request) -> Pid ! {self(), Request}, receive {Pid, Response} -> Response end. loop() -> receive {From, {rectangle, Width, Ht}} -> From ! {self(), Width * Ht}, loop(); {From, {circle, R}} -> From ! {self(), 3.14159 * R * R}, loop(); {From, Other} -> From ! {self(), {error, Other}}, loop() end. *What I really need to know is how to MFA spawn a process around a function with no arguments.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Wed Apr 30 21:27:20 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 30 Apr 2008 12:27:20 -0700 Subject: [erlang-questions] what is the correct syntax to spawm a MFA with no arguments? In-Reply-To: References: Message-ID: 2008/4/30 Jarrod Roberson : > I have also tried spawn(?MODULE, loop, []) and I get a warning that loop/0 > is unused. You need to add loop/0 to -export. From mog-lists@REDACTED Wed Apr 30 22:00:44 2008 From: mog-lists@REDACTED (mog) Date: Wed, 30 Apr 2008 15:00:44 -0500 Subject: [erlang-questions] what is the correct syntax to spawm a MFA with no arguments? In-Reply-To: References: Message-ID: <4818CFEC.9070600@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jarrod Roberson wrote: > On Wed, Apr 30, 2008 at 1:55 PM, Jarrod Roberson > > wrote: > > start() -> spawn(fun loop/0). > > I want to convert the above code snippet into a MFA, what is the > correct syntax to do this. > > I tried start() -> spawn(?MODULE, fun loop/0, []). and all I get > when I call it is ** exception error: bad function > 'area_server.start' > > > > I have also tried spawn(?MODULE, loop, []) and I get a warning that > loop/0 is unused. > > 1> c(area_server). > ./area_server.erl:16: Warning: function loop/0 is unused > {ok,area_server} > 2> P = area_server:start(). > <0.40.0> > > =ERROR REPORT==== 30-Apr-2008::15:20:53 === > Error in process <0.40.0> with exit value: > {undef,[{area_server,loop,[]}]} > > 3> > > here is the entire program. > > -module(area_server). > -export([start/0, area/2]). > > start() -> spawn(area_server, loop, []). > > area(Pid, What) -> > rpc(Pid, What). > > rpc(Pid, Request) -> > Pid ! {self(), Request}, > receive > {Pid, Response} -> > Response > end. > > loop() -> > receive > {From, {rectangle, Width, Ht}} -> > From ! {self(), Width * Ht}, > loop(); > {From, {circle, R}} -> > From ! {self(), 3.14159 * R * R}, > loop(); > {From, Other} -> > From ! {self(), {error, Other}}, > loop() > end. > > *What I really need to know is how to MFA spawn a process around a > function with no arguments.* > > ---------------------------------------------------------------------- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions loop needs to be exported if your going to call it with spawn(mod, fun, args) it does not need to be exported if you call spawn(fun() function() end) , it would need to be exported if you called spawn(fun() module:function() end) mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIGM/req+tARrxhnsRArPQAKCSwAoxyf9jVXX5njTo+j81RZF+WgCfXMsW sBcM8fRm32RIBtDHHaHco5M= =Whe7 -----END PGP SIGNATURE----- From jarrod@REDACTED Wed Apr 30 23:02:00 2008 From: jarrod@REDACTED (Jarrod Roberson) Date: Wed, 30 Apr 2008 17:02:00 -0400 Subject: [erlang-questions] what is the correct syntax to spawm a MFA with no arguments? In-Reply-To: References: Message-ID: On Wed, Apr 30, 2008 at 3:27 PM, Matthew Dempsky wrote: > 2008/4/30 Jarrod Roberson : > > I have also tried spawn(?MODULE, loop, []) and I get a warning that > loop/0 > > is unused. > > You need to add loop/0 to -export. > thanks that stopped the warning, and it actually works! I thought the idea of that example is to _hide_ the loop/0 method since it is an implementation detail now that there is a start/0 function? I guess my question to the group is; is there anyway to get this to work without having to -export loop/0? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mog-lists@REDACTED Wed Apr 30 23:15:29 2008 From: mog-lists@REDACTED (mog) Date: Wed, 30 Apr 2008 16:15:29 -0500 Subject: [erlang-questions] what is the correct syntax to spawm a MFA with no arguments? In-Reply-To: References: Message-ID: <4818E171.2000701@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jarrod Roberson wrote: > > > On Wed, Apr 30, 2008 at 3:27 PM, Matthew Dempsky > > wrote: > > 2008/4/30 Jarrod Roberson >: >> I have also tried spawn(?MODULE, loop, []) and I get a warning > that loop/0 >> is unused. > > You need to add loop/0 to -export. > > > thanks that stopped the warning, and it actually works! I thought > the idea of that example is to _hide_ the loop/0 method since it is > an implementation detail now that there is a start/0 function? I > guess my question to the group is; is there anyway to get this to > work without having to -export loop/0? > > ---------------------------------------------------------------------- > > > _______________________________________________ erlang-questions > mailing list erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions have you read my responses???? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIGOFweq+tARrxhnsRAq8XAJsE88jst9vdJsqnbvNEo0KBji0JdQCglkp7 0Rax42o9Miwv0qA0dh7Q8ao= =1gp6 -----END PGP SIGNATURE----- From dg@REDACTED Wed Apr 30 23:38:05 2008 From: dg@REDACTED (Daniel Ginsburg) Date: Thu, 01 May 2008 01:38:05 +0400 Subject: [erlang-questions] gen_tcp nonblocking send Message-ID: <4818E6BD.2020402@ot-e.biz> Is there any way to make gen_tcp:send operate in non-blocking mode? As I read the documentation, there are two possible ways to handle stalling reader: 1) block forever 2) use {send_timeout, N} and when timeout occurs, close the socket. In my application 2 is unacceptable and 1 is suboptimal. What I'd really like to have is an opportunity to know that kernel send buffer is filled and send would block, and conversely, when stalled receiver has recovered and I can send more data. It that possible with standard erlang library? I'd really hate to write my own driver to handle this. From v@REDACTED Wed Apr 30 23:42:37 2008 From: v@REDACTED (Valentin Micic) Date: Wed, 30 Apr 2008 23:42:37 +0200 Subject: [erlang-questions] R12B-1 runtime-errors In-Reply-To: <006001c8aad6$29925bc0$b029030a@mtl.ubisoft.org> Message-ID: <200804302142.m3ULgkGF028808@mail.pharos-avantgard.com> The one that Chih-Wei is talking about produces a core dump with SIGBUS signal as a cause. Who can assist with this, or rather, where can we mail the core dump and more details about the crash? V. ________________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of denis Sent: 30 April 2008 05:23 PM To: 'Chih-Wei Yu' Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] R12B-1 runtime-errors If I?m remember well, no. We are developing on windows, and the result was a crash of werl, but no crash dump. I tried on linux, and got the same kind of errors. But I can?t remember if we had a core and/or crash dump. The error was random, sometime bad tag, sometimes otherwise. ________________________________________ De?: Chih-Wei Yu [mailto:mailparmalat@REDACTED] Envoy??: mercredi 30 avril 2008 11:14 ??: denis Cc?: erlang-questions@REDACTED Objet?: Re: [erlang-questions] R12B-1 runtime-errors Hi, ? We have binary matching yes. Did your runtime produce a crash dump or core? ? Regards, Chih-Wei Yu ? On 4/30/08, denis wrote: Do you use binary pattern matching ?in your program ? I already had the same kind of errors (at random) in a program which did pattern matching on binaries. It was a bug in R12B1. It's fixed in R12B2. ? Regards Denis ? ________________________________________ De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] De la part de Chih-Wei Yu Envoy??: mercredi 30 avril 2008 07:20 ??: erlang-questions@REDACTED Objet?: [erlang-questions] R12B-1 runtime-errors ? Hi everyone, ? I'm having some issues with Erlang 12B-1 getting errors such as 'size_object: bad tag for 0x528' in the nohup.out file. I'm running SMP on Solaris 10 platform. Can anyone advise on the cause of the error? Thanks ? Regards, Chih-Wei Yu From Woolla_T@REDACTED Wed Apr 30 14:49:06 2008 From: Woolla_T@REDACTED (Trevor Woollacott [ MTN - Innovation Centre ]) Date: Wed, 30 Apr 2008 14:49:06 +0200 Subject: [erlang-questions] ERLANG Runtime Crash Message-ID: <70D00C33FCD1FD4A860DEAC228277C0C0309A3A5@MTNMAIL1.mtn.co.za> Hi all We are having a problem with 64-bit Erlang R12B-1 with SMP on Solaris 10 where it crashes and produces a core dump containing the following information: adb core core file = core -- program ``/usr/local/erlang/R12B-1/lib/erlang/erts-5.6.1/bin/beam.smp'' on platform SUNW,Netra-T2000 SIGBUS: Bus Error $c io_list_len+0xbc(100a1ca99, 100c3d450, 0, 0, 1001c6444, 1) list_to_binary_1+0x80(100eb3a98, 100a1ca99, 1011c3578, f, 1011b3088, 10015bea0) process_main+0x6390(1, 100c3d450, 0, 0, 1001c6444, 1) sched_thread_func+0x60(100c3d450, ffffffff7ffff258, ffffffff7e6f7d40, ffffffff7ffff254, ffffffff79b13c00, 0) thr_wrapper+0x6c(ffffffff7ffff250, 1fc000, 0, 0, 1001c6444, 1) libc.so.1`_lwp_start(0, 0, 0, 0, 0, 0) Does anyone have an idea what could cause this crash? Is it fixed in Erlang R12B-2? Thanks Regards, Trevor NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/default.aspx?pid=34411 -------------- next part -------------- An HTML attachment was scrubbed... URL: