From per@REDACTED Fri Aug 1 00:13:58 2003 From: per@REDACTED (Per Bergqvist) Date: Fri, 01 Aug 2003 01:13:58 +0300 Subject: Resource Sharing Between production and test environment In-Reply-To: <877k5yie22.fsf@ghidra.vail> Message-ID: <200307312313.h6VNDxn23104@tessla.levonline.com> global use gen_server:multi_call/3 to set_lock on all connected nodes. note that this is with infinite timeout. each individual call per node will however be aborted if the node goes down and set_lock may be restarted. the worst thing that can happen to an erlang node is that the beam scheduler stops scheduling. the tcp/ip connection will still appear to be up but it will obviously not respond to requests. depending on how you set the kernel ping this may lead to a long time before a node down event is delivered. this would happen if you for example hit a break point in gdb if you are debugging the evm. an even easier way to get the same result is to suspend (^Z) a node run interactively. this will effect mnesia and any distributed application (i.e. using dist_ac). /Per ------------------- > Per Bergqvist writes: > > > You should absolutely not attempt to solve the problem with > > distributed erlang since it may potentially severely impact the > > production system. (e.g. gdb debugging a node in the test system > > could potentially stall global locking on all other connected > > nodes.) > > Could you explain a little more what might cause global locking to > stall, and what parts of OTP are affected? > > You don't need gdb to take a node offline at an inopportune moment. > :-0 > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From anders_nygren2002@REDACTED Fri Aug 1 04:35:54 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Fri, 1 Aug 2003 04:35:54 +0200 (CEST) Subject: Starting Your favorite editor from Erlang In-Reply-To: <200307312038.h6VKcRh20014@tessla.levonline.com> Message-ID: <20030801023554.34138.qmail@web14605.mail.yahoo.com> --- Per Bergqvist skrev: > Hi, > > Yeah, you're right. Whitespace should be quoted as > well. > > Unfortunately this does not work for me on Windows > XP. > The short form of the directory name without > whitespace works. > > Does it work for anybody with whitespace in > directory names ??? > > /Per > Whitespace does not work for me either, also on Win XP. /Anders _____________________________________________________ G? f?re i k?n och f? din sajt v?rderad p? nolltid med Yahoo! Express Se mer p?: http://se.docs.yahoo.com/info/express/help/index.html From vlad_dumitrescu@REDACTED Fri Aug 1 14:33:58 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 1 Aug 2003 14:33:58 +0200 Subject: Distributed supervising Message-ID: Hi all, I feel I could use a distributed supervising hierarchy, i.e. the processes can be on several nodes. And it would probably not be such a big deal to extend supervisor.erl to make it work in the normal case, but I suppose the trouble begins when node connectivity begins to be less than 100%. Which is almost right away :-) If the idea has been looked at and rejected for good reason, please let me know, so that I can move on. Otherwise it might keep buzzing around in my head. Or if there is such a thing already, even better! Thanks in advance, Vlad From Erik.Stenman@REDACTED Fri Aug 1 16:44:21 2003 From: Erik.Stenman@REDACTED (Erik Stenman) Date: Fri, 1 Aug 2003 16:44:21 +0200 Subject: Starting Your favorite editor from Erlang Message-ID: <006401c3583b$64da2ac0$9224fea9@lamppc36> For me it works if I give the path between double quotes (which are quoted). Example: os:cmd("\"C:/Program Files/Adobe/Acrobat 5.0/Reader/AcroRd32.exe\""). This is XP and Erlang 5.2.3.3. Usually in Windows you have to put a path that contains white space within double quotes ("). /Erik -------------------------------------- Eric Conspiracy Secret Laboratories I'm Happi, you should be happy. Praeterea censeo "0xCA" scribere Erlang posse. > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Anders Nygren > Sent: den 1 augusti 2003 04:36 > To: erlq > Subject: Re: Starting Your favorite editor from Erlang > > > --- Per Bergqvist skrev: > Hi, > > > > Yeah, you're right. Whitespace should be quoted as > > well. > > > > Unfortunately this does not work for me on Windows > > XP. > > The short form of the directory name without > > whitespace works. > > > > Does it work for anybody with whitespace in > > directory names ??? > > > > /Per > > > > Whitespace does not work for me either, also on > Win XP. > > /Anders > > _____________________________________________________ > G? f?re i k?n och f? din sajt v?rderad p? nolltid med Yahoo! > Express Se mer p?: > http://se.docs.yahoo.com/info/express/help/ind> ex.html > From byron.hale@REDACTED Fri Aug 1 23:17:24 2003 From: byron.hale@REDACTED (Byron Hale) Date: Fri, 01 Aug 2003 14:17:24 -0700 Subject: Comments on the First Regular Erlang Beer Break In-Reply-To: <07FAE771-C186-11D7-9250-0003938748D4@young-river.com> Message-ID: <5.2.0.9.2.20030801140827.02854e10@einfo.com> We had the First Regular Erlang Beer Break on Monday night at Cafe Baronne in Menlo Park. Jim, Roger, Lennart, Sebastian, Bart, Maurice and myself found each other, although standing there at first seemed dubious. Were there others who couldn't find us? Despite a Monday night in a down economy, Cafe Baronne was roaring! Quite a few of my Erlang questions were answered, although after two beers, it became difficult to focus on technicalities. The more so because of droll Software Engineering experiences. I greatly enjoyed meeting you all and the evening. Byron From jilani.khaldi@REDACTED Fri Aug 1 23:54:58 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Fri, 01 Aug 2003 23:54:58 +0200 Subject: reading and writing text file Message-ID: Hi All, I have a file text "/erlang/eng.txt" and I want to read it; I have tried file:file_read and file:binary_to_list but the result is a file full of "\n". Is there a way to get it as a list of strings? Example: myfile.txt has these lines: Italy, Rome France, Paris England, London Now I want to chane these lines in: Italia, Roma Francia, Parigi Inghilterra, Londra and save them in "/erlang/ita.txt" I have tried many ways but in vain. Thanks! jk From ulf.wiger@REDACTED Sat Aug 2 12:08:00 2003 From: ulf.wiger@REDACTED (Wiger Ulf) Date: Sat, 2 Aug 2003 12:08:00 +0200 Subject: reading and writing text file References: Message-ID: <000d01c358dd$f47aa180$fd7a40d5@telia.com> You can either use file:read_file() and binary_to_list(), followed by string:tokens(List, "\n") -- which will give you a list of strings, one for each line of text in the file -- or use io:get_line(FileDescr,'') to read one line at a time from the file. (regexp:split() will also work, but in this case, I think string:tokens/2 is better.) Note that reading one line at a time from the file will give better memory characteristics. /Uffe ----- Original Message ----- From: "Jilani Khaldi" To: Sent: den 1 augusti 2003 23:54 Subject: reading and writing text file > Hi All, > I have a file text "/erlang/eng.txt" and I want to read it; I have tried > file:file_read and file:binary_to_list but the result is a file full of > "\n". > Is there a way to get it as a list of strings? > Example: > myfile.txt has these lines: > > Italy, Rome > France, Paris > England, London > > Now I want to chane these lines in: > > Italia, Roma > Francia, Parigi > Inghilterra, Londra > > and save them in "/erlang/ita.txt" > > I have tried many ways but in vain. > > Thanks! > > jk > From jilani.khaldi@REDACTED Sat Aug 2 17:17:47 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Sat, 02 Aug 2003 17:17:47 +0200 Subject: Erlang & shell Message-ID: Hi All, using the shell under Linux, 1. is there a way to clear a variable in Erlang and use it again? 2. How to list all the used variables? 3. The command m(MethodName) lists all the methods of the module and if these methods are many, m(file) for example I can't see them all. Is there a command similar to "|more" to scroll a page each time? Where can I find an updated list of all the modules and their methods. Thank you very much. jilani From happi@REDACTED Sat Aug 2 17:41:58 2003 From: happi@REDACTED (happi@REDACTED) Date: Sat, 2 Aug 2003 17:41:58 +0200 Subject: Erlang & shell In-Reply-To: Message-ID: <010301c3590c$9c7b9410$9224fea9@lamppc36> > Hi All, > > using the shell under Linux, try the help: help(). > 1. is there a way to clear a variable in Erlang and use it again? f(X). > 2. How to list all the used variables? b(). > 3. The command m(MethodName) lists all the methods of the > module and if these methods are many, m(file) for example I can't see them > all. Is there a command similar to "|more" to scroll a page each time? Not that I know of, perhaps someone else know about this, but a good idea is to run the shell from inside Emacs, then there is no need for more, all is saved in the buffer. You could try L = ModuleName:module_info(exports). Which gives you a list of all exported functions, then you can traverse that list yourself. > Where can I find an updated list of all the modules and their methods. All OTP modules are documented at: http://www.erlang.org/doc/r9b/doc/index.html If you want to see all loaded modules in your system you can do: code:all_loaded(). You could do something like L = [{M,M:module_info(exports)} || {M,Path} <- code:all_loaded()]. to get a list of all modules and functions. /Erik -------------------------------------- Eric Conspiracy Secret Laboratories I'm Happi, you should be happy. Praeterea censeo "0xCA" scribere Erlang posse. From jilani.khaldi@REDACTED Sun Aug 3 01:35:49 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Sun, 03 Aug 2003 01:35:49 +0200 Subject: reading and writing text file In-Reply-To: <000d01c358dd$f47aa180$fd7a40d5@telia.com> References: <000d01c358dd$f47aa180$fd7a40d5@telia.com> Message-ID: > You can either use file:read_file() and binary_to_list(), followed by > string:tokens(List, "\n") -- which will give you a list of strings, one > for each line of text in the file -- It works but I still get "\" added for all quoted text. For example "Hello" becomes \"hello\". How can I get rid of these "\". > or use io:get_line(FileDescr,'') to read one > line at a time from the file. What FileDesc means in this case and what do I have to put inside ''? I just have a file "a.txt" to read and see it as a list of strings. How to append the string "Hello Erlang" to the text file "a.txt"? I can't find the append command. Thank you again. jilani From jilani.khaldi@REDACTED Sun Aug 3 01:34:42 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Sun, 03 Aug 2003 01:34:42 +0200 Subject: Erlang & shell In-Reply-To: <010301c3590c$9c7b9410$9224fea9@lamppc36> References: <010301c3590c$9c7b9410$9224fea9@lamppc36> Message-ID: >> using the shell under Linux, > > try the help: help(). > >> 1. is there a way to clear a variable in Erlang and use it again? > f(X). > >> 2. How to list all the used variables? > > b(). Sorry, but I can't see, using Linux (Slackware 9) "b()" or "f()" doing help(). However these commands works fine. Thanks! jilani From hakan.stenholm@REDACTED Sun Aug 3 03:05:20 2003 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 3 Aug 2003 03:05:20 +0200 Subject: Erlang & shell In-Reply-To: Message-ID: <8D756855-C54E-11D7-921B-000393B8AB26@mbox304.swipnet.se> On l?rdag, aug 2, 2003, at 17:17 Europe/Stockholm, Jilani Khaldi wrote: > Hi All, > > using the shell under Linux, > 1. is there a way to clear a variable in Erlang and use it again? 2. > How to list all the used variables? > 3. The command m(MethodName) lists all the methods of the module and > if these methods are many, m(file) for example I can't see them all. > Is there a command similar to "|more" to scroll a page each time? One way to print all the text of very big terms is wrap them in a io:format, like this: io:format("~p",[m(file)]). %% for m(file) > Where can I find an updated list of all the modules and their methods. > > Thank you very much. > > jilani > From ulf.wiger@REDACTED Sun Aug 3 14:45:42 2003 From: ulf.wiger@REDACTED (Wiger Ulf) Date: Sun, 3 Aug 2003 14:45:42 +0200 Subject: reading and writing text file References: <000d01c358dd$f47aa180$fd7a40d5@telia.com> Message-ID: <001501c359bd$26981d20$fd7a40d5@telia.com> From: "Jilani Khaldi" > > You can either use file:read_file() and binary_to_list(), followed by > > string:tokens(List, "\n") -- which will give you a list of strings, one > > for each line of text in the file -- > It works but I still get "\" added for all quoted text. For example "Hello" > becomes \"hello\". How can I get rid of these "\". The quoting is a matter of output formatting. The backslashes are not really there, but added by the formatting function of the shell. Using io:format(), ~p (pretty-print) will escape all quotes in that fashion, whereas ~s (format as string) will not. Erlang (BEAM) emulator version 5.2 [threads:0] Eshell V5.2 (abort with ^G) 1> String = "Say \"Hello\"". "Say \"Hello\"" 2> io:format("~p~n", [String]). "Say \"Hello\"" ok 3> io:format("~s~n", [String]). Say "Hello" ok 4> length(String). 11 5> > > or use io:get_line(FileDescr,'') to read one > > line at a time from the file. > What FileDesc means in this case and what do I have to put inside ''? I > just have a file "a.txt" to read and see it as a list of strings. I was perhaps a bit too terse. Apologies. I wanted to leave some room for personal exploration. (-: You can always look up the documentation for functions using "erl -man ", e.g. "erl -man io". Another method is to browse the on-line documentation on http://www.erlang.org/. FileDescr (or IoDevice, as it is called in the io reference manual) is a file descriptor identifying an open file. 6> {ok,FileDescr} = file:open("README", read). {ok,<0.36.0>} 7> io:get_line(FileDescr, ''). "Erlang/OTP October 15, 2002\n" 8> io:get_line(FileDescr, ''). "\n" 9> io:get_line(FileDescr, ''). "\n" 10> io:get_line(FileDescr, ''). "LAST MINUTE INFORMATION -- Release of Erlang 5.2/OTP R9B\n" 11> file:close(FileDescr). ok > How to append the string "Hello Erlang" to the text file "a.txt"? I can't > find the append command. Using {ok,OutFd} = file:open("a.txt", write) will give you a file descriptor, and clear the file a.txt, preparing it for writing. You can then use e.g. io:format(OutFd, Format, Args), which will behave just like io:format/2, but send the output to the file instead of stdout. /Uffe From vlad_dumitrescu@REDACTED Mon Aug 4 14:39:42 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 4 Aug 2003 14:39:42 +0200 Subject: Compiling P9C 2003-08-04 Message-ID: Hi, I tried to compile the latest release, but it stumbles at if [ ! -d "/cygdrive/h/dev/otp_src/lib/jinterface/priv/" ];then mkdir "/cygdrive/h/dev/otp_src/lib/jinterface/priv/"; fi make: *** No rule to make target `/cygdrive/h/dev/otp_src/lib/jinterface/priv/com/ericsson/otp/erlang/OtpErlangDe codeException.class', needed by `/cygdrive/h/dev/otp_src/lib/jinterface/priv/OtpErlang.jar'. Stop. I run Win2000 and it last tested (and working) configuration is 2003-07-27. regards, Vlad From erlang@REDACTED Mon Aug 4 15:08:36 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 04 Aug 2003 14:08:36 +0100 Subject: getting erl_interface C program to reply to net_adm:ping/1 Message-ID: <3F2E5AD4.5050601@manderp.freeserve.co.uk> Hi Gurus, I'm locking horns with erl_interface C libraries, and so far I've managed to get most thing to work, thanks to the excellent documentation. But I've stumbled on net_adm:ping/1. I can receive the {is_auth,NodeName} message, but since I don't know how to reply, the pinging end never gets a 'pong' back and just dumbly sits there. What is the appropriate answer to a 'ping', when using erl_interface? Also, what is involved in making a 'C' node behave like a visible node instead of a hidden one? Pete. From erlang@REDACTED Mon Aug 4 17:02:25 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 04 Aug 2003 16:02:25 +0100 Subject: getting erl_interface C program to reply to net_adm:ping/1 References: <3F2E5AD4.5050601@manderp.freeserve.co.uk> <006501c35a92$646854f0$01010d0a@moneymaker> Message-ID: <3F2E7581.20804@manderp.freeserve.co.uk> Hi Valentin, Hmm, I looked at the net_adm.erl and auth.erl code and did find the "yes" you suggest, but I've tried that without success. Having a look at what happens on the wire, an initial "ok" is sent but is followed by a slew of other transactions, including some containing net_kernel, $gen_call, is_auth, global_name_server, $gen_cast, init_connect etc... in them. Some locking, exchanging and resolving of data too, apparently. It doesn't look as simple as just "yes", there's authentication happening too. It's definitely not ICMP 'ping' as we know it on the Internet! Pete. Valentin wrote: > Try the following: > start toolbar, and open process monitor, and localte net_adm process. > Dobule-klick to start the trace. Then, from your local shell issue command: > > net_adm:ping( node() ). > > According to the trace that I am looking at: > > rec {'$gen_call', {<0.29.0>, #Ref<0.0.0.302>}, {is_auth, 'Val2@REDACTED'}} > > ... > > ! To: <0.29.0> Msg: {#Ref<0.0.0.302>, yes} > > This might be different for C-Nodes, thus try to reply with 'yes' and see > what happens. > > Valentin. > > Phartos Consulting (Pty) Ltd. > > ----- Original Message ----- > From: "Peter-Henry Mander" > To: > Sent: Monday, August 04, 2003 3:08 PM > Subject: getting erl_interface C program to reply to net_adm:ping/1 > > > >>Hi Gurus, >> >>I'm locking horns with erl_interface C libraries, and so far I've >>managed to get most thing to work, thanks to the excellent >>documentation. But I've stumbled on net_adm:ping/1. I can receive the >>{is_auth,NodeName} message, but since I don't know how to reply, the >>pinging end never gets a 'pong' back and just dumbly sits there. >> >>What is the appropriate answer to a 'ping', when using erl_interface? >> >>Also, what is involved in making a 'C' node behave like a visible node >>instead of a hidden one? >> >>Pete. >> >> >> > > > > From richardc@REDACTED Mon Aug 4 17:03:40 2003 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 4 Aug 2003 17:03:40 +0200 (MET DST) Subject: more on Erlang Workshop registration In-Reply-To: References: Message-ID: To clarify a point about registration for the Erlang Workshop (http://www.erlang.se/workshop/2003/): * Yes, you can pay on site (the fee is the same). * However, you cannot use the online advance registration unless you also pay in advance (ACM policy, etc. etc.). So if you prefer to pay on site, you will also have to register there. In that case, it would be kind of you to send a quick mail to Bjarne D?cker and tell him that you intend to come. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From Chandrashekhar.Mullaparthi@REDACTED Tue Aug 5 18:20:41 2003 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Tue, 5 Aug 2003 17:20:41 +0100 Subject: mnesia:first/1 and mnesia:next/2 Message-ID: Hello everyone, I need functions like mnesia:first/1 and mnesia:next/2 (which can be safely run in the context of a transaction) similar to mnesia:dirty_first/1 and mnesia:dirty_next/2 - I've implemented them by copying the read/2 function and modifying it as follows :-) It seems to work alright. Has anyone felt the need for such functions...? Any comments on the implementation? Wont work very well for fragmented tables but I guess I can live with that. cheers Chandru %% ---------------------------------- %% Following code added to mnesia.erl %% ---------------------------------- first(Tab) -> first(Tab, read). first(Tab, LockKind) -> case get(mnesia_activity_state) of {?DEFAULT_ACCESS, Tid, Ts} -> first(Tid, Ts, Tab, LockKind); {Mod, Tid, Ts} -> Mod:first(Tid, Ts, Tab, LockKind); _ -> abort(no_transaction) end. first(Tid, Ts, Tab, LockKind) when atom(Tab), Tab /= schema -> case element(1, Tid) of ets -> ?ets_first(Tab); tid -> Store = Ts#tidstore.store, Key = ?ets_first(Tab), LockItem = {record, Tab, Key}, case LockKind of read -> lock(LockItem, read); write -> lock(LockItem, write); sticky_write -> lock(LockItem, sticky); _ -> abort({bad_type, Tab, LockItem}) end, Key; Protocol -> dirty_first(Tab) end; first(Tid, Ts, Tab, LockKind) -> abort({bad_type, Tab}). next(Tab, Key) -> next(Tab, Key, read). next(Tab, Key, LockKind) -> case get(mnesia_activity_state) of {?DEFAULT_ACCESS, Tid, Ts} -> next(Tid, Ts, Tab, Key, LockKind); {Mod, Tid, Ts} -> Mod:next(Tid, Ts, Tab, Key, LockKind); _ -> abort(no_transaction) end. next(Tid, Ts, Tab, Key, LockKind) when atom(Tab), Tab /= schema -> case element(1, Tid) of ets -> ?ets_next(Tab, Key); tid -> Store = Ts#tidstore.store, Key_1 = ?ets_next(Tab, Key), LockItem = {record, Tab, Key_1}, case LockKind of read -> lock(LockItem, read); write -> lock(LockItem, write); sticky_write -> lock(LockItem, sticky); _ -> abort({bad_type, Tab, LockItem}) end, Key_1; Protocol -> dirty_next(Tab, Key) end; next(Tid, Ts, Tab, Key, LockKind) -> abort({bad_type, Tab}). NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From rickard.s.green@REDACTED Wed Aug 6 10:12:20 2003 From: rickard.s.green@REDACTED (Rickard Green) Date: Wed, 06 Aug 2003 10:12:20 +0200 Subject: bug in pid()? References: <200307300834.03754.dsolaz@sistelcom.com> Message-ID: <3F30B864.9080108@ericsson.com> Hi, Comment cut from external.c: /* * Valid creations for nodes are 1, 2, or 3. 0 can also be sent * as creation, though. When 0 is used as creation, the real creation * is unknown. Creation 0 on data will be changed to current * creation of the node which it belongs to when it enters * that node. * This typically happens when a remote pid is created with * list_to_pid/1 and then sent to the remote node. This behavior * has the undesirable effect that a pid can be passed between nodes, * and as a result of that not being equal to itself (the pid that * comes back isn't equal to the original pid). * */ c:pid/3 uses list_to_pid/1 when creating the pid. Note that list_to_pid/1 and c:pid/3 are only intended to be used for debugging and testing. They should not be used in application programs. Regards, Rickard Green, Erlang/OTP Daniel Solaz wrote: > is this a bug? > > node1> self(). > <0,41,0> > node1> global:register_name(shell1, self()). > yes > node1> global:whereis_name(shell1) == pid(0, 41, 0). > true > > node2> global:whereis_name(shell1) == pid(3822, 41, 0). > false > > comparison is true when pid is local but false when remote > > tested with > R9B-1 and P9C (July 28) on FreeBSD/x86 > R9B-1 on Linux/x86 and Linux/HPPA > > From Marc.Vanwoerkom@REDACTED Wed Aug 6 13:35:33 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Wed, 6 Aug 2003 13:35:33 +0200 (MEST) Subject: Erlang programmation In-Reply-To: (message from Mickael Remond on Mon, 02 Jun 2003 09:56:14 +0200) Message-ID: <200308061135.h76BZXS00151@bonsai.fernuni-hagen.de> Bonjour! I tried to order your book directly from Amazon.fr, but was not able to pay it, as I have no credit card. Buying a gift voucher from Amazon.de and using it for Amazon.fr is not supported, which is kind of strange, as they share the user/login databases. Rather strange it is as well to me that we now have European bank numbers and that banking fees for European money transfers went down to zero Euro here in Germany this year - so why the heck can't they cash in from my regular bank account? I am really thinink of writing to the EU commission to complain about that strange inner European trade. :) Yesterday, I asked a friend (with credit card) to buy the book for me, so I hope I see it in a week or two. Regards, Marc From rpettit@REDACTED Wed Aug 6 17:49:34 2003 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 6 Aug 2003 08:49:34 -0700 Subject: erl_interface (samples, anyone?) Message-ID: <20030806154934.GB16501@vailsys.com> I am in the process of getting C/C++ to talk to Erlang via erl_interface-3.3.2, and am curious if anyone has any examples they would like to share. My current work is on wrapping erl_interface in a C++ class that will serve multi-threaded clients. The class will be part of a shared object library which existing C/C++ applications will load in order to message Erlang processes on the internal network. I have the basics working (i.e. I can connect to remote nodes, message them, get messages back, etc). I am just curious as to what people have done with erl_interface and if anyone is willing to share. Any gotchas to watch out for that may not be mentioned in the docs? Any help/comments are appreciated. -Rick From dsolaz@REDACTED Wed Aug 6 18:36:14 2003 From: dsolaz@REDACTED (Daniel Solaz) Date: Wed, 6 Aug 2003 18:36:14 +0200 Subject: bug in pid()? In-Reply-To: <3F30B864.9080108@ericsson.com> References: <200307300834.03754.dsolaz@sistelcom.com> <3F30B864.9080108@ericsson.com> Message-ID: <200308061836.14372.dsolaz@sistelcom.com> On Wednesday 06 August 2003 10:12, Rickard Green wrote: > Note that list_to_pid/1 and c:pid/3 are only intended to be used for > debugging and testing. They should not be used in application programs. Which is exactly what I was doing. However, this difference in behavior goes against what I would expect (complete network transparency, no less), even when debugging/testing in the shell, and does not seem to be mentioned in the documentation. -Daniel From kenneth@REDACTED Wed Aug 6 20:28:10 2003 From: kenneth@REDACTED (Kenneth Lundin) Date: Wed, 06 Aug 2003 20:28:10 +0200 Subject: Erlang/OTP R9C-0 is now available for download Message-ID: <3F3148BA.60301@erix.ericsson.se> We are proud to announce that the new Erlang/OTP R9C-0 release is available for download as planned August 6, 2003. This is the original R9C release, R9C-0. You can download the full source distribution, main readme, documentation and a Windows binary installer from http://www.erlang.org/download/otp_src_R9C-0.tar.gz http://www.erlang.org/download/otp_src_R9C-0.readme http://www.erlang.org/download/otp_html_R9C-0.tar.gz http://www.erlang.org/download/otp_man_R9C-0.tar.gz http://www.erlang.org/download/otp_win32_R9C-0.exe Note that to unpack the TAR archives you need a GNU TAR compatible program. For example on MacOS X you need to use the 'gnutar' command, you can't use the 'tar' command or StuffIt to unpack the sources. You can find the complete documentation including release highlights in the on-line documentation http://www.erlang.org/doc/r9c/doc/ We want to thank those that sent us patches, suggestions and bug reports. The Erlang/OTP team at Ericsson -- Kenneth Lundin Ericsson AB kenneth@REDACTED ?T2/UAB/UKH/K BOX 1505 +46 8 727 57 25 125 25 ?lvsj? From serge@REDACTED Thu Aug 7 05:41:06 2003 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 06 Aug 2003 23:41:06 -0400 Subject: Suspected Spam: Erlang/OTP R9C-0 is now available for download References: <3F3148BA.60301@erix.ericsson.se> Message-ID: <3F31CA52.5000308@hq.idt.net> After installing R9C on Windows XP, I noticed that erl5.3\lib\erl_interface-3.4 is missing the src directory. Is it intentional? The erl_interface source was available in 5.2.3.3. Also in erl_interface documentation, the top link "EI User's Guide" doesn't work. Serge Kenneth Lundin wrote: > We are proud to announce that the new Erlang/OTP R9C-0 release is > available for download as planned August 6, 2003. > > This is the original R9C release, R9C-0. You can download the full > source distribution, main readme, documentation and a Windows > binary installer from > > http://www.erlang.org/download/otp_src_R9C-0.tar.gz > http://www.erlang.org/download/otp_src_R9C-0.readme > http://www.erlang.org/download/otp_html_R9C-0.tar.gz > http://www.erlang.org/download/otp_man_R9C-0.tar.gz > http://www.erlang.org/download/otp_win32_R9C-0.exe > > Note that to unpack the TAR archives you need a GNU TAR compatible > program. For example on MacOS X you need to use the 'gnutar' command, > you can't use the 'tar' command or StuffIt to unpack the sources. > > You can find the complete documentation including release highlights > in the on-line documentation > > http://www.erlang.org/doc/r9c/doc/ > > We want to thank those that sent us patches, suggestions and bug > reports. > > The Erlang/OTP team at Ericsson > From rpettit@REDACTED Thu Aug 7 16:56:37 2003 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 7 Aug 2003 07:56:37 -0700 Subject: getting erl_interface C program to reply to net_adm:ping/1 In-Reply-To: <3F2E5AD4.5050601@manderp.freeserve.co.uk> References: <3F2E5AD4.5050601@manderp.freeserve.co.uk> Message-ID: <20030807145637.GA2554@vailsys.com> On Mon, Aug 04, 2003 at 02:08:36PM +0100, Peter-Henry Mander wrote: > Also, what is involved in making a 'C' node behave like a visible node > instead of a hidden one? Haven't gotten that far yet but the docs (Erl Interface User's Guide) seem to say: 1.7 Using EPMD Epmd is the Erlang Port Mapper Daemon. Distributed Erlang nodes register with epmd on the localhost to indicate to other nodes that they exist and can accept connections. Epmd maintains a register of node and port number information, and when a node wishes to connect to another node, it first contacts epmd in order to find out the correct port number to connect to. When you use erl_connect() to connect to an Erlang node, a connection is first made to epmd and, if the node is known, a connection is then made to the Erlang node. *** C nodes can also register themselves with epmd if they want other nodes in the system to be able to find and connect to them. *** I put ***'s around the pertinent part. Seems to indicate that the node is no longer "hidden", but again I have not yet tested this. I will try get back to you when I have. -Rick From erlang@REDACTED Thu Aug 7 18:54:01 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 07 Aug 2003 17:54:01 +0100 Subject: getting erl_interface C program to reply to net_adm:ping/1 References: <3F2E5AD4.5050601@manderp.freeserve.co.uk> <20030807145637.GA2554@vailsys.com> Message-ID: <3F328429.5070108@manderp.freeserve.co.uk> Hi Rick, I have found that now my C-node replies to net_adm:ping/1 it only appears in the hidden node list. In order to communicate with a C-node, epmd must be running, and any other Erlang-node can send and receive messages to the C-node. So running epmd is not sufficient. The phrase "register themselves with epmd" seems to imply more than simply being pingable. The C function erl_publish is used to "register with the local name server epmd", but even though I do this, the C-node remains hidden, and only appears in the hidden node list after a ping. Should I be using erl_global_register? What Pid should I give to globally register a C-node under a name? What kind of process id can a C-node have? The example in chapter 1.1.10 gives an example: pid = erl_mk_pid(thisnode,14,0,0); erl_global_register(fd,servicename,pid); Apparently the number, serial, and creation values (14,0,0) are arbitrary. I'll try this and give some feedback. Pete. Rick Pettit wrote: > On Mon, Aug 04, 2003 at 02:08:36PM +0100, Peter-Henry Mander wrote: > >>Also, what is involved in making a 'C' node behave like a visible node >>instead of a hidden one? > > > Haven't gotten that far yet but the docs (Erl Interface User's Guide) seem to > say: > > 1.7 Using EPMD > > Epmd is the Erlang Port Mapper Daemon. Distributed Erlang nodes register with > epmd on the localhost to indicate to other nodes that they exist and can accept > connections. Epmd maintains a register of node and port number information, and > when a node wishes to connect to another node, it first contacts epmd in order > to find out the correct port number to connect to. > > When you use erl_connect() to connect to an Erlang node, a connection is first > made to epmd and, if the node is known, a connection is then made to the Erlang > node. > > *** C nodes can also register themselves with epmd if they want other nodes in > the system to be able to find and connect to them. *** > > I put ***'s around the pertinent part. Seems to indicate that the node is no > longer "hidden", but again I have not yet tested this. I will try get back to > you when I have. > > -Rick > > From jeinhorn@REDACTED Thu Aug 7 19:13:11 2003 From: jeinhorn@REDACTED (Jeff Einhorn) Date: 07 Aug 2003 12:13:11 -0500 Subject: Standard OTP build systems. Message-ID: <1060276374.18797.103.camel@dhcp-lom-195-14.futuresource.com> I'm curious to know if there is an ongoing efforts to create standard build system for creating erlang OTP apps. I know we have built our own here and I assume many other erlang/OTP developers have done the same. I think a refined erlang/OTP build system would go a long way to making erlang/OTP slightly easier to create. Some examples of refinements might be as follows. 1) The ability to generate template applications. 2) The ability to generate template releases. 3) The ability to generate template unit tests for an applicaiton/release. 4) Currently we spend a brief amount of time porting third party erlang software into our OTP/Apps and build system. A standard build system might allow third party software to integrate better. thanks for your time, -jeff -- Jeffrey M. Einhorn Platform Systems Design and Integration Manager FutureSource, LLC jeinhorn@REDACTED http://www.futuresource.com From vances@REDACTED Thu Aug 7 19:27:21 2003 From: vances@REDACTED (Vance Shipley) Date: Thu, 7 Aug 2003 13:27:21 -0400 Subject: getting erl_interface C program to reply to net_adm:ping/1 In-Reply-To: <3F328429.5070108@manderp.freeserve.co.uk> References: <3F2E5AD4.5050601@manderp.freeserve.co.uk> <20030807145637.GA2554@vailsys.com> <3F328429.5070108@manderp.freeserve.co.uk> Message-ID: <20030807172721.GB90881@frogman.motivity.ca> Pete, You could in theory have your C-node appear as a fully distributed node but to do so you would have to implement all the functionality of an Erlang runtime system at least as far as distribution goes. That would be a formidable task. erl_interface does not attempt to do this but just lets you communicate with a process written in C. -Vance From ulf.wiger@REDACTED Thu Aug 7 19:37:47 2003 From: ulf.wiger@REDACTED (=?iso-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Thu, 7 Aug 2003 19:37:47 +0200 Subject: Standard OTP build systems. Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6AE@ESEALNT442.al.sw.ericsson.se> One way to go would be to enhance the tool 'builder', which is available at Jungerl. It basically does 1) and 2) in your list below. One of the ideas of builder is that you should be able to grow a system incrementally, adding one application at a time and easily generating a start script for that application (the start script ending up in the application's priv/ directory by default). This could become a standard way of building and testing applications. Feedback is much appreciated. Perhaps it's too much to have all this in one tool. I've found that build and install tools require a truckload of customization options, so several "small" tools may be better. /Uffe -----Original Message----- From: Jeff Einhorn [mailto:jeinhorn@REDACTED] Sent: Thursday, August 07, 2003 19:13 To: erlang-questions@REDACTED Subject: Standard OTP build systems. I'm curious to know if there is an ongoing efforts to create standard build system for creating erlang OTP apps. I know we have built our own here and I assume many other erlang/OTP developers have done the same. I think a refined erlang/OTP build system would go a long way to making erlang/OTP slightly easier to create. Some examples of refinements might be as follows. 1) The ability to generate template applications. 2) The ability to generate template releases. 3) The ability to generate template unit tests for an applicaiton/release. 4) Currently we spend a brief amount of time porting third party erlang software into our OTP/Apps and build system. A standard build system might allow third party software to integrate better. thanks for your time, -jeff -- Jeffrey M. Einhorn Platform Systems Design and Integration Manager FutureSource, LLC jeinhorn@REDACTED http://www.futuresource.com From erlang@REDACTED Thu Aug 7 19:47:31 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 07 Aug 2003 18:47:31 +0100 Subject: getting erl_interface C program to reply to net_adm:ping/1 References: <3F2E5AD4.5050601@manderp.freeserve.co.uk> <20030807145637.GA2554@vailsys.com> <3F328429.5070108@manderp.freeserve.co.uk> <20030807172721.GB90881@frogman.motivity.ca> Message-ID: <3F3290B3.7040503@manderp.freeserve.co.uk> I suspected that much. I initially wanted to fix the ping problem, since that made the "pinger" node hang indefinitely when the "pingee" node was a C-node which received the ping without replying. That's fixed now, thanks for the help everyone. Would there be any use in me uploading the C code to show as an example? Pete. Vance Shipley wrote: > Pete, > > You could in theory have your C-node appear as a fully > distributed node but to do so you would have to implement > all the functionality of an Erlang runtime system at least > as far as distribution goes. That would be a formidable > task. erl_interface does not attempt to do this but just > lets you communicate with a process written in C. > > -Vance > > From rpettit@REDACTED Thu Aug 7 22:38:26 2003 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 7 Aug 2003 13:38:26 -0700 Subject: getting erl_interface C program to reply to net_adm:ping/1 In-Reply-To: <3F3290B3.7040503@manderp.freeserve.co.uk> References: <3F2E5AD4.5050601@manderp.freeserve.co.uk> <20030807145637.GA2554@vailsys.com> <3F328429.5070108@manderp.freeserve.co.uk> <20030807172721.GB90881@frogman.motivity.ca> <3F3290B3.7040503@manderp.freeserve.co.uk> Message-ID: <20030807203826.GC2554@vailsys.com> On Thu, Aug 07, 2003 at 06:47:31PM +0100, Peter-Henry Mander wrote: > I suspected that much. I initially wanted to fix the ping problem, since > that made the "pinger" node hang indefinitely when the "pingee" node was > a C-node which received the ping without replying. That's fixed now, > thanks for the help everyone. > > Would there be any use in me uploading the C code to show as an example? I would be interested in a copy off-list if nobody else shows interest. -Rick From valentin@REDACTED Thu Aug 7 23:12:57 2003 From: valentin@REDACTED (Valentin) Date: Thu, 7 Aug 2003 23:12:57 +0200 Subject: getting erl_interface C program to reply to net_adm:ping/1 References: <3F2E5AD4.5050601@manderp.freeserve.co.uk><20030807145637.GA2554@vailsys.com> <3F328429.5070108@manderp.freeserve.co.uk><20030807172721.GB90881@frogman.motivity.ca> <3F3290B3.7040503@manderp.freeserve.co.uk> Message-ID: <001501c35d28$ae2f0d20$01010d0a@moneymaker> Dear all C-Node can implement a service that can be accessible from distributed erlang nodes... I've attached a sample code (a listener class that illustrates a point -- it cannot be used as it is missing bunch of other libraries, which I'm not free to disclose at this point). 1) C-node has to be initialized (done in constructor) 2) C-node TCP/IP listener is started and registered with EPMD 3) At this stage, new connection requests may be accepted. The connection request will be generated when arbitrary ERTS node attempts to send a message using the following format: {ArbitraryName, CNodeNameAtHostName} ! "The arbitrary Message". 4) Having accepted a connection that came from a particular ERTS, the connection can be used to receive/send messages, (i.e. using int ei_xreceive_msg(int fd, erlang_msg* msg, ei_x_buff* x)) Note: Each ERTS uses a separate connection to communicate with C-Node. I've tested this quite a while ago, and it worked. Valentin. ----- Original Message ----- From: "Peter-Henry Mander" To: "Vance Shipley" Cc: "Rick Pettit" ; Sent: Thursday, August 07, 2003 7:47 PM Subject: Re: getting erl_interface C program to reply to net_adm:ping/1 > I suspected that much. I initially wanted to fix the ping problem, since > that made the "pinger" node hang indefinitely when the "pingee" node was > a C-node which received the ping without replying. That's fixed now, > thanks for the help everyone. > > Would there be any use in me uploading the C code to show as an example? > > Pete. > > Vance Shipley wrote: > > Pete, > > > > You could in theory have your C-node appear as a fully > > distributed node but to do so you would have to implement > > all the functionality of an Erlang runtime system at least > > as far as distribution goes. That would be a formidable > > task. erl_interface does not attempt to do this but just > > lets you communicate with a process written in C. > > > > -Vance > > > > > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: verl_listener.cpp Type: application/octet-stream Size: 2823 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: verl_listener.h Type: application/octet-stream Size: 1364 bytes Desc: not available URL: From vances@REDACTED Fri Aug 8 03:17:50 2003 From: vances@REDACTED (Vance Shipley) Date: Thu, 7 Aug 2003 21:17:50 -0400 Subject: trouble with files bigger than 4GB In-Reply-To: Message-ID: <20030808011750.GG90881@frogman.motivity.ca> Raimo, I'm happy to report that this trick does now work with R9C-0. Setting CC="gcc -m64" does not though. I was able to build R9C-0 under SPARC Solaris 8 with no problems at all. With the addition of this trick it built as a 64-bit application. -Vance On Thu, 24 Apr 2003 Raimo Niskanen wrote: } } Would it be sufficient to have kind of the following shell script (named } gcc) before the real gcc in the path? } } #!/bin/sh } exec /usr/local/bin/gcc -m64 ${1+"$@"} } } / Raimo Niskanen, Erlang/OTP, Ericsso AB From erlang@REDACTED Fri Aug 8 09:03:22 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Fri, 08 Aug 2003 08:03:22 +0100 Subject: Nigerians scams and p0rn spam. Message-ID: <3F334B3A.1060306@manderp.freeserve.co.uk> Hi List Maintainers, Following up on the Spam Question in http://www.erlang.org/ml-archive/erlang-questions/200206/msg00072.html This is the *only* mailing list where the notorious Nigerian scamsters and p0rn pushers have harvested my email address. I'm certain of this because I've allocated a unique address specifically for this list, and that's the one they're using. Is there anything that can be done to purge the online archives of email addresses, or at least render them robot-proof? The Gnu.org mailing lists never gave me this kind of problem. They require subscription and only the names of participants are displayed in the archives, none of the addresses. I know this makes the list less accessible to the browsing public, but the resulting high signal/noise ratio is desirable! I'm currently trying to devise mail client filters to dump most of the spam, but prevention is definitely preferable since I don't want to loose genuine correspondance. Sorry for the rant, but I'm sure I'm not the only one feeling this way. Pete. From vances@REDACTED Fri Aug 8 10:04:29 2003 From: vances@REDACTED (Vance Shipley) Date: Fri, 8 Aug 2003 04:04:29 -0400 Subject: Nigerians scams and p0rn spam. In-Reply-To: <3F334B3A.1060306@manderp.freeserve.co.uk> References: <3F334B3A.1060306@manderp.freeserve.co.uk> Message-ID: <20030808080429.GD91048@frogman.motivity.ca> On Fri, Aug 08, 2003 at 08:03:22AM +0100, Peter-Henry Mander wrote: } } Is there anything that can be done to purge the online archives of email } addresses, or at least render them robot-proof? Funny, I have pretty much the opposite request. I wish the search function for the archives would actually work on From addresses as it purports to. I often want to find something I may have written previously or maybe I remember some good advice provided by Ulf and want to find it. It would be much easier if the search criteria included the sender. Also if I find a post from someone which is right up my alley I may want to contact them directly. Anyone is welcome to contact me, just make sure you have a good Subject line as an absent one or a suspicious one will get deleted along with the Nigerian, Viagra, etc. spam. :) -Vance From erlang@REDACTED Fri Aug 8 10:16:44 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Fri, 08 Aug 2003 09:16:44 +0100 Subject: Nigerians scams and p0rn spam. References: <3F334B3A.1060306@manderp.freeserve.co.uk> <20030808080429.GD91048@frogman.motivity.ca> Message-ID: <3F335C6C.5050101@manderp.freeserve.co.uk> Hi Vance, I expect that most email addresses include a "human" name that can be harmlessly displayed in the archives. Would that meet your requirements? What I wish is the "machine" email address to be removed, not the real name of participants. Real names aren't very useful to spammers. True, I can smell a scam or spam email miles away, but it still bothers me since the solution ought to be quite trivial. Why should we even tolerate spam fodder harvesting when a cure is possible? Pete. Vance Shipley wrote: > On Fri, Aug 08, 2003 at 08:03:22AM +0100, Peter-Henry Mander wrote: > } > } Is there anything that can be done to purge the online archives of email > } addresses, or at least render them robot-proof? > > > Funny, I have pretty much the opposite request. I wish the search > function for the archives would actually work on From addresses as > it purports to. I often want to find something I may have written > previously or maybe I remember some good advice provided by Ulf and > want to find it. It would be much easier if the search criteria > included the sender. Also if I find a post from someone which is > right up my alley I may want to contact them directly. Anyone is > welcome to contact me, just make sure you have a good Subject line > as an absent one or a suspicious one will get deleted along with > the Nigerian, Viagra, etc. spam. :) > > -Vance > > > From kent@REDACTED Fri Aug 8 13:06:56 2003 From: kent@REDACTED (Kent Boortz) Date: 08 Aug 2003 13:06:56 +0200 Subject: Nigerians scams and p0rn spam. In-Reply-To: <3F334B3A.1060306@manderp.freeserve.co.uk> References: <3F334B3A.1060306@manderp.freeserve.co.uk> Message-ID: Peter-Henry Mander writes: > Hi List Maintainers, > > Following up on the Spam Question in > http://www.erlang.org/ml-archive/erlang-questions/200206/msg00072.html > > > This is the *only* mailing list where the notorious Nigerian scamsters > and p0rn pushers have harvested my email address. I'm certain of this > because I've allocated a unique address specifically for this list, > and that's the one they're using. > > Is there anything that can be done to purge the online archives of > email addresses, or at least render them robot-proof? > > The Gnu.org mailing lists never gave me this kind of problem. They > require subscription and only the names of participants are displayed > in the archives, none of the addresses. I know this makes the list > less accessible to the browsing public, but the resulting high > signal/noise ratio is desirable! I'm currently trying to devise mail > client filters to dump most of the spam, but prevention is definitely > preferable since I don't want to loose genuine correspondance. > > Sorry for the rant, but I'm sure I'm not the only one feeling this way. > It is no problem for us to change this if the members on this list can agree that the email addresses should be removed or how they should be changed not to be visible to the robots that collect them, kent From jilani.khaldi@REDACTED Fri Aug 8 13:18:34 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Fri, 08 Aug 2003 13:18:34 +0200 Subject: Installing erl -man Message-ID: Hi All, I just have installed OTP_R9C on a Linux box and I want to intstall the utility erl -man . So I have untarred otp_man_R9C-0.tar.gz and now I have: /usr/local/lib/erlang/lib/man| man1 | man3 | man4 | man6 Now doing for example: erl -man io I get: No manual entry for io What I am missing? Thanks! jilani ps. Why man2 and man5 don't exist? From erlang@REDACTED Fri Aug 8 13:37:59 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Fri, 08 Aug 2003 12:37:59 +0100 Subject: Nigerians scams and p0rn spam. References: <3F334B3A.1060306@manderp.freeserve.co.uk> Message-ID: <3F338B97.1090708@manderp.freeserve.co.uk> Thanks Kent, If it can be done, I would be much obliged. Pete. Kent Boortz wrote: > Peter-Henry Mander writes: > >>Hi List Maintainers, >> >>Following up on the Spam Question in >>http://www.erlang.org/ml-archive/erlang-questions/200206/msg00072.html >> >> -----8<----- snip -----8<----- >> > > It is no problem for us to change this if the members on this list can > agree that the email addresses should be removed or how they should be > changed not to be visible to the robots that collect them, > > kent From HEINRICH.VENTER@REDACTED Fri Aug 8 15:12:25 2003 From: HEINRICH.VENTER@REDACTED (HEINRICH VENTER) Date: Fri, 08 Aug 2003 15:12:25 +0200 Subject: Erlang doesnt want to quit Message-ID: Hi I am having a very strange problem (OTP 8). I start an erlang node with a boot script. It executes an application and everything is fine. When I want to quit the appliction I type q(). at the shell command prompt. I get the response ok and the shell and application just continues executing. Any ideas what could cause this?? -]-[einrich ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From kent@REDACTED Fri Aug 8 15:29:13 2003 From: kent@REDACTED (Kent Boortz) Date: 08 Aug 2003 15:29:13 +0200 Subject: Installing erl -man In-Reply-To: References: Message-ID: Jilani Khaldi writes: > I just have installed OTP_R9C on a Linux box and I want to intstall > the utility erl -man . > So I have untarred otp_man_R9C-0.tar.gz and now I have: > /usr/local/lib/erlang/lib/man| man1 > | man3 > | man4 > | man6 > > Now doing for example: erl -man io > > I get: > No manual entry for io > > What I am missing? Probably the windex file. You can rerun the Install script or run the script it will call to format the manual pages % cd /usr/local/lib/erlang/lib/ % ./misc/format_man_pages `pwd` > Why man2 and man5 don't exist? man2 is system calls, I don't think we should define any ;-) man5 is file formats, I don't know if we have separate manual pages for any file formats in Erlang/OTP, kent From kulkam@REDACTED Fri Aug 8 15:31:39 2003 From: kulkam@REDACTED (Mayuresh Kulkarni) Date: Fri, 8 Aug 2003 09:31:39 -0400 (EDT) Subject: Installing erl -man In-Reply-To: References: Message-ID: <20030808092820.Q13630@gettysburg.cs.rpi.edu> jilani, i dont have installation privileges where i work and the same thing happens to the default erlang installation here. what i do is use man -M or set the MANPATH variable (in which case the -M option to man is not needed) -- ---------------------------------------------------- mayuresh k. do you know that we are ruled by TV? ---------------------------------------------------- On Fri, 8 Aug 2003, Jilani Khaldi wrote: > Hi All, > > I just have installed OTP_R9C on a Linux box and I want to intstall the > utility erl -man . > So I have untarred otp_man_R9C-0.tar.gz and now I have: > /usr/local/lib/erlang/lib/man| man1 > | man3 > | man4 > | man6 > > Now doing for example: erl -man io > > I get: > No manual entry for io > > What I am missing? > > Thanks! > > jilani > > ps. > Why man2 and man5 don't exist? > > > From per@REDACTED Fri Aug 8 16:10:06 2003 From: per@REDACTED (Per Hedeland) Date: Fri, 8 Aug 2003 16:10:06 +0200 (CEST) Subject: Installing erl -man In-Reply-To: Message-ID: <200308081410.h78EA6iS059980@tordmule.bluetail.com> Kent Boortz wrote: > >Jilani Khaldi writes: >> I just have installed OTP_R9C on a Linux box and I want to intstall >> the utility erl -man . >> So I have untarred otp_man_R9C-0.tar.gz and now I have: >> /usr/local/lib/erlang/lib/man| man1 >> | man3 >> | man4 >> | man6 >> >> Now doing for example: erl -man io >> >> I get: >> No manual entry for io >> >> What I am missing? > >Probably the windex file. Hm, I thought the fix was mv /usr/local/lib/erlang/lib/man /usr/local/lib/erlang - i.e. the "man" directory should be directly under the toplevel install directory, not under toplevel/lib. At least that's the way the FreeBSD port installs:-), I can't seem to find any instruction as to where you are supposed to unpack the man tarball... --Per From erik.pearson@REDACTED Fri Aug 8 22:28:55 2003 From: erik.pearson@REDACTED (Erik J Pearson) Date: 08 Aug 2003 13:28:55 -0700 Subject: Win DLL for ssl:start() Message-ID: <1060374535.8280.4.camel@12-235-188-90.client.attbi.com> Does anyone know any info about the DLL used to build the R9C0 win binary otp_win32_R9C-0.exe? I installed it last night, but ssl:start(). failed because it couldn't find the correct DLL. (I don't have the name on me right now unfortunately.) Is this DLL freely available? Thanks in advance for any info. --erikp-- From kent@REDACTED Sat Aug 9 04:08:00 2003 From: kent@REDACTED (Kent Boortz) Date: 09 Aug 2003 04:08:00 +0200 Subject: Win DLL for ssl:start() In-Reply-To: <1060374535.8280.4.camel@12-235-188-90.client.attbi.com> References: <1060374535.8280.4.camel@12-235-188-90.client.attbi.com> Message-ID: Erik J Pearson writes: > Does anyone know any info about the DLL used to build > the R9C0 win binary otp_win32_R9C-0.exe? > > I installed it last night, but ssl:start(). failed because > it couldn't find the correct DLL. (I don't have the name > on me right now unfortunately.) > > Is this DLL freely available? I think the relevant section from the source distribution README.win32 is * OpenSSL for Windows. This is if you want the SSL and crypto applications to compile (and run). Go to http://www.openssl.org, click on the "Related" link and then on the "Binaries" link (upper right corner of the page last time I looked), you can then reach the "Shining Lights Productions" Web site for Windows binaries distributions. Get the latest or 0.9.7b if you get trouble with the latest. It's a nifty installer. The rest should be handled by configure, you needn't put anything in the path or anything. In the manual for the Erlang/OTP ssl application you can read For Win32 it is only required that the libraries can be found from the PATH environment variable, or that they reside in the appropriate SYSTEM32 directory; hence no particular relinking is need. Hence no example Makefile for Win32 is provided. kent From dsolaz@REDACTED Sat Aug 9 11:56:31 2003 From: dsolaz@REDACTED (Daniel Solaz) Date: Sat, 9 Aug 2003 11:56:31 +0200 Subject: Nigerians scams and p0rn spam. In-Reply-To: References: <3F334B3A.1060306@manderp.freeserve.co.uk> Message-ID: <200308091156.31274.dsolaz@sistelcom.com> I had noticed this. I also used to have an erlang-specific mail address, one that had an SMTP server filtering rule that resulted in mail being rejected an the SMTP server level with a 550 code. The same effect can be achieved at the POP3 client level, but then you keep downloading mail just to have it deleted immediately, which, besides not solving the problem at all, is not desirable if you connect via modem. On Friday 08 August 2003 13:06, Kent Boortz wrote: > the email addresses should be removed, OR > they should be changed not to be visible to the robots that collect them I'd rather have them removed, but someone might care about a non-subscriber wanting to contact a subscriber directly for non-spam reasons. -Daniel From Marc.Vanwoerkom@REDACTED Sat Aug 9 15:29:01 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Sat, 9 Aug 2003 15:29:01 +0200 (MEST) Subject: Nigerians scams and p0rn spam. In-Reply-To: (message from Kent Boortz on 08 Aug 2003 13:06:56 +0200) Message-ID: <200308091329.h79DT1821080@bonsai.fernuni-hagen.de> > It is no problem for us to change this if the members on this list can > agree that the email addresses should be removed or how they should be > changed not to be visible to the robots that collect them, The quick fix is to remove the email adresses from the web version of the mailing list archive. On the other it is useful to have the adresses of the participants to ask them questions that are not interesting to all subscribers. One solution would be to add a login to the web interface. A guest could browse the mailing list archive but would not get the email addresses until he subscribes to the list and is provided a login password. With login one could access a web version of the ML with full information disclosed. This would work until the spammers subscribe to the list, which hopefully would make them subject to removal by the list admin. Regards, Marc From thomas.arts@REDACTED Sat Aug 9 18:05:23 2003 From: thomas.arts@REDACTED (Thomas Arts) Date: Sat, 9 Aug 2003 18:05:23 +0200 Subject: yaws plug-ins Message-ID: <000d01c35e90$412f3420$6400a8c0@ituniv398> Please find attached a calendar plug-in for yaws. Install the compiled Erlang file in a directory where the yaws server searches for code and try the calendar.yaws page. Nifty calendar in the right hand corner in which you can select a date. This is an experiment after having seen the wonderful web-objects concept. Just thinking that separating layout and functionality should be doable with a yaws server as well... Not trivial, though, since the HTML style concept is hard to computer scientist that take certain scoping rules for granted. Anyone interested in setting up a plug-in archive for yaws? /Thomas --- Dr Thomas Arts Program Manager Software Engineering and Management IT-university in Gothenburg Box 8718, 402 75 Gothenburg, Sweden http://www.ituniv.se/ Tel +46 31 772 6031 Fax +46 31 772 4899 -------------- next part -------------- A non-text attachment was scrubbed... Name: calendar.yaws Type: application/octet-stream Size: 862 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: html_calendar.erl Type: application/octet-stream Size: 10110 bytes Desc: not available URL: From kent@REDACTED Sat Aug 9 19:13:27 2003 From: kent@REDACTED (Kent Boortz) Date: 09 Aug 2003 19:13:27 +0200 Subject: Nigerians scams and p0rn spam. In-Reply-To: <200308091329.h79DT1821080@bonsai.fernuni-hagen.de> References: <200308091329.h79DT1821080@bonsai.fernuni-hagen.de> Message-ID: Marc Ernst Eddy van Woerkom writes: > > It is no problem for us to change this if the members on this list can > > agree that the email addresses should be removed or how they should be > > changed not to be visible to the robots that collect them, > > The quick fix is to remove the email adresses from the web version > of the mailing list archive. I did change the old HTML pages and configured the mail2html program to hide the names but it was just brought to my attention that www.erlang.org is not the only place where the erlang-question list is viewable from a web server. The mailing list is sent out to gmane.org as well (I don't think we at Ericsson added this, it is just an email address on the list). This means that the mails goes unaltered to gmane.org and can be viewable there with email addresses http://news.gmane.org/thread.php?group=gmane.comp.lang.erlang.bugs http://news.gmane.org/thread.php?group=gmane.comp.lang.erlang.general http://news.gmane.org/thread.php?group=gmane.comp.lang.erlang.patches So if we really want to hide the addresses we have to filter the mails sent to gmane.org and maybe other places as well. I have undone my changes to the HTML archive and mail2html program, we have to come up with a solution, if any, that really works, kent From vances@REDACTED Sat Aug 9 19:37:39 2003 From: vances@REDACTED (Vance Shipley) Date: Sat, 9 Aug 2003 13:37:39 -0400 Subject: Nigerians scams and p0rn spam. In-Reply-To: References: <200308091329.h79DT1821080@bonsai.fernuni-hagen.de> Message-ID: <20030809173739.GE8691@frogman.motivity.ca> IMHO there is no solution at this level. If you "post" to a public forum you are out there for all to see. There is nothing stopping anyone from gatewaying this list to a news group, other mailing list, web log, etc. If you're paranoid you can post without a valid return address. -Vance From vances@REDACTED Sun Aug 10 22:11:04 2003 From: vances@REDACTED (Vance Shipley) Date: Sun, 10 Aug 2003 16:11:04 -0400 Subject: driver_entry.init return ignored Message-ID: <20030810201104.GE21947@frogman.motivity.ca> I noticed today that when I load a driver which fails to initialize properly erl_ddll keeps it around and doesn't return an error. The documented behaviour is for driver_entry.init() to return 0 on success and -1 on error. I would have expected something to happen on error. -Vance From ulf.wiger@REDACTED Mon Aug 11 15:10:49 2003 From: ulf.wiger@REDACTED (=?iso-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Mon, 11 Aug 2003 15:10:49 +0200 Subject: what system limit? Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6B0@ESEALNT442.al.sw.ericsson.se> See the output below. I am trying to create a database using mnesia. After a while, I get a complaint that an ets table cannot be created because of some system limit. Which one would that be? I've verified using a small background loop that the number of ets tables is < 40. This happens in both R9B and R9C. /Uffe Erlang (BEAM) emulator version 5.2.3.1 [hipe] [threads:0] Eshell V5.2.3.1 (abort with ^G) 1> [...] =PROGRESS REPORT==== 11-Aug-2003::13:56:29 === application: sasl started_at: cath@REDACTED spawn(fun() -> L = fun(L1) -> io:format("tables: ~p~n", [length(ets:all())]),timer:sleep(1000),L1(L1) end, L(L) end). tables: 12 <0.45.0> tables: 12 tables: 12 tables: 12 tables: 12 tables: 12 [...] =PROGRESS REPORT==== 11-Aug-2003::13:58:16 === application: mnesia started_at: cath@REDACTED tables: 34 [...] =ERROR REPORT==== 11-Aug-2003::13:58:17 === Mnesia(cath@REDACTED): ** ERROR ** (core dumped to file: "/home/etxuwig/work/erlang/open_source/contribs/mine/not_ready/cath-0.8/MnesiaCore.cath@REDACTED") ** FATAL ** {system_limit,"Cannot create ets table", rule, [{keypos,2},public,named_table,set], {badarg,[{ets, new, [rule, [{keypos,2},public,named_table,set]]}, {mnesia_monitor,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]}} tables: 46 tables: 46 tables: 46 tables: 46 From andre_khromov@REDACTED Mon Aug 11 13:25:47 2003 From: andre_khromov@REDACTED (Andre Khromov) Date: Mon, 11 Aug 2003 07:25:47 -0400 Subject: Werl crashing on IBM ThinkPad T40p Message-ID: I tried to install every version of Erlang from 7B2 to 9C0, and all of them crashed when I doubled clicked Werl.exe. I even uninstalled every Windows update to get WinXP to Service Pack 1 clean. I did notice that when when I removed the start.boot, it wouldn't crash. But it just ended in an aborted termination (but the window emulator at least remained). I am keeping my fingers crossed that someone has had a similar experience. Please help, Andre Khromov _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail From dgud@REDACTED Mon Aug 11 16:03:53 2003 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 11 Aug 2003 16:03:53 +0200 Subject: what system limit? In-Reply-To: <76E5F712842F5F49A35738622BAA0F4F9EA6B0@ESEALNT442.al.sw.ericsson.se> References: <76E5F712842F5F49A35738622BAA0F4F9EA6B0@ESEALNT442.al.sw.ericsson.se> Message-ID: <16183.41545.708417.495958@rian.du.uab.ericsson.se> Nice failure message isn't it :-) You're probably creating a table with the same name as an already existing ets table. I.e. the system is limited to one ets table with the name 'rule' :-) /Dan PS: You should have got a {aborted, ...} instead of FATAL in R9C! Ulf Wiger (?L2/EAB) writes: > > See the output below. I am trying to create a database using mnesia. > After a while, I get a complaint that an ets table cannot be created because > of some system limit. Which one would that be? I've verified using a small > background loop that the number of ets tables is < 40. > > This happens in both R9B and R9C. > > /Uffe > > > Erlang (BEAM) emulator version 5.2.3.1 [hipe] [threads:0] > > Eshell V5.2.3.1 (abort with ^G) > 1> > [...] > =PROGRESS REPORT==== 11-Aug-2003::13:56:29 === > application: sasl > started_at: cath@REDACTED > spawn(fun() -> L = fun(L1) -> io:format("tables: ~p~n", [length(ets:all())]),timer:sleep(1000),L1(L1) end, L(L) end). > tables: 12 > <0.45.0> > tables: 12 > tables: 12 > tables: 12 > tables: 12 > tables: 12 > > [...] > > =PROGRESS REPORT==== 11-Aug-2003::13:58:16 === > application: mnesia > started_at: cath@REDACTED > tables: 34 > > [...] > > =ERROR REPORT==== 11-Aug-2003::13:58:17 === > Mnesia(cath@REDACTED): ** ERROR ** (core dumped to file: "/home/etxuwig/work/erlang/open_source/contribs/mine/not_ready/cath-0.8/MnesiaCore.cath@REDACTED") > > ** FATAL ** {system_limit,"Cannot create ets table", > rule, > [{keypos,2},public,named_table,set], > {badarg,[{ets, > new, > [rule, > [{keypos,2},public,named_table,set]]}, > {mnesia_monitor,handle_call,3}, > {gen_server,handle_msg,6}, > {proc_lib,init_p,5}]}} > tables: 46 > tables: 46 > tables: 46 > tables: 46 -- Dan Gudmundsson Project: Mnesia, Erlang/OTP Ericsson Utvecklings AB Phone: +46 8 727 5762 UAB/F/P Mobile: +46 70 519 9469 S-125 25 Stockholm Visit addr: Armborstv 1 From vlad_dumitrescu@REDACTED Mon Aug 11 19:33:39 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 11 Aug 2003 19:33:39 +0200 Subject: Werl crashing on IBM ThinkPad T40p References: Message-ID: Hi, I never had such problems, but if you could post some more details it would be easier. Can it be something like spaces in the installation path? Just a wild guess... regards, Vlad ----- Original Message ----- From: "Andre Khromov" To: Sent: Monday, August 11, 2003 1:25 PM Subject: Werl crashing on IBM ThinkPad T40p > I tried to install every version of Erlang from 7B2 to 9C0, and all of them > crashed when I doubled clicked Werl.exe. I even uninstalled every Windows > update to get WinXP to Service Pack 1 clean. > > I did notice that when when I removed the start.boot, it wouldn't crash. But > it just ended in an aborted termination (but the window emulator at least > remained). > > I am keeping my fingers crossed that someone has had a similar experience. > > Please help, > > Andre Khromov > > _________________________________________________________________ > STOP MORE SPAM with the new MSN 8 and get 2 months FREE* > http://join.msn.com/?page=features/junkmail > > From Marc.Vanwoerkom@REDACTED Tue Aug 12 04:32:13 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Tue, 12 Aug 2003 04:32:13 +0200 (MEST) Subject: Distribution with Mnesia Message-ID: <200308120232.h7C2WDU21649@bonsai.fernuni-hagen.de> The features of Mnesia, as described in the docs, are remarkable. But what exactly is its useful grade of distribution? Is it just usuable for a well defined group (not changing too much in time) of nodes that are kind of close together (e.g. in the same corporate LAN or WAN? The other extreme would be a kind of P2P setting, with lots nodes that join and leave the net in an unpredictable fashion. Or not so extme: Would it allow connecting let's say 10 servers via the internet? Would inter node metadata flow be possible over encrypted channels? Regards, Marc From vances@REDACTED Tue Aug 12 05:58:30 2003 From: vances@REDACTED (Vance Shipley) Date: Mon, 11 Aug 2003 23:58:30 -0400 Subject: Distribution with Mnesia In-Reply-To: <200308120232.h7C2WDU21649@bonsai.fernuni-hagen.de> References: <200308120232.h7C2WDU21649@bonsai.fernuni-hagen.de> Message-ID: <20030812035830.GD28510@frogman.motivity.ca> Marc, http://www.erlang.org/doc/r9c/lib/ssl-3.0.1/doc/html/usersguide_frame.html "In the SSL application there is an additional distribution module, inet_ssl_dist which can be used as an alternative. All distribution connections will be using SSL and all participating Erlang nodes in a distributed system must use this distribution module." -Vance On Tue, Aug 12, 2003 at 04:32:13AM +0200, Marc Ernst Eddy van Woerkom wrote: } } Would inter node metadata flow be possible over } encrypted channels? } } Regards, } Marc From jilani.khaldi@REDACTED Mon Aug 11 23:21:30 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Mon, 11 Aug 2003 23:21:30 +0200 Subject: string:left (bug ?!) Message-ID: Hello All, try this: string:left("hello", $' '). The shell editor goes infinitely in input mode. I have to press CTRL-C to get back. Is this a bug result or something I ignore? Thanks. ps. Slackware Linux 9.0 jilani From richardc@REDACTED Tue Aug 12 08:28:01 2003 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 12 Aug 2003 08:28:01 +0200 (MET DST) Subject: string:left (bug ?!) In-Reply-To: References: Message-ID: On Mon, 11 Aug 2003, Jilani Khaldi wrote: > string:left("hello", $' '). > > The shell editor goes infinitely in input mode. I have to press CTRL-C > to get back. Is this a bug result or something I ignore? ...(..., $' '). ^^ yields the character code for ' ...(..., $' '). ^ starts a quoted atom, like 'foo' so to end the atom you must type another ' character. Then you will get the control back. To get the character code for SPACE, you can write $\s or $\040. TAB is $\t or $\011, and so on. For example: string:left(String, FieldWidth, $\s). /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From jonas.aman@REDACTED Tue Aug 12 08:47:01 2003 From: jonas.aman@REDACTED (=?iso-8859-15?Q?Jonas_=C5man?=) Date: Tue, 12 Aug 2003 08:47:01 +0200 Subject: SV: string:left (bug ?!) In-Reply-To: Message-ID: Hello. When using string:left with only two arguments, the second argument should be an integer. Since the data type character is integers, the function call string:left(string(), char()) should normally return a new string, however wrong it may be. But "$' '" is not a valid character, which is the reason that it does not work. The shell is waiting for another "'" to terminate the atom started by the second "'" in "$' '". If you want to pad your string with blanks, you should do like this: string:left(String, Number) or string:left(String, Number, Character). Used on the above string, padding it with spaces, therefor looks like this: string:left("hello", 10) or string:left("hello", 10, $ ). /Jonas -----Ursprungligt meddelande----- Fr?n: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]F?r Jilani Khaldi Skickat: den 11 augusti 2003 23:22 Till: erlang-questions@REDACTED ?mne: string:left (bug ?!) Hello All, try this: string:left("hello", $' '). The shell editor goes infinitely in input mode. I have to press CTRL-C to get back. Is this a bug result or something I ignore? Thanks. ps. Slackware Linux 9.0 jilani From ulf.wiger@REDACTED Tue Aug 12 09:52:25 2003 From: ulf.wiger@REDACTED (=?ISO-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Tue, 12 Aug 2003 09:52:25 +0200 Subject: Distribution with Mnesia Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6B5@ESEALNT442.al.sw.ericsson.se> Marc, If you want to have a very dynamic network of mnesia nodes, I suggest you configure a few nodes to hold a disk copy of the schema, and manage them with care. Then, you can connect other nodes using the mnesia 'extra_db_nodes' feature. These nodes will be "diskless" from mnesia's perspective, and may come and go at will... almost. If a diskless node loses contact with one of the master nodes, it should unconditionally restart (mnesia, at least). Running distributed erlang over SSL is probably a good idea. /Uffe -----Original Message----- From: Marc Ernst Eddy van Woerkom [mailto:Marc.Vanwoerkom@REDACTED] Sent: Tuesday, August 12, 2003 04:32 To: erlang-questions@REDACTED Subject: Distribution with Mnesia The features of Mnesia, as described in the docs, are remarkable. But what exactly is its useful grade of distribution? Is it just usuable for a well defined group (not changing too much in time) of nodes that are kind of close together (e.g. in the same corporate LAN or WAN? The other extreme would be a kind of P2P setting, with lots nodes that join and leave the net in an unpredictable fashion. Or not so extme: Would it allow connecting let's say 10 servers via the internet? Would inter node metadata flow be possible over encrypted channels? Regards, Marc From per@REDACTED Tue Aug 12 10:55:35 2003 From: per@REDACTED (Per Bergqvist) Date: Tue, 12 Aug 2003 11:55:35 +0300 Subject: Distribution with Mnesia In-Reply-To: <200308120232.h7C2WDU21649@bonsai.fernuni-hagen.de> Message-ID: <200308120955.h7C9tZl28653@tessla.levonline.com> > > But what exactly is its useful grade of distribution? > > Is it just usuable for a well defined group (not changing too > much in time) of nodes that are kind of close together (e.g. > in the same corporate LAN or WAN? > IMHO it is even closer, a dedicated non-shared LAN (i.e. a System Area Network). > /Per From serge@REDACTED Tue Aug 12 12:50:45 2003 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 12 Aug 2003 06:50:45 -0400 Subject: Distribution with Mnesia References: <76E5F712842F5F49A35738622BAA0F4F9EA6B5@ESEALNT442.al.sw.ericsson.se> Message-ID: <3F38C685.7070209@hq.idt.net> Ulf, I wonder in case of your suggested use of the msesia's distribution what's the penalty of a restart of an "extra" node? Apparently, the first thing such a node would do is call wait_for_table(). In my small experiments a call to this function on a mnesia node containing a disk image of a 15M table took a couple of minutes to complete (which seemed conciderably long, as I would think that the disk image uses binary format and involves no parsing). If both primary and "extra" nodes reside in the same LAN, is the wait_for_table() call on the "extra" diskless distributed node is as slow (or even slower due to LAN speed vs. disk speed) than calling it on the primary node? Serge Ulf Wiger (?L2/EAB) wrote: > Marc, > > If you want to have a very dynamic network of mnesia nodes, > I suggest you configure a few nodes to hold a disk copy of > the schema, and manage them with care. Then, you can connect > other nodes using the mnesia 'extra_db_nodes' feature. > These nodes will be "diskless" from mnesia's perspective, > and may come and go at will... almost. If a diskless node > loses contact with one of the master nodes, it should > unconditionally restart (mnesia, at least). > > Running distributed erlang over SSL is probably a good idea. > > /Uffe > > -----Original Message----- > From: Marc Ernst Eddy van Woerkom > [mailto:Marc.Vanwoerkom@REDACTED] > Sent: Tuesday, August 12, 2003 04:32 > To: erlang-questions@REDACTED > Subject: Distribution with Mnesia > > > The features of Mnesia, as described in the docs, are remarkable. > > But what exactly is its useful grade of distribution? > > Is it just usuable for a well defined group (not changing too > much in time) of nodes that are kind of close together (e.g. > in the same corporate LAN or WAN? > > The other extreme would be a kind of P2P setting, > with lots nodes that join and leave the net in an > unpredictable fashion. > > Or not so extme: > > Would it allow connecting let's say 10 servers > via the internet? > Would inter node metadata flow be possible over > encrypted channels? > > Regards, > Marc > > > From ulf.wiger@REDACTED Tue Aug 12 12:56:16 2003 From: ulf.wiger@REDACTED (=?ISO-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Tue, 12 Aug 2003 12:56:16 +0200 Subject: Distribution with Mnesia Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6B7@ESEALNT442.al.sw.ericsson.se> You would only call wait_for_table() for tables that need a replica on the diskless node. Otherwise, all that is needed is that the schema is replicated from a master node. Since mnesia offers distribution transparency, all data will still be accessible on each diskless node. If you have lots of diskless nodes, you will probably not want to replicate all data to all nodes, since it will make table updates much slower. /Uffe -----Original Message----- From: Serge Aleynikov [mailto:serge@REDACTED] Sent: Tuesday, August 12, 2003 12:51 To: Ulf Wiger (?L2/EAB) Cc: 'Marc Ernst Eddy van Woerkom'; erlang-questions@REDACTED Subject: Re: Distribution with Mnesia Ulf, I wonder in case of your suggested use of the msesia's distribution what's the penalty of a restart of an "extra" node? Apparently, the first thing such a node would do is call wait_for_table(). In my small experiments a call to this function on a mnesia node containing a disk image of a 15M table took a couple of minutes to complete (which seemed conciderably long, as I would think that the disk image uses binary format and involves no parsing). If both primary and "extra" nodes reside in the same LAN, is the wait_for_table() call on the "extra" diskless distributed node is as slow (or even slower due to LAN speed vs. disk speed) than calling it on the primary node? Serge Ulf Wiger (?L2/EAB) wrote: > Marc, > > If you want to have a very dynamic network of mnesia nodes, > I suggest you configure a few nodes to hold a disk copy of > the schema, and manage them with care. Then, you can connect > other nodes using the mnesia 'extra_db_nodes' feature. > These nodes will be "diskless" from mnesia's perspective, > and may come and go at will... almost. If a diskless node > loses contact with one of the master nodes, it should > unconditionally restart (mnesia, at least). > > Running distributed erlang over SSL is probably a good idea. > > /Uffe > > -----Original Message----- > From: Marc Ernst Eddy van Woerkom > [mailto:Marc.Vanwoerkom@REDACTED] > Sent: Tuesday, August 12, 2003 04:32 > To: erlang-questions@REDACTED > Subject: Distribution with Mnesia > > > The features of Mnesia, as described in the docs, are remarkable. > > But what exactly is its useful grade of distribution? > > Is it just usuable for a well defined group (not changing too > much in time) of nodes that are kind of close together (e.g. > in the same corporate LAN or WAN? > > The other extreme would be a kind of P2P setting, > with lots nodes that join and leave the net in an > unpredictable fashion. > > Or not so extme: > > Would it allow connecting let's say 10 servers > via the internet? > Would inter node metadata flow be possible over > encrypted channels? > > Regards, > Marc > > > From jilani.khaldi@REDACTED Tue Aug 12 16:36:43 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Tue, 12 Aug 2003 16:36:43 +0200 Subject: Summing a number to the terms of a list Message-ID: Hi All, Why this code gives me these different results? -module(sumit). -export([sum_me/2]). sum_me(H|T,X) -> [(H+X)|sum_me(T,X)]; sum_me([], X) -> []. Results: A=[1,2,3]. sumit:sum_me(A,100). "efg" sumit:sum_me(A,200). "\311\312\313" sumit:sum_me(A,300). [301,302,303] -- as I expected. jilani From ulf.wiger@REDACTED Tue Aug 12 16:58:08 2003 From: ulf.wiger@REDACTED (=?ISO-8859-15?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Tue, 12 Aug 2003 16:58:08 +0200 Subject: Summing a number to the terms of a list Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6B9@ESEALNT442.al.sw.ericsson.se> The shell guesses that the first two results are strings, as they are lists of numbers in the ASCII range. The third list contains numbers greater than 255, and is thus not formatted as a string. This is a consequence of the fact that erlang lacks a string data type. It's only a presentation issue. Try e.g. io:format("~w~n", [sumit:sum_me(A,100)]). /Uffe -----Original Message----- From: Jilani Khaldi [mailto:jilani.khaldi@REDACTED] Sent: Tuesday, August 12, 2003 16:37 To: erlang-questions@REDACTED Subject: Summing a number to the terms of a list Hi All, Why this code gives me these different results? -module(sumit). -export([sum_me/2]). sum_me(H|T,X) -> [(H+X)|sum_me(T,X)]; sum_me([], X) -> []. Results: A=[1,2,3]. sumit:sum_me(A,100). "efg" sumit:sum_me(A,200). "\311\312\313" sumit:sum_me(A,300). [301,302,303] -- as I expected. jilani From vances@REDACTED Tue Aug 12 17:03:12 2003 From: vances@REDACTED (Vance Shipley) Date: Tue, 12 Aug 2003 11:03:12 -0400 Subject: Summing a number to the terms of a list In-Reply-To: References: Message-ID: <20030812150312.GN28510@frogman.motivity.ca> Jilani, They're not really different they're just displayed diofferent. >From the wonderful new Erlang Reference Manual: 2.11 String Strings are enclosed in double quotes ("), but is not a data type in Erlang. Instead a string "hello" is shorthand for the list [$h,$e,$l,$l,$o], that is [104,101,108,108,111]. -Vance On Tue, Aug 12, 2003 at 04:36:43PM +0200, Jilani Khaldi wrote: } Hi All, } } Why this code gives me these different results? } } -module(sumit). } -export([sum_me/2]). } } sum_me(H|T,X) -> [(H+X)|sum_me(T,X)]; } sum_me([], X) -> []. } } Results: } } A=[1,2,3]. } sumit:sum_me(A,100). } "efg" } } sumit:sum_me(A,200). } "\311\312\313" } } sumit:sum_me(A,300). } [301,302,303] -- as I expected. } } jilani } From mikael.karlsson@REDACTED Tue Aug 12 17:23:27 2003 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Tue, 12 Aug 2003 17:23:27 +0200 Subject: Summing a number to the terms of a list In-Reply-To: References: Message-ID: <200308121723.27032.mikael.karlsson@creado.com> I think that the output formatter assumes that your list is a string as long as the characters have a value less than 255. You can get the same format by using explicit formatting io:format... I do not get the same output result for A,200 in my shell though: 16> lists:map(fun(A) -> 100+A end,[1,2,3]). "efg" 17> lists:map(fun(A) -> 200+A end,[1,2,3]). "???" 18> lists:map(fun(A) -> 300+A end,[1,2,3]). [301,302,303] 19> io:format("~w",[lists:map(fun(A) -> 100+A end,[1,2,3])]). [101,102,103]ok 20> io:format("~w",[lists:map(fun(A) -> 200+A end,[1,2,3])]). [201,202,203]ok 21> io:format("~w",[lists:map(fun(A) -> 300+A end,[1,2,3])]). [301,302,303]ok /Mikael tisdag 12 augusti 2003 16:36 skrev Jilani Khaldi: > Hi All, > > Why this code gives me these different results? > > -module(sumit). > -export([sum_me/2]). > > sum_me(H|T,X) -> [(H+X)|sum_me(T,X)]; > sum_me([], X) -> []. > > Results: > > A=[1,2,3]. > sumit:sum_me(A,100). > "efg" > > sumit:sum_me(A,200). > "\311\312\313" > > sumit:sum_me(A,300). > [301,302,303] -- as I expected. > > jilani From mlogan@REDACTED Tue Aug 12 18:59:35 2003 From: mlogan@REDACTED (Martin J. Logan) Date: 12 Aug 2003 11:59:35 -0500 Subject: Distribution with Mnesia In-Reply-To: <76E5F712842F5F49A35738622BAA0F4F9EA6B5@ESEALNT442.al.sw.ericsson.se> References: <76E5F712842F5F49A35738622BAA0F4F9EA6B5@ESEALNT442.al.sw.ericsson.se> Message-ID: <1060707574.1256.221.camel@dhcp-lom-194-186.futuresource.com> I have a behaviour that manages this. I wrote it two years ago and have used it numerous times in production. The behaviour will let you self seed if there are no other db nodes in you cluster. If there are other db nodes present then it will automatically replicate with them. The file is attached. Martin On Tue, 2003-08-12 at 02:52, Ulf Wiger (?L2/EAB) wrote: > Marc, > > If you want to have a very dynamic network of mnesia nodes, > I suggest you configure a few nodes to hold a disk copy of > the schema, and manage them with care. Then, you can connect > other nodes using the mnesia 'extra_db_nodes' feature. > These nodes will be "diskless" from mnesia's perspective, > and may come and go at will... almost. If a diskless node > loses contact with one of the master nodes, it should > unconditionally restart (mnesia, at least). > > Running distributed erlang over SSL is probably a good idea. > > /Uffe > > -----Original Message----- > From: Marc Ernst Eddy van Woerkom > [mailto:Marc.Vanwoerkom@REDACTED] > Sent: Tuesday, August 12, 2003 04:32 > To: erlang-questions@REDACTED > Subject: Distribution with Mnesia > > > The features of Mnesia, as described in the docs, are remarkable. > > But what exactly is its useful grade of distribution? > > Is it just usuable for a well defined group (not changing too > much in time) of nodes that are kind of close together (e.g. > in the same corporate LAN or WAN? > > The other extreme would be a kind of P2P setting, > with lots nodes that join and leave the net in an > unpredictable fashion. > > Or not so extme: > > Would it allow connecting let's say 10 servers > via the internet? > Would inter node metadata flow be possible over > encrypted channels? > > Regards, > Marc > -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : fs_db_init.erl %%% Author : Martin J. Logan %%% %%% @doc %%% %%%

Brings mnesia databases together dynamically. This module is intended %%% only to cover the simple cases for replication. The simple cases are defined %%% as:

%%% %%% 1. Starting from scratch as the first mnesia db in a replication cluster and %%% in this case self seeding the db.
%%% %%% 2. Starting with an empty schema and joining a replication cluster.
%%% %%% @end %%% %%% Created : 1 Feb 2003 by Martin J. Logan %%%------------------------------------------------------------------- -module(fs_db_init). %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% External exports %%-------------------------------------------------------------------- -export([start_link/1, start_link/2]). %%-------------------------------------------------------------------- %% Internal exports %%-------------------------------------------------------------------- -export([db_init/3]). %%-------------------------------------------------------------------- %% macro definitions %%-------------------------------------------------------------------- -define(SERVER, ?MODULE). -define(DEFAULT_SCHEMA_TYPE, disc_copies). -define(WAIT_FOR_TABLES, 10000). %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% @doc Starts the server. %% @spec start_link(CallBackModule) -> {ok, pid()} | {error, Reason} %% @end %%-------------------------------------------------------------------- start_link(CallBackModule) -> proc_lib:start_link(?MODULE, db_init, [self(), CallBackModule, []]). %%-------------------------------------------------------------------- %% @doc Starts the server with options. %%
%%
%% The options are as follows:
%%  {schema_type, Type}
%%
%% Types:
%%  Type = ram_copies | disc_copies | disc_only_copies
%%
%% 
%% @spec start_link(CallBackModule, Options) -> {ok, pid()} | {error, Reason} %% @end %%-------------------------------------------------------------------- start_link(CallBackModule, Options) -> proc_lib:start_link(?MODULE, db_init, [self(), CallBackModule, Options]). %%%============================================================================= %%% Internal functions %%%============================================================================= %%-------------------------------------------------------------------- %% @doc Initialize db then die. %% @end %%-------------------------------------------------------------------- db_init(Parent, CallbackModule, Options) -> case apply(CallbackModule, init, []) of no_init -> proc_lib:init_ack(Parent, {ok, self()}), exit(normal); {ok, []} -> delete_schema(), local_init(CallbackModule, schema_type(Options)), proc_lib:init_ack(Parent, {ok, self()}); {ok, DBNodes} -> delete_schema(), remote_init(CallbackModule, schema_type(Options), DBNodes), proc_lib:init_ack(Parent, {ok, self()}) end. %% deletes a local schema. delete_schema() -> mnesia:stop(), mnesia:delete_schema([node()]), mnesia:start(). %%-------------------------------------------------------------------- %% Locally initialize tables. %% Returns: void() | exit(Reason) %%-------------------------------------------------------------------- local_init(CallbackModule, Type) -> ok = schema_type_specific(Type), {ok, Records} = apply(CallbackModule, local_init, []), lists:foreach(fun(Record) -> ok = mnesia:dirty_write(Record) end, Records). %%-------------------------------------------------------------------- %% Join with another node in a mnesia cluster. %% Types: %% Reason = schema_type_change | replication %% %% Returns: %% ok | {error, Reason} %%-------------------------------------------------------------------- remote_init(CallbackModule, Type, []) -> {error, replication}; remote_init(CallbackModule, Type, [Node|T]) -> case mnesia:change_config(extra_db_nodes, [Node]) of {ok, [Node]} -> {ok, TableTypeList} = apply(CallbackModule, remote_init, []), Res = mnesia:add_table_copy(schema, node(), Type), error_logger:info_msg("fs_db_init:remote_init schema type ~p~n", [Res]), Fun = fun({Table, TableType}) -> Res1 = mnesia:add_table_copy(Table, node(), TableType), error_logger:info_msg( "fs_db_init:remote_init add_table copy = ~p~n", [Res1]) end, lists:foreach(Fun, lists:delete(schema, TableTypeList)), Tables = mnesia:system_info(tables), case mnesia:wait_for_tables(Tables, ?WAIT_FOR_TABLES) of ok -> schema_type_specific(Type); {error, Reason} -> {error, replication} end; _ -> remote_init(CallbackModule, Type, T) end. %% If the type is disc copy make it so. %% Returns: ok | {error, schema_type_change} schema_type_specific(disc_only_copies) -> res(mnesia:change_table_copy_type(schema, node(), disc_only_copies)); schema_type_specific(disc_copies) -> res(mnesia:change_table_copy_type(schema, node(), disc_copies)); schema_type_specific(_) -> ok. res({atomic, ok}) -> ok; res(_) -> {error, schema_type_change}. %%-------------------------------------------------------------------- %% Determine the storage type of the schema. %% Types: %% Type = ram_copies | disc_copies | disc_only_copies. %% %% Returns: %% exit({error, {enosuchtype, BadType}}) | Type %%-------------------------------------------------------------------- schema_type([{schema_type, Type}|T]) -> type(Type); schema_type([_|T]) -> schema_type(T); schema_type([]) -> ?DEFAULT_SCHEMA_TYPE. type(ram_copies) -> ram_copies; type(disc_copies) -> disc_copies; type(disc_only_copies) -> disc_only_copies; type(BadType) -> exit({error, {enosuchtype, BadType}}). From Marc.Vanwoerkom@REDACTED Tue Aug 12 23:02:01 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Tue, 12 Aug 2003 23:02:01 +0200 (MEST) Subject: Distribution with Mnesia In-Reply-To: <20030812035830.GD28510@frogman.motivity.ca> (message from Vance Shipley on Mon, 11 Aug 2003 23:58:30 -0400) Message-ID: <200308122102.h7CL21J15965@bonsai.fernuni-hagen.de> > http://www.erlang.org/doc/r9c/lib/ssl-3.0.1/doc/html/usersguide_frame.html Thanks for that link! Marc From Marc.Vanwoerkom@REDACTED Tue Aug 12 23:47:45 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Tue, 12 Aug 2003 23:47:45 +0200 (MEST) Subject: Distribution with Mnesia In-Reply-To: <76E5F712842F5F49A35738622BAA0F4F9EA6B5@ESEALNT442.al.sw.ericsson.se> (message from =?ISO-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?= on Tue, 12 Aug 2003 09:52:25 +0200) Message-ID: <200308122147.h7CLlje18956@bonsai.fernuni-hagen.de> > If you want to have a very dynamic network of mnesia nodes, > I suggest you configure a few nodes to hold a disk copy of > the schema, and manage them with care. Then, you can connect > other nodes using the mnesia 'extra_db_nodes' feature. > These nodes will be "diskless" from mnesia's perspective, > and may come and go at will... almost. If a diskless node > loses contact with one of the master nodes, it should > unconditionally restart (mnesia, at least). The docs (as far as I read them) tell not much about the limits and costs of distribution. But what you tell here looks like a distributed mnesia db is a tightly coupled aggreation of nodes. If one wants to support Peer to Peer with lots of folks entering and leaving the net unpredictably, one would probably something different. I really hope it will be possible to extend Erlang in that direction, there are so many places where P2P would already make good sense besides stealing copyrighted stuff, imagine rolling out the latest Erlang tarballs with P2P techniques to distribute server load.. The mnesia doc also makes me wonder how you did implement certain stuff, like the transaction system analyzing the function objects that represent transactions.. Regards, Marc From Marc.Vanwoerkom@REDACTED Wed Aug 13 00:27:24 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Wed, 13 Aug 2003 00:27:24 +0200 (MEST) Subject: Erlang programmation In-Reply-To: (message from Mickael Remond on Mon, 02 Jun 2003 09:56:14 +0200) Message-ID: <200308122227.h7CMRNA21552@bonsai.fernuni-hagen.de> > I just finished a French book on Erlang Yea, I got my copy from Amazon.fr today (took about a week)! First impressions: o Well done: Nice book format, nice font, nice graphics. o The emphasis seems to lie on giving an overview of today's Erlang world. o The the technical French language together with the code and images makes it possible to comprehend it with my school French.. so don't let you keep off to get it if your French is not perfect! > (published by Eyrolles, a > famous french technical publisher). When asked by an English friend, who that Golden Earring music group was, a "They are world famous in Holland!" slipped out. :) Thank you! Marc From vlad_dumitrescu@REDACTED Tue Aug 12 19:58:26 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 12 Aug 2003 19:58:26 +0200 Subject: Summing a number to the terms of a list References: Message-ID: Hi, ----- Original Message ----- From: "Jilani Khaldi" > Why this code gives me these different results? > > A=[1,2,3]. > sumit:sum_me(A,100). > "efg" > > sumit:sum_me(A,200). > "\311\312\313" > > sumit:sum_me(A,300). > [301,302,303] -- as I expected. In the first two cases, the resulting lists contain small integers and when printing those, the shell assumes they are strings. Erlang strings are indistinguishable from arbitrary lists that happen to contain only small integers (<255). Try in the shell to type >[101, 102, 103]. regards, Vlad From per@REDACTED Wed Aug 13 07:32:39 2003 From: per@REDACTED (Per Bergqvist) Date: Wed, 13 Aug 2003 08:32:39 +0300 Subject: Resource Sharing Between production and test environment In-Reply-To: <20030812233955.GH30901@frogman.motivity.ca> Message-ID: <200308130632.h7D6Wdo22379@tessla.levonline.com> Hi Vance, 1) build a debug emulator (cd erts; make debug) 2) make sure your X environment is correct 3) tell your script to execute "cerl -gdb ..." instead of "erl ..." This will pop up gdb in emacs. very handy. You can also do this on remote nodes by passing X settings. Note that you need to work with the source tree in the path since cerl and debug emulators are not installed. You say .DLL and I must say that I never tried this on Win32. Should probably work now when you can build local using cygwin. (Have to try this some day but I have had my doze of M$ for this year ....) /Per ------------------- > Per, > > You mentioned recently "gdb debugging a node". I was > struggling with thsi today and wondered if you had any > sage words of advice for me. I have never really used > gdb much at all and have some problem using it in this > context. > > Since we start Erlang/OTP with a shell script which calls > a loader program which executes the erts (beam) process > I have trouble starting it with gdb. The only method I've > been able to use is to start erl and then "attach" gdb > by giving it the pid of the beam process. I sthis what > you do? Is there a better way? > > I actually need to debug a DLL I've written so that makes > it ever more complicated. > > -Vance > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From Bengt.Kleberg@REDACTED Tue Aug 12 16:48:41 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Tue, 12 Aug 2003 16:48:41 +0200 Subject: Summing a number to the terms of a list In-Reply-To: References: Message-ID: <3F38FE49.8080609@ericsson.com> Jilani Khaldi wrote: > Hi All, > > Why this code gives me these different results? > ...deleted > > Results: > > A=[1,2,3]. > sumit:sum_me(A,100). > "efg" > > sumit:sum_me(A,200). > "\311\312\313" > > sumit:sum_me(A,300). > [301,302,303] -- as I expected. > erlang uses lists of integers (in the range 0 - 255) to ''implement'' strings. thus [101, 102, 103] is interpreted as the string "efg". [201, 202, 203] are still characters, but not printable. so they are displayed as octal numbers in a string. [301,302,303] has risen above the 255 limit and can not be a string. must be a list of numbers. bengt From D.WILLIAMS@REDACTED Wed Aug 13 13:58:21 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Wed, 13 Aug 2003 13:58:21 +0200 Subject: compiler internal error Message-ID: Hello, The following (incorrect) code produces an internal compiler error (R9B under Win2000) -module(testing). -export([run/0,fun1/0]). run() -> {ok,fun1/0} = e3:run_tests([fun fun1/0]). fun1() -> ok = ok. Here is the output: ./testing.erl:none: internal error in v3_core; crash reason: {{case_clause,{'EXIT',{'EXIT', {function_clause, [{v3_core, pattern, [{op,5, '/', {atom,5,fun1}, {integer,5,0}}]}, {lists,map,2}, {v3_core,pattern,1}, {v3_core,expr,2}, {v3_core,exprs,2}, {v3_core,clause,2}, {v3_core,clauses,2}, {v3_core,body,3}| more]}}}}, [{compile,'-select_passes/2-anonymous-2-',2}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} error I know what is wrong with the code, but just wanted to let you know about the compiler crash. Regards, Dominic. From serge@REDACTED Wed Aug 13 14:14:45 2003 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 13 Aug 2003 08:14:45 -0400 Subject: distributed erl startup crash Message-ID: <3F3A2BB5.9090603@hq.idt.net> Can anybody tell why erl shell would crash at startup on WinXP with the following message? It does start fine in the non-distributed mode. If I am reading the error dump correctly, net_kernel failed to start a listener on port 15000. I checked netstat and don't see anything running on 15000, so there should be no conflict. Is there a way to start the shell in a more verbose mode? Serge c:\>erl -sname node1 {error_logger,{{2003,8,13},{8,6,44}},'Protocol: ~p: register/listen error: ~p~n' ,[inet_tcp,enotsock]} {error_logger,{{2003,8,13},{8,6,44}},crash_report,[[{pid,<0.17.0>},{registered_n ame,net_kernel},{error_info,{error,badarg}},{initial_call,{gen,init_it,[gen_serv er,<0.14.0>,<0.14.0>,{local,net_kernel},net_kernel,{node1,shortnames,15000},[]]} },{ancestors,[net_sup,kernel_sup,<0.8.0>]},{messages,[]},{links,[<0.14.0>]},{dic tionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,377},{ stack_size,23},{reductions,281}],[]]} {error_logger,{{2003,8,13},{8,6,44}},supervisor_report,[{supervisor,{local,net_s up}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid ,undefined},{name,net_kernel},{mfa,{net_kernel,start_link,[[node1,shortnames]]}} ,{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2003,8,13},{8,6,44}},supervisor_report,[{supervisor,{local,kerne l_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined}, {name,net_sup},{mfa,{erl_distribution,start_link,[]}},{restart_type,permanent},{ shutdown,infinity},{child_type,supervisor}]}]} {error_logger,{{2003,8,13},{8,6,44}},crash_report,[[{pid,<0.7.0>},{registered_na me,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call,{applica tion_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,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,applicatio n_controller,application_master,application_starter,auth,code,code_aux,packages, code_server,dist_util,erl_boot_server,erl_distribution,erl_open_port,erl_prim_lo ader,erl_reply,erlang,error_handler,error_logger,file,file_server,old_file_serve r,file_io_server,prim_file,global,global_group,global_search,group,heart,inet6_t cp,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,e rl_epmd,erts_debug,gen_tcp,gen_udp,prim_inet,inet,inet_db,inet_dns,inet_parse,in et_res,inet_tcp,inet_udp,pg2,seq_trace,socks5,socks5_auth,socks5_tcp,socks5_udp, wrap_log_reader,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,10 80}],[]]} {error_logger,{{2003,8,13},{8,6,44}},std_info,[{application,kernel},{exited,{shu tdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller,shutdown} Kernel pid terminated (application_controller) (shutdown) From rpettit@REDACTED Wed Aug 13 18:21:13 2003 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 13 Aug 2003 09:21:13 -0700 Subject: ErlInterface Message-ID: <20030813162113.GC1142@vailsys.com> Reading through the ErlInterface documentation I noticed a couple things that seemed to be lacking: 1) Not nearly enough mention of erl_interface being deprecated/obsolete. The _majority_ of the User's Guide focuses on this dead library, and it is confusing to new people. I think it would be helpful to remind people in the erl_interface docs that the library is dead. 2) No mention of what, if any, erl_interface routines are ok to use. I see no ei_global_names, for example. Is the erl_interface version off limits? Not thread safe? My biggest question now is are _any_ of the erl_* routines ok/safe to use? I have a fully working sample using erl_interface that I am now rebuilding to use ei, and noticed that there is not a one-for-one mapping of erl_X routine to ei_X routine. Put another way, should I have to look at any of the docs beyond ei and ei_connect manpages? -Rick From vances@REDACTED Wed Aug 13 16:47:42 2003 From: vances@REDACTED (Vance Shipley) Date: Wed, 13 Aug 2003 10:47:42 -0400 Subject: Resource Sharing Between production and test environment In-Reply-To: <200308130632.h7D6Wdo22379@tessla.levonline.com> References: <20030812233955.GH30901@frogman.motivity.ca> <200308130632.h7D6Wdo22379@tessla.levonline.com> Message-ID: <20030813144742.GC32018@frogman.motivity.ca> On Wed, Aug 13, 2003 at 08:32:39AM +0300, Per Bergqvist wrote: } } You say .DLL and I must say that I never tried this on Win32. } Should probably work now when you can build local using cygwin. Per, Actually I said "DLL" and I obviously should have chosen my terms better. That seemed shorter than "dynamic library" or "relocatable object". Let be more specific: :) $ file libnatest.so libnatest.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically linked, not stripped } (Have to try this some day but I have had my doze of M$ for this year } ....) I'm not masochistic enough to try to do this stuff on Windows. On Wed, Aug 13, 2003 at 08:32:39AM +0300, Per Bergqvist wrote: } Hi Vance, } } 1) build a debug emulator (cd erts; make debug) } 2) make sure your X environment is correct } 3) tell your script to execute "cerl -gdb ..." instead of "erl ..." } } This will pop up gdb in emacs. very handy. } You can also do this on remote nodes by passing X settings. } Note that you need to work with the source tree in the path since } cerl and debug emulators are not installed. Thanks, I'll give this a try. -Vance From rpettit@REDACTED Wed Aug 13 19:31:09 2003 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 13 Aug 2003 10:31:09 -0700 Subject: ErlInterface In-Reply-To: <20030813162113.GC1142@vailsys.com> References: <20030813162113.GC1142@vailsys.com> Message-ID: <20030813173109.GD1142@vailsys.com> I include both ei.h and ei_connect.h in my sample program, and call int ei_connect_xinit(...); and get an error about implicit definition. I then look and see no prototype for this in ei_connect.h. Is this intentional? -Rick From vlad_dumitrescu@REDACTED Wed Aug 13 20:36:39 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 13 Aug 2003 20:36:39 +0200 Subject: ErlInterface References: <20030813162113.GC1142@vailsys.com> Message-ID: Hi, This is not an answer, but it's related: There is no "EI User Guide" in the documentation, the link is dead and also no such file seems to exist. Maybe the User Guide would have helped Rick (and us others) to better understand what's going on. regards, Vlad From vances@REDACTED Wed Aug 13 21:01:35 2003 From: vances@REDACTED (Vance Shipley) Date: Wed, 13 Aug 2003 15:01:35 -0400 Subject: ErlInterface In-Reply-To: References: <20030813162113.GC1142@vailsys.com> Message-ID: <20030813190134.GB34097@frogman.motivity.ca> I'm getting used to deprecated C language interfaces. I started out using IG, then erl_interface and now ei. Someday we'll drop ei in favour of UBF or whatever is next. :) -Vance From rpettit@REDACTED Wed Aug 13 22:50:16 2003 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 13 Aug 2003 13:50:16 -0700 Subject: ErlInterface In-Reply-To: References: <20030813162113.GC1142@vailsys.com> Message-ID: <20030813205016.GF1142@vailsys.com> On Wed, Aug 13, 2003 at 08:36:39PM +0200, Vlad Dumitrescu wrote: > This is not an answer, but it's related: There is no "EI User Guide" in the > documentation, the link is dead and also no such file seems to exist. > > Maybe the User Guide would have helped Rick (and us others) to better > understand what's going on. Agreed. For now I continue to struggle with missing prototypes in headers (ex. the prototype for ei_connect_xinit() is nowhere to be found). Did I miss a header somewhere? This prototype did not seem to be in ei_connect.h. Another question is why some calls internally call erl_err_quit() instead of returning an error. Granted, most of those errors (if not all) will stop the library routine in question from proceeding, but to terminate the calling process seems a bit extreme. -Rick From rpettit@REDACTED Wed Aug 13 22:53:08 2003 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 13 Aug 2003 13:53:08 -0700 Subject: ErlInterface In-Reply-To: <20030813190134.GB34097@frogman.motivity.ca> References: <20030813162113.GC1142@vailsys.com> <20030813190134.GB34097@frogman.motivity.ca> Message-ID: <20030813205308.GG1142@vailsys.com> On Wed, Aug 13, 2003 at 03:01:35PM -0400, Vance Shipley wrote: > > I'm getting used to deprecated C language interfaces. I started > out using IG, then erl_interface and now ei. Someday we'll drop > ei in favour of UBF or whatever is next. :) You can stick a UBF contract checker (along with UBF B .con file) inbetween your C node and server right now, right? I don't know much about UBF but have started playing around in spare time. -Rick From hal@REDACTED Wed Aug 13 22:10:27 2003 From: hal@REDACTED (Hal Snyder) Date: Wed, 13 Aug 2003 15:10:27 -0500 Subject: ErlInterface In-Reply-To: <20030813173109.GD1142@vailsys.com> (Rick Pettit's message of "Wed, 13 Aug 2003 10:31:09 -0700") References: <20030813162113.GC1142@vailsys.com> <20030813173109.GD1142@vailsys.com> Message-ID: <87znidmi8c.fsf@ghidra.vail> Rick Pettit writes: > I include both ei.h and ei_connect.h in my sample program, and call > > int ei_connect_xinit(...); > > and get an error about implicit definition. I then look and see no > prototype for this in ei_connect.h. Is this intentional? I'm guessing it was omitted as an oversight. Workaround is to put the following in your .c, or add a patch to your OpenBSD port. :) extern int ei_connect_xinit (ei_cnode* ec, const char *thishostname, const char *thisalivename, const char *thisnodename, Erl_IpAddr thisipaddr, const char *cookie, const short creation); From jilani.khaldi@REDACTED Wed Aug 13 15:24:36 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Wed, 13 Aug 2003 15:24:36 +0200 Subject: Help! Message-ID: Hi All, I am trying in vain to write a function that once I inserted the number of a chapter of a book it gives me as result its title. For example: f(2) -> Chapitre 2 I tried many ways but can reach the correct result. -module(chapter). -export([f/1]). f(X) -> {_,_,_,Y} = {book, preface, contents,{chapters,[{chapter, 1, 'Chapitre 1'}, {chapter, 2, 'Chapitre 2'}, {chapter, 3, 'Chapitre 3'}]}}, {Z,Chapters} = Y... Y now has the list of chapters, but... Surely there are many ways to get the result, but I couldn't find any even if it seems so simple. Thanks! jilani From kent@REDACTED Wed Aug 13 22:42:15 2003 From: kent@REDACTED (Kent Boortz) Date: 13 Aug 2003 22:42:15 +0200 Subject: ErlInterface In-Reply-To: <20030813173109.GD1142@vailsys.com> References: <20030813162113.GC1142@vailsys.com> <20030813173109.GD1142@vailsys.com> Message-ID: Rick Pettit writes: > I include both ei.h and ei_connect.h in my sample program, and call > > int ei_connect_xinit(...); > > and get an error about implicit definition. I then look and see no prototype > for this in ei_connect.h. Is this intentional? In R9C? The file "ei_connect.h" is for now just an include of "ei.h" #ifndef EI_CONNECT_H #define EI_CONNECT_H /* Dummy for now.... */ #include "ei.h" #endif /* EI_CONNECT_H */ and "ei.h" does contain the prototype for ei_connect_xinit(). In R9C all documented prototypes and macro definitions where tested for header definition problems (except the return types) and linking problems compiling two "fake" programs that use them all. If you build from source you can do this test using something like % export ERL_TOP=/your/erlang/top % cd $ERL_TOP/lib/erl_interface/src % gmake -f yourtarget/Makefile check kent From mlogan@REDACTED Wed Aug 13 22:48:18 2003 From: mlogan@REDACTED (Martin J. Logan) Date: 13 Aug 2003 15:48:18 -0500 Subject: Help! In-Reply-To: References: Message-ID: <1060807697.1256.234.camel@dhcp-lom-194-186.futuresource.com> Perhaps I have mistaken your post but it seems to me that you simply want to iterate over a list??? On Wed, 2003-08-13 at 08:24, Jilani Khaldi wrote: > Hi All, > I am trying in vain to write a function that once I inserted the number of > a chapter of a book it gives me as result its title. > For example: f(2) -> Chapitre 2 > > I tried many ways but can reach the correct result. > > -module(chapter). > -export([f/1]). > f(X) -> > {_,_,_,Y} = {book, preface, contents,{chapters,[{chapter, 1, 'Chapitre 1'}, > {chapter, 2, 'Chapitre 2'}, {chapter, 3, 'Chapitre 3'}]}}, > {Z,Chapters} = Y... > Y now has the list of chapters, but... Surely there are many ways to get > the result, but I couldn't find any even if it seems so simple. > > Thanks! > > jilani From svg@REDACTED Wed Aug 13 22:43:21 2003 From: svg@REDACTED (Vladimir Sekissov) Date: Thu, 14 Aug 2003 02:43:21 +0600 (YEKST) Subject: Help! In-Reply-To: References: Message-ID: <20030814.024321.41652595.svg@surnet.ru> Good day, f(X) -> ... {_, Chapters} = element(4, Book), case lists:keysearch(X, 2, Chapters) of {value, {_, _, Header}} -> {ok, Header}; Other -> Other end. But may be it would be better to use records here if book format is fixed: -record(book, {preface, contents, chapters}). -record(chapter, {num, header}). get_chapter(N, B=#book{chapters=Cs}) -> case lists:dropwhile(fun (C=#chapter{num=N}) -> false; (_) -> true end, Cs) of [C=#chapter{header=H}|_] -> {ok, Header}; [] -> undefined end. Or xml-like {book, [{AttrName, AttrValue}], [Content]} if it is float. You can effectively traverse it with simple generic functions in such case. For example: %% fold_tree(Node={Name, Args}, DownHlr, HereHlr, UpHlr, Seed) -> fold_tree(Node={Name, Args, []}, DownHlr, HereHlr, UpHlr, Seed); fold_tree(Node={Name, Args, Content}, DownHlr, HereHlr, UpHlr, Seed) -> NodeEl = {Name, Args}, ChildSeed = fold_content(Content, DownHlr, HereHlr, UpHlr, DownHlr(NodeEl, Seed)), UpHlr(NodeEl, Seed, ChildSeed); fold_tree(Nodes=[N|_], DownHlr, HereHlr, UpHlr, Seed) when is_tuple(N) -> fold_content(Nodes, DownHlr, HereHlr, UpHlr, Seed); fold_tree(Str, DownHlr, HereHlr, UpHlr, Seed) when is_list(Str) -> HereHlr(Str, Seed). fold_content(Nodes, DownHlr, HereHlr, UpHlr, Seed) -> lists:foldl(fun (N, S) -> fold_tree(N, DownHlr, HereHlr, UpHlr, S) end, Seed, normalize_el_content(Nodes)). normalize_el_content(C=[I|_]) when is_integer(I) -> %% string() -> [string()] [C]; normalize_el_content(C) -> C. Best Regards, Vladimir Sekissov jilani.khaldi> I am trying in vain to write a function that once I inserted the number of jilani.khaldi> a chapter of a book it gives me as result its title. jilani.khaldi> For example: f(2) -> Chapitre 2 jilani.khaldi> jilani.khaldi> I tried many ways but can reach the correct result. jilani.khaldi> jilani.khaldi> -module(chapter). jilani.khaldi> -export([f/1]). jilani.khaldi> f(X) -> jilani.khaldi> {_,_,_,Y} = {book, preface, contents,{chapters,[{chapter, 1, 'Chapitre 1'}, jilani.khaldi> {chapter, 2, 'Chapitre 2'}, {chapter, 3, 'Chapitre 3'}]}}, jilani.khaldi> {Z,Chapters} = Y... jilani.khaldi> Y now has the list of chapters, but... Surely there are many ways to get jilani.khaldi> the result, but I couldn't find any even if it seems so simple. jilani.khaldi> jilani.khaldi> Thanks! jilani.khaldi> jilani.khaldi> jilani From kent@REDACTED Wed Aug 13 23:29:18 2003 From: kent@REDACTED (Kent Boortz) Date: 13 Aug 2003 23:29:18 +0200 Subject: ErlInterface In-Reply-To: References: <20030813162113.GC1142@vailsys.com> Message-ID: "Vlad Dumitrescu" writes: > This is not an answer, but it's related: There is no "EI User Guide" in the > documentation, the link is dead and also no such file seems to exist. > > Maybe the User Guide would have helped Rick (and us others) to better > understand what's going on. The plan was to include a new "EI User Guide" in R9C and clarify the difference between using the old erl_interface library and the newer ei library. Unfortunately this user guide isn't written yet, Vance Shipley writes: > I'm getting used to deprecated C language interfaces. I started > out using IG, then erl_interface and now ei. Someday we'll drop > ei in favour of UBF or whatever is next. :) It is hard to get a clean nice interface from C with an abstraction level that makes it efficient enough and yet hide the details about the internal representations or the external format. But we haven't given up on trying, that is why the C interface is likely to change again ;-) Seriously, when adding the connection part to ei it was a mistake to just clone the erl_interface functions. This is why ei isn't reentrant, ei_connect_init() and ei_connect() should have returned node objects and connection objects that was passed on to the other functions that handle the connection. Now there is shared data that map between file descriptors and node/connection data. This data is protected with thread locking. We will work on making ei reentrant. Someone has to correct me if I say this wrong. The ei library is thread safe but not reentrant, i.e. you can safely set up and use connections from different threads but you can't safely call ei_connect() from a signal handler. Erl_interface uses ei for the connection handling so the erl_interface library should be thread safe as well. Rick Pettit writes: > Another question is why some calls internally call erl_err_quit() instead of > returning an error. Granted, most of those errors (if not all) will stop the > library routine in question from proceeding, but to terminate the calling > process seems a bit extreme. Historical reasons. There may be programs out there that depends on this behavior. Ei don't call exit, kent From hal@REDACTED Thu Aug 14 01:59:01 2003 From: hal@REDACTED (Hal Snyder) Date: Wed, 13 Aug 2003 18:59:01 -0500 Subject: R9C FreeBSD-5.0 dns (was: ErlInterface) In-Reply-To: (Kent Boortz's message of "13 Aug 2003 22:42:15 +0200") References: <20030813162113.GC1142@vailsys.com> <20030813173109.GD1142@vailsys.com> Message-ID: <87he4lm7ne.fsf_-_@ghidra.vail> Kent Boortz writes: > In R9C? The file "ei_connect.h" is for now just an include of "ei.h" ... > and "ei.h" does contain the prototype for ei_connect_xinit(). In R9C > all documented prototypes and macro definitions where tested for > header definition problems (except the return types) and linking > problems compiling two "fake" programs that use them all. If you build > from source you can do this test using something like > > % export ERL_TOP=/your/erlang/top > % cd $ERL_TOP/lib/erl_interface/src > % gmake -f yourtarget/Makefile check Right, thanks. Just upgraded a system to R9C. BTW, with R9-C on FreeBSD-5.0, I can't net_adm:ping() a remote node without frobbing ETS. This also used to happen on other BSDs. erl -name foozle -setcookie baz Erlang (BEAM) emulator version 5.3 [source] [hipe] [threads:0] Eshell V5.3 (abort with ^G) (foozle@REDACTED)1> net_adm:ping('pdq@REDACTED'). pang (foozle@REDACTED)2> ets:insert(inet_db, {res_lookup, [file,dns]}). true (foozle@REDACTED)3> net_adm:ping('pdq@REDACTED'). pong Bug or feature? (See also mailing list thread starting with http://www.erlang.org/ml-archive/erlang-questions/200111/msg00146.html ) From D.WILLIAMS@REDACTED Thu Aug 14 09:40:22 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Thu, 14 Aug 2003 09:40:22 +0200 Subject: function() guard Message-ID: Hello, The function() guard does not seem to accept the {Module,Fun} form. Is this intentional, or am I doing something wrong? ----- THIS RETURNS ok -------- -module(funguard). -export([run/0,global/0]). f(Fun) when function(Fun) -> Fun(). local() -> ok. global() -> ok. run() -> ok = f(fun() -> ok end), ok = f(fun local/0). % ok = f({funguard,global}). %% NOT ATTEMPTED ----- THIS ALSO RETURNS ok -------- -module(funguard). -export([run/0,global/0]). f(Fun) -> %% REMOVED GUARD Fun(). local() -> ok. global() -> ok. run() -> ok = f(fun() -> ok end), ok = f(fun local/0), ok = f({funguard,global}). ----- THIS exits with function_clause -------- -module(funguard). -export([run/0,global/0]). f(Fun) when function(Fun) -> Fun(). local() -> ok. global() -> ok. run() -> ok = f(fun() -> ok end), ok = f(fun local/0), ok = f({funguard,global}). ------ Cheers, Dominic. From ulf.wiger@REDACTED Thu Aug 14 09:44:35 2003 From: ulf.wiger@REDACTED (=?ISO-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Thu, 14 Aug 2003 09:44:35 +0200 Subject: Help! Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6C5@ESEALNT442.al.sw.ericsson.se> From: Vladimir Sekissov [mailto:svg@REDACTED] >f(X) -> > ... > {_, Chapters} = element(4, Book), > case lists:keysearch(X, 2, Chapters) of > {value, {_, _, Header}} -> > {ok, Header}; > Other -> > Other > end. > >But may be it would be better to use records here if >book format is fixed: > >-record(book, {preface, contents, chapters}). >-record(chapter, {num, header}). > >get_chapter(N, B=#book{chapters=Cs}) -> > case lists:dropwhile(fun (C=#chapter{num=N}) -> false; > (_) -> true > end, Cs) of > [C=#chapter{header=H}|_] -> > {ok, Header}; > [] -> > undefined > end. Just for the record, you can use record syntax in lists:keysearch/3 as well: case lists:keysearch(X, #chapter.num, Chapters) of ... /Uffe From ulf.wiger@REDACTED Thu Aug 14 11:29:33 2003 From: ulf.wiger@REDACTED (=?ISO-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Thu, 14 Aug 2003 11:29:33 +0200 Subject: surprising behaviour for duplicate cmd line opts Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6C9@ESEALNT442.al.sw.ericsson.se> I had reason to wonder what would happen if the -sname option is given twice on the erl command line, so I tried it (in R9C): $ erl -boot start_clean -sname a Erlang (BEAM) emulator version 5.3 [hipe] [threads:0] Eshell V5.3 (abort with ^G) (a@REDACTED)1> $ erl -boot start_clean -sname a -sname b Erlang (BEAM) emulator version 5.3 [hipe] [threads:0] Eshell V5.3 (abort with ^G) 1> node(). nonode@REDACTED 2> $ erl -boot start_clean -sname a -sname a Erlang (BEAM) emulator version 5.3 [hipe] [threads:0] Eshell V5.3 (abort with ^G) 1> node(). nonode@REDACTED 2> I would have preferred an error message, or perhaps that the first or last option be the one that counts. The current behaviour when -sname is given twice is by all means consistent, but it is always wrong. /Uffe From Bruce@REDACTED Thu Aug 14 14:07:24 2003 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Fri, 15 Aug 2003 00:07:24 +1200 Subject: Mnesia tables: load times and sizes after deletion Message-ID: <0f3601c3625c$9fbc7ff0$0a21970a@norris> Gentlemen, I've just been playing with my little jukebox I wrote for broadcasting background music in Erlang. It logs the songs played into an mnesia table 'playlog' (set, disc_copies). I managed to get 71,000 entries into the table, at which point it took a number of minutes to open on my little Duron 1300 w/ ATA100 hd I used a (inefficient) mnemosyne query to get all the entries older than 1 day and delete them, and this worked. Surprisingly fast, to mnemosynes credit. What did surprise me is that the on-disk size, and the size reported by mnesia:table_info(playlog, size) continued to increased (it was still playing). Is this normal? The docs say size = total number of records, is it actually max size? Even after the delete and normal shutdown the table did not shrink in either sense. It still took a number of minutes to open too. I guess I'm just curious to know if this is normal? I attempted to directly open the mnesia files under dets to query them...but that is apparently not allowed. A good thing probably. Thanks for any info. I've deleted and recreated the table now. This is all under R9C (nice work guys, great docs), although the DB was created using R9B-1. /Bruce From ulf.wiger@REDACTED Thu Aug 14 14:46:00 2003 From: ulf.wiger@REDACTED (=?ISO-8859-1?Q?Ulf_Wiger_=28=C4L2/EAB=29?=) Date: Thu, 14 Aug 2003 14:46:00 +0200 Subject: Mnesia tables: load times and sizes after deletion Message-ID: <76E5F712842F5F49A35738622BAA0F4F9EA6CB@ESEALNT442.al.sw.ericsson.se> Are you sure the tables were created under R9B? If so, are you sure they are dets files (.DAT when using mnesia)? Granted, I've been on a long vacation and my brain may not have engaged fully yet, but I recall that disc_copies are stored on disk in disk_log format (mnesia gives them the extension .DCD), and not as dets files. Disc_only copies are stored as dets files. The file size should adjust at every log dump, and a load time of minutes seems a bit slow, perhaps, but I wouldn't want to swear that it's abnormal. /Uffe -----Original Message----- From: Bruce Fitzsimons [mailto:Bruce@REDACTED] Sent: Thursday, August 14, 2003 14:07 To: erlang-questions@REDACTED Subject: Mnesia tables: load times and sizes after deletion Gentlemen, I've just been playing with my little jukebox I wrote for broadcasting background music in Erlang. It logs the songs played into an mnesia table 'playlog' (set, disc_copies). I managed to get 71,000 entries into the table, at which point it took a number of minutes to open on my little Duron 1300 w/ ATA100 hd I used a (inefficient) mnemosyne query to get all the entries older than 1 day and delete them, and this worked. Surprisingly fast, to mnemosynes credit. What did surprise me is that the on-disk size, and the size reported by mnesia:table_info(playlog, size) continued to increased (it was still playing). Is this normal? The docs say size = total number of records, is it actually max size? Even after the delete and normal shutdown the table did not shrink in either sense. It still took a number of minutes to open too. I guess I'm just curious to know if this is normal? I attempted to directly open the mnesia files under dets to query them...but that is apparently not allowed. A good thing probably. Thanks for any info. I've deleted and recreated the table now. This is all under R9C (nice work guys, great docs), although the DB was created using R9B-1. /Bruce From rpettit@REDACTED Thu Aug 14 19:12:32 2003 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 14 Aug 2003 10:12:32 -0700 Subject: Building OTP R9C-0 on OpenBSD 3.3 Message-ID: <20030814171232.GA22719@vailsys.com> Sorry if this is a duplicate (don't think my previous email made it to the list). I finally got R9C to build, after doing the following: 1) ./configure --with-ssl=/usr/include/openssl Configure succeeds, but build will fail as OPENSSL_CMD is incorrectly set to /usr/include/openssl/bin/openssl 2) manually modify appropriate Makefile to hard-code OPENSSL_CMD It is worth noting that a vanilla "./configure" with no args used to work just fine with R9B-1. Not being terribly familiar with autotools I am doing my best to work with the otp_src_R9C-0/erts/configure.in to patch for OpenBSD 3.3 I have attached a diff that I am having trouble getting to work, perhaps someone can shed some light on what I am doing wrong? Thanks. -Rick P.S. It is also worth noting that I needed to apply one patch to get os_mon to build (same patch to memsup.c as was recommended on list for R9B-1). This could also be fixed with modified version of the configure.in for os_mon no doubt. P.P.S. Once I figure the "right" way to patch the appropriate configure.in's, is anyone willing to test and perhaps include in the next release so that a vanilla build on OpenBSD does not require special args to configure or patches to src and/or Makefiles? From rpettit@REDACTED Thu Aug 14 19:27:23 2003 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 14 Aug 2003 10:27:23 -0700 Subject: ErlInterface (sorry, here goes another question) Message-ID: <20030814172723.GB22719@vailsys.com> I whipped up a sample ei program that connects to a remote node and attempts to send a message to a registered process on that node. The message is simply the atom 'hello_world'. Attached is the Makefile and main.cpp src file. This builds (OpenBSD 3.3 Current running OTP R9C-0): rpettit@REDACTED /home/rpettit/EI # gmake g++ -c -I/usr/local/lib/erlang/lib/erl_interface-3.4/include main.cpp g++ main.o -L/usr/local/lib/erlang/lib/erl_interface-3.4/lib -lerl_interface -lei -lpthread -o ei-test /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_connect.o): In function `ei_connect_init': /home/rpettit/downloads/erlang/OTP-R9C/otp_src_R9C-0/lib/erl_interface/src/connect/ei_connect.c:491: warning: sprintf() is often misused, please use snprintf() /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(show_msg.o): In function `ei_trace_printf': /home/rpettit/downloads/erlang/OTP-R9C/otp_src_R9C-0/lib/erl_interface/src/misc/show_msg.c:81: warning: vsprintf() is often misused, please use vsnprintf() Disregard the error messages (or don't ;-), it is complaining about "unsafe" string routines being called from the ei library. The problem is the program produces output that seems to indicate I goofed a pointer somewhere: rpettit@REDACTED /home/rpettit/EI # ./ei-test Calling ei_connect_xinit() Calling ei_xconnect() Calling ei_reg_send() Pphagdei-test-node@REDACTED hello_worldLooks like it worked! If I comment out the call to ei_reg_send() then I only see: Calling ei_connect_xinit() Calling ei_xconnect() Calling ei_reg_send() Which seems to indicate that the trouble is with the call to ei_reg_send(). I thought my sample was pretty much straight out of the docs, with minor mods (the atom sent, etc). Any suggestions welcome. Thanks, -Rick P.S. Perhaps someone has done work with ei (sample apps, etc) that they would like to post a link to? From rpettit@REDACTED Thu Aug 14 19:30:36 2003 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 14 Aug 2003 10:30:36 -0700 Subject: Building OTP R9C-0 on OpenBSD 3.3 In-Reply-To: <20030814171232.GA22719@vailsys.com> References: <20030814171232.GA22719@vailsys.com> Message-ID: <20030814173036.GC22719@vailsys.com> On Thu, Aug 14, 2003 at 10:12:32AM -0700, Rick Pettit wrote: > I have attached a diff Hehe, for real this time ;-) -Rick -------------- next part -------------- 1137c1137,1146 < SSL_BINDIR="$dir/bin" --- > > case $host_os in > openbsd*) > SSL_BINDIR="$dir/sbin" > ;; > *) > SSL_BINDIR="$dir/bin" > ;; > esac > From dne@REDACTED Fri Aug 15 00:06:51 2003 From: dne@REDACTED (=?iso-8859-1?q?Daniel_N=E9ri?=) Date: Fri, 15 Aug 2003 00:06:51 +0200 Subject: R9C FreeBSD-5.0 dns References: <20030813162113.GC1142@vailsys.com> <20030813173109.GD1142@vailsys.com> <87he4lm7ne.fsf_-_@ghidra.vail> Message-ID: <87isozrj0k.fsf@nowhere.mayonnaise.net> Hal Snyder writes: > BTW, with R9-C on FreeBSD-5.0, I can't net_adm:ping() a remote node > without frobbing ETS. This also used to happen on other BSDs. This patch should help (untested): -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/x-patch Size: 830 bytes Desc: not available URL: -------------- next part -------------- Regards, -- Daniel Neri dne@REDACTED From shivers@REDACTED Thu Aug 14 16:59:23 2003 From: shivers@REDACTED (Olin Shivers) Date: 14 Aug 2003 10:59:23 -0400 Subject: ICFP 2003 / PLI 2003 -- final call for participation In-Reply-To: Olin Shivers's message of "29 Jul 2003 11:43:30 -0400" References: Message-ID: The following message is a courtesy copy of an article that has been posted to comp.lang.scheme,comp.lang.scheme.scsh,comp.lang.dylan,comp.lang.functional,comp.lang.lisp,comp.lang.lisp.franz,comp.lang.lisp.mcl,comp.lang.lisp.x,comp.lang.apl,comp.lang.clos as well. ICFP 2003, the International Conference on Functional Programming, will be happening two weeks from now, 8/25-27. If you are contemplating registering for the conference, note that on-line/remote registration closes on Friday (8/15) -- although walk-in/on-site registration will be available up to and through the conference. I append the programme of talks to this message. For more information, see the conference web page http://www.cc.gatech.edu/~shivers/icfp03/schedule.html -Olin Shivers ------------------------------------------------------------------------------- ICFP 2003 program ----------------- http://www.cc.gatech.edu/icfp03/schedule.html http://www.cc.gatech.edu/icfp03/schedule.txt Affiliated with PLI 2003 August 25-29, 2003 Uppsala, Sweden =============================================================================== Monday 25 August 2003 Invited talk: 9:00-10:00 ------------------------ Conservation of information: Applications in functional, reversible, and quantum computing Thomas Knight, Jr. (MIT Artificial Intelligence Laboratory) Session I: 10:30-12:30 ---------------------- Scripting the type-inference process Bastiaan Heeren, Jurriaan Hage, Doaitse Swierstra (Universiteit Utrecht) Discriminative sum types locate the source of type errors Matthias Neubauer, Peter Thiemann (Universit?t Freiburg) MLF: Raising ML to the power of System F Didier Le Botlan, Didier R?my (INRIA Rocquencourt) An extension of HM(X) with bounded existential and universal data-types Vincent Simonet (INRIA Rocquencourt) Session II: 2:15-3:45 --------------------- CDuce: an XML-centric general-purpose language V?ronique Benzaken (LRI, Universit? Paris Sud, Orsay), Giuseppe Castagna (CNRS, LIENS, ?cole Normale Sup?rieure), Alain Frisch (LIENS, ?cole Normale Sup?rieure, Paris) Compiling regular patterns Michael Levin (University of Pennsylvania) Software is discrete mathematics Rex Page (University of Oklahoma) Session III: 4:15-6:00 ---------------------- Global abstraction-safe marshalling with hash types James Leifer (INRIA Rocquencourt), Gilles Peskine(INRIA Rocquencourt), Peter Sewell (University of Cambridge), Keith Wansbrough (University of Cambridge) Dynamic rebinding for marshalling and update, with destruct-time lambda Gavin Bierman (University of Cambridge), Michael Hicks (University of Maryland, College Park), Peter Sewell (University of Cambridge), Gareth Stoyle (University of Cambridge), Keith Wansbrough (University of Cambridge) Iterative-free program analysis Mizuhito Ogawa (Japan Advanced Institute of Science and Technology), Zhenjiang Hu (University of Tokyo), Isao Sasano (Japan Advanced Institute of Technology and Science) Report on ICFP 2003 & 2004 Olin Shivers & Kathleen Fisher =============================================================================== Tuesday 26 August 2003 Invited talk: 9:00-10:00 ------------------------ From Hilbert space to Dilbert space: Context semantics as a language for games and flow analysis Harry Mairson (Brandeis University) Session IV: 10:30-12:30 ----------------------- A theory of aspects David Walker (Princeton University), Steve Zdancewic (University of Pennsylvania), Jay Ligatti (Princeton University) Dependency-style Generic Haskell Andres L?h, Dave Clarke, Johan Jeuring (Universiteit Utrecht) Functional automatic differentiation with Dirac impulses Henrik Nilsson (Yale University) A user-centred approach to functions in Excel Simon Peyton Jones (Microsoft Research), Alan Blackwell (University of Cambridge), Margaret Burnett (Oregon State University) Session V: 2:15-3:45 -------------------- A sound and complete axiomatization of delimited continuations Yukiyoshi Kameyama (University of Tsukuba), Masahito Hasegawa (Kyoto University) Call-by-value is dual to call-by-name Philip Wadler (Avaya Labs) Disjunctive normal forms and local exceptions Emmanuel Beffara (CRNS, Universit? Paris 7), Vincent Danos (CRNS, Universit? Paris 7) Session VI: 4:15-6:00 --------------------- An effective theory of type refinements Yitzhak Mandelbaum (Princeton University), David Walker (Princeton University), Robert Harper (Carnegie Mellon University) A static type system for JVM access control Tomoyuki Higuchi, Atsushi Ohori (Japan Advanced Institute of Science and Technology) Parsing polish, step by step (functional pearl) John Hughes (Chalmers University), Doaitse Swierstra (Universiteit Utrecht) Programming contest awards presentation John Hughes et al. (Chalmers University of Technology) =============================================================================== Wednesday 27 August 2003 Session VII: 9:00-10:30 ----------------------- Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism Geoffrey Washburn, Stephanie Weirich (University of Pennsylvania) FreshML: Programming with binders made simple Mark Shinwell, Andrew Pitts, Murdoch Gabbay (University of Cambridge) Meta-programming through typeful code representation Chiyan Chen, Hongwei Xi (Boston University) Session VIII: 11:00-11:30 ------------------------- Optimistic evaluation: An adaptive evaluation strategy for non-strict programs Robert Ennals (University of Cambridge), Simon Peyton Jones (Microsoft Research) Invited talk (joint with PPDP'03): 11:30-12:30 ---------------------------------------------- Understanding aspects Mitchell Wand (Northeastern University) From anders_nygren2002@REDACTED Fri Aug 15 07:43:35 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Fri, 15 Aug 2003 07:43:35 +0200 (CEST) Subject: Debugger bug? Message-ID: <20030815054335.57572.qmail@web14601.mail.yahoo.com> In the debugger it seems that the evaluator does not work. I can enter stuff but nothing happen when I press return. I am running R9c on Suse 8.2 Anders Nygren Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From anders_nygren2002@REDACTED Fri Aug 15 07:57:05 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Fri, 15 Aug 2003 07:57:05 +0200 (CEST) Subject: gs editor bug ? Message-ID: <20030815055705.60706.qmail@web14606.mail.yahoo.com> I am trying to use the editor widget in gs, but have a problem with gs:read(Editor,char_height) which is supposed to return the "The height of the editor window measured in characters." according to the gs user's guide. But for me it always returns 24 no matter how large or small the editor happens to be. R9c on Suse 8.2 Anders Nygren Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From p-news@REDACTED Fri Aug 15 11:49:00 2003 From: p-news@REDACTED (Per Einar =?iso-8859-1?q?Str=F6mme?=) Date: Fri, 15 Aug 2003 11:49:00 +0200 Subject: ICFP 2003 / PLI 2003 -- final call for participation In-Reply-To: References: Message-ID: <200308151149.00926.p-news@telia.com> s Hej ! Trying to registering for the conference, but received a timeout waiting for a response (from http://regmaster.com/pli2003.html). Is this server in the electrical power outage belt of eastern USA/Canada ? Regards Per Einar -------------------------------------------------------------------------------- Per Einar Str?mme stromme@REDACTED -------------------------------------------------------------------------------- torsdagen den 14 augusti 2003 16.59 wrote Olin Shivers: > The following message is a courtesy copy of an article > that has been posted to > comp.lang.scheme,comp.lang.scheme.scsh,comp.lang.dylan,comp.lang.functional >,comp.lang.lisp,comp.lang.lisp.franz,comp.lang.lisp.mcl,comp.lang.lisp.x,com >p.lang.apl,comp.lang.clos as well. > > ICFP 2003, the International Conference on Functional Programming, will > be happening two weeks from now, 8/25-27. > > If you are contemplating registering for the conference, note that > on-line/remote registration closes on Friday (8/15) -- although > walk-in/on-site registration will be available up to and through the > conference. > > I append the programme of talks to this message. For more information, > see the conference web page > http://www.cc.gatech.edu/~shivers/icfp03/schedule.html > > -Olin Shivers > > --------------------------------------------------------------------------- >---- ICFP 2003 program > ----------------- > http://www.cc.gatech.edu/icfp03/schedule.html > http://www.cc.gatech.edu/icfp03/schedule.txt > Affiliated with PLI 2003 > August 25-29, 2003 > Uppsala, Sweden From jilani.khaldi@REDACTED Fri Aug 15 14:29:47 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Fri, 15 Aug 2003 14:29:47 +0200 Subject: Different results using Lists & tuples Message-ID: Hi All, having -module(statistics). -export([set_xi/0,...]). ... set_xi() -> Xi = [64,71,53,67,55,58,77,56,51,76,68], X1. %% (1) ... why statistics:set_xi() gives as result "@G5C7:M983LD" // seems a segment:offset memory address but if I change (1) in set_xi() -> Xi = {64,71,53,67,55,58,77,56,51,76,68}, X1. it gives {64,71,53,67,55,58,77,56,51,76,68} // as expected ? Thanks! jilani From Bengt.Kleberg@REDACTED Fri Aug 15 14:42:26 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Fri, 15 Aug 2003 14:42:26 +0200 Subject: Different results using Lists & tuples In-Reply-To: References: Message-ID: <3F3CD532.6080002@ericsson.com> Jilani Khaldi wrote: > Hi All, > > having > > -module(statistics). > -export([set_xi/0,...]). > ... > set_xi() -> Xi = [64,71,53,67,55,58,77,56,51,76,68], X1. %% (1) > ... > > why > > statistics:set_xi() > gives as result "@G5C7:M983LD" // seems a segment:offset memory address > this is a string. strings are represented by a list of integers, 0-255. do io:format( "~p~n", [statistics:set_xi()]). to see the list. or add an integer > 255 to the list. bengt From mikael.karlsson@REDACTED Fri Aug 15 15:41:50 2003 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 15 Aug 2003 15:41:50 +0200 Subject: Different results using Lists & tuples In-Reply-To: References: Message-ID: <200308151541.50773.mikael.karlsson@creado.com> Same problem as before Jilani, lists and strings are the same in erlang, for lists with values < 255. Use io:format("~w~n",[Yourlist]) 1> A=[64,71,53,67,55,58,77,56,51,76,68]. "@G5C7:M83LD" 2> B={64,71,53,67,55,58,77,56,51,76,68}. {64,71,53,67,55,58,77,56,51,76,68} 3> io:format("~w~n",[A]). [64,71,53,67,55,58,77,56,51,76,68] ok 4> io:format("~p~n",[A]). "@G5C7:M83LD" ok /Mikael fredag 15 augusti 2003 14:29 skrev Jilani Khaldi: > Hi All, > > having > > -module(statistics). > -export([set_xi/0,...]). > ... > set_xi() -> Xi = [64,71,53,67,55,58,77,56,51,76,68], X1. %% (1) > ... > > why > > statistics:set_xi() > gives as result "@G5C7:M983LD" // seems a segment:offset memory address > > but if I change (1) in > set_xi() -> Xi = {64,71,53,67,55,58,77,56,51,76,68}, X1. > it gives {64,71,53,67,55,58,77,56,51,76,68} // as expected ? > > Thanks! > > jilani From kent@REDACTED Fri Aug 15 23:15:45 2003 From: kent@REDACTED (Kent Boortz) Date: 15 Aug 2003 23:15:45 +0200 Subject: Opteron estone results Message-ID: Some interesting and affordable 64 bit platforms are showing up giving us a lot more real and virtual memory space to run Erlang in. I just tried building and running R9C estone on a AMD Opteron 1.4 GHz processor and FreeBSD. Opteron is a 64 bit processor with a very fast memory system. I built Erlang using gcc 3.2.2. I will get access to a PowerMac G5 soon. The IBM PowerPC G5 also a 64 bit processor and probably a very fast processor running Erlang as well, kent [Estone is part of the emulator test suite] http://www.erlang.org/project/test_server/index.html **** ESTONES = 79750 **** Title Millis Estone % Loops list manipulation 147 10311 7 6400 small messages 430 7217 10 1515 medium messages 807 7527 14 1527 huge messages 222 2237 4 52 pattern matching 110 7058 5 1046 traverse 170 2910 4 2834 Port i/o 1051 4247 12 4800 Work with large dataset 116 2407 3 1193 Work with large local dataset 94 2954 3 1174 Alloc and dealloc 59 2094 2 3710 Bif dispatch 141 5501 5 1623 Binary handling 189 2621 4 581 ets datadictionary 209 5335 6 342 Generic server (with timeout) 349 7197 9 7977 Small Integer arithmetics 139 2005 3 4157 Float arithmetics 29 1070 1 5526 Function calls 149 5210 5 882 Timers 100 1234 2 2312 Links 50 615 1 30 From vances@REDACTED Sat Aug 16 00:08:13 2003 From: vances@REDACTED (Vance Shipley) Date: Fri, 15 Aug 2003 18:08:13 -0400 Subject: Opteron estone results In-Reply-To: References: Message-ID: <20030815220813.GC2801@frogman.motivity.ca> Kent, Are these results using a 64-bit emulator? -Vance On Fri, Aug 15, 2003 at 11:15:45PM +0200, Kent Boortz wrote: } } Some interesting and affordable 64 bit platforms are showing up giving } us a lot more real and virtual memory space to run Erlang in. I just } tried building and running R9C estone on a AMD Opteron 1.4 GHz } processor and FreeBSD. Opteron is a 64 bit processor with a very fast } memory system. I built Erlang using gcc 3.2.2. } ... } **** ESTONES = 79750 **** From kent@REDACTED Sat Aug 16 06:57:28 2003 From: kent@REDACTED (Kent Boortz) Date: 16 Aug 2003 06:57:28 +0200 Subject: Opteron estone results In-Reply-To: <20030815220813.GC2801@frogman.motivity.ca> References: <20030815220813.GC2801@frogman.motivity.ca> Message-ID: Vance Shipley writes: > Are these results using a 64-bit emulator? Yes. % otp_src_R9C-0/bin/erl Erlang (BEAM) emulator version 5.3 [64-bit] [source] Eshell V5.3 (abort with ^G) 1> To make 100% sure I did % file otp_src_R9C-0/bin/amd64-unknown-freebsd5.1/beam otp_src_R9C-0/bin/amd64-unknown-freebsd5.1/beam: ELF 64-bit LSB executable, AMD x86-64, version 1 (FreeBSD), for FreeBSD 0.0.1, dynamically linked (uses shared libs), not stripped The FreeBSD support for opteron is experimental and the gcc 3.2.2 used is not very stable (had to go down to -O1 to compile "erl_vector.c") and probably not very optimized for opteron yet. I tried running a 32 bit Erlang to compare the 32 and 64 bit results but it segfaults. I'm sure there are more mature Linux ports to opteron and I think there will even be a Microsoft Windows version soon. If I exclude the port IO test and bypassed the test server I could run estone. In 32 bits on the same machine I get **** ESTONES = 69695 **** (not a true estone result, port io test is missing) Title Millis Estone % Loops list manipulation 229 6644 7 6400 small messages 451 6876 10 1515 medium messages 867 7010 14 1527 huge messages 253 1957 4 52 pattern matching 110 7027 5 1046 traverse 181 2743 4 2834 Work with large dataset 114 2454 3 1193 Work with large local dataset 104 2683 3 1174 Alloc and dealloc 56 2219 2 3710 Bif dispatch 147 5281 5 1623 Binary handling 220 2250 4 581 ets datadictionary 237 4700 6 342 Generic server (with timeout) 364 6903 9 7977 Small Integer arithmetics 131 2134 3 4157 Float arithmetics 23 1367 1 5526 Function calls 133 5814 5 882 Timers 112 1105 2 2312 Links 59 528 1 30 kent From bjarne@REDACTED Sat Aug 16 10:12:30 2003 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Sat, 16 Aug 2003 10:12:30 +0200 Subject: 2nd ACM SIGPLAN Erlang Workshop Message-ID: <006301c363ce$aade1600$e72469d4@segeltorp> Dear Erlang friends The 2nd ACM SIGPLAN Erlang Workshop will take place within a couple of weeks http://www.erlang.se/workshop/2003/ On-line/remote registration is closed but you are welcome for walk-in/on-site registration. If you intend to come, you can also send me a mail so I can notify the organisers. Best wishes Bjarne D?cker -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Sat Aug 16 17:04:25 2003 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 16 Aug 2003 08:04:25 -0700 (PDT) Subject: code size in memory Message-ID: <20030816150425.46468.qmail@web41903.mail.yahoo.com> Is there some way to see how much space a function or a module occupies when loaded? E.g., "size of bytecode". Best, Thomas __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com From vances@REDACTED Sat Aug 16 20:26:37 2003 From: vances@REDACTED (Vance Shipley) Date: Sat, 16 Aug 2003 14:26:37 -0400 Subject: Opteron estone results In-Reply-To: References: <20030815220813.GC2801@frogman.motivity.ca> Message-ID: <20030816182637.GC8689@frogman.motivity.ca> On Sat, Aug 16, 2003 at 06:57:28AM +0200, Kent Boortz wrote: } } Erlang (BEAM) emulator version 5.3 [64-bit] [source] Kent, What change would enabling threads make to the results? -Vance From kent@REDACTED Sat Aug 16 23:03:07 2003 From: kent@REDACTED (Kent Boortz) Date: 16 Aug 2003 23:03:07 +0200 Subject: Opteron estone results In-Reply-To: <20030816182637.GC8689@frogman.motivity.ca> References: <20030815220813.GC2801@frogman.motivity.ca> <20030816182637.GC8689@frogman.motivity.ca> Message-ID: Vance Shipley writes: > What change would enabling threads make to the results? I don't expect it to change the results at all for estone. The machine I test on is a single processor system (built from parts < $1000, Tyan Tomcat K8S, S2850 motherboard). I did rebuild with --enable-threads and run estone with 0, 4 and 100 threads and the score was about the same, kent From vances@REDACTED Sat Aug 16 23:33:29 2003 From: vances@REDACTED (Vance Shipley) Date: Sat, 16 Aug 2003 17:33:29 -0400 Subject: Opteron estone results In-Reply-To: References: <20030815220813.GC2801@frogman.motivity.ca> <20030816182637.GC8689@frogman.motivity.ca> Message-ID: <20030816213329.GD8689@frogman.motivity.ca> Kent, I thought the file IO was supposed to be improved when threads were enabled. The estone tests probably don't exercise this though (I haven't played with estones in a couple years) although the whole system does have to use file IO. -Vance On Sat, Aug 16, 2003 at 11:03:07PM +0200, Kent Boortz wrote: } } I don't expect it to change the results at all for estone. The machine From vances@REDACTED Sun Aug 17 01:36:47 2003 From: vances@REDACTED (Vance Shipley) Date: Sat, 16 Aug 2003 19:36:47 -0400 Subject: Is it safe to use driver_event()? Message-ID: <20030816233647.GE8689@frogman.motivity.ca> I'm building a dynamically linked in driver and I really need to have the poll() version of driver_select() because my file handles are used with STREAMS and I need to maintain the extra data which poll() handles. I was happy to find the existance of the driver_event() function which does exactly what I need: EXTERN int driver_event(ErlDrvPort port, ErlDrvEvent event, ErlDrvEventData event_data); ... and the associated callback: void (*event)(ErlDrvData drv_data, ErlDrvEvent event, ErlDrvEventData event_data); /* Called when an event selected by driver_event() has occurred */ It is however not documented, and of even more concern, not used anywhere. Is this feature considered fully implemented? How much trouble am I asking for if I use it? -Vance From rprice@REDACTED Sun Aug 17 00:55:22 2003 From: rprice@REDACTED (Roger Price) Date: Sun, 17 Aug 2003 00:55:22 +0200 (CEST) Subject: erl_scan:string ignores /' and /" Message-ID: "Concurrent Programming in Erlang", chapter 2.1.2 says "Within a quoted atom the following conventions apply"... Chapter 2.1.4 says "Within a string the quoting conventions used within an atom also apply." However erl_scan:string/1 seems to ignore \' and \". Here are the results for all the conventions: 15> erl_scan:string("\b") . {ok,[],1} 16> erl_scan:string("\d") . {ok,[{'\d',1}],1} 17> erl_scan:string("\e") . {ok,[],1} 18> erl_scan:string("\f") . {ok,[],1} 19> erl_scan:string("\n") . {ok,[],2} 20> erl_scan:string("\r") . {ok,[],1} 21> erl_scan:string("\t") . {ok,[],1} 22> erl_scan:string("\v") . {ok,[],1} 23> erl_scan:string("\\") . {ok,[{'\\',1}],1} 24> erl_scan:string("\^A") . {ok,[],1} 25> erl_scan:string("\'") . {error,{1,erl_scan,{string,39,[]}},1} 26> erl_scan:string("\"") . {error,{1,erl_scan,{string,34,[]}},1} 27> erl_scan:string("\266") . {ok,[{'?',1}],1} 28> erl_scan:string("\266\ 28> \266") . {ok,[{'?',1},{'?',2}],2} Roger From joe@REDACTED Sun Aug 17 21:37:03 2003 From: joe@REDACTED (Joe Armstrong) Date: Sun, 17 Aug 2003 21:37:03 +0200 (CEST) Subject: erl_scan:string ignores /' and /" In-Reply-To: Message-ID: I think things are as they should be. writing\C is just the same as writing C if C is not a one of the special formatting characters s,n,r,... ^ or an octal digit Thus \' is just the same as ' \" is just the same as " thus erl_scan:string("\''") is the same as erl_scan:string("'") which should give an error since ' is NOT a valid token, it is the start of an atom. try say, > erl_scan:string("\'a\'"). {ok,[{atom,1,a}],1} Queries 25 and 26 seem correct since erl_scan:string expects a string containing completed tokens. For incomplete stings you can call the re-entrant scanner erl_scan:tokens, like this: 1> erl_scan:tokens("", "\'", 1). {more,{[{'\'',1}],"'",1,1}} 2> {more, M} = v(-1). {more,{[{'\'',1}],"'",1,1}} 3> erl_scan:tokens(M, "abc'", 1). {more,{[],"'cba'",1,1}} 4> {more,M1}=v(-1). {more,{[],"'cba'",1,1}} 5> erl_scan:tokens(M1, ",123. ", 1). {more,{[{'\'',1}],"'.321,'cba'",1,1}} 6> erl_scan:tokens(M1, ",123. ", 1). {done,{ok,[{atom,1,abc},{',',1},{integer,1,123},{dot,1}],1},[]} Hope that helps /Joe On Sun, 17 Aug 2003, Roger Price wrote: > "Concurrent Programming in Erlang", chapter 2.1.2 says "Within a quoted > atom the following conventions apply"... Chapter 2.1.4 says "Within a > string the quoting conventions used within an atom also apply." However > erl_scan:string/1 seems to ignore \' and \". Here are the results for all > the conventions: > > 15> erl_scan:string("\b") . > {ok,[],1} > 16> erl_scan:string("\d") . > {ok,[{'\d',1}],1} > 17> erl_scan:string("\e") . > {ok,[],1} > 18> erl_scan:string("\f") . > {ok,[],1} > 19> erl_scan:string("\n") . > {ok,[],2} > 20> erl_scan:string("\r") . > {ok,[],1} > 21> erl_scan:string("\t") . > {ok,[],1} > 22> erl_scan:string("\v") . > {ok,[],1} > 23> erl_scan:string("\\") . > {ok,[{'\\',1}],1} > 24> erl_scan:string("\^A") . > {ok,[],1} > 25> erl_scan:string("\'") . > {error,{1,erl_scan,{string,39,[]}},1} > 26> erl_scan:string("\"") . > {error,{1,erl_scan,{string,34,[]}},1} > 27> erl_scan:string("\266") . > {ok,[{'?',1}],1} > 28> erl_scan:string("\266\ > 28> \266") . > {ok,[{'?',1},{'?',2}],2} > > Roger > > erl From Marc.Vanwoerkom@REDACTED Mon Aug 18 01:44:26 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Mon, 18 Aug 2003 01:44:26 +0200 (MEST) Subject: Parallelism and compilers Message-ID: <200308172344.h7HNiQk23771@bonsai.fernuni-hagen.de> I had a discussion with a friend if Erlang would make a nice language for writing compilers, e.g. writing a C compiler. Is there more useful than a parallel make? I.e. are there stages during compilation that would benefit from distribution/concurrency? Regards, Marc From Bruce@REDACTED Mon Aug 18 11:15:24 2003 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 18 Aug 2003 21:15:24 +1200 Subject: Mnesia tables: load times and sizes after deletion References: <76E5F712842F5F49A35738622BAA0F4F9EA6CB@ESEALNT442.al.sw.ericsson.se> Message-ID: <124e01c36569$41fbfa70$0a21970a@norris> Hi Ulf, > Are you sure the tables were created under R9B? > If so, are you sure they are dets files (.DAT when using > mnesia)? Ahhh....no they are disk logs, as you said. > Granted, I've been on a long vacation and my brain may not > have engaged fully yet, but I recall that disc_copies are > stored on disk in disk_log format (mnesia gives them the > extension .DCD), and not as dets files. Disc_only copies > are stored as dets files. Your brain is fine. I wasn't aware that the options had such a dramatic difference in implementation. Its is good to know. > The file size should adjust at every log dump, > and a load time of minutes seems a bit slow, perhaps, but > I wouldn't want to swear that it's abnormal. How can I force a log dump? Do they happen periodically under Mnesia or do I need to initiate a backup or something? I've never seen the internals of Mnesia documented to this extent (although whenever I say this it is immediately pointed out in the place I've been looking...). Thanks for the help. /Bruce From dgud@REDACTED Mon Aug 18 11:47:00 2003 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 18 Aug 2003 11:47:00 +0200 Subject: Mnesia tables: load times and sizes after deletion In-Reply-To: <124e01c36569$41fbfa70$0a21970a@norris> References: <76E5F712842F5F49A35738622BAA0F4F9EA6CB@ESEALNT442.al.sw.ericsson.se> <124e01c36569$41fbfa70$0a21970a@norris> Message-ID: <16192.41108.403681.168350@rian.du.uab.ericsson.se> Bruce Fitzsimons writes: > > > The file size should adjust at every log dump, > > and a load time of minutes seems a bit slow, perhaps, but > > I wouldn't want to swear that it's abnormal. > > How can I force a log dump? mnesia:dump_log() > Do they happen periodically under Mnesia or do I > need to initiate a backup or something? Default it's every thousend write or third minute if I remember correctly. But that moves the updates (for disc_copies) to another log TAB.DCL which contains the table specific updates. A new DCD file is generated when the DCL is larger than 1/4 of the DCD size. > I've never seen the internals of > Mnesia documented to this extent (although whenever I say this it is > immediately pointed out in the place I've been looking...). > > Thanks for the help. > > /Bruce > From bry@REDACTED Tue Aug 19 14:27:18 2003 From: bry@REDACTED (bryan) Date: Tue, 19 Aug 2003 14:27:18 +0200 Subject: erlang on WinCE In-Reply-To: <000d01c35e90$412f3420$6400a8c0@ituniv398> Message-ID: <000001c3664d$3bbe7b80$2001a8c0@bryans> Is there an erlang distribution that will work on WinCE, if so can anyone point me to it? Thanks. From bry@REDACTED Tue Aug 19 15:58:40 2003 From: bry@REDACTED (bryan) Date: Tue, 19 Aug 2003 15:58:40 +0200 Subject: erlang on WinCE In-Reply-To: <000001c3664d$3bbe7b80$2001a8c0@bryans> Message-ID: <000001c36659$ff167450$2001a8c0@bryans> >Is there an erlang distribution that will work on WinCE, if so can >anyone point me to it? Thanks. Ah, never mind, I guess that would be the embedded_nt part :) From vances@REDACTED Tue Aug 19 16:10:38 2003 From: vances@REDACTED (Vance Shipley) Date: Tue, 19 Aug 2003 10:10:38 -0400 Subject: port_call flags? Message-ID: <20030819141038.GI14794@frogman.motivity.ca> The driver callback call() has a "flags" field which is undocumented. The erl_driver.h header file includes a define which suggests it's use: /* Constants for return flags from the 'port_call' callback */ #define DRIVER_CALL_KEEP_BUFFER 0x1 Can anyone provide me some insight about this? -Vance int call(ErlDrvData drv_data, unsigned int command, char *buf, int len, char **rbuf, int rlen, unsigned int *flags) From rpettit@REDACTED Tue Aug 19 19:47:48 2003 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 19 Aug 2003 10:47:48 -0700 Subject: No epmd built/installed with erl_interface on R9C-0? Message-ID: <20030819174748.GE32544@vailsys.com> I just noticed that although there appear to be ei_epmd_* sources with the R9C-0 ErlInterface library, they do not get built or installed. Are these safe to use, or still works in progress? If indeed they are safe to use, why did they not get built/installed with the rest of ErlInterface? -Rick From rpettit@REDACTED Tue Aug 19 20:18:45 2003 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 19 Aug 2003 11:18:45 -0700 Subject: No epmd built/installed with erl_interface on R9C-0? In-Reply-To: <20030819174748.GE32544@vailsys.com> References: <20030819174748.GE32544@vailsys.com> Message-ID: <20030819181845.GF32544@vailsys.com> On Tue, Aug 19, 2003 at 10:47:48AM -0700, Rick Pettit wrote: > I just noticed that although there appear to be ei_epmd_* sources with the > R9C-0 ErlInterface library, they do not get built or installed. Are these safe > to use, or still works in progress? If indeed they are safe to use, why did > they not get built/installed with the rest of ErlInterface? Sorry, finally screwed my head back on. Please disregard. -Rick From mlogan@REDACTED Tue Aug 19 22:55:33 2003 From: mlogan@REDACTED (Martin J. Logan) Date: 19 Aug 2003 15:55:33 -0500 Subject: 2nd ACM SIGPLAN Erlang Workshop In-Reply-To: <006301c363ce$aade1600$e72469d4@segeltorp> References: <006301c363ce$aade1600$e72469d4@segeltorp> Message-ID: <1061326532.24603.16.camel@dhcp-lom-194-186.futuresource.com> EUC 2003???? On Sat, 2003-08-16 at 03:12, Bjarne D?cker wrote: > Dear Erlang friends > > The 2nd ACM SIGPLAN Erlang Workshop will > take place within a couple of weeks > > http://www.erlang.se/workshop/2003/ > > On-line/remote registration is closed but you are > welcome for walk-in/on-site registration. > > If you intend to come, you can also send me > a mail so I can notify the organisers. > > Best wishes > > Bjarne D?cker > From bjarne@REDACTED Wed Aug 20 12:18:54 2003 From: bjarne@REDACTED (=?UTF-8?Q?Bjarne_D=C3=A4cker?=) Date: Wed, 20 Aug 2003 12:18:54 +0200 Subject: 2nd ACM SIGPLAN Erlang Workshop and EUC'2003 ?! References: <006301c363ce$aade1600$e72469d4@segeltorp> <1061326532.24603.16.camel@dhcp-lom-194-186.futuresource.com> Message-ID: <002601c36704$78400ee0$9d1369d4@segeltorp> Hello The Erlang/OTP team and myself will organise an Erlang User Conference in Stockholm in November this year. It will be the 9th since we started and has been an annual event since 1994 (only missing 1996). The ACM SIGPLAN Erlang Workshops are part of the PLI's which alternate between North America and Europe. Last year it was in Pittsburgh and this year it happens to be in Uppsala. As soon as the workshop is over and we have settled on a suitable date we will send out a call-for-paper for EUC'2003. Best regards Bjarne ----- Original Message ----- From: "Martin J. Logan" To: "Bjarne D?cker" Cc: "Erlang Questions" Sent: Tuesday, August 19, 2003 10:55 PM Subject: Re: 2nd ACM SIGPLAN Erlang Workshop EUC 2003???? On Sat, 2003-08-16 at 03:12, Bjarne D?cker wrote: > Dear Erlang friends > > The 2nd ACM SIGPLAN Erlang Workshop will > take place within a couple of weeks > > http://www.erlang.se/workshop/2003/ > > On-line/remote registration is closed but you are > welcome for walk-in/on-site registration. > > If you intend to come, you can also send me > a mail so I can notify the organisers. > > Best wishes > > Bjarne D?cker > From massimo.cesaro@REDACTED Wed Aug 20 09:08:39 2003 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: 20 Aug 2003 09:08:39 +0200 Subject: Using references from the shell? Message-ID: <1061363321.1962.22.camel@xam> Hi, this is my first post on this list, but we studying/learning/using Erlang since June. We are developing a softswitch application using Erlang and OTP and me and my team are really amazed of what we can accomplish using this wonderful middleware in record time. Several of modules in the application have functions taking references (created with make_ref()) as parameters. I'd like to test those functions manually, using the Erlang shell, but the shell parser balks when I try to input a reference by hand. I.e. 153> otr:connect(Source, Dest, #Ref<0.0.0.4363>, bridge). ** 1: syntax error before: Ref ** I tried several variations on the theme, with the same result. In this case, the reference value I'm using was generated internally by another module (using make_ref()), and stored in an ets table. I should check for reference value equality. I understand that what I see in the shell is just a "rendering" of the real reference (I read a former thread in this list about the real format of references, courtesy of Rickard Green). The question is, can I handle references from the shell, or am I supposed to write a test module and pass references as opaque values? Thanks, Massimo Cesaro - Eidetix From jozsef.berces@REDACTED Wed Aug 20 15:47:09 2003 From: jozsef.berces@REDACTED (Jozsef Berces (PR/ECZ)) Date: Wed, 20 Aug 2003 15:47:09 +0200 Subject: MPH Message-ID: Does anyone have any MPH "driver" for Erlang? Or anything that could help writing tools for SEA in Erlang? Thanks in advance, Jozsef From bjorn@REDACTED Wed Aug 20 16:01:11 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Aug 2003 16:01:11 +0200 Subject: compiler internal error In-Reply-To: References: Message-ID: The bug has been fixed in R9C. /Bjorn "WILLIAMS Dominic" writes: > Hello, > > The following (incorrect) code produces an internal compiler error (R9B under Win2000) > > -module(testing). > -export([run/0,fun1/0]). > > run() -> > {ok,fun1/0} = e3:run_tests([fun fun1/0]). > > fun1() -> > ok = ok. > > Here is the output: > > ./testing.erl:none: internal error in v3_core; > crash reason: {{case_clause,{'EXIT',{'EXIT', > {function_clause, > [{v3_core, > pattern, > [{op,5, > '/', > {atom,5,fun1}, > {integer,5,0}}]}, > {lists,map,2}, > {v3_core,pattern,1}, > {v3_core,expr,2}, > {v3_core,exprs,2}, > {v3_core,clause,2}, > {v3_core,clauses,2}, > {v3_core,body,3}| > more]}}}}, > [{compile,'-select_passes/2-anonymous-2-',2}, > {compile,'-internal_comp/4-anonymous-1-',2}, > {compile,fold_comp,3}, > {compile,internal_comp,4}, > {compile,internal,3}]} > error > > I know what is wrong with the code, but just wanted to let you know about the compiler crash. > > Regards, > > Dominic. > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From bjorn@REDACTED Wed Aug 20 16:09:27 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Aug 2003 16:09:27 +0200 Subject: Opteron estone results In-Reply-To: <20030816213329.GD8689@frogman.motivity.ca> References: <20030815220813.GC2801@frogman.motivity.ca> <20030816182637.GC8689@frogman.motivity.ca> <20030816213329.GD8689@frogman.motivity.ca> Message-ID: It is not file I/O that is tested but "pipe I/O", that is communicating with a port program started with open_port({spawn,...}, ...). /Bjorn Vance Shipley writes: > Kent, > > I thought the file IO was supposed to be improved when threads were > enabled. The estone tests probably don't exercise this though (I > haven't played with estones in a couple years) although the whole > system does have to use file IO. > > -Vance > > On Sat, Aug 16, 2003 at 11:03:07PM +0200, Kent Boortz wrote: > } > } I don't expect it to change the results at all for estone. The machine > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From Chandrashekhar.Mullaparthi@REDACTED Wed Aug 20 16:14:31 2003 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Wed, 20 Aug 2003 15:14:31 +0100 Subject: Using references from the shell? Message-ID: Hi, I dont think you can create a reference manually. But if you want to see the contents of a reference, you can do term_to_binary(Ref) to see what it contains. Erlang (BEAM) emulator version 5.2 [threads:0] Eshell V5.2 (abort with ^G) 1> 1> 1> term_to_binary(make_ref()). <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0, 0,0, 0,111,0,0,0,0,...>> 2> 2> 2> io:format("~p~n", [v(-1)]). <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0, 0,0, 0,111,0,0,0,0,0,0,0,0>> ok 3> cheers Chandru > -----Original Message----- > From: Massimo Cesaro [mailto:massimo.cesaro@REDACTED] > Sent: 20 August 2003 08:09 > To: erlang-questions@REDACTED > Subject: Using references from the shell? > > > Hi, > this is my first post on this list, but we studying/learning/using > Erlang since June. > We are developing a softswitch application using Erlang and OTP and me > and my team are really amazed of what we can accomplish using this > wonderful middleware in record time. > Several of modules in the application have functions taking references > (created with make_ref()) as parameters. I'd like to test those > functions manually, using the Erlang shell, but the shell parser balks > when I try to input a reference by hand. I.e. > > 153> otr:connect(Source, Dest, #Ref<0.0.0.4363>, bridge). > ** 1: syntax error before: Ref ** > > I tried several variations on the theme, with the same result. > > In this case, the reference value I'm using was generated > internally by > another module (using make_ref()), and stored in an ets > table. I should > check for reference value equality. > I understand that what I see in the shell is just a > "rendering" of the > real reference (I read a former thread in this list about the real > format of references, courtesy of Rickard Green). > The question is, can I handle references from the shell, or am I > supposed to write a test module and pass references as opaque values? > > Thanks, > Massimo Cesaro - Eidetix > > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From bernardp@REDACTED Wed Aug 20 16:27:45 2003 From: bernardp@REDACTED (Pierpaolo BERNARDI) Date: Wed, 20 Aug 2003 16:27:45 +0200 Subject: Using references from the shell? References: <1061363321.1962.22.camel@xam> Message-ID: <00fa01c36727$3a1d73a0$81f06850@c1p4e3> From: "Massimo Cesaro" > The question is, can I handle references from the shell, or am I > supposed to write a test module and pass references as opaque values? As far as I understand, the whole point of references is that they are unforgeable. If there existed a way to obtain the reference from its printed representation then this would be vanified. Perhaps you can do: R = ets:lookup(...), func(R). ?? Ciao P. From paris@REDACTED Wed Aug 20 18:55:02 2003 From: paris@REDACTED (Javier =?iso-8859-1?Q?Par=EDs_Fern=E1ndez?=) Date: Wed, 20 Aug 2003 18:55:02 +0200 Subject: Bug in erl_interface in R9C? Message-ID: <20030820165502.GA6806@dc.fi.udc.es> Hi, I think there's a bug in ei_decode_longlong when decoding integers bigger than 2^32. --- otp_src_R9C-0/lib/erl_interface/src/decode/decode_longlong.c~ 2003-08-20 18:01:54.000000000 +0200 +++ otp_src_R9C-0/lib/erl_interface/src/decode/decode_longlong.c 2003-08-20 18:19:18.000000000 +0200 @@ -51,7 +51,7 @@ int pos, shift = 0; n = 0; for (pos = 0; pos < arity; pos++) { - n |= get8(s) << shift; + n |= ((EI_LONGLONG) get8(s)) << shift; shift += 8; } } The result of get8(s) << shift is an integer, but when the shift makes the number bigger than 2^32 the remaining bits are discarded. Putting a cast to force the result to be 64 bits solves the problem. Regards. From massimo.cesaro@REDACTED Wed Aug 20 17:59:22 2003 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: 20 Aug 2003 17:59:22 +0200 Subject: Using references from the shell? In-Reply-To: <00fa01c36727$3a1d73a0$81f06850@c1p4e3> References: <1061363321.1962.22.camel@xam> <00fa01c36727$3a1d73a0$81f06850@c1p4e3> Message-ID: <1061395163.1963.42.camel@xam> On Wed, 2003-08-20 at 16:27, Pierpaolo BERNARDI wrote: > From: "Massimo Cesaro" > > > The question is, can I handle references from the shell, or am I > > supposed to write a test module and pass references as opaque values? > > As far as I understand, the whole point of references is that they are > unforgeable. If there existed a way to obtain the reference from > its printed representation then this would be vanified. I (naively?) thought that references are really for creating unique values even on a distributed system. I never thought to them as unforgeable values. Anyway, I found a workaround for testing my modules from the shell. The trick is in using a shell variable to hold the reference value: 62> Ref=otr_switch:get_call_id(otr_switch:resolve("aaln/1@[192.168.0.16]", "555", [])). #Ref<0.0.0.1637> Now the Rf variable holds the value of the make_ref()'ed call id returned by otr_switch:resolve/3. otr_switch:get_call_id/1 is just a helper that extracts the reference from a list. Then I can use the reference like this: 63>otr_switch:connection("aaln/1@[192.168.0.16]", "aaln/2@[192.168.0.16]",Ref,bridge). true > > Perhaps you can do: > > R = ets:lookup(...), func(R). > > ?? > > Ciao > P. > Thanks for the info, Massimo From erik.ej.reitsma@REDACTED Wed Aug 20 16:42:54 2003 From: erik.ej.reitsma@REDACTED (Erik Reitsma EJ (RY/ETM)) Date: Wed, 20 Aug 2003 16:42:54 +0200 Subject: Using references from the shell? Message-ID: <440A2703A54A8F4FB2AC2AE34F27129D054958C6@ESEALNT889.al.sw.ericsson.se> > As far as I understand, the whole point of references is that they are > unforgeable. If there existed a way to obtain the reference from > its printed representation then this would be vanified. You can still do: 1> R=make_ref(). #Ref<0.0.0.102> 2> B=term_to_binary(R). <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0, 0,102,0,0,0,0,...>> 3> io:format("~w~n",[B]). <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0, 0,102,0,0,0,0,0,0,0,0>> ok 4> BCopy = <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115 ,116,0,0,0,0,102,0,0,0,0,0,0,0,0>>. <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0, 0,102,0,0,0,0,...>> 5> R2=binary_to_term(BCopy). #Ref<0.0.0.102> 6> R==R2. true 7> So I do not know what you mean by "forging", but I can create my own references in this way. *Erik. From vances@REDACTED Wed Aug 20 23:16:29 2003 From: vances@REDACTED (Vance Shipley) Date: Wed, 20 Aug 2003 17:16:29 -0400 Subject: open_port/2 overloading Message-ID: <20030820211628.GA21374@frogman.motivity.ca> It is unfortunate that the open_port/2 BIF is overloaded to handle drivers. The result is that opening a port always succeeds: Erlang (BEAM) emulator version 5.3 [source] [hipe] Eshell V5.3 (abort with ^G) 1> P = open_port({spawn, 'bogus_drv'}, []). sh: bogus_drv: not found #Port<0.28> 2> is_port(P). true This is because if there is no currently loaded driver with the name "bogus_drv" it will start a Unix shell to run the command "bogus_drv". The shell get's started therefore we get an opened port. It would be nice to have an explicit method to open ports on drivers which would fail appropriately. -Vance From wolfoxbr@REDACTED Wed Aug 20 22:38:40 2003 From: wolfoxbr@REDACTED (Roberto Amorim) Date: Wed, 20 Aug 2003 17:38:40 -0300 Subject: Bug in erl_interface in R9C? References: <20030820165502.GA6806@dc.fi.udc.es> Message-ID: > The result of get8(s) << shift is an integer, but when the shift makes the > number bigger than 2^32 the remaining bits are discarded. Putting a cast > to force the result to be 64 bits solves the problem. What about the performance? Unnecessary casts are a common source of unwanted performance problems. Best regards, Roberto From vances@REDACTED Thu Aug 21 08:53:52 2003 From: vances@REDACTED (Vance Shipley) Date: Thu, 21 Aug 2003 02:53:52 -0400 Subject: Can't send a long from a driver? Message-ID: <20030821065352.GE21374@frogman.motivity.ca> It seems the "driver term format" does not include support for integers greater than a signed int. To send an integer in from a driver you can do this: ErlDriverTermData reply[] = { ERL_DRV_INT, 100, }; driver_output_term(port, reply, (sizeof(reply) / sizeof(reply[0])); Despite the fact that ErlDriverTermData is actually an unsigned long If you try and send a long driver_output_term() will return -1 and the term won't be received. There are probably a few things missing from this list: Term type Argument(s) =========================================== ERL_DRV_NIL None ERL_DRV_ATOM driver_mk_atom(string) ERL_DRV_INT int ERL_DRV_PORT driver_mk_port(ix) ERL_DRV_BINARY ErlDriverBinary*, int len, int offset ERL_DRV_STRING char*, int len ERL_DRV_TUPLE int size ERL_DRV_LIST int size ERL_DRV_PID driver_connected,... ERL_DRV_STRING_CONS char*, int len I was beginning to panic but I realized that I can always send in a binary and make it into what I need on the other side. This is however rather kludgy for something as simple as an unsigned long (my current dilema). The strange thing is that ErlDriverTermData is actually an unsigned long! -Vance From bernardp@REDACTED Thu Aug 21 09:09:33 2003 From: bernardp@REDACTED (Pierpaolo BERNARDI) Date: Thu, 21 Aug 2003 09:09:33 +0200 Subject: Using references from the shell? References: <1061363321.1962.22.camel@xam> <00fa01c36727$3a1d73a0$81f06850@c1p4e3> <1061395163.1963.42.camel@xam> Message-ID: <00ee01c367b3$6139f120$e2f36850@c1p4e3> From: "Massimo Cesaro" > I (naively?) thought that references are really for creating unique > values even on a distributed system. I never thought to them as > unforgeable values. You and Erik are right, of course. "Unforgeable" is not the right word, as this word implies a much stronger difficulty. Cheers P. From joe@REDACTED Thu Aug 21 11:06:54 2003 From: joe@REDACTED (Joe Armstrong) Date: Thu, 21 Aug 2003 11:06:54 +0200 (CEST) Subject: The wrapper project Message-ID: I'm back .... (been on holiday) I've been thinking about stuff. Once upon a time I was interested in "how to program" I think that we now know how to do this (not perfectly, but adequately) - now I'm interested in "fitting things togther". I have convinced myself of the following: 1) Systems must be made of *isolated* components. 2) The components must communicate by asynchronous message passing ... (and a few more things which are not relevant to this discussion) Isolation is the *essential* characteristic. It means that if one component crashes, the other components must not themselves crash. Two processes running on the same machine should be as isolated as if one ran in (say) Sweden and the other in (say) the USA. What these process are written in (language) and what they run on (OS) is *irrelevant* - But the *protocol* between them is vital (hence my thoughts on UBF and the like (see www.sics.se/~joe/ubf). I would like to propose the construction of a series of "wrappers" - What is a wrapper? ================== A wrapper takes an application that is NOT a isolated component, and makes it into a component that IS an isolated component. Here's an example. Take something that is pretty nasty to build (say a media player like mplayer. Mplayer is currently commanded by mouse and keyboard events. I'd like to add a wrapper so I could control it from a socket, like this: +------------------+ | +----------+ | | | wrapper +------------------- socket ----- | +----+-----+ | | | | | +----------+ | | | mplayer | | | +----------+ | +------------------+ On a unix system the *entire* app is started thus: > startMediaPlayer Name PortNumber Thereafter we define a simple socket protocol to command the thing. (eventually UBF but not yet - for experimental purposes a simple byte protocol will do. example: byte 1 = 1 means start 2 stop 3 play movie (file name in bytes 2..) etc. Completed applications should then be delivered as statically linked binaries for a particular OS. Why (because it's very complicated to get the right combination of shared libraries to get arbitrary applications working properly). Having defined the *protocols* the components can be implements and distributed for different OSs. I am currently pursuing this idea. My first component should be a control wrapper round wxWindows so we can do GUI's - NOTE my view is that the GUI is itself a *component* which is isolated from the application which should be another component. (Thus controlling mplayer needs two components and one control process - The GUI component, the mplayer component, and a semantics process). As proof of concept it would be nice is somebody felt the urge to write a component according to this model. Say an image display component. This component would display an image (jpeg/gif) etc in an Xwindow (or on windoze) manipulate the image. NOTE the image component ONLY displays the image and has NO GUI - th GUI must be done by the GUI component (which I am trying to write :-) To start with I'd recommend the *simplest* possible protocols (Just bytes) NO XML, No cobra, etc. I will migrate to UBF when the appropriate encode/decode libraries are available. (If anybody cares to write a C++ UBF parser/deparser I'd be very grateful) So do we have some volunteers - /Joe PS - this could be fun. You can code in ANY language any OS, and do your favorite app. All you have to do is make sure that you application is *isolated* (no shared libraries) and is NOT controlled by a GUI (most important) but IS controlled by commands from a socket. It must also be started and stopped in a standardized was on each OS in question. (The start-stop API is not worked out) From kent@REDACTED Thu Aug 21 13:17:35 2003 From: kent@REDACTED (Kent Boortz) Date: 21 Aug 2003 13:17:35 +0200 Subject: The wrapper project In-Reply-To: References: Message-ID: Joe Armstrong writes: > What is a wrapper? > ================== > > A wrapper takes an application that is NOT a isolated component, and > makes it into a component that IS an isolated component. I think I suggested this at a SICS team workshop at L?ngholmen maybe 10 years back. We where writing an emulator and runtime system for the AKL language. For me the workshop was embarrassing and fun at the same time. I was forced to talk but had nothing to say so I put together a talk where I pretended to be 5 years ahead in time and described where our research and work with AKL was then. My main idea was to look at communication between programs in a larger perspective, "software agents", and part of this was encapsulate other software using "wrappers" to make all coexist and asynchronously talk to each other. I left SICS and I don't think the research at SICS did go the way I described and the only outcome from my talk was that we renamed AKL to "Agents" ;-) Shortly after, totally unrelated, "agent programming" became a hot subject in the research arena. There must be a lot written on the subject, kent From vlad_dumitrescu@REDACTED Thu Aug 21 13:39:45 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 21 Aug 2003 13:39:45 +0200 Subject: The wrapper project References: Message-ID: ----- Original Message ----- From: "Joe Armstrong" > I'm back .... (been on holiday) Welcome back! > I would like to propose the construction of a series of "wrappers" - Very interesting idea. > I am currently pursuing this idea. My first component should be a > control wrapper round wxWindows so we can do GUI's - NOTE my view is > that the GUI is itself a *component* which is isolated from the > application which should be another component. Looking forward to it :) > NOTE the image component ONLY displays the image and has NO GUI - the > GUI must be done by the GUI component (which I am trying to write :-) I think I don't really understand what you mean. If the image component can display something by itself, then it has a GUI (even if it's a dumb one). What would be needed here is a "remote canvas" created by the GUI component, and on which the application could draw. Alternatively, the application would describe for the GUI what to be drawn via the protocol - and we get the X basic setup. Or one could split into three layers, according to the Model-View-Controller pattern: the application knows how to manipulate the binary bitmap, the view knows how to display it, and the controller... well, it coordinates :) regards, Vlad From luke@REDACTED Thu Aug 21 13:54:32 2003 From: luke@REDACTED (Luke Gorrie) Date: 21 Aug 2003 13:54:32 +0200 Subject: The wrapper project In-Reply-To: References: Message-ID: Joe Armstrong writes: > I have convinced myself of the following: > > 1) Systems must be made of *isolated* components. > 2) The components must communicate by asynchronous message passing > ... (and a few more things which are not relevant to this discussion) Madness! One language! One address space! Surrender now and Emacs will be merciful! From joe@REDACTED Thu Aug 21 14:19:56 2003 From: joe@REDACTED (Joe Armstrong) Date: Thu, 21 Aug 2003 14:19:56 +0200 (CEST) Subject: The wrapper project In-Reply-To: Message-ID: On 21 Aug 2003, Luke Gorrie wrote: > Joe Armstrong writes: > > > I have convinced myself of the following: > > > > 1) Systems must be made of *isolated* components. > > 2) The components must communicate by asynchronous message passing > > ... (and a few more things which are not relevant to this discussion) > > Madness! > Thanks > One language! One address space! Surrender now and Emacs will be > merciful! Thus is is writ: .. 21. Yea, even though my program hath no errors, I say unto you that verily verily thy neighbours program shalt thy program crasheth. 22. Thus go thou and may it me done that thy program shall not it's address space mixether with ye others programs, and let it be done that thou program shall talk in many tongues to all the programs of the world. 23. And thus there will be great rejocing and singing in the streets and dancing, and celebration, and consuming of Freakstones old undrinkable mixtures. 24. And they that do not heed my world - yea I say unto you that their programs shall crasheth, not worketh and be delivered lateth - and there will be much nashing of teeth, bearing of breasts, and dispare throghout the land. Nebelkenizer Book 4 Chap 14 verses 21-24. /Joe From joe@REDACTED Thu Aug 21 14:39:11 2003 From: joe@REDACTED (Joe Armstrong) Date: Thu, 21 Aug 2003 14:39:11 +0200 (CEST) Subject: The wrapper project In-Reply-To: Message-ID: On Thu, 21 Aug 2003, Vlad Dumitrescu wrote: > ----- Original Message ----- > From: "Joe Armstrong" > > I'm back .... (been on holiday) > > Welcome back! > > > I would like to propose the construction of a series of "wrappers" - > > Very interesting idea. > > > I am currently pursuing this idea. My first component should be a > > control wrapper round wxWindows so we can do GUI's - NOTE my view is > > that the GUI is itself a *component* which is isolated from the > > application which should be another component. > > Looking forward to it :) > > > NOTE the image component ONLY displays the image and has NO GUI - the > > GUI must be done by the GUI component (which I am trying to write :-) > > I think I don't really understand what you mean. Like this: +----------------+ +-------------+ socket +----------------+ socket | +------------+ | | Generic GUI +----------+ Erlang process +-------------+ generic IO + | +-------------+ +----------------+ | +------------+ | | | | | +------------+ | | | Image | | | | canvas | | | +------------+ | +----------------+ The generic GUI is just that. A GUI which is controlled by the Erlang process. The Erlang process sends it {mk_window, ...} {add_button, ...} events. Events in the GUI resut in {button_pressed, ...} message being sent to Erlang. I assume the GUI does not know how to display an image. The Image component *only* knows how to display images and is commanded by {display_image, ...} {resize, ..} messages from Erlang. All three components could in principle run on *any* machine. (and Yes the GUI probably can display images - that's not the point The Image component could be anything (a music player, a movie player etc.) Most Apps are not structured like this - the GUI the logic and the application engine are mixed into one glorious mess which runs in the same address space - so a bug in one component crashes the other (innocent components) > > If the image component can display something by itself, then it has a GUI (even > if it's a dumb one). I don't consider it a GUI only a display. It has no "buttons" and can only display stuff. > What would be needed here is a "remote canvas" created by > the GUI component, and on which the application could draw. Alternatively, the > application would describe for the GUI what to be drawn via the protocol - and > we get the X basic setup. Or one could split into three layers, according to the > Model-View-Controller pattern: the application knows how to manipulate the > binary bitmap, the view knows how to display it, and the controller... well, it > coordinates :) I don't think it's Model-View-Controller How about the TV-Zapper-Controller model We have a TV which talks to a Controller We have a programmable zapper (remote control) which talks to the controller The controller can cause arbitrary buttons/entries etc to appear on the zapper. Messages from the zapper go the controller and result in commands going to both the zapper and the TV. /Joe > > regards, > Vlad > From vlad_dumitrescu@REDACTED Thu Aug 21 15:11:56 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 21 Aug 2003 15:11:56 +0200 Subject: The wrapper project References: Message-ID: Hi, > The generic GUI is just that. A GUI which is controlled by the > Erlang process. The Erlang process sends it {mk_window, ...} > {add_button, ...} events. > > Events in the GUI resut in {button_pressed, ...} message being sent > to Erlang. Yes, that part was clear even to me :) > I assume the GUI does not know how to display an image. > > The Image component *only* knows how to display images and is commanded > by {display_image, ...} {resize, ..} messages from Erlang. It is here I lost the track. To me, "displaying something" is tightly connected with a medium on which the resulting image will be visible. Only the GUI has the physical ability to actually show something on a screen (or similar). If the GUI gets a {display_image, ...} message, it has to be able to know what the binary data means and how to render it. >From your description, I figured you are meaning to let the knowledge about rendering JPEG images (for example) be a part of the imaging component. This means there has to be some generic drawing protocol between image-component and gui-component (like for example PostScript/PDF, or in the simplest variant raw pixel arrays). Is this what you meant? I'm asking because I thought I'd try to write such a component, but I need a more precise "specification" :-) > Most Apps are not structured like this - the GUI the logic and the > application engine are mixed into one glorious mess which runs in the > same address space - so a bug in one component crashes the other > (innocent components) True > > If the image component can display something by itself, then it has a GUI (even > > if it's a dumb one). > I don't consider it a GUI only a display. It has no "buttons" and > can only display stuff. It's a "read-only" interface :) >>Model-View-Controller pattern > How about the TV-Zapper-Controller model? Is the TV trying to display video on the zapper? /Vlad From joe@REDACTED Thu Aug 21 15:24:24 2003 From: joe@REDACTED (Joe Armstrong) Date: Thu, 21 Aug 2003 15:24:24 +0200 (CEST) Subject: The wrapper project In-Reply-To: <3F44C08C.3040509@web.de> Message-ID: On Thu, 21 Aug 2003, Joachim Durchholz wrote: > Joe Armstrong wrote: > > 2) The components must communicate by asynchronous message passing > > I have an exception to consider: > When composing subcomponents from components, Uugh - do you mean the other way around? You make components from sub-components ... ???? > *and* a crashing subcomponent shall crash the entire component, > *then* synchronous communication is appropriate. I assume you meant that 1) components are made from sub-components 2) if a sub-component crashes you want the component to crash To do this (if that's what you meant) I would like asynchronous messages. The problem with synchronous messages is that you can't implement them. The laws of physics preclude this. You need to send a message between the systems (which even at the speed of light takes finite time) to send information between the systems - you also change the state. > At least if that "synchronous communication" is a simple subroutine call > - emulating synchronous messages on top of an asynchronous layer like > Erlang's messages and pipes isn't doing much good. > But I wouldn't emulate synchronous messages on top of the messages and pipes I'd use discrete events or RPC's with timeouts. I would also make no assumptions about the cause of the absence of a message. /Joe > Just my 2c. > Flame me as appropriate :-) > > Regards, > Jo > From joe@REDACTED Thu Aug 21 15:54:17 2003 From: joe@REDACTED (Joe Armstrong) Date: Thu, 21 Aug 2003 15:54:17 +0200 (CEST) Subject: The wrapper project In-Reply-To: Message-ID: On Thu, 21 Aug 2003, Vlad Dumitrescu wrote: > Hi, > > > The generic GUI is just that. A GUI which is controlled by the > > Erlang process. The Erlang process sends it {mk_window, ...} > > {add_button, ...} events. > > > > Events in the GUI resut in {button_pressed, ...} message being sent > > to Erlang. > > Yes, that part was clear even to me :) > > > I assume the GUI does not know how to display an image. > > > > The Image component *only* knows how to display images and is commanded > > by {display_image, ...} {resize, ..} messages from Erlang. > > It is here I lost the track. To me, "displaying something" is tightly connected > with a medium on which the resulting image will be visible. Yes - in my model only the X component knows how to display a X. Here X = jpeg (it might have been (say) an mp3 file). > Only the GUI has the > physical ability to actually show something on a screen (or similar). To make it clearer I'll talk about music instead of images (I guess GUIs dont's understand how to play music :-) I had intended the generic GUI to be a device to which you send {mk_button,...} messages. When the user clicks on the button a {button_pressed, id} event is sent to the controller. Now a button *might* be an image (co-incidentally) - but it might be pattern of dots on a programmable braille device (for blind people) - it's a kind of abstract button if you see what I mean. To make it clearer suppose I have a controller and a music player. here are some message sequence diagrams, to show what happens where. GUI {add_entry,e1} Controller |-------<------------------------| | {add_button,b1,"play"} | |-------<------------------------| The gui now has an entry and a button The user fills in the title of a song in the entry and the presses the button GUI Controller Audio controller | {click, b1} | | |------->------------------------| | | {read,e1} | | |-------<------------------------| | | {e1,data,"song.mpg"} | | |------->------------------------| | | | {play_song,"song.mpg"} | {change_button_text,b1,"stop"}|------------->-------------| |--------------<-----------------| | Music plays - the button on the GUI changes to stop Now the user clicks the stop button GUI Controller Audio controller {click, b1} |------->------------------------| | | {set_entry,e1,""} | | |-------<------------------------| stop_playing | | {change_button_text,b1,"play"}|------------->-------------| |--------------<-----------------| | > gets a {display_image, ...} message, it has to be able to know what the binary > data means and how to render it. > > >From your description, I figured you are meaning to let the knowledge about > rendering JPEG images (for example) be a part of the imaging component. This > means there has to be some generic drawing protocol between image-component and > gui-component (like for example PostScript/PDF, or in the simplest variant raw > pixel arrays). > > Is this what you meant? No (see above) > > I'm asking because I thought I'd try to write such a component, but I need a > more precise "specification" :-) Here's the simplest possible spec: ========================================================================= Controller -> ImageEngine [1,N,"BBBBB"] (Display image) replies 1 (ok) 2 (no such file) - N = file name size - BB.. = file name [2,H1,H2,W1,W2] (set width/height) replies 1 (ok) 2 (no such file) To start the image engine > start_engine.sh 1234 The image engine starts and listens to port 1234 Now If I send the 9 byte message to port 1234 the image component will display the file "joe.jpg" (if it can find it) [1,7,$j,$o,$e,$.,$j,$p,$g] It replies with the one byte message 1 if it can do this otherwise 2 Later we can add *bells and whistles* and use UBF for *specifying* the messaging. ===================================================================== > > > Most Apps are not structured like this - the GUI the logic and the > > application engine are mixed into one glorious mess which runs in the > > same address space - so a bug in one component crashes the other > > (innocent components) > > True > > > > If the image component can display something by itself, then it has a GUI > (even > > > if it's a dumb one). > > I don't consider it a GUI only a display. It has no "buttons" and > > can only display stuff. > > It's a "read-only" interface :) > > >>Model-View-Controller pattern > > How about the TV-Zapper-Controller model? > Is the TV trying to display video on the zapper? > No no no. The zapper only knows how to make "abstract buttons" and it knows when one of it's buttons has been clicked. Nothing else. (well a little more, say buttons, entries, combo-boxes etc.) but not *too* much. *only* the TV knows how to display the picture. /Joe > /Vlad > From joachim.durchholz@REDACTED Thu Aug 21 16:02:26 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Thu, 21 Aug 2003 16:02:26 +0200 Subject: The wrapper project In-Reply-To: References: Message-ID: <3F44D0F2.7040203@web.de> Joe Armstrong wrote: > On Thu, 21 Aug 2003, Joachim Durchholz wrote: >>Joe Armstrong wrote: >> >>>2) The components must communicate by asynchronous message passing >> >>I have an exception to consider: >>When composing subcomponents from components, > > Uugh - do you mean the other way around? > > You make components from sub-components ... ???? You're right. A bad case of one too many edits in a message... >>*and* a crashing subcomponent shall crash the entire component, >>*then* synchronous communication is appropriate. > > I assume you meant that > > 1) components are made from sub-components > 2) if a sub-component crashes you want the component to crash > > To do this (if that's what you meant) I would like asynchronous messages. > > The problem with synchronous messages is that you can't implement > them. The laws of physics preclude this. You need to send a message > between the systems (which even at the speed of light takes finite > time) to send information between the systems - you also change the > state. To give any sense to the moniker "asynchronous communication", you need to define something sensible for "synchronous communication". Which, in my book, means that each request is guaranteed to be followed by a response, with no intermediate external activity of the server object. Regards, Jo From Laszlo.Varga@REDACTED Thu Aug 21 16:46:15 2003 From: Laszlo.Varga@REDACTED (Laszlo Varga) Date: Thu, 21 Aug 2003 16:46:15 +0200 (MEST) Subject: why isolated components Message-ID: <200308211446.h7LEkFD03507@duna273.eth.ericsson.se> Hello, may I have a very basic question? The component based systems has proofed the basic idea of decomposition. In mechanics, you must have components to get something move. Since the invention of the wheel everybody goes for components, but only some knows why. Really, why? What are the (main) motivations for kind a system? It might sound stupid, but I hope that the precise answer for this would help the rest of thinking. Cheers Laszlo From joachim.durchholz@REDACTED Thu Aug 21 17:04:03 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Thu, 21 Aug 2003 17:04:03 +0200 Subject: why isolated components In-Reply-To: <200308211446.h7LEkFD03507@duna273.eth.ericsson.se> References: <200308211446.h7LEkFD03507@duna273.eth.ericsson.se> Message-ID: <3F44DF63.7080406@web.de> Laszlo Varga wrote: > Really, why? > What are the (main) motivations for kind a system? Let me rephrase, in the hopes that I understood your question correctly: What is the main motivation for isolating components? The answer is simple. If you double the number of names in a program, the number of unwanted possible interaction quadruples. More generally, for N items, you have N*(N-1)/2 possible interactions. The number of *intended* interactions between components grows roughly linearly (I think it's usually on the order of N*log(N), but whether it's really linear or not doesn't matter: the main point is that the number of wanted interactions is massively less than O(N*N)). In other words, the number of unwanted potential interactions grows in an approximately quadradic correlation with program size. To keep the number of potential interactions down, Parnas propagated "information hiding", cutting down on the number of interactions that a compiler will allow. (Information hiding is not intended to prevent programmers from looking into components, its for preventing components from looking into other components.) Just my thoughts on the subject. HTH Jo From per@REDACTED Thu Aug 21 16:09:52 2003 From: per@REDACTED (Per Bergqvist) Date: Thu, 21 Aug 2003 17:09:52 +0300 Subject: erl_marshal bug Message-ID: <200308211509.h7LF9rB01470@tessla.levonline.com> Hi, just noticed that the patch i submitted for R8B-x did not make it into R9C-0 either. It fixes comparison of tuples of integers in erl_compare. (hint: try erl_compare with timestamps without it ...) /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R9C-0.patch-30 Type: application/octet-stream Size: 2054 bytes Desc: not available URL: From per@REDACTED Thu Aug 21 16:12:06 2003 From: per@REDACTED (Per Bergqvist) Date: Thu, 21 Aug 2003 17:12:06 +0300 Subject: fix for asn1 driver Message-ID: <200308211512.h7LFC7n01534@tessla.levonline.com> There is a debug printout that should be removed in the asn1 driver in R9C-0. Patch attached. /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R9C-0.patch-31 Type: application/octet-stream Size: 856 bytes Desc: not available URL: From paris@REDACTED Thu Aug 21 17:37:25 2003 From: paris@REDACTED (Javier =?iso-8859-1?Q?Par=EDs_Fern=E1ndez?=) Date: Thu, 21 Aug 2003 17:37:25 +0200 Subject: Bug in erl_interface in R9C? In-Reply-To: References: <20030820165502.GA6806@dc.fi.udc.es> Message-ID: <20030821153725.GA27579@dc.fi.udc.es> Hi, On Wed, Aug 20, 2003 at 05:38:40PM -0300, Roberto Amorim wrote: > > The result of get8(s) << shift is an integer, but when the shift makes the > > number bigger than 2^32 the remaining bits are discarded. Putting a cast > > to force the result to be 64 bits solves the problem. > > What about the performance? Unnecessary casts are a common source of > unwanted performance problems. Well, the code is only used with integers bigger than 2^32, so it does not affect normal integer decoding. The easy way to avoid making unnecessary casts would be to unroll the loop, but i don't think it's worth the effort. The nice way would be to read the number from s backwards, and shift n instead of the number from get8(s), but that would need changes to the putget functions. That would be nice, but i don't think the performance hit is that big to justify the change. Regards. From taavi@REDACTED Thu Aug 21 17:39:05 2003 From: taavi@REDACTED (Taavi Talvik) Date: Thu, 21 Aug 2003 18:39:05 +0300 (EEST) Subject: The wrapper project In-Reply-To: Message-ID: <20030821182814.T6686-100000@valu.uninet.ee> On Thu, 21 Aug 2003, Joe Armstrong wrote: > Having defined the *protocols* the components can be implements and > distributed for different OSs. > > I am currently pursuing this idea. My first component should be a > control wrapper round wxWindows so we can do GUI's - NOTE my view is > that the GUI is itself a *component* which is isolated from the > application which should be another component. > > (Thus controlling mplayer needs two components and one control > process - The GUI component, the mplayer component, and a semantics > process). > > As proof of concept it would be nice is somebody felt the urge to > write a component according to this model. I have been playing around with gtk binding built up similiar way. (look at http://home.uninet.ee/~taavi/files/erlang/xgs/). Basicly port driver with following interface: Object = create(Parent_object, "object_type"), config(Object,[{"parameter","value"}]), Paramter = read(Object, "parameter"), destroy(Object) However there are some issue I have stumbled upon: 1. Probably most gtk components/widgets should be quite high level and probably it erlang can only use them and not construct new ones. This is due to gtk callback model - constructing new widgets requires complex callbacks. For just using widgets events are enough. 2. Garbage collection. When object in erlang is garbage collected there is no way to inform foreign component. 3. Communicating data structures and efficient acces to them. For example - I can send deep list to gtk and display tree. However for modification are two options: either resend everything or design efficient foreign data access protocol (which adds tremendous complexity). best regards, taavi From cpressey@REDACTED Thu Aug 21 16:43:42 2003 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 21 Aug 2003 09:43:42 -0500 Subject: The wrapper project In-Reply-To: References: Message-ID: <20030821094342.76809e91.cpressey@catseye.mine.nu> On Thu, 21 Aug 2003 11:06:54 +0200 (CEST) Joe Armstrong wrote: > > I'm back .... (been on holiday) > > I've been thinking about stuff. > > Once upon a time I was interested in "how to program" I think that > we now know how to do this (not perfectly, but adequately) - now I'm > interested in "fitting things togther". > > I have convinced myself of the following: > > 1) Systems must be made of *isolated* components. > 2) The components must communicate by asynchronous message > passing... (and a few more things which are not relevant to this > discussion) > > Isolation is the *essential* characteristic. It means that if one > component crashes, the other components must not themselves crash. See also: protected memory. http://www.wikipedia.org/wiki/Protected_memory > Two > processes running on the same machine should be as isolated as if one > ran in (say) Sweden and the other in (say) the USA. > > What these process are written in (language) and what they run on > (OS) is *irrelevant* - But the *protocol* between them is vital (hence > my thoughts on UBF and the like (see www.sics.se/~joe/ubf). Then the protocol becomes the OS, for all intents and purposes. (And... you don't *really* believe that the choice of language is "irrelevant", do you? :) ... On Thu, 21 Aug 2003 17:04:03 +0200 Joachim Durchholz wrote: > To keep the number of potential interactions down, Parnas propagated > "information hiding", cutting down on the number of interactions that > a compiler will allow. (Information hiding is not intended to prevent > programmers from looking into components, its for preventing > components from looking into other components.) See also: the Law of Demeter. http://www.ccs.neu.edu/home/lieber/LoD.html -Chris From Marc.Vanwoerkom@REDACTED Thu Aug 21 19:22:35 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 21 Aug 2003 19:22:35 +0200 (MEST) Subject: The wrapper project In-Reply-To: (message from Joe Armstrong on Thu, 21 Aug 2003 11:06:54 +0200 (CEST)) Message-ID: <200308211722.h7LHMZu02499@bonsai.fernuni-hagen.de> > Mplayer is currently commanded by mouse and keyboard events. > > I'd like to add a wrapper so I could control it from a socket, like > this: There must be test programs for X11 apps who have solved how to simulate mouse and keyboard, I hope it is not necessary to write special X device drivers. Java has a robot class for such. Its uses are tests and demos. Regards, Marc From hal@REDACTED Thu Aug 21 19:35:41 2003 From: hal@REDACTED (Hal Snyder) Date: Thu, 21 Aug 2003 12:35:41 -0500 Subject: C node ERL_TICK question Message-ID: <87n0e27w2a.fsf@ghidra.vail> Is it necessary to respond to an ERL_TICK? We are working on an OTP project that will involve C nodes talking to OTP nodes. Here's the general approach, using ei from R9C: ei_connect_xinit initialize C node ei_xconnect connect to OTP node while(1) { ... time passes ... ei_reg_send ask the OTP node for something ei_xreceive_msg get answer from OTP node } We understand that receive routines such as ei_xreceive_msg will automatically reply to a tick message as well as pass ERL_TICK to the C node calling code. The question is, do we need to be listening all the time? We would like to open a connection to an OTP node, but then we might not use it for hours at a time. Will we lose the connection to the remote OTP node if we don't continually listen for (and respond) to ticks? If so, it suggests you we either a select/poll loop controlling the program, or a thread whose job it is to keep the connection alive. Correct? From erlang@REDACTED Thu Aug 21 20:14:01 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 21 Aug 2003 19:14:01 +0100 Subject: Erlang skills requested for permanent employment Message-ID: <3F450BE9.5080304@manderp.freeserve.co.uk> Hi Erlang Gurus, As advertised on our company website. "Automated Test Engineering Development Role" http://www.newport-networks.com/pages/jobswte.html Please apply if you're interested, I need more hands on deck! There's considerable programming work to be done, we're building our own testing software and hardware tools. Pete. From bertil@REDACTED Thu Aug 21 17:23:09 2003 From: bertil@REDACTED (Bertil Karlsson) Date: Thu, 21 Aug 2003 17:23:09 +0200 Subject: fix for asn1 driver References: <200308211512.h7LFC7n01534@tessla.levonline.com> Message-ID: <3F44E3DD.7010702@erix.ericsson.se> Thank you, the trace printout will be removed in the next patch. Per Bergqvist wrote: > There is a debug printout that should be removed in the > asn1 driver in R9C-0. > > Patch attached. > > /Per > > ========================================================= > Per Bergqvist > Synapse Systems AB > Phone: +46 709 686 685 > Email: per@REDACTED -- / Bertil Karlsson From wolfoxbr@REDACTED Thu Aug 21 20:12:38 2003 From: wolfoxbr@REDACTED (Roberto Amorim) Date: Thu, 21 Aug 2003 15:12:38 -0300 Subject: Bug in erl_interface in R9C? References: <20030820165502.GA6806@dc.fi.udc.es> <20030821153725.GA27579@dc.fi.udc.es> Message-ID: > Well, the code is only used with integers bigger than 2^32, so it does not > affect normal integer decoding. The easy way to avoid making unnecessary > casts would be to unroll the loop, but i don't think it's worth the effort. > > The nice way would be to read the number from s backwards, and shift n > instead of the number from get8(s), but that would need changes to the > putget functions. That would be nice, but i don't think the performance hit > is that big to justify the change. Thanks for the explanation. I'm still far from considering myself a Erlang newbie... it was just a general C related comment, that I now see that didn't apply to this specific case. Regards, Roberto From vances@REDACTED Thu Aug 21 23:32:14 2003 From: vances@REDACTED (Vance Shipley) Date: Thu, 21 Aug 2003 17:32:14 -0400 Subject: C node ERL_TICK question In-Reply-To: <87n0e27w2a.fsf@ghidra.vail> References: <87n0e27w2a.fsf@ghidra.vail> Message-ID: <20030821213214.GG21374@frogman.motivity.ca> Hal, Yes you should have a select/poll as or in your main loop. When the ei socket(s) are readable run the appropriate function to process the request and then go back to what you were doing. The ei*receive* functions handle the ERL_TICK and other stuff. If you are not using poll() but are doing a blocking call of some other kind as your main loop you should have it time out occasionally and run a non-blocking poll (or select) or even just run one of the ei*receive* functions and ignore errors. If you don't have a "wait" option in the blocking function set up a signal handler for SIGALARM and call alarm(timout) to interrupt the blocking call every so often and go and check things on the ei socket(s). -Vance On Thu, Aug 21, 2003 at 12:35:41PM -0500, Hal Snyder wrote: } } If so, it suggests you we either a select/poll loop controlling the } program, or a thread whose job it is to keep the connection alive. } Correct? From twanvds@REDACTED Fri Aug 22 00:20:17 2003 From: twanvds@REDACTED (Twan van der Schoot) Date: Fri, 22 Aug 2003 00:20:17 +0200 Subject: The wrapper project In-Reply-To: <20030821094342.76809e91.cpressey@catseye.mine.nu> Message-ID: Hi All, I would like to add a design constraint one of a "dynamic" nature. "When desiging commuicating processes one should not make any assumptions on the relative speeds of either process". Which is a formulation of my own but based on a note by the late Dijkstra [EWD123, p.10], but there it was part of a problem statment. Dijkstra elevated this later to a kind of "design stance" rather than a strict rule [EWD1303, p.33, http://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/EWD1303.html .It think it is quite worthwhile to read] But as a rule in its more strict sense (replace "should" by "must") served me well. It also, I believe, strengthens Joe's second rule, and makes the distinction between language or OS issues moot, as it is a design issue. Eventhough it would be nice if an OS or langauge makes it easy to implement designs following resulting from this rule, e.g. Erlang ;-) Twan > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Chris Pressey > Sent: donderdag 21 augustus 2003 16:44 > To: Erlang-Questions > Subject: Re: The wrapper project > > > On Thu, 21 Aug 2003 11:06:54 +0200 (CEST) > Joe Armstrong wrote: > > > > > I'm back .... (been on holiday) > > > > I've been thinking about stuff. > > > > Once upon a time I was interested in "how to program" I think that > > we now know how to do this (not perfectly, but adequately) - now I'm > > interested in "fitting things togther". > > > > I have convinced myself of the following: > > > > 1) Systems must be made of *isolated* components. > > 2) The components must communicate by asynchronous message > > passing... (and a few more things which are not relevant to this > > discussion) > > > > Isolation is the *essential* characteristic. It means that if one > > component crashes, the other components must not themselves crash. > > See also: protected memory. > http://www.wikipedia.org/wiki/Protected_memory > > > Two > > processes running on the same machine should be as isolated as if one > > ran in (say) Sweden and the other in (say) the USA. > > > > What these process are written in (language) and what they run on > > (OS) is *irrelevant* - But the *protocol* between them is vital (hence > > my thoughts on UBF and the like (see www.sics.se/~joe/ubf). > > Then the protocol becomes the OS, for all intents and purposes. > > (And... you don't *really* believe that the choice of language is > "irrelevant", do you? :) > > ... > > On Thu, 21 Aug 2003 17:04:03 +0200 > Joachim Durchholz wrote: > > > To keep the number of potential interactions down, Parnas propagated > > "information hiding", cutting down on the number of interactions that > > a compiler will allow. (Information hiding is not intended to prevent > > programmers from looking into components, its for preventing > > components from looking into other components.) > > See also: the Law of Demeter. > http://www.ccs.neu.edu/home/lieber/LoD.html > > -Chris > From TriumphX75@REDACTED Fri Aug 22 03:25:57 2003 From: TriumphX75@REDACTED (Dave McMahon) Date: Fri, 22 Aug 2003 02:25:57 +0100 Subject: Erlang on OS X Message-ID: <94A9FFBE-D43F-11D7-9B5F-000A2782E4B6@mac.com> I have only recently discovered Erlang, thanks to my interest in 3D modelling and my wish to use Wings3D, which uses Erlang. Both Erlang and Wings3D seem to work fine on my setup (from minimal testing) with one slight problem. It takes almost 30 minutes for the program to start up. I originally discovered this thanks to a phone call when trying to start up Wings3D. I'm using an iMac DVSE (400MHz G3, 640Mb OS X 10.2.6) When I run the Wings3D loader it hands off to beam, which then takes about 30 minutes to actually display anything on screen. I downloaded the precompiled version of Erlang/OTP and found that when I run erl from the terminal, it's a similar story. It seems to work, eventually. Any help would be much appreciated. Dave McMahon From hal@REDACTED Fri Aug 22 04:23:08 2003 From: hal@REDACTED (Hal Snyder) Date: Thu, 21 Aug 2003 21:23:08 -0500 Subject: ei_rpc_from speedup? Message-ID: <87vfsqzb03.fsf@ghidra.vail> In R9C-0 lib/erl_interface/src/connect/ei_connect.c we see (line numbers prepended) 922 FD_ZERO(&readmask); 923 FD_SET(fd,&readmask); 924 925 switch (select(FD_SETSIZE, &readmask, NULL, NULL, t)) { On FreeBSD-5.0 at least, FD_SETSIZE defaults to 1024U. Isn't the following patch an improvement (pointed out by Rick Pettit)? --- ei_connect.c.orig Fri Aug 1 04:07:11 2003 +++ ei_connect.c Thu Aug 21 21:10:11 2003 @@ -922,7 +922,7 @@ FD_ZERO(&readmask); FD_SET(fd,&readmask); - switch (select(FD_SETSIZE, &readmask, NULL, NULL, t)) { + switch (select(fd + 1, &readmask, NULL, NULL, t)) { case -1: erl_errno = EIO; return ERL_ERROR; From kent@REDACTED Fri Aug 22 09:16:32 2003 From: kent@REDACTED (Kent Boortz) Date: 22 Aug 2003 09:16:32 +0200 Subject: Erlang on OS X In-Reply-To: <94A9FFBE-D43F-11D7-9B5F-000A2782E4B6@mac.com> References: <94A9FFBE-D43F-11D7-9B5F-000A2782E4B6@mac.com> Message-ID: Dave McMahon writes: > I'm using an iMac DVSE (400MHz G3, 640Mb OS X 10.2.6) > > When I run the Wings3D loader it hands off to beam, which then takes > about 30 minutes to actually display anything on screen. I downloaded > the precompiled version of Erlang/OTP and found that when I run erl > from the terminal, it's a similar story. It seems to work, eventually. To help finding the problem you could run % ktrace -d -f 2.out erl % ktrace -d -f 10.out erl % ktrace -d -f 20.out erl and send the *.out files to me (or even better put them up under a web server or ftp server somewhere and send me the links, the files may be huge). The *.out files are kernel traces that can be viewed with "kdump". This may give us a hint where time is spent during the startup, kent From vlad_dumitrescu@REDACTED Fri Aug 22 09:28:58 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 22 Aug 2003 09:28:58 +0200 Subject: Erlang on OS X References: <94A9FFBE-D43F-11D7-9B5F-000A2782E4B6@mac.com> Message-ID: Hello, > When I run the Wings3D loader it hands off to beam, which then takes > about 30 minutes to actually display anything on screen. I downloaded > the precompiled version of Erlang/OTP and found that when I run erl > from the terminal, it's a similar story. It seems to work, eventually. This is a wild guess, but I had a similar problem on Windows. The problem was that I had added a lot of entries in the .hosts file and at startup, loading the file took a long time. Not 30 minutes, but like 5-6. May be worth checking. Good luck! /Vlad From vlad_dumitrescu@REDACTED Fri Aug 22 10:11:27 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 22 Aug 2003 10:11:27 +0200 Subject: The wrapper project Message-ID: Hi, > From: "Joe Armstrong" > > To make it clearer suppose I have a controller and a music player. Okay, now I get it. I thought it was about displaying the image _inside_ the GUI, but it was just an example. However, even the GUI could be built from independent components. But that problem can wait until it's time comes. regards, Vlad From Laszlo.Varga@REDACTED Fri Aug 22 10:15:46 2003 From: Laszlo.Varga@REDACTED (Laszlo Varga) Date: Fri, 22 Aug 2003 10:15:46 +0200 (MEST) Subject: ReRe: why isolated components Message-ID: <200308220815.h7M8FkD04505@duna273.eth.ericsson.se> Hello, thanks for the "answer". Right, isolation reduces the (possible) complexity, but is that the motivation for the wrapper project? For coping with complexity we have several other isolation technics, like namespace, functions, or objects. Part of the mail thread showes that the main motivation is to cope with the "dynamic complexity". (Reduing the number of states, I mean). Other reflections say that it is for robustness. Other benefits that not mentioned are the reusability, the cooperation of programmers, the testabilty, and .... I guess that everybody who started programming knows these benefits in general. There are many tools and paradigmas to support this idea. But now, people seems to start thinking something new, and I wanted to provocate them to try to be precise at the start. I know well that it is hard. But also had bad experience when ommited this hard phase. So what we (Joe) want? Robust system? Real time system? Open system? Replacing CORBA. Supervised components? Standardised components? ??? ??? ??? All of them? Cheers Laszlo -------joachim.durchholz wrote------------------------ > Laszlo Varga wrote: > > Really, why? > > What are the (main) motivations for kind a system? > > Let me rephrase, in the hopes that I understood your question correctly: > What is the main motivation for isolating components? > > The answer is simple. If you double the number of names in a program, > the number of unwanted possible interaction quadruples. More generally, > for N items, you have N*(N-1)/2 possible interactions. > > The number of *intended* interactions between components grows roughly > linearly (I think it's usually on the order of N*log(N), but whether > it's really linear or not doesn't matter: the main point is that the > number of wanted interactions is massively less than O(N*N)). > > In other words, the number of unwanted potential interactions grows in > an approximately quadradic correlation with program size. > > To keep the number of potential interactions down, Parnas propagated > "information hiding", cutting down on the number of interactions that a > compiler will allow. (Information hiding is not intended to prevent > programmers from looking into components, its for preventing components > from looking into other components.) > > Just my thoughts on the subject. > HTH > Jo > From joachim.durchholz@REDACTED Fri Aug 22 12:14:23 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Fri, 22 Aug 2003 12:14:23 +0200 Subject: ReRe: why isolated components In-Reply-To: <200308220815.h7M8FkD04505@duna273.eth.ericsson.se> References: <200308220815.h7M8FkD04505@duna273.eth.ericsson.se> Message-ID: <3F45ECFF.5090309@web.de> Laszlo Varga wrote: > thanks for the "answer". Right, isolation reduces the (possible) complexity, > but is that the motivation for the wrapper project? Well, *that* is another issue. I don't know Joe's thoughts on the subject, but my impression is that it's about coping with failures. If a subroutine crashes, or if it just detects an abnormal condition and logs it, this is behaviour that punches right through to the top levels of the application. The "let it crash" philosophy of Erlang says: if a component fails, let if fail, and don't burden the caller (or service requester or whatever you name it) with analysis of the crash details, just tell it that the request failed. The toplevel may be unable to cope with the situation, but then passing up crash details will introduce lots of coupling just for the rare case of a crash - the resulting design mess just isn't worth the benefits. Other languages handle this via exceptions. Eiffel got this right: Eiffel exceptions are unsuitable for passing up information on a crash (apart from diagnostic information that helps programmers and debuggers; there's no channel for passing up information that would help the top-level to analyze the error). Java and C++ got it wrong: they make it all too easy to pass up information that allows the caller to continue. The net result being that exceptions create an additional, quite tight coupling between low and high levels of the system. (It's no good if the top-level of a system tries to handle an InternetConnectionFailure exception just because an Internet resource wasn't available ten call levels below it...) Erlang's idea is to separate the layers of processing into separate processes, and to let the process crash. The advantage is that this quite nicely handles any memory leaks that might occur on lower levels (even garbage-collected languages can leak memory: when calling out into C, or when accumulating larger and larger structures). I consider it a disadvantage that this interleaves the issues of crash protection and asynchronous message passing. However, my Erlang experience is *very* limited, so please consider the latter just an uninformed opinion. HTH Jo From Laszlo.Varga@REDACTED Fri Aug 22 14:14:03 2003 From: Laszlo.Varga@REDACTED (Laszlo Varga) Date: Fri, 22 Aug 2003 14:14:03 +0200 (MEST) Subject: ReRe: why isolated components Message-ID: <200308221214.h7MCE3D04720@duna273.eth.ericsson.se> Hello, it seems that we are getting understand each other. At least we have no clear idea about what Joe want to have. Really, it seems that the motivation is to have something process based fault tolerancy or robustness or at least stability. UBF is also behind the scene, what makes me suspicious. Maybe I'm mistaken, but the main point in UBF - I think- the C level, the contract. It makes an UBF contract much more strict then an IDL. In other words, it specifies the dynamic behaviour while IDLs-are just static. Is not the THING about building a contract-specified component system? If it were, i'd like it. Thanks for your time Laszlo > > Laszlo Varga wrote: > > thanks for the "answer". Right, isolation reduces the (possible) complexity, > > but is that the motivation for the wrapper project? > > Well, *that* is another issue. > > I don't know Joe's thoughts on the subject, but my impression is that > it's about coping with failures. > If a subroutine crashes, or if it just detects an abnormal condition and > logs it, this is behaviour that punches right through to the top levels > of the application. The "let it crash" philosophy of Erlang says: if a > component fails, let if fail, and don't burden the caller (or service > requester or whatever you name it) with analysis of the crash details, > just tell it that the request failed. > The toplevel may be unable to cope with the situation, but then passing > up crash details will introduce lots of coupling just for the rare case > of a crash - the resulting design mess just isn't worth the benefits. > > Other languages handle this via exceptions. > Eiffel got this right: Eiffel exceptions are unsuitable for passing up > information on a crash (apart from diagnostic information that helps > programmers and debuggers; there's no channel for passing up information > that would help the top-level to analyze the error). > Java and C++ got it wrong: they make it all too easy to pass up > information that allows the caller to continue. The net result being > that exceptions create an additional, quite tight coupling between low > and high levels of the system. (It's no good if the top-level of a > system tries to handle an InternetConnectionFailure exception just > because an Internet resource wasn't available ten call levels below it...) > > Erlang's idea is to separate the layers of processing into separate > processes, and to let the process crash. The advantage is that this > quite nicely handles any memory leaks that might occur on lower levels > (even garbage-collected languages can leak memory: when calling out into > C, or when accumulating larger and larger structures). > I consider it a disadvantage that this interleaves the issues of crash > protection and asynchronous message passing. However, my Erlang > experience is *very* limited, so please consider the latter just an > uninformed opinion. > > HTH > Jo > From per@REDACTED Fri Aug 22 13:41:01 2003 From: per@REDACTED (Per Bergqvist) Date: Fri, 22 Aug 2003 14:41:01 +0300 Subject: fix for asn1 driver In-Reply-To: <3F44E3DD.7010702@erix.ericsson.se> Message-ID: <200308221241.h7MCf1o10193@tessla.levonline.com> Hi, Attached are a couple of more fixes for asn1. -32 fixes a length bug on extensions in asn1rt_ber_bin -33 fixes 'OBJECT DESCRIPTOR' bug in asn1 modules (found by Erik Reitsma but not fixed in R9C-0) -34 fixes a tag matching bug in ber decoding -35 enables erlc command line to pass +ber_bin for asn1 modules (and actually use it ;-) /Per ------------------- > Thank you, the trace printout will be removed in the next patch. > > Per Bergqvist wrote: > > There is a debug printout that should be removed in the > > asn1 driver in R9C-0. > > > > Patch attached. > > > > /Per > > > > ========================================================= > > Per Bergqvist > > Synapse Systems AB > > Phone: +46 709 686 685 > > Email: per@REDACTED > > > -- > / Bertil Karlsson > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R9C-0.patch-32 Type: application/octet-stream Size: 593 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: R9C-0.patch-33 Type: application/octet-stream Size: 1940 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: R9C-0.patch-34 Type: application/octet-stream Size: 666 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: R9C-0.patch-35 Type: application/octet-stream Size: 1303 bytes Desc: not available URL: From joe@REDACTED Fri Aug 22 14:41:02 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 22 Aug 2003 14:41:02 +0200 (CEST) Subject: why isolated components In-Reply-To: <3F44DF63.7080406@web.de> Message-ID: On Thu, 21 Aug 2003, Joachim Durchholz wrote: > Laszlo Varga wrote: > > Really, why? > > What are the (main) motivations for kind a system? > > Let me rephrase, in the hopes that I understood your question correctly: > What is the main motivation for isolating components? > > The answer is simple. If you double the number of names in a program, > the number of unwanted possible interaction quadruples. More generally, > for N items, you have N*(N-1)/2 possible interactions. > ... cut ... Nicely put. I must admit that when I read the question I had thought of a *completely different* answer - so I you mail quite surprised me, I've been thinking upon different lines :-) Why isolated components? - for fault isolation - for concurrency/scalability My main reason for wanting isolated components is for isolating software faults in the components themselves. Virtually all software contains faults. In a system with lots of things happening at the same time I don't want faults in a faulty component to effect the behaviour of a component that is running somewhere else in the system. Normally we use OS processes for precisely this reason - processes provide "protection domains" and the isolate the effects on an error to the process where the error occurred. At least that's the idea - no OS that I know of has this property, and some OSs are better than others. Windows 98 for example has appalling protection between processes - doing something silly in one process can easily crash the entire machine. The Linuxes are not much better - one process can essentially do a denial of survive attack on other processes in the system, by thrashing the disk or something. Processes running on *isolated* machines are much better. If I run one process in Sweden and another in the USA and if they only communicate asynchronously it becomes more unlikely that a SW error in the Swedish machine will crash the process running on a machine in the USA. Two processes running on the same machines should be as independent as if they ran one two machines in different countries. Modern OSs try to achieve this but fail. Erlang tries to achieve this, it does somewhat better than mosts OSs but still one process could attack another process by sending it zillions of messages. Erlang was designed to protect processes from accidental errors not malicious attack. It is precisely the lack of protection between processes that makes, for example, Java unsuitable for large-scale SW projects. This is not my conclusion but is the conclusion draw by researchers from Sun Labs. Let me quote: In a paper on Java by Czajkowski and Dayn\`{e}s [1], from Sun Microsystems, say: The only safe way to execute multiple applications, written in the Java programming language, on the same computer is to use a separate JVM for each of them, and to execute each JVM in a separate OS process. This introduces various inefficiencies in resource utilization, which downgrades performance, scalability, and application startup time. The benefits the language can offer are thus reduced mainly to portability and improved programmer productivity. Granted these are important, but the full potential of language-provided safety is not realized. Instead there exists a curious distinction between ``language safety'' and ``real safety''. In their paper they introduce the MVM (an extension to the JVM) their goal is: ... to turn the JVM into an execution environment akin to an OS. In particular, the abstraction of a process, offered by modern OSes, is the role model in terms of features; isolation from other computations, resources accountability and control, and ease of termination and resource reclamation. To achieve this they conclude that: ... tasks cannot directly share objects, and that the only way for tasks to communicate is to use standard, copying communication mechanisms The full paper is very interesting - they say 1) Java is not a safe language 2) Java applications cannot me mixed in the same JVM 3) Java threads do not offer the protection offered by OS threads Then they invent Erlang :-) (joke) I mailed C & D and asked how the MVM was going - whey said they could have a max of 125 parallel JVMs going at once (compare with hundred of thousands of Erlang processes) and the JVM "spawn" time was not microseconds but "as lot as it took to start a regular JVM" - wow - don't hold your breath. Software development goes fine until somebody gets the idea of linking together different bits of code into the same memory space and allowing languages which can overwrite not you own memory, but somebody else's memory. OS processes basically give you resource protection + concurrency the main resource being memory. Memory protection is *unnecessary* in a language without pointers and decent garbage collector (like Erlang, lisp, prolog, smalltalk, ...) but essential for C, C++. ----------------------------------------------------------------------- My second reason for isolated components has to do with concurrency, scalability etc. If components are NOT isolated, or cannot be isolated, then the system is NOT scalable - the code must be re-written before it can be scaled. If two sub-components A and B are assembled together to form C in such a way that A and B are not strictly isolated with a message passing channel between them then scaling or distributing the application will be difficult or impossible. If A and B are isolated then we can easily run A and B on the *same* machine OR on *different* machines - this is the basis of fault-tolerance, scalability etc. ----------------------------------------------------------------------- Long live isolated components with asynchronous streams :-) Isolation is an essential pre-condition for building fault-tolerent systems. /Joe Refs [1] @inproceedings{javaProcesses, author = {Grzegorz Czajkowski and Laurent Dayn\`{e}s}, title = {Multitasking without comprimise: a virtual machine evolution}, booktitle = {Proceedings of the OOPSLA '01 conference on Object Oriented Programming Systems Languages and Applications}, year = {2001}, isbn = {1-58113-441-X}, pages = {125--138}, location = {Tampa Bay, FL, USA}, doi = {http://doi.acm.org/10.1145/504282.504292}, publisher = {ACM Press}, } From vances@REDACTED Fri Aug 22 14:48:06 2003 From: vances@REDACTED (Vance Shipley) Date: Fri, 22 Aug 2003 08:48:06 -0400 Subject: ei_rpc_from speedup? In-Reply-To: <87vfsqzb03.fsf@ghidra.vail> References: <87vfsqzb03.fsf@ghidra.vail> Message-ID: <20030822124806.GH21374@frogman.motivity.ca> Hal, File descriptors are opaque data types. You shouldn't make any assumptions about what values they take other than that they fit in an int. That file descriptors are assigned incrementally increasing from stdio is only a well known practice not a guarantee. I'm currently working with devices which start at 257 and assign incrementally from there. -Vance On Thu, Aug 21, 2003 at 09:23:08PM -0500, Hal Snyder wrote: } } On FreeBSD-5.0 at least, FD_SETSIZE defaults to 1024U. Isn't the } following patch an improvement (pointed out by Rick Pettit)? ... } - switch (select(FD_SETSIZE, &readmask, NULL, NULL, t)) { } + switch (select(fd + 1, &readmask, NULL, NULL, t)) { From joe@REDACTED Fri Aug 22 14:57:29 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 22 Aug 2003 14:57:29 +0200 (CEST) Subject: ReRe: why isolated components In-Reply-To: <200308220815.h7M8FkD04505@duna273.eth.ericsson.se> Message-ID: On Fri, 22 Aug 2003, Laszlo Varga wrote: > Hello, > thanks for the "answer". Right, isolation reduces the (possible) complexity, > but is that the motivation for the wrapper project? For coping with complexity > we have several other isolation technics, like namespace, functions, or > objects. Part of the mail thread showes that the main motivation is to cope > with the "dynamic complexity". (Reduing the number of states, I mean). > Other reflections say that it is for robustness. When I use the world isolation I'm thinking of the kind of protection domains offered by processes. Two components running on two different computers in two different countries are isolated :-) Namespaces are a different kind of isolation. > > Other benefits that not mentioned are the reusability, the cooperation of > programmers, the testabilty, and .... > > I guess that everybody who started programming knows these benefits in general. > There are many tools and paradigmas to support this idea. > But now, people seems to start thinking something new, > and I wanted to provocate them to try to be precise at the start. > I know well that it is hard. But also had bad experience when ommited > this hard phase. > > > So what we (Joe) want? > > Robust system? Yes > Real time system? > Open system? > Replacing CORBA. > Supervised components? > Standardised components? > ??? > ??? > ??? > > All of them? Not yet. In the old days the great masters said: "get it right before you make it fast" - IMHO the "getting it right" bit is the difficult bit (VERY difficult) - making it fast once it is right in much easier. Unfortunately, virtually every (or possibly it is every) system only gets things almost right and customers have been lead to believe that fast flashy software that crashes now and then looses their work is preferable to simpler and more reliable things. My view is that 1) We should construct systems from isolated components 2) The systems should communicate with asynchronous messages 3) The sequencing and types of these messages should be governed by contracts 4) The contracts should be checked dynamically and all the time Read www.sics.se/~jeo/ubf for more details We should also aim to improve the isolation bit - ie make Erlang etc better to avoid malicious inter-process denial of service attacks. Once we have done 1) - 4) in a realistic system we will have got to the "get it right" toll-gate. Then we can start thinking about the "make it fast" bit and some of the other issues you addresses. /Joe > > Cheers > Laszlo > -------joachim.durchholz wrote------------------------ > > Laszlo Varga wrote: > > > Really, why? > > > What are the (main) motivations for kind a system? > > > > Let me rephrase, in the hopes that I understood your question correctly: > > What is the main motivation for isolating components? > > > > The answer is simple. If you double the number of names in a program, > > the number of unwanted possible interaction quadruples. More generally, > > for N items, you have N*(N-1)/2 possible interactions. > > > > The number of *intended* interactions between components grows roughly > > linearly (I think it's usually on the order of N*log(N), but whether > > it's really linear or not doesn't matter: the main point is that the > > number of wanted interactions is massively less than O(N*N)). > > > > In other words, the number of unwanted potential interactions grows in > > an approximately quadradic correlation with program size. > > > > To keep the number of potential interactions down, Parnas propagated > > "information hiding", cutting down on the number of interactions that a > > compiler will allow. (Information hiding is not intended to prevent > > programmers from looking into components, its for preventing components > > from looking into other components.) > > > > Just my thoughts on the subject. > > HTH > > Jo > > > From rpettit@REDACTED Fri Aug 22 17:21:26 2003 From: rpettit@REDACTED (Rick Pettit) Date: Fri, 22 Aug 2003 08:21:26 -0700 Subject: ei_rpc_from speedup? In-Reply-To: <20030822124806.GH21374@frogman.motivity.ca> References: <87vfsqzb03.fsf@ghidra.vail> <20030822124806.GH21374@frogman.motivity.ca> Message-ID: <20030822152126.GA21360@vailsys.com> On Fri, Aug 22, 2003 at 08:48:06AM -0400, Vance Shipley wrote: > File descriptors are opaque data types. You shouldn't make > any assumptions about what values they take other than that > they fit in an int. That file descriptors are assigned > incrementally increasing from stdio is only a well known > practice not a guarantee. I'm currently working with devices > which start at 257 and assign incrementally from there. Are there systems that don't assign incrementally? Scanning 60,000 descriptors (FreeBSD) when the highest descriptor in my FD_SET is 4 seems a bit inefficient. I understand that portability is important, but is the following really a problem on some systems (i.e. the only assumption made is that descriptors are assigned incrementally)? Couldn't this be dealt with in the autotools stuff? -Rick > On Thu, Aug 21, 2003 at 09:23:08PM -0500, Hal Snyder wrote: > } > } On FreeBSD-5.0 at least, FD_SETSIZE defaults to 1024U. Isn't the > } following patch an improvement (pointed out by Rick Pettit)? > ... > } - switch (select(FD_SETSIZE, &readmask, NULL, NULL, t)) { > } + switch (select(fd + 1, &readmask, NULL, NULL, t)) { From Laszlo.Varga@REDACTED Fri Aug 22 15:30:39 2003 From: Laszlo.Varga@REDACTED (Laszlo Varga) Date: Fri, 22 Aug 2003 15:30:39 +0200 (MEST) Subject: ReRe: why isolated components Message-ID: <200308221330.h7MDUdD04784@duna273.eth.ericsson.se> Hello, I'm glad to have the answer I liked (and suspected) :). /Laszlo > X-Authentication-Warning: enfield.sics.se: joe owned process doing -bs > Date: Fri, 22 Aug 2003 14:57:29 +0200 (CEST) > From: Joe Armstrong > To: Laszlo Varga > cc: joachim.durchholz@REDACTED, > Subject: Re: ReRe: why isolated components > MIME-Version: 1.0 > X-OriginalArrivalTime: 22 Aug 2003 13:04:45.0895 (UTC) FILETIME=[F5CC6570:01C368AD] > > On Fri, 22 Aug 2003, Laszlo Varga wrote: > > > Hello, > > thanks for the "answer". Right, isolation reduces the (possible) complexity, > > but is that the motivation for the wrapper project? For coping with complexity > > we have several other isolation technics, like namespace, functions, or > > objects. Part of the mail thread showes that the main motivation is to cope > > with the "dynamic complexity". (Reduing the number of states, I mean). > > Other reflections say that it is for robustness. > > When I use the world isolation I'm thinking of the kind of > protection domains offered by processes. > > Two components running on two different computers in two different > countries are isolated :-) > > Namespaces are a different kind of isolation. > > > > > Other benefits that not mentioned are the reusability, the cooperation of > > programmers, the testabilty, and .... > > > > I guess that everybody who started programming knows these benefits in general. > > There are many tools and paradigmas to support this idea. > > But now, people seems to start thinking something new, > > and I wanted to provocate them to try to be precise at the start. > > I know well that it is hard. But also had bad experience when ommited > > this hard phase. > > > > > > So what we (Joe) want? > > > > Robust system? > > Yes > > > Real time system? > > Open system? > > Replacing CORBA. > > Supervised components? > > Standardised components? > > ??? > > ??? > > ??? > > > > All of them? > > Not yet. > > In the old days the great masters said: > > "get it right before you make it fast" - IMHO the "getting it right" > bit is the difficult bit (VERY difficult) - making it fast once it is > right in much easier. > > Unfortunately, virtually every (or possibly it is every) system only > gets things almost right and customers have been lead to believe that > fast flashy software that crashes now and then looses their work is > preferable to simpler and more reliable things. > > My view is that > > 1) We should construct systems from isolated components > 2) The systems should communicate with asynchronous messages > 3) The sequencing and types of these messages should be governed > by contracts > 4) The contracts should be checked dynamically and all the time > > Read www.sics.se/~jeo/ubf for more details > > We should also aim to improve the isolation bit - ie make Erlang etc > better to avoid malicious inter-process denial of service attacks. > > Once we have done 1) - 4) in a realistic system we will have got to > the "get it right" toll-gate. Then we can start thinking about the > "make it fast" bit and some of the other issues you addresses. > > /Joe > > > > > > > Cheers > > Laszlo > > -------joachim.durchholz wrote------------------------ > > > Laszlo Varga wrote: > > > > Really, why? > > > > What are the (main) motivations for kind a system? > > > > > > Let me rephrase, in the hopes that I understood your question correctly: > > > What is the main motivation for isolating components? > > > > > > The answer is simple. If you double the number of names in a program, > > > the number of unwanted possible interaction quadruples. More generally, > > > for N items, you have N*(N-1)/2 possible interactions. > > > > > > The number of *intended* interactions between components grows roughly > > > linearly (I think it's usually on the order of N*log(N), but whether > > > it's really linear or not doesn't matter: the main point is that the > > > number of wanted interactions is massively less than O(N*N)). > > > > > > In other words, the number of unwanted potential interactions grows in > > > an approximately quadradic correlation with program size. > > > > > > To keep the number of potential interactions down, Parnas propagated > > > "information hiding", cutting down on the number of interactions that a > > > compiler will allow. (Information hiding is not intended to prevent > > > programmers from looking into components, its for preventing components > > > from looking into other components.) > > > > > > Just my thoughts on the subject. > > > HTH > > > Jo > > > > > > From kostis@REDACTED Fri Aug 22 09:53:27 2003 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 22 Aug 2003 09:53:27 +0200 (MEST) Subject: Erlang on OS X In-Reply-To: Mail from '"Vlad Dumitrescu" ' dated: Fri, 22 Aug 2003 09:28:58 +0200 Message-ID: <200308220753.h7M7rReT029974@harpo.it.uu.se> Vlad Dumitrescu wrote: > > When I run the Wings3D loader it hands off to beam, which then takes > > about 30 minutes to actually display anything on screen. I downloaded > > the precompiled version of Erlang/OTP and found that when I run erl > > from the terminal, it's a similar story. It seems to work, eventually. > > This is a wild guess, but I had a similar problem on Windows. The problem > was that I had added a lot of entries in the .hosts file and at startup, > loading the file took a long time. Not 30 minutes, but like 5-6. I experienced a similar problem on my old laptop running Linux Mandrake. For some weird reason, the /etc/hosts file was filling with 2999 entries once in a while, and starting beam took quite a while. Deleting those entries, fixed the problem. Kostis. From mikael.karlsson@REDACTED Fri Aug 22 15:39:45 2003 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 22 Aug 2003 15:39:45 +0200 Subject: Enterprise Erlang Beams? Message-ID: <200308221539.45014.mikael.karlsson@creado.com> Howdy, I started to read one of those bricksized books about J2EE and Enterprise Java Beans (EJB) during vacations. I must confess I never made it through. However since I relate many things to what can be implemented in Erlang I am still thinking about it. It is a bit irritating that so many things get implemented in Java on the server side when Erlang is so much better, isn't it? Web applications seem to use Java all the way from WebServices-SOAP (Apache Axis), Servlets (Tomcat) and EJBs (JBoss). Now, I would not expect that many transactions per second out of my system when you put several of those together (which you do, see for example http://titanium.dstc.edu.au/gehr/demonstrator/resources.shtml). Especially if you need SSL as well. Is there anyone that is familiar with J2EE and EJBs who knows if it would be possible to implement something similar to Enterprise Java Beans in Erlang? As far as I understand (I didn't finish the book remember :) the main point of EJBs is that the container they live in takes care of parallel processing and transaction processing towards databases with rollbacks etc. Parallel processing is for free in Erlang :-) and maybe one could wrap a transaction around a gen_server or gen_fsm to get something like what you have in an EJB. EJB spec. also has a mapping to CORBA. CORBA is implemented in Erlang, including cosTransactions. Thanks Mikael From joe@REDACTED Fri Aug 22 16:10:22 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 22 Aug 2003 16:10:22 +0200 (CEST) Subject: The wrapper project In-Reply-To: <200308211722.h7LHMZu02499@bonsai.fernuni-hagen.de> Message-ID: On Thu, 21 Aug 2003, Marc Ernst Eddy van Woerkom wrote: > > Mplayer is currently commanded by mouse and keyboard events. > > > > I'd like to add a wrapper so I could control it from a socket, like > > this: > > There must be test programs for X11 apps who have solved how to > simulate mouse and keyboard, I hope it is not necessary to > write special X device drivers. Does anybody know of such a (free) program ? /Joe > > Java has a robot class for such. Its uses are tests and demos. > > Regards, > Marc > > > > > > > > > From jay@REDACTED Fri Aug 22 16:11:35 2003 From: jay@REDACTED (Jay Nelson) Date: Fri, 22 Aug 2003 07:11:35 -0700 Subject: why isolated components Message-ID: <4.2.2.20030822062405.00d23160@duomark.com> Joe wrote: > ... (deleted discussion of machines in different countries) That description was much clearer. > Long live isolated components with asynchronous streams :-) A while back I posted about looking into an algebra of streams. I had a similar goal in producing a webserver (and later thinking about a GUI) in that I wanted to have multiple components contributing to the final output. This takes two different forms: 1) HTML, XML, PDF, raw text, SOAP, etc: there is one source which is the content that is stored. There are multiple "markups" or "formats" which are layered on the content (or interspersed). Depending on the final output, multiple streams need to be combined by separate processes, each of which contribute local knowledge of markup. Allowing editing markups means some things may get deleted, modified or merged. 2) GUI with multiple inputs (keyboard, mouse, microphone, 2nd keyboard, etc) A Lampley clock is needed to globally timestamp the multiple streams so that they can be merged into an interpreted view of the inputs. I wanted multiple users on different machines around the world to interact on a single display, so just as meta-ctl-f or double-click mouse are combinations that require overlapping time measures, overlapping inputs from different machines can contribute to new behaviour on screen (or in audible music, etc). The key to having multiple isolated processes is ensuring that the method of interaction among the processes is rich enough to express useful constructs, and formally described sufficiently to predict the information transfer that will occur. (It would also be interesting to investigate something that is too complex to monitor formally, such as the information transfer going on between a mass of neurons to produce adaptive, unpredictable behaviour but that would be a different exercise.) > Isolation is an essential pre-condition for building fault-tolerent systems. This is why I switched to erlang from Java. After working with it a while building a gameserver, I decided that the streaming things I wanted to do above required multiple overlapping processes, load balancing and fault tolerance. I thought about the way a webpage is written and wanted to separate the content from the markup to allow versioning of modifications on both, as well as transparent multiple views of the same content. My thinking went towards componentizing the document on the paragraph level and maintaining all the snippets as separate DB items. A paragraph from email becomes quoted and reused on a webpage, but is only stored once so that the versioning and attribution can remain. I have concluded the simplest way to implement this is to use an "object - oriented" approach (horrors, not this discussion again! -- bear with me). I plan to implement an Aspect-Oriented approach that more closely resembles the old Simula than any modern day OO system. Here are the basic features: 1) Every object is a process 2) Objects communicate with messages 3) The "behaviours" or "methods" of an object are modules (aspects) 4) Any object may contain any set of aspects (no inheritance as we know it) 5) An "instance" is created by composing the aspects needed 6) Aspects may dynamically be added or removed from a process 7) Prototype stamping of instances provides a syntactic shorthand for creating a collection of similarly configured items (traditional class related instances) Joe later wrote: > My view is that > 1) We should construct systems from isolated components > 2) The systems should communicate with asynchronous messages > 3) The sequencing and types of these messages should be governed by contracts > 4) The contracts should be checked dynamically and all the time The result is exactly what Joe is talking about, if the following extensions are added: 8) Objects communicate using UBF messages 9) Programmers write aspects 10) Architects weave objects > We should also aim to improve the isolation bit - ie make Erlang etc better > to avoid malicious inter-process denial of service attacks. This is the one thing about erlang that I thought was lacking, but I haven't thought about how to improve it (I don't have the background knowledge). I would like to use erlang more as a P2P type system, but the whole notion of cookies, how they are communicated and how to prevent spoofing is a bit scary in a wide open world. I like the idea of reusing proven code by hooking it with new code and letting them talk to each other. I don't like the idea of digging into Apache or gcc and trying to add a feature. jay From joe@REDACTED Fri Aug 22 16:26:04 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 22 Aug 2003 16:26:04 +0200 (CEST) Subject: ReRe: why isolated components In-Reply-To: <200308221214.h7MCE3D04720@duna273.eth.ericsson.se> Message-ID: On Fri, 22 Aug 2003, Laszlo Varga wrote: > Hello, > it seems that we are getting understand each other. > At least we have no clear idea about what Joe want to have. > Really, it seems that the motivation is to have something > process based fault tolerancy or robustness or at least stability. > UBF is also behind the scene, what makes me suspicious. > > Maybe I'm mistaken, but the main point in UBF - I think- the C level, > the contract. It makes an UBF contract much more strict then an IDL. > In other words, it specifies the dynamic behaviour while IDLs-are just static. Yes. APIs are deeply flawed: Look at this code: silly() -> {ok, H} = file:open("foo.dat", read), file:close(H), file:read_line(H). It is stupid - yes, you can't read a line *after* you've closed the file. Here's the API in some type system: +type file:open(fileName(), read | write) -> {ok, fileHandle()} | {error, string()}. +type file:read_line(fileHandle()) -> {ok, string()} | eof. +type file:close(fileHandle()) -> true. +deftype fileName() = [int()] +deftype string() = [int()]. +deftype fileHandle() = pid(). Does this help? - No way. Add states, like this: +type start x file:open(fileName(), read | write) -> {ok, fileHandle()} x ready | {error, string()} x stop. +type ready x file:read_line(fileHandle()) -> {ok, string()} x ready | eof x atEof. +type atEof | ready x file:close(fileHandle()) -> true x stop. +type atEof | ready x file:rewind(fileHandle()) -> true x ready Rule (2) says for example that in the state "ready" you can evaluate file:read_line(fileHandle()) and it will return something of type {ok, string()} and move into state "ready", or it will return eof and move into state "atEof" > > Is not the THING about building a contract-specified component system? Yes^100. Contracts and APIs are *almost* equivalent. IMHO systems should be made of black boxes (ie my famed components that I keep blithering on about) - you check the inputs and outputs to the BBs NOT what goes on at every single function call. Inside a BB you might program in assembler (whatever) break all rules of common-sense etc. But "at the door" - when you pass in or out of the BB you *must* obey the protocol. Observational equivalence applies. Any two BBs that behave the same way ARE equivalent. The nice thing about doing dynamic checking is we can add non-functional requirements. for example: ready x read_line -> ( {ok, string()} x ready eof x error ) within 5 seconds Which is way beyond the state-of-the-art in statically checked systems. > > If it were, i'd like it. Then you should like this approach /Joe > > Thanks for your time > Laszlo > > > > > Laszlo Varga wrote: > > > thanks for the "answer". Right, isolation reduces the (possible) complexity, > > > but is that the motivation for the wrapper project? > > > > Well, *that* is another issue. > > > > I don't know Joe's thoughts on the subject, but my impression is that > > it's about coping with failures. > > If a subroutine crashes, or if it just detects an abnormal condition and > > logs it, this is behaviour that punches right through to the top levels > > of the application. The "let it crash" philosophy of Erlang says: if a > > component fails, let if fail, and don't burden the caller (or service > > requester or whatever you name it) with analysis of the crash details, > > just tell it that the request failed. > > The toplevel may be unable to cope with the situation, but then passing > > up crash details will introduce lots of coupling just for the rare case > > of a crash - the resulting design mess just isn't worth the benefits. > > > > Other languages handle this via exceptions. > > Eiffel got this right: Eiffel exceptions are unsuitable for passing up > > information on a crash (apart from diagnostic information that helps > > programmers and debuggers; there's no channel for passing up information > > that would help the top-level to analyze the error). > > Java and C++ got it wrong: they make it all too easy to pass up > > information that allows the caller to continue. The net result being > > that exceptions create an additional, quite tight coupling between low > > and high levels of the system. (It's no good if the top-level of a > > system tries to handle an InternetConnectionFailure exception just > > because an Internet resource wasn't available ten call levels below it...) > > > > Erlang's idea is to separate the layers of processing into separate > > processes, and to let the process crash. The advantage is that this > > quite nicely handles any memory leaks that might occur on lower levels > > (even garbage-collected languages can leak memory: when calling out into > > C, or when accumulating larger and larger structures). > > I consider it a disadvantage that this interleaves the issues of crash > > protection and asynchronous message passing. However, my Erlang > > experience is *very* limited, so please consider the latter just an > > uninformed opinion. > > > > HTH > > Jo > > > From joe@REDACTED Fri Aug 22 16:33:52 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 22 Aug 2003 16:33:52 +0200 (CEST) Subject: ReRe: why isolated components In-Reply-To: <200308221214.h7MCE3D04720@duna273.eth.ericsson.se> Message-ID: > > > but is that the motivation for the wrapper project? > > > > Well, *that* is another issue. > > > > I don't know Joe's thoughts on the subject, but my impression is that > > it's about coping with failures. Yes > > If a subroutine crashes, or if it just detects an abnormal condition and > > logs it, this is behaviour that punches right through to the top levels > > of the application. The "let it crash" philosophy of Erlang says: if a > > component fails, let if fail, and don't burden the caller (or service > > requester or whatever you name it) with analysis of the crash details, > > just tell it that the request failed. > > The toplevel may be unable to cope with the situation, but then passing > > up crash details will introduce lots of coupling just for the rare case > > of a crash - the resulting design mess just isn't worth the benefits. Processes that fail if they can't do what they are supposed to do are called "fail-stop" - this is how the Tandem computer was designed. I recentely read the amazingly good: @techreport{gray, author = "Jim Gray", title = "Why do computers stop and what can be done about it?", type = "Technical Report", number = "85.7", institution = "Tandem Computers", year = 1985 } It was like reading a description of Erlang. One way to describe Erlang and OTP is "It's just like the tandem - only in software instead of hardware" > > > > Other languages handle this via exceptions. > > Eiffel got this right: Eiffel exceptions are unsuitable for passing up > > information on a crash (apart from diagnostic information that helps > > programmers and debuggers; there's no channel for passing up information > > that would help the top-level to analyze the error). Yes - as well as isolation you need, what schneider calls "Failure-reason" > > Java and C++ got it wrong: they make it all too easy to pass up > > information that allows the caller to continue. The net result being > > that exceptions create an additional, quite tight coupling between low > > and high levels of the system. (It's no good if the top-level of a > > system tries to handle an InternetConnectionFailure exception just > > because an Internet resource wasn't available ten call levels below it...) > > Shudder > > Erlang's idea is to separate the layers of processing into separate > > processes, and to let the process crash. The advantage is that this > > quite nicely handles any memory leaks that might occur on lower levels > > (even garbage-collected languages can leak memory: when calling out into > > C, or when accumulating larger and larger structures). > > I consider it a disadvantage that this interleaves the issues of crash > > protection and asynchronous message passing. I beg to differ :-) > However, my Erlang > > experience is *very* limited, so please consider the latter just an > > uninformed opinion. > > > > HTH > > Jo > > > From joe@REDACTED Fri Aug 22 16:43:04 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 22 Aug 2003 16:43:04 +0200 (CEST) Subject: Maybe Erlang is OO after all? Message-ID: I have been reliably informed that maybe Erlang *is* OO after all. The argument goes like this: The two most important things in OO reasoning are: - isolation, and, - polymorphism All the other stuff - inheritance etc pales into insignificance in comparison. Isolation is needed to implement true objects - they *must* be isolated processes are a very good approximation to true objects (in as much as two Erlang processes are fairly well isolated) We can easily set-up polymorphic protocols to processes and write polymorphic functions (like lists:sort) - why is polymorphism so nice it make programming so much easier - all objects obey the same protocol (at some level of abstraction). Thus it might be argued that: - Erlang *is* OO and - Erlang is *more* OO than any of the other so called OO languages Put that in your pipe and smoke it! Cheers /Joe From vlad_dumitrescu@REDACTED Fri Aug 22 16:44:53 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 22 Aug 2003 16:44:53 +0200 Subject: The wrapper project References: Message-ID: Hi, Some possibilities might be: xtrap (seems to be deprecated) xtest extensions with xautomation http://www.gnu.org/software/xnee/ xwit regards, Vlad ----- Original Message ----- From: "Joe Armstrong" To: "Marc Ernst Eddy van Woerkom" Cc: Sent: Friday, August 22, 2003 4:10 PM Subject: Re: The wrapper project > On Thu, 21 Aug 2003, Marc Ernst Eddy van Woerkom wrote: > > > > Mplayer is currently commanded by mouse and keyboard events. > > > > > > I'd like to add a wrapper so I could control it from a socket, like > > > this: > > > > There must be test programs for X11 apps who have solved how to > > simulate mouse and keyboard, I hope it is not necessary to > > write special X device drivers. > > Does anybody know of such a (free) program ? > > /Joe > > > > > Java has a robot class for such. Its uses are tests and demos. > > > > Regards, > > Marc > > > > > > > > > > > > > > > > > > > > From vances@REDACTED Fri Aug 22 17:22:00 2003 From: vances@REDACTED (Vance Shipley) Date: Fri, 22 Aug 2003 11:22:00 -0400 Subject: ReRe: why isolated components In-Reply-To: References: <200308221214.h7MCE3D04720@duna273.eth.ericsson.se> Message-ID: <20030822152159.GJ21374@frogman.motivity.ca> One problem which is hard to eliminate is that people will make assumptions. You can obey the contract but ignore the intention. The discussion about file descriptors comes to mind. If we peek into the token we are passed on an open() we can start to make assumptions about what to expect and can cheat in how we deal with them. Every time I see code like this I smell trouble: fd = open(...) foo[fd] = ... One might just start doing this: for (i=first_fd; i <= last_fd; i++) write(i, ...) or number_of_files = last_fd - stderr It might appear to work most of the time. Further if a black box is always observered to behave in a certain way it will often be assumed that it should always behave that way. After a while it becomes expected and systems are built to depend on it and eventually someone puts it in a standard. Maybe the contract checker should mangle handles so they are unobservable. The addition of state to the type system goes a long way to define the other behaviour. -Vance On Fri, Aug 22, 2003 at 04:26:04PM +0200, Joe Armstrong wrote: } } Inside a BB you might program in assembler (whatever) break all rules of } common-sense etc. But "at the door" - when you pass in or out of the } BB you *must* obey the protocol. Observational equivalence applies. } Any two BBs that behave the same way ARE equivalent. From svg@REDACTED Fri Aug 22 17:07:53 2003 From: svg@REDACTED (Vladimir Sekissov) Date: Fri, 22 Aug 2003 21:07:53 +0600 (YEKST) Subject: The wrapper project In-Reply-To: References: <200308211722.h7LHMZu02499@bonsai.fernuni-hagen.de> Message-ID: <20030822.210753.108755885.svg@surnet.ru> From: Joe Armstrong Subject: Re: The wrapper project Date: Fri, 22 Aug 2003 16:10:22 +0200 (CEST) Message-ID: joe> On Thu, 21 Aug 2003, Marc Ernst Eddy van Woerkom wrote: joe> joe> > > Mplayer is currently commanded by mouse and keyboard events. joe> > > joe> > > I'd like to add a wrapper so I could control it from a socket, like joe> > > this: joe> > joe> > There must be test programs for X11 apps who have solved how to joe> > simulate mouse and keyboard, I hope it is not necessary to joe> > write special X device drivers. joe> joe> Does anybody know of such a (free) program ? I know about Android: http://www.wildopensource.com/larry-projects/android.html This sort of programs use standard Xtest extention of X11 which allows you send events to GUI in textual form. Best Regards, Vladimir Sekissov From hal@REDACTED Fri Aug 22 18:11:25 2003 From: hal@REDACTED (Hal Snyder) Date: Fri, 22 Aug 2003 11:11:25 -0500 Subject: ei_rpc_from speedup? In-Reply-To: <20030822124806.GH21374@frogman.motivity.ca> (Vance Shipley's message of "Fri, 22 Aug 2003 08:48:06 -0400") References: <87vfsqzb03.fsf@ghidra.vail> <20030822124806.GH21374@frogman.motivity.ca> Message-ID: <87k795pt8y.fsf@ghidra.vail> Vance Shipley writes: > File descriptors are opaque data types. You shouldn't make any > assumptions about what values they take other than that they fit in > an int. That file descriptors are assigned incrementally increasing > from stdio is only a well known practice not a guarantee. I'm > currently working with devices which start at 257 and assign > incrementally from there. Thanks for the reply. But, I'm not aware of *any* OS where the following would be wrong - such an OS would make the initial argument to select useless. FD_ZERO(&readmask); FD_SET(fd,&readmask); ... (select(fd + 1, &readmask, NULL, NULL, t) ... Note I don't care what number fd is, whether it's 3 or 403. Is there such a (broken?) OS - where the above does not achieve the desired result? BTW, FreeBSD-5.0 select man page also says: For historical reasons, select() will always examine the first 256 descriptors. Of course if we're using only the BSDs we would probably want kernel events and not moldy old select/poll. > On Thu, Aug 21, 2003 at 09:23:08PM -0500, Hal Snyder wrote: > } > } On FreeBSD-5.0 at least, FD_SETSIZE defaults to 1024U. Isn't the > } following patch an improvement (pointed out by Rick Pettit)? > ... > } - switch (select(FD_SETSIZE, &readmask, NULL, NULL, t)) { > } + switch (select(fd + 1, &readmask, NULL, NULL, t)) { From fritchie@REDACTED Fri Aug 22 18:20:55 2003 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 22 Aug 2003 11:20:55 -0500 Subject: why isolated components In-Reply-To: Message of "Fri, 22 Aug 2003 14:41:02 +0200." Message-ID: <200308221620.h7MGKtTp080154@snookles.snookles.com> I can't recall if I've already mentioned this to the erlang-questions crowd, so forgive me if I'm repeating myself. >>>>> "ja" == Joe Armstrong writes: ja> In a paper on Java by Czajkowski and Dayn\`{e}s [1], from Sun ja> Microsystems, say: ja> The only safe way to execute multiple applications, written in the ja> Java programming language, on the same computer is to use a ja> separate JVM for each of them, and to execute each JVM in a ja> separate OS process. The Software Infrastructures Group at Stanford is taking this exact approach to provide the sort of software component isolation that Joe is talking about. See http://swig.stanford.edu/public/projects/roc/ for lots of papers. "By concentrating on reducing Mean Time to Repair (MTTR) rather than increasing Mean Time to Failure (MTTF), [Recovery Oriented Computing] reduces recovery time and thus offers higher availability." They've cooked up a system for applications distributed across multiple JVMs that *very* closely resembles the Erlang/OTP supervisor behavior. I love the title of one of their papers: "Crash-Only Software". -Scott P.S. I hope to see many of you in Uppsala next week. From fritchie@REDACTED Fri Aug 22 18:28:55 2003 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 22 Aug 2003 11:28:55 -0500 Subject: The wrapper project In-Reply-To: Message of "Fri, 22 Aug 2003 16:44:53 +0200." Message-ID: <200308221628.h7MGStTp080260@snookles.snookles.com> >>>>> "vd" == Vlad Dumitrescu writes: vd> Some possibilities might be: The latest issue of Linux Journal magazine has an article on scripting X applications. A sidebar at the end of the article includes URLs for some of the items in Vlad's list: xautomation (includes xte) http://hoopajoo.net/projects/xautomation.html xwit http://softcity.libero.it/debian/pool/main/x/xwit Also, the "xev" utility is useful for figuring out what events are being thrown around by the X server. http://www.ditch.org/kbstick uses the XTest to take joystick input and convert them to keyboard events. -Scott From joachim.durchholz@REDACTED Fri Aug 22 18:53:28 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Fri, 22 Aug 2003 18:53:28 +0200 Subject: Maybe Erlang is OO after all? In-Reply-To: References: Message-ID: <3F464A88.1030203@web.de> Joe Armstrong wrote: > I have been reliably informed that maybe Erlang *is* OO after all. > > The argument goes like this: > > The two most important things in OO reasoning are: > > - isolation, and, - polymorphism > > All the other stuff - inheritance etc pales into insignificance in > comparison. That's not the majority opinion in the OO arena. More importantly, one of the key points in making OO practical is that calling a polymorphic function is very little overhead over calling a monomorphic one. I don't see this happen in Erlang: sending an asynchronous message is, after all, *much* more overhead than doing a subroutine call, even if that call goes through a dispatch table. You'll probably consider that overhead negligible, but that's only because you don't do serious data moving through messages. You're not going to write a separate process for doing arithmetic with complex numbers, string processing, or similar basic tasks - OO languages do a dynamic dispatch on these (or *should* do it...) In other words, claiming OO for Erlang is a bit like claiming functionalness for C - yes you *can* do it, but it's not practical... > Isolation is needed to implement true objects - they *must* be > isolated processes are a very good approximation to true objects > (in as much as two Erlang processes are fairly well isolated) > > We can easily set-up polymorphic protocols to processes and write > polymorphic functions (like lists:sort) - why is polymorphism so > nice it make programming so much easier - all objects obey the same > protocol (at some level of abstraction). Agreed. > Thus it might be argued that: > > - Erlang *is* OO and > - Erlang is *more* OO than any of the other so called OO languages Actually, the "most OO" language that I know is Smalltalk, which does dynamic dispatch on *everything*, including integer arithmetic. Also, I don't see much gain in claiming OO-ness for Erlang. The OO hype is the Cobol of the last and (as it seems) current decade. The one lasting value of OO that I see is its insistence on isolation. The polymorphism aspects of OO are far overrated, and tend to leave type holes in murky areas of the language specification. (The bad thing is that these type holes tend to go unnoticed for three to fifteen years, depending on how much polymorphic type theory the language designer has under the hood - and there's usually a deficit there.) Just my 2c. Regards, Jo From cpressey@REDACTED Fri Aug 22 19:05:15 2003 From: cpressey@REDACTED (Chris Pressey) Date: Fri, 22 Aug 2003 12:05:15 -0500 Subject: why isolated components In-Reply-To: References: <3F44DF63.7080406@web.de> Message-ID: <20030822120515.3152db00.cpressey@catseye.mine.nu> On Fri, 22 Aug 2003 14:41:02 +0200 (CEST) Joe Armstrong wrote: > [...] > Normally we use OS processes for precisely this reason - processes > provide "protection domains" and the isolate the effects on an error > to the process where the error occurred. > > At least that's the idea - no OS that I know of has this property, > and some OSs are better than others. Windows 98 for example has > appalling protection between processes - doing something silly in one > process can easily crash the entire machine. The Linuxes are not much > better - one process can essentially do a denial of survive attack on > other processes in the system, by thrashing the disk or something. > [...] > Erlang tries to achieve this, it does somewhat better than mosts OSs > but still one process could attack another process by sending it > zillions of messages. Erlang was designed to protect processes from > accidental errors not malicious attack. Um... Joe, are you implying that it's *possible* to construct a system that is impervious to DoS/flooding? Or are you just carping? > Memory protection is *unnecessary* in a language without pointers > and decent garbage collector (like Erlang, lisp, prolog, smalltalk, > ...) but essential for C, C++. And guess what almost all of those pointerless languages are written in! At any rate, this is certainly a different analysis than the point of view where it "doesn't matter" what language some component is written in. Basically I guess my point is this - coming out in favour of isolating processes on this mailing list, is preaching to the converted. Most Erlang programmers really do understand the benefits. So if you're asking us what we think, yes of course it's a good idea - and I'm sure as we need wrappers, we do construct them, on an ad-hoc basis. On the other hand if you're asking for help in your Crusade to Wrapperize the Entire Planet, it would help immensely if you could provide a clear framework for it *first*. So if you're *really* convinced this is the way to go, how about writing a paper on it? I think that would have more persuasive power in the long run than some mailing-list ramblings. Just my $0.02 worth of mailing-list ramblings, -Chris From cpressey@REDACTED Fri Aug 22 19:24:22 2003 From: cpressey@REDACTED (Chris Pressey) Date: Fri, 22 Aug 2003 12:24:22 -0500 Subject: Maybe Erlang is OO after all? In-Reply-To: <3F464A88.1030203@web.de> References: <3F464A88.1030203@web.de> Message-ID: <20030822122422.4b4ac69e.cpressey@catseye.mine.nu> On Fri, 22 Aug 2003 18:53:28 +0200 Joachim Durchholz wrote: > Joe Armstrong wrote: > > [...] > > We can easily set-up polymorphic protocols to processes and > > write > > polymorphic functions (like lists:sort) - why is polymorphism so > > nice it make programming so much easier - all objects obey the same > > protocol (at some level of abstraction). > > Agreed. So who ever said programming should be easy, is what I want to know. Polymorphism as it's usually promoted elevates the semantic<->syntactic mapping to a human (read: fuzzy) level while obscuring the actual working detail semantics. i.e., suddenly X.play() can have wildly different resource requirements depending on whether X is of type Movie or of type GameOfNim. And don't even get me started on dog.bark() vs. tree.bark(). I'd be quite happy in a world where I had to say X.play_video() or X.play_game_of_nim() explicitly; at least then I'd be able to better judge what is going on merely by reading the place in the code where it happens. On the other hand, like overloading, sometimes it's just right - I don't want to have to use float+ instead of int+ to add floating point values. But likewise, cout << "hello" leaves a bad taste in my mouth - output's relation to left-shift is fuzzy at *best*. Sure, it makes programming "easier", like Perl's dense forest of symbols makes programming "easier" (fewer keystrokes) - but in the long run, the more semantics that get piled up onto the same syntax, the more context-dependent it is, and the more there is to remember when it comes time to maintain the code. Probably the first tenet of OO, before Polymorphism, Inheritance, and even Encapsulation, should've been Moderation... ...but that's just not sexy. -Chris From TriumphX75@REDACTED Fri Aug 22 21:40:48 2003 From: TriumphX75@REDACTED (Dave McMahon) Date: Fri, 22 Aug 2003 20:40:48 +0100 Subject: Erlang on OS X In-Reply-To: <200308220753.h7M7rReT029974@harpo.it.uu.se> Message-ID: <8770CF36-D4D8-11D7-A27E-000A2782E4B6@mac.com> On Friday, Aug 22, 2003, at 08:53 Europe/Dublin, Kostis Sagonas wrote: > Vlad Dumitrescu wrote: > >>> When I run the Wings3D loader it hands off to beam, which then takes >>> about 30 minutes to actually display anything on screen. I downloaded >>> the precompiled version of Erlang/OTP and found that when I run erl >>> from the terminal, it's a similar story. It seems to work, >>> eventually. >> >> This is a wild guess, but I had a similar problem on Windows. The >> problem >> was that I had added a lot of entries in the .hosts file and at >> startup, >> loading the file took a long time. Not 30 minutes, but like 5-6. > > I experienced a similar problem on my old laptop running Linux > Mandrake. > For some weird reason, the /etc/hosts file was filling with 2999 > entries > once in a while, and starting beam took quite a while. Deleting those > entries, fixed the problem. > > Kostis. > > Well, your wild guess was right on the money. Some time ago while I was still using dialup I installed an etc/hosts file that pointed a lot of spam/advertising sites to 127.0.0.1 and sped up my web access by a large amount. The file was about half a megabyte in size, and this was indeed the cause of my problems with Erlang/OTP. Now I've gone back to an etc/hosts file that is about half a kilobyte things are running perfectly. However, one thing does rather confuse me. From the README file that comes with the source for Erlang/OTP: > Erlang/OTP will read the network configuration files in "/etc" at > startup. In Darwin these are normally not used by the operating > system. The easiest way to force Erlang/OTP avoid reading the files > is to put the line (including the ending '.') > > {lookup,["native"]}. Doing this didn't seem to have any effect on the problem whatsoever. It's irrelevant in my case because I no longer use the large etc/hosts file anyhow, but I would have thought it would have circumvented the problem. Many thanks for your help. Dave McMahon From joachim.durchholz@REDACTED Sat Aug 23 03:39:28 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Sat, 23 Aug 2003 03:39:28 +0200 Subject: Maybe Erlang is OO after all? In-Reply-To: <20030822122422.4b4ac69e.cpressey@catseye.mine.nu> References: <3F464A88.1030203@web.de> <20030822122422.4b4ac69e.cpressey@catseye.mine.nu> Message-ID: <3F46C5D0.6070507@web.de> Chris Pressey wrote: > Polymorphism as it's usually promoted elevates the semantic<->syntactic > mapping to a human (read: fuzzy) level while obscuring the actual > working detail semantics. i.e., suddenly X.play() can have wildly > different resource requirements depending on whether X is of type Movie > or of type GameOfNim. And don't even get me started on dog.bark() vs. > tree.bark(). You can control this kind of problem using assertions (or, more precisely: using the Design by Contract rules). In a nutshell, Design by Contract says: In the superclass, every routine should have preconditions and postconditions that adequately define the semantics of that routine. In the subclass, any redefinition must be compatible with these assertions (the actual rules are more precise, but that's the gist of it). GOOD OO software is written with Design by Contract in mind. (A fuzzily-worded version of DbC is known as the "Liskov Substitution Principle", in case anybody wants to do a Google search.) My experience with a language that supports DbC directly is that this is powerful enough to prevent idiocies like Dog.bark vs. Tree.bark (not that anybody in his right mind would make Dog a subclass of Tree or vice versa - this kind of problem is far less common than one might think). Regards, Jo From ms@REDACTED Sat Aug 23 05:35:04 2003 From: ms@REDACTED (Martin Sandiford) Date: Sat, 23 Aug 2003 13:05:04 +0930 Subject: Problem with 64 bit FP under ARM Message-ID: <20030823033504.GB4013@mcdev.com.au> Hello all, I have a problem with 64 bit floating point numbers on an embedded SA1110 based machine running under Linux. A summary of the problem: (Running under Linux on x86): 1> <<1.0:64/float>>. <<63,240,0,0,0,0,0,0>> (Pretty much as expected for a little endian machine) (Running under Linux on ARM): 1> <<1.0:64/float>>. <<0,0,0,0,63,240,0,0>> (Looks a bit like little endian, only the quads are swapped) This essentially means that any code compiled with floating point constants in it will not run on the other machine. It might also mean other issues as well, but this is where I first discovered the problem. I'm not an ARM expert, so I can only assume that the correct representation for a double on ARM is with the quads swapped with respect to "normal" LE ordering. Does anyone here know if this is the case? I'm thinking it maybe could be a problem with the FP emulator? (There is no FPU on this board). In the mean time, I've included some hacks in erl_bits.c to modify erts_bs_put_float() and erts_bs_get_float() to swap the quad order when reading or writing 64 bit floats on ARM. This seems to fix the cross compilation problem. Are there any other areas that I should be looking at? Martin From matthias@REDACTED Sat Aug 23 10:55:01 2003 From: matthias@REDACTED (Matthias Lang) Date: Sat, 23 Aug 2003 10:55:01 +0200 Subject: Problem with 64 bit FP under ARM In-Reply-To: <20030823033504.GB4013@mcdev.com.au> References: <20030823033504.GB4013@mcdev.com.au> Message-ID: <16199.11237.930151.268859@antilipe.corelatus.se> Martin Sandiford writes: > (Running under Linux on x86): > 1> <<1.0:64/float>>. > <<63,240,0,0,0,0,0,0>> > (Pretty much as expected for a little endian machine) > > (Running under Linux on ARM): > 1> <<1.0:64/float>>. > <<0,0,0,0,63,240,0,0>> > (Looks a bit like little endian, only the quads are swapped) I run erlang r8b on linux on a big-endian PowerPC embedded system with floating point emulation: 1> <<1.0:64/float>>. <<63,240,0,0,0,0,0,0>> I know very little about floating point arithmetic. I don't know if that's "correct" or not, I'm just giving you another data point. The Erlang build system isn't really built for cross-compiling, I had to do a fair bit of manual tweaking to get things to work. I assume you've checked what happened during autoconf, e.g. that you have ac_cv_c_bigendian=${ac_cv_c_bigendian=yes} > This essentially means that any code compiled with floating point > constants in it will not run on the other machine. It might also mean > other issues as well, but this is where I first discovered the > problem. If you provide an example which fails I'll try it. > I'm thinking it maybe could be a problem with the FP emulator? Are you using the in-kernel FP emulation or the gcc 'soft-float'? See also: http://codepoet.org/lists/busybox/2003-June/008547.html Matthias From wolfoxbr@REDACTED Fri Aug 22 21:42:59 2003 From: wolfoxbr@REDACTED (Roberto Amorim) Date: Fri, 22 Aug 2003 16:42:59 -0300 Subject: Maybe Erlang is OO after all? References: <3F464A88.1030203@web.de> Message-ID: > In other words, claiming OO for Erlang is a bit like claiming > functionalness for C - yes you *can* do it, but it's not practical... Well put. > Actually, the "most OO" language that I know is Smalltalk, which does > dynamic dispatch on *everything*, including integer arithmetic. Smalltalk is still my favorite language - it just feels right to me. I'm an Erlang newbie, I admit, but I doubt it will be so natural for me as Smalltalk is (even though I'm enjoying Erlang). > Also, I don't see much gain in claiming OO-ness for Erlang. The OO hype > is the Cobol of the last and (as it seems) current decade. > The one lasting value of OO that I see is its insistence on isolation. > The polymorphism aspects of OO are far overrated, and tend to leave type > holes in murky areas of the language specification. (The bad thing is > that these type holes tend to go unnoticed for three to fifteen years, > depending on how much polymorphic type theory the language designer has > under the hood - and there's usually a deficit there.) I don't see OO fading away so soon - in fact, I doubt it will, IMHO. But I admit you have a point. I agree OO is generally overrated, and polymorphism in particular. In fact, IMHO, one of the main weaknesses of class-based OO is its dependence on good design - without which you have to rely on heavy refactoring. Prototype-based OO is more flexible, but big systems can grow to extreme levels of complexity if you don't take measures against disordinate growth and modification. Functional languages seem to be more flexible to design changes and adaptations, but as long as I'm concerned, it remains to be seen. :-) Just my .02 worth... Roberto From gwright@REDACTED Fri Aug 22 23:18:40 2003 From: gwright@REDACTED (Gregory Wright) Date: Fri, 22 Aug 2003 17:18:40 -0400 Subject: R9C-0 available on OS X under darwinports Message-ID: <33AF0C64-D4E6-11D7-9F32-00039398F084@comcast.net> Hello, Erlang/OTP version R9C-0 is available under the darwinports system on Mac OS X. Darwinports is a packaging system similar to the *BSD ports system. More information on installing darwinports is available from www.opendarwin.org/projects/darwinports/ The port itself is found in the lang/erlang directory. If anyone would like to maintain this port, let me know. It is left over from some work I did at my previous company. It would be nice if a regular user of Erlang would look after it. If you have any questions, send them to me directly as I do not subscribe to the erlang-questions list. Best Wishes, Greg Wright Gregory Wright Antiope Associates gwright@REDACTED From ms@REDACTED Sat Aug 23 15:39:29 2003 From: ms@REDACTED (Martin Sandiford) Date: Sat, 23 Aug 2003 23:09:29 +0930 Subject: Problem with 64 bit FP under ARM In-Reply-To: <16199.11237.930151.268859@antilipe.corelatus.se> References: <20030823033504.GB4013@mcdev.com.au> <16199.11237.930151.268859@antilipe.corelatus.se> Message-ID: <20030823133929.GC4013@mcdev.com.au> Hi Matthias, On Sat, 23 Aug 2003, Matthias Lang wrote: > I run erlang r8b on linux on a big-endian PowerPC embedded system > with floating point emulation: > > 1> <<1.0:64/float>>. > <<63,240,0,0,0,0,0,0>> This looks good to me. Erlang does some internal massaging to make sure the ordering is common (BE I think?) regardless of platform. I believe I made a error in my previous statement to the effect that this was the "right" result for a LE machine. I believe it is correct for the beam VM. Usually the difference between LE/BE is a byte by byte swap, highest for lowest. I haven't seen quads swapped like this in double before (but I haven't been looking either). > I assume you've checked what happened during autoconf, e.g. that you > have > > ac_cv_c_bigendian=${ac_cv_c_bigendian=yes} I'm pretty sure I have this set OK. The SA1110 is little endian. It's pretty easy to tell using (I think) <<1:32/integer>> which should output <<0,0,0,1>>, but outputs <<1,0,0,0>> if the endianness is messed up. > If you provide an example which fails I'll try it. if <<1.0:64/float>> outputs as above, this matches with my idea of what should be output. The compiler uses term_to_binary to convert floating point constants into binaries, and then writes them out to the .beam file. When reading them in on the non-matching machine, they are back to front quad wise and represent different numbers altogether. > Are you using the in-kernel FP emulation or the gcc 'soft-float'? See > also: > > http://codepoet.org/lists/busybox/2003-June/008547.html I'm using the in kernel FPE. Thanks for the tip, maybe the soft-float thing will provide a solution. Cheers, Martin From Marc.Vanwoerkom@REDACTED Sun Aug 24 06:46:00 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Sun, 24 Aug 2003 06:46:00 +0200 (MEST) Subject: Loco.. Message-ID: <200308240446.h7O4k0B21639@bonsai.fernuni-hagen.de> In regard of Joe's recent posting that Erlang might be OOP after all, I just came accross an announcement http://compilers.iecc.com/comparch/article/03-08-088 that says that for example perhaps C++ wasn't multi-pardigm enough yet as it was. Waiting for LOCOFPOOPL, Marc > MPOOL'03 -- Call for Papers (Anaheim, Oct 03) > > (..) > > While OO has become ubiquitously employed for design, implementation, and even > conceptualization, many practitioners recognize the concomitant need for other > programming paradigms according to problem domain. We seek answers to the > question of how to address the need for other programming paradigms in the > general context of OO languages. > > Can OO programming languages effectively support other programming paradigms? > The tentative answer seems to be affirmative, at least for some paradigms; for > example, significant progress has been made for the case of functional > programming in C++. > > (..) > > * non-OO programming with OO languages; > * merging functional/logic/OO/other programs (language crossbinding); > * non-OO programming at the meta level (e.g. template metaprogramming) > * module systems vs. object systems > * OO design patterns and their relation to functional patterns > * type system relationships across languages > * theoretical foundations of multiparadigm programming with OO languages From kent@REDACTED Sun Aug 24 17:33:09 2003 From: kent@REDACTED (Kent Boortz) Date: 24 Aug 2003 17:33:09 +0200 Subject: Can't open character-special file In-Reply-To: <20030728131039.GA56404@frogman.motivity.ca> References: <20030728131039.GA56404@frogman.motivity.ca> Message-ID: Vance Shipley writes: > 1> file:open("adc@REDACTED,9e:00temperature", [read, raw, binary]). > {error,eisdir} > > This is not a directory but a character-special file: > > cr--r--r-- 1 root sys 163,256 Jul 27 00:54 adc@REDACTED,9e:00temperature This is now recorded in our internal bug/request/job tracking system (OTP-4782). Thank you for reporting this, kent From kent@REDACTED Sun Aug 24 17:41:56 2003 From: kent@REDACTED (Kent Boortz) Date: 24 Aug 2003 17:41:56 +0200 Subject: P9C: Compilation hangs when last line is a comment with no newline In-Reply-To: <3F255EE2.6030201@manderp.freeserve.co.uk> References: <3F255EE2.6030201@manderp.freeserve.co.uk> Message-ID: Peter-Henry Mander writes: > Eshell V2003.07.28 > > c(testing). > > hangs indefinitely, testing.erl contents are: > > -module(testing). > -export([]). > > % last line with no newline This is now recorded in our internal bug/request/job tracking system (OTP-4783). Thank you for reporting this, kent From Marc.Vanwoerkom@REDACTED Sun Aug 24 22:15:36 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Sun, 24 Aug 2003 22:15:36 +0200 (MEST) Subject: The wrapper project In-Reply-To: (message from Joe Armstrong on Fri, 22 Aug 2003 16:10:22 +0200 (CEST)) Message-ID: <200308242015.h7OKFaj22344@bonsai.fernuni-hagen.de> > > There must be test programs for X11 apps who have solved how to > > simulate mouse and keyboard, I hope it is not necessary to > > write special X device drivers. > > > Java has a robot class for such. Its uses are tests and demos. > > Does anybody know of such a (free) program ? I found one, it is called Android: http://www.wildopensource.com/larry-projects/android.html here is an article http://www.wildopensource.com/larry-projects/article1.html Even if it should not be good, I can't tell, as I have not tested it, I believe it shows an technique to use (X TEST extension). Regards, Marc From ms@REDACTED Mon Aug 25 00:23:01 2003 From: ms@REDACTED (Martin Sandiford) Date: Mon, 25 Aug 2003 07:53:01 +0930 Subject: The wrapper project In-Reply-To: References: <200308211722.h7LHMZu02499@bonsai.fernuni-hagen.de> Message-ID: <20030824222301.GE4013@mcdev.com.au> On Fri, 22 Aug 2003, Joe Armstrong wrote: > On Thu, 21 Aug 2003, Marc Ernst Eddy van Woerkom wrote: > > > > > There must be test programs for X11 apps who have solved how to > > simulate mouse and keyboard, I hope it is not necessary to > > write special X device drivers. > > Does anybody know of such a (free) program ? Xnee might do what you need. http://www.gnu.org/software/xnee/ Martin From mikael.karlsson@REDACTED Sun Aug 24 21:54:57 2003 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Sun, 24 Aug 2003 21:54:57 +0200 Subject: Enterprise Erlang Beams? In-Reply-To: <200308221539.45014.mikael.karlsson@creado.com> References: <200308221539.45014.mikael.karlsson@creado.com> Message-ID: <200308242154.57320.mikael.karlsson@creado.com> OK, I should have read the archive before posting. Micka?l R?mond posted this more than a year ago: http://www.erlang.org/ml-archive/erlang-questions/200207/msg00202.html Has anyone thought more about this? Cheers Mikael ... > Is there anyone that is familiar with J2EE and EJBs who knows if it would be > possible to implement something similar to Enterprise Java Beans in Erlang? ... From kent@REDACTED Mon Aug 25 01:27:41 2003 From: kent@REDACTED (Kent Boortz) Date: 25 Aug 2003 01:27:41 +0200 Subject: Bug in erl_interface in R9C? In-Reply-To: <20030820165502.GA6806@dc.fi.udc.es> References: <20030820165502.GA6806@dc.fi.udc.es> Message-ID: Javier Par?s Fern?ndez writes: > I think there's a bug in ei_decode_longlong when decoding integers bigger > than 2^32. > > --- otp_src_R9C-0/lib/erl_interface/src/decode/decode_longlong.c~ 2003-08-20 18:01:54.000000000 +0200 > +++ otp_src_R9C-0/lib/erl_interface/src/decode/decode_longlong.c 2003-08-20 18:19:18.000000000 +0200 > @@ -51,7 +51,7 @@ > int pos, shift = 0; > n = 0; > for (pos = 0; pos < arity; pos++) { > - n |= get8(s) << shift; > + n |= ((EI_LONGLONG) get8(s)) << shift; > shift += 8; > } > } > > The result of get8(s) << shift is an integer, but when the shift makes the > number bigger than 2^32 the remaining bits are discarded. Putting a cast > to force the result to be 64 bits solves the problem. Thank you for reporting this. The bug has been added to our internal bug tracking system (OTP-4784) and will be corrected in R9C-1, kent From anders_nygren2002@REDACTED Mon Aug 25 01:38:50 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Mon, 25 Aug 2003 01:38:50 +0200 (CEST) Subject: Strange mnesia behaviour Message-ID: <20030824233850.37056.qmail@web14608.mail.yahoo.com> Hi I have found a strange thing in mnesia. I was trying to do some throughput measurement on a process. My process does the following: 1, receive one message 2, make one mnesia:select 3, send one message My test was to send N identicat messages to my process and measure the time it took to process all messages. To my suprise the times grew non-linearly with N. eprof shows that N = 10 - > mnesia:flush_downs/0 is called 55 times N = 100 -> mnesia:flush_downs/0 is called 5000 times N = 4000 -> a whopping 4 million times. Also if I run the test twice with 50 messages I get 2500 mnesia:flush_downs, but when I run one test with 100 messages there are 5000. I the mnesia table has one record. I am using a single node -> no distribution. The table is type bag, disc_copy. I am using R9C on Suse 8.2. Is there something wrong with mnesia or is there something I dont understand? /Anders Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From anders_nygren2002@REDACTED Mon Aug 25 01:42:55 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Mon, 25 Aug 2003 01:42:55 +0200 (CEST) Subject: tv bug Message-ID: <20030824234255.72197.qmail@web14610.mail.yahoo.com> I have found a problem in tv in R9c on Suse 8.2 If I try to resize the window shwing the contents of a table, the window goes into an infinite loop of resizing and jumping back to the original size. /Anders Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From anders_nygren2002@REDACTED Mon Aug 25 02:39:19 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Mon, 25 Aug 2003 02:39:19 +0200 (CEST) Subject: stdlib documentation error Message-ID: <20030825003919.16076.qmail@web14602.mail.yahoo.com> In timer it says that now_diff(T2, T1) -> {Time, Value} That should be now_diff(T2, T1) -> Microseconds /Anders Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From kurtw@REDACTED Mon Aug 25 05:32:30 2003 From: kurtw@REDACTED (Kurt at DBC) Date: Mon, 25 Aug 2003 15:32:30 +1200 Subject: Maybe Erlang is OO after all? In-Reply-To: References: Message-ID: <3F49834E.6060402@dbc.co.nz> Joe Armstrong wrote: > I have been reliably informed that maybe Erlang *is* OO after all. > > Isolation is needed to implement true objects - they *must* be > isolated processes are a very good approximation to true objects (in > as much as two Erlang processes are fairly well isolated) [...] > - Erlang *is* OO > and > - Erlang is *more* OO than any of the other so called OO languages [...] > Put that in your pipe and smoke it! > Cheers It seems to me that there is a big difference between processes and objects in that objects, or OO, don't take account of time. So Objects are discrete, whereas Processes are continuous. If you don't ever take time into account the isolation of private methods/members work very well - the object discretely changes from one state to the next and it doesn't exist between states. Which is why the old example of : /* start */ create Object { var x = 0; } Object.function(y){ set x = y; } output of Object { set result = 100/x; //but what is the value of x here? } /* end */ is seen as right by OO people: -Object doesn't exist -> step 1 : object created -> step 2 : object exists in state x=0 -> step 3 : object set to state x=y -> step 4 : output object and wrong by non-OO people -Object doesn't exist -> step 1 : object created -> step 2 : object exists in state x=0 -> step 3 : object exists in state x=y who fear one of the paths : in parallel: -> step 3 : output Object {Bang! Error : divide by 0} or sequentially: -> step 4 : object set by "someone else" to state x=0 -> step 5 : output Object {Bang! Error : divide by 0} This, ISTM, is also why in OO (admittedly Object Pascal, Java and guessing at C++) threads are so difficult to manage, as they are implicitly time-based, so the thread object can only _simulate_ being in a distinct state (either by polling or blocking) when it is actually in a different state during any time interval - and in no particular state at a given point in time. Processes, by handling the time component of state can basically emulate an object, as they can quite naturally enforce the isolation, polymorphism and the inheritance, which is why : > claiming OO for Erlang is a bit like claiming > functionalness for C - yes you *can* do it, but it's not practical although rather than "practical" I'd say "native". Alternatively, I'd suggest that items in a database would be more easily represented by an OO language as the states are very explicit and very distinct - due to having an enforced commit or rollback, the database items also don't exist between states. Anyway : dutifully smoked. (Or dutifully me.pipe.smoke.earlier() ;) Cheers, Kurt. ps: Never noticed before how OO has stolen a whole lot of usefully descriptive words. Try describing the time component without using the word "component", or database `items` without using the word "object". From ok@REDACTED Mon Aug 25 07:52:46 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 25 Aug 2003 17:52:46 +1200 (NZST) Subject: Maybe Erlang is OO after all? Message-ID: <200308250552.h7P5qkiW144356@atlas.otago.ac.nz> Kurt at DBC wrote a bunch of stuff from a somewhat limited perspective. (It's good to see other people in NZ interested in Erlang, though.) This, ISTM, is also why in OO (admittedly Object Pascal, Java and guessing at C++) threads are so difficult to manage, as they are implicitly time-based, so the thread object can only _simulate_ being in a distinct state (either by polling or blocking) when it is actually in a different state during any time interval - and in no particular state at a given point in time. This is true, but it seems rather unfair to ignore all the languages that were designed with concurrency in mind. (From a Smalltalk perspective, by the way, Object Pascal, Java, and C++ hardly count as OO at all.) A fairer comparison would be with Hewitt's "Actors". From dgud@REDACTED Mon Aug 25 09:42:26 2003 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 25 Aug 2003 09:42:26 +0200 Subject: Strange mnesia behaviour In-Reply-To: <20030824233850.37056.qmail@web14608.mail.yahoo.com> References: <20030824233850.37056.qmail@web14608.mail.yahoo.com> Message-ID: <16201.48610.329141.760622@rian.du.uab.ericsson.se> Hmm flush_downs cleans the msg queue, with alot msgs in it, it takes some time.. Can you email me the test program? /Dan Anders Nygren writes: > Hi > I have found a strange thing in mnesia. I was trying > to do some throughput measurement on a process. > > My process does the following: > 1, receive one message > 2, make one mnesia:select > 3, send one message > > My test was to send N identicat messages to my process > and measure the time it took to process all messages. > To my suprise the times grew non-linearly with N. > eprof shows that > N = 10 - > mnesia:flush_downs/0 is called 55 times > N = 100 -> mnesia:flush_downs/0 is called 5000 times > N = 4000 -> a whopping 4 million times. > > Also if I run the test twice with 50 messages I get > 2500 mnesia:flush_downs, but when I run one test with > 100 messages there are 5000. > > I the mnesia table has one record. > I am using a single node -> no distribution. > The table is type bag, disc_copy. > I am using R9C on Suse 8.2. > > Is there something wrong with mnesia or is there > something I dont understand? > > /Anders > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From per@REDACTED Mon Aug 25 09:43:16 2003 From: per@REDACTED (Per Bergqvist) Date: Mon, 25 Aug 2003 10:43:16 +0300 Subject: Can't open character-special file In-Reply-To: Message-ID: <200308250843.h7P8hGm05954@tessla.levonline.com> Attached is a small patch to fix it. /Per ------------------- > > Vance Shipley writes: > > 1> file:open("adc@REDACTED,9e:00temperature", [read, raw, binary]). > > {error,eisdir} > > > > This is not a directory but a character-special file: > > > > cr--r--r-- 1 root sys 163,256 Jul 27 00:54 adc@REDACTED,9e:00temperature > > This is now recorded in our internal bug/request/job tracking > system (OTP-4782). > > Thank you for reporting this, > > kent > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R9C-0.patch-37 Type: application/octet-stream Size: 593 bytes Desc: not available URL: From per@REDACTED Mon Aug 25 10:08:05 2003 From: per@REDACTED (Per Bergqvist) Date: Mon, 25 Aug 2003 11:08:05 +0300 Subject: timestamps in sasl In-Reply-To: Message-ID: <200308250908.h7P986m07047@tessla.levonline.com> Hi, There seem to a bit more activity on the list now. Since I had very little response on my previous posting I repeat myself. Timestamps for sasl are generated as local time (without timezone indication). The user can optionally set the utc_log environment variable to get time reported in UTC. Sasl will convert local -> utc on the fly. Note that the timestamp is still generated and stored as local time. The problem with is that there is no unambiguous translation for all local -> utc when you don't have the timezone (or rather dayligt saving indication). I my opinion the proper solution would be to generate and store all timestamps in utc. Any comments ? (Anyone else even bother ?) /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From joachim.durchholz@REDACTED Mon Aug 25 11:22:05 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Mon, 25 Aug 2003 11:22:05 +0200 Subject: Maybe Erlang is OO after all? In-Reply-To: <3F49834E.6060402@dbc.co.nz> References: <3F49834E.6060402@dbc.co.nz> Message-ID: <3F49D53D.3050105@web.de> Kurt at DBC wrote: > This, ISTM, is also why in OO (admittedly Object Pascal, Java and > guessing at C++) threads are so difficult to manage, as they are > implicitly time-based, so the thread object can only _simulate_ being > in a distinct state (either by polling or blocking) when it is > actually in a different state during any time interval - and in no > particular state at a given point in time. I think this is more a problem of the way that OO is typically implemented. C++ is particularly bad here: during construction, all calls are "nonvirtual", i.e. you can't use virtual functions to "do the right thing" during object initialization. Since there's a very common need for that, you end up using two-phase object construction: first construct the object, then initialize it. Which means you already have two object states, one of them quite unusable. Which, in turn, means that you have to manage a state for each and every C++ object. It's a pure mess. It's also a problem of the way that OO classes are typically written. Programmers who design a class usually use stateful objects: the interaction with a caller is based on a series of microtransactions during which the serving object undergoes a series of state transformations. Usually, the object is in a state of "ready for requests", "executing request", "holding diagnostic data about the last request". The last and first state are usually the same. With that design, again there's a lot of state involved. If a language makes it easy to package out-of-band data such as error diagnostics into results, and where it's likewise easy to disassemble that data on the caller side, then it's not necessary to have this. In other words: traditional programming languages are missing both tuples that can be defined and constructed with minimal syntactic overhead, and they are missing pattern matching on tuples. I think these difference contribute more to the difficulties in OO design than any difference between time modelling. Actually, I don't understand the difference: you get exactly the same type of synchronicity problems if an object calls itself with virtual calls. Or if it passes itself to another object and gets called back. This is exactly equivalent to an Erlang process sending a message to itself, or sending its id to another process with the intention of being sent back a message, with the exactly same uses and potential pitfalls. A highly concurrent environment will, of course, exhibit more race conditions than a sequential one, but that's unrelated to the differences between OO and processess, it's the difference between parallel and sequential. Just my 2c. Jo From Bengt.Kleberg@REDACTED Mon Aug 25 10:31:17 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Mon, 25 Aug 2003 10:31:17 +0200 Subject: USENIX - HotOS IX - Scribe Reports Message-ID: <3F49C955.4000002@ericsson.com> greetings, some of the os questions discussed at: are _very_ similar to erlang design goals. bengt From sean.hinde@REDACTED Mon Aug 25 12:02:58 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 25 Aug 2003 11:02:58 +0100 Subject: R9C-0 shared libraries don't work on OS X Message-ID: <4DD7C34F-D6E3-11D7-A8BE-000A95927CCE@mac.com> Hi, In R9C-0 the shared library for asn1 doesn't run on OS X (it crashes the emulator). The following patch fixes the issue in line with the guidelines in the top level README. As this changes configure.in it is obviously necessary to run autoconf in the erts directory after applying the patch. Regs, Sean --- otp_src_R9C-0.orig/erts/configure.in Tue Aug 5 14:36:25 2003 +++ otp_src_R9C-0/erts/configure.in Mon Aug 25 10:14:39 2003 @@ -1035,7 +1035,8 @@ darwin*) # Mach-O linker: a shared lib and a loadable # object file is not the same thing. - DED_LDFLAGS="-bundle -flat_namespace -undefined suppress -lbundle1.o" + DED_LD="$CC" + DED_LDFLAGS="-bundle -flat_namespace -undefined suppress" DED_CFLAGS="$DED_CFLAGS -fno-common" ;; *) From joachim.durchholz@REDACTED Mon Aug 25 12:11:19 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Mon, 25 Aug 2003 12:11:19 +0200 Subject: timestamps in sasl In-Reply-To: <200308250908.h7P986m07047@tessla.levonline.com> References: <200308250908.h7P986m07047@tessla.levonline.com> Message-ID: <3F49E0C7.8020007@web.de> Per Bergqvist wrote: > (Anyone else even bother ?) Yes, I still do bother. When (if) I'm going to have multiple servers running, it's quite conceivable that they will be in different timezones. Regards, Jo From joe@REDACTED Mon Aug 25 13:52:54 2003 From: joe@REDACTED (Joe Armstrong) Date: Mon, 25 Aug 2003 13:52:54 +0200 (CEST) Subject: Documentation of heap data structures Message-ID: Hello, Is there any documentation of the data structures used to represent tuples, lists, binaries etc on the heap. Also is the layout of a stack frames documented anywhere. I know they are tagged pointers, but are there any text files which *specify* the structure or must I read the code (sigh) to find out? Thanks /Joe From D.WILLIAMS@REDACTED Mon Aug 25 13:52:33 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Mon, 25 Aug 2003 13:52:33 +0200 Subject: idiom for clearing up resources? Message-ID: Hello, Is there an idiom for initializing and clearing up resources (e.g. files) needed by an Erlang function, in such a way that the clear-up code gets called even in the face of an error? e.g. myfunc() -> ok = file:make_dir("c:/tmp/foo"), % do some stuff ok = file:del_dir("c:/tmp/foo"). I want the last line to be called even if "do some stuff" crashes. Basically, coming from a C++ background, this is the code I would have put in something's destructor, and I am wondering what Erlangers do... Cheers, Dominic. From francesco@REDACTED Mon Aug 25 14:10:06 2003 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 25 Aug 2003 13:10:06 +0100 Subject: idiom for clearing up resources? References: Message-ID: <3F49FC9E.8030109@erlang-consulting.com> If you use OTP behaviours, you could trap exits and clean up in the terminate call back function. The function is called every time you stop your behaviour, or when ever it terminates abnormally and you are trapping exits. The cleaning would have to be generic, however, as it can be tricky to figure out exactly what you were doing before the crash. You can read about the OTP behaviours at http://www.erlang.org/doc/r9c/doc/design_principles/part_frame.html Regards, Francesco -- http://www.erlang-consulting.com WILLIAMS Dominic wrote: >Hello, > >Is there an idiom for initializing and clearing up resources >(e.g. files) needed by an Erlang function, in such a way that the >clear-up code gets called even in the face of an error? > >e.g. > >myfunc() -> > ok = file:make_dir("c:/tmp/foo"), > % do some stuff > ok = file:del_dir("c:/tmp/foo"). > >I want the last line to be called even if "do some stuff" crashes. >Basically, coming from a C++ background, this is the code I would >have put in something's destructor, and I am wondering what Erlangers >do... > >Cheers, > >Dominic. > > > > From raimo.niskanen@REDACTED Mon Aug 25 14:26:08 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Mon, 25 Aug 2003 14:26:08 +0200 Subject: Is it safe to use driver_event()? References: <20030816233647.GE8689@frogman.motivity.ca> Message-ID: Hi Vance. I introduced driver_event because I needed it, and tried to make it sufficiently generic. It may change in the future, but not much more than the other driver interface functions. Its only problem is that it is new, and someone may point out that it should have been generic in some other way. But, whe do not intend to change it or remove it since it is needed for some of our odd drivers that also depend on poll(). And we will always try to use poll() in favour of select() (until something better turns up). So, fully implemented? For now, at least, and as always we will try to make changes backwards compatible (to not break our own drivers). / Raimo Niskanen, Erlang/OTP, Ericsson AB Vance Shipley wrote: > I'm building a dynamically linked in driver and I really need to > have the poll() version of driver_select() because my file handles > are used with STREAMS and I need to maintain the extra data which > poll() handles. > > I was happy to find the existance of the driver_event() function > which does exactly what I need: > > EXTERN int driver_event(ErlDrvPort port, ErlDrvEvent event, > ErlDrvEventData event_data); > > ... and the associated callback: > > void (*event)(ErlDrvData drv_data, ErlDrvEvent event, > ErlDrvEventData event_data); > /* Called when an event selected by > driver_event() has occurred */ > > It is however not documented, and of even more concern, not used > anywhere. > > Is this feature considered fully implemented? How much trouble > am I asking for if I use it? > > -Vance > From serge@REDACTED Mon Aug 25 14:40:20 2003 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 25 Aug 2003 08:40:20 -0400 Subject: idiom for clearing up resources? In-Reply-To: References: Message-ID: <3F4A03B4.1080103@hq.idt.net> You can use catch facility with pattern patching: case catch file:make_dir("c:/tmp/foo") of ok -> do_some_stuff(); {'EXIT', Reason} -> file:del_dir("c:/tmp/foo") end or Result = catch file:make_dir("c:/tmp/foo"), file:del_dir("c:/tmp/foo"), case Result of ok -> do_some_stuff(); {'EXIT', Reason} -> io:format('Error making dir: ~p~n", [Reason]) end; WILLIAMS Dominic wrote: > Hello, > > Is there an idiom for initializing and clearing up resources > (e.g. files) needed by an Erlang function, in such a way that the > clear-up code gets called even in the face of an error? > > e.g. > > myfunc() -> > ok = file:make_dir("c:/tmp/foo"), > % do some stuff > ok = file:del_dir("c:/tmp/foo"). > > I want the last line to be called even if "do some stuff" crashes. > Basically, coming from a C++ background, this is the code I would > have put in something's destructor, and I am wondering what Erlangers > do... > > Cheers, > > Dominic. > From raimo.niskanen@REDACTED Mon Aug 25 14:50:46 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Mon, 25 Aug 2003 14:50:46 +0200 Subject: erl_scan:string ignores /' and /" References: Message-ID: Have you not simply forgotten the double parsing problem that everything you type in is parsed (by erl_parse et.al) before erl_parse:string/1 is called? Try this: %%% A 16> f(S),S="A",io:format("~w -> ",[S]),erl_scan:string(S). [65] -> {ok,[{var,1,'A'}],1} %%% "A" 17> f(S),S="\"A\"",io:format("~w -> ",[S]),erl_scan:string(S). [34,65,34] -> {ok,[{string,1,"A"}],1} %%% "\^A" 18> f(S),S="\"\\^A\"",io:format("~w",[S]),erl_scan:string(S). [34,92,94,65,34]{ok,[{string,1,[1]}],1} %%% "\^A\"" 19> f(S),S="\"\\^A\\\"\"",io:format("~w -> ",[S]),erl_scan:string(S). [34,92,94,65,92,34,34] -> {ok,[{string,1,[1,34]}],1} / Raimo Niskanen, Erlang/OTP, Ericsson AB Roger Price wrote: > "Concurrent Programming in Erlang", chapter 2.1.2 says "Within a quoted > atom the following conventions apply"... Chapter 2.1.4 says "Within a > string the quoting conventions used within an atom also apply." However > erl_scan:string/1 seems to ignore \' and \". Here are the results for all > the conventions: > > 15> erl_scan:string("\b") . > {ok,[],1} > 16> erl_scan:string("\d") . > {ok,[{'\d',1}],1} > 17> erl_scan:string("\e") . > {ok,[],1} > 18> erl_scan:string("\f") . > {ok,[],1} > 19> erl_scan:string("\n") . > {ok,[],2} > 20> erl_scan:string("\r") . > {ok,[],1} > 21> erl_scan:string("\t") . > {ok,[],1} > 22> erl_scan:string("\v") . > {ok,[],1} > 23> erl_scan:string("\\") . > {ok,[{'\\',1}],1} > 24> erl_scan:string("\^A") . > {ok,[],1} > 25> erl_scan:string("\'") . > {error,{1,erl_scan,{string,39,[]}},1} > 26> erl_scan:string("\"") . > {error,{1,erl_scan,{string,34,[]}},1} > 27> erl_scan:string("\266") . > {ok,[{'?',1}],1} > 28> erl_scan:string("\266\ > 28> \266") . > {ok,[{'?',1},{'?',2}],2} > > Roger > > From svg@REDACTED Mon Aug 25 14:57:00 2003 From: svg@REDACTED (Vladimir Sekissov) Date: Mon, 25 Aug 2003 18:57:00 +0600 (YEKST) Subject: idiom for clearing up resources? In-Reply-To: References: Message-ID: <20030825.185700.78719350.svg@surnet.ru> Good day, I often use the following construct in such cases: myfunc() -> Ret= case catch begin ok = file:make_dir("c:/tmp/foo"), %% do some stuff {ok, Res} end of R={ok, _} -> R; Other -> better_error(Other) end, %% cleanup (catch file:del_dir("c:/tmp/foo")), Ret. better_error({'EXIT', {{badmatch, Error}, _}}) -> better_error(Error); better_error({'EXIT', Error}) -> better_error(Error); better_error(Error) when is_tuple(Error), element(1,Error) == error -> Error; better_error(Error) -> {error, Error}. Best Regards, Vladimir Sekissov D.WILLIAMS> Is there an idiom for initializing and clearing up resources D.WILLIAMS> (e.g. files) needed by an Erlang function, in such a way that the D.WILLIAMS> clear-up code gets called even in the face of an error? D.WILLIAMS> D.WILLIAMS> e.g. D.WILLIAMS> D.WILLIAMS> myfunc() -> D.WILLIAMS> ok = file:make_dir("c:/tmp/foo"), D.WILLIAMS> % do some stuff D.WILLIAMS> ok = file:del_dir("c:/tmp/foo"). D.WILLIAMS> D.WILLIAMS> I want the last line to be called even if "do some stuff" crashes. D.WILLIAMS> Basically, coming from a C++ background, this is the code I would D.WILLIAMS> have put in something's destructor, and I am wondering what Erlangers D.WILLIAMS> do... D.WILLIAMS> D.WILLIAMS> Cheers, D.WILLIAMS> D.WILLIAMS> Dominic. From anders_nygren2002@REDACTED Mon Aug 25 17:20:19 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Mon, 25 Aug 2003 17:20:19 +0200 (CEST) Subject: Strange mnesia behaviour In-Reply-To: <16201.48610.329141.760622@rian.du.uab.ericsson.se> Message-ID: <20030825152019.46543.qmail@web14609.mail.yahoo.com> Hi Enclosed are two files for demonstrating the problem. 1> mnesia:create_schema([node()]). ok %% create test table 2> proc1:create_tab(). %% Send 1000 messages 21> load_test:start(1000,1,1000). Starting: {1061,824066,922527} ok Finished: {1061,824067,57799} Duration: 0.135272 %% send 4000 messages 22> load_test:start(4000,1,4000). Starting: {1061,824104,408645} ok Finished: {1061,824105,433962} Duration: 1.02532 %% NOTE: Duration more than 4x time for 1000 msgs. %% send 10000 msgs 23> load_test:start(10000,1,10000). Starting: {1061,824183,532563} ok Finished: {1061,824190,685861} Duration: 7.15330 %% And now for the real fun %% Send 10000 msgs, but sleep 1 sec, after 5000 msgs 24> load_test:start(10000,1000,5000). Starting: {1061,824264,759878} ok Finished: {1061,824268,418335} Duration: 3.65846 %% !!!!!!!!! eprof shows that flush_downs is the guilty. Warning: do not try profileing witheprof on 10000 messages, 4000 msg takes 25 secs with profiling on my 2.4 Ghz P4. /Anders --- Dan Gudmundsson skrev: > > Hmm > > flush_downs cleans the msg queue, with alot msgs in > it, it takes some > time.. > > Can you email me the test program? > > /Dan > > Anders Nygren writes: > > Hi > > I have found a strange thing in mnesia. I was > trying > > to do some throughput measurement on a process. > > > > My process does the following: > > 1, receive one message > > 2, make one mnesia:select > > 3, send one message > > > > My test was to send N identicat messages to my > process > > and measure the time it took to process all > messages. > > To my suprise the times grew non-linearly with N. > > eprof shows that > > N = 10 - > mnesia:flush_downs/0 is called 55 > times > > N = 100 -> mnesia:flush_downs/0 is called 5000 > times > > N = 4000 -> a whopping 4 million times. > > > > Also if I run the test twice with 50 messages I > get > > 2500 mnesia:flush_downs, but when I run one test > with > > 100 messages there are 5000. > > > > I the mnesia table has one record. > > I am using a single node -> no distribution. > > The table is type bag, disc_copy. > > I am using R9C on Suse 8.2. > > > > Is there something wrong with mnesia or is there > > something I dont understand? > > > > /Anders > > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, > spamfilter och virusscan. Se mer p? > http://se.mail.yahoo.com > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com -------------- next part -------------- A non-text attachment was scrubbed... Name: files.tar.gz Type: application/x-tar Size: 1709 bytes Desc: files.tar.gz URL: From cpressey@REDACTED Mon Aug 25 18:12:13 2003 From: cpressey@REDACTED (Chris Pressey) Date: Mon, 25 Aug 2003 11:12:13 -0500 Subject: Maybe Erlang is OO after all? In-Reply-To: <3F46C5D0.6070507@web.de> References: <3F464A88.1030203@web.de> <20030822122422.4b4ac69e.cpressey@catseye.mine.nu> <3F46C5D0.6070507@web.de> Message-ID: <20030825111213.63a1d7e0.cpressey@catseye.mine.nu> On Sat, 23 Aug 2003 03:39:28 +0200 Joachim Durchholz wrote: > My experience with a language that supports DbC directly is that this > is powerful enough to prevent idiocies like Dog.bark vs. Tree.bark > (not that anybody in his right mind would make Dog a subclass of Tree > or vice versa - this kind of problem is far less common than one might > think). Well, if you're lucky enough that the programmer didn't learn OO design from a "how to program in C++" book, then, yes. (how about if both Dog and Tree are subclasses of Barkable... ewww) In a sense, it's inheritance's job to "reign in" polymorphism a bit, and in that light, languages like Erlang aren't as good at OO (I hesitate to say that any language "is OO" or "is not OO") because you can happily overload bark() like: bark(X) when record(X, dog) -> ... bark(X) when record(X, tree) -> ... But when you do get into the case where you want an object that is a combination of two disjunct classes, you do have a way to distinguish between their methods: dog:bark(X) and tree:bark(X). The underlying implementation of X would have to be fairly inventive to allow it, but I'm sure it could be done. -Chris From anders_nygren2002@REDACTED Mon Aug 25 20:45:40 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Mon, 25 Aug 2003 20:45:40 +0200 (CEST) Subject: Strange mnesia behaviour In-Reply-To: <20030825152019.46543.qmail@web14609.mail.yahoo.com> Message-ID: <20030825184540.62211.qmail@web14603.mail.yahoo.com> Ops I forgot, You need to do >proc1:start_link(). before running the test with load_test:start(...). /Anders --- Anders Nygren skrev: > Hi > Enclosed are two files for demonstrating the > problem. > > 1> mnesia:create_schema([node()]). > ok > %% create test table > 2> proc1:create_tab(). > > %% Send 1000 messages > > 21> load_test:start(1000,1,1000). > Starting: {1061,824066,922527} > ok > Finished: {1061,824067,57799} > Duration: 0.135272 > > %% send 4000 messages > > 22> load_test:start(4000,1,4000). > Starting: {1061,824104,408645} > ok > Finished: {1061,824105,433962} > Duration: 1.02532 > %% NOTE: Duration more than 4x time for 1000 msgs. > > %% send 10000 msgs > 23> load_test:start(10000,1,10000). > Starting: {1061,824183,532563} > ok > Finished: {1061,824190,685861} > Duration: 7.15330 > > %% And now for the real fun > %% Send 10000 msgs, but sleep 1 sec, after 5000 msgs > 24> load_test:start(10000,1000,5000). > Starting: {1061,824264,759878} > ok > Finished: {1061,824268,418335} > Duration: 3.65846 %% !!!!!!!!! > > eprof shows that flush_downs is the guilty. > Warning: do not try profileing witheprof on 10000 > messages, 4000 msg takes 25 secs with profiling on > my 2.4 Ghz P4. > /Anders > > --- Dan Gudmundsson skrev: > > > > Hmm > > > > flush_downs cleans the msg queue, with alot msgs > in > > it, it takes some > > time.. > > > > Can you email me the test program? > > > > /Dan > > > > Anders Nygren writes: > > > Hi > > > I have found a strange thing in mnesia. I was > > trying > > > to do some throughput measurement on a process. > > > > > > My process does the following: > > > 1, receive one message > > > 2, make one mnesia:select > > > 3, send one message > > > > > > My test was to send N identicat messages to my > > process > > > and measure the time it took to process all > > messages. > > > To my suprise the times grew non-linearly with > N. > > > eprof shows that > > > N = 10 - > mnesia:flush_downs/0 is called 55 > > times > > > N = 100 -> mnesia:flush_downs/0 is called 5000 > > times > > > N = 4000 -> a whopping 4 million times. > > > > > > Also if I run the test twice with 50 messages I > > get > > > 2500 mnesia:flush_downs, but when I run one > test > > with > > > 100 messages there are 5000. > > > > > > I the mnesia table has one record. > > > I am using a single node -> no distribution. > > > The table is type bag, disc_copy. > > > I am using R9C on Suse 8.2. > > > > > > Is there something wrong with mnesia or is > there > > > something I dont understand? > > > > > > /Anders > > > > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, > > spamfilter och virusscan. Se mer p? > > http://se.mail.yahoo.com > > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, > spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com > ATTACHMENT part 2 application/x-tar name=files.tar.gz Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From cpressey@REDACTED Mon Aug 25 21:54:16 2003 From: cpressey@REDACTED (Chris Pressey) Date: Mon, 25 Aug 2003 14:54:16 -0500 Subject: erlgtk config + new erl_interface = pthread-related errors? Message-ID: <20030825145416.3dad39ce.cpressey@catseye.mine.nu> Hi all, I've successfully installed the erlang-r9c0,1 port on FreeBSD -STABLE, and I'm trying to re-install erlgtk-0.9.6 on top of it. But I'm seeing a new error in the configure stage that seems to have something to do with the changes in erl_interface w.r.t. pthreads. The relevant output of 'make configure' follows: checking fun erl_interface... /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_create': ei_pthreads.o(.text+0x2e): undefined reference to `pthread_mutex_init' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_destroy': ei_pthreads.o(.text+0x59): undefined reference to `pthread_mutex_destroy' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_lock': ei_pthreads.o(.text+0x8e): undefined reference to `pthread_mutex_lock' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_trylock': ei_pthreads.o(.text+0xb2): undefined reference to `pthread_mutex_trylock' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_unlock': ei_pthreads.o(.text+0xd6): undefined reference to `pthread_mutex_unlock' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `erl_errno_key_alloc': ei_pthreads.o(.text+0x129): undefined reference to `pthread_key_create' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `__erl_errno_place': ei_pthreads.o(.text+0x15a): undefined reference to `pthread_once' ei_pthreads.o(.text+0x17a): undefined reference to `pthread_getspecific' ei_pthreads.o(.text+0x19e): undefined reference to `pthread_setspecific' ei_pthreads.o(.text+0x1b3): undefined reference to `pthread_getspecific' exec: ./eiconf: not found Crash dump was written to: erl_crash.dump init terminating in do_boot () no false {"init terminating in do_boot",{badarg,[{erlang,port_close,[#Port<0.27>]},{eiconf,fun_ext,0}, {init,start_it,1},{init,start_em,1}]}} checking erlang:fun_info(Fun,arity)... /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_create': ei_pthreads.o(.text+0x2e): undefined reference to `pthread_mutex_init' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_destroy': ei_pthreads.o(.text+0x59): undefined reference to `pthread_mutex_destroy' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_lock': ei_pthreads.o(.text+0x8e): undefined reference to `pthread_mutex_lock' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_trylock': ei_pthreads.o(.text+0xb2): undefined reference to `pthread_mutex_trylock' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `ei_m_unlock': ei_pthreads.o(.text+0xd6): undefined reference to `pthread_mutex_unlock' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `erl_errno_key_alloc': ei_pthreads.o(.text+0x129): undefined reference to `pthread_key_create' /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): In function `__erl_errno_place': ei_pthreads.o(.text+0x15a): undefined reference to `pthread_once' ei_pthreads.o(.text+0x17a): undefined reference to `pthread_getspecific' ei_pthreads.o(.text+0x19e): undefined reference to `pthread_setspecific' ei_pthreads.o(.text+0x1b3): undefined reference to `pthread_getspecific' yes Any idea what could be causing this? My hunch is it's something either in the port or in my local configuration, rather than in the R9C dist itself, but I guess it could be just about anything. The pth-2.0.0 port is installed, even though the erlang port doesn't seem to mention it as a dependency. TIA for any insight, -Chris From ok@REDACTED Tue Aug 26 01:53:59 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 26 Aug 2003 11:53:59 +1200 (NZST) Subject: timestamps in sasl Message-ID: <200308252353.h7PNrxeV204937@atlas.otago.ac.nz> Per Bergqvist thinks that SASL timestamps should be UTC. Pro: no timezone information required. Pro: no confusion when clocks reset (so some times "happen" twice) Pro: files transportable to machines in other time zones without change Con: potential for human error; people looking at the timestamps will be surprised by what they see. Con: I've been told that Windows doesn't actually _know_ what the UTC time is; was that true and if so is it still true? Con: UNIX doesn't actually know what the UTC time is either; UNIX firmly believes that every day has exactly 86,400 seconds and in UTC that just isn't true. Up to two days in a year may have an extra second, and there is no formula saying which years get leap seconds. I used to have a table giving historic leap seconds, but it is way out of date and I don't remember where to get current information. With respect to the last point, presumably UNIX "fake" UTC which ignores leap seconds (in effect saying that up to two of the seconds in a year may take twice as long as all the other seconds...) would do just as well. For me, the fact that a local time T1 that is less than a local time T2 may actually indicate a _later_ time (due to the clocks being reset at a daylight saving transition) makes local time too unreliable to take seriously for any kind of time stamp. From jonathan@REDACTED Mon Aug 25 19:51:41 2003 From: jonathan@REDACTED (Jonathan Coupe) Date: Mon, 25 Aug 2003 18:51:41 +0100 Subject: Maybe Erlang is OO after all? References: <3F49834E.6060402@dbc.co.nz> <3F49D53D.3050105@web.de> Message-ID: <000101c36b67$e396f2f0$0100a8c0@mimbi> ----- Original Message ----- From: "Joachim Durchholz" To: Sent: Monday, August 25, 2003 10:22 AM Subject: Re: Maybe Erlang is OO after all? > I think this is more a problem of the way that OO is typically implemented. > C++ is particularly bad here: during construction, all calls are > "nonvirtual", i.e. you can't use virtual functions to "do the right > thing" during object initialization. Since there's a very common need > for that, you end up using two-phase object construction: first > construct the object, then initialize it. And made much worse by the workings of initialising reference and const data. (And have you ever noticed how poorly const works the iostream library? They just don't fit together at all.) > If a language > makes it easy to package out-of-band data such as error diagnostics into > results, and where it's likewise easy to disassemble that data on the > caller side, then it's not necessary to have this. In other words: > traditional programming languages are missing both tuples that can be > defined and constructed with minimal syntactic overhead, and they are > missing pattern matching on tuples. Very, very true! Other than the lack of closures (and you could only ever have a restricted version of them in a non-GC language) I find the combined absence of pattern matching and tuples the greatest lack in C++ (which is the language I work in 90% of the time, and really does have many advantages for an important if restricted set of real world programming tasks.) Thought: you can add restricted closure support to C++ using the Open C++ toolkit - I wonder if it will support pattern matching? It's other big problem is that the language needs a refactoring browser as much or more than Java or Smalltalk, but is so hard to parse that no one seems capable of writing one. - Jonathan From per@REDACTED Tue Aug 26 07:14:12 2003 From: per@REDACTED (Per Bergqvist) Date: Tue, 26 Aug 2003 08:14:12 +0300 Subject: timestamps in sasl In-Reply-To: <200308252353.h7PNrxeV204937@atlas.otago.ac.nz> Message-ID: <200308260614.h7Q6ECp19281@tessla.levonline.com> ------------------- > > Con: potential for human error; people looking at the timestamps will be > surprised by what they see. The utc_log flag should still be used. > Con: I've been told that Windows doesn't actually _know_ what the UTC time > is; was that true and if so is it still true? This is not true. >From the platform SDK "The system bases system time on coordinated universal time (UTC). UTC-based time is loosely defined as the current date and time of day in Greenwich, England." " Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in winbase.h. Import Library: Use kernel32.lib." > Con: UNIX doesn't actually know what the UTC time is either; UNIX firmly > believes that every day has exactly 86,400 seconds and in UTC that > just isn't true. Up to two days in a year may have an extra second, > and there is no formula saying which years get leap seconds. I used > to have a table giving historic leap seconds, but it is way out of > date and I don't remember where to get current information. > This is true, OS people are planning/working on a move towards TAI (International Atomic Time) nowadays. Use of NTP corrects leap seconds, but the final solution would be to use TAI. Until TAI support is more spread in OS'es I'll guess we will have to set for UTC. /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From lennart.ohman@REDACTED Tue Aug 26 09:38:09 2003 From: lennart.ohman@REDACTED (=?ISO-8859-1?Q?Lennart_=D6hman?=) Date: Tue, 26 Aug 2003 09:38:09 +0200 Subject: timestamps in sasl In-Reply-To: <200308260614.h7Q6ECp19281@tessla.levonline.com> References: <200308260614.h7Q6ECp19281@tessla.levonline.com> Message-ID: <3F4B0E61.9020709@st.se> Hi, For leapseconds see: http://www.bldrdoc.gov/timefreq/pubs/bulletin/leapsecond.htm For those fluent in Swedish, Statensprovningsanstalt is now responsible for the time keeping in Sweden. http://www.sp.se/metrology/timefreq/sv/tidhallning.htm /Lennart Per Bergqvist wrote: > ------------------- > >>Con: potential for human error; people looking at the timestamps > > will be > >> surprised by what they see. > > The utc_log flag should still be used. > > >>Con: I've been told that Windows doesn't actually _know_ what the > > UTC time > >> is; was that true and if so is it still true? > > > This is not true. > From the platform SDK "The system bases system time on coordinated > universal time (UTC). UTC-based time is loosely defined as the current > date and time of day in Greenwich, England." > " Windows NT: Requires version 3.1 or later. > Windows: Requires Windows 95 or later. > Windows CE: Requires version 1.0 or later. > Header: Declared in winbase.h. > Import Library: Use kernel32.lib." > > >>Con: UNIX doesn't actually know what the UTC time is either; UNIX > > firmly > >> believes that every day has exactly 86,400 seconds and in UTC that >> just isn't true. Up to two days in a year may have an extra > > second, > >> and there is no formula saying which years get leap seconds. I > > used > >> to have a table giving historic leap seconds, but it is way out of >> date and I don't remember where to get current information. >> > > This is true, OS people are planning/working on a move towards TAI > (International Atomic Time) nowadays. > Use of NTP corrects leap seconds, but the final solution would be to > use TAI. Until TAI support is more spread in OS'es I'll guess we will > have to set for UTC. > > > /Per > ========================================================= > Per Bergqvist > Synapse Systems AB > Phone: +46 709 686 685 > Email: per@REDACTED -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From kent@REDACTED Tue Aug 26 09:53:20 2003 From: kent@REDACTED (Kent Boortz) Date: 26 Aug 2003 09:53:20 +0200 Subject: Can't open character-special file In-Reply-To: <200308250843.h7P8hGm05954@tessla.levonline.com> References: <200308250843.h7P8hGm05954@tessla.levonline.com> Message-ID: Per Bergqvist writes: > Attached is a small patch to fix it. Thanks, kent From bjorn@REDACTED Tue Aug 26 10:10:07 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 26 Aug 2003 10:10:07 +0200 Subject: Problem with 64 bit FP under ARM In-Reply-To: <20030823033504.GB4013@mcdev.com.au> References: <20030823033504.GB4013@mcdev.com.au> Message-ID: Martin Sandiford writes: > Hello all, > > I have a problem with 64 bit floating point numbers on an embedded > SA1110 based machine running under Linux. > > A summary of the problem: > > (Running under Linux on x86): > 1> <<1.0:64/float>>. > <<63,240,0,0,0,0,0,0>> > (Pretty much as expected for a little endian machine) This is the expected result on ANY machine. The default endian is big, so <<1.0:64/float>> is just shorthand for <<1.0:64/big-float>>. To get the native ordering, you could use <<1.0:64/native-float>>. > I'm not an ARM expert, so I can only assume that the correct > representation for a double on ARM is with the quads swapped with > respect to "normal" LE ordering. Does anyone here know if this is the > case? I'm thinking it maybe could be a problem with the FP emulator? > (There is no FPU on this board). > I don't know anything about the ARM. It would be interesting if you could post the result of: <<1.0:64/native-float>> That should show exactly how floating point numbers are stored internally. /Bjorn -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From kent@REDACTED Tue Aug 26 10:11:32 2003 From: kent@REDACTED (Kent Boortz) Date: 26 Aug 2003 10:11:32 +0200 Subject: erlgtk config + new erl_interface = pthread-related errors? In-Reply-To: <20030825145416.3dad39ce.cpressey@catseye.mine.nu> References: <20030825145416.3dad39ce.cpressey@catseye.mine.nu> Message-ID: Chris Pressey writes: > I've successfully installed the erlang-r9c0,1 port on FreeBSD -STABLE, > and I'm trying to re-install erlgtk-0.9.6 on top of it. > > But I'm seeing a new error in the configure stage that seems to have > something to do with the changes in erl_interface w.r.t. pthreads. The > relevant output of 'make configure' follows: > > checking fun erl_interface... > /usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_pthreads.o): > In function `ei_m_create': > ei_pthreads.o(.text+0x2e): undefined reference to `pthread_mutex_init' . . > Any idea what could be causing this? My hunch is it's something either > in the port or in my local configuration, rather than in the R9C dist > itself, but I guess it could be just about anything. The pth-2.0.0 port > is installed, even though the erlang port doesn't seem to mention it > as a dependency. It is a change in erl_interface. In earlier versions the library for linking with threaded and non threaded code was the same. A compiler and linker "feature" was used to make sure that the right functions was used for threaded and non threaded code (pragma weak + erl_init() as a macro expanding to different init functions that forced specific .o files out of the .a library that defined the same functions). In R9C we use separate libraries for threaded and non threaded code. One of the reason was that we can't be sure that the only change made in C header files when _REENTRANT is defined is "errno" that was specially handled in erl_interface if threads where used. If you change erlgtk to link using "-lerl_interface_st" and "-lei_st" you link with the single threaded library and the link errors will go away. This is documented, kent From bjorn@REDACTED Tue Aug 26 10:17:03 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 26 Aug 2003 10:17:03 +0200 Subject: R9C-0 shared libraries don't work on OS X In-Reply-To: <4DD7C34F-D6E3-11D7-A8BE-000A95927CCE@mac.com> References: <4DD7C34F-D6E3-11D7-A8BE-000A95927CCE@mac.com> Message-ID: We hope to soon have daily builds (including running the entire test suite) running on Mac OS X. I did some attempts fixing the ASN1 problem at my Mac at home, but without the test suites all I could was some random manual testing and it seems that I got it wrong. In one of the snapshots, including the -lbundle1.o flag did seem to fix the problem. /Bjorn Sean Hinde writes: > Hi, > > In R9C-0 the shared library for asn1 doesn't run on OS X (it crashes > the emulator). The following patch fixes the issue in line with the > guidelines in the top level README. As this changes configure.in it is > obviously necessary to run autoconf in the erts directory after > applying the patch. > > Regs, > Sean > > --- otp_src_R9C-0.orig/erts/configure.in Tue Aug 5 14:36:25 2003 > +++ otp_src_R9C-0/erts/configure.in Mon Aug 25 10:14:39 2003 > @@ -1035,7 +1035,8 @@ > darwin*) > # Mach-O linker: a shared lib and a loadable > # object file is not the same thing. > - DED_LDFLAGS="-bundle -flat_namespace > -undefined suppress -lbundle1.o" > + DED_LD="$CC" > + DED_LDFLAGS="-bundle -flat_namespace > -undefined suppress" > DED_CFLAGS="$DED_CFLAGS -fno-common" > ;; > *) > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From bertil@REDACTED Tue Aug 26 09:59:21 2003 From: bertil@REDACTED (Bertil Karlsson) Date: Tue, 26 Aug 2003 09:59:21 +0200 Subject: fix for asn1 driver References: <200308221241.h7MCf1o10193@tessla.levonline.com> Message-ID: <3F4B1359.1080405@erix.ericsson.se> Thank you again! /Bertil Per Bergqvist wrote: > Hi, > > Attached are a couple of more fixes for asn1. > > -32 fixes a length bug on extensions in asn1rt_ber_bin > -33 fixes 'OBJECT DESCRIPTOR' bug in asn1 modules (found by Erik > Reitsma but not fixed in R9C-0) > -34 fixes a tag matching bug in ber decoding > -35 enables erlc command line to pass +ber_bin for asn1 modules > (and actually use it ;-) > > > /Per > > ------------------- > >>Thank you, the trace printout will be removed in the next patch. >> >>Per Bergqvist wrote: >> >>>There is a debug printout that should be removed in the >>>asn1 driver in R9C-0. >>> >>>Patch attached. >>> >>>/Per >>> >>>========================================================= >>>Per Bergqvist >>>Synapse Systems AB >>>Phone: +46 709 686 685 >>>Email: per@REDACTED >> >> >>-- >>/ Bertil Karlsson >> > > ========================================================= > Per Bergqvist > Synapse Systems AB > Phone: +46 709 686 685 > Email: per@REDACTED From per@REDACTED Tue Aug 26 09:32:05 2003 From: per@REDACTED (Per Bergqvist) Date: Tue, 26 Aug 2003 10:32:05 +0300 Subject: asn1 improvement proposal In-Reply-To: <3F4B1359.1080405@erix.ericsson.se> Message-ID: <200308260832.h7Q8W5927472@tessla.levonline.com> Hi, The asn1 en/decoder proberly handles ellipsis notation as it is today. However, the decoder receives an extended PDU with ellipsis data it will simply discard that information. There is no way to tell the encoder to add extension information. I propose that each record generated by the compiler should add an additional '$ellipsis' field for the last '...' in a sequence/set. The decoder should add any extension information to the '$ellipsis' field. The encoder should allow the user to put extension information. This improvement would allow creation of proxy functions where one does not always have the latest available/vendor specific spec. /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From dgud@REDACTED Tue Aug 26 10:37:51 2003 From: dgud@REDACTED (Dan Gudmundsson) Date: Tue, 26 Aug 2003 10:37:51 +0200 Subject: Strange mnesia behaviour In-Reply-To: <20030825184540.62211.qmail@web14603.mail.yahoo.com> References: <20030825152019.46543.qmail@web14609.mail.yahoo.com> <20030825184540.62211.qmail@web14603.mail.yahoo.com> Message-ID: <16203.7263.637871.740024@rian.du.uab.ericsson.se> Hi flush_downs() is called once per transaction, (I've added counter to check), since you in your testprogram cast in all tests you got N long msg queue which is checked N times, an O(N*N) operation, but if you wait for the reply before you do the next operation is behaves better. I do think that is OK, you don't normally have one process with a msq with a couple of thousends reqs, then you have problems in your app. Regards /Dan Anders Nygren writes: > > --- Dan Gudmundsson skrev: > > > > > > Hmm > > > > > > flush_downs cleans the msg queue, with alot msgs > > in > > > it, it takes some > > > time.. > > > > > > Can you email me the test program? > > > > > > /Dan > > > > > > Anders Nygren writes: > > > > Hi > > > > I have found a strange thing in mnesia. I was > > > trying > > > > to do some throughput measurement on a process. > > > > > > > > My process does the following: > > > > 1, receive one message > > > > 2, make one mnesia:select > > > > 3, send one message > > > > > > > > My test was to send N identicat messages to my > > > process > > > > and measure the time it took to process all > > > messages. > > > > To my suprise the times grew non-linearly with > > N. > > > > eprof shows that > > > > N = 10 - > mnesia:flush_downs/0 is called 55 > > > times > > > > N = 100 -> mnesia:flush_downs/0 is called 5000 > > > times > > > > N = 4000 -> a whopping 4 million times. > > > > > > > > Also if I run the test twice with 50 messages I > > > get > > > > 2500 mnesia:flush_downs, but when I run one > > test > > > with > > > > 100 messages there are 5000. > > > > > > > > I the mnesia table has one record. > > > > I am using a single node -> no distribution. > > > > The table is type bag, disc_copy. > > > > I am using R9C on Suse 8.2. > > > > > > > > Is there something wrong with mnesia or is > > there > > > > something I dont understand? > > > > > > > > /Anders > > > > > > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, > > > spamfilter och virusscan. Se mer p? > > > http://se.mail.yahoo.com > > > > > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, > > spamfilter och virusscan. Se mer p? > http://se.mail.yahoo.com > > > ATTACHMENT part 2 application/x-tar > name=files.tar.gz > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From ms@REDACTED Tue Aug 26 13:21:35 2003 From: ms@REDACTED (Martin Sandiford) Date: Tue, 26 Aug 2003 20:51:35 +0930 Subject: Problem with 64 bit FP under ARM In-Reply-To: References: <20030823033504.GB4013@mcdev.com.au> Message-ID: <20030826112135.GF4013@mcdev.com.au> Hi Bjorn, On Tue, 26 Aug 2003, Bjorn Gustavsson wrote: > Martin Sandiford writes: > > > 1> <<1.0:64/float>>. > > <<63,240,0,0,0,0,0,0>> > > (Pretty much as expected for a little endian machine) > > This is the expected result on ANY machine. Sorry, misspoke myself. Should be "..as expected for the beam VM"? > It would be interesting if you could post the result of: > <<1.0:64/native-float>> Eshell V5.3 (abort with ^G) 1> <<1.0:64/native-float>>. <<0,0,240,63,0,0,0,0>> 2> <<1.0:64/float>>. <<0,0,0,0,63,240,0,0>> I've since found out (by reading the manuals!) that there is a bug/feature in the ARM core < v5 in that it always stores floats in big endian quad order. SA1110 is little endian and v4 core, so this is where the problem is occurring. I have a fix for erts/emulator/beam/erl_bits.c that swaps the quads in erts_bs_(put|get)_float(), but I'm wondering if there are any other interfaces to the outside world that might need attention? Martin From joachim.durchholz@REDACTED Tue Aug 26 13:36:15 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Tue, 26 Aug 2003 13:36:15 +0200 Subject: timestamps in sasl In-Reply-To: <200308252353.h7PNrxeV204937@atlas.otago.ac.nz> References: <200308252353.h7PNrxeV204937@atlas.otago.ac.nz> Message-ID: <3F4B462F.9050008@web.de> Richard A. O'Keefe wrote: > Con: potential for human error; people looking at the timestamps will be > surprised by what they see. This can be handled by formatting the printable representation of time appropriately (either by conversion to local time, given the current timezone information, or, if no timezone information is available, by appending a "(UTC)" suffix to the time data). I'd prefer that this is done in the default routines for converting to printable representation, but if this isn't possible due to compatibility considerations, a readily usable conversion function would be a good second best option. (If such a function doesn't already exist.) Regards, Jo From anders_nygren2002@REDACTED Tue Aug 26 15:36:34 2003 From: anders_nygren2002@REDACTED (=?iso-8859-1?q?Anders=20Nygren?=) Date: Tue, 26 Aug 2003 15:36:34 +0200 (CEST) Subject: Strange mnesia behaviour In-Reply-To: <16203.7263.637871.740024@rian.du.uab.ericsson.se> Message-ID: <20030826133634.23647.qmail@web14601.mail.yahoo.com> Hi Thanks for the explanation. The idea of my test was to see what happens if my system gets a flood of alarms. I doubt that it ever will be the volumes used in my test. But if it ever becomes a problem I'll just add a buffering process to add some flow-control. Or maybe I'll use dirty_select instead that doesn't have this behaviour. Are there any other possible problems I should be aware of regarding long message queues? /Anders --- Dan Gudmundsson skrev: > > Hi > > flush_downs() is called once per transaction, (I've > added counter to > check), since you in your testprogram cast in all > tests you got N long > msg queue which is checked N times, an O(N*N) > operation, but if you > wait for the reply before you do the next operation > is behaves better. > > I do think that is OK, you don't normally have one > process with a msq > with a couple of thousends reqs, then you have > problems in your app. > > Regards > /Dan > > Anders Nygren writes: > > > --- Dan Gudmundsson > skrev: > > > > > > > > Hmm > > > > > > > > flush_downs cleans the msg queue, with alot > msgs > > > in > > > > it, it takes some > > > > time.. > > > > > > > > Can you email me the test program? > > > > > > > > /Dan > > > > > > > > Anders Nygren writes: > > > > > Hi > > > > > I have found a strange thing in mnesia. I > was > > > > trying > > > > > to do some throughput measurement on a > process. > > > > > > > > > > My process does the following: > > > > > 1, receive one message > > > > > 2, make one mnesia:select > > > > > 3, send one message > > > > > > > > > > My test was to send N identicat messages > to my > > > > process > > > > > and measure the time it took to process > all > > > > messages. > > > > > To my suprise the times grew non-linearly > with > > > N. > > > > > eprof shows that > > > > > N = 10 - > mnesia:flush_downs/0 is called > 55 > > > > times > > > > > N = 100 -> mnesia:flush_downs/0 is called > 5000 > > > > times > > > > > N = 4000 -> a whopping 4 million times. > > > > > > > > > > Also if I run the test twice with 50 > messages I > > > > get > > > > > 2500 mnesia:flush_downs, but when I run > one > > > test > > > > with > > > > > 100 messages there are 5000. > > > > > > > > > > I the mnesia table has one record. > > > > > I am using a single node -> no > distribution. > > > > > The table is type bag, disc_copy. > > > > > I am using R9C on Suse 8.2. > > > > > > > > > > Is there something wrong with mnesia or is > > > there > > > > > something I dont understand? > > > > > > > > > > /Anders > > > > > > > > > > Yahoo! Mail - Gratis: 6 MB > lagringsutrymme, > > > > spamfilter och virusscan. Se mer p? > > > > http://se.mail.yahoo.com > > > > > > > > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, > > > spamfilter och virusscan. Se mer p? > > http://se.mail.yahoo.com > > > > > ATTACHMENT part 2 application/x-tar > > name=files.tar.gz > > > > > > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, > spamfilter och virusscan. Se mer p? > http://se.mail.yahoo.com > Yahoo! Mail - Gratis: 6 MB lagringsutrymme, spamfilter och virusscan. Se mer p? http://se.mail.yahoo.com From cpressey@REDACTED Tue Aug 26 19:47:35 2003 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 26 Aug 2003 12:47:35 -0500 Subject: erlgtk config + new erl_interface = pthread-related errors? In-Reply-To: References: <20030825145416.3dad39ce.cpressey@catseye.mine.nu> Message-ID: <20030826124735.38c215e5.cpressey@catseye.mine.nu> On 26 Aug 2003 10:11:32 +0200 Kent Boortz wrote: > Chris Pressey writes: > > I've successfully installed the erlang-r9c0,1 port on FreeBSD > > -STABLE, and I'm trying to re-install erlgtk-0.9.6 on top of it. > > > > But I'm seeing a new error in the configure stage that seems to have > > something to do with the changes in erl_interface w.r.t. pthreads. > > [...] > [...] > If you change erlgtk to link using "-lerl_interface_st" and "-lei_st" > you link with the single threaded library and the link errors will go > away. This is documented, > > kent Thanks, this set me out on the right path (although I still can't find where this exactly is documented.) Another issue turned up: ERL_MAX_COUNT is no longer defined anywhere in the erl_interface include files. I just patched the old #define into gtk_drv.c and it seems to work fine. Was this omission an oversight, or is there a different way to do this that gtk_drv.c should be using instead? Thanks again, -Chris From sean.hinde@REDACTED Tue Aug 26 21:47:26 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 26 Aug 2003 20:47:26 +0100 Subject: R9C-0 available on OS X under darwinports In-Reply-To: <33AF0C64-D4E6-11D7-9F32-00039398F084@comcast.net> Message-ID: <1EBB5FA4-D7FE-11D7-A8BE-000A95927CCE@mac.com> On Friday, August 22, 2003, at 10:18 pm, Gregory Wright wrote: > > Hello, > > Erlang/OTP version R9C-0 is available under the darwinports system > on Mac OS X. Darwinports is a packaging system similar to the *BSD > ports system. More information on installing darwinports is available > from www.opendarwin.org/projects/darwinports/ > Great stuff, I have been half heartedly playing with this myself, but real work always gets in the way.. > The port itself is found in the lang/erlang directory. > > If anyone would like to maintain this port, let me know. It is left > over from > some work I did at my previous company. It would be nice if a regular > user of Erlang would look after it. I can volunteer - now you have done all the hard work I don't mind keeping it up to date. I will apply for a darwinports account and assuming this is OK I will take it on from now on. Best Regards, Sean From peter@REDACTED Tue Aug 26 22:30:19 2003 From: peter@REDACTED (Peter Lund) Date: Tue, 26 Aug 2003 21:30:19 +0100 (BST) Subject: mnesia:dirty_update_counter/3 - patch needed... Message-ID: <2886.217.213.248.28.1061929819.squirrel@www.lundata.se> Hi, The command mnesia:dirty_update_counter(Tab, Key, Incr) does not work as well as I had expected to do. When doing: mnesia:dirty_update_counter(counter, default, 3) and the entry {counter, default, 0} does not exist in mnesia, that row is created, BUT it is left at {counter, default, 0} and it does not become {counter, default, 3} which I expected it to become. I have made a patch and tested the patch. It works. When incrementing a counter with 3 and the "counter" does not exist, it gets as initial value the increment, 3 in this case. I tried to attach the corrected file but it seems like the erlang list has some size limitation. Anyhow: I have updated the source file: C:\PROGRAM\erl5.2.3.3\lib\mnesia-4.1.3\src\mnesia_tm.erl The tiny change is on line number 1685: %%% Zero = {RecName, K, 0}, Zero = {RecName, K, Incr}, Best regards, Peter Lund From vances@REDACTED Tue Aug 26 23:55:40 2003 From: vances@REDACTED (Vance Shipley) Date: Tue, 26 Aug 2003 17:55:40 -0400 Subject: timestamps in sasl In-Reply-To: <200308260614.h7Q6ECp19281@tessla.levonline.com> References: <200308252353.h7PNrxeV204937@atlas.otago.ac.nz> <200308260614.h7Q6ECp19281@tessla.levonline.com> Message-ID: <20030826215539.GC35402@frogman.motivity.ca> Apparently there is serious discussion about abandoning the practice of inserting leap seconds. -Vance http://www.ucolick.org/~sla/leapsecs/ From kent@REDACTED Wed Aug 27 01:26:43 2003 From: kent@REDACTED (Kent Boortz) Date: 27 Aug 2003 01:26:43 +0200 Subject: erlgtk config + new erl_interface = pthread-related errors? In-Reply-To: <20030826124735.38c215e5.cpressey@catseye.mine.nu> References: <20030825145416.3dad39ce.cpressey@catseye.mine.nu> <20030826124735.38c215e5.cpressey@catseye.mine.nu> Message-ID: Chris Pressey writes: > Thanks, this set me out on the right path (although I still can't find > where this exactly is documented.) I was wrong, it isn't. I was late and it didn't make it into the release. Sorry about that. > Another issue turned up: ERL_MAX_COUNT is no longer defined anywhere > in the erl_interface include files. I just patched the old #define into > gtk_drv.c and it seems to work fine. Was this omission an oversight, or > is there a different way to do this that gtk_drv.c should be using > instead? I can't find it used or documented anywhere, for what do you use it and where did you find documentation about ERL_MAX_COUNT? kent From cpressey@REDACTED Wed Aug 27 04:46:02 2003 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 26 Aug 2003 21:46:02 -0500 Subject: erlgtk config + new erl_interface = pthread-related errors? In-Reply-To: References: <20030825145416.3dad39ce.cpressey@catseye.mine.nu> <20030826124735.38c215e5.cpressey@catseye.mine.nu> Message-ID: <20030826214602.035ff66b.cpressey@catseye.mine.nu> On 27 Aug 2003 01:26:43 +0200 Kent Boortz wrote: > Chris Pressey writes: > > Another issue turned up: ERL_MAX_COUNT is no longer defined anywhere > > in the erl_interface include files. I just patched the old #define > > into gtk_drv.c and it seems to work fine. Was this omission an > > oversight, or is there a different way to do this that gtk_drv.c > > should be using instead? > > I can't find it used or documented anywhere, for what do you use it > and where did you find documentation about ERL_MAX_COUNT? erl_interface-3.3.2/include/erl_eterm.h:#define ERL_MAX_COUNT 0xffffff It's used in the erlgtk driver (gtk_drv.c) like so: #define ETERM_REF(e) do { \ if (ERL_COUNT(e) < ERL_MAX_COUNT) \ ERL_COUNT(e)++; \ } while(0) ERL_COUNT is still defined in erl_interface-3.4. I haven't found any documentation on any of this yet, either - and you'll have to ask Tony about how it's used in erlgtk. I'm just trying to port it :) -Chris From vlad_dumitrescu@REDACTED Wed Aug 27 10:36:27 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 27 Aug 2003 10:36:27 +0200 Subject: Enterprise Erlang Beams? References: <200308221539.45014.mikael.karlsson@creado.com> <200308242154.57320.mikael.karlsson@creado.com> Message-ID: Hi, > > Is there anyone that is familiar with J2EE and EJBs who knows if it would be > > possible to implement something similar to Enterprise Java Beans in Erlang? > Has anyone thought more about this? Since I am working with J2EE on a daily basis, I couldn't help but keep thinking about an Erlang solution instead... And there are some general things I've come up with: - I don't think it would be good to try to imitate J2EE. Many J2EE features are aimed at solving things that are non-problems in Erlang (as you pointed out also). Maybe a better way to express the goal would be "implementing an Enterprise Application Server". - An aspect where Java has the upper hand is security: JVM is acting as a sandbox, while BeamVM isn't. This might be important. - On the web side, we would need a framework to bridge the gap between HTML and the application. Custom tag libraries, or other templating mechanisms, could be an elegant solution that is already in place. The semantic gap from todays web design should not be large. I have a feeling there was more to say, but I'll be back when I remember. :-) best regards, Vlad From sankar.kalluri@REDACTED Wed Aug 27 10:17:40 2003 From: sankar.kalluri@REDACTED (SANKAR SAI K) Date: Wed, 27 Aug 2003 13:47:40 +0530 Subject: TTCN Message-ID: Hi, Has any interface been developed by you or any third party tools are available to execute TTCN based test scripts on Erlang environment. Regards, Sankar Sai **************************Disclaimer************************************ Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. *************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Wed Aug 27 11:18:59 2003 From: peter@REDACTED (Peter Lund) Date: Wed, 27 Aug 2003 10:18:59 +0100 (BST) Subject: Enterprise Erlang Beams? In-Reply-To: References: Message-ID: <39895.149.254.120.136.1061975939.squirrel@www.lundata.se> Vlad wrote: > - An aspect where Java has the upper hand is security: JVM is acting as > a sandbox, while BeamVM isn't. This might be important. The VM running in the browser has implemented a "sandbox" for applets to run in. As far as I know there is no browser around that may run any Erlang VM (sandbox version). Has anyone heard about any browser plugin that contains an Erlang VM making it possible to run Erlang inside the client's browers? Peter Lund From vlad_dumitrescu@REDACTED Wed Aug 27 11:20:22 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 27 Aug 2003 11:20:22 +0200 Subject: Enterprise Erlang Beams? References: <39895.149.254.120.136.1061975939.squirrel@www.lundata.se> Message-ID: Hi, ----- Original Message ----- From: "Peter Lund" > Vlad wrote: > > - An aspect where Java has the upper hand is security: JVM is acting as > > a sandbox, while BeamVM isn't. This might be important. > > The VM running in the browser has implemented a "sandbox" for applets > to run in. As far as I know there is no browser around that may run any > Erlang VM (sandbox version). I was thinking about the server side, but you have a good point. > Has anyone heard about any browser plugin that contains an Erlang VM > making it possible to run Erlang inside the client's browers? No, but it seems like a very interesting idea! /Vlad From kent@REDACTED Wed Aug 27 11:21:23 2003 From: kent@REDACTED (Kent Boortz) Date: 27 Aug 2003 11:21:23 +0200 Subject: [Administrative] Missing postings on the list Message-ID: This list is moderated and all mail from non members on the list show up in my mail box for approval. With the recent increase of the number of spam I reject a couple of hundreds a day. This means that I accidently may delete on or two valid postings to the list. I'm sorry about this. If your posting don't pass please let me know and I will go back and approve it. But the problem is only for non member postings. If you post and are not a member, please join the list. If you post from multiple email accounts, please send me your additional addresses and I will enable that email from them pass without the manual approval handling, kent From vlad_dumitrescu@REDACTED Wed Aug 27 11:39:06 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 27 Aug 2003 11:39:06 +0200 Subject: Enterprise Erlang Beams? References: <39895.149.254.120.136.1061975939.squirrel@www.lundata.se> Message-ID: ----- Original Message ----- From: "Peter Lund" > Has anyone heard about any browser plugin that contains an Erlang VM > making it possible to run Erlang inside the client's browers? Hi again, The big problem is that there is no "sandbox Erlang VM" yet (as far as I know). Until SafeErlang (or similar) is ready, I don't think it is wise to open that big a security hole :-) /Vlad From joachim.durchholz@REDACTED Wed Aug 27 12:13:05 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Wed, 27 Aug 2003 12:13:05 +0200 Subject: Enterprise Erlang Beams? In-Reply-To: References: <200308221539.45014.mikael.karlsson@creado.com> <200308242154.57320.mikael.karlsson@creado.com> Message-ID: <3F4C8431.30705@web.de> Vlad Dumitrescu wrote: > [lots of things I agree with] > > - An aspect where Java has the upper hand is security: JVM is acting as a > sandbox, while BeamVM isn't. This might be important. This is definitely important. The slew of "security advisories" for Java and JavaScript has also shown that it's not easy to get right. The challenge is determining what activities should be allowed for the sandboxed applications: there are many legitimate and illegitimate uses, and there is considerable overlap that forces the design to differentiate even more precisely. An example: it's legitimate to write temporary data to disk. It's illegitimate to overwrite system files. So be more precise: it's legitimate to write temporary files and to files that have been submitted by the end user. But then it's illegitimate to hog the disk, so we need a size limit of files written. And that's just writing to files, there are dozens of other issues... There's another question: Java and JavaScript are already there. Will Erlang as a browser plug-in offer any serious advantages /for the end user/? I suspect the answer is No, so nobody will want to install the plug-in. So concentrating on the server side is probably a better approach. (Sure enough somebody will write the plug-in anyway... the interesting question being whether it's going to be maintained.) Just my 2c. Jo From joachim.durchholz@REDACTED Wed Aug 27 12:19:17 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Wed, 27 Aug 2003 12:19:17 +0200 Subject: timestamps in sasl In-Reply-To: <20030826215539.GC35402@frogman.motivity.ca> References: <200308252353.h7PNrxeV204937@atlas.otago.ac.nz> <200308260614.h7Q6ECp19281@tessla.levonline.com> <20030826215539.GC35402@frogman.motivity.ca> Message-ID: <3F4C85A5.1010005@web.de> Vance Shipley wrote: > Apparently there is serious discussion about abandoning the practice of > inserting leap seconds. Interesting web site. A detail: they will insert leap hours instead of leap seconds. Another detail: let's just use whatever universal time is in effect. Leap second/hour considerations will be the same regardless of whether the time is local time or universal time. Regards, Jo From svg@REDACTED Wed Aug 27 12:00:45 2003 From: svg@REDACTED (Vladimir Sekissov) Date: Wed, 27 Aug 2003 16:00:45 +0600 (YEKST) Subject: Enterprise Erlang Beams? In-Reply-To: References: <39895.149.254.120.136.1061975939.squirrel@www.lundata.se> Message-ID: <20030827.160045.112607856.svg@surnet.ru> Good day, I think client-side XUL-based interface using UBF or native format would be better alternative. http://xul.sourceforge.net/ Best Regards, Vladimir Sekissov vlad_dumitrescu> From: "Peter Lund" vlad_dumitrescu> > Has anyone heard about any browser plugin that contains an Erlang VM vlad_dumitrescu> > making it possible to run Erlang inside the client's browers? vlad_dumitrescu> vlad_dumitrescu> Hi again, vlad_dumitrescu> vlad_dumitrescu> The big problem is that there is no "sandbox Erlang VM" yet (as far as I know). vlad_dumitrescu> Until SafeErlang (or similar) is ready, I don't think it is wise to open that vlad_dumitrescu> big a security hole :-) vlad_dumitrescu> vlad_dumitrescu> /Vlad From jk@REDACTED Wed Aug 27 13:20:28 2003 From: jk@REDACTED (=?ISO-8859-1?Q?Johan_K=F6lhi?=) Date: Wed, 27 Aug 2003 13:20:28 +0200 Subject: Newbie graphics question Message-ID: <3F4C93FC.5010305@fluffclub.net> Hi all, I'm working on a simulations system that has a GUI implemented with GS. I am in need of a zoom out function to be able to see more of my Canvas sometimes. Can this be achieved with GS? Have searched the archives and all documentation but it seems that nothing like that is available... is that right? Is there any other graphics system that I can use instead with more advanced functionality? Thanks in advance, /JK From francesco@REDACTED Wed Aug 27 14:20:38 2003 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 27 Aug 2003 13:20:38 +0100 Subject: Newbie graphics question References: <3F4C93FC.5010305@fluffclub.net> Message-ID: <3F4CA216.6090903@erlang-consulting.com> Check out etk, an erlang to TK binding that bypasses TCL altogether. It is much more efficient. I am not sure of its state and upkeep. Check out http://sourceforge.net/projects/erlgtk/ GS only has the most basic functionality, and will be kept that way by Ericsson did not see graphics as a priority in telecom applications. Cheers, Francesco -- http://www.erlang-consulting.com Johan K?lhi wrote: > Hi all, > > I'm working on a simulations system that has a GUI implemented with > GS. I am in need of a zoom out function to be able to see more of my > Canvas sometimes. > > Can this be achieved with GS? Have searched the archives and all > documentation but it seems that nothing like that is available... is > that right? > > Is there any other graphics system that I can use instead with more > advanced functionality? > > Thanks in advance, > > /JK > > > From vances@REDACTED Wed Aug 27 15:19:59 2003 From: vances@REDACTED (Vance Shipley) Date: Wed, 27 Aug 2003 09:19:59 -0400 Subject: Why no is_string()? Message-ID: <20030827131959.GD44506@frogman.motivity.ca> There is no guard test is_string(). Now I realize that strings are not a unique data type in Erlang however they are respresented as such in many ways. In the external term format there is a unique tag for strings. In the documentation we have things with type "string()". I'd like to have a is_string() guard which would tell the difference between [foo, <<1,2,3>>, [a,b,c]] and "bar". Would this require a time consuming test of each element of the list or is the internal tagging already there? -Vance From jk@REDACTED Wed Aug 27 15:40:14 2003 From: jk@REDACTED (=?ISO-8859-1?Q?Johan_K=F6lhi?=) Date: Wed, 27 Aug 2003 15:40:14 +0200 Subject: Newbie graphics question In-Reply-To: <3F4CA216.6090903@erlang-consulting.com> References: <3F4C93FC.5010305@fluffclub.net> <3F4CA216.6090903@erlang-consulting.com> Message-ID: <3F4CB4BE.5090605@fluffclub.net> Excellent, I will check it out! Thanks for your help, /JK Francesco Cesarini wrote: > Check out etk, an erlang to TK binding that bypasses TCL altogether. > It is much more efficient. I am not sure of its state and upkeep. > Check out http://sourceforge.net/projects/erlgtk/ > > GS only has the most basic functionality, and will be kept that way by > Ericsson did not see graphics as a priority in telecom applications. > > Cheers, > Francesco > -- > http://www.erlang-consulting.com > > Johan K?lhi wrote: > >> Hi all, >> >> I'm working on a simulations system that has a GUI implemented with >> GS. I am in need of a zoom out function to be able to see more of my >> Canvas sometimes. >> >> Can this be achieved with GS? Have searched the archives and all >> documentation but it seems that nothing like that is available... is >> that right? >> >> Is there any other graphics system that I can use instead with more >> advanced functionality? >> >> Thanks in advance, >> >> /JK >> >> >> > > From raimo.niskanen@REDACTED Wed Aug 27 16:39:28 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Wed, 27 Aug 2003 16:39:28 +0200 Subject: Why no is_string()? References: <20030827131959.GD44506@frogman.motivity.ca> Message-ID: It would require a test for each element in the whole list. The only guard function I know of that is O(N) is length(), and that is almost a mistake since guard tests must be fast. / Raimo Niskanen, Erlang/OTP, Ericsson AB Vance Shipley wrote: > There is no guard test is_string(). Now I realize that strings > are not a unique data type in Erlang however they are respresented > as such in many ways. In the external term format there is a > unique tag for strings. In the documentation we have things with > type "string()". > > I'd like to have a is_string() guard which would tell the difference > between [foo, <<1,2,3>>, [a,b,c]] and "bar". > > Would this require a time consuming test of each element of the list > or is the internal tagging already there? > > -Vance > > > From Marc.Vanwoerkom@REDACTED Thu Aug 28 12:35:50 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 28 Aug 2003 12:35:50 +0200 (MEST) Subject: Enterprise Erlang Beams? In-Reply-To: (vlad_dumitrescu@hotmail.com) Message-ID: <200308281035.h7SAZop23470@bonsai.fernuni-hagen.de> > - I don't think it would be good to try to imitate J2EE. Many J2EE features are > aimed at solving things that are non-problems in Erlang (as you pointed out > also). Maybe a better way to express the goal would be "implementing an > Enterprise Application Server". The Apache folks just started with their own J2EE server "Geronimo", I follow the list loosly to understand what that involves. So far it looked like providing a lot different services, like messaging frameworks. Part of that should be possible in Erlang as well. I like the idea to provide Java equivalents (similiar or better features but not implemented in Java). Yaws is a cool example. > - On the web side, we would need a framework to bridge the gap between HTML and > the application. Custom tag libraries, or other templating mechanisms, could be > an elegant solution that is already in place. The semantic gap from todays web > design should not be large. Stuff like struts. I also saw attempts to provide Web equivalents of traditional GUI widgets. Myself I had to recode a treeview widget in PHP latetly. Regards, Marc From Marc.Vanwoerkom@REDACTED Thu Aug 28 13:04:23 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 28 Aug 2003 13:04:23 +0200 (MEST) Subject: Newbie graphics question In-Reply-To: <3F4C93FC.5010305@fluffclub.net> (message from =?ISO-8859-1?Q?Johan_K=F6lhi?= on Wed, 27 Aug 2003 13:20:28 +0200) Message-ID: <200308281104.h7SB4NA29590@bonsai.fernuni-hagen.de> > Is there any other graphics system that I can use instead with more > advanced functionality? If you interface to Java you might want to look at ZUI/2.5D toolkits like VTM or Jazz. Regards, Marc From jilani.khaldi@REDACTED Thu Aug 28 14:11:00 2003 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Thu, 28 Aug 2003 14:11:00 +0200 Subject: Tail/Non tail recursion Message-ID: Hi All, Is there a better way to write this code when there is a lot of elements in the list? square([H|T]) -> [(H*H|square(T)]; square([]) -> []. Thanks. jilani From Bengt.Kleberg@REDACTED Thu Aug 28 14:23:10 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Thu, 28 Aug 2003 14:23:10 +0200 Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: <3F4DF42E.3050304@ericsson.com> Jilani Khaldi wrote: > Hi All, > Is there a better way to write this code when there is a lot of elements > in the list? > > square([H|T]) -> [(H*H|square(T)]; > square([]) -> []. > square( Numbers ) -> Fun = fun( N ) -> N*N end, lists:map( Fun, Numbers ). bengt From vlad_dumitrescu@REDACTED Thu Aug 28 14:36:12 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 28 Aug 2003 14:36:12 +0200 Subject: Tail/Non tail recursion References: Message-ID: Hi, > Is there a better way to write this code when there is a lot of elements in > the list? > > square([H|T]) -> [(H*H|square(T)]; > square([]) -> []. For example, square(L) -> square(L, []). square([], Res) -> lists:reverse(Res). square([H|T], Res) -> square(T, [H*H|Res]); regards, Vlad From peter@REDACTED Thu Aug 28 14:45:28 2003 From: peter@REDACTED (Peter Lund) Date: Thu, 28 Aug 2003 13:45:28 +0100 (BST) Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: <56370.149.254.120.136.1062074728.squirrel@www.lundata.se> Possibly: square([H|T]) -> [H*H|square(T)]; square([]) -> []. Since the one you wrote will not compile. :) No, I think this is one of the most efficient ways to do it and it is tail-recursive. An alternative would be: lists:map(fun(X) -> X*X end, ListOfNumbers). /Peter > Hi All, > Is there a better way to write this code when there is a lot of > elements in the list? > > square([H|T]) -> [(H*H|square(T)]; > square([]) -> []. > > Thanks. > > jilani From luke@REDACTED Thu Aug 28 15:08:23 2003 From: luke@REDACTED (Luke Gorrie) Date: 28 Aug 2003 15:08:23 +0200 Subject: Tail/Non tail recursion In-Reply-To: <3F4DF42E.3050304@ericsson.com> References: <3F4DF42E.3050304@ericsson.com> Message-ID: Jilani Khaldi wrote: > Hi All, > Is there a better way to write this code when there is a lot of > elements in the list? > square([H|T]) -> [(H*H|square(T)]; > square([]) -> []. Short answer: That's best in that it uses time and space proportional to the length of the list, just like lists:map, list comprehension, etc. Long answer: There was an eye-wateringly detailed look at the performance of various implementations of roughly this algorithm on this list two years ago: tail recursion + reverse, continuation-passing style, etc. I don't know if the conclusions are still accurate for R9C, but here's the start of the thread if anyone is interested: http://www.erlang.org/ml-archive/erlang-questions/200110/msg00019.html And the conclusion: http://www.erlang.org/ml-archive/erlang-questions/200110/msg00024.html P.S., I like: square(L) -> [N*N || N <- L]. -Luke From vlad_dumitrescu@REDACTED Thu Aug 28 15:39:34 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 28 Aug 2003 15:39:34 +0200 Subject: Tail/Non tail recursion References: <3F4DF42E.3050304@ericsson.com> Message-ID: Hi, ----- Original Message ----- From: "Luke Gorrie" > > square([H|T]) -> [H*H|square(T)]; > > square([]) -> []. > > Short answer: That's best in that it uses time and space proportional > to the length of the list, just like lists:map, list comprehension, > etc. Did I miss the fact that the Erlang compiler now also does cons-tail-call optimizations? (or whatever it is called :-) I remember that was not the case for some versions ago, and I did not look at all the change logs... or I just forgot about it... regards, Vlad From ingela@REDACTED Thu Aug 28 15:47:37 2003 From: ingela@REDACTED (Ingela Anderton) Date: Thu, 28 Aug 2003 15:47:37 +0200 Subject: Tail/Non tail recursion References: <3F4DF42E.3050304@ericsson.com> Message-ID: <16206.2041.221947.510819@gargle.gargle.HOWL> Luke Gorrie wrote: > There was an eye-wateringly detailed look at the performance of > various implementations of roughly this algorithm on this list two > years ago: tail recursion + reverse, continuation-passing style, > etc. I don't know if the conclusions are still accurate for R9C, but You could always make a new test with help of the benchmark framework provided in the efficiency guide to come to the right conclusion for R9C. -- /Ingela Ericsson AB - OTP team From D.WILLIAMS@REDACTED Thu Aug 28 15:56:05 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Thu, 28 Aug 2003 15:56:05 +0200 Subject: Tail/Non tail recursion Message-ID: -module(square). -export([run/0,plain/1,map/1,comprehension/1]). run() -> List = lists:seq(1,1000000), timer:start(), lists:foreach( fun(Fun) -> {Time,_} = timer:tc(?MODULE,Fun,[List]), io:fwrite("~w: ~w~n",[Fun,Time]) end, [plain,map,comprehension]). plain([H|T]) -> [H*H|plain(T)]; plain([]) -> []. map(Numbers) -> lists:map(fun(X)->X*X end,Numbers). comprehension(Numbers)-> [X*X||X<-Numbers]. ------ 2> c(square). {ok,square} 3> square:run(). plain: 3155000 map: 2003000 comprehension: 1592000 ok 4> (Win2K with R9B) Regards, Dominic. From thomasl_erlang@REDACTED Thu Aug 28 15:57:26 2003 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 28 Aug 2003 06:57:26 -0700 (PDT) Subject: Erlang application roundup Message-ID: <20030828135726.87301.qmail@web41903.mail.yahoo.com> Dear Erlang programmers, I think it's time to find out the state of Erlang usage, so please reply to this little poll (always email me, and the list if you like to) as appropriate: I would like to know what Erlang programs you are working on, well-known or unknown, so that we can list them somewhere prominent. What I would like you to tell me: - who you are (company/department + optional contact) - project homepage, if any - what your system does (one line/sentence or so) - size (approx. lines of Erlang) * don't count OTP * optionally loc in other languages, or just "other" - type (industrial or academic or open-source) (personal, secret, unreleased projects may be the subject of another poll) Also welcome: - project duration - number of developers - status (beta, released, supporting N installations, version 20.1, ...) I will put the answers together in a table and hand this over to erlang.org. Best, Thomas __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com From joachim.durchholz@REDACTED Thu Aug 28 16:03:59 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Thu, 28 Aug 2003 16:03:59 +0200 Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: <3F4E0BCF.8020904@web.de> Jilani Khaldi wrote: > Is there a better way to write this code when there is a lot of > elements in the list? > > square([H|T]) -> [(H*H|square(T)]; square([]) -> []. Make it a one-liner using map(), like this: square(L) -> map(fun (X) -> X*X end, L) This is potentially more efficient than explicitly writing down the recursion :-) Regards, Jo From vances@REDACTED Thu Aug 28 16:42:41 2003 From: vances@REDACTED (Vance Shipley) Date: Thu, 28 Aug 2003 10:42:41 -0400 Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: <20030828144241.GL35402@frogman.motivity.ca> On Thu, Aug 28, 2003 at 03:56:05PM +0200, WILLIAMS Dominic wrote: } } comprehension(Numbers)-> } [X*X||X<-Numbers]. } List comprehensions rule. For anyone relatively new to Erlang; if you haven't used a list comprehension yet you should have. Learn it now, you'll be glad you did. With list comprehensions you can avoid writing complete functions and inline a single line in your code instead. The fact that the comprehension version won this particular shootout is a bonus. -Vance From raimo.niskanen@REDACTED Thu Aug 28 17:23:10 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Thu, 28 Aug 2003 17:23:10 +0200 Subject: Tail/Non tail recursion References: Message-ID: I think Peter Lund's suggestion (corrected variant of Jilani Khaldi's) is the fastest in this case (and it is non-tail-recursive): square([H|T]) -> [H*H|square(T)]; square([]) -> []. The list comprehension variant suggested by Luke Gorrie will probably be translated to essentially the same as the above by the compiler so it should be just as fast (and it is beautifully short): square(L) -> [N*N || N <- L]. The closest competitor would be (and it is tail-recursive): square(L) -> square(L, []). square([], R) -> lists:reverse(L); square([H|T], R) -> square(T, [H*H|R]). Why do I think the first (second) one is the fastest? The first one saves two words on the stack (one result H*H (or just H doing the multiplication after the return) and one return address) per recursion on the way down. Every now and then the stack+heap size will exeed the allocated limit causing a garbage collection. After reaching the end of the input list it starts returning, building the result list on the way up - adding two words on the heap (a cons cell with one word immediate result value and one word tail pointer) and popping the two words off the stack, per return. No stack+heap size change, that is. AND since the heap and the stack shares allocated area and the heap grows upwards towards the stack downwards growing stack, no garbage collections has to be done. The second one i think is syntactical sugar for the first one. The third one saves two words on the heap per recursion (one cons cell but built in the reverse order). The stack does not change since the calls are tail recursive. Garbage collections will occur just as for the first suggestion, but now caused by heap growth not stack growth. After reaching the end of the input list it will build the non-reversed result list by calling lists:reverse/1 that adds and removes two words on the heap per recursion. No heap size chanbe, that is, BUT the new cons cells are allocated from the top of the heap and the freed creates holes in the heap, so the holes has to be garbage collected every now and then. Summing it up then, I guess that the first and the third one will reach the end of the input list in the same time. Then the first one just has to do N returns, but the third one has to call a (fast, but wait...) BIF that builds and garbage collects holes in proportion to the input list length. That is why I think the first (second) one wins: the non-tail-recursion data to be pushed on the stack is not greater than the result to build on the heap when returning, and it is fast to build the result when returning. But to know you must benchmark. Messen ist Wissen. (Werner von Siemens: To measure is to know) / Raimo Niskanen, Erlang/OTP, Ericsson AB Jilani Khaldi wrote: > Hi All, > Is there a better way to write this code when there is a lot of elements > in the list? > > square([H|T]) -> [(H*H|square(T)]; > square([]) -> []. > > Thanks. > > jilani From luke@REDACTED Thu Aug 28 17:41:59 2003 From: luke@REDACTED (Luke Gorrie) Date: 28 Aug 2003 17:41:59 +0200 Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: Raimo Niskanen writes: > I think Peter Lund's suggestion (corrected variant of Jilani Khaldi's) > is the fastest in this case (and it is non-tail-recursive): We must of course remember that he asked for a better way, not a faster one. -Luke (guilty!) From peter@REDACTED Thu Aug 28 18:03:19 2003 From: peter@REDACTED (Peter Lund) Date: Thu, 28 Aug 2003 17:03:19 +0100 (BST) Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: <4308.217.213.248.193.1062086599.squirrel@www.lundata.se> Yes, this is what I meant even if I failed to write that into plain language. I have a faint memory from several years ago, that there was a compiler optimization for exactly this type of non-recursive calls, that in fact made it behave like a tail-recursive function. Maybe someone that KNOWS can tell us if anything like this exist. /Peter > Hi, > > ----- Original Message ----- > From: "Luke Gorrie" >> > square([H|T]) -> [H*H|square(T)]; >> > square([]) -> []. >> >> Short answer: That's best in that it uses time and space proportional >> to the length of the list, just like lists:map, list comprehension, >> etc. > > Did I miss the fact that the Erlang compiler now also does > cons-tail-call optimizations? (or whatever it is called :-) > I remember that was not the case for some versions ago, and I did not > look at all the change logs... or I just forgot about it... > > regards, > Vlad From peter@REDACTED Thu Aug 28 18:37:37 2003 From: peter@REDACTED (Peter Lund) Date: Thu, 28 Aug 2003 17:37:37 +0100 (BST) Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: <4356.217.213.248.193.1062088657.squirrel@www.lundata.se> When I ran your code on my Win2K system several times I got 3 very different results... 1> c(square). {ok,square} 2> square:run(). plain: 5027000 map: 2644000 comprehension: 2935000 ok 3> square:run(). plain: 8022000 map: 9023000 comprehension: 1302590 ok 4> square:run(). plain: 2433000 map: 3935000 comprehension: 2473000 Does this just show that W2K is crap? :) Peter > -module(square). > -export([run/0,plain/1,map/1,comprehension/1]). > > run() -> > List = lists:seq(1,1000000), > timer:start(), > lists:foreach( > fun(Fun) -> > {Time,_} = timer:tc(?MODULE,Fun,[List]), > io:fwrite("~w: ~w~n",[Fun,Time]) > end, > [plain,map,comprehension]). > > plain([H|T]) -> [H*H|plain(T)]; > plain([]) -> []. > > map(Numbers) -> > lists:map(fun(X)->X*X end,Numbers). > > comprehension(Numbers)-> > [X*X||X<-Numbers]. > > > > ------ > > 2> c(square). > {ok,square} > 3> square:run(). > plain: 3155000 > map: 2003000 > comprehension: 1592000 > ok > 4> > > (Win2K with R9B) > > Regards, > > Dominic. From vlad_dumitrescu@REDACTED Thu Aug 28 19:34:04 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 28 Aug 2003 19:34:04 +0200 Subject: Tail/Non tail recursion References: <4356.217.213.248.193.1062088657.squirrel@www.lundata.se> Message-ID: Hi, > When I ran your code on my Win2K system several times I got > 3 very different results... I'd guess you got some garbage collections in there, that messed up the timings. /Vlad From joachim.durchholz@REDACTED Thu Aug 28 20:14:39 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Thu, 28 Aug 2003 20:14:39 +0200 Subject: Tail/Non tail recursion In-Reply-To: <4356.217.213.248.193.1062088657.squirrel@www.lundata.se> References: <4356.217.213.248.193.1062088657.squirrel@www.lundata.se> Message-ID: <3F4E468F.1060507@web.de> Peter Lund wrote: > When I ran your code on my Win2K system several times I got > 3 very different results... > [...] > Does this just show that W2K is crap? :) No, it shows that benchmarking is a bad idea if one doesn't know what's being measured. I suspect that garbage collection has disturbed your results. The effects are particularly visible because Erlang uses a stop-the-world collector (though it should be more appropriately named "stop-the-process collector" in an Erlang context). Regards, Jo From klacke@REDACTED Thu Aug 28 22:52:04 2003 From: klacke@REDACTED (klacke@REDACTED) Date: Thu, 28 Aug 2003 22:52:04 +0200 Subject: yaws 1.30 Message-ID: <20030828205204.GA20370@hyber.org> Folks, I am happy to announce yaws 1.30. This time we have a major release with a whole slew of new features contributed by several people. New energetic developers in the yaws project are Carsten Schultz and Leon Smith. Code, docs, relnotes and whatnot as usual at http://yaws.hyber.org /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From ok@REDACTED Fri Aug 29 00:45:43 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 29 Aug 2003 10:45:43 +1200 (NZST) Subject: Tail/Non tail recursion Message-ID: <200308282245.h7SMjhJ5196360@atlas.otago.ac.nz> Jilani Khaldi wrote: > Is there a better way to write this code ====> > when there is a lot of elements in the list? > square([H|T]) -> [H*H | square(T)]; > square([]) -> []. Bengt Kleberg suggested, more or less, square(Numbers) -> lists:map(fun(X) -> X*X end, Numbers). Using a higher order function so that you don't have to code the recursion yourself is "better" in several ways, but I take it that the key phrase was "when there is a lot of elements in the list". The answer is to _measure_ it. 3> sq:t(d, 100000). {650,100000} 5> sq:t(m, 100000). {2990,100000} That is, the first (direct) version was about 4.6 times faster, and thus "better" for large numbers of elements. Here's a transcript of Erlang running my test file. f% erl 1> c(sq). {ok,sq} 2> l(sq). {module,sq} 3> sq:t(d, 100000). {650,100000} 4> sq:t(u, 100000). {430,100000} 5> sq:t(m, 100000). {2990,100000} 6> {2990/650, 2990/430, 650/430}. {4.60000,6.95349,1.51163} 7> halt(). We see that the lists:map version is 4.6 times slower than the direct version, which is in term 1.5 times slower than an unrolled version. On a different processor, or with a different version of Erlang, your results might well be different, but the ratios are likely to be roughly the same. If the speed of such an operation is of the utmost importance, then it might be worth going with an unrolled version, but the simple direct version should normally be fast enough. Here is the sq module. It's not intended as an example of good Erlang style, it's just what I typed in a hurry to do the job. -module(sq). -export([t/2]). t(V, N) -> m(V, lists:duplicate(N, 28.0)). m(V, L) -> {T0,_} = statistics(runtime), R = r(V, L), {T1,_} = statistics(runtime), {T1-T0, length(R)}. r(d, L) -> d(L); r(u, L) -> u(L); r(m, L) -> lists:map(fun(X) -> X*X end, L). d([H|T]) -> [H*H | d(T)]; d([]) -> []. u([H1,H2,H3|T]) -> [H1*H1, H2*H2, H3*H3 | u(T)]; u([H1|T]) -> [H1*H1 | u(T)]; u([]) -> []. From ms@REDACTED Fri Aug 29 00:59:41 2003 From: ms@REDACTED (Martin Sandiford) Date: Fri, 29 Aug 2003 08:29:41 +0930 Subject: Tail/Non tail recursion In-Reply-To: References: Message-ID: <20030828225941.GG4013@mcdev.com.au> Hi Dominic, My numbers seem to be more stable if I run erlang:garbage_collect() before the timer:tc(...). Linux, PIII 1GHz, R9C: (a@REDACTED)6> perf:run(). plain: 1177035 map: 1640737 comprehension: 721675 ok On Thu, 28 Aug 2003, WILLIAMS Dominic wrote: > -module(square). > -export([run/0,plain/1,map/1,comprehension/1]). > > run() -> > List = lists:seq(1,1000000), > timer:start(), > lists:foreach( > fun(Fun) -> erlang:garbage_collect(), %% <- Inserted > {Time,_} = timer:tc(?MODULE,Fun,[List]), > io:fwrite("~w: ~w~n",[Fun,Time]) > end, > [plain,map,comprehension]). > > plain([H|T]) -> [H*H|plain(T)]; > plain([]) -> []. > > map(Numbers) -> > lists:map(fun(X)->X*X end,Numbers). > > comprehension(Numbers)-> > [X*X||X<-Numbers]. From raimo.niskanen@REDACTED Fri Aug 29 09:12:27 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Fri, 29 Aug 2003 09:12:27 +0200 Subject: Tail/Non tail recursion References: <3F4DF42E.3050304@ericsson.com>, , <16206.2041.221947.510819@gargle.gargle.HOWL> Message-ID: Here are the results from the benchmark tool from the efficiency guide: R7B01 R8B R9B R9C ------------------------------------- square plain 1.22 1.01 1.01 1.00 square lcomp 1.34 1.01 1.03 1.01 square tail 1.23 1.05 1.02 1.03 square map 1.70 1.54 1.48 1.48 On my old Sun Ultra 10 for lists of length 30000. The results are normalized execution time. Vlad Dumitrescu's simple benchmark indicated something else, and demonstrated that benchmarks are a bit tricky. The benchmark tool from the efficiency guide does what it can to eliminate errors. For example are all tests run in a new process so they will have to do the garbage collection in the same way. In Vlad's benchmark the first test made the heap grow so the subsequent tests had a sufficiently big heap to work on and could run almost without garbage collections. Here's the code. The benchmark tool produces a neat .html page with the test results. Try it - you may get addicted. You may even get reliable results. ============================================================= -module(square_bm). -include("bench.hrl"). -export([benchmarks/0]). -export([bm_square_plain/1,bm_square_tail/1, bm_square_lcomp/1, bm_square_map/1]). benchmarks() -> {100, [bm_square_plain,bm_square_tail,bm_square_lcomp,bm_square_map]}. bm_square_plain(Iter) -> iterate(Iter, fun square_plain/1). bm_square_tail(Iter) -> iterate(Iter, fun square_tail/1). bm_square_lcomp(Iter) -> iterate(Iter, fun square_lcomp/1). bm_square_map(Iter) -> iterate(Iter, fun square_map/1). iterate(Iter, Fun) -> List = lists:seq(1, 30000), iterate(Iter, Fun, List). iterate(0, _Fun, _List) -> ok; iterate(Iter, Fun, List) -> Fun(List), iterate(Iter-1, Fun, List). square_plain([]) -> []; square_plain([H|T]) -> [H*H|square_plain(T)]. square_tail(L) -> square_tail(L, []). square_tail([], R) -> lists:reverse(R); square_tail([H|T], R) -> square_tail(T, [H*H|R]). square_lcomp(L) -> [X*X || X <- L]. square_map(L) -> lists:map(fun(X) -> X*X end, L). ============================================================= Short user's guide: Place the above benchmark file square_bm.erl in the same directory as the benchmark tool's two files all.erl and bench.erl. Edit all.erl at the end to point out your installation(s) of erlang. Move all *_bm.erl files to some other directory (e.g a subdirectory ./DISABLED) that you do not want to be run in the benchmark. Start an Erlang command shell and give the commands: c(all). all:run(). Exit the Erlang command shell and edit square_bm.erl to change iterations and/or list length to get run times of a few seconds per test. Since everyone in the world probably has got faster machines than I you will have to increase the numbers. Re-enter the Erlang command shell and give the command: all:run(). Iterate the last two paragraphs until satisfied. Have a look with your web browser on the file index.html to see the results. / Raimo Niskanen, Erlang/OTP, Ericsso AB. Ingela Anderton wrote: > Luke Gorrie wrote: > >>There was an eye-wateringly detailed look at the performance of >>various implementations of roughly this algorithm on this list two >>years ago: tail recursion + reverse, continuation-passing style, >>etc. I don't know if the conclusions are still accurate for R9C, but > > You could always make a new test with help of the benchmark framework > provided in the efficiency guide to come to the right conclusion for R9C. > From vlad_dumitrescu@REDACTED Fri Aug 29 10:28:37 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 29 Aug 2003 10:28:37 +0200 Subject: Tail/Non tail recursion References: <3F4DF42E.3050304@ericsson.com>, , <16206.2041.221947.510819@gargle.gargle.HOWL> Message-ID: ----- Original Message ----- From: "Raimo Niskanen" > Vlad Dumitrescu's simple benchmark indicated something else, and Even before reading further to find out if it was a positive or negative opinion about the benchmark :-) I want to point out it wasn't my benchmark. /Vlad From raimo.niskanen@REDACTED Fri Aug 29 11:27:04 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Fri, 29 Aug 2003 11:27:04 +0200 Subject: Tail/Non tail recursion References: <16206.2041.221947.510819@gargle.gargle.HOWL>, , Message-ID: Oops, I am sorry! /Raimo Vlad Dumitrescu wrote: > ----- Original Message ----- > From: "Raimo Niskanen" > >>Vlad Dumitrescu's simple benchmark indicated something else, and > > > Even before reading further to find out if it was a positive or negative opinion > about the benchmark :-) I want to point out it wasn't my benchmark. > > /Vlad > From raimo.niskanen@REDACTED Fri Aug 29 11:30:49 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Fri, 29 Aug 2003 11:30:49 +0200 Subject: Tail/Non tail recursion References: <16206.2041.221947.510819@gargle.gargle.HOWL>, , Message-ID: ... it was "WILLIAMS Dominic"'s benchmark... / Raimo Vlad Dumitrescu wrote: > ----- Original Message ----- > From: "Raimo Niskanen" > >>Vlad Dumitrescu's simple benchmark indicated something else, and > > > Even before reading further to find out if it was a positive or negative opinion > about the benchmark :-) I want to point out it wasn't my benchmark. > > /Vlad > From bjorn@REDACTED Fri Aug 29 15:32:44 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 29 Aug 2003 15:32:44 +0200 Subject: Tail/Non tail recursion In-Reply-To: "Peter Lund"'s message of "Thu, 28 Aug 2003 17:03:19 +0100 (BST)" References: <4308.217.213.248.193.1062086599.squirrel@www.lundata.se> Message-ID: "Peter Lund" writes: > Yes, this is what I meant even if I failed to write that into plain > language. I have a faint memory from several years ago, that there > was a compiler optimization for exactly this type of non-recursive > calls, that in fact made it behave like a tail-recursive function. > Maybe someone that KNOWS can tell us if anything like this exist. > > /Peter > No, there is no such optimization in Beam. /Bjorn -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From garry@REDACTED Fri Aug 29 21:05:38 2003 From: garry@REDACTED (Garry Hodgson) Date: Fri, 29 Aug 2003 15:05:38 -0400 (EDT) Subject: english version of new erlang book? Message-ID: <2003082915061062183971@k2.sage.att.com> i noticed the announcement of a new erlang book, in french, on the erlang site. for those of us in the cultural backwaters of the US, are there any plans for an english version? or, failing that, any hope of a translation project similar to what we did for the oreilly ocaml book? ---- Garry Hodgson, Technology Consultant, AT&T Labs Be happy for this moment. This moment is your life. From hal@REDACTED Fri Aug 29 23:08:42 2003 From: hal@REDACTED (Hal Snyder) Date: Fri, 29 Aug 2003 16:08:42 -0500 Subject: english version of new erlang book? In-Reply-To: <2003082915061062183971@k2.sage.att.com> (Garry Hodgson's message of "Fri, 29 Aug 2003 15:05:38 -0400 (EDT)") References: <2003082915061062183971@k2.sage.att.com> Message-ID: <87ad9s189x.fsf@ghidra.vail> Garry Hodgson writes: > i noticed the announcement of a new erlang book, in french, on the > erlang site. for those of us in the cultural backwaters of the US, > are there any plans for an english version? or, failing that, any > hope of a translation project similar to what we did for the oreilly > ocaml book? We went ahead and ordered the French from amazon.fr this week. Copies are en route, as they say, 12 days quoted for delivery to Chi. From raimo.niskanen@REDACTED Fri Aug 29 14:07:50 2003 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Fri, 29 Aug 2003 14:07:50 +0200 Subject: Tail/Non tail recursion References: <200308282245.h7SMjhJ5196360@atlas.otago.ac.nz> Message-ID: Here are new benchmark results including Richard A. O'Keefe's unrolled version and an unrolled variant that delivers a reversed result. R7B01 R8B R9B R9C -------------------------------------------- bm_square_ru 1.29 0.96 0.96 1.00 bm_square_u 1.27 1.06 1.10 1.02 bm_square_d 1.27 1.09 1.11 1.08 bm_square_l 1.49 1.09 1.08 1.08 bm_square_t 1.37 1.14 1.12 1.14 bm_square_m 1.82 1.59 1.66 1.58 Winner: reversed and unrolled. It returns the result list in reverse order, but it is tail recursive and the fastest. Often order is not important so do not reverse lists just for the fun of it. Note that the difference between all but the last really is neglectible. The last is the lists:map/2 version that suffers from being general since it calls a fun in the inner loop which slows things down. So the best(tm) choice is really a matter of taste, code clarity, etc. / Raimo Niskanen, Eralng/OTP, Ericsson AB Code: ================================================================== -module(square_bm). -include("bench.hrl"). -export([benchmarks/0]). -export([bm_square_d/1,bm_square_u/1,bm_square_t/1,bm_square_ru/1, bm_square_l/1,bm_square_m/1]). benchmarks() -> {100, [bm_square_d,bm_square_u,bm_square_t,bm_square_ru, bm_square_l,bm_square_m]}. bm_square_d(Iter) -> iterate(Iter, fun square_d/1). bm_square_u(Iter) -> iterate(Iter, fun square_u/1). bm_square_t(Iter) -> iterate(Iter, fun square_t/1). bm_square_ru(Iter) -> iterate(Iter, fun square_ru/1). bm_square_l(Iter) -> iterate(Iter, fun square_l/1). bm_square_m(Iter) -> iterate(Iter, fun square_m/1). iterate(Iter, Fun) -> List = lists:seq(1, 30000), iterate(Iter, Fun, List). iterate(0, _Fun, _List) -> ok; iterate(Iter, Fun, List) -> Fun(List), iterate(Iter-1, Fun, List). square_d([]) -> []; square_d([H|T]) -> [H*H|square_d(T)]. square_u([H,I,J|T]) -> [H*H,I*I,J*J|square_u(T)]; square_u([H,I|T]) -> [H*H,I*I|square_u(T)]; square_u([H|T]) -> [H*H|square_u(T)]; square_u([]) -> []. square_t(L) -> square_t(L, []). %% square_t([], R) -> lists:reverse(R); square_t([H|T], R) -> square_t(T, [H*H|R]). square_ru(L) -> square_ru(L, []). %% square_ru([H,I,J|T], R) -> square_ru(T, [H*H,I*I,J*J|R]); square_ru([H,I|T], R) -> square_ru(T, [H*H,I*I|R]); square_ru([H|T], R) -> square_ru(T, [H*H|R]); square_ru([], R) -> R. square_l(L) -> [X*X || X <- L]. square_m(L) -> lists:map(fun(X) -> X*X end, L). ================================================================== Richard A. O'Keefe wrote: > Jilani Khaldi wrote: > > Is there a better way to write this code > ====> > when there is a lot of elements in the list? > > > square([H|T]) -> [H*H | square(T)]; > > square([]) -> []. > > Bengt Kleberg suggested, more or less, > > square(Numbers) -> lists:map(fun(X) -> X*X end, Numbers). > > Using a higher order function so that you don't have to code the > recursion yourself is "better" in several ways, but I take it that > the key phrase was "when there is a lot of elements in the list". > > The answer is to _measure_ it. > > 3> sq:t(d, 100000). > {650,100000} > 5> sq:t(m, 100000). > {2990,100000} > > That is, the first (direct) version was about 4.6 times faster, > and thus "better" for large numbers of elements. > > Here's a transcript of Erlang running my test file. > f% erl > 1> c(sq). > {ok,sq} > 2> l(sq). > {module,sq} > 3> sq:t(d, 100000). > {650,100000} > 4> sq:t(u, 100000). > {430,100000} > 5> sq:t(m, 100000). > {2990,100000} > 6> {2990/650, 2990/430, 650/430}. > {4.60000,6.95349,1.51163} > 7> halt(). > > We see that the lists:map version is 4.6 times slower than the > direct version, which is in term 1.5 times slower than an unrolled version. > > On a different processor, or with a different version of Erlang, your > results might well be different, but the ratios are likely to be roughly > the same. If the speed of such an operation is of the utmost importance, > then it might be worth going with an unrolled version, but the simple > direct version should normally be fast enough. > > Here is the sq module. It's not intended as an example of good Erlang > style, it's just what I typed in a hurry to do the job. > > -module(sq). > -export([t/2]). > > t(V, N) -> > m(V, lists:duplicate(N, 28.0)). > > m(V, L) -> > {T0,_} = statistics(runtime), > R = r(V, L), > {T1,_} = statistics(runtime), > {T1-T0, length(R)}. > > r(d, L) -> d(L); > r(u, L) -> u(L); > r(m, L) -> lists:map(fun(X) -> X*X end, L). > > d([H|T]) -> [H*H | d(T)]; > d([]) -> []. > > u([H1,H2,H3|T]) -> [H1*H1, H2*H2, H3*H3 | u(T)]; > u([H1|T]) -> [H1*H1 | u(T)]; > u([]) -> []. > From Marc.Vanwoerkom@REDACTED Sat Aug 30 00:53:21 2003 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Sat, 30 Aug 2003 00:53:21 +0200 (MEST) Subject: english version of new erlang book? In-Reply-To: <2003082915061062183971@k2.sage.att.com> (message from Garry Hodgson on Fri, 29 Aug 2003 15:05:38 -0400 (EDT)) Message-ID: <200308292253.h7TMrL500372@bonsai.fernuni-hagen.de> > i noticed the announcement of a new erlang book, > in french, on the erlang site. I got that book two weeks ago via www.amazon.fr If you go to one of the better bookshops in Germany you can order almost any US or UK titel, but nothing from your European neighbours. Quite embarassing. And although we no have Europe-wide banking numbers, which should make money transfers from bank to bank easy and cheap, I still needed to pay via credit card. So much for united Europe. :) > for those of us in the > cultural backwaters of the US, are there any plans > for an english version? I am sure the author will respond to this himself soon :) Note that computer French is simpler than normal French, add the nice graphics plus code snippets which help understanding and your school french should be ok, at least it worked for me. > or, failing that, any hope of > a translation project similar to what we did for the > oreilly ocaml book? That book is part of a series called "coming next" and seems to have the function to introduce interested readers with new promising technologies. It honours the French that they have such a book project. And indeed this book gives a nice overview over the large Erlang/OTP system plus some free stuff (like yaws). This is nice and worth the money, but it won't justify the collective effort. What we rather need is - something easy with lots of example code like the Java tutorial - online and free to use for everyone - a rigorous, strong title like the original Erlang book, only updated I don't know if one should organize an open doc effort using docbook stuff, checked into a public cvs version. like the FreeBSD documentation project does for example, or some improved wiki (one which can render high quality), because installing all docbook tools already imposes a nontrivial burden. Anyone interested? Regards, Marc From thomasl_erlang@REDACTED Sat Aug 30 08:51:01 2003 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 29 Aug 2003 23:51:01 -0700 (PDT) Subject: Tail/Non tail recursion In-Reply-To: Message-ID: <20030830065101.61919.qmail@web41903.mail.yahoo.com> --- Raimo Niskanen wrote: > Here are new benchmark results including Richard A. > O'Keefe's unrolled > version and an unrolled variant that delivers a > reversed result. It is also nice to see that R9C0 is 15-35% faster than R7B2 (at least on this sort of benchmark :-). Best, Thomas __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com From mickael.remond@REDACTED Sun Aug 31 14:21:03 2003 From: mickael.remond@REDACTED (Mickael Remond) Date: Sun, 31 Aug 2003 14:21:03 +0200 Subject: english version of new erlang book? In-Reply-To: <200308292253.h7TMrL500372@bonsai.fernuni-hagen.de> References: <200308292253.h7TMrL500372@bonsai.fernuni-hagen.de> Message-ID: <1062332463.322260a78aed2@webmail.spamcop.net> Marc Ernst Eddy van Woerkom : > > for those of us in the > > cultural backwaters of the US, are there any plans > > for an english version? > > I am sure the author will respond to this himself soon :) > > Note that computer French is simpler than normal > French, add the nice graphics plus code snippets > which help understanding > and your school french should be ok, at least it > worked for me. Yes. I think it could be usefull even if you know very little french. However, I am trying hard to make the english translation happens. I already have a volunteer for the english translation and many, many request for an English version. What I need is now an English or American editor willing to publish the book. This is the last needed step. The English version will have some errata added to the book and maybe some new chapters, as I am still working on the text to improve it and keep it up to date. So do not hesitate to send me remarks and request for new topics so that I can have your feedback for the English version if it is to be published. Of course, I will keep you informed through the Erlang mailing list. Thank you for your feedback. -- Micka?l R?mond From per@REDACTED Sun Aug 31 18:52:20 2003 From: per@REDACTED (Per Hedeland) Date: Sun, 31 Aug 2003 18:52:20 +0200 (CEST) Subject: ei_rpc_from speedup? In-Reply-To: <20030822124806.GH21374@frogman.motivity.ca> Message-ID: <200308311652.h7VGqKLn013998@tordmule.bluetail.com> Vance Shipley wrote: > >File descriptors are opaque data types. You shouldn't make >any assumptions about what values they take other than that >they fit in an int. That file descriptors are assigned >incrementally increasing from stdio is only a well known >practice not a guarantee. POSIX requires not only that file descriptors are "small integers", and not only that they are assigned incrementally, but that any system call returning a file descriptor will return the lowest-numbered free one. Thus e.g. close(0); fd = open("/dev/null", O_RDWR); is guaranteed to set fd to 0 (or -1 in case /dev/null couldn't be opened:-). And there is *lots* of "core" Unix code that depends on this behaviour. > I'm currently working with devices >which start at 257 and assign incrementally from there. I guess they're not POSIX-compliant then. And of course "file descriptor" can be taken in an "abstract" sense, but then it's not something you can pass to select() (or poll()). --Per Hedeland per@REDACTED