From xlcr@REDACTED Sat Apr 1 10:09:56 2006 From: xlcr@REDACTED (Nick Linker) Date: Sat, 01 Apr 2006 15:09:56 +0700 Subject: Newbie questions In-Reply-To: <200603302306.k2UN6SeE495849@atlas.otago.ac.nz> References: <200603302306.k2UN6SeE495849@atlas.otago.ac.nz> Message-ID: <442E3554.4030401@mail.ru> Richard A. O'Keefe wrote: > >I'm aware of (and have used) several programming languages providing >as-long-as-necessary integer arithmetic. Without consulting manuals >(everything is being moved out of my office so that new carpet can >be laid) it's hard to be sure, but from memory, NONE of them provides >an operation "how many decimal digits in this bignum". Common Lisp >has HAULONG, which tells you about how many BITS, and Java's >BigInteger class offers bitLength(), which again tells you how many >BITS. In Smalltalk, the obvious thing to do would be n printString size, >and in Scheme it would be (string-length (number->string n)). > > Hm, for example Maple has "ilog10" function, that instantly gets the result. (Although Mapple is specialized language.) >The question remains, WHY? For what kind of problem is it useful to know >the number of decimal digits but NOT what the digits actually are? > > I had an idea to implement numeric mutable arrays as bignums. (Btw I know about ets, dictionary and ports). >I benchmarked the following code against length(integer_to_list(N)), >for the first however many factorials. The two seemed to be about the >same speed. Your mileage will of course vary. > >integer_digits(N) when integer(N) -> > if N >= 0 -> natural_digits_loop(N, 0) > ; N < 0 -> natural_digits_loop(-N, 1) > end. > >natural_digits(N) when integer(N), N >= 0 -> > natural_digits_loop(N, 0). > >natural_digits_loop(N, D) when N >= 10000 -> > natural_digits_loop(N div 10000, D + 4); >natural_digits_loop(N, D) when N >= 1000 -> > D + 4; >natural_digits_loop(N, D) when N >= 100 -> > D + 3; >natural_digits_loop(N, D) when N >= 10 -> > D + 2; >natural_digits_loop(_, D) -> > D + 1. > > Interesting idea - to move by 4 not by 1. I tried to do like that except I moved by 1 each step, and it wasn't better than length(integer_to_list(N)). Your answers are always comprehensive and very useful. Thank you, Richard. Best regards, Linker Nick. From invisio22@REDACTED Sat Apr 1 15:19:03 2006 From: invisio22@REDACTED (Eric Shun) Date: Sat, 1 Apr 2006 15:19:03 +0200 Subject: Write a supervisor Message-ID: <3f9db9f20604010519k4f418928v162ce9df282ab3f2@mail.gmail.com> In the examples I could find, there are "manually written" supervisors and others using -behaviour(supervisor). Is this only used for servers supervisors or Should I use it whenever I need to write a supervisor? -------------- next part -------------- An HTML attachment was scrubbed... URL: From orbitz@REDACTED Sat Apr 1 16:24:15 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Sat, 1 Apr 2006 09:24:15 -0500 Subject: Write a supervisor In-Reply-To: <3f9db9f20604010519k4f418928v162ce9df282ab3f2@mail.gmail.com> References: <3f9db9f20604010519k4f418928v162ce9df282ab3f2@mail.gmail.com> Message-ID: <66F80D85-F51F-48E7-98C3-C1D0FCCA2B52@ezabel.com> Well you write a supervisor whenever you want to supervise some processes. They can be servers, clients, anything that needs supervision. Is there some problem with using -behavior (supervisor)? This is the way that you write a supervisor. On Apr 1, 2006, at 8:19 AM, Eric Shun wrote: > In the examples I could find, there are "manually written" > supervisors and others using -behaviour(supervisor). > Is this only used for servers supervisors or Should I use it > whenever I need to write a supervisor? From pupeno@REDACTED Sat Apr 1 22:12:51 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 1 Apr 2006 22:12:51 +0200 Subject: [ANN] SCons Erlang 0.1.0 released Message-ID: <200604012212.55822.pupeno@pupeno.com> I am here announcing the release of SCons Erlang 0.1.0. Scons Erlang is an add on for SCons, a make/autotools replacement, to compile Erlang projects. It is currently in it's early development stages but it can already be useful. There's no documentation yet. If you want to use it first learn the basics of SCons at the `SCons User's Guide`_. Then, to learn how to use SCons Erlang itself take a look at these two project's source code (currently unreleased): - `Serlvers `__ - `Fanterlastic Four `__ Thank you. -- Pupeno (http://pupeno.com) PS: I am sorry if someone felt offended by the cross-posting, please in that case, tell me. .. _`SCons User's Guide`: http://scons.org/doc/HTML/scons-user/book1.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From pupeno@REDACTED Sat Apr 1 22:48:42 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 1 Apr 2006 22:48:42 +0200 Subject: [scons-users] [ANN] SCons Erlang 0.1.0 released In-Reply-To: <200604012212.55822.pupeno@pupeno.com> References: <200604012212.55822.pupeno@pupeno.com> Message-ID: <200604012248.45107.pupeno@pupeno.com> Sorry, I forgot to include the URL: http://pupeno.com/software/scons-erlang Thank you. On Saturday, 1 de April de 2006 22:12, Pupeno wrote: > I am here announcing the release of SCons Erlang 0.1.0. > > Scons Erlang is an add on for SCons, a make/autotools replacement, to > compile Erlang projects. > > It is currently in it's early development stages but it can already be > useful. There's no documentation yet. If you want to use it first learn the > basics of SCons at the `SCons User's Guide`_. Then, to learn how to use > SCons Erlang itself take a look at these two project's source code > (currently unreleased): > > - `Serlvers `__ > - `Fanterlastic Four `__ > > Thank you. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From pupeno@REDACTED Sat Apr 1 23:41:09 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 1 Apr 2006 23:41:09 +0200 Subject: Standard unix daemon Message-ID: <200604012341.13028.pupeno@pupeno.com> Hello, I have an Erlang application, it is a server, it can be started with application:start(appname) and stopped with application:stop(appname). Nice. But now I want to turn it into a unix/posix daemon to make it easier to run it on Linux servers. Here http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 is the answer to the question "How do I get my program to act like a daemon?" of a Unix Programming FAQ. What of that should I do on Erlang ? How ? Thanks. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From robert.virding@REDACTED Sun Apr 2 00:29:14 2006 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 02 Apr 2006 00:29:14 +0200 Subject: Defensive programming In-Reply-To: <0FC6DF8F-8F07-48EA-9F36-0271684AE69E@rogvall.com> References: <200603290036.39986.pupeno@pupeno.com> <0FC6DF8F-8F07-48EA-9F36-0271684AE69E@rogvall.com> Message-ID: <442EFEBA.6020401@telia.com> I think Tony hit it right on here. YOU have to decide what are true errors and what are acceptable return values! Even if the return value is called 'error'. The true errors you should probably just exit on, whereas the others you should probably take care of. Robert Tony Rogvall skrev: > > On 29 mar 2006, at 00.36, Pupeno wrote: > >> Hello, >> I am used to defensive programming and it's hard for me to program >> otherwise. >> Today I've found this piece of code I wrote some months ago: >> >> acceptor(tcp, Module, LSocket) -> >> case gen_tcp:accept(LSocket) of >> {ok, Socket} -> >> case Module:start() of >> {ok, Pid} -> >> ok = gen_tcp:controlling_process(Socket, Pid), >> gen_server:cast(Pid, {connected, Socket}), >> acceptor(tcp, Module, LSocket); >> {error, Error} -> >> {stop, {Module, LSocket, Error}} >> end; >> {error, Reason} -> >> {stop, {Module, LSocket, Reason}} >> end; >> >> is that too defensive ? should I write it this way > > > I suggest you think about the term {error,Reason} as any other term. > Either you need to handle it as a result from a function call, or you do > not. > > >> >> acceptor(tcp, Module, LSocket) -> >> {ok, Socket} = case gen_tcp:accept(LSocket), >> {ok, Pid} = Module:start() >> ok = gen_tcp:controlling_process(Socket, Pid), >> gen_server:cast(Pid, {connected, Socket}), >> acceptor(tcp, Module, LSocket); >> > > The may be some reasons why accpet fail. > > - The listen socket has closed. > - Resource problems. > - Timeout (if used) > > This may require special treat. > > /Tony > > > From serge@REDACTED Sun Apr 2 01:32:20 2006 From: serge@REDACTED (Serge Aleynikov) Date: Sat, 01 Apr 2006 18:32:20 -0500 Subject: Standard unix daemon In-Reply-To: <200604012341.13028.pupeno@pupeno.com> References: <200604012341.13028.pupeno@pupeno.com> Message-ID: <442F0D84.4030207@hq.idt.net> You have several options, two of which are: 1. Start Erlang with -detached -noshell options http://www.erlang.org/doc/doc-5.4.13/erts-5.4.13/doc/html/erl.html 2. Use run_erl / start_erl to start Erlang. http://www.erlang.org/doc/doc-5.4.13/erts-5.4.13/doc/html/run_erl.html The second method is preferred. Serge Pupeno wrote: > Hello, > I have an Erlang application, it is a server, it can be started with > application:start(appname) and stopped with application:stop(appname). Nice. > But now I want to turn it into a unix/posix daemon to make it easier to run > it on Linux servers. > Here http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 is the answer to > the question "How do I get my program to act like a daemon?" of a Unix > Programming FAQ. What of that should I do on Erlang ? How ? > Thanks. From orbitz@REDACTED Sun Apr 2 02:32:00 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Sat, 1 Apr 2006 19:32:00 -0500 Subject: Standard unix daemon In-Reply-To: <442F0D84.4030207@hq.idt.net> References: <200604012341.13028.pupeno@pupeno.com> <442F0D84.4030207@hq.idt.net> Message-ID: <9E26D28D-2593-47E4-811A-3BEC4D15061D@ezabel.com> http://www.trapexit.org/docs/howto/port_and_otp.html Also describes how to make an init script. On Apr 1, 2006, at 6:32 PM, Serge Aleynikov wrote: > You have several options, two of which are: > > 1. Start Erlang with -detached -noshell options > > http://www.erlang.org/doc/doc-5.4.13/erts-5.4.13/doc/html/erl.html > > 2. Use run_erl / start_erl to start Erlang. > > http://www.erlang.org/doc/doc-5.4.13/erts-5.4.13/doc/html/run_erl.html > > The second method is preferred. > > Serge > > Pupeno wrote: >> Hello, >> I have an Erlang application, it is a server, it can be started >> with application:start(appname) and stopped with application:stop >> (appname). Nice. But now I want to turn it into a unix/posix >> daemon to make it easier to run it on Linux servers. >> Here http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 is the >> answer to the question "How do I get my program to act like a >> daemon?" of a Unix Programming FAQ. What of that should I do on >> Erlang ? How ? >> Thanks. > From alex.arnon@REDACTED Sun Apr 2 14:10:06 2006 From: alex.arnon@REDACTED (Alex Arnon) Date: Sun, 2 Apr 2006 15:10:06 +0300 Subject: Distributed programming In-Reply-To: References: Message-ID: <944da41d0604020510u5e64b197i7112d777ffd23ca2@mail.gmail.com> On 3/28/06, Ulf Wiger (AL/EAB) wrote: > > > Joe Armstrong (AL/EAB) wrote: > > > > > The second... the second, is it possible at all ? Can I > > > launch a process in another node and still let it handle a > > > local socket ? > > > > yes - if you're mad > > Well, you'd need a proxy process handling the port. > Unless things have changed in the past few years, > a port cannot be controlled by a remote pid. > > /Ulf W > Oh? I thought process location is abstract :) Seriously, though, why is this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Sun Apr 2 14:59:56 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Sun, 02 Apr 2006 14:59:56 +0200 Subject: Distributed programming In-Reply-To: <944da41d0604020510u5e64b197i7112d777ffd23ca2@mail.gmail.com> References: <944da41d0604020510u5e64b197i7112d777ffd23ca2@mail.gmail.com> Message-ID: <442FCACC.4090407@hyber.org> Alex Arnon wrote: > > Oh? I thought process location is abstract :) > Seriously, though, why is this? > Process location is abstract, i.e. the location of te process is embedded in the pid and the user of Pis doesn't have to care about wether the pid is local or remote. This doesn't apply to ports though, and a gen_tcp socket is a port. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From pupeno@REDACTED Sun Apr 2 16:00:23 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 2 Apr 2006 16:00:23 +0200 Subject: Standard unix daemon In-Reply-To: <442F0D84.4030207@hq.idt.net> References: <200604012341.13028.pupeno@pupeno.com> <442F0D84.4030207@hq.idt.net> Message-ID: <200604021600.27068.pupeno@pupeno.com> Hello, On Sunday, 2 de April de 2006 01:32, Serge Aleynikov wrote: > 2. Use run_erl / start_erl to start Erlang. > > http://www.erlang.org/doc/doc-5.4.13/erts-5.4.13/doc/html/run_erl.html Ok, So I run my application: $ run_erl -daemon tmp/pipe/ tmp/log/ "exec erl -boot fanterlasticfour" now, how do I stop it ? Thanks. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From serge@REDACTED Sun Apr 2 17:07:44 2006 From: serge@REDACTED (Serge Aleynikov) Date: Sun, 02 Apr 2006 11:07:44 -0400 Subject: Standard unix daemon In-Reply-To: <200604021600.27068.pupeno@pupeno.com> References: <200604012341.13028.pupeno@pupeno.com> <442F0D84.4030207@hq.idt.net> <200604021600.27068.pupeno@pupeno.com> Message-ID: <442FE8C0.3070004@hq.idt.net> You can run a distributed node using "-sname NAME" option, and use another instrance of Erlang to force a distributed stop like this: $ run_erl -daemon tmp/pipe/ tmp/log/ \ "exec erl -sname a -boot fanterlasticfour" $ erl -eval "case rpc:call(a@`hostname -s`, init, stop, []) of " \ "ok -> erlang:halt(0); " \ "_ -> erlang:halt(1) " \ "end." \ -hidden -noshell Or you can acomplish the same using erl_call utility (see: "erl -man erl_call"): $ erl_call -sname a -a "init stop" Serge Pupeno wrote: > Hello, > > On Sunday, 2 de April de 2006 01:32, Serge Aleynikov wrote: > >>2. Use run_erl / start_erl to start Erlang. >> >>http://www.erlang.org/doc/doc-5.4.13/erts-5.4.13/doc/html/run_erl.html > > Ok, > So I run my application: > > $ run_erl -daemon tmp/pipe/ tmp/log/ "exec erl -boot fanterlasticfour" > > now, how do I stop it ? > > Thanks. From serge@REDACTED Mon Apr 3 04:40:14 2006 From: serge@REDACTED (Serge Aleynikov) Date: Sun, 02 Apr 2006 22:40:14 -0400 Subject: hipe segmentation fault Message-ID: <44308B0E.1090505@hq.idt.net> Any advice on what might be causing this seg fault? The same test works fine on another machine with same OS & hardware. [serge@REDACTED:~/tmp]$ erl Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] Eshell V5.4.13 (abort with ^G) 1> os:type(). {unix,linux} 2> os:version(). {2,6,9} 3> c(big, [native]). {ok,big} 4> big:bang(600). Segmentation fault [serge@REDACTED:~/tmp]$ uname -a Linux drp01dev.corp.idt.net 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux [serge@REDACTED:~/tmp]$ cat /etc/redhat-release Red Hat Enterprise Linux ES release 4 (Nahant) $ ldd /usr/local/lib/erlang/erts-5.4.13/bin/beam libdl.so.2 => /lib/libdl.so.2 (0x00a83000) libm.so.6 => /lib/tls/libm.so.6 (0x00a89000) libncurses.so.5 => /usr/lib/libncurses.so.5 (0x0017e000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00ac0000) librt.so.1 => /lib/tls/librt.so.1 (0x00bb2000) libc.so.6 => /lib/tls/libc.so.6 (0x00958000) /lib/ld-linux.so.2 (0x0093f000) Regards, Serge From ok@REDACTED Mon Apr 3 06:34:38 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 3 Apr 2006 16:34:38 +1200 (NZST) Subject: Child modules draft feedback wanted Message-ID: <200604030434.k334YcoK518178@atlas.otago.ac.nz> I have to leave in a few minutes, so there really isn't time to respond to Romain Lenglet's points as they deserve. No, I am trying to solve that problem: removing the use of -include, .hrl files, and -ifdef when those mechanisms are used to select different alternatives in an architecture / configuration. But your proposal does not allow us to do that, thanks to records. I also want to repeat that for Prolog and Erlang I have several times (and in the case of Prolog, several times in the last week) heard a "user" demand for some kind of hierarchical structure within a module. "Child modules" were inspired by Ada, although they don't have much in common with Ada 95 child modules. But my hypothesis (which I should have stated explicitly, sorry) is that architecture alternative selection should be done at the granularity of modules (not arbitrary pieces of code). I agree. I just don't think that all modules have to be the same. In particular, I think that some modules *ought* to be private to other modules. I am not trying to adapt the include mechanisms as you do (by introducing the concepts of "parent" and "child" modules), but rather to remove that concept entirely, But a parent/child relationship is one of the things I am trying to ADD, not take away. I repeat, there are people who *WANT* hierarchical structure within modules, and, if not taken to excess, I do not regard that as unreasonable. (The ersatz Java dotted module names, which I DO regard as unreasonable, are an attempt to provide some kind of hierarchical structure above the level of modules; I think replaceable children can satisfy that need in a much better way.) > But this now GREATLY complicates the implementation. It can very easily be implemented by program transformation at compile time. No need to change the runtime. I completely fail to see how this can possibly be done at compile time. Consider the following: -import(foo, [...]). f(M) -> M:g(42). If M happens to be 'foo' at run time, then the call to M:g/1 should be mapped to M':g/1, where M' is whatever foo is mapped to. But that mapping is private to this module, not global. And if M happens to be 'goo' at run time, then the call to M:g/1 should *not* be mapped to M':g/1. What's even worse here is when the caller passes in 'foo' *intending to refer to whatever 'foo' refers to IN THE CALLER*. I think the single major difference between you and me here is that you think module name indirection can be done easily at compile time without any runtime changes, and I don't. Replacing a "logical" module name in module:call() statements in the scope in a module, by an actual module name, can be done at compile time very easily. I don't believe this, and will take some persuading. > You are offering something as a feature that I regarded as a > serious problem to be avoided. I don't see where there is a serious problem. That's because you think it is a trivial compile-time problem and Id on't. > (1) I am trying to remove *FILE* names from the source > files. I don't see where you say anything about file names. Since module names are also file names, dealing with logical module names instead of real module names removes file names from the source files. No, module names are NOT file names. What's more, they shouldn't be. Amongst other things, we have the problem that foobar and fooBar are *different* Erlang atoms and therefore *different* as module names, but under Windows foobar.beam and fooBar.beam are the *same* file name. Since the criteria for establishing identity are different, module names CANNOT be file names. As I understand it, the main use of -ifdef, etc. is to select alternative architectures. Using an ADL, you would simply have to write several specs. Yes, but that could mean repeating hundreds of lines. I'm thinking in terms of something like C/MESA. *Dependencies* (what is required) must be stated in a module's source code, since they are very interdependent on the module's implementation (you cannot change one without changing the other). On the other hand, *bindings* should be stated outside, because the architecture (the configuration) is a concern separated from the modules implementation. Complete agreement. Modules and their bindings form a "flat" graph: they do not necessarily form a tree, or "hierarchy". Nobody said they do so *necessarily*. But we DO as an empirical fact have a hierarchical structure of systems, applications, and modules, plus hierarchical structure within modules that is not syntactically marked. > I am trying > to design a principled replacement for -include AND I am > trying to meet a frequently expressed "need" for some kind of > hierarchical name scope WITHIN a single module. And this contradicts my basic principle (which I state in the beginning of this email, sorry I should have stated this before): configuration alternatives ("what can be required") should be specified as functions in modules. This contradiction does not exist. The 'frequently expressed "need" for some kind of hierarchical name scope WITHIN a single module' has *NOTHING WHATEVER TO DO WITH* configuration alternatives. I believe that one mechanism can help with both needs, but they are none-the-less separate and distinct needs. We already have functions, and modules, and they can be used as units for selecting configuration alternatives. We don't need to introduce new concepts ("parent" and "child" modules) only for that purpose. But nowhere have I stated, nor is it even close to true, that the concepts ARE new or are ONLY for that purpose. I agree very much with you. And my proposal does not replace all uses of -include / -ifdef, but it solves at least the important problem of selecting alternative implementations. I also agree with you, in that my proposal does not replace -record. Your proposal, as stated, DOES NOT HANDLE RECORDS. There are therefore ALMOST NO uses of -include in the present system which could thus be replaced. I think that it is a bad idea to try to specify a single construct that would replace all actual usages of -include and -ifdef: either the new construct will be as bad as what it replaces, or it will not cover all usages. This seems to me to be a matter of personal taste; I see no reason why the claim should be true. Maybe you have arguments against that, but please write them. ;-) No, "extraordinary claims need extraordinary evidence". YOU are the one saying that one good mechanism can't be enough, so it's you who have the obligation to provide the evidence. I agree. But let's solve one problem at a time?! I am sorry, but -record is the MAJOR problem. If you want to solve one problem at a time, you have to solve -record FIRST. I have already tackled that in two different ways: "abstract patterns" and "frames" alias Joe Armstrong's "proper structs". Neither of those has (yet) been adopted or is likely to be in the near future. To move forward, we need to move forward with what we have, and that means -record. Why not have a specific construct or convention to get record information at a module level (not at a source code level, like -record). The Erlang/OTP support people have already made it plain that they will not tolerate any replacement for -record that *requires* cross-module inlining. Trying to develop a solution that you know has no chance of being adopted is simply an idle pastime like painting flowers on toilet paper just before you use it. Something that provides a kind of encapsulation, requires minimal changes to the run-time system, and *still* allows the use of -record with no cross-(full)-module inlining has *some* non-zero chance of being useful. From rlenglet@REDACTED Mon Apr 3 08:35:07 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 3 Apr 2006 15:35:07 +0900 Subject: Child modules draft feedback wanted In-Reply-To: <200604030434.k334YcoK518178@atlas.otago.ac.nz> References: <200604030434.k334YcoK518178@atlas.otago.ac.nz> Message-ID: <200604031535.07535.rlenglet@users.forge.objectweb.org> Richard A. O'Keefe wrote: [...] > I also want to repeat that for Prolog and Erlang I have > several times (and in the case of Prolog, several times in the > last week) heard a "user" demand for some kind of hierarchical > structure within a module. "Child modules" were inspired by > Ada, although they don't have much in common with Ada 95 child > modules. And why is there a demand? What problem do they solve that cannot be solved otherwise and more or less simply? [...] > But a parent/child relationship is one of the things I am > trying to ADD, not take away. I repeat, there are people who > *WANT* hierarchical structure within modules, and, if not > taken to excess, I do not regard that as unreasonable. (The > ersatz Java dotted module names, which I DO regard as > unreasonable, are an attempt to provide some kind of > hierarchical structure above the level of modules; I think > replaceable children can satisfy that need in a much better > way.) Java packages are only namespaces. No more. There are not even hierarchical relationships between packages. > > But this now GREATLY complicates the implementation. > > It can very easily be implemented by program transformation > at compile time. No need to change the runtime. > > I completely fail to see how this can possibly be done at > compile time. > > Consider the following: > > -import(foo, [...]). > > f(M) -> M:g(42). > > If M happens to be 'foo' at run time, then the call to M:g/1 > should be mapped to M':g/1, where M' is whatever foo is mapped > to. But that mapping is private to this module, not global. > And if M happens to be 'goo' at run time, then the call to > M:g/1 should *not* be mapped to M':g/1. I was considering a solution based on external calls only, not on implicit applies. foo:g(42) is an external call, while M:g(42) is an implicit apply. The distinction is very clear in Erlang. For instance, cf. section 4.2 of the Efficiency Guide. And both are compiled in a very different way in beam code. So both kinds of statements can be manipulated differently by the compiler, and if only the module name in some external calls need to be replaced by a compiler, this is possible and easy. What I proposed is external calls with "virtual" module names that can be replaced at compile time (or load time, or whenever after coding). Just take a look at lib/compiler/src/genop.tab in the OTP sources for the list of beam opcodes: - local calls are compiled into call/2 ops; - external calls are compiled into call_ext/2 ops; - implicit apply calls are compiled into normal calls to apply. Try to decompile that module, and you will see: -module(test). -export([start/0,start/1]). start() -> test:start(). start(Test) -> Test:start(). $ erlc test.erl $ erl 1> beam_disasm:file("test.beam"). In the output, you should remark that part: ... {code,[{function,start, 0, undefined, [{label,1}, {func_info,{atom,test}, {atom,start},0}, {label,2}, {call_ext_only,0, {extfunc,test,start,0}}]}, {function,start, 1, undefined, [{label,3}, {func_info,{atom,test}, {atom,start},1}, {label,4}, {allocate,0,1}, {move,{atom,start},{x,1}}, {apply_last,0,0}]}, ... test:start() is compiled into a "call_ext_only", while Test:start() is compiled as a call to apply. So yes, I claim it once again: replacing the module name in external calls is easy at compile time. We need only to transform the parameters of the call_ext ops. Out of context, just for the fun, I would like to paraphrase your own document: With the -require construct I propose a solution in which - There are modules, just like we had before, and only modules. - File names never appear in source files, only module names. - A separate configuration language says how to map logical module names in the scope of client modules, and actual module names. - File names never appear in configuration files, only module names. - By having more than one configuration file, you can have several different configurations for a set of modules. - The interface between a module and another module is already explicit (it is the list of functions exported by every module). ;-) [...] > As I understand it, the main use of -ifdef, etc. is to select > alternative architectures. Using an ADL, you would simply > have to write several specs. > > Yes, but that could mean repeating hundreds of lines. > I'm thinking in terms of something like C/MESA. Hundreds of lines??? [...] > > I am trying > > to design a principled replacement for -include AND I am > > trying to meet a frequently expressed "need" for some kind > > of hierarchical name scope WITHIN a single module. > > And this contradicts my basic principle (which I state in the > beginning of this email, sorry I should have stated this > before): configuration alternatives ("what can be required") > should be specified as functions in modules. > > This contradiction does not exist. The 'frequently expressed > "need" for some kind of hierarchical name scope WITHIN a > single module' has *NOTHING WHATEVER TO DO WITH* configuration > alternatives. I believe that one mechanism can help with both > needs, but they are none-the-less separate and distinct needs. Please explain what problems do such hierchical namespaces solve? I thought from your document that you wanted to get rid of the preprocessr. Probably I was wrong, and you have other, additional motives. But I don't see them. [...] > I think that it is a bad idea to try to specify a single > construct that would replace all actual usages of -include > and -ifdef: either the new construct will be as bad as what it > replaces, or it will not cover all usages. > > This seems to me to be a matter of personal taste; I see no > reason why the claim should be true. OK, it is mainly a matter of personal taste. [...] > I agree. But let's solve one problem at a time?! > > I am sorry, but -record is the MAJOR problem. If you want to > solve one problem at a time, you have to solve -record FIRST. > I have already tackled that in two different ways: "abstract > patterns" and "frames" alias Joe Armstrong's "proper structs". > Neither of those has (yet) been adopted or is likely to be in > the near future. To move forward, we need to move forward with > what we have, and that means -record. > > Why not have a specific construct or convention to get record > information at a module level (not at a source code level, > like -record). > > The Erlang/OTP support people have already made it plain that > they will not tolerate any replacement for -record that > *requires* cross-module inlining. Can you please point me to such a discussion on the Erlang mailing-list or elsewhere? And who has talked about cross-module inlining in this discussion?! Let's consider the semantics of the proposed new -import_records construct (thanks for that name, Ulf, although I thought it would be nice to be able to be able to import a list of several record defs at a time, just like import, hence the final "s"): -module(mod1). -record(record1, {field1, field2}. ... -module(mod2). -import_records(mod1, [record1]). ... Would be strictly equivalent (and can be easily transformed into): -module(mod1). -record(record1, {field1, field2}). % Generated automatically by the compiler: -export([record_info/2]). record_info(fields, record1) -> [field1, field2]; record_info(size, record1) -> 2. ... -module(mod2). % This -record is generated from the result of calls to % mod1:record_info/2 by the compiler: -record(record1, {field1, field2}. % Since importing a record def is just like declaring % it locally, it would be exported from that module also: -export([record_info/2]). record_info(fields, record1) -> [field1, field2]; record_info(size, record1) -> 2. ... Please point me where you see inlining in that. > Trying to develop a solution that you know has no chance of > being adopted is simply an idle pastime like painting flowers > on toilet paper just before you use it. You should have become a poet! > Something that provides a kind of encapsulation, requires > minimal changes to the run-time system, and *still* allows the > use of -record with no cross-(full)-module inlining has *some* > non-zero chance of being useful. -- Romain LENGLET From rlenglet@REDACTED Mon Apr 3 09:20:22 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 3 Apr 2006 16:20:22 +0900 Subject: Child modules draft feedback wanted In-Reply-To: <200604031535.07535.rlenglet@users.forge.objectweb.org> References: <200604030434.k334YcoK518178@atlas.otago.ac.nz> <200604031535.07535.rlenglet@users.forge.objectweb.org> Message-ID: <200604031620.22951.rlenglet@users.forge.objectweb.org> > I was considering a solution based on external calls only, not > on implicit applies. foo:g(42) is an external call, while > M:g(42) is an implicit apply. More generally, I was considering the transformation of every statement where a module name is specified statically as an atom in a module's beam op. External calls fit into that category, but external calls don't. Probably more constructs should be transformed, for convenience, and not only external calls. For instance, -import_records statements. And a new pseudo-BIF could be generated by the compiler: required_module_name(Atom) -> Atom To do the translation at runtime. The parameter to that function must be a statically determinable atom (a "logical module name"), e.g. as in call: ReqlName = required_module_name(logical_name) -- Romain LENGLET From thomasl_erlang@REDACTED Mon Apr 3 10:37:05 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 3 Apr 2006 01:37:05 -0700 (PDT) Subject: Child modules draft feedback wanted In-Reply-To: <200604031620.22951.rlenglet@users.forge.objectweb.org> Message-ID: <20060403083705.90182.qmail@web38811.mail.mud.yahoo.com> --- Romain Lenglet wrote: > More generally, I was considering the transformation > of every > statement where a module name is specified > statically as an atom > in a module's beam op. External calls fit into that > category, > but external calls don't. ??? > And a new pseudo-BIF could be generated by the > compiler: > required_module_name(Atom) -> Atom > To do the translation at runtime. The parameter to > that function > must be a statically determinable atom (a "logical > module > name"), e.g. as in call: > ReqlName = required_module_name(logical_name) This, or a similar, transformation is also needed when one renames, merges, splits, etc. modules in a compiler. When an atom is resolved to a module, an extra lookup is performed to dispatch to the right code. The lookup can be done by the compiler in a regular erlang system. (See my paper for EUC 2001.) It is, as noted, basically a consequence of passing around atoms and then using them as module names. One option for Erlang-2 (because not backwards compatible) would be to instead have first-class modules: M = module lists which resolves M to the module named by 'lists'. Coupled with a more sophisticated notion of "module" and code change (and delving into the requirements and details some more), it might serve as the next stepping stone. (NB: Erlang "packages" lack dynamic translation of module names to modules, which is one reason why they aren't quite what's needed.) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From mikpe@REDACTED Mon Apr 3 11:02:07 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 3 Apr 2006 11:02:07 +0200 (MEST) Subject: hipe segmentation fault Message-ID: <200604030902.k33927qd020493@harpo.it.uu.se> On Sun, 02 Apr 2006 22:40:14 -0400, Serge Aleynikov wrote: >Any advice on what might be causing this seg fault? The same test works >fine on another machine with same OS & hardware. > >[serge@REDACTED:~/tmp]$ erl >Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] > >Eshell V5.4.13 (abort with ^G) >1> os:type(). >{unix,linux} >2> os:version(). >{2,6,9} >3> c(big, [native]). >{ok,big} >4> big:bang(600). >Segmentation fault >[serge@REDACTED:~/tmp]$ uname -a >Linux drp01dev.corp.idt.net 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST >2005 i686 i686 i386 GNU/Linux >[serge@REDACTED:~/tmp]$ cat /etc/redhat-release >Red Hat Enterprise Linux ES release 4 (Nahant) If the other machine has identical HW and SW, then I'd have to suspect the HW, like memory going bad, PSU too weak or giving up, or inadequate cooling. We could try to reproduce the error using your test case (if you can share it), but since you say it works on another identical machine, I'm not really suspecting a bug in HiPE at this point. /Mikael p.s. That 2.6.9-5.EL kernel is way out of date. From rlenglet@REDACTED Mon Apr 3 12:20:19 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 3 Apr 2006 19:20:19 +0900 Subject: Child modules draft feedback wanted In-Reply-To: <20060403083705.90182.qmail@web38811.mail.mud.yahoo.com> References: <20060403083705.90182.qmail@web38811.mail.mud.yahoo.com> Message-ID: <200604031920.19295.rlenglet@users.forge.objectweb.org> Thomas Lindgren wrote: > wrote: > > More generally, I was considering the transformation > > of every > > statement where a module name is specified > > statically as an atom > > in a module's beam op. External calls fit into that > > category, > > but external calls don't. > > ??? Sorry. Please read: External calls fit into that category, but implicit applies don't. > > And a new pseudo-BIF could be generated by the > > compiler: > > required_module_name(Atom) -> Atom > > To do the translation at runtime. The parameter to > > that function > > must be a statically determinable atom (a "logical > > module > > name"), e.g. as in call: > > ReqlName = required_module_name(logical_name) > > This, or a similar, transformation is also needed when > one renames, merges, splits, etc. modules in a > compiler. When an atom is resolved to a module, an > extra lookup is performed to dispatch to the right > code. The lookup can be done by the compiler in a > regular erlang system. (See my paper for EUC 2001.) This explains simply why external calls are so faster than implicit applies... > It is, as noted, basically a consequence of passing > around atoms and then using them as module names. One > option for Erlang-2 (because not backwards compatible) > would be to instead have first-class modules: > > M = module lists > > which resolves M to the module named by 'lists'. > Coupled with a more sophisticated notion of "module" > and code change (and delving into the requirements and > details some more), it might serve as the next > stepping stone. Actually, using program transformation, it would be possible to make current beam files compatible with this future "beam-ng", by inserting beam ops that are calls to such explicit translation functions (or are just new special conversion ops?), just before any beam ops that require modules instead of atoms. -- Romain LENGLET From serge@REDACTED Mon Apr 3 16:30:15 2006 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 03 Apr 2006 10:30:15 -0400 Subject: hipe segmentation fault In-Reply-To: <17456.48857.889561.638440@antilipe.corelatus.se> References: <44308B0E.1090505@hq.idt.net> <17456.48857.889561.638440@antilipe.corelatus.se> Message-ID: <44313177.8080706@hq.idt.net> Ops... Sorry, this test case was taken from Rickard Green's post on profiling P11B smp scheduling support. I wanted to run it on multi-cpu host, and installed R10B-10 and P11B releases with and without hipe. I don't think this problem is related to some memory corruption. This is what I tried to do in order to diagnose the problem: I recompiled erts with gcc's "-g -O0" options, and then: $ ulimit -c unlimited $ erl -emu_args Executing: /usr/local/lib/erlang/erts-5.4.13/bin/beam /usr/local/lib/erlang/erts-5.4.13/bin/beam -- -root /usr/local/lib/erlang -progname erl -- -home /home/serge Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] Eshell V5.4.13 (abort with ^G) 1> c(big, [native]). {ok,big} 2> big:bang(4). Segmentation fault (core dumped) $ gdb /usr/local/lib/erlang/erts-5.4.13/bin/beam core.18921 GNU gdb Red Hat Linux (6.1post-1.20040607.62rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1". Core was generated by `/usr/local/lib/erlang/erts-5.4.13/bin/beam -- -root /usr/local/lib/erlang -prog'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/tls/libm.so.6...done. Loaded symbols for /lib/tls/libm.so.6 Reading symbols from /usr/lib/libncurses.so.5...done. Loaded symbols for /usr/lib/libncurses.so.5 Reading symbols from /lib/tls/libpthread.so.0...done. Loaded symbols for /lib/tls/libpthread.so.0 Reading symbols from /lib/tls/librt.so.1...done. Loaded symbols for /lib/tls/librt.so.1 Reading symbols from /lib/tls/libc.so.6...done. Loaded symbols for /lib/tls/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 #0 0x08aae41c in ?? () (gdb) bt #0 0x08aae41c in ?? () #1 0x080f0f63 in x86_call_to_native () at hipe/hipe_x86_glue.S:42 #2 0x00000000 in ?? () (gdb) ... Looking at hipe_x86_glue.S:42: x86_call_to_native: ENTER_FROM_C /* get argument registers */ LOAD_ARG_REGS /* call the target */ NSP_CALL(*P_NCALLEE(P)) <-- Failing here I'm not sure what this call does, but maybe Mikael can give a clue. Regards, Serge Matthias Lang wrote: > Serge Aleynikov writes: > > Any advice on what might be causing this seg fault? > > Did you forget to attach 'big.erl', or did you deliberately leave it > out? (that would at least give you some feedback on whether it happens > on other people's setups too) > > Matthias > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: big.erl URL: From kaslist@REDACTED Mon Apr 3 16:45:51 2006 From: kaslist@REDACTED (kaslist) Date: Mon, 03 Apr 2006 16:45:51 +0200 Subject: Mnesia fundamentals Message-ID: <4431351F.6040908@gmail.com> Hi, I think this is a just a quick question for someone who knows.... I've been trying to get to grips with using Mnesia and, with a simple: one table one record setup, I've managed to work through most of the functions very happily. I thought I was really getting somewhere until a couple of days ago when... I tried to fill two tables defined with the same record type. Specifically, the tutorial that I based my studies on used: -record(employee, {emp_no, name, salary, sex, phone, room_no}). mnesia:create_table(employee, [{attributes, record_info(fields, employee)}]), Emp = #employee{emp_no= 843838, name = klacke, salary = 3, sex = male, phone = 98111, room_no ={221, 051}}, ...and to insert the data within a transaction: mnesia:write(employee, Emp, write) All well and good. However, when I restart the program with the addition a second table: mnesia:create_table(employee2, [{attributes, record_info(fields, employee)}]), and attempted to insert the data within a transaction thus: mnesia:write(employee2, Emp, write) ...everything compiles happily, runs happily... but employee2 table is not filled and yet no errors/exceptions are found. I have gone over and over the tutorials and the dozen or so Mnesia references/blogs on the net looking for examples of this issue but to no avail. Must there be a relationship between the record and table names??? Can anyone help me out of this newbie ditch I've got myself into? Thanks, Kyle. From matthias@REDACTED Mon Apr 3 17:08:34 2006 From: matthias@REDACTED (Matthias Lang) Date: Mon, 3 Apr 2006 17:08:34 +0200 Subject: hipe segmentation fault In-Reply-To: <44313177.8080706@hq.idt.net> References: <44308B0E.1090505@hq.idt.net> <17456.48857.889561.638440@antilipe.corelatus.se> <44313177.8080706@hq.idt.net> Message-ID: <17457.14962.835302.458333@antilipe.corelatus.se> Serge Aleynikov writes: > Ops... Sorry, this test case was taken from Rickard Green's post Oh, ok. I assumed 'big' was something you'd written. Anyway, I ran it on two machines here without problems and saw nothing special: Linux antilipe 2.6.12.1 #3 Wed Jan 11 16:25:06 CET 2006 i686 GNU/Linux tmp >erl Erlang (BEAM) emulator version 5.4.13 [source] [hipe] Eshell V5.4.13 (abort with ^G) 1> c(big, [native]). {ok,big} 2> big:bang(4). 2.30000e-5 and Linux cors 2.4.27 #5 Tue Feb 15 15:15:03 CET 2005 i686 GNU/Linux matthias@REDACTED:/tmp$ erl Erlang (BEAM) emulator version 5.4.13 [source] [hipe] Eshell V5.4.13 (abort with ^G) 1> c(big, [native]). {ok,big} 2> big:bang(4). 2.80000e-5 both emulators are vanilla compiles, i.e. no tweaking. Both machines run debian linux. Both machines have 32 bit AMD x86 CPUs. Matthias From pupeno@REDACTED Mon Apr 3 18:25:06 2006 From: pupeno@REDACTED (Pupeno) Date: Mon, 3 Apr 2006 18:25:06 +0200 Subject: Erlang repository for (K)Ubuntu Breezy Message-ID: <200604031825.10419.pupeno@pupeno.com> http://pupeno.com/blog/erlang-repository-for-k-ubuntu-breezy Recently I created a repository for Erlang and ejabberd (a Jabber server written in Erlang) for Debian Sarge because I needed it on one of my servers (which runs that operating system). Since then I promised a (K)Ubuntu counter-part, here it is. To use it, just add to /etc/apt/sources.list of your favourite Ubuntu flavor the following lines: deb http://packages.pupeno.com/ breezy erlang deb-src http://packages.pupeno.com/ breezy erlang and that's it; you can run apt-get install erlang and get the lattest version of Erlang. Remeber to run apt-get update before. I am also uploading erlang-manpages and erlang-doc-html, you'll get them soon. Please, try the repository, I am on a slow dial-up link and uplading it tooked me days, I am not going to install from it. Some notes regarding the Erlang packages. It is the last version, I upgraded it myself to R10B-10. I don't know why when installing the Emacs extension you'll get some warnings, they don't seem dangerous and everything works anyway. In most common (K)Ubuntu installations you won't mind this, but the Erlang package depends on Tk which depends on part of the X Windows System. I know this is not right for servers and I'll work out a solution (that is separating the parts that require Tk in an optional package). Once that is working, I'll backport this packages to the Debian Sarge repository; please, be patient (or pay ;). Thank you. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From d.andreasi@REDACTED Mon Apr 3 18:29:35 2006 From: d.andreasi@REDACTED (Daniele Andreasi) Date: Mon, 03 Apr 2006 18:29:35 +0200 Subject: where is snmp_mgr in otp_src_R10B-9? Message-ID: <44314D6F.4000509@nesit.it> Hi, I'm using erlang snmp and i'd like to test my agent development with snmp_mgr, but i don't find that module in erlang src and library. Moreover I find in the directory ex1 in the snmp library an example where the module snmp_mgr it's started by the module snmp_mgr_tests... How it's possible? Thanks Daniele From kaslist@REDACTED Mon Apr 3 19:06:55 2006 From: kaslist@REDACTED (kaslist) Date: Mon, 03 Apr 2006 19:06:55 +0200 Subject: Mnesia fundamentals & hipe segmentation fault In-Reply-To: References: Message-ID: <4431562F.4040503@gmail.com> tty@REDACTED wrote: > mnesia:write looks at the record you are writting and find that its of type 'employee'. With this the record is then written into the 'employee' table even though you stated 'employee2' as part of the write. To place anything into table 'employee2' it must be a record of type 'employee2'. > > To get around this when creating 'employee2' add the '{record_name, Name}' to the option list. > > e.g. > > mnesia:create_table(employee2, [{attributes, record_info(fields, > employee)}, {record_name, employee}]). > > Regards > > t > > -------- Original Message -------- > From: kaslist > Apparently from: owner-erlang-questions@REDACTED > To: erlang-questions@REDACTED > Cc: kaslist@REDACTED > Subject: Mnesia fundamentals > Date: Mon, 03 Apr 2006 16:45:51 +0200 > > >> Hi, >> >> I think this is a just a quick question for someone who knows.... >> >> I've been trying to get to grips with using Mnesia and, with a simple: >> one table one record setup, I've managed to work through most of the >> functions very happily. I thought I was really getting somewhere until >> a couple of days ago when... I tried to fill two tables defined with the >> same record type. >> >> Specifically, the tutorial that I based my studies on used: >> >> -record(employee, {emp_no, name, salary, sex, phone, room_no}). >> mnesia:create_table(employee, [{attributes, record_info(fields, >> employee)}]), >> Emp = #employee{emp_no= 843838, name = klacke, salary = 3, sex = male, >> phone = 98111, room_no ={221, 051}}, >> >> ...and to insert the data within a transaction: >> >> mnesia:write(employee, Emp, write) >> >> All well and good. However, when I restart the program with the >> addition a second table: >> >> mnesia:create_table(employee2, [{attributes, record_info(fields, >> employee)}]), >> >> and attempted to insert the data within a transaction thus: >> >> mnesia:write(employee2, Emp, write) >> >> ...everything compiles happily, runs happily... but employee2 table is >> not filled and yet no errors/exceptions are found. >> >> I have gone over and over the tutorials and the dozen or so Mnesia >> references/blogs on the net looking for examples of this issue but to no >> avail. Must there be a relationship between the record and table >> names??? Can anyone help me out of this newbie ditch I've got myself into? >> >> Thanks, >> >> Kyle. >> > > Yes that solves it... both tables populate correctly now. Thanks very much 't'. Kyle. P.S. Re the 'hipe segmentation fault' thread.... If it's any use to anyone... these are the results for big.erl on my Win laptop: Eshell V5.4.13 (abort with ^G) 1> big:bang(1). 1.00000e-6 2> big:bang(10). 1.00000e-6 3> big:bang(100). 4.00000e-2 4> big:bang(1000). 48.1600 Also, the rapid increase in processing work/time follows approx the same gradient on my Linux box, when I tried that. From orbitz@REDACTED Mon Apr 3 21:01:22 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Mon, 3 Apr 2006 15:01:22 -0400 Subject: Mnesia fundamentals In-Reply-To: <4431351F.6040908@gmail.com> References: <4431351F.6040908@gmail.com> Message-ID: You're doing this in a transaction I hope? On Apr 3, 2006, at 10:45 AM, kaslist wrote: > Hi, > > I think this is a just a quick question for someone who knows.... > I've been trying to get to grips with using Mnesia and, with a > simple: one table one record setup, I've managed to work through > most of the functions very happily. I thought I was really getting > somewhere until a couple of days ago when... I tried to fill two > tables defined with the same record type. > > Specifically, the tutorial that I based my studies on used: > > -record(employee, {emp_no, name, salary, sex, phone, room_no}). > mnesia:create_table(employee, [{attributes, record_info(fields, > employee)}]), > Emp = #employee{emp_no= 843838, name = klacke, salary = 3, sex = > male, phone = 98111, room_no ={221, 051}}, > > ...and to insert the data within a transaction: > > mnesia:write(employee, Emp, write) > > All well and good. However, when I restart the program with the > addition a second table: > > mnesia:create_table(employee2, [{attributes, record_info(fields, > employee)}]), > > and attempted to insert the data within a transaction thus: > > mnesia:write(employee2, Emp, write) > > ...everything compiles happily, runs happily... but employee2 table > is not filled and yet no errors/exceptions are found. > I have gone over and over the tutorials and the dozen or so Mnesia > references/blogs on the net looking for examples of this issue but > to no avail. Must there be a relationship between the record and > table names??? Can anyone help me out of this newbie ditch I've got > myself into? > > Thanks, > > Kyle. > > > From serge@REDACTED Mon Apr 3 21:57:17 2006 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 03 Apr 2006 15:57:17 -0400 Subject: hipe segmentation fault In-Reply-To: <17457.14962.835302.458333@antilipe.corelatus.se> References: <44308B0E.1090505@hq.idt.net> <17456.48857.889561.638440@antilipe.corelatus.se> <44313177.8080706@hq.idt.net> <17457.14962.835302.458333@antilipe.corelatus.se> Message-ID: <44317E1D.5060308@hq.idt.net> In my case the host has 2 CPUs (seen as 4 in hyper-threaded mode), which support 64-bit architecture, yet 32-bit Linux RedHat ES 4.0 is installed. I did remove, plain vanilla compile and reinstall Erlang, and still get the same core dump. I am second guessing my prior statement about this test running successfully on another host with the same hardware. Right now I don't have access to that machine, but will get a chance to verify that later on this week. $ cat /proc/cpuinfo | egrep "processor|model\ name" processor : 0 model name : Intel(R) Xeon(TM) CPU 3.60GHz processor : 1 model name : Intel(R) Xeon(TM) CPU 3.60GHz processor : 2 model name : Intel(R) Xeon(TM) CPU 3.60GHz processor : 3 model name : Intel(R) Xeon(TM) CPU 3.60GHz The box has 4G RAM. > cat /proc/meminfo MemTotal: 4149312 kB MemFree: 1815708 kB Buffers: 393516 kB Cached: 1660744 kB ... Serge Matthias Lang wrote: > Serge Aleynikov writes: > > Ops... Sorry, this test case was taken from Rickard Green's post > > Oh, ok. I assumed 'big' was something you'd written. Anyway, I ran it > on two machines here without problems and saw nothing special: > > Linux antilipe 2.6.12.1 #3 Wed Jan 11 16:25:06 CET 2006 i686 GNU/Linux > tmp >erl > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] > > Eshell V5.4.13 (abort with ^G) > 1> c(big, [native]). > {ok,big} > 2> big:bang(4). > 2.30000e-5 > > and > > Linux cors 2.4.27 #5 Tue Feb 15 15:15:03 CET 2005 i686 GNU/Linux > matthias@REDACTED:/tmp$ erl > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] > > Eshell V5.4.13 (abort with ^G) > 1> c(big, [native]). > {ok,big} > 2> big:bang(4). > 2.80000e-5 > > both emulators are vanilla compiles, i.e. no tweaking. Both machines > run debian linux. Both machines have 32 bit AMD x86 CPUs. > > Matthias -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From ok@REDACTED Tue Apr 4 08:12:19 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 4 Apr 2006 18:12:19 +1200 (NZST) Subject: Child modules draft feedback wanted Message-ID: <200604040612.k346CJrI519037@atlas.otago.ac.nz> I wrote: > I also want to repeat that for Prolog and Erlang I have > several times (and in the case of Prolog, several times in the > last week) heard a "user" demand for some kind of hierarchical > structure within a module. "Child modules" were inspired by > Ada, although they don't have much in common with Ada 95 child > modules. Romain Lenglet replied: And why is there a demand? What problem do they solve that cannot be solved otherwise and more or less simply? Obviously, there is no such problem. We can do everything "more or less simply" by using Turing machines, possibly extended with "!" and "receive". Practically, there is a problem. Modules have to do at least two different things. They are the units of hot loading. They are the units of encapsulation. I'm sure I remember someone talking about using different mechanisms for different jobs. I'm proposing "full" modules as units of hot loading, and "child" modules as units of encapsulation. To see that there is a problem, I made some size measurements on Erlang R9C. (The R11 release I downloaded turned out to be corrupted, so I couldn't measure that, and while I _am_ downloading R10 to do my measurements on, it's taking long enough that I decided not to wait.) > summary(s) Min. 1st Qu. Median Mean 3rd Qu. Max. 2.0 44.5 127.0 291.4 314.0 22508.0 That is, there is at least one module with 2 SLOC, 1/4 of the modules have 44 or fewer SLOC, 1/2 of the modules have 127 or fewer SLOC, 3/4 of the modules have 314 or fewer SLOC, but there is at least one module with 22,508 SLOC. The distribution of SLOC sizes shows two peaks, one around 8 SLOC (yes, that small) and one around 192 SLOC. But there are quite a few big ones. Unsurprisingly, the very largest files are parsers generated by Yecc. (The very biggest is the Megaco parser.) So we had better remove those from discussion. > summary(s) Min. 1st Qu. Median Mean 3rd Qu. Max. 2.0 45.0 126.0 263.3 309.0 5927.0 > summary(log10(s)) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.301 1.653 2.100 2.043 2.490 3.773 The median size is somewhere about 125 SLOC, and files that size probably don't need named parts, let alone replaceable named parts. More than 5% of the files are over 1000 SLOC, however, and it defies belief that there is no significant structure in a file that size. In fact, I'd say that a file with 500 SLOC (and remember, that's SLOC, not raw lines) probably has significant structure, and about 15% of the modules are that size or more. (And several of the smaller files I've looked at would benefit from explicit structure.) While >500SLOC modules are 15% of modules, they contain more than 55% of the SLOC. So I can say that more than half of the Erlang code in R9C is in modules that, in my view, would be easier to read with some explicit structure. Of course we can manage without that; we have. But there is a big difference between looking at a function and KNOWING that it is only used in a small part of a large module and having to CHECK the whole module to find out. Being able to split a large module into pieces for editing also means that we can extend version control below the module level. If someone wants to edit the sorting routines in lists.erl, why should they have to check out the mapping and filtering functions at the same time? Then we can go the other way. There are things which are currently expressed as collections of modules, where there isn't the slightest intention that some of the modules should ever be used anywhere else, where indeed things could go badly wrong if some of the "private" modules were used by unrelated code. There is no way of marking modules as "private", although the -export_to(Module, [F1/N1, ..., Fk/Nk]). directive that I proposed many years ago would make this kind of thing a lot safer and a lot easier to grasp the structure of than it presently is. Having *one* full module providing the "public" interface and making the other modules replaceable out-of-line children provides all of the benefits of the present setup, with fewer risks, and making them in-line children would remove the remaining risks. Here the absence of structure within modules has forced people to expose interfaces that should not have been exposed. In summary, hierarchy within a module provides - explicit structure and - CHECKED explicit encapsulation which are not needed for the majority of *modules*, but which would be useful for reading the majority of *lines*. This would help people write code that was easier to read. > But a parent/child relationship is one of the things I am > trying to ADD, not take away. I repeat, there are people who > *WANT* hierarchical structure within modules, and, if not > taken to excess, I do not regard that as unreasonable. (The > ersatz Java dotted module names, which I DO regard as > unreasonable, are an attempt to provide some kind of > hierarchical structure above the level of modules; I think > replaceable children can satisfy that need in a much better > way.) Java packages are only namespaces. No more. There are not even hierarchical relationships between packages. You mistook me completely. I was not talking about Java packages, but about the "ersatz Java[-like] dotted module names" FOR ERLANG. Of *course* there is a hierarchical relationship between such names. It's not a relationship present in anything *other* than the names, which is why it's "unreasonable". Nevertheless, the whole point of trying to introduce such names into Erlang was to provide applications with their own namespaces for modules, which is a form of hierarchy. > I completely fail to see how [the renaming trick] can possibly > be done at compile time. I was considering a solution based on external calls only, not on implicit applies. Right. You were considering, in short, a "solution" which doesn't work, and now you are talking about patching it into working. foo:g(42) is an external call, while M:g(42) is an implicit apply. The distinction is very clear in Erlang. Untrue. There is NO distinction between the semantics of foo:g(42) and the semantics of M = foo, M:g(42) in Erlang (other than the existence of the variable M). For instance, cf. section 4.2 of the Efficiency Guide. Er, which version? In the current (5.4.13) version, section 4.2 is "Ets specific". Can you mean section 3.2? But that is a fact about the current implementation, and the performance of so-called "implicit apply" could be GREATLY improved. Heck, it should be trivial. In fact, it's so trivial I am astonished that it's not already done. Here's what you do. 1. Each module has some number of functions '0'(a) -> a(); ... one rule for each a/0 that is exported '0'(F) -> erlang:no_such_function(?MODULE, F, []). ... '8'(X1, ..., X8, a) -> a(X1, ..., X8); ... one rule for each a/8 that is exported '8'(X1, ..., X8, F) -> erlang:no_such_function(?MODULE, F, [X1,...,X8]). up to whatever size the implementors deem appropriate. These rules are built at compile time. 2. The system has a set of functions, which I'll put in 'erlang:'. '0'(F, mod1) -> mod1:'0'(F); one rule for each module '0'(F, M) -> erlang:no_such_module(M, F, []). ... '8'(X1, ..., X8, F, mod1) -> mod1:'8'(X1, ..., X8, F); one rule for each module '8'(X1, ..., X8, F, M) -> erlang:no_such_module(M, F, [X1,...,X8]). These rules are built at run time, but that's old technology. The new rules are added at the front of the existing code, and it's basically just a matter of adding an entry to a hash table. 3. A call M:f(X1,...,Xk) where k <= 8 is compiled as erlang:'k'(X1, ..., Xk, f, M) and a call apply(M, F, [X1,...,Xk]) where k <= 8 is known at compile time or the equivalent M:F(X1, ..., Xk) is compiled as erlang:'k'(X1, ..., Xk, F, M). For example, M:foo(42) should be compiled as erlang:'1'(42, foo, M). If an 'external call' costs 1.08 units relative to a 'local call', then an 'implicit apply' with not too many arguments should just cost two of these (one call to erlang:'k'/k+2 and one call to M:'k'/k+1), or 2.16 units. It really has no business being 7.76 units; that's much slower than it should be. The space cost for the extra hidden rules (and I am NOT seriously suggesting '0' to '8' as names for them) is linear in the size of the program; there are exactly 2(kmax + 1) clauses for each module. There are other ways to manage this, including at least one fairly obvious way that should get the cost down even further, but this is the easiest scheme to explain that I've come up with yet. This kind of thing gets an order of magnitude harder if module names are not, as they are now, context-independent. And both are compiled in a very different way in beam code. That is a fact about the present implementation which should clearly change. It is not a fact about the semantics of the language. So both kinds of statements can be manipulated differently by the compiler, The compiler is at liberty to manipulate things differently any way it likes, AS LONG AS IT PRESERVES THE SEMANTICS. The semantics of m:f(X1) and M:f(X1) do NOT different in any way that entitles a compiler to give them translations with incompatible effects. and if only the module name in some external calls need to be replaced by a compiler, this is possible and easy. That would CHANGE THE SEMANTICS of existing code, which my proposal does not do. Making m:f(X) and (M=m, m:f(X)) do different things would be downright evil. Just take a look at lib/compiler/src/genop.tab in the OTP sources for the list of beam opcodes: - local calls are compiled into call/2 ops; - external calls are compiled into call_ext/2 ops; - implicit apply calls are compiled into normal calls to apply. They shouldn't be. As noted above, it is possible to do MUCH better. (Actually, section 3.2 of the Efficiency Guide says that "The compiler will now optimise this [implicit apply] syntax giving it better performance than apply/3], which cannot be true if implicit applies are just "compiled into normal calls to apply". Something is wrong here. HOW it is done is not in fact relevant. The point is that whatever the compiler does (and it can make local calls work by sending e-mail if it wants to) it has to get the SEMANTICS right, which according to all the Erlang documentation (including the specification "books") I've ever seen means that "implicit apply" and apply and external call all have the SAME semantics. So yes, I claim it once again: replacing the module name in external calls is easy at compile time. We need only to transform the parameters of the call_ext ops. In short, you are proposing an IMCOMPATIBLE CHANGE to the semantics of the language, for no other reason than that it's easy. Silly me, I thought you had in mind an implementation which *only* made module names context-sensitive but otherwise preserved the semantics of the language. Well, if we don't have to preserve the semantics of the language, any change can be as easy as we want. With the -require construct I propose a solution in which - There are modules, just like we had before, and only modules. No, modules are no longer "just like we had before". You've CHANGED THE SEMANTICS of module names in two different ways. - File names never appear in source files, only module names. We both have that. - A separate configuration language says how to map logical module names in the scope of client modules, and actual module names. We both have that. - File names never appear in configuration files, only module names. That can't possibly work. File names have to appear SOMEWHERE. One of the reasons for having a configuration language is to cope with the vagaries of file systems. Module names are case sensitive. In several M$ajor file systems, file names are not. So mapping from module names to file names is not trivial. Module names do not contain directory information, but modules do not all live in the same directory. - By having more than one configuration file, you can have several different configurations for a set of modules. We both have that. - The interface between a module and another module is already explicit (it is the list of functions exported by every module). No, only HALF of the interface is there, and only HALF of the information you actually need in the interface. In general, you need to know not just "what do I offer to the whole world" but "what do I offer to which particular modules". Think about the way Eiffel lets you export features to specified classes. Think about the fact that in Erlang, when you use a behaviour, you export some functions *TO THE BEHAVIOUR*, which are never ever supposed to be called by anything *BUT* the behaviour, BUT YOU CAN'T SAY THAT. My -use_child directive has TWO function lists because every relationship has two sides, and because it is important to distinguish between "I am willing to offer this function to that child" and "this child currently needs that function from its parent". > As I understand it, the main use of -ifdef, etc. is to select > alternative architectures. Using an ADL, you would simply > have to write several specs. > > Yes, but that could mean repeating hundreds of lines. > I'm thinking in terms of something like C/MESA. Hundreds of lines??? Yes. I'm thinking of configuration files that cover *applications*, not single modules. Please explain what problems do such hierchical namespaces solve? I've done this above. > I think that it is a bad idea to try to specify a single > construct that would replace all actual usages of -include > and -ifdef: either the new construct will be as bad as what it > replaces, or it will not cover all usages. > > This seems to me to be a matter of personal taste; I see no > reason why the claim should be true. OK, it is mainly a matter of personal taste. There are two statements: (1) "It is a bad idea .. single construct ... -ifdef." (2) "Either the new construct will be as bad ... all usages." The first statement appears to express a matter of taste; you don't like the idea. The second statement is the grounds for the first. Maybe it is true. The second statement, however, is not a matter of personal taste. As I said, that one _could_ be true, and I would like to see some evidence for it. > The Erlang/OTP support people have already made it plain that > they will not tolerate any replacement for -record that > *requires* cross-module inlining. Can you please point me to such a discussion on the Erlang mailing-list or elsewhere? The thread about "when will abstract patterns be implemented" within the last month or possibly two. And who has talked about cross-module inlining in this discussion?! I have. For heaven's sake, it's half of what my proposal is ABOUT! Abstract patterns were rejected by the OTP implementors (in the thread mentioned above) on the grounds that they required cross-module inlining. (As the original paper made clear, they DON'T, but that's another matter.) The fact that the current Erlang system doesn't do cross-module inlining is one of the major reasons for the preprocessor. If you want to get rid of the preprocessor, you have to provide some means whereby constants &c can be compiled efficiently without requiring general cross-module inlining (which amongst other things messes up naive hot-loading). People who use records want them to be as efficient as any other kind of pattern matching, so that there is no performance penalty for writing readable code. Since there is no cross-module inlining, they don't WANT records to be imported from other modules. (If they were going to put up with that, they might as well use abstract patterns.) So there has to be something that shared record definitions can go in which is not a full module and so that record definitions CAN be fully presented to the compiler. The current answer is that the something in question is a .hrl file. My answer is that it's an integrated child module. -module(mod1). -record(record1, {field1, field2}. ... -module(mod2). -import_records(mod1, [record1]). ... Would be strictly equivalent (and can be easily transformed into): -module(mod1). -record(record1, {field1, field2}). % Generated automatically by the compiler: -export([record_info/2]). record_info(fields, record1) -> [field1, field2]; record_info(size, record1) -> 2. ... -module(mod2). % This -record is generated from the result of calls to % mod1:record_info/2 by the compiler: -record(record1, {field1, field2}. WHOOPS! You are doing cross-module inlining! You just made an incompatible change to the semantics of the language! (Haven't we seen that before?) You are *supposed* to be able to load a new version of mod1 WITHOUT recompiling mod2. Now you can't. % Since importing a record def is just like declaring % it locally, it would be exported from that module also: -export([record_info/2]). record_info(fields, record1) -> [field1, field2]; record_info(size, record1) -> 2. ... Please point me where you see inlining in that. Great balls of fire. Isn't it obvious? You are talking about the compiler processing mod2 WITH FULL KNOWLEDGE OF A DEFINITION IN mod1. That is precisely cross-module inlining. Now, I happen to believe that cross-module inlining is a good thing. (And I know it has been tried in an Erlang context.) I also believe that hot loading is a good thing. But I also know that this kind of thing has been done before. Robert Dewar's SPITBOL implementation of SNOBOL coped with a language (SNOBOL) which allowed new code to be created at run time (even creating new data types!) and could undo code generation which had made assumptions that were no longer true. That was in the 70s. There are some Smalltalk compilers which can do some inlining, and recompile when the original definitions change. That kind of thing was also done for Self. It requires excellent dependency tracking, and it's not at all easy. So I think that refusing to do cross-module inlining (yet) is a good engineering decision by the OTP team. By the way, anyone who has looked at my proposal recently should pretend they never saw the configuration language draft. It is MUCH too complicated. I have a whole new draft of that, but haven't had time today to type it up. For one thing, it never occurred to me that people were trying to use case sensitive module names, but they are. In my proposal, I am taking a very strong stand on semantics. NO CHANGE to the semantics of existing Erlang code. NONE. One consequence of that is that things which seem very easy on the assumption that you are allowed to make such changes may in fact be very hard. Another consequence is that the design one ends up with may not be as nice, in many ways, as the design one would have produced for a new language. I think many people trying to get real work done with Erlang would say "if you want me to put up with a change in the meaning of module names just so that you can get rid of the preprocessor, no thanks, I'll stick with the preprocessor". From vlad.xx.dumitrescu@REDACTED Tue Apr 4 09:26:17 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Tue, 4 Apr 2006 09:26:17 +0200 Subject: Child modules draft feedback wanted Message-ID: <11498CB7D3FCB54897058DE63BE3897C016FD7EE@esealmw105.eemea.ericsson.se> Hi! > -----Original Message----- > From: Richard A. O'Keefe > I'm proposing "full" modules as units of hot > loading, and "child" modules as units of encapsulation. >..... > Being able to split a large module into pieces for editing > also means that we can extend version control below the module level. > If someone wants to edit the sorting routines in lists.erl, > why should they have to check out the mapping and filtering > functions at the same time? Just to make sure I understand what you mean. Your child modules would be similar to traits[1] in OOP, right? I.e. A parametrized[*] set of methods. In OOP there is a similar dichotomy for classes that should be both generators of instances (with a lot of functionality) and units of reuse (small and self-contained). [*] Parametrization isn't part of your proposal, but I don't see as unthinkable to use the same mechanism as for 'abstract modules', should that feature be needed. BTW, does anyone use abstract modules? [1] See for example http://www.iam.unibe.ch/~scg/Archive/Papers/Scha03aTraits.pdf Quoting from the above, ------- Traits have the following properties. - A trait _provides_ a set of methods that implement behaviour. - A trait _requires_ a set of methods that serve as parameters for the provided behaviour. - Traits do not specify any state variables, and the methods provided by traits never access state variables directly. - Classes and traits can be composed from other traits, but the composition order is irrelevant. Conflicting methods must be explicitly resolved. - Trait composition does not affect the semantics of a class: the meaning of the class is the same as it would be if all of the methods obtained from the trait(s) were defined directly in the class. - Similarly, trait composition does not affect the semantics of a trait: a composite trait is equivalent to a flattened trait containing the same methods. ------- IMHO this looks almost the same as Richard's proposal. > There is no way of > marking modules as "private", although the > > -export_to(Module, [F1/N1, ..., Fk/Nk]). > > directive that I proposed many years ago would make this kind > of thing a lot safer and a lot easier to grasp the structure > of than it presently is. This and child modules/traits and the other related things look to me like they are part of a general module management functionality. Handling it with module attributes works and is relatively easy implemented, but feels similar to using records vs abstract patterns - a little too low-level. It might be useful to try to see if having modules as first-class citizens and another notation would make anything easier to understand, use and/or implement. Best regards, Vlad From bmk@REDACTED Tue Apr 4 10:37:10 2006 From: bmk@REDACTED (Micael Karlberg) Date: Tue, 04 Apr 2006 10:37:10 +0200 Subject: where is snmp_mgr in otp_src_R10B-9? In-Reply-To: <44314D6F.4000509@nesit.it> References: <44314D6F.4000509@nesit.it> Message-ID: <44323036.2000006@erix.ericsson.se> Hi, The snmp_mgr was primarily a test-tool, and was therefor moved to the test directory when version 4.0 was released, which included a "proper" manager component. The test directory will be included in next version of the SNMP application (included in R11B). The snmp_mgr_test module is clearly broken. Thanks for pointing that out! But, I would not base any tests on code found in the test directory. It can be rewritten or even removed from one version to another. Regards, /BMK Daniele Andreasi wrote: > Hi, > I'm using erlang snmp and i'd like to test my agent development with > snmp_mgr, but i don't find that module in erlang src and library. > Moreover I find in the directory ex1 in the snmp library an example > where the module snmp_mgr it's started by the module snmp_mgr_tests... > > How it's possible? > > Thanks > Daniele > > From heinrich@REDACTED Tue Apr 4 11:45:59 2006 From: heinrich@REDACTED (Heinrich Venter) Date: Tue, 4 Apr 2006 11:45:59 +0200 Subject: Xmerl 1.0.3 prolog issue Message-ID: Hi List I am using xmerl 1.0.3 to parse a large XML file into a new format that is useful for my application. The callback module I created works, but only if there is no prolog line in the XML file. I tried one of the supplied callback modules, but got the same error message. If I take out the prolog line, everything processes fine. I tried the same thing with some of the XML files in the documentation with the same results. Am I missing some parameter or configuration setting? >xmerl_eventp:file_sax("wurfl.xml", xmerl_xml,[],[]). =ERROR REPORT==== 4-Apr-2006::11:26:51 === Error in process <0.45.0> with exit value: {badarg,[{xmerl_scan,scan_prolog,3},{ xmerl_scan,scan_document,2},{xmerl_scan,file,2},{erl_eval,do_apply,5},{s hell,exp rs,6},{shell,eval_loop,3}]} ** exited: {badarg,[{xmerl_scan,scan_prolog,3}, {xmerl_scan,scan_document,2}, {xmerl_scan,file,2}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** The first few lines of the XML file is ... Thanks -]-[einrich From rlenglet@REDACTED Tue Apr 4 12:08:44 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Tue, 4 Apr 2006 19:08:44 +0900 Subject: Child modules draft feedback wanted In-Reply-To: <200604040612.k346CJrI519037@atlas.otago.ac.nz> References: <200604040612.k346CJrI519037@atlas.otago.ac.nz> Message-ID: <200604041908.44855.rlenglet@users.forge.objectweb.org> Sorry, in this discussion, emails get longer and longer... Richard A. O'Keefe wrote: [...] > Practically, there is a problem. Modules have to do at least > two different things. They are the units of hot loading. > They are the units of encapsulation. I'm sure I remember > someone talking about using different mechanisms for different > jobs. I'm proposing "full" modules as units of hot loading, > and "child" modules as units of encapsulation. [...] Ah! I agree with that new objective of separating both concerns. And you should state that objective explicitly in your draft document, too. Is there any motivation for defining a new smaller-than-module-level concept (child module) instead of a new larger-than-module-level concept that would aggregate functions exported by several modules, and be a facade to those modules? In the latter case, modules would still be units of hot loading, but units of encapsulation would be modules, and facades (or composite modules, ... or whatever). I am thinking out loud. A quick and dirty draft of what would be such a facade: -facade(example). -export_from_module(some_module, [func1/0, func2/12]). -export_from_module(another_mod, [func3/0]). Or it could be simply a normal module: -module(example). -export_from_module(some_module, [func1/0, func2/12]). -export_from_module(another_mod, [func3/0]). And such a facade could be used by modules just like any normal module: -module(client). start() -> example:func1(). Maybe a facade could allow to rename functions when re-exporting them. [...] > Of course we can manage without that; we have. But there is a > big difference between looking at a function and KNOWING that > it is only used in a small part of a large module and having > to CHECK the whole module to find out. > > Being able to split a large module into pieces for editing > also means that we can extend version control below the module > level. If someone wants to edit the sorting routines in > lists.erl, why should they have to check out the mapping and > filtering functions at the same time? I just don't understand why you assume that we must introduce a lower-scale-than-module concept to do that? Couldn't you just cut modules into other modules? > Then we can go the other way. > > There are things which are currently expressed as collections > of modules, where there isn't the slightest intention that > some of the modules should ever be used anywhere else, where > indeed things could go badly wrong if some of the "private" > modules were used by unrelated code. There is no way of > marking modules as "private", although the > > -export_to(Module, [F1/N1, ..., Fk/Nk]). > > directive that I proposed many years ago would make this kind > of thing a lot safer and a lot easier to grasp the structure > of than it presently is. Having *one* full module providing > the "public" interface and making the other modules > replaceable out-of-line children provides all of the benefits > of the present setup, with fewer risks, and making them > in-line children would remove the remaining risks. Here the > absence of structure within modules has forced people to > expose interfaces that should not have been exposed. I understand that you have two objectives: 1- encapsulation: make parts of modules implementations and interfaces private to modules; 2- structuring: introduce more structure in implementations. I think that your out-of-line child modules do not help for encapsulation: any module can declare use it as a child, even if that child module was meant to be "private" to a specific collection of modules. And as you wrote, "things could go badly wrong if some of the "private" modules were used by unrelated code": this applies also to out-of-line child modules. >From your documentation, "To_The_Child is like an -export directive". Just like -export, there is the risk of being forced to export "too private" features. In-line child modules, on the other hand, are really encapsulated, and not accessible from outside of the declaring module. But do they really help structuring modules? It does not help about splitting modules into several more easily editable pieces. You complained above about modules such as lists.erl: with in-line chlid modules it would be just as difficult to browse the code. More generally, we need something that would provide encapsulation like your "in-line" modules, but sharing like your "out-of-line" modules. How about my naive "facade" concept above? It would not really help about encapsulation: composed modules would still be accessible separately. But it would help structuring: a facade could gather be a subset of the exported functions of a module (hence the interface of modules such as lists.erl could be split into several facades / interfaces), or gather functions from several modules (hence, would provide a structure to a set of modules). A larger-than-module concept needs more thoughts, and introducing such naive facades may be too basic. For instance, we could gain from introducing composite modules, which would completely encapsulate modules. [...] > > I completely fail to see how [the renaming trick] can > > possibly be done at compile time. > > I was considering a solution based on external calls only, > not on implicit applies. > > Right. You were considering, in short, a "solution" which > doesn't work, and now you are talking about patching it into > working. No, I considered external calls only, from the start. > foo:g(42) is an external call, while M:g(42) > is an implicit apply. The distinction is very clear in > Erlang. > > Untrue. There is NO distinction between the semantics of > foo:g(42) and the semantics of M = foo, M:g(42) in Erlang > (other than the existence of the variable M). > > For instance, cf. section 4.2 of the Efficiency Guide. > > Er, which version? In the current (5.4.13) version, section > 4.2 is "Ets specific". Can you mean section 3.2? Yes, sorry. Typo. > But that is a fact about the current implementation, and the > performance of so-called "implicit apply" could be GREATLY > improved. Heck, it should be trivial. In fact, it's so > trivial I am astonished that it's not already done. Perhaps because your solution below is already slower than implicit applies? See below. > Here's what you do. > > 1. Each module has some number of functions > > '0'(a) -> a(); > ... one rule for each a/0 that is exported > '0'(F) -> erlang:no_such_function(?MODULE, F, []). > > ... > > '8'(X1, ..., X8, a) -> a(X1, ..., X8); > ... one rule for each a/8 that is exported > '8'(X1, ..., X8, F) -> erlang:no_such_function(?MODULE, F, > [X1,...,X8]). > > up to whatever size the implementors deem appropriate. > These rules are built at compile time. > > 2. The system has a set of functions, which I'll put in > 'erlang:'. > > '0'(F, mod1) -> mod1:'0'(F); > one rule for each module > '0'(F, M) -> erlang:no_such_module(M, F, []). > > ... > > '8'(X1, ..., X8, F, mod1) -> mod1:'8'(X1, ..., X8, F); > one rule for each module > '8'(X1, ..., X8, F, M) -> erlang:no_such_module(M, F, > [X1,...,X8]). > > These rules are built at run time, but that's old > technology. The new rules are added at the front of the > existing code, and it's basically just a matter of adding an > entry to a hash table. > > 3. A call M:f(X1,...,Xk) where k <= 8 is compiled as > > erlang:'k'(X1, ..., Xk, f, M) > > and a call apply(M, F, [X1,...,Xk]) where k <= 8 is known > at compile time or the equivalent M:F(X1, ..., Xk) is compiled > as > > erlang:'k'(X1, ..., Xk, F, M). > > For example, M:foo(42) should be compiled as > erlang:'1'(42, foo, M). > > If an 'external call' costs 1.08 units relative to a 'local > call', then an 'implicit apply' with not too many arguments > should just cost two of these (one call to erlang:'k'/k+2 and > one call to M:'k'/k+1), or 2.16 units. It really has no > business being 7.76 units; that's much slower than it should > be. Let's consider facts, and let's profile that module: -module(test). -export([start/0,call_me/0]). start() -> Module = ?MODULE, start_implicit_apply(Module, 100000), start_matching(Module, 100000). start_implicit_apply(_Module, 0) -> ok; start_implicit_apply(Module, Count) -> Module:call_me(), start_implicit_apply(Module, Count - 1). start_matching(_Module, 0) -> ok; start_matching(Module, Count) -> invoke_call_me(Module), start_matching(Module, Count - 1). call_me() -> ok. invoke_call_me(a) -> ok; invoke_call_me(b) -> ok; invoke_call_me(c) -> ok; invoke_call_me(d) -> ok; invoke_call_me(e) -> ok; invoke_call_me(f) -> ok; invoke_call_me(g) -> ok; invoke_call_me(h) -> ok; invoke_call_me(i) -> ok; invoke_call_me(j) -> ok; invoke_call_me(k) -> ok; invoke_call_me(l) -> ok; invoke_call_me(test) -> test:call_me(). And let's profile using fprof: 1> l(test). 2> fprof:apply(test, start, []). 3> fprof:profile(). 4> fprof:analyse(). In the output, we can see: ... { {test,start_matching,2}, 100001, 3523.577, 1451.172}, % ... { {test,start_implicit_apply,2}, 100001, 2944.968, 1901.568}, % ... 3523.577 > 2944.968 But perhaps you will find a much better way to do pattern matching in calls and it will be so trivial that you will be astonished that it's not already done? ;-) [...] > This kind of thing gets an order of magnitude harder if module > names are not, as they are now, context-independent. > > And both are compiled in a very different way in beam code. > > That is a fact about the present implementation which should > clearly change. It is not a fact about the semantics of the > language. OK. > So both kinds of statements can be manipulated differently by > the compiler, > > The compiler is at liberty to manipulate things differently > any way it likes, AS LONG AS IT PRESERVES THE SEMANTICS. The > semantics of m:f(X1) and M:f(X1) do NOT different in any way > that entitles a compiler to give them translations with > incompatible effects. They have compatible effects: transformed calls are still calls to functions in modules. > > and if only the module name in some external calls > need to be replaced by a compiler, this is possible and easy. > > That would CHANGE THE SEMANTICS of existing code, which my > proposal does not do. Making m:f(X) and (M=m, m:f(X)) do > different things would be downright evil. > > Just take a look at lib/compiler/src/genop.tab in the OTP > sources for the list of beam opcodes: > - local calls are compiled into call/2 ops; > - external calls are compiled into call_ext/2 ops; > - implicit apply calls are compiled into normal calls to > apply. > > They shouldn't be. As noted above, it is possible to do MUCH > better. (Actually, section 3.2 of the Efficiency Guide says > that "The compiler will now optimise this [implicit apply] > syntax giving it better performance than apply/3], which > cannot be true if implicit applies are just "compiled into > normal calls to apply". Something is wrong here. Yes, in fact, they are optimized calls to apply. Optimization is done by the compiler. > HOW it is done is not in fact relevant. The point is that > whatever the compiler does (and it can make local calls work > by sending e-mail if it wants to) it has to get the SEMANTICS > right, which according to all the Erlang documentation > (including the specification "books") I've ever seen means > that "implicit apply" and apply and external call all have the > SAME semantics. I agree that I take a different viewpoint: I am thinking in terms of the Erlang VM, and its instruction set. I consider that it is a better abstraction level to think about program transformation, than the source language level. Now, I agree that the semantics of my external calls is different. But in fact, I have not changed the semantics of existing external calls, but I have *added* a variant form of external call. In Mod:call(), if Mod is statically determined to be an atom that is declared in a -require clause in the module, then this is a "modified" external call, otherwise it is a "normal" external call. It is not a change in semantics, because all existing code would have the same semantics. Only new code, explicitly using -require and virtual module names in external calls, would use the new variant of external calls. I think that what bothers you is that the syntax of that variant of external calls is the same as that of "normal" external calls? But I believe that introducing a new syntax for that variant would be unnecessary, since there would be no ambiguity from a compiler's viewpoint. And I would like to argue why I consider a variant semantics (i.e., with renaming of modules) of external calls only, and not a modification of the semantics of all function calls. The purpose is to remove explicit bindings between modules from the modules' source code. When using implicit applies or calls to apply(), the module name is a variable, hence it can already be a parameter coming from outside of the module implementation, and be determined at runtime. We don't need to add any new mechanism here to allow to specify bindings out of the modules' source code. My proposal is to remove explicit bindings between modules, from the source code of modules, 1) when relationships between modules need not change at runtime (otherwise, implicit applies must be used), and 2) when we need better performance than implicit applies or calls to apply(). Therefore, we need external calls. But since external calls have the module name statically compiled in, we need to make the called module name parameterized from outside of a module's code, and modified at compile time. > So yes, I claim it once again: replacing the module name in > external calls is easy at compile time. We need only to > transform the parameters of the call_ext ops. > > In short, you are proposing an IMCOMPATIBLE CHANGE to the > semantics of the language, for no other reason than that it's > easy. It is compatible with existing Erlang code. I propose to add a new variant of function calls. [...] > - File names never appear in configuration files, only module > names. > > That can't possibly work. File names have to appear > SOMEWHERE. One of the reasons for having a configuration > language is to cope with the vagaries of file systems. Module > names are case sensitive. In several M$ajor file systems, file > names are not. So mapping from module names to file names is > not trivial. Module names do not contain directory > information, but modules do not all live in the same > directory. Mapping real module names (not my logical ones...) with module file names is the job of the code loader. And it already does that job well, doesn't it? I think that it is better to centralize all file name handling in one place. And the code loader seems to be the right place. [...] > - The interface between a module and another module is > already explicit (it is the list of functions exported by > every module). > > No, only HALF of the interface is there, and only HALF of the > information you actually need in the interface. > > In general, you need to know not just "what do I offer to the > whole world" but "what do I offer to which particular > modules". Think about the way Eiffel lets you export features > to specified classes. I am not so fond of Eiffel's visibility mechanism. It makes you make strong assumptions about the environment of a class, inside the code of a class. But I agree that we should have a way to limit the visibility of features. > Think about the fact that in Erlang, > when you use a behaviour, you export some functions *TO THE > BEHAVIOUR*, which are never ever supposed to be called by > anything *BUT* the behaviour, BUT YOU CAN'T SAY THAT. > > My -use_child directive has TWO function lists because every > relationship has two sides, No, not every relationship has two sides. I prefer to focus on modules' interfaces, instead on bindings. Yes, every module (or any unit of encapsulation) should declare both provided features, and required features. But that does not mean that it must always provide its features to the same modules it uses. Usage relationships are generally one-way, not two-way. When one of my modules uses the lists module, lists does not need to use the features of my module. > and because it is important to > distinguish between "I am willing to offer this function to > that child" and "this child currently needs that function from > its parent". I agree that it is important to distinguish between "what functions I am willing to offer", and "what functions I require". But we can talk about usage relationships without introducing child and parent roles. > > As I understand it, the main use of -ifdef, etc. is to > > select alternative architectures. Using an ADL, you would > > simply have to write several specs. > > > > Yes, but that could mean repeating hundreds of lines. > > I'm thinking in terms of something like C/MESA. > > Hundreds of lines??? > > Yes. I'm thinking of configuration files that cover > *applications*, not single modules. Nice, I am thinking about that, too. [...] > > I think that it is a bad idea to try to specify a single > > construct that would replace all actual usages of -include > > and -ifdef: either the new construct will be as bad as what > > it replaces, or it will not cover all usages. > > > > This seems to me to be a matter of personal taste; I see no > > reason why the claim should be true. > > OK, it is mainly a matter of personal taste. > > There are two statements: > (1) "It is a bad idea .. single construct ... -ifdef." > (2) "Either the new construct will be as bad ... all > usages." > > The first statement appears to express a matter of taste; you > don't like the idea. The second statement is the grounds for > the first. Maybe it is true. The second statement, however, > is not a matter of personal taste. As I said, that one > _could_ be true, and I would like to see some evidence for it. Well. We would need first to analyze what are all usages of the preprocessor. > > The Erlang/OTP support people have already made it plain > > that they will not tolerate any replacement for -record > > that *requires* cross-module inlining. > > Can you please point me to such a discussion on the Erlang > mailing-list or elsewhere? > > The thread about "when will abstract patterns be implemented" > within the last month or possibly two. Ok. Thanks. > And who has talked about cross-module inlining in this > discussion?! > > I have. For heaven's sake, it's half of what my proposal is > ABOUT! Abstract patterns were rejected by the OTP implementors > (in the thread mentioned above) on the grounds that they > required cross-module inlining. (As the original paper made > clear, they DON'T, but that's another matter.) > > The fact that the current Erlang system doesn't do > cross-module inlining is one of the major reasons for the > preprocessor. If you want to get rid of the preprocessor, you > have to provide some means whereby constants &c can be > compiled efficiently without requiring general cross-module > inlining (which amongst other things messes up naive > hot-loading). People who use records want them to be as > efficient as any other kind of pattern matching, so that there > is no performance penalty for writing readable code. Since > there is no cross-module inlining, they don't WANT records to > be imported from other modules. (If they were going to put up > with that, they might as well use abstract patterns.) So > there has to be something that shared record definitions can > go in which is not a full module and so that record > definitions CAN be fully presented to the compiler. > > The current answer is that the something in question is a .hrl > file. My answer is that it's an integrated child module. My answer is that it's the value returned by a function call (record_info/2), that function's implementation being generated automatically by the compiler. > -module(mod1). > -record(record1, {field1, field2}. > ... > > -module(mod2). > -import_records(mod1, [record1]). > ... > > Would be strictly equivalent (and can be easily transformed > into): > > -module(mod1). > -record(record1, {field1, field2}). > % Generated automatically by the compiler: > -export([record_info/2]). > record_info(fields, record1) -> [field1, field2]; > record_info(size, record1) -> 2. > ... > > -module(mod2). > % This -record is generated from the result of calls to > % mod1:record_info/2 by the compiler: > -record(record1, {field1, field2}. > > WHOOPS! You are doing cross-module inlining! You just made > an incompatible change to the semantics of the language! > (Haven't we seen that before?) You are *supposed* to be able > to load a new version of mod1 WITHOUT recompiling mod2. Now > you can't. If a new version mod1 is loaded, - if the record definition has been changed in mod1 (the -record statement has been changed, and mod1 has been recompiled), then mod2 must also be recompiled. - if the record definition has not been changed in mod1, then mod2 needs not be recompiled. This is true for both the actual way of using -record based on -include of .hrl files, and for my proposal. The fact that there may be cross-module inlining in my solution, is because the first implementation would directly rely on the current -record construct and the current way of compiling it, and because the current implementation of -record does imply cross-module inlining. It is an implementation detail. If one day there is an implementation of -record that does not do cross-module inlining, then my solution would not do cross-module inlining either! Look at the source code before transformation: -module(mod2). -import_records(mod1, [record1]). ... There are no record definitions in the source code. The purpose of my proposal is not to replace the way record definitions are translated by the compiler, but to get rid of -include to share record definitions. If -record currently require such inlining, it is not directly my problem: my purpose is to get rid of -include and .hrl files. And I think that implementing records without inlining is a separate problem. If that more general problem is solved in the future, then my proposal may even be discarded, but I think that for now it is an acceptable intermediate solution which gets rid of include files. By the way, you have the same problem: to share a record definition with child modules, you have to declare the -record in an out-of-line child module, and have mod1 and mod2 both be parents of that child module. When you modify the child module (e.g. to modify the record definition), you have to recompile both mod1 and mod2. "WHOOPS! You are doing cross-module inlining!" ;-) > % Since importing a record def is just like declaring > % it locally, it would be exported from that module also: > -export([record_info/2]). > record_info(fields, record1) -> [field1, field2]; > record_info(size, record1) -> 2. > ... > > Please point me where you see inlining in that. > > Great balls of fire. Isn't it obvious? You are talking > about the compiler processing mod2 WITH FULL KNOWLEDGE OF A > DEFINITION IN mod1. That is precisely cross-module inlining. Ok. > Now, I happen to believe that cross-module inlining is a good > thing. (And I know it has been tried in an Erlang context.) I > also believe that hot loading is a good thing. But I also > know that this kind of thing has been done before. Robert > Dewar's SPITBOL implementation of SNOBOL coped with a language > (SNOBOL) which allowed new code to be created at run time > (even creating new data types!) and could undo code generation > which had made assumptions that were no longer true. That was > in the 70s. There are some Smalltalk compilers which can do > some inlining, and recompile when the original definitions > change. That kind of thing was also done for Self. It > requires excellent dependency tracking, and it's not at all > easy. > > So I think that refusing to do cross-module inlining (yet) is > a good engineering decision by the OTP team. > > By the way, anyone who has looked at my proposal recently > should pretend they never saw the configuration language > draft. It is MUCH too complicated. I have a whole new draft > of that, but haven't had time today to type it up. For one > thing, it never occurred to me that people were trying to use > case sensitive module names, but they are. > > In my proposal, I am taking a very strong stand on semantics. > NO CHANGE to the semantics of existing Erlang code. NONE. I propose to add a new form of external call, without changing at all the semantics of existing code. > One consequence of that is that things which seem very easy on > the assumption that you are allowed to make such changes may > in fact be very hard. Another consequence is that the design > one ends up with may not be as nice, in many ways, as the > design one would have produced for a new language. > > I think many people trying to get real work done with Erlang > would say "if you want me to put up with a change in the > meaning of module names just so that you can get rid of the > preprocessor, no thanks, I'll stick with the preprocessor". -- Romain LENGLET From invisio22@REDACTED Tue Apr 4 15:48:20 2006 From: invisio22@REDACTED (Eric Shun) Date: Tue, 4 Apr 2006 15:48:20 +0200 Subject: GS and Gif images Message-ID: <3f9db9f20604040648k21549d1jdb13fa8addcbff9b@mail.gmail.com> Hello, I have two questions: 1) How can I resize an image with gs? 2) I have to simulate an animation with 5 gifs (like an animated gif). I tried this: loop(Image) -> gs:config(Image,Canvas,[{load_gif,"1.gif"}]), timer:sleep(10), gs:config(Image,Canvas,[{load_gif,"2.gif"}]), timer:sleep(10), gs:config(Image,Canvas,[{load_gif,"3.gif"}]), timer:sleep(10), gs:config(Image,Canvas,[{load_gif,"4.gif"}]), timer:sleep(10), gs:config(Image,Canvas,[{load_gif,"5.gif"}]), timer:sleep(10), loop(Image). The problem is: Doing this, the memory doesn't stop to grow... until overflow... How can I do that properly? -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Apr 4 17:17:34 2006 From: erlang@REDACTED (Inswitch Solutions) Date: Tue, 4 Apr 2006 12:17:34 -0300 Subject: Send - buffer overrun Message-ID: <1e8d01c657fb$259fdf40$4a00a8c0@Inswitch251> Hi, I have a TCP/IP Client in Erlang and doing some stressing on it I've noticed that the gen_tcp:send/2 function blocks. About send function in MSDN doc: "If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in a nonblocking mode" In Erlang I can't use select or other async functions. Is there any solution for this in Erlang? thanks, Eduardo Prepaid Expertise - Programmable Switches Powered by Ericsson Licensed Technology Eng. Eduardo Figoli - Development Center - IN Switch Solutions Inc. Headquarters - Miami-U.S.A. Tel: 1305-3578076 Fax: 1305-7686260 Development Center - Montevideo - Uruguay Tel/Fax: 5982-7104457 e-mail: eduardo@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 1429 bytes Desc: not available URL: From roger.larsson@REDACTED Tue Apr 4 17:55:01 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Tue, 4 Apr 2006 17:55:01 +0200 Subject: cross-module inlining - just in time? Message-ID: <200604041755.01899.roger.larsson@norran.net> Why do all cross-module inlining at compile time? Why not when (re)loading? How often is code actually reloaded into a running Erlang system? I think I have read something about genering Erlang source from complex data (queries), compile and load while running? Is this common? If reloading modules are not common what about running a global inlining/optimization pass after reloading a module. This could be done just in time when a call is made to another module. When a module is reloaded all such optimizations could be discarded. (First load does not need to discard any optimizations - no one could yet be a user. Later with better dependency tracking is implemented less optimizations need to be discarded). Wouldn't just in time inlining solve: - records - interface functions (with data validation, send, receive) - constant functions Maybe there should be two types of cross-module inlining. 1. Modules compiled together with other modules - subsystem Contained and loaded together. "Parent" + "Childs" + Subsystem internal datatypes But for better optimization even stdlib modules like "lists" should be compiled in. Resulting .beam should be self contained (ie should not require "lists" when loaded) 2. Modules loaded together at runtime - system linked and optimized in run time (should not require the same "lists" implementation). Would this optimization even be necessary? Could this be possible? Where would otp modules fit, would they need to be separately compiled or could they be contained? /RogerL From mickael.remond@REDACTED Tue Apr 4 18:44:47 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 4 Apr 2006 18:44:47 +0200 Subject: Send - buffer overrun In-Reply-To: <1e8d01c657fb$259fdf40$4a00a8c0@Inswitch251> References: <1e8d01c657fb$259fdf40$4a00a8c0@Inswitch251> Message-ID: <20060404164446.GA24839@memphis.ilius.fr> Hello Eduardo, * Inswitch Solutions [2006-04-04 12:17:34 -0300]: > Hi, > > I have a TCP/IP Client in Erlang and doing some stressing on it I've noticed that the gen_tcp:send/2 function blocks. > About send function in MSDN doc: > "If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in a nonblocking mode" > > In Erlang I can't use select or other async functions. Is there any solution for this in Erlang? The state of the discussion can be found in the following mail from Matthias Lang: http://www.erlang.org/ml-archive/erlang-questions/200302/msg00157.html I hope this helps, -- Micka?l R?mond http://www.process-one.net/ From ulf.wiger@REDACTED Tue Apr 4 19:00:59 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 4 Apr 2006 19:00:59 +0200 Subject: Child modules draft feedback wanted Message-ID: Richard A. O'Keefe wrote: > > Practically, there is a problem. Modules have to do at least > two different things. They are the units of hot loading. > They are the units of encapsulation. I'm sure I remember > someone talking about using different mechanisms for > different jobs. I'm proposing "full" modules as units of hot > loading, and "child" modules as units of encapsulation. Modules are also, to some extent, units of version control (more on that later). Regarding hot loading - while it's often extremely practical to hot-load individual modules during experimentation and debugging, things tend to work a bit differently when upgrading large systems. Basically, _OTP applications_ are the unit of in-service upgrade when using the OTP framework. For example when discussing cross-module optimization with Thomas Lindgren, we (the IMS Gateways unit within Ericsson) have taken the preliminary stance that it would be OK to allow cross-module inlining within an application, at least in a stable system. (This could have an effect on per-module hot-loading somewhat similar to the "sticky" concept, where a module cannot be loaded if it is marked as "sticky"/"hard-wired into an application".) OTP has pretty good support for upgrading an application at a time, and I think this might be a good trade-off in order to allow cross-module inlining. Semantically there should be no significant difference between code that's inlined across modules and code that isn't. It might be possible to accept _some_ well-defined differences e.g. as regards exceptions. In a concurrency-oriented language, any optimization may affect timing, which may cause problems if the code is timing-sensitive. > To see that there is a problem, I made some size measurements > on Erlang R9C. (The R11 release I downloaded turned out to > be corrupted, so I couldn't measure that, and while I _am_ > downloading R10 to do my measurements on, it's taking long > enough that I decided not to wait.) > > > summary(s) > Min. 1st Qu. Median Mean 3rd Qu. Max. > 2.0 44.5 127.0 291.4 314.0 22508.0 > > That is, there is at least one module with 2 SLOC, > 1/4 of the modules have 44 or fewer SLOC, > 1/2 of the modules have 127 or fewer SLOC, > 3/4 of the modules have 314 or fewer SLOC, but there is at > least one module with 22,508 SLOC. > > The distribution of SLOC sizes shows two peaks, one around 8 > SLOC (yes, that small) and one around 192 SLOC. But there > are quite a few big ones. I think this corresponds pretty well to our experience. There are many modules in our systems as well as in OTP that really are not reusable entities as such, except in a very narrow context. Examples that come to mind are - hipe_xxx_loader (xxx: amd64 | ppc64 | ppc | sparc | unified | x86) - disk_log1, disk_log_server - most modules in mnesia (except mnesia, mnesia_frag, and a few others) The way to achieve structure today is to break a large module into several first-class modules, but then having to document which ones are to be viewed as "official" modules. > Of course we can manage without that; we have. But there is > a big difference between looking at a function and KNOWING > that it is only used in a small part of a large module and > having to CHECK the whole module to find out. We've had a convention to name one module with an "i" suffix, to delineate where the official interface functions of an application are to be found. This has several disadvantages, but has the big advantage (esp in large systems) that you can rather easily find the functions that have been written with the intent of being used by users external to the application. It also has the property (here's the "later" that you can check the revision of the file and tell whether it were changed since last. If designers follow the rule that you should put as little implementation as possible in the interface modules, this check may actually tell you something. I think child modules make a lot of sense in terms of trying to bring more structure into complex systems. > -module(mod1). > -record(record1, {field1, field2}. > ... > > -module(mod2). > -import_records(mod1, [record1]). > ... > > Would be strictly equivalent (and can be easily transformed > into): > > -module(mod1). > -record(record1, {field1, field2}). > % Generated automatically by the compiler: > -export([record_info/2]). > record_info(fields, record1) -> [field1, field2]; > record_info(size, record1) -> 2. > ... > > -module(mod2). > % This -record is generated from the result of calls to > % mod1:record_info/2 by the compiler: > -record(record1, {field1, field2}. > > WHOOPS! You are doing cross-module inlining! You just made > an incompatible change to the semantics of the language! Even if the cross-module inlining step were skipped, exporting the pseudo function record_info/2 would mean that some helper code could be written a lot more cleanly. I see very few disadvantages with doing this, as the preprocessor has reserved both the name and semantics of the record_info/2 function. > I think many people trying to get real work done with Erlang > would say "if you want me to put up with a change in the > meaning of module names just so that you can get rid of the > preprocessor, no thanks, I'll stick with the preprocessor". I agree. BR, Ulf W > From hokan.stenholm@REDACTED Tue Apr 4 19:26:46 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Tue, 04 Apr 2006 19:26:46 +0200 Subject: GS and Gif images In-Reply-To: <3f9db9f20604040648k21549d1jdb13fa8addcbff9b@mail.gmail.com> References: <3f9db9f20604040648k21549d1jdb13fa8addcbff9b@mail.gmail.com> Message-ID: <4432AC56.3030500@bredband.net> Eric Shun wrote: >Hello, > >I have two questions: > >1) How can I resize an image with gs? > > You can't (to the best of my knowledge) >2) I have to simulate an animation with 5 gifs (like an animated gif). I >tried this: > >loop(Image) -> > gs:config(Image,Canvas,[{load_gif,"1.gif"}]), > timer:sleep(10), > gs:config(Image,Canvas,[{load_gif,"2.gif"}]), > timer:sleep(10), > gs:config(Image,Canvas,[{load_gif,"3.gif"}]), > timer:sleep(10), > gs:config(Image,Canvas,[{load_gif,"4.gif"}]), > timer:sleep(10), > gs:config(Image,Canvas,[{load_gif,"5.gif"}]), > timer:sleep(10), > loop(Image). > >The problem is: Doing this, the memory doesn't stop to grow... until >overflow... >How can I do that properly? > > Hmm, I wonder if the memory should overflow in this case ? There are a couple of other options that may work: * load pictures once and use gs:config(...) to raise or lower certain images (assuming that they are not supposed to move around). * use gs:destroy/1 to periodicly remove a gui widget and hopefully its associated memory * it may also be possible to move unused images ofscreen, e.g. by putting the image at a negative x and y coordinates or beyond the area of the window (e.g. x = 10000, y = 10000). From klacke@REDACTED Tue Apr 4 19:29:45 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 04 Apr 2006 19:29:45 +0200 Subject: Send - buffer overrun In-Reply-To: <20060404164446.GA24839@memphis.ilius.fr> References: <1e8d01c657fb$259fdf40$4a00a8c0@Inswitch251> <20060404164446.GA24839@memphis.ilius.fr> Message-ID: <4432AD09.5070206@hyber.org> Mickael Remond wrote: > Hello Eduardo, > > * Inswitch Solutions [2006-04-04 12:17:34 -0300]: > > >>Hi, >> >>I have a TCP/IP Client in Erlang and doing some stressing on it I've noticed that the gen_tcp:send/2 function blocks. >>About send function in MSDN doc: >> "If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in a nonblocking mode" >> >>In Erlang I can't use select or other async functions. Is there any solution for this in Erlang? > > > The state of the discussion can be found in the following mail from > Matthias Lang: > > http://www.erlang.org/ml-archive/erlang-questions/200302/msg00157.html Well, there is a bit more to it. If the client writes faster than the reader can read, eventually TCP write would block. The erlang driver, inet_drv.c use nonblocking IO and detects this condition. It then signals the port (this is the actual socket on the erlang side) as a "busy port". Any erlang process which tries to write, i.e. Port ! {self(), {command, Data}} or any of the equivalents will be automatically suspended until the port is marked as "not busy" by the driver. The driver on it's side, will continue to try to write the pending buffers, when eventually the reader actually reads, or the socket is closed, the driver will be able to either write, in which case it will signal the port as "not busy" and the producer (the writer) is released from suspension, or the socket gets closed, and also in this case the producer gets released. The downside of this, is that it's not possible to write an erlang program that detects that the reader isn't reading fast enough. (At least not easily). The upside is that users don't have to bother with user space flow control, but can rely on the allready excellent flowcontrol in TCP. The only thing that gets suspended is the fast writer Pid, the rest of the erlang node keeps running fine. /klacke /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From jeremie@REDACTED Tue Apr 4 22:44:57 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Tue, 4 Apr 2006 22:44:57 +0200 Subject: ets or mnesia? Message-ID: <2b7b425b0604041344v13bb6786i47ef9fcb8e34fe2@mail.gmail.com> Hello, I have bits and pieces of data I would like to make available to all my processes, and which I would like these processes to be able to edit. I originally was going to do this with records that are maintained at a supervisor level. All the childs then send messages to the supervisor to modify the records. Each child keeps track of the data that is important to it. But this seemed to bypass the "make small module-like processes that only do one thing", and seemed like it could easily become unmaintainable. I then thought of mnesia, but when reading the introduction page of its guide, I heard of dets/ets. I *will* have some data that I want to permanently keep and have a fast, indexed access to?and for that I will use mnesia. But the data I'm talking about here is something that is only needed while the program is running. It is not data I want to keep, and it is data that will likely change a lot while the children are connected to the servers. Should I use mnesia or ets for that? (And if you say ets, can you recommend a good starting guide?) Best Regards, J?r?mie -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Tue Apr 4 23:36:32 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 04 Apr 2006 23:36:32 +0200 Subject: ets or mnesia? In-Reply-To: <2b7b425b0604041344v13bb6786i47ef9fcb8e34fe2@mail.gmail.com> References: <2b7b425b0604041344v13bb6786i47ef9fcb8e34fe2@mail.gmail.com> Message-ID: <4432E6E0.2070009@hyber.org> J?r?mie Lumbroso wrote: > Should I use mnesia or ets for that? (And if you say ets, can you ets > recommend a good starting guide?) > It's unfortunately going to have to be # man ets (Assuming you have the man pages set up) /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From ryanobjc@REDACTED Wed Apr 5 00:39:42 2006 From: ryanobjc@REDACTED (Ryan Rawson) Date: Tue, 4 Apr 2006 15:39:42 -0700 Subject: ets or mnesia? In-Reply-To: <4432E6E0.2070009@hyber.org> References: <2b7b425b0604041344v13bb6786i47ef9fcb8e34fe2@mail.gmail.com> <4432E6E0.2070009@hyber.org> Message-ID: <78568af10604041539r153664fdg97b5338dd3a7d728@mail.gmail.com> I would recommend ETS as well. It's essentially a hashtable (in API), so there isn't any learning to be done really. All you need is an API reference, which man ets works very well for. -ryan On 4/4/06, Claes Wikstrom wrote: > J?r?mie Lumbroso wrote: > > > Should I use mnesia or ets for that? (And if you say ets, can you > > ets > > > recommend a good starting guide?) > > > > It's unfortunately going to have to be > > # man ets > > (Assuming you have the man pages set up) > > > /klacke > > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > cellphone: +46 70 2097763 > From ok@REDACTED Wed Apr 5 06:43:08 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 5 Apr 2006 16:43:08 +1200 (NZST) Subject: cross-module inlining - just in time? Message-ID: <200604050443.k354h8xV011037@atlas.otago.ac.nz> Roger Larsson wrote: Why do all cross-module inlining at compile time? Why not when (re)loading? In this particular thread, it doesn't matter. Ever since I read about Kistler's "Juice" implementation of Oberon, I've liked the idea. Oberon is a Wirth language, sort of a cleaned up and stripped down Modula-2 with a few extra goodies thrown in. One of them is dynamically loadable and unloadable modules. Oberon was implemented in a fairly conventional way, with a compiler generating linkable object files, and a dynamic relocating linker pulling them in. Kistler wrote an Oberon compiler that compiled a module into a (rather cunningly) compressed abstract syntax tree. These compressed ASTs were so much smaller than the usual sort of linkable object file, the the cost of reading an AST from disc *and* dynamically generating native object code was less than the cost of linking an ordinary object file, and the code was better too. (And of course Juice files were so much smaller than .class files that it really wasn't funny. Oddly enough, we never heard about .jar files until _after_ Kistler published...) Now the Juice compiler for Oberon could be trusting. It could assume that the compressed AST it was reading was a tree that described a *legal* Oberon module (and variables had already been looked up &c). So the run- time code generator didn't have to repeat the work the compiler had already done. I have been saying for years (mainly to people at SERC) that I couldn't see any reason why the idea wouldn't work for Erlang. I have already pointed out with measurements this year that if you take Erlang source code and strip out comments and indentation and then compress, you get something _much_ smaller than .beam files. An adaptation of the Juice idea should yield a compressed representation that is smaller still AND which makes code generation easy. So "compilation" could really be "static checking and compression" and "loading" could really be "decompression-and-code-generation". So I don't see "compiling" -vs- "loading" as a big deal. In both cases, the crucial points is that code from the exporting module winds up indissolubly tangled up with code from the importing module. The problem this creates is that in the present system, if module M is reloaded, *only* module M is affected. The amount of work is bounded by some (hopefully linear) function of the size of M. But in a system with cross-module inlining, a change to a 3-line module might require 300 MB of code from 30,000 modules to be recompiled. (Imagine the fun if one of the affected modules is the recompiler...) When a module is reloaded all such optimizations could be discarded. Understand that "optimisations" here includes constant propagation and dead code elimination. Suppose you have 200 modules that -import(options, [debug/0]). ... f(...) when debug() -> ... f(...) -> ... and you used to have -module(options). -export([debug/0, ...]). debug() -> false. Now you change the last line to debug() -> true. recompile, and reload. The code that needs to be "unoptimised" is a lot of code that isn't _there_ any more. In general, there isn't much you can do better than going back to the sources and running the whole code generation process (including constant propagation and dead code elimination) again. Wouldn't just in time inlining solve: Nothing that any other kind of cross-module inlining wouldn't solve. - records - interface functions (with data validation, send, receive) - constant functions It's a nice idea, although as I pointed out this kind of thing is anything but new. But "just in time inlining" doesn't seem to be relevantly different from doing cross-module inlining at any other time; the issue is that cross-module inlining - creates dependencies between modules which have to be tracked - may cause extremely large amounts of recompilation to be required in response to what looks like a small change (and even if this is deferred, it still has to happen SOME time) - therefore needs to be under explicit programmer control. Maybe there should be two types of cross-module inlining. 1. Modules compiled together with other modules - subsystem Contained and loaded together. ... 2. Modules loaded together at runtime - system Several years ago, I proposed a distinction between -import_late(Module[, Functions]). Late binding dependency on Module, listed Functions must be provided by Module and may be used without Module: prefixes. -import_early(Module[, Functions]). Early binding dependency on Module, listed Functions must be provided by Module and may be used without Module: prefixes. This would let you say -import_early(lists, [map/2]). or whatever, announcing that you are willing to pay the price of having this module recompiled/regenerated/whatever if/when the lists module is reloaded, or -import_late(...) if you wanted reloading to be cheap and calls to be dear. Because of the potential benefits of cross-module inlining, it should be available. Because of the potential very high costs, it should not be the default. I think something like the -import_early/-import_late explicit indication is the way to go. From ok@REDACTED Wed Apr 5 07:27:00 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 5 Apr 2006 17:27:00 +1200 (NZST) Subject: Child modules draft feedback wanted Message-ID: <200604050527.k355R0C4004953@atlas.otago.ac.nz> "Ulf Wiger \(AL/EAB\)" wrote: Modules are also, to some extent, units of version control (more on that later). As indeed I have pointed out. ... OTP has pretty good support for upgrading an application at a time, and I think this might be a good trade-off in order to allow cross-module inlining. Agreed. Semantically there should be no significant difference between code that's inlined across modules and code that isn't. It might be possible to accept _some_ well-defined differences e.g. as regards exceptions. We already have this difference for code that is inlined within a module. There are many modules in our systems as well as in OTP that really are not reusable entities as such, except in a very narrow context. Examples that come to mind are - hipe_xxx_loader (xxx: amd64 | ppc64 | ppc | sparc | unified | x86) - disk_log1, disk_log_server - most modules in mnesia (except mnesia, mnesia_frag, and a few others) If I've understood correctly, large chunks of dets and asn1 are like that. The way to achieve structure today is to break a large module into several first-class modules, but then having to document which ones are to be viewed as "official" modules. This is one of the things that the -export_to(Module, Functions) directive I proposed, oh, must have been in 1997, was to have accomplished. If module foobar_helper exports everything to foobar and nothing to the world in general, it's clearly not an "official" module. I think child modules make a lot of sense in terms of trying to bring more structure into complex systems. > WHOOPS! You are doing cross-module inlining! You just made > an incompatible change to the semantics of the language! Even if the cross-module inlining step were skipped, exporting the pseudo function record_info/2 would mean that some helper code could be written a lot more cleanly. So you have mod1 that exports (partial) record_info (that is, some records have their information exported, but not others), and mod2 that imports this record_info. The problem is that without cross- module inlining, that *does* let you enquire about record info at run time, but it does *not* let you *use* any of that information at compile time, so you've imported a record type from mod1, but you can't actually *use* that record type in your source code. In that case, you really might as well use abstract patterns. I see very few disadvantages with doing this, as the preprocessor has reserved both the name and semantics of the record_info/2 function. To me it certainly violates the principle of least surprise. Here I am writing mod2, and want to use #fred from mod1. And I am now allowed to import it from mod1, and I'm allowed to ask about it at run time, but I'm not allowed to use it in my source code. Is that weird or is that really REALLY confusing or what? There is a conceptually much simpler change to the language which would mean much bigger changes to the compiler and emulator, alas. That is to do away with -record entirely and use something very similar to IBM PROLOG's "items" = Joe Armstrong's "proper structs" = my "frames" = (more or less) Psi-Terms. They have the same space requirements as records, they are distinct from records, they are even better than records because they are extensible, and they would be a touch slower than records but not hugely so, without requiring any kind of preprocessing or cross-module inlining. (This is also a simpler change to the language than abstract patterns.) That would still leave us with a use for some levels of structure above and below the current module level, but it would eliminate the main *principled* requirement for the preprocessor. From vlad_dumitrescu@REDACTED Wed Apr 5 08:14:00 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 5 Apr 2006 08:14:00 +0200 Subject: cross-module inlining - just in time? References: <200604050443.k354h8xV011037@atlas.otago.ac.nz> Message-ID: Hi, > In both cases, the crucial points is that code from the exporting module > winds up indissolubly tangled up with code from the importing module. > > The problem this creates is that in the present system, if module M > is reloaded, *only* module M is affected. The amount of work is bounded > by some (hopefully linear) function of the size of M. But in a system > with cross-module inlining, a change to a 3-line module might require > 300 MB of code from 30,000 modules to be recompiled. (Imagine the fun > if one of the affected modules is the recompiler...) Unfortunately, this isn't entirely true from a practical point of view: changing a record definition and recompiling just one module using it is a sure way to make everything crash ;-) Likewise, changing the API of some service would also require recompilation of all clients. So the problem is already here, only it doesn't manifest itself at compile time, but at run time. I'm not sure if the one is better than the other. regards, Vlad From sanjaya@REDACTED Wed Apr 5 08:29:39 2006 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Wed, 5 Apr 2006 12:29:39 +0600 Subject: optimize the use of erlang processes ???? Message-ID: <001601c6587a$53244c60$9a0a10ac@wavenet.lk> Hi ... !!! Environment Summary: 4GB HP Server Running Mnesia Fragmented Table (Exactly the Same Copy) on 2 nodes. They are working independently to each other. Node 1: Running the actual db with 375459 records (started with +A255) Node 2: Using for load testing etc. (started with +A255) Problem: Node2 Crashed when started to add records (Very Small amount of records ~100000 ... mmmm not sure but Very Less). There are plenty of memory available in the system when node 2 crashed (Note the total used memory as crash_dump 512Mb) crash_dump: Slogan: eheap_alloc: Cannot allocate 1271244 bytes of memory (of type "old_heap"). System version: Erlang (BEAM) emulator version 5.4.12 [source] [hipe] [threads:255] Compiled: Mon Jan 16 14:59:19 2006 Atoms: 10435 =memory total: 512729384 processes: 15884970 processes_used: 15868210 system: 496844414 atom: 464421 atom_used: 459809 binary: 351077627 code: 3989398 ets: 140681800 My Solution: When I restarted the Node 2 with +A64 it adds up to 2220000 records Questions: Q1.) Are there any dependencies with 2 nodes started with +A255 ? Why it works when the second node started with +A64 ? Q2.) What is the best way to optimize the processes used by each node? I mean putting +A32 will work, but reduce the performance OR putting +A192 will also work but it uses more processes than it needs. So how to tune up the applications to get the resources as there need? Q3.) What is the "old_heap" ??? And When & Why it uses?? Q4.) What is the eheap and when & how it used ? Q5.) Are there any relation between c malloc and erlang eheap_alloc ? Q6.) How to get the details of available/used number of processes in erlang? Q7.) How the total number of erlang processes depends with the OS ?? Q8.) How to get the details of Linux resources which erlang depends on?? (Ex System Processes, Threads .. etc) Q9.) What is the maximum number of processes can be used in a single erlang system. Q10.) If we started several erlang nodes/systems are there any shared resources among them. If yes, how to get the details of them? Thanks in advance. Sanjaya Vitharana -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Wed Apr 5 08:54:43 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 5 Apr 2006 08:54:43 +0200 Subject: Send - buffer overrun Message-ID: Claes Wikstrom wrote: > > Port ! {self(), {command, Data}} > > or any of the equivalents will be automatically suspended > until the port is marked as "not busy" by the driver. [...] > > The downside of this, is that it's not possible to write an > erlang program that detects that the reader isn't reading > fast enough. (At least not easily). Not that I've used it myself, but the BIFs erlang:send_nosuspend(Dest, Msg), and erlang:send(Dest, Msg, [nosuspend) are supposed to deal with this situation, by returning 'false' (and not sending the message) if the sender would have been suspended. The man page says "use with extreme care!". BR, Ulf W From ulf.wiger@REDACTED Wed Apr 5 09:19:59 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 5 Apr 2006 09:19:59 +0200 Subject: Child modules draft feedback wanted Message-ID: Richard A. O'Keefe > > "Ulf Wiger \(AL/EAB\)" wrote: > Even if the cross-module inlining step were skipped, > exporting the pseudo function record_info/2 would > mean that some helper code could be written a lot > more cleanly. > > So you have mod1 that exports (partial) record_info (that is, > some records have their information exported, but not > others), and mod2 that imports this record_info. To clarify, I didn't mean supporting the -import_records() directive, but rather only to export the record_info/2 function. > The problem > is that without cross- module inlining, that *does* let you > enquire about record info at run time, but it does *not* let > you *use* any of that information at compile time, so you've > imported a record type from mod1, but you can't actually > *use* that record type in your source code. > In that case, you really might as well use abstract patterns. ... which require quite some more implementation effort before they are available, than for the compiler to lay out code for record_info/2 and exporting it. > > I see very few disadvantages with doing this, > as the preprocessor has reserved both the name > and semantics of the record_info/2 function. > > To me it certainly violates the principle of least surprise. > Here I am writing mod2, and want to use #fred from mod1. And > I am now allowed to import it from mod1, and I'm allowed to > ask about it at run time, but I'm not allowed to use it in my > source code. Is that weird or is that really REALLY > confusing or what? I agree that the -import_records/2 directive without cross-module inlining would be confusing, but mod1 exporting a function record_info/2 (which anyone is free to write by hand, except under another name) is hardly confusing in itself. What the function would say is "this is what I (mod1) think a record #fred looks like." BR, Ulf W From klacke@REDACTED Wed Apr 5 09:38:01 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 05 Apr 2006 09:38:01 +0200 Subject: Send - buffer overrun In-Reply-To: References: Message-ID: <443373D9.3080701@hyber.org> Ulf Wiger (AL/EAB) wrote: > Not that I've used it myself, but the BIFs > > erlang:send_nosuspend(Dest, Msg), and > erlang:send(Dest, Msg, [nosuspend) > Wow, I wonder what kind of code would use that. Yikes, I couldn't send this message now, because if I did I would become suspended - instead I .. ... well do something else ... kindof. Uhhh, advanced. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From bertil.karlsson@REDACTED Wed Apr 5 10:23:40 2006 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Wed, 05 Apr 2006 10:23:40 +0200 Subject: Xmerl 1.0.3 prolog issue In-Reply-To: References: Message-ID: <44337E8C.7080306@ericsson.com> This is a bug that will be fixed in the next release of xmerl. /Bertil Heinrich Venter wrote: > Hi List > > I am using xmerl 1.0.3 to parse a large XML file into a new format that > is useful for my application. The callback module I created works, but > only if there is no prolog line in the XML file. I tried one of the > supplied callback modules, but got the same error message. If I take > out the prolog line, everything processes fine. > I tried the same thing with some of the XML files in the documentation > with the same results. Am I missing some parameter or configuration > setting? > > >> xmerl_eventp:file_sax("wurfl.xml", xmerl_xml,[],[]). >> > > =ERROR REPORT==== 4-Apr-2006::11:26:51 === > Error in process <0.45.0> with exit value: > {badarg,[{xmerl_scan,scan_prolog,3},{ > xmerl_scan,scan_document,2},{xmerl_scan,file,2},{erl_eval,do_apply,5},{s > hell,exp > rs,6},{shell,eval_loop,3}]} > > ** exited: {badarg,[{xmerl_scan,scan_prolog,3}, > {xmerl_scan,scan_document,2}, > {xmerl_scan,file,2}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > The first few lines of the XML file is > > > > > ... > > Thanks > > -]-[einrich > From mats.cronqvist@REDACTED Wed Apr 5 10:08:46 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 05 Apr 2006 10:08:46 +0200 Subject: Child modules draft feedback wanted In-Reply-To: <200604050527.k355R0C4004953@atlas.otago.ac.nz> References: <200604050527.k355R0C4004953@atlas.otago.ac.nz> Message-ID: <44337B0E.9000306@ericsson.com> Richard A. O'Keefe wrote: > [...] > This is one of the things that the -export_to(Module, Functions) > directive I proposed, oh, must have been in 1997, was to have > accomplished. this is a nice idea. how would it be enforced? > "Ulf Wiger \(AL/EAB\)" wrote: > [...] > exporting the pseudo function record_info/2 would > mean that some helper code could be written a lot > more cleanly. > [...] > I see very few disadvantages with doing this, > as the preprocessor has reserved both the name > and semantics of the record_info/2 function. > > To me it certainly violates the principle of least surprise. > Here I am writing mod2, and want to use #fred from mod1. And I > am now allowed to import it from mod1, and I'm allowed to ask > about it at run time, but I'm not allowed to use it in my source > code. Is that weird or is that really REALLY confusing or what? this paragraph is confusing me. the function mod1:record_info(fred) tells you what mod1 thinks fred looks like. how is that confusing? btw, the "helper code" ulf refers to is a tool i wanted to write for the AXD. the tool would query all modules in the system about what they think various records looks like, and warn about discrepancies. (in our build system it's entirely possible that mod1 and mod2 both use #fred, but disagree on its definition.) mats From matthias@REDACTED Wed Apr 5 10:46:03 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 5 Apr 2006 10:46:03 +0200 Subject: Send - buffer overrun In-Reply-To: <443373D9.3080701@hyber.org> References: <443373D9.3080701@hyber.org> Message-ID: <17459.33739.567222.618120@antilipe.corelatus.se> > > erlang:send_nosuspend(Dest, Msg), and > Wow, > > I wonder what kind of code would use that. > Yikes, I couldn't send this message now, because > if I did I would become suspended - instead I .. > ... well do something else ... kindof. > > Uhhh, advanced. The problem pops up every time you have a TCP socket where blocking indicates failure. In that case, the "something else" is "just close the socket". Crops up quite often if you work with real-time data. Matthias From ulf.wiger@REDACTED Wed Apr 5 09:49:58 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 5 Apr 2006 09:49:58 +0200 Subject: Send - buffer overrun Message-ID: Claes Wikstrom wrote: > > Ulf Wiger (AL/EAB) wrote: > > > Not that I've used it myself, but the BIFs > > > > erlang:send_nosuspend(Dest, Msg), and > > erlang:send(Dest, Msg, [nosuspend) > > Wow, > > I wonder what kind of code would use that. I thought I would find it in the code for rpc:abcast/2, but it had another obscure construct: abcast(Name, Mess) -> abcast([node() | nodes()], Name, Mess). abcast([Node|Tail], Name, Mess) -> Dest = {Name,Node}, case catch erlang:send(Dest, Mess, [noconnect]) of noconnect -> spawn(erlang, send, [Dest,Mess]); _ -> ok end, abcast(Tail, Name, Mess); abcast([], _,_) -> abcast. I recall the reason for this. We were using rpc:abcast/2 for doing event broadcast, but in the event of comm problems, each send operation could suspend for as much as 10 seconds. While this was fine, we had rather that it didn't suspend the unsuspecting caller, who specifically didn't care about the result (hence abcast). An obvious alternative would have been to spawn a process for each send operation in abcast. AFAIR, this was considered unattractive at the time, but processes were a precious commodity back then. (: BR, Ulf W From yerl@REDACTED Wed Apr 5 11:56:20 2006 From: yerl@REDACTED (yerl@REDACTED) Date: Wed, 5 Apr 2006 11:56:20 +0200 Subject: Erlang process management Message-ID: Hi All! I'm looking for any docs, papers or links about how Erlang creates process and manages them. Could any one show me where can I find those stuffs in the OTP source code. Thanks in advance Ycrux From sanjaya@REDACTED Wed Apr 5 13:40:18 2006 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Wed, 5 Apr 2006 17:40:18 +0600 Subject: Erlang process management References: Message-ID: <005701c658a5$b71fa3b0$9a0a10ac@wavenet.lk> Yes, I hope this will help full for me as well. I have sent a post today under "optimize the use of erlang processes ????" also related to this area. But still don't get any reply from anyone :( If there are any docs related to Erlang process management it will be helpfull. Thanks, Sanjaya Vitharana ----- Original Message ----- From: To: Sent: Wednesday, 05 April 2006 03:56 pm Subject: Erlang process management > Hi All! > > I'm looking for any docs, papers or links about how Erlang creates > process and manages them. > > Could any one show me where can I find those stuffs in the OTP source code. > > Thanks in advance > Ycrux > > From mikpe@REDACTED Wed Apr 5 15:19:33 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 5 Apr 2006 15:19:33 +0200 (MEST) Subject: hipe segmentation fault Message-ID: <200604051319.k35DJXWm001902@alkaid.it.uu.se> Date: Mon, 03 Apr 2006 10:30:15 -0400, Serge Aleynikov wrote: > Ops... Sorry, this test case was taken from Rickard Green's post on > profiling P11B smp scheduling support. I wanted to run it on multi-cpu > host, and installed R10B-10 and P11B releases with and without hipe. ... > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] > > Eshell V5.4.13 (abort with ^G) > 1> c(big, [native]). > {ok,big} > 2> big:bang(4). > Segmentation fault (core dumped) ... > (gdb) bt > #0 0x08aae41c in ?? () > #1 0x080f0f63 in x86_call_to_native () at hipe/hipe_x86_glue.S:42 > #2 0x00000000 in ?? () > (gdb) > > ... > > Looking at hipe_x86_glue.S:42: > > x86_call_to_native: > ENTER_FROM_C > /* get argument registers */ > LOAD_ARG_REGS > /* call the target */ > NSP_CALL(*P_NCALLEE(P)) <-- Failing here > > I'm not sure what this call does, but maybe Mikael can give a clue. This is the entry point for BEAM calling a native-compiled function. NSP_CALL() currently expands to a plain "call" instruction; it's a macro so we can experiment with and measure other ways of performing calls and returns. I'm unable to reproduce your problem here. The closest machine we have to yours is a dual HT P4 Xeon of the older 32-bit only type, running FC4 user-space on a custom 2.6.9-34 RHEL4 kernel, and things just work. Your test case also works on an Athlon64 running the same FC4/RHEL4 combo in pure 64-bit mode. It would help if you could run beam from gdb (easiest is to attach to it, otherwise you have to set up several environment variables), and print the exact location of the program counter at the crash, list the surrounding assembler code, print the registers, and also the print the contents of "P" (print *p in a C frame, print *(Process*)$ebp ought to do the same in assembler mode). /Mikael From orbitz@REDACTED Wed Apr 5 18:21:35 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Wed, 5 Apr 2006 12:21:35 -0400 Subject: Erlang process management In-Reply-To: References: Message-ID: <92F25253-3DC2-47F1-B852-A67AB6A4E46E@ezabel.com> http://ortdotlove.net/docs/erlang-doc/design_principles-5.4.12.pdf On Apr 5, 2006, at 5:56 AM, yerl@REDACTED wrote: > Hi All! > > I'm looking for any docs, papers or links about how Erlang creates > process and manages them. > > Could any one show me where can I find those stuffs in the OTP > source code. > > Thanks in advance > Ycrux > From yerl@REDACTED Wed Apr 5 18:35:36 2006 From: yerl@REDACTED (yerl@REDACTED) Date: Wed, 5 Apr 2006 18:35:36 +0200 Subject: Erlang process management Message-ID: Thanks for the link, I already read it. May be my question wasn't really clear, I'm intrested by the process creation internals, management, the algorithms behind the scene for handling large number of process, async communication ... Thank again /ycrux ----Message d'origine---- >Copie ?: erlang-questions@REDACTED >De: orbitz@REDACTED >Sujet: Re: Erlang process management >Date: Wed, 5 Apr 2006 12:21:35 -0400 >A: yerl@REDACTED > >http://ortdotlove.net/docs/erlang-doc/design_principles-5.4.12.pdf > >On Apr 5, 2006, at 5:56 AM, yerl@REDACTED wrote: > >> Hi All! >> >> I'm looking for any docs, papers or links about how Erlang creates >> process and manages them. >> >> Could any one show me where can I find those stuffs in the OTP >> source code. >> >> Thanks in advance >> Ycrux >> > > From rpettit@REDACTED Wed Apr 5 18:46:33 2006 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 5 Apr 2006 11:46:33 -0500 Subject: Erlang process management In-Reply-To: References: Message-ID: <20060405164633.GA22515@vailsys.com> On Wed, Apr 05, 2006 at 06:35:36PM +0200, yerl@REDACTED wrote: > Thanks for the link, I already read it. > > May be my question wasn't really clear, I'm intrested by the process creation internals, management, the algorithms behind the scene for handling large number of process, async communication ... Why not download the latest OTP release and comb through the sources--it is a learning experience and may be the quickest, most accurate way to answer your own question. In doing so you will also no doubt stumble on some neat tricks used by the "masters" which aren't necessarily spelled out in any doc. Just a suggestion. -Rick > ----Message d'origine---- > >Copie ?: erlang-questions@REDACTED > >De: orbitz@REDACTED > >Sujet: Re: Erlang process management > >Date: Wed, 5 Apr 2006 12:21:35 -0400 > >A: yerl@REDACTED > > > >http://ortdotlove.net/docs/erlang-doc/design_principles-5.4.12.pdf > > > >On Apr 5, 2006, at 5:56 AM, yerl@REDACTED wrote: > > > >> Hi All! > >> > >> I'm looking for any docs, papers or links about how Erlang creates > >> process and manages them. > >> > >> Could any one show me where can I find those stuffs in the OTP > >> source code. > >> > >> Thanks in advance > >> Ycrux > >> > > > > > From serge@REDACTED Wed Apr 5 19:54:14 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 05 Apr 2006 13:54:14 -0400 Subject: hipe segmentation fault In-Reply-To: <200604051319.k35DJXWm001902@alkaid.it.uu.se> References: <200604051319.k35DJXWm001902@alkaid.it.uu.se> Message-ID: <44340446.1010108@hq.idt.net> Mikael, Here's a bunch of info you requested. Let's continue this discussion outside of the mailing list's scope, and just post the resolution when/if it's available. Regards, Serge (gdb) where #0 0x08aae424 in ?? () #1 0x080f0f63 in x86_call_to_native () at hipe/hipe_x86_glue.S:42 #2 0x00000000 in ?? () Current instruction: (gdb) p/x $pc $2 = 0x8aae424 Next instruction: (gdb) x/i $pc 0x8aae424: lea 0xffffff78(%esp),%ebx (gdb) list 42 NSP_CALL(*P_NCALLEE(P)) 43 /* 44 * We export this return address so that hipe_mode_switch() can discover 45 * when native code tailcalls emulated code. 46 * 47 * This is where native code returns to emulated code. 48 */ 49 nbif_return: 50 movl %eax, P_ARG0(P) # save retval 51 movl $HIPE_MODE_SWITCH_RES_RETURN, %eax (gdb) disas 0x08aae424 No function contains specified address. (gdb) disas 0x080f0f63 Dump of assembler code for function nbif_return: 0x080f0f63 : mov %eax,0x4c(%ebp) 0x080f0f66 : mov $0x5,%eax End of assembler dump. (gdb) info registers eax 0x4f 79 ecx 0xb7d568e9 -1210750743 edx 0x578b 22411 ebx 0xb7eca674 -1209227660 esp 0x8ab059c 0x8ab059c ebp 0xb7eca674 0xb7eca674 esi 0xb7d52980 -1210766976 edi 0x18 24 eip 0x8aae424 0x8aae424 eflags 0x10286 66182 cs 0x73 115 ss 0x7b 123 ds 0x7b 123 es 0x7b 123 fs 0x0 0 gs 0x33 51 (gdb) print *(Process*)$ebp $1 = {htop = 0xb7d52980, stop = 0xb7d52a30, heap = 0xb7d52108, hend = 0xb7d52a90, heap_sz = 610, min_heap_size = 233, hipe = { nsp = 0x8ab05a0, nstack = 0x8ab03a0, nstend = 0x8ab05a0, ncallee = 0x8aae424, closure = 11, nstgraylim = 0x0, nstblacklim = 0x0, ngra = 0, ncsp = 0xbffff46c, narity = 0}, arity = 0, arg_reg = 0xb7eca6c0, max_arg_reg = 6, def_arg_reg = { 79, 22411, 3084216553, 135076450, 0, 1000}, cp = 0x81b18b8, i = 0x0, catches = 0, fcalls = 600, status = 3, rstatus = 0, rcount = 0, id = 499, prio = 2, skipped = 0, reds = 968, error_handler = 6859, tracer_proc = 4294967291, group_leader = 387, flags = 0, fvalue = 4294967291, freason = 848, ftrace = 4294967291, dist_entry = 0x0, tm = {next = 0x0, slot = 0, count = 0, active = 0, timeout = 0, cancel = 0, arg = 0x0}, next = 0x0, reg = 0x0, nlinks = 0xb7ecacdc, monitors = 0x0, msg = { first = 0x0, last = 0xb7eca750, save = 0xb7eca750, len = 0}, bif_timers = 0x0, dictionary = 0x0, debug_dictionary = 0x0, ct = 0x0, seq_trace_clock = 0, seq_trace_lastcnt = 0, seq_trace_token = 4294967291, initial = {6731, 22411, 2}, current = 0x0, parent = 403, started = 1144245940, high_water = 0xb7d52604, old_hend = 0xb7d513c8, old_htop = 0xb7d50aa0, old_heap = 0xb7d50a40, gen_gcs = 4, max_gen_gcs = 65535, off_heap = {mso = 0x0, funs = 0xb7d52944, externals = 0x0, overhead = 0}, mbuf = 0x0, mbuf_sz = 0, arith_heap = 0x0, arith_avail = 0} Mikael Pettersson wrote: > Date: Mon, 03 Apr 2006 10:30:15 -0400, Serge Aleynikov wrote: > >>Ops... Sorry, this test case was taken from Rickard Green's post on >>profiling P11B smp scheduling support. I wanted to run it on multi-cpu >>host, and installed R10B-10 and P11B releases with and without hipe. > > ... > >>Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] >> >>Eshell V5.4.13 (abort with ^G) >>1> c(big, [native]). >>{ok,big} >>2> big:bang(4). >>Segmentation fault (core dumped) > > ... > >>(gdb) bt >>#0 0x08aae41c in ?? () >>#1 0x080f0f63 in x86_call_to_native () at hipe/hipe_x86_glue.S:42 >>#2 0x00000000 in ?? () >>(gdb) >> >>... >> >>Looking at hipe_x86_glue.S:42: >> >>x86_call_to_native: >> ENTER_FROM_C >> /* get argument registers */ >> LOAD_ARG_REGS >> /* call the target */ >> NSP_CALL(*P_NCALLEE(P)) <-- Failing here >> >>I'm not sure what this call does, but maybe Mikael can give a clue. > > > This is the entry point for BEAM calling a native-compiled function. > NSP_CALL() currently expands to a plain "call" instruction; it's a macro so > we can experiment with and measure other ways of performing calls and returns. > > I'm unable to reproduce your problem here. The closest machine we > have to yours is a dual HT P4 Xeon of the older 32-bit only type, > running FC4 user-space on a custom 2.6.9-34 RHEL4 kernel, and things > just work. Your test case also works on an Athlon64 running the same > FC4/RHEL4 combo in pure 64-bit mode. > > It would help if you could run beam from gdb (easiest is to attach to > it, otherwise you have to set up several environment variables), and > print the exact location of the program counter at the crash, list the > surrounding assembler code, print the registers, and also the print the > contents of "P" (print *p in a C frame, print *(Process*)$ebp ought to > do the same in assembler mode). > > /Mikael > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From tty@REDACTED Wed Apr 5 20:47:53 2006 From: tty@REDACTED (tty@REDACTED) Date: Wed, 5 Apr 2006 14:47:53 -0400 Subject: Defining records at runtime Message-ID: Hello folks, Is there a way of defining records at runtime which usable by QLC ? I currently allow the user to define mnesia tables on the fly. e.g: new_table(Table, Attrs) -> mnesia:create_table(Table, [... {attributes, Attrs}]). new_entry(Table, Vals) -> Record = list_to_tuple([Table] ++ Vals), mnesia:dirty_write(Record). However while doing a query I can not write: query(Table, Attr, MatchVal) -> QH = qlc:q([P || P <- mnesia:table(Table), P#Table.Attr == MatchVal]), ... since the Table record does not actually exist. I get around that by finding the index of Attr and doing 'elements(Index, P) == MatchVal' instead. It would simplify my code if I could define records at runtime and avoid having to keep track of the location of a particular attribute. Any ideas ? Thanks t From ryanobjc@REDACTED Thu Apr 6 01:33:33 2006 From: ryanobjc@REDACTED (Ryan Rawson) Date: Wed, 5 Apr 2006 16:33:33 -0700 Subject: Anyone use Erlang and stow? Message-ID: <78568af10604051633k7597254bv6c6b9c8b2c0ba160@mail.gmail.com> Looks like the configure/build system as it stands does not allow you to install erlang into a different directory than it will eventually run out of. This should prevent Erlang from out of the box being compatible with RPM, DEB and any package management system, including stow. Anyone else solve this problem? I've tried make install prefix= and INSTALL_PREFIX= but the build scripts keep on embeddeding that path in all the shell scripts. -ryan From orbitz@REDACTED Thu Apr 6 02:34:22 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Wed, 5 Apr 2006 20:34:22 -0400 Subject: Defining records at runtime In-Reply-To: References: Message-ID: Well a record is really just a tuple where the first element is the name of the record. The compiler just does the mapping for you for extracting the elements by name. On Apr 5, 2006, at 2:47 PM, tty@REDACTED wrote: > Hello folks, > > Is there a way of defining records at runtime which usable by QLC ? > I currently allow the user to define mnesia tables on the fly. e.g: > > new_table(Table, Attrs) -> > mnesia:create_table(Table, [... {attributes, Attrs}]). > > new_entry(Table, Vals) -> > Record = list_to_tuple([Table] ++ Vals), > mnesia:dirty_write(Record). > > However while doing a query I can not write: > > query(Table, Attr, MatchVal) -> > QH = qlc:q([P || P <- mnesia:table(Table), P#Table.Attr == > MatchVal]), > ... > > since the Table record does not actually exist. I get around that > by finding the > index of Attr and doing 'elements(Index, P) == MatchVal' instead. > It would simplify my code if I could define records at runtime and > avoid having to keep track of the location of a particular attribute. > > Any ideas ? > > Thanks > > t From rlenglet@REDACTED Thu Apr 6 03:20:14 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Thu, 6 Apr 2006 10:20:14 +0900 Subject: Anyone use Erlang and stow? In-Reply-To: <78568af10604051633k7597254bv6c6b9c8b2c0ba160@mail.gmail.com> References: <78568af10604051633k7597254bv6c6b9c8b2c0ba160@mail.gmail.com> Message-ID: <200604061020.14915.rlenglet@users.forge.objectweb.org> Ryan Rawson wrote: > Looks like the configure/build system as it stands does not > allow you to install erlang into a different directory than it > will eventually run out of. This should prevent Erlang from > out of the box being compatible with RPM, DEB and any package > management system, including stow. Yes, using instead the behaviour of INSTALL_DIR would have been better, as in Makefiles generated by GNU Automake. But Erlang's Makefiles already use an INSTALL_DIR variable for another purpose... > Anyone else solve this problem? I've tried make install > prefix= and INSTALL_PREFIX= but the build scripts keep on > embeddeding that path in all the shell scripts. The official Debian package uses INSTALL_PREFIX when calling make install, and then it modifies the start scripts before constructing the package, something like that: for f in $INSTALL_PREFIX$PREFIX/lib/erlang/bin/* ; do sed -i -e 's,ROOTDIR=.*,ROOTDIR='"$PREFIX/lib/erlang/," $f done -- Romain LENGLET From serge@REDACTED Thu Apr 6 03:31:37 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 05 Apr 2006 21:31:37 -0400 Subject: Anyone use Erlang and stow? In-Reply-To: <78568af10604051633k7597254bv6c6b9c8b2c0ba160@mail.gmail.com> References: <78568af10604051633k7597254bv6c6b9c8b2c0ba160@mail.gmail.com> Message-ID: <44346F79.8090901@hq.idt.net> Perhaps I didn't fully understand your question, but wouldn't the followig work for you: ./configure --prefix=/install/to/path Serge Ryan Rawson wrote: > Looks like the configure/build system as it stands does not allow you > to install erlang into a different directory than it will eventually > run out of. This should prevent Erlang from out of the box being > compatible with RPM, DEB and any package management system, including > stow. > > Anyone else solve this problem? I've tried make install prefix= and > INSTALL_PREFIX= but the build scripts keep on embeddeding that path in > all the shell scripts. > > -ryan > From rlenglet@REDACTED Thu Apr 6 04:07:59 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Thu, 6 Apr 2006 11:07:59 +0900 Subject: Anyone use Erlang and stow? In-Reply-To: <44346F79.8090901@hq.idt.net> References: <78568af10604051633k7597254bv6c6b9c8b2c0ba160@mail.gmail.com> <44346F79.8090901@hq.idt.net> Message-ID: <200604061107.59427.rlenglet@users.forge.objectweb.org> Serge Aleynikov wrote: > Perhaps I didn't fully understand your question, but wouldn't > the followig work for you: > > ./configure --prefix=/install/to/path The problem, is that INSTALL_PREFIX is functionally equivalent to prefix, whereas it should instead be like the traditional DESTDIR variable. Cf.: http://www.gnu.org/software/automake/manual/html_mono/automake.html#Install And look for DESTDIR in the GNU Coding Standards: http://www.gnu.org/prep/standards/standards.html > Ryan Rawson wrote: > > Looks like the configure/build system as it stands does not > > allow you to install erlang into a different directory than > > it will eventually run out of. This should prevent Erlang > > from out of the box being compatible with RPM, DEB and any > > package management system, including stow. > > > > Anyone else solve this problem? I've tried make install > > prefix= and INSTALL_PREFIX= but the build scripts keep on > > embeddeding that path in all the shell scripts. -- Romain LENGLET From ok@REDACTED Thu Apr 6 04:50:03 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 6 Apr 2006 14:50:03 +1200 (NZST) Subject: cross-module inlining - just in time? Message-ID: <200604060250.k362o3VN516274@atlas.otago.ac.nz> "Vlad Dumitrescu" wrote: Unfortunately, this isn't entirely true from a practical point of view: changing a record definition and recompiling just one module using it is a sure way to make everything crash ;-) Yes, but that's the whole problem I am trying to solve: the thing those record definitions are in is *NOT* a module! Likewise, changing the API of some service would also require recompilation of all clients. True. But there really is a big difference here. With cross-module inlining, a change that *doesn't* affect the API of anything can cause problems. Even interface checking (harder than it should be in Erlang because you don't have to _declare_ your intention to use some function from another module) and even type checking (using any of the type checkers I've heard of for Erlang), while they WOULD help with API changes, DON'T help with cross-module inlining. So the problem is already here, only it doesn't manifest itself at compile time, but at run time. But the problem I am talking about is one that manifests itself at run time, not at compile time. From ok@REDACTED Thu Apr 6 05:47:36 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 6 Apr 2006 15:47:36 +1200 (NZST) Subject: Child modules draft feedback wanted Message-ID: <200604060347.k363ladx018732@atlas.otago.ac.nz> I wrote: > This is one of the things that the -export_to(Module, Functions) > directive I proposed, oh, must have been in 1997, was to have > accomplished. Mats Cronqvist asked: this is a nice idea. how would it be enforced? There are two people in this office trying to empty it out so that the carpet layers can come in on Monday morning. They want to take the computers away tomorrow morning. So please forgive me for not giving a detailed answer. Oh help, my wife has just run saying she needs to go to the doctor and I'll have to pick the girls up from choir. Here's a quick sketch. As it happens, it's _not_ what I really had in mind; it's just to make a point. Secondly, a call to M:F(X1, ..., Xn) is basically erlang:'_n'(X1, ..., Xn, ?MODULE, F, M). where /* In erlang: */ '_n'(X1, ...., Xn, Importer, F, mod1) -> mod1:'_n'(X1, ..., Xn, Importer, F). /* In mod1: */ '_n'(X1, ..., Xn, _, f) -> f(X1, ..., Xn); if -export([f/n]) with no restriction. '_n'(X1, ..., Xn, mod2, f) -> f(X1, ..., Xn); if -export_to(mod2, [f/n]) If a module exports a function to more than one other module, you get more than one clause here, but I expected that to be rare. I'm also assuming, in this sketch, fast hashed clause selection. > "Ulf Wiger \(AL/EAB\)" wrote: > [...] > exporting the pseudo function record_info/2 would > mean that some helper code could be written a lot > more cleanly. This confused me, because it had never occurred to me that this function wasn't already exported, AND because the context was EXPORTING RECORD DECLARATIONS SO THEY COULD BE USED AS RECORD SYNTAX. Apparently there was a change of subject here which I didn't pick up, this paragraph is confusing me. the function mod1:record_info(fred) tells you what mod1 thinks fred looks like. how is that confusing? Because who is "you"? Because if you are *expecting* to get records from fred, why don't you *know* why they look like? Because this can expose details about record structures that fred has no intention of revealing to any other module. And so on. btw, the "helper code" ulf refers to is a tool i wanted to write for the AXD. the tool would query all modules in the system about what they think various records looks like, and warn about discrepancies. (in our build system it's entirely possible that mod1 and mod2 both use #fred, but disagree on its definition.) That's nice, but it is something you can _already_ do, no? Not trivially, but as long as you have the .beam files, it's _possible_ to get that information. Records are wrong. That's the problem. They just don't "fit" the way Erlang does things, and never did. From parault2@REDACTED Thu Apr 6 06:48:52 2006 From: parault2@REDACTED (Patrice Rault) Date: Thu, 06 Apr 2006 06:48:52 +0200 Subject: hipe segmentation fault In-Reply-To: <200604051319.k35DJXWm001902@alkaid.it.uu.se> References: <200604051319.k35DJXWm001902@alkaid.it.uu.se> Message-ID: <1144298932.2703.12.camel@localhost.localdomain> Le mercredi 05 avril 2006 ? 15:19 +0200, Mikael Pettersson a ?crit : > Date: Mon, 03 Apr 2006 10:30:15 -0400, Serge Aleynikov wrote: > > Ops... Sorry, this test case was taken from Rickard Green's post on > > profiling P11B smp scheduling support. I wanted to run it on multi-cpu > > host, and installed R10B-10 and P11B releases with and without hipe. > ... > > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] > > > > Eshell V5.4.13 (abort with ^G) > > 1> c(big, [native]). > > {ok,big} > > 2> big:bang(4). > > Segmentation fault (core dumped) > ... > > (gdb) bt > > #0 0x08aae41c in ?? () > > #1 0x080f0f63 in x86_call_to_native () at hipe/hipe_x86_glue.S:42 > > #2 0x00000000 in ?? () > > (gdb) > > > > ... > > > > Looking at hipe_x86_glue.S:42: > > > > x86_call_to_native: > > ENTER_FROM_C > > /* get argument registers */ > > LOAD_ARG_REGS > > /* call the target */ > > NSP_CALL(*P_NCALLEE(P)) <-- Failing here > > > > I'm not sure what this call does, but maybe Mikael can give a clue. > > This is the entry point for BEAM calling a native-compiled function. > NSP_CALL() currently expands to a plain "call" instruction; it's a macro so > we can experiment with and measure other ways of performing calls and returns. > > I'm unable to reproduce your problem here. The closest machine we > have to yours is a dual HT P4 Xeon of the older 32-bit only type, > running FC4 user-space on a custom 2.6.9-34 RHEL4 kernel, and things > just work. Your test case also works on an Athlon64 running the same > FC4/RHEL4 combo in pure 64-bit mode. > > It would help if you could run beam from gdb (easiest is to attach to > it, otherwise you have to set up several environment variables), and > print the exact location of the program counter at the crash, list the > surrounding assembler code, print the registers, and also the print the > contents of "P" (print *p in a C frame, print *(Process*)$ebp ought to > do the same in assembler mode). > > /Mikael Hello, For information, on FC5 with kernel 2.6.16-1.2080_FC5.i686 Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] Eshell V5.4.13 (abort with ^G) 1> c(big). {ok,big} 2> big:bang(4). 3.20000e-5 3> c(big, [native]). {ok,big} 4> big:bang(4). Erreur de segmentation And i got segmentation fault with ALL native compilations. But with a switch to kernel 2.6.15-1.2054_FC5.i686, native compilation work. Regards. From mats.cronqvist@REDACTED Thu Apr 6 09:18:00 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 06 Apr 2006 09:18:00 +0200 Subject: Child modules draft feedback wanted In-Reply-To: <200604060347.k363ladx018732@atlas.otago.ac.nz> References: <200604060347.k363ladx018732@atlas.otago.ac.nz> Message-ID: <4434C0A8.5030503@ericsson.com> Richard A. O'Keefe wrote: > Mats Cronqvist said: > btw, the "helper code" ulf refers to is a tool i wanted to > write for the AXD. the tool would query all modules in the > system about what they think various records looks like, and > warn about discrepancies. (in our build system it's entirely > possible that mod1 and mod2 both use #fred, but disagree on its > definition.) > > That's nice, but it is something you can _already_ do, no? Not trivially, > but as long as you have the .beam files, it's _possible_ to get that > information. not in any way i'm aware of :< > Records are wrong. That's the problem. They just don't "fit" the way > Erlang does things, and never did. sad but true (to quote Metallica). mats From hasse@REDACTED Thu Apr 6 09:01:00 2006 From: hasse@REDACTED (Hans Bolinder) Date: Thu, 6 Apr 2006 09:01:00 +0200 Subject: Defining records at runtime In-Reply-To: References: Message-ID: <17460.48300.366228.846434@gargle.gargle.HOWL> [tty@REDACTED:] > I get around that by finding the index of Attr and doing > 'element(Index, P) == MatchVal' instead. Be careful to use =:=/2 rather than ==/2, or QLC will scan the whole table even if Index is the key position or there is an index on position Index. Use ==/2 only if you want comparison rather than matching. For example, "2.0 == 2" is true, but "2.0 =:= 2" is false. Best regards, Hans Bolinder, Erlang/OTP From fritchie@REDACTED Thu Apr 6 10:00:26 2006 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 06 Apr 2006 03:00:26 -0500 Subject: Mnesia, table updates, and (UNIX) process bloat Message-ID: <200604060800.k3680Qil025377@snookles.snookles.com> Greetings. I'm a bit puzzled about R10B-9's behavior regarding process size. My platform is: Erlang R10B-9 Linux EL3 + AMD Opteron (64-bit build), 4GB RAM Mnesia disc_copies tables Heavy update workload (I'm trying 2000 updates/sec, it's a benchmark workload right now), where a fragmented Mnesia table is updated with something approximately the same size. Odd behavior: The UNIX process size grows from a comfortable 2.4GB to an uncomfortable 3.2-3.5GB in under 1 hour. The 2,000 update/sec benchmark slows down once the OS's VM paging starts, and then things go rapidly downhill. According to erlang:memory(), the 'total' and 'maximum' values only grow about 100MB during the 1 hour. But the UNIX process size grows by roughly 1GB, sometimes a touch more. Things I've tried: 1. Adding "+r" to the "erl" command line 2. Adding "+Mim true +MEas aobf" to the "erl" command line 3. Switching from 'set' to 'ordered_set' tables 4. Using an Erlang virtual machine with elib_malloc support This smells like fragmentation of malloc's heap. #1 is documented (I forget where, at the moment) to avoid/slow fragmentation for some kinds of ETS workloads. Too bad it doesn't work for me. Trying the "address order best fit" scheme didn't help, nor #3 or #4. Is there a silver bullet for this particular problem, or am I sentenced to go spelunking with the "instrument" module and/or valgrind's "memcheck" and/or .... (I'm actually waiting for 16GB to arrive, but I'm wondering if this is going to eat 16GB eventually.) -Scott (*) Is the elib_malloc configure option broken? Just using "./configure --enable-elib-malloc" didn't seem to be enough, because erlang:system_info(elib_malloc) would always return false. I kludged a Makefile (without RTFM'ing or the fine mailing list archives) to add the necessary compiler "-D" bits, then added extra stuff to erl_bif_info.c's "erts_system_version" string to help verify that I'd defined the right CPP symbols. Perhaps I used too much brute force? From mikpe@REDACTED Thu Apr 6 10:54:16 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 6 Apr 2006 10:54:16 +0200 Subject: hipe segmentation fault In-Reply-To: <1144298932.2703.12.camel@localhost.localdomain> References: <200604051319.k35DJXWm001902@alkaid.it.uu.se> <1144298932.2703.12.camel@localhost.localdomain> Message-ID: <17460.55096.445760.190920@alkaid.it.uu.se> Patrice Rault writes: > For information, on FC5 with kernel 2.6.16-1.2080_FC5.i686 > > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] > > Eshell V5.4.13 (abort with ^G) > 1> c(big). > {ok,big} > 2> big:bang(4). > 3.20000e-5 > 3> c(big, [native]). > {ok,big} > 4> big:bang(4). > Erreur de segmentation > > And i got segmentation fault with ALL native compilations. > But with a switch to kernel 2.6.15-1.2054_FC5.i686, native compilation > work. Does this Erlang system have the glibc-2.4 fix applied? (See below.) Does the problem go away if you build without thread support? There was a bug in the sigaltstack() setup, but I've only seen the ill effects on the SMP system, never on R10B. The fact that a 2.6.16-based kernel breaks while a pre-2.6.16 kernel works hints strongly at the sigaltstack() bug. /Mikael --- otp-0317/erts/emulator/hipe/hipe_x86_signal.c.~1~ 2005-10-21 14:02:57.000000000 +0200 +++ otp-0317/erts/emulator/hipe/hipe_x86_signal.c 2006-03-27 12:30:08.000000000 +0200 @@ -27,7 +27,7 @@ #include #include "hipe_signal.h" -#if __GLIBC__ == 2 && __GLIBC_MINOR__ == 3 +#if __GLIBC__ == 2 && (__GLIBC_MINOR__ == 3 || __GLIBC_MINOR__ == 4) /* See comment below for glibc 2.2. */ #ifndef __USE_GNU #define __USE_GNU /* to un-hide RTLD_NEXT */ From jaiswal.vikash@REDACTED Thu Apr 6 10:18:21 2006 From: jaiswal.vikash@REDACTED (jaiswal.vikash@REDACTED) Date: Thu, 6 Apr 2006 13:48:21 +0530 Subject: gs error Message-ID: Hello sir , I've developed a mini project using erlang . This project makes use of many graphical windows which have been developed using the graphical server ' gs ' . At some instances when I'm moving the windows ( resizing or changing the position ) , all the windows are simply vanishing . At this point I'm getting the following error : gs error: =ERROR REPORT==== 6-Apr-2006::09:37:10 === Error in process <0.35.0> on node 'abc@REDACTED' with exit value: {{badmatch,[]},[{gstk_db,opt,3},{gstk_window,event,5},{gstk,doit,2},{gst k,loop,1}]} user backend died reason {{badmatch,[]},[{gstk_db,opt,3},{gstk_window,event,5},{gstk,doit,2},{gst k,loop,1}]} It would be highly appreciative if you could suggest what could be the cause for this error . Here I would like to mention that I've handled the configuration( resizing or changing the position ) of the windows using { gs,W, configure,_,_ } . Is this an error from the graphical server ( gs ) itself ? What does 'user backend died reason' mean ? Thanks & Regards , Vikash The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mickael.remond@REDACTED Thu Apr 6 12:25:14 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 6 Apr 2006 12:25:14 +0200 Subject: Mnesia, table updates, and (UNIX) process bloat In-Reply-To: <200604060800.k3680Qil025377@snookles.snookles.com> References: <200604060800.k3680Qil025377@snookles.snookles.com> Message-ID: <20060406102514.GA22230@memphis.ilius.fr> Hello Scott, * Scott Lystig Fritchie [2006-04-06 03:00:26 -0500]: > This smells like fragmentation of malloc's heap. #1 is documented (I > forget where, at the moment) to avoid/slow fragmentation for some > kinds of ETS workloads. Too bad it doesn't work for me. Trying the > "address order best fit" scheme didn't help, nor #3 or #4. > > Is there a silver bullet for this particular problem, or am I > sentenced to go spelunking with the "instrument" module and/or > valgrind's "memcheck" and/or .... Good description of the problem. We are working on exactly the same problem, but we did not found any answer to this problem yet. We are interested in experience exchange regarding the instrumentation analysis. For now, we did not find a good way to avoid this fragmentation, which is causing a loss of memory use. It is not technically speaking a memory leak, but behave like a memory leak and, as a consequence memory occupation keeps on growing indefinitely. Memory fragmentation and how to avoid it is definitely a hard problem. -- Micka?l R?mond http://www.process-one.net/ From gunilla@REDACTED Thu Apr 6 14:33:31 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Thu, 06 Apr 2006 14:33:31 +0200 Subject: gs error In-Reply-To: References: Message-ID: <44350A9B.4020007@erix.ericsson.se> Hi, Yes, it is a message from the GS application itself. GS is logically divided into a frontend and a backend, the frontend handling communication with the user and the backend communication with Tcl/Tk. With the backend gone, calls to for example gs:read/2 will return a value (an error tuple) but all windows are gone and no new windows can be created. Call gs:start/0 to start a new backend. The problem seems to be that a 'configure' event should be created for a window, but there for some reason is no configure option stored in the database for that window object. I'm not sure why this happens, if I can find the time I will take a closer look at the code later. If you have some more specific information about when the problem occurs, or if you are able to reproduce it, please let me know. Regards, Gunilla jaiswal.vikash@REDACTED wrote: > Hello sir , > > > > I've developed a mini project using erlang . This project > makes use of many graphical windows which have been developed using the > graphical server ' gs ' . > > At some instances when I'm moving the windows ( resizing or changing the > position ) , all the windows are simply vanishing . > > At this point I'm getting the following error : > > > > > > gs error: > > =ERROR REPORT==== 6-Apr-2006::09:37:10 === > > Error in process <0.35.0> on node 'abc@REDACTED' > with exit value: > {{badmatch,[]},[{gstk_db,opt,3},{gstk_window,event,5},{gstk,doit,2},{gstk,loop,1}]} > > > > user backend died reason > {{badmatch,[]},[{gstk_db,opt,3},{gstk_window,event,5},{gstk,doit,2},{gstk,loop,1}]} > > > > > > It would be highly appreciative if you could suggest what > could be the cause for this error . > > Here I would like to mention that I've handled the configuration( > resizing or changing the position ) of the windows using { gs,W, > configure,_,_ } . > > Is this an error from the graphical server ( gs ) itself ? > > What does 'user backend died reason' mean ? > > > > > > > > Thanks & Regards , > > Vikash > > > The information contained in this electronic message and any attachments > to this message are intended for the exclusive use of the addressee(s) > and may contain proprietary, confidential or privileged information. If > you are not the intended recipient, you should not disseminate, > distribute or copy this e-mail. Please notify the sender immediately and > destroy all copies of this message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The recipient > should check this email and any attachments for the presence of viruses. > The company accepts no liability for any damage caused by any virus > transmitted by this email. > > www.wipro.com > From jeadea@REDACTED Thu Apr 6 17:21:33 2006 From: jeadea@REDACTED (JeaDea) Date: Thu, 6 Apr 2006 17:21:33 +0200 Subject: duplicate a image with gs In-Reply-To: References: Message-ID: I would like to try to strech a image (gif) to simulate a progress bar. How can i do that with gs ? Else how can i duplicate this image without reloading it from the original file each time the progress bar increase? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Thu Apr 6 21:44:07 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 6 Apr 2006 21:44:07 +0200 Subject: hipe segmentation fault In-Reply-To: <44340446.1010108@hq.idt.net> References: <200604051319.k35DJXWm001902@alkaid.it.uu.se> <44340446.1010108@hq.idt.net> Message-ID: <17461.28551.177582.208872@alkaid.it.uu.se> Serge Aleynikov writes: > Mikael, > > Here's a bunch of info you requested. Let's continue this discussion > outside of the mailing list's scope, and just post the resolution > when/if it's available. > [gdb session omitted] Problem solved. According to the gdb session everything looked OK, yet the code couldn't be executed. It turns out that with the fairly new processor model Serge is using, the Linux kernel makes normal data memory non-executable by default. We've seen this long ago on AMD64 machines with 64-bit kernels, but never before on machines with 32-bit kernels. The solution is to adapt the specially written AMD64 code memory allocation routines for use on x86 as well. The patch below solves this problem. It's been checked in on the R11 development branch and should be applied to R10B-10 as well. /Mikael --- otp-0330/erts/emulator/hipe/hipe_amd64.h.~1~ 2005-12-15 12:29:52.000000000 +0100 +++ otp-0330/erts/emulator/hipe/hipe_amd64.h 2006-04-06 17:46:19.000000000 +0200 @@ -14,10 +14,6 @@ #define hipe_arch_name am_amd64 -/* for hipe_bifs_enter_code_2 */ -extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); -#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) - extern const Uint sse2_fnegate_mask[]; #endif /* HIPE_AMD64_H */ --- otp-0330/erts/emulator/hipe/hipe_x86.c.~1~ 2005-12-15 12:29:53.000000000 +0100 +++ otp-0330/erts/emulator/hipe/hipe_x86.c 2006-04-06 19:23:59.000000000 +0200 @@ -50,6 +50,114 @@ return 0; } +/* + * Memory allocator for executable code. + * + * This is required on x86 because some combinations + * of Linux kernels and CPU generations default to + * non-executable memory mappings, causing ordinary + * malloc() memory to be non-executable. + */ +static unsigned int code_bytes; +static char *code_next; + +#if 0 /* change to non-zero to get allocation statistics at exit() */ +static unsigned int total_mapped, nr_joins, nr_splits, total_alloc, nr_allocs, nr_large, total_lost; +static unsigned int atexit_done; + +static void alloc_code_stats(void) +{ + printf("\r\nalloc_code_stats: %u bytes mapped, %u joins, %u splits, %u bytes allocated, %u average alloc, %u large allocs, %u bytes lost\r\n", + total_mapped, nr_joins, nr_splits, total_alloc, nr_allocs ? total_alloc/nr_allocs : 0, nr_large, total_lost); +} + +static void atexit_alloc_code_stats(void) +{ + if (!atexit_done) { + atexit_done = 1; + (void)atexit(alloc_code_stats); + } +} + +#define ALLOC_CODE_STATS(X) do{X;}while(0) +#else +#define ALLOC_CODE_STATS(X) do{}while(0) +#endif + +static void morecore(unsigned int alloc_bytes) +{ + unsigned int map_bytes; + char *map_hint, *map_start; + + /* Page-align the amount to allocate. */ + map_bytes = (alloc_bytes + 4095) & ~4095; + + /* Round up small allocations. */ + if (map_bytes < 1024*1024) + map_bytes = 1024*1024; + else + ALLOC_CODE_STATS(++nr_large); + + /* Create a new memory mapping, ensuring it is executable + and in the low 2GB of the address space. Also attempt + to make it adjacent to the previous mapping. */ + map_hint = code_next + code_bytes; + if ((unsigned long)map_hint & 4095) + abort(); + map_start = mmap(map_hint, map_bytes, + PROT_EXEC|PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS +#ifdef __x86_64__ + |MAP_32BIT +#endif + , + -1, 0); + if (map_start == MAP_FAILED) { + perror("mmap"); + abort(); + } + ALLOC_CODE_STATS(total_mapped += map_bytes); + + /* Merge adjacent mappings, so the trailing portion of the previous + mapping isn't lost. In practice this is quite successful. */ + if (map_start == map_hint) { + ALLOC_CODE_STATS(++nr_joins); + code_bytes += map_bytes; + } else { + ALLOC_CODE_STATS(++nr_splits); + ALLOC_CODE_STATS(total_lost += code_bytes); + code_next = map_start; + code_bytes = map_bytes; + } + + ALLOC_CODE_STATS(atexit_alloc_code_stats()); +} + +static void *alloc_code(unsigned int alloc_bytes) +{ + void *res; + + /* Align function entries. */ + alloc_bytes = (alloc_bytes + 3) & ~3; + + if (code_bytes < alloc_bytes) + morecore(alloc_bytes); + ALLOC_CODE_STATS(++nr_allocs); + ALLOC_CODE_STATS(total_alloc += alloc_bytes); + res = code_next; + code_next += alloc_bytes; + code_bytes -= alloc_bytes; + return res; +} + +void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p) +{ + if (is_not_nil(callees)) + return NULL; + *trampolines = NIL; + return alloc_code(nrbytes); +} + /* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() and hipe_bif0.c:hipe_make_stub() */ void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) @@ -76,7 +184,7 @@ 16 + /* 16 when both offsets are 8-bit */ (P_BEAM_IP >= 128 ? 3 : 0) + (P_ARITY >= 128 ? 3 : 0); - codep = code = erts_alloc(ERTS_ALC_T_HIPE, codeSize); + codep = code = alloc_code(codeSize); /* movl $beamAddress, P_BEAM_IP(%ebp); 3 or 6 bytes, plus 4 */ codep[0] = 0xc7; --- otp-0330/erts/emulator/hipe/hipe_x86.h.~1~ 2005-12-15 12:29:53.000000000 +0100 +++ otp-0330/erts/emulator/hipe/hipe_x86.h 2006-04-06 17:45:48.000000000 +0200 @@ -39,4 +39,8 @@ extern void nbif_inc_stack_0(void); extern void nbif_handle_fp_exception(void); +/* for hipe_bifs_enter_code_2 */ +extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); +#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) + #endif /* HIPE_X86_H */ From serge@REDACTED Thu Apr 6 21:53:57 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 06 Apr 2006 15:53:57 -0400 Subject: hipe segmentation fault In-Reply-To: <17461.28551.177582.208872@alkaid.it.uu.se> References: <200604051319.k35DJXWm001902@alkaid.it.uu.se> <44340446.1010108@hq.idt.net> <17461.28551.177582.208872@alkaid.it.uu.se> Message-ID: <443571D5.3090004@hq.idt.net> Mikael, Thanks for the quick turnaround! Serge Mikael Pettersson wrote: > Serge Aleynikov writes: > > Mikael, > > > > Here's a bunch of info you requested. Let's continue this discussion > > outside of the mailing list's scope, and just post the resolution > > when/if it's available. > > > [gdb session omitted] > > Problem solved. According to the gdb session everything looked OK, > yet the code couldn't be executed. It turns out that with the fairly > new processor model Serge is using, the Linux kernel makes normal > data memory non-executable by default. We've seen this long ago on > AMD64 machines with 64-bit kernels, but never before on machines with > 32-bit kernels. The solution is to adapt the specially written AMD64 > code memory allocation routines for use on x86 as well. > > The patch below solves this problem. It's been checked in on the R11 > development branch and should be applied to R10B-10 as well. > > /Mikael > > --- otp-0330/erts/emulator/hipe/hipe_amd64.h.~1~ 2005-12-15 12:29:52.000000000 +0100 > +++ otp-0330/erts/emulator/hipe/hipe_amd64.h 2006-04-06 17:46:19.000000000 +0200 > @@ -14,10 +14,6 @@ > > #define hipe_arch_name am_amd64 > > -/* for hipe_bifs_enter_code_2 */ > -extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); > -#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) > - > extern const Uint sse2_fnegate_mask[]; > > #endif /* HIPE_AMD64_H */ > --- otp-0330/erts/emulator/hipe/hipe_x86.c.~1~ 2005-12-15 12:29:53.000000000 +0100 > +++ otp-0330/erts/emulator/hipe/hipe_x86.c 2006-04-06 19:23:59.000000000 +0200 > @@ -50,6 +50,114 @@ > return 0; > } > > +/* > + * Memory allocator for executable code. > + * > + * This is required on x86 because some combinations > + * of Linux kernels and CPU generations default to > + * non-executable memory mappings, causing ordinary > + * malloc() memory to be non-executable. > + */ > +static unsigned int code_bytes; > +static char *code_next; > + > +#if 0 /* change to non-zero to get allocation statistics at exit() */ > +static unsigned int total_mapped, nr_joins, nr_splits, total_alloc, nr_allocs, nr_large, total_lost; > +static unsigned int atexit_done; > + > +static void alloc_code_stats(void) > +{ > + printf("\r\nalloc_code_stats: %u bytes mapped, %u joins, %u splits, %u bytes allocated, %u average alloc, %u large allocs, %u bytes lost\r\n", > + total_mapped, nr_joins, nr_splits, total_alloc, nr_allocs ? total_alloc/nr_allocs : 0, nr_large, total_lost); > +} > + > +static void atexit_alloc_code_stats(void) > +{ > + if (!atexit_done) { > + atexit_done = 1; > + (void)atexit(alloc_code_stats); > + } > +} > + > +#define ALLOC_CODE_STATS(X) do{X;}while(0) > +#else > +#define ALLOC_CODE_STATS(X) do{}while(0) > +#endif > + > +static void morecore(unsigned int alloc_bytes) > +{ > + unsigned int map_bytes; > + char *map_hint, *map_start; > + > + /* Page-align the amount to allocate. */ > + map_bytes = (alloc_bytes + 4095) & ~4095; > + > + /* Round up small allocations. */ > + if (map_bytes < 1024*1024) > + map_bytes = 1024*1024; > + else > + ALLOC_CODE_STATS(++nr_large); > + > + /* Create a new memory mapping, ensuring it is executable > + and in the low 2GB of the address space. Also attempt > + to make it adjacent to the previous mapping. */ > + map_hint = code_next + code_bytes; > + if ((unsigned long)map_hint & 4095) > + abort(); > + map_start = mmap(map_hint, map_bytes, > + PROT_EXEC|PROT_READ|PROT_WRITE, > + MAP_PRIVATE|MAP_ANONYMOUS > +#ifdef __x86_64__ > + |MAP_32BIT > +#endif > + , > + -1, 0); > + if (map_start == MAP_FAILED) { > + perror("mmap"); > + abort(); > + } > + ALLOC_CODE_STATS(total_mapped += map_bytes); > + > + /* Merge adjacent mappings, so the trailing portion of the previous > + mapping isn't lost. In practice this is quite successful. */ > + if (map_start == map_hint) { > + ALLOC_CODE_STATS(++nr_joins); > + code_bytes += map_bytes; > + } else { > + ALLOC_CODE_STATS(++nr_splits); > + ALLOC_CODE_STATS(total_lost += code_bytes); > + code_next = map_start; > + code_bytes = map_bytes; > + } > + > + ALLOC_CODE_STATS(atexit_alloc_code_stats()); > +} > + > +static void *alloc_code(unsigned int alloc_bytes) > +{ > + void *res; > + > + /* Align function entries. */ > + alloc_bytes = (alloc_bytes + 3) & ~3; > + > + if (code_bytes < alloc_bytes) > + morecore(alloc_bytes); > + ALLOC_CODE_STATS(++nr_allocs); > + ALLOC_CODE_STATS(total_alloc += alloc_bytes); > + res = code_next; > + code_next += alloc_bytes; > + code_bytes -= alloc_bytes; > + return res; > +} > + > +void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p) > +{ > + if (is_not_nil(callees)) > + return NULL; > + *trampolines = NIL; > + return alloc_code(nrbytes); > +} > + > /* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() > and hipe_bif0.c:hipe_make_stub() */ > void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) > @@ -76,7 +184,7 @@ > 16 + /* 16 when both offsets are 8-bit */ > (P_BEAM_IP >= 128 ? 3 : 0) + > (P_ARITY >= 128 ? 3 : 0); > - codep = code = erts_alloc(ERTS_ALC_T_HIPE, codeSize); > + codep = code = alloc_code(codeSize); > > /* movl $beamAddress, P_BEAM_IP(%ebp); 3 or 6 bytes, plus 4 */ > codep[0] = 0xc7; > --- otp-0330/erts/emulator/hipe/hipe_x86.h.~1~ 2005-12-15 12:29:53.000000000 +0100 > +++ otp-0330/erts/emulator/hipe/hipe_x86.h 2006-04-06 17:45:48.000000000 +0200 > @@ -39,4 +39,8 @@ > extern void nbif_inc_stack_0(void); > extern void nbif_handle_fp_exception(void); > > +/* for hipe_bifs_enter_code_2 */ > +extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); > +#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) > + > #endif /* HIPE_X86_H */ > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From hokan.stenholm@REDACTED Thu Apr 6 22:45:12 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Thu, 06 Apr 2006 22:45:12 +0200 Subject: duplicate a image with gs In-Reply-To: References: Message-ID: <44357DD8.3070506@bredband.net> JeaDea wrote: >I would like to try to strech a image (gif) > That's sadly not possible in gs. > to simulate a progress bar. How >can i do that with gs ? >Else how can i duplicate this image without reloading it from the original >file each time the progress bar increase? > > > The best choice is probably to use a series of image or rectangle objects (in a canvas), to render the progess bar as a number of tiles (increments). Another possiblity is to render the progressbar as a single solid color rectangle. From ok@REDACTED Fri Apr 7 00:46:34 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 7 Apr 2006 10:46:34 +1200 (NZST) Subject: Child modules draft feedback wanted Message-ID: <200604062246.k36MkYJs023534@atlas.otago.ac.nz> I was under the misapprehension that the record_info information was there in the Beam files, just not exported in the usual way. What a drongo! Sorry. From fritchie@REDACTED Fri Apr 7 04:59:11 2006 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 06 Apr 2006 21:59:11 -0500 Subject: Mnesia, table updates, and (UNIX) process bloat In-Reply-To: Message of "Thu, 06 Apr 2006 03:00:26 CDT." <200604060800.k3680Qil025377@snookles.snookles.com> Message-ID: <200604070259.k372xBcE070781@snookles.snookles.com> In a followup to my own message ... I have a plea for the Gods of the virtual machine. Assume that I start the VM with "+Mim true" to get the memory instrumentation enabled. Then assume I call the following function and see this result: erlang:system_info({allocator, binary_alloc}) ==> [... {mbcs,[{blocks,5609521,5617526,5617526}, {blocks_size,646515824,674100920,674100920}, {carriers,135,137,137}, {mseg_alloc_carriers,134}, {sys_alloc_carriers,1}, {carriers_size,679624744,690110504,690110504}, {mseg_alloc_carriers_size,679493632}, {sys_alloc_carriers_size,131112}]}, ...] As far as I can tell (without actually looking at source code to verify ... ): 'blocks' = number of items allocated out of this "carrier" (to use the names from the "erts_alloc" document). Each item is an individual binary term? Larger than 64 bytes and thus allocated using the binary_alloc allocator? 'blocks_size' = sum of the size of each 'blocks' item. Perhaps plus a little extra fudge/overhead/alignment? 'carriers_size' = sum of all memory region sizes allocated for this carrier OK, if those guesses are correct ... then if I see the 'blocks' and 'blocks_size' values increasing without an eventual decrease(*) then I definitely have some >64 byte binary term somewhere that's still referenced, right? (*) Presumably due to garbage collection. -Scott From parault2@REDACTED Fri Apr 7 06:58:51 2006 From: parault2@REDACTED (Patrice Rault) Date: Fri, 07 Apr 2006 06:58:51 +0200 Subject: hipe segmentation fault Message-ID: <1144385932.17543.6.camel@localhost.localdomain> Le jeudi 06 avril 2006 ? 21:44 +0200, Mikael Pettersson a ?crit : > Serge Aleynikov writes: > > Mikael, > > > > Here's a bunch of info you requested. Let's continue this discussion > > outside of the mailing list's scope, and just post the resolution > > when/if it's available. > > > [gdb session omitted] > ...................... > ...................... Hello, Now, native compilation works with applied patches. Many thanks. From ulf.wiger@REDACTED Fri Apr 7 09:08:41 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 7 Apr 2006 09:08:41 +0200 Subject: exporting record_info (RE: Child modules draft feedback wanted) Message-ID: Richard O'Keefe wrote: > > I was under the misapprehension that the record_info > information was there in the Beam files, just not exported in > the usual way. What a drongo! Sorry. Well, they are... or can be, at least. erlc +debug_info hashdb.erl erl 1> beam_lib:chunks("hashdb.beam",[abstract_code]). {ok,{hashdb,[{abstract_code,{raw_abstract_v1, [{attribute,1,file,{"./hashdb.erl",1}}, ... 2> {ok,{_,[{abstract_code,{_, Forms}}]}} = v(1). {ok,{hashdb,[{abstract_code,{raw_abstract_v1, ... 3> [A || {attribute,_,record,_} =A <- Forms]. [{attribute,58, record, {hashdb,[{record_field,58,{atom,58,name}}, {record_field,59,{atom,59,size},{integer,59,0}}, {record_field,60,{atom,60,type},{atom,60,set}}, {record_field,61,{atom,61,keypos},{integer,61,1}}, {record_field,62,{atom,62,fix},{atom,62,false}}, {record_field,63,{atom,63,n},{integer,63,16}}, {record_field,64,{atom,64,maxn},{integer,64,16}}, {record_field,65, {atom,65,bso}, {op,65, 'div', {integer,65,16}, {integer,65|...}}}, {record_field,66, {atom,66,exp_size}, {op,66, '*', {integer,66|...}, {integer|...}}}, {record_field,67, {atom,67,con_size}, {op,67,'*',{integer,67|...},{integer|...}}}, {record_field,68, {atom,68,segs}, {call,68,{atom,68|...},[{...}]}}]}}] 4> BR, Ulf W From mats.cronqvist@REDACTED Fri Apr 7 09:16:20 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 07 Apr 2006 09:16:20 +0200 Subject: exporting record_info (RE: Child modules draft feedback wanted) In-Reply-To: References: Message-ID: <443611C4.7040109@ericsson.com> Ulf Wiger (AL/EAB) wrote: > Richard O'Keefe wrote: > >>I was under the misapprehension that the record_info >>information was there in the Beam files, just not exported in >>the usual way. What a drongo! Sorry. > > > Well, they are... or can be, at least. > > erlc +debug_info hashdb.erl > using debug_info is cheating. From ulf.wiger@REDACTED Fri Apr 7 10:00:00 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 7 Apr 2006 10:00:00 +0200 Subject: exporting record_info (RE: Child modules draft feedback wanted) Message-ID: Mats Cronqvist wrote: > > using debug_info is cheating. Indeed, and using debug_info on sites where the source code is not available is ... non-trivial. I was just replying to the observation that record info were not available in the .beam file. Under certain circumstances, they can be. The debug_info can also be encrypted, and decrypted on the fly. This can be used e.g. to be able to include debug_info and leave it throughout the testing. Then you can release the beam code unchanged but without the key that makes the debug info accessible. /Ulf W From samuel@REDACTED Fri Apr 7 12:02:49 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 7 Apr 2006 12:02:49 +0200 Subject: gen_server documentation Message-ID: <20060407100249.GA1526@nodo2.lambdastream.com> Hi, Documentation for gen_server:start_link reads: " If Module:init/1 fails with Reason, the function returns {error,Reason}. If Module:init/1 returns {stop,Reason} or ignore, the process is terminated and the function returns {error,Reason} or ignore, respectively" For gen_server:start it refers to previous definition. However, both functions behaves differently: in both cases start_link exits, while start returns {error, Reason}: %%%% -module(dumb_server). -behaviour(gen_server). -export([init/1]). init(_) -> exit(foo). 1> gen_server:start_link(dumb_server, [], []). ** exited: foo ** 2> gen_server:start(dumb_server, [], []). {error,foo} %%%% -module(dumb_server). -behaviour(gen_server). -export([init/1]). init(_) -> {stop, foo}. 1> gen_server:start_link(dumb_server, [], []). ** exited: foo ** 2> gen_server:start(dumb_server, [], []). {error,foo} -- Samuel From matthias@REDACTED Fri Apr 7 12:20:00 2006 From: matthias@REDACTED (Matthias Lang) Date: Fri, 7 Apr 2006 12:20:00 +0200 Subject: gen_server documentation In-Reply-To: <20060407100249.GA1526@nodo2.lambdastream.com> References: <20060407100249.GA1526@nodo2.lambdastream.com> Message-ID: <17462.15568.900811.290039@antilipe.corelatus.se> The documentation is correct. You have overlooked how linked processes must behave. If you link a process and then exit, then your process (the shell, in your example) will exit too. If you don't want that to happen, you can either not link in the first place, or you can trap exits. Example: 3> process_flag(trap_exit, true). false 4> gen_server:start_link(dumb_server, [], []). {error,foo} Matthias ---------------------------------------------------------------------- Samuel Rivas writes: > Hi, > > Documentation for gen_server:start_link reads: > > " If Module:init/1 fails with Reason, the function returns > {error,Reason}. If Module:init/1 returns {stop,Reason} or ignore, the > process is terminated and the function returns {error,Reason} or ignore, > respectively" > > For gen_server:start it refers to previous definition. > > However, both functions behaves differently: in both cases start_link exits, > while start returns {error, Reason}: > > > %%%% > -module(dumb_server). > -behaviour(gen_server). > > -export([init/1]). > > init(_) -> > exit(foo). > > > 1> gen_server:start_link(dumb_server, [], []). > ** exited: foo ** > 2> gen_server:start(dumb_server, [], []). > {error,foo} > > %%%% > -module(dumb_server). > -behaviour(gen_server). > > -export([init/1]). > > init(_) -> > {stop, foo}. > > > 1> gen_server:start_link(dumb_server, [], []). > ** exited: foo ** > 2> gen_server:start(dumb_server, [], []). > {error,foo} > > -- > Samuel From ft@REDACTED Fri Apr 7 12:20:46 2006 From: ft@REDACTED (Fredrik Thulin) Date: Fri, 7 Apr 2006 12:20:46 +0200 Subject: gen_server documentation In-Reply-To: <20060407100249.GA1526@nodo2.lambdastream.com> References: <20060407100249.GA1526@nodo2.lambdastream.com> Message-ID: <200604071220.46716.ft@it.su.se> On Friday 07 April 2006 12:02, Samuel Rivas wrote: > Hi, > > Documentation for gen_server:start_link reads: > > " If Module:init/1 fails with Reason, the function returns > {error,Reason}. If Module:init/1 returns {stop,Reason} or ignore, > the process is terminated and the function returns {error,Reason} or > ignore, respectively" > > For gen_server:start it refers to previous definition. > > However, both functions behaves differently: in both cases > start_link exits, while start returns {error, Reason}: > > > %%%% > -module(dumb_server). > -behaviour(gen_server). > > -export([init/1]). > > init(_) -> > exit(foo). > > > 1> gen_server:start_link(dumb_server, [], []). > ** exited: foo ** > 2> gen_server:start(dumb_server, [], []). > {error,foo} What happens here is that the started gen_server _terminates_ - it does not return a value to the process that starts it (your shell). Since you use start_link the termination of the gen_server is propagated to your shell, which also terminates. This can be observed by checking the pid of the shell before and after. 1> self(). <0.30.0> 2> gen_server:start_link(dumb_server, [], []). ** exited: foo ** 3> self(). <0.34.0> 4> You see? Different pid, because you crashed the first shell process. /Fredrik From samuel@REDACTED Fri Apr 7 12:42:00 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 7 Apr 2006 12:42:00 +0200 Subject: gen_server documentation In-Reply-To: <17462.15568.900811.290039@antilipe.corelatus.se> References: <20060407100249.GA1526@nodo2.lambdastream.com> <17462.15568.900811.290039@antilipe.corelatus.se> Message-ID: <20060407104200.GA2339@nodo2.lambdastream.com> Matthias Lang wrote: > > The documentation is correct. > > You have overlooked how linked processes must behave. If you link a > process and then exit, then your process (the shell, in your example) > will exit too. > > If you don't want that to happen, you can either not link in the first > place, or you can trap exits. Example: > > 3> process_flag(trap_exit, true). > false > 4> gen_server:start_link(dumb_server, [], []). > {error,foo} > > > Matthias > Mmm yes. I was somehow deceived into believing that gen_server was supposed to catch init exits and return {error, Reason}. Obviously, you can't catch an spawn_link. My fault. PS: I didn't say the documentation was wrong. I said that those functions behave differently, so I was right (just by chance) :) -- Samuel From jeadea@REDACTED Fri Apr 7 12:50:57 2006 From: jeadea@REDACTED (JeaDea) Date: Fri, 7 Apr 2006 12:50:57 +0200 Subject: duplicate a image with gs In-Reply-To: <44357DD8.3070506@bredband.net> References: <44357DD8.3070506@bredband.net> Message-ID: > > The best choice is probably to use a series of image or rectangle > objects (in a canvas), to render the progess bar as a number of tiles > (increments). It's what i did, but to reload image cause a out of memory, and how can i use the garbage collector or other solution for to avoid overloading memory ? Another possiblity is to render the progressbar as a single solid color > rectangle. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From invisio22@REDACTED Fri Apr 7 13:21:03 2006 From: invisio22@REDACTED (Eric Shun) Date: Fri, 7 Apr 2006 13:21:03 +0200 Subject: Nth element of a Tuple Message-ID: <3f9db9f20604070421q19f3a639hc1cfc8a83c4637d8@mail.gmail.com> I would like to write a function that replaces the Nth element of a tuple. exemple: replace(3,{a,b,c,d},a) returns {a,b,a,c,d} how can I do that? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri Apr 7 13:32:05 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 07 Apr 2006 13:32:05 +0200 Subject: Nth element of a Tuple In-Reply-To: <3f9db9f20604070421q19f3a639hc1cfc8a83c4637d8@mail.gmail.com> References: <3f9db9f20604070421q19f3a639hc1cfc8a83c4637d8@mail.gmail.com> Message-ID: <44364DB5.8000806@ericsson.com> On 2006-04-07 13:21, Eric Shun wrote: > I would like to write a function that replaces the Nth element of a tuple. > exemple: > > replace(3,{a,b,c,d},a) returns {a,b,a,c,d} > > how can I do that? erlang:setelement(Index, Tuple1, Value) -> Tuple2 Types Index = 1..size(Tuple1) Tuple1 = Tuple2 = tuple() Value = term() Returns a tuple which is a copy of the argument Tuple1 with the element given by the integer argument Index (the first element is the element with index 1) replaced by the argument Value. >setelement(2, {10, green, bottles}, red). {10, red, bottles} bengt From vlad_dumitrescu@REDACTED Fri Apr 7 13:37:53 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 7 Apr 2006 13:37:53 +0200 Subject: Nth element of a Tuple In-Reply-To: <3f9db9f20604070421q19f3a639hc1cfc8a83c4637d8@mail.gmail.com> Message-ID: Hi, Replace element, or insert element? Your example does an insert... I would like to write a function that replaces the Nth element of a tuple. exemple: replace(3,{a,b,c,d},a) returns {a,b,a,c,d} how can I do that? Replacing is done easily with erlang:setelement(3,{a,b,c,d},a). Inserting is not so easy, one would be to convert to a list, insert in it and convert back to a tuple. Regards, Vlad From bmk@REDACTED Fri Apr 7 16:40:03 2006 From: bmk@REDACTED (Micael Karlberg) Date: Fri, 07 Apr 2006 16:40:03 +0200 Subject: SNMP Message-ID: <443679C3.5070806@erix.ericsson.se> Hi, Is anybody using the mib OTP-SNMPEA-MIB provided by the snmp application? /BMK From serge@REDACTED Fri Apr 7 18:02:02 2006 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 07 Apr 2006 12:02:02 -0400 Subject: SNMP In-Reply-To: <443679C3.5070806@erix.ericsson.se> References: <443679C3.5070806@erix.ericsson.se> Message-ID: <44368CFA.4020603@hq.idt.net> Yes, we do. Micael Karlberg wrote: > Hi, > > Is anybody using the mib OTP-SNMPEA-MIB provided > by the snmp application? > > /BMK > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From olgeni@REDACTED Sun Apr 9 00:59:34 2006 From: olgeni@REDACTED (Jimmy Olgeni) Date: Sun, 9 Apr 2006 00:59:34 +0200 (CEST) Subject: SNMP In-Reply-To: <443679C3.5070806@erix.ericsson.se> References: <443679C3.5070806@erix.ericsson.se> Message-ID: <20060409004723.C2995@olgeni.olgeni> On Fri, 7 Apr 2006, Micael Karlberg wrote: > Is anybody using the mib OTP-SNMPEA-MIB provided > by the snmp application? I use it in a couple of products. -- jimmy From jeremie@REDACTED Sun Apr 9 02:11:50 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Sun, 9 Apr 2006 02:11:50 +0200 Subject: ets or mnesia? In-Reply-To: <78568af10604041539r153664fdg97b5338dd3a7d728@mail.gmail.com> References: <2b7b425b0604041344v13bb6786i47ef9fcb8e34fe2@mail.gmail.com> <4432E6E0.2070009@hyber.org> <78568af10604041539r153664fdg97b5338dd3a7d728@mail.gmail.com> Message-ID: <2b7b425b0604081711r16a48e4dg511c8b2c8db6d08d@mail.gmail.com> Thank you for all your input. It seems the consensus would have me use ets. :-) Rich, I'm beginning to see that gen_server offers many of the things I need for my server, but as I've just begun Erlang (and as this is a project I've set myself specifically to get to know the basics of the language), I choose not to take any shortcuts. That, and the fact that gen_server seems pretty complicated, at this point!!! In any case, as you all have recommend, I am going through the doc for ets. As I am now only looking at ets:new, ets:lookup, ets:insert, ets:delete, as suggested by Rich, I find it much easier to focus (perhaps the abundance of calls is overwhelming!). --- After a few days of use, it turns out ets is exactly what I needed?a (simple) globally accessible table with key-lookup capabilities. Perfect! Thank you all very much. Kind Regards, J?r?mie -------------- next part -------------- An HTML attachment was scrubbed... URL: From gunilla@REDACTED Mon Apr 10 08:38:43 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Mon, 10 Apr 2006 08:38:43 +0200 Subject: gen_server documentation In-Reply-To: <20060407104200.GA2339@nodo2.lambdastream.com> References: <20060407100249.GA1526@nodo2.lambdastream.com> <17462.15568.900811.290039@antilipe.corelatus.se> <20060407104200.GA2339@nodo2.lambdastream.com> Message-ID: <4439FD73.1040303@erix.ericsson.se> Samuel Rivas wrote: > Matthias Lang wrote: >> The documentation is correct. >> >> You have overlooked how linked processes must behave. If you link a >> process and then exit, then your process (the shell, in your example) >> will exit too. >> >> If you don't want that to happen, you can either not link in the first >> place, or you can trap exits. Example: >> >> 3> process_flag(trap_exit, true). >> false >> 4> gen_server:start_link(dumb_server, [], []). >> {error,foo} >> >> >> Matthias >> > > Mmm yes. I was somehow deceived into believing that gen_server was supposed > to catch init exits and return {error, Reason}. The gen_server process *does* catch that the init/1 function exits. It reports this back to its starter and then terminates with exit reason = Reason. The start function, start/3 as well start_link/3, in this case *does* return {error, Reason}. > > Obviously, you can't catch an spawn_link. My fault. Well, you can, but there's no point in doing so. 'catch' catches an error *within* the context of a process. That is, 'catch spawn_link(...)' would only catch an exception raised within the spawn_link function itself (which won't happen), not an error within the new process created as a result of calling spawn_link. > > PS: I didn't say the documentation was wrong. I said that those > functions behave differently, so I was right (just by chance) :) The functions behave exactly the same, except for that gen_server:start_link/3 creates a link between the calling process and the gen_server process. As Matthias explained, you overlooked how linked processes behave. You have two processes here: the shell process and the gen_server process. In both cases, the gen_server process terminates with reason 'foo' and the start function returns {error, foo}. When you use gen_server:start_link/3, however, the shell process is linked to the gen_server. When the gen_server terminates, so does the shell process, before it has had the time to print out the return value {error, foo}. Regards, Gunilla From rasmussen.bryan@REDACTED Mon Apr 10 10:12:47 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Mon, 10 Apr 2006 10:12:47 +0200 Subject: mnesia delicious database structure Message-ID: <3bb44c6e0604100112n21d8b76fmaf46fd0476fca1e5@mail.gmail.com> I'm wondering if there is any documentation on matching common database structures to mnesia, for example canonical books -> authors examples? As I'm going to be doing a little del.icio.us clone for inhouse development soon, and will have to be doing a bunch of thinking about structures for doing that http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html does anyone have any inputs on the suggested structures, matching in Mnesia, or better ways to do it in Mnesia? this is of basically technical interest, I plan on using MysSQL, but was hoping that people would have some comments here that would improve my understanding of what Mnesia is useful for, and how to best use it in common development scenarios. Cheers, Bryan Rasmussen From rasmussen.bryan@REDACTED Mon Apr 10 10:39:54 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Mon, 10 Apr 2006 10:39:54 +0200 Subject: Danish OIO Service Oriented Infrastructure and Erlang Message-ID: <3bb44c6e0604100139t5d7327d8k3801258964f993cc@mail.gmail.com> I'm currently on a project that I think could benefit from possible usage of Erlang, the page for the project is at http://www.oio.dk/arkitektur/soa/infrastruktur this page is written in Danish although the descriptive documents it links to are English, so I have provided a translation beneath: OIO Serviceorienteret Infrastruktur is an initiative, that has as its object to develop a framework for exchange of business documents over the internet in a secure and trusted manner. This project is especially focussed on small and medium sized firms and governmental organizations. The Project is composed of 3 elements: An adressing mechanism, whereby service providers and their endpoints can be located. Registering of services are done via Danish CVR numbers (civil registry numbers) and eventually EAN-locations numbers. A web service profile - i.e. an interoperability profile. This Profile is a specification of a number of web service standards, which are combined with reference to specific business requirements. A software toolkit and reference implementation of a client - a so-called "message handler". This Software toolkit will be implemented both in Java and .Net platforms, so that software-providers and system integrators can easily provide support for the addressing mechanism and exhange of business documents as per the profile. If anyone has any comments on the architecture proposed, places where they can see Erlang fitting, arguments to be made for using Erlang, please pass them along. From erlang@REDACTED Mon Apr 10 11:34:22 2006 From: erlang@REDACTED (Peter Lund) Date: Mon, 10 Apr 2006 11:34:22 +0200 Subject: inet keepalive secs? Message-ID: <443A269E.50005@lundata.se> Checking the inet doc, I find that the keepalive parameter is only true | false Why not allow the user to specify an integer so I could specify my gen_tcp listening server to send keepalives every N seconds instead of the default value that is way to long? I tried the search function on erlang.org first but it crashed on me / did not work. /Peter From matt@REDACTED Mon Apr 10 17:04:27 2006 From: matt@REDACTED (Matthew McDonnell) Date: Mon, 10 Apr 2006 16:04:27 +0100 (BST) Subject: Basic experimental control in Erlang Message-ID: Hi, I have been working on an Erlang application to act as the interface layer between a high level experimental control program and low level hardware. The code is at a stage where it may be of some interest to others learning Erlang/OTP, so I have put it on the web at the link below (the bulk of the page is the problem description, links to code are at the bottom of the page in the Code section) http://www.matt-mcdonnell.com/code/code_erl/expt_otp/expt_otp.html There are two programs, both having equivalent functionality, one written in Erlang and the other written using the OTP behaviours. Each program starts: - a Pascal program that simulates a microcontroller under control from an external computer and randomly outputting data, - a port controller that controls access to the Pascal program - a GUI that communicates to the Pascal program through the port controller Basically, once you start the GUI you get a window with four sliders, the first three of which send data to the port, the last one plotting data received from the port. Not very exciting at the moment, but hopefully it will be soon. Still a bit buggy, most annoyingly the Pascal program dumps core when it exits. I think this is probably a Pascal problem rather than an Erlang one, but any solution, and indeed any comments in general, would be welcomed. Cheers, Matt Matt McDonnell Email: matt@REDACTED Web: http://www.matt-mcdonnell.com/ From garry@REDACTED Mon Apr 10 18:12:28 2006 From: garry@REDACTED (Garry Hodgson) Date: Mon, 10 Apr 2006 12:12:28 -0400 (EDT) Subject: ets or mnesia? In-Reply-To: <2b7b425b0604081711r16a48e4dg511c8b2c8db6d08d@mail.gmail.com> References: <2b7b425b0604081711r16a48e4dg511c8b2c8db6d08d@mail.gmail.com> Message-ID: <2006041012121144685548@k2.sage.att.com> "=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=" wrote: > Rich, I'm beginning to see that gen_server offers many of the things I need > for my server, but as I've just begun Erlang (and as this is a project I've > set myself specifically to get to know the basics of the language), I choose > not to take any shortcuts. That, and the fact that gen_server seems pretty > complicated, at this point!!! i flet exactly the same way when i built my first erlang system. didn't really understand OTP, and figured i wanted to learn the core language better by rolling my own. big mistake. i ended up spending a lot of effort building the same capabilities that OTP does 10 times better, and the result is not nearly so elegant or robust. admittedly, back then there was little useful information about using OTP, a situation that's getting a little better. it'd be much easier to go the OTP root now, with the various tutorials floating around. were i starting from scratch now, i might even make the right call. do what's right for you, but think hard about the things you're giving up that come essentially for free. ---- Garry Hodgson, Technical Consultant, AT&T Labs Can't you hear my lambs a callin'? Oh good shepherd won't you feed my sheep? From anders.nygren@REDACTED Tue Apr 11 00:27:33 2006 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 10 Apr 2006 17:27:33 -0500 Subject: mnesia is overloaded Message-ID: <200604101727.33953.anders.nygren@gmail.com> Hi Today something happened that I dont quite understand. We ran a test that was supposed to send 25000 messages, where every message leads to 5-10 mnesia writes. When the test was finished we found that only about 4000 of the messages were processed completely and there were no traces of the others. (There is of course a chance that we manage to screw something up on our own but tests with 1000-2000 messages have never had any problems.) The only messages we got in the log was couple of warnings from mnesia. Mnesia is overloaded: {dump_log,write_threshold} Searching the archives I found that this was discussed back in 2000 when Sean Hinde said in message http://www.erlang.org/ml-archive/erlang-questions/200007/msg00099.html "It also makes a big difference whether you have dump_log_load_regulation set to true or false. If true, the dumper process runs much more slowly which will make the error report more likely, If false the dumper runs at full speed but the emulator itself can pause noticeably while it waits for lots of disc intensive bifs to complete. I tend to run with it set to true as I need to guarantee read response times." Which sounds like true means to run the dumps at a lower priority. But the mnesia documentation says "Controls if the log dumps should be performed as fast as possible or if the dumper should do its own load regulation." Which is not exactly clear what true is supposed to mean. Is there any tuning that can be done to improve performance with lots of writes? The part that has me worried is that mnesia:info() showed that one table that is used as a persistant message queue had 25 records, but > mnesia:dirty_first(pq_msg). '$end_of_table' and adding new rows did not change it. After mnesia:stop(). mnesia:start(). It found the 25 queued messages again. Anders Nygren From dmitriid@REDACTED Tue Apr 11 10:39:18 2006 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Tue, 11 Apr 2006 11:39:18 +0300 Subject: Mnesia. Comlex queries. Best approach Message-ID: Let's suppose I have a database with more or less the following structure: -record(users, {id, login, full_name}). -record(messages, {id, user_id, title, read_flag}). -record(message_data, {mid, data}). And let's suppose I have 10 000 users and >100 000 messages and the messages table grows more or less rapidly, at a rate of at least 1 000+ messages a day. What is the best way to query the message_data table (from mnesia and erlang point of view)? With a combined query like [{User.full_name, Message.title, MessageBody.data} || User <- table(users), Message <- table(messages), MessageBody <- table(message_data), User.id == Message.user_id, MessageBody.mid == Message.id ] or by querying individual tables every time a new row from message_data is requested? Thank you From invisio22@REDACTED Tue Apr 11 11:54:33 2006 From: invisio22@REDACTED (Eric Shun) Date: Tue, 11 Apr 2006 11:54:33 +0200 Subject: duplicate a image with gs In-Reply-To: References: Message-ID: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> 2006/4/6, JeaDea : > > I would like to try to strech a image (gif) to simulate a progress bar. > How can i do that with gs ? > Is it really impossible??? In any other language you can do that!! -------------- next part -------------- An HTML attachment was scrubbed... URL: From pupeno@REDACTED Tue Apr 11 13:55:31 2006 From: pupeno@REDACTED (Pupeno) Date: Tue, 11 Apr 2006 13:55:31 +0200 Subject: duplicate a image with gs In-Reply-To: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> References: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> Message-ID: <1144756531.6241.73.camel@ulab.pupeno.com> On Tue, 2006-04-11 at 11:54 +0200, Eric Shun wrote: > 2006/4/6, JeaDea : > I would like to try to strech a image (gif) to simulate a > progress bar. How can i do that with gs ? > Is it really impossible??? In any other language you can do that!! Really ? How do you do it in C ? or in Lisp ? Using a library, it is not a feature of the language itself. And you can make a library to do that just as well on Erlang or you could even use a C library from Erlang. I think the answer of not being possible to stretch a gif is related to a particular library that was being used at the time. You may criticize the library but the library is not the language. Obviously adding the feature instead of criticizing would be much more productive. -- Pupeno http://pupeno.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From jaiswal.vikash@REDACTED Mon Apr 10 15:04:03 2006 From: jaiswal.vikash@REDACTED (vikash) Date: Mon, 10 Apr 2006 13:04:03 +0000 (UTC) Subject: gs error References: <44350A9B.4020007@erix.ericsson.se> Message-ID: Hi Gunilla , Thanks for your valuable comments. Since it is a GS application error, as you are suggesting, could you please suggest how this can be handled. Regards, Vikash From vlad.xx.dumitrescu@REDACTED Wed Apr 12 10:26:05 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Wed, 12 Apr 2006 10:26:05 +0200 Subject: Ets:update_counter doc Message-ID: <11498CB7D3FCB54897058DE63BE3897C0179749C@esealmw105.eemea.ericsson.se> Hi! The documentation for ets:update_counter should maybe be updated to state that badarg is also thrown if the counter to be updated happens to be the key. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeadea@REDACTED Wed Apr 12 10:42:14 2006 From: jeadea@REDACTED (JeaDea) Date: Wed, 12 Apr 2006 10:42:14 +0200 Subject: duplicate a image with gs In-Reply-To: <1144756531.6241.73.camel@ulab.pupeno.com> References: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> <1144756531.6241.73.camel@ulab.pupeno.com> Message-ID: > Really ? How do you do it in C ? or in Lisp ? This not the point. But, is there any solution to manualy unload or delete graphic components (or variables) in memory, for example like the function free in C ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Wed Apr 12 11:19:03 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 12 Apr 2006 11:19:03 +0200 Subject: duplicate a image with gs In-Reply-To: References: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> <1144756531.6241.73.camel@ulab.pupeno.com> Message-ID: <17468.50695.156492.790780@antilipe.corelatus.se> JeaDea writes: > This not the point. > But, is there any solution to manualy unload or delete graphic components > (or variables) in memory, for example like the function free in C ? Consider this C code: int f() { char my_image[8000]; g(my_image); /* here */ h(); } How would you "manually unload or delete" the variable 'd' at the point I marked with the comment "here"? Matthias From matthias@REDACTED Wed Apr 12 12:05:46 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 12 Apr 2006 12:05:46 +0200 Subject: duplicate a image with gs In-Reply-To: <17468.50695.156492.790780@antilipe.corelatus.se> References: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> <1144756531.6241.73.camel@ulab.pupeno.com> <17468.50695.156492.790780@antilipe.corelatus.se> Message-ID: <17468.53498.714529.522957@antilipe.corelatus.se> > > This not the point. > > But, is there any solution to manualy unload or delete graphic components > > (or variables) in memory, for example like the function free in C ? And now, in the vague hope of putting an end to this thread, here is some code which uses gs to make an animated progress bar. Matthias ---------------------------------------------------------------------- -module(progress). -export([go/0]). go() -> Top = gs:start(), W = gs:window(Top, {map, true}), C = gs:create(canvas, W, [{width, 100}, {height, 20}]), R1 = gs:create(rectangle, C, [{coords, [{0,1}, {0,10}]}, {fg, red}, {fill, red}]), R2 = gs:create(rectangle, C, [{coords, [{0,1}, {100,10}]}, {fg, green}, {fill, green}]), animate(R1, R2, 1), gs:stop(). animate(_R1, _R2, 100) -> done; animate(R1, R2, N) -> timer:sleep(100), gs:config(R1, [{coords, [{0,1}, {N,10}]}]), gs:config(R2, [{coords, [{N,1}, {100,10}]}]), animate(R1, R2, N + 1). From ulf.wiger@REDACTED Wed Apr 12 12:53:36 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 12 Apr 2006 12:53:36 +0200 Subject: erl_driver documentation Message-ID: Is there some errata concerning the erl_driver documentation? I'm trying to acquaint myself with the port_call() function and driver_output_term() functions. The first bug I noticed was that the type ErlDriverTerm should rather be ErlDrvTermData. Also, the example for driver_output_term(): ErlDriverBinary* bin = ... ErlDriverPort port = ... ErlDriverTerm spec[] = { ERL_DRV_ATOM, driver_mk_atom("tcp"), ERL_DRV_PORT, driver_mk_port(port), ERL_DRV_INT, 100, ERL_DRV_BINARY, bin, 50, 0, ERL_DRV_LIST, 2, ERL_DRV_TUPLE, 3, }; driver_output_term(port, spec, sizeof(spec) / sizeof(spec[0])); has a few things wrong with it, as far as I can tell. But my C programming is rusty to say the least, and I'm having to spend significant time comparing the manual with the sources and trying to figure out if they are consistent, or if it's just me. I noted that inet_drv.c has a different way of building the term array: ErlDrvTermData spec[6]; int i = 0; i = LOAD_ATOM(spec, i, am_tcp_closed); i = LOAD_PORT(spec, i, desc->inet.dport); i = LOAD_TUPLE(spec, i, 2); ASSERT(i <= 6); return driver_output_term(desc->inet.port, spec, i); (based on some local macros, e.g. #define LOAD_ATOM(vec, i, atom) \ (((vec)[(i)] = ERL_DRV_ATOM), \ ((vec)[(i)+1] = (atom)), \ (i+2)) ) Btw, some of the comments in erl_driver.h are also out of sync with the actual source. Just one example is the ErlDriverBinary (also shown above), which is really named ErlDrvBinary, but referred to in erl_driver.h (line 346) as ErlDriverBinary, and the ErlDriverTerm type above (which is really ErlDrvTermData) is referred to in the comments of erl_driver.h (line 327) as ErlDrvTerm. BR, /Ulf W From serge@REDACTED Wed Apr 12 20:59:39 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 12 Apr 2006 14:59:39 -0400 Subject: inet:ip/1 Message-ID: <443D4E1B.1000800@hq.idt.net> While playing with the inet:ip/1 function I noticed that it can take an argument containing less than four octets. What's the meaning of such a strange conversion like inet:ip("1.2.3")? 1> inet:ip("1.2.3.4"). {ok,{1,2,3,4}} 2> inet:ip("1.2.3"). {ok,{1,2,0,3}} 3> inet:ip("1.2"). {ok,{1,0,0,2}} 4> inet:ip("1"). {ok,{0,0,0,1}} Serge -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From serge@REDACTED Wed Apr 12 23:14:42 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 12 Apr 2006 17:14:42 -0400 Subject: inet:ip/1 In-Reply-To: <20060412210732.GG12541@angband.cse.nd.edu> References: <443D4E1B.1000800@hq.idt.net> <20060412210732.GG12541@angband.cse.nd.edu> Message-ID: <443D6DC2.7040402@hq.idt.net> Though it doesn't quite make sense for the IPv4 case... Moreover, the kernel/inet_parse.erl has the following comment for ipv4_address/1: %% Parse IPv4 address: %% d1.d2.d3.d4 %% d1.d2.d4 %% d1.d4 %% d4 %% %% Return {ok, IP} | {error, einval} I wonder what it was that authors were trying to accomplish. Serge Phil Snowberger wrote: > On Wed, Apr 12, 2006 at 02:59:39PM -0400, Serge Aleynikov wrote: > >>While playing with the inet:ip/1 function I noticed that it can take an >>argument containing less than four octets. What's the meaning of such a >>strange conversion like inet:ip("1.2.3")? >> >>1> inet:ip("1.2.3.4"). >>{ok,{1,2,3,4}} >>2> inet:ip("1.2.3"). >>{ok,{1,2,0,3}} >>3> inet:ip("1.2"). >>{ok,{1,0,0,2}} >>4> inet:ip("1"). >>{ok,{0,0,0,1}} > > > I can only guess this is to support the IPv6 shorthand. > > --Phil > From hedeland@REDACTED Wed Apr 12 23:34:56 2006 From: hedeland@REDACTED (Per Hedeland) Date: Wed, 12 Apr 2006 23:34:56 +0200 (CEST) Subject: inet:ip/1 In-Reply-To: <443D6DC2.7040402@hq.idt.net> Message-ID: <200604122134.k3CLYul6002618@tordmule.bluetail.com> Serge Aleynikov wrote: > >Moreover, the kernel/inet_parse.erl has the following comment for >ipv4_address/1: > >%% Parse IPv4 address: >%% d1.d2.d3.d4 >%% d1.d2.d4 >%% d1.d4 >%% d4 >%% >%% Return {ok, IP} | {error, einval} > >I wonder what it was that authors were trying to accomplish. It's the standard, is what it is: $ telnet 1.2.3 Trying 1.2.0.3... ^C $ telnet 1.2 Trying 1.0.0.2... Though admittedly an old and not very useful standard... See the section INTERNET ADDRESSES on e.g. http://www.freebsd.org/cgi/man.cgi?query=inet_aton for a description of the logic, such as it is (feel free to ignore the part about the VAX:-). The above commands are from a Linux box, i.e. it's not (Free)BSD- specific, but of course the logic is not described in Linux man pages. --Per Hedeland From matthias@REDACTED Wed Apr 12 23:41:22 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 12 Apr 2006 23:41:22 +0200 Subject: inet:ip/1 In-Reply-To: <443D4E1B.1000800@hq.idt.net> References: <443D4E1B.1000800@hq.idt.net> Message-ID: <17469.29698.262748.629854@antilipe.corelatus.se> This doesn't seem to be erlang-specific behaviour, which makes me suspect that there's more to this than appears at first glance. Try playing around with the attached program. Matthias -------------------- Serge Aleynikov writes: > While playing with the inet:ip/1 function I noticed that it can take an > argument containing less than four octets. What's the meaning of such a > strange conversion like inet:ip("1.2.3")? > > 1> inet:ip("1.2.3.4"). > {ok,{1,2,3,4}} > 2> inet:ip("1.2.3"). > {ok,{1,2,0,3}} > 3> inet:ip("1.2"). > {ok,{1,0,0,2}} > 4> inet:ip("1"). > {ok,{0,0,0,1}} > > Serge ---------------------------------------------------------------------- #include #include #include int main() { struct hostent* he; unsigned char** addr; he = gethostbyname("1"); assert(he); addr = he->h_addr_list; while (*addr) { printf("hostent entry: %u.%u.%u.%u\n", **addr, *(*addr+1), *(*addr+2), *(*addr+3)); addr++; } return 0; } From serge@REDACTED Wed Apr 12 23:47:23 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 12 Apr 2006 17:47:23 -0400 Subject: inet:ip/1 In-Reply-To: <200604122134.k3CLYul6002618@tordmule.bluetail.com> References: <200604122134.k3CLYul6002618@tordmule.bluetail.com> Message-ID: <443D756B.7060209@hq.idt.net> Thanks for clarification. Something not useful, yet we have to live with it. Saidly, it makes validation of IP address entries quite difficult, as one cannot use inet:ip like functions to distinguish shorthand notations from errors. BTW, Windows' telnet doesn't seem to recognize this shorthand form: c:\>telnet 1.2.3 Connecting To 1.2.3... Serge Per Hedeland wrote: > Serge Aleynikov wrote: > >>Moreover, the kernel/inet_parse.erl has the following comment for >>ipv4_address/1: >> >>%% Parse IPv4 address: >>%% d1.d2.d3.d4 >>%% d1.d2.d4 >>%% d1.d4 >>%% d4 >>%% >>%% Return {ok, IP} | {error, einval} >> >>I wonder what it was that authors were trying to accomplish. > > > It's the standard, is what it is: > > $ telnet 1.2.3 > Trying 1.2.0.3... > ^C > $ telnet 1.2 > Trying 1.0.0.2... > > Though admittedly an old and not very useful standard... See the section > INTERNET ADDRESSES on e.g. > http://www.freebsd.org/cgi/man.cgi?query=inet_aton for a description of > the logic, such as it is (feel free to ignore the part about the VAX:-). > The above commands are from a Linux box, i.e. it's not (Free)BSD- > specific, but of course the logic is not described in Linux man pages. > > --Per Hedeland From mbj@REDACTED Wed Apr 12 23:50:27 2006 From: mbj@REDACTED (Martin Bjorklund) Date: Wed, 12 Apr 2006 23:50:27 +0200 (CEST) Subject: inet:ip/1 In-Reply-To: <443D4E1B.1000800@hq.idt.net> References: <443D4E1B.1000800@hq.idt.net> Message-ID: <20060412.235027.103958438.mbj@tail-f.com> Serge Aleynikov wrote: > While playing with the inet:ip/1 function I noticed that it can take an > argument containing less than four octets. What's the meaning of such a > strange conversion like inet:ip("1.2.3")? same as e.g. telnet: $ telnet 127.0.1 45 Trying 127.0.0.1... or $ telnet 127.1 45 Trying 127.0.0.1... /martin From marthin@REDACTED Thu Apr 13 00:45:03 2006 From: marthin@REDACTED (Marthin Laubscher) Date: Thu, 13 Apr 2006 00:45:03 +0200 Subject: inet:ip/1 In-Reply-To: <443D756B.7060209@hq.idt.net> Message-ID: <000001c65e82$be9bd180$4800a8c0@studioa> I don't believe it's a case of shorthand, 127.1 is the same thing as 127.0.0.1, which is why win telnet considers 127.1 as a legal address and reports in that manner. Try ping (incl. win) and you'll see more of what goes on Ping 192.168.0.72 -> pinging 192.168.0.72 Ping 192.168.72 -> pinging 192.168.0.72 Ping 192.11010120 -> pinging 192.168.0.72 Ping 323223559 -> pinging 192.168.0.72 Believing that the numbers in the dotted notation are "octets" will get you thinking that you can specify an ipv4 address in less than for octets, which isn't the case. It's always 4 octets. In the decimal, dotted string format we use, it can be specified in any one of the four formats equally (pseudo notation, don't try to parse this in Erlang". "<>.<>.<>.<>" =="<>.<>.<>" =="<>.<>. =="<>" ATB/Marthin > -----Original Message----- > From: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Serge Aleynikov > Sent: 12 April 2006 23:47 > To: Per Hedeland; erlang-questions@REDACTED > Subject: Re: inet:ip/1 > > Thanks for clarification. > > Something not useful, yet we have to live with it. Saidly, it makes > validation of IP address entries quite difficult, as one cannot use > inet:ip like functions to distinguish shorthand notations from errors. > > BTW, Windows' telnet doesn't seem to recognize this shorthand form: > > c:\>telnet 1.2.3 > Connecting To 1.2.3... > > Serge > > Per Hedeland wrote: > > Serge Aleynikov wrote: > > > >>Moreover, the kernel/inet_parse.erl has the following comment for > >>ipv4_address/1: > >> > >>%% Parse IPv4 address: > >>%% d1.d2.d3.d4 > >>%% d1.d2.d4 > >>%% d1.d4 > >>%% d4 > >>%% > >>%% Return {ok, IP} | {error, einval} > >> > >>I wonder what it was that authors were trying to accomplish. > > > > > > It's the standard, is what it is: > > > > $ telnet 1.2.3 > > Trying 1.2.0.3... > > ^C > > $ telnet 1.2 > > Trying 1.0.0.2... > > > > Though admittedly an old and not very useful standard... See the section > > INTERNET ADDRESSES on e.g. > > http://www.freebsd.org/cgi/man.cgi?query=inet_aton for a description of > > the logic, such as it is (feel free to ignore the part about the VAX:-). > > The above commands are from a Linux box, i.e. it's not (Free)BSD- > > specific, but of course the logic is not described in Linux man pages. > > > > --Per Hedeland From cloos@REDACTED Thu Apr 13 02:10:18 2006 From: cloos@REDACTED (James Cloos) Date: Wed, 12 Apr 2006 20:10:18 -0400 Subject: inet:ip/1 In-Reply-To: <443D4E1B.1000800@hq.idt.net> (Serge Aleynikov's message of "Wed, 12 Apr 2006 14:59:39 -0400") References: <443D4E1B.1000800@hq.idt.net> Message-ID: >>>>> "Serge" == Serge Aleynikov writes: Serge> While playing with the inet:ip/1 function I noticed that it can take Serge> an argument containing less than four octets. What's the meaning of Serge> such a strange conversion like inet:ip("1.2.3")? The RFC for ipv4 defines all of: a.b.c.d a.b.e a.f g as identical, where e=256c+d, f=256b+e and g=256a+f. The idea was that in a class A (now called a /8) you could just use a.1 through a.16777214 (if I got the math right), in a class B a.b.1 thru a.b.65534 and in a class C a.b.c.1 thru a.b.c.254. Some of the more recent RFCs try to deprecate that syntax, but it hangs on in most resolvers. -JimC -- James H. Cloos, Jr. From david.nospam.hopwood@REDACTED Thu Apr 13 03:56:04 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Thu, 13 Apr 2006 02:56:04 +0100 Subject: inet:ip/1 In-Reply-To: <000001c65e82$be9bd180$4800a8c0@studioa> References: <000001c65e82$be9bd180$4800a8c0@studioa> Message-ID: <443DAFB4.6060606@blueyonder.co.uk> Marthin Laubscher wrote: > I don't believe it's a case of shorthand, 127.1 is the same thing as > 127.0.0.1, which is why win telnet considers 127.1 as a legal address and > reports in that manner. > > Try ping (incl. win) and you'll see more of what goes on > > Ping 192.168.0.72 -> pinging 192.168.0.72 > Ping 192.168.72 -> pinging 192.168.0.72 > Ping 192.11010120 -> pinging 192.168.0.72 > Ping 323223559 -> pinging 192.168.0.72 > > Believing that the numbers in the dotted notation are "octets" will get you > thinking that you can specify an ipv4 address in less than for octets, which > isn't the case. It's always 4 octets. In the decimal, dotted string format > we use, it can be specified in any one of the four formats equally (pseudo > notation, don't try to parse this in Erlang". > > "<>.<>.<>.<>" > =="<>.<>.<>" > =="<>.<>. > =="<>" Note that you won't find this notation in any RFC, AFAIK. It's a Unix (originally BSD) thing; not an IETF standard. >From RFC 1020: One commonly used notation for internet host addresses divides the 32-bit address into four 8-bit fields and specifies the value of each field as a decimal number with the fields separated by periods. This is called the "dotted decimal" notation. For example, the internet address of VENERA.ISI.EDU in dotted decimal is 010.001.000.052, or 10.1.0.52. (whereas inet_aton would interpret the components of 010.001.000.052 as octal). When IETF protocols make use of string representations of IP addresses, they generally only specify the full dotted-decimal notation, without shorthands, octal, or hexadecimal. For example, "http://192.168.0.72/" is a valid URL, but "http://323223559/" isn't. Most browsers get this wrong, because they (directly or indirectly) use inet_aton, and don't bother to validate URLs properly. Personally, I think it's unfortunate that the APIs of Erlang and some other recent languages are perpetuating this misfeature, and would recommend stripping it out. -- David Hopwood From david.nospam.hopwood@REDACTED Thu Apr 13 04:11:37 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Thu, 13 Apr 2006 03:11:37 +0100 Subject: inet:ip/1 In-Reply-To: References: <443D4E1B.1000800@hq.idt.net> Message-ID: <443DB359.30607@blueyonder.co.uk> James Cloos wrote: >>>>>>"Serge" == Serge Aleynikov writes: > > Serge> While playing with the inet:ip/1 function I noticed that it can take > Serge> an argument containing less than four octets. What's the meaning of > Serge> such a strange conversion like inet:ip("1.2.3")? > > The RFC for ipv4 defines all of: > > a.b.c.d > a.b.e > a.f > g > > as identical, where e=256c+d, f=256b+e and g=256a+f. That's not correct. Don't confuse the (long obsolete) RFC 950 class A/B/C subnetting with the strings accepted by inet_aton. RFC 791 doesn't define or use any string notation for IP addresses (it defines them as sequences of four 8-bit bytes), and RFC 1020 uses a notation which is not consistent with inet_aton. -- David Hopwood From goertzen@REDACTED Thu Apr 13 05:00:59 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Wed, 12 Apr 2006 22:00:59 -0500 Subject: SNMP v3 In-Reply-To: <443DB359.30607@blueyonder.co.uk> References: <443D4E1B.1000800@hq.idt.net> <443DB359.30607@blueyonder.co.uk> Message-ID: <443DBEEB.2070301@ertw.com> I'm looking to get a feel for the quality of the snmp v3 implementation in erlang. We tried using net-snmp (http://www.net-snmp.com/) which claimed to be v3 compatible but were severely disappointed. We ultimately had to give up on it and go with a commercial agent. If the erlang snmp agent does v3 well, we may move to that. Has anybody tested the erlang agent with the silvercreek test suite (http://www.iwl.com/Products/sc/) ? Thanks, Dan. From bmk@REDACTED Thu Apr 13 08:00:29 2006 From: bmk@REDACTED (Micael Karlberg) Date: Thu, 13 Apr 2006 08:00:29 +0200 Subject: SNMP v3 In-Reply-To: <443DBEEB.2070301@ertw.com> References: <443D4E1B.1000800@hq.idt.net> <443DB359.30607@blueyonder.co.uk> <443DBEEB.2070301@ertw.com> Message-ID: <443DE8FD.5000107@erix.ericsson.se> Hi, As I recall, Martin Bj?rklund, used silvercreek for testing, when he developed v3 in the app. Since then we have not used it though. Regards, /BMK Daniel Goertzen wrote: > I'm looking to get a feel for the quality of the snmp v3 implementation > in erlang. > > We tried using net-snmp (http://www.net-snmp.com/) which claimed to be > v3 compatible but were severely disappointed. We ultimately had to give > up on it and go with a commercial agent. If the erlang snmp agent does > v3 well, we may move to that. > > Has anybody tested the erlang agent with the silvercreek test suite > (http://www.iwl.com/Products/sc/) ? > > Thanks, > Dan. > > From mbj@REDACTED Thu Apr 13 08:17:04 2006 From: mbj@REDACTED (Martin Bjorklund) Date: Thu, 13 Apr 2006 08:17:04 +0200 (CEST) Subject: SNMP v3 In-Reply-To: <443DBEEB.2070301@ertw.com> References: <443DB359.30607@blueyonder.co.uk> <443DBEEB.2070301@ertw.com> Message-ID: <20060413.081704.108749325.mbj@tail-f.com> Daniel Goertzen wrote: > Has anybody tested the erlang agent with the silvercreek test suite > (http://www.iwl.com/Products/sc/) ? Yes. I developed the v3 agent in OTP once upon a time, and at that time, I did use silvercreek for testing. /martin From johan@REDACTED Wed Apr 12 21:39:08 2006 From: johan@REDACTED (Johan Montelius) Date: Wed, 12 Apr 2006 21:39:08 +0200 Subject: httpd and inets Message-ID: A short question on inets and httpd; what are the pros and cons of running httpd without starting inets (or is inets started in the background when you start a httpd process?) Right now I start httpd under my own supervisor but shoudl I start it under inets? Johan -- Johan Montelius From d.andreasi@REDACTED Thu Apr 13 10:41:12 2006 From: d.andreasi@REDACTED (Daniele Andreasi) Date: Thu, 13 Apr 2006 10:41:12 +0200 Subject: HELP ME, please Message-ID: <443E0EA8.9000107@nesit.it> Hallo, I have a big problem: i loose my ".erl" file!, but i have the ".beam"; Do anybody know if exist a way to rebuild a file ".erl" by a file ".beam"? ANY WAY. Thanks From mats.cronqvist@REDACTED Thu Apr 13 12:54:11 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 13 Apr 2006 12:54:11 +0200 Subject: HELP ME, please In-Reply-To: <443E0EA8.9000107@nesit.it> References: <443E0EA8.9000107@nesit.it> Message-ID: <443E2DD3.2060102@ericsson.com> if the beam file was generated with erlc +debug_info this ought to work; {ok,{_,[{abstract_code,{_,AC}}]}}=beam_lib:chunks(BeamFileName,[abstract_code]). io:fwrite("~s~n",[erl_prettypr:format(erl_syntax:form_list(AC))]). mats Daniele Andreasi wrote: > Hallo, > > I have a big problem: i loose my ".erl" file!, but i have the ".beam"; > > Do anybody know if exist a way to rebuild a file ".erl" by a file ".beam"? > ANY WAY. > > Thanks From bertil.karlsson@REDACTED Thu Apr 13 13:04:31 2006 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Thu, 13 Apr 2006 13:04:31 +0200 Subject: httpd and inets In-Reply-To: References: Message-ID: <443E303F.5000607@ericsson.com> You'll have to make your own code upgrade strategy, because when you start the http server without inets you'll break the built in structure for that in inets. /Bertil Johan Montelius wrote: > > > A short question on inets and httpd; what are the pros and cons of > running httpd without starting inets (or is inets started in the > background when you start a httpd process?) Right now I start httpd > under my own supervisor but shoudl I start it under inets? > > Johan > > > > --Johan Montelius From emil@REDACTED Thu Apr 13 14:07:05 2006 From: emil@REDACTED (Emil Hellman) Date: Thu, 13 Apr 2006 14:07:05 +0200 Subject: Erlang-DBMS survey for bachelor thesis Message-ID: <443E3EE9.80704@erlang-consulting.com> Hi! I am a student at the IT-University of Gothenburg, doing my thesis project on what aspects of DBMSs are important to developers when creating Erlang systems with large data storage demands. I am looking for people who have worked with Erlang in concjunciton with DBMSs on projects with scalability requirements, especially requirements where mnesia has proven not to be enough or has been pushed to its limits. If you feel you fit this description, I would appreciate if you can take a moment to answere the survey in the link below. http://www.zoomerang.com/survey.zgi?p=WEB2257WYYXVS3 It should not take more than two minites. When my thesis is done, I will happily share my experiences with you. Many thanks, Emil Hellman -- http://www.erlang-consulting.com From jeadea@REDACTED Fri Apr 14 08:48:12 2006 From: jeadea@REDACTED (JeaDea) Date: Fri, 14 Apr 2006 08:48:12 +0200 Subject: duplicate a image with gs In-Reply-To: <17468.53498.714529.522957@antilipe.corelatus.se> References: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> <1144756531.6241.73.camel@ulab.pupeno.com> <17468.50695.156492.790780@antilipe.corelatus.se> <17468.53498.714529.522957@antilipe.corelatus.se> Message-ID: My code is -module(test). -export([init/0]). init() -> Gs = gs:start(), Win = gs:create(window, Gs,[{map,true},{title,"Drainage Mine"},{width,620},{height,500}]), Cs = gs:create(canvas,CCs,[{width,620},{height,500},{bg,white}]), gs:create(image,Cs,[{coords,[{50,50}]},{load_gif,"myImage.gif"}]), loop(Cs,50,50). loop(Cs,X,Y) -> gs:create(image,Cs,[{coords,[{X,Y}]},{load_gif,"myImage.gif"}), loop(Cs,X,Y+20). The problem is load_gif, each time a new gif is loaded in memory (the old ones aren't unloaded) so that the memory never stops growing... until overflow... -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Fri Apr 14 10:08:54 2006 From: matthias@REDACTED (Matthias Lang) Date: Fri, 14 Apr 2006 10:08:54 +0200 Subject: duplicate a image with gs In-Reply-To: References: <3f9db9f20604110254j10121abid837bf9c8b6279b2@mail.gmail.com> <1144756531.6241.73.camel@ulab.pupeno.com> <17468.50695.156492.790780@antilipe.corelatus.se> <17468.53498.714529.522957@antilipe.corelatus.se> Message-ID: <17471.22678.227006.100357@antilipe.corelatus.se> You have a loop which endlessly creates images. It's hardly surprising that you eventually run out of memory. What are you actually trying to do? Is this a homework assignment? Matthias -------------------- JeaDea writes: > My code is > > -module(test). > -export([init/0]). > > init() -> > Gs = gs:start(), > > Win = gs:create(window, Gs,[{map,true},{title,"Drainage > Mine"},{width,620},{height,500}]), > > Cs = gs:create(canvas,CCs,[{width,620},{height,500},{bg,white}]), > > gs:create(image,Cs,[{coords,[{50,50}]},{load_gif,"myImage.gif"}]), > > loop(Cs,50,50). > > loop(Cs,X,Y) -> > gs:create(image,Cs,[{coords,[{X,Y}]},{load_gif,"myImage.gif"}), > loop(Cs,X,Y+20). > > The problem is load_gif, each time a new gif is loaded in memory (the old > ones aren't unloaded) so that the memory never stops growing... until > overflow... From rlenglet@REDACTED Fri Apr 14 11:06:03 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 14 Apr 2006 18:06:03 +0900 Subject: duplicate a image with gs In-Reply-To: <17471.22678.227006.100357@antilipe.corelatus.se> References: <17471.22678.227006.100357@antilipe.corelatus.se> Message-ID: <200604141806.04471.rlenglet@users.forge.objectweb.org> > gs:create(image,Cs,[{coords,[{X,Y}]},{load_gif,"myImage.gif >"}), loop(Cs,X,Y+20). > > The problem is load_gif, each time a new gif is loaded in > memory (the old ones aren't unloaded) so that the memory > never stops growing... until overflow... Have you ever thought about using gs:destroy? gs is a binding to Tk, which requires to explicitly destroy objects. The gs graphics server does automatic garbage collection of those non-Erlang objects, but it is done only when the process "owning" (i.e. created) the objects terminates. Cf. section 2.4 of the GS User's Guide. If you want to destroy objects before the "owning" process terminates, use gs:destroy/1. Id = gs:create(image, ...), gs:destroy(Id) -- Romain LENGLET From jann@REDACTED Fri Apr 14 12:51:17 2006 From: jann@REDACTED (Jan Henry Nystrom) Date: Fri, 14 Apr 2006 11:51:17 +0100 (BST) Subject: Public Erlang talk in London at Erlang-Consulting Message-ID: Hi All, On Monday, April 24th, I will present the results of a three year research project conducted at Heriot-Watt University in collaboration with Motorola Labs in Basingstoke. The project aim has been to produce scientific evidence that Erlang can improve distributed quality and productivity, and to investigate the impact of programming constructs on distributed software. This talk focuses on a comparative study done on a Motorola distributed C++ application that has been re-engineered in Erlang. The study clearly indicates that great benefits can be gained from using Erlang for this type of applications. The talk will start at 16.30 pm, and is expected to take about an hour, followed by a Q&A session. It will be held in the conference room of Erlang_Consulting's London offices, http://www.erlang-consulting.com/contact.html. Please let me know if you are planning to attend, so we know how many people to expect. Refreshments will be served after the talk. It would be great if you could make it. Welcome! Henry Nystrom and Erlang-Consulting -- Jan Henry Nystr?m Skolgatan 20B 753 32 UPPSALA Sweden E-mail: jann@REDACTED Phone: +46 (0)18 14 24 04 WWW: http://www.macs.hw.ac.uk/~jann From garris@REDACTED Fri Apr 14 20:53:19 2006 From: garris@REDACTED (Erik Garrison) Date: Fri, 14 Apr 2006 14:53:19 -0400 (EDT) Subject: process runtime, time and simulation in erlang Message-ID: Is there a way to obtain the total runtime of a process in Erlang? I'd like to use the information to create a metronome process which scales "time" in a simulated environment relative to system load. Scaled time will be used to throttle the rate at which requests to a simulated system occur relative to wallclock time. I can find the number of reductions completed by a process using process_info(Pid, reductions). Is there also a way to find out how much runtime a given process has? Is such a question meaningless when processes are scheduled based upon the number of reductions they make? -Erik For some background... I'm building a simulated environment using Erlang to test the efficacy of different distributed object caching and placement protocols. Generally, things have been wonderful. I *really* like Erlang and the manner in simplifies problems of distributed systems. The problem is that I'm not just working with a distributed system; I'm simulating one. Time is an important part of simulation, but when one system is emulating a dozen, or a hundred others, wallclock time loses meaning relative to the rate at which these processes operate. For instance, when a system runs one process continuously, it registers N reductions/millisecond, when it runs ten of the same process concurrently, they each run N/10 red/ms. If each new process is understood to be running on a distinct node, then in a real environment, each would run at the same rate relative to a wallclock as the first process did when it had full access to the resources of a single system. If I can solve this problem, then I can make it much easier to simulate an entire, concurrent, network environment on a single Erlang node. I can also rate-limit nodes, or build some conception of process "niceness" within Erlang. I fear that anything more than a simple hack to fix this will require a patch to Erlang/OTP itself. From lennart.ohman@REDACTED Sat Apr 15 00:13:39 2006 From: lennart.ohman@REDACTED (Lennart Ohman) Date: Sat, 15 Apr 2006 00:13:39 +0200 Subject: process runtime, time and simulation in erlang In-Reply-To: Message-ID: <000001c66010$aec754c0$0600a8c0@st.se> Hi, one way of doing it is using the trace functionality. Use erlang:trace/3 to turn the 'running' 'timestamp' and 'cpu_timestamp' flag on for all processes. You will the get 'in' and 'out' trace messages for every process. Look at erlang:trace/3 in the erlang module in kernel application for more details. Note cpu timestamp currently only works on Solaris as far as I know. Best Regards, Lennart ------------------------------------------------------------- Lennart Ohman office : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 67 35 Sehlstedtsgatan 6 fax : +46-8-667 82 30 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > -----Original Message----- > From: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Erik Garrison > Sent: Friday, April 14, 2006 8:53 PM > To: erlang-questions@REDACTED > Subject: process runtime, time and simulation in erlang > > Is there a way to obtain the total runtime of a process in Erlang? I'd > like to use the information to create a metronome process which scales > "time" in a simulated environment relative to system load. Scaled time > will be used to throttle the rate at which requests to a simulated system > occur relative to wallclock time. > > I can find the number of reductions completed by a process using > process_info(Pid, reductions). Is there also a way to find out how much > runtime a given process has? Is such a question meaningless when > processes are scheduled based upon the number of reductions they make? > > -Erik > > > For some background... > > I'm building a simulated environment using Erlang to test the efficacy of > different distributed object caching and placement protocols. > > Generally, things have been wonderful. I *really* like Erlang and the > manner in simplifies problems of distributed systems. The problem is that > I'm not just working with a distributed system; I'm simulating one. > > Time is an important part of simulation, but when one system is emulating > a dozen, or a hundred others, wallclock time loses meaning relative to the > rate at which these processes operate. For instance, when a system runs > one process continuously, it registers N reductions/millisecond, when it > runs ten of the same process concurrently, they each run N/10 red/ms. If > each new process is understood to be running on a distinct node, then > in a real environment, each would run at the same rate relative to a > wallclock as the first process did when it had full access to the > resources of a single system. > > If I can solve this problem, then I can make it much easier to simulate an > entire, concurrent, network environment on a single Erlang node. I can > also rate-limit nodes, or build some conception of process "niceness" > within Erlang. I fear that anything more than a simple hack to fix this > will require a patch to Erlang/OTP itself. > From cyberlync@REDACTED Sat Apr 15 00:50:56 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 14 Apr 2006 15:50:56 -0700 Subject: Public Erlang talk in London at Erlang-Consulting In-Reply-To: References: Message-ID: Is there any possibility of getting this recorded and posted somewhere? On 4/14/06, Jan Henry Nystrom wrote: > > Hi All, > > On Monday, April 24th, I will present the results of a three > year research project conducted at Heriot-Watt University in collaboration > with Motorola Labs in Basingstoke. The project aim has been to produce > scientific evidence that Erlang can improve distributed quality and > productivity, and to investigate the impact of programming constructs on > distributed software. This talk focuses on a comparative study done on a > Motorola distributed C++ application that has been re-engineered in > Erlang. The study clearly indicates that great benefits can be gained > from using Erlang for this type of applications. > > The talk will start at 16.30 pm, and is expected to take about an hour, > followed by a Q&A session. It will be held in the conference room of > Erlang_Consulting's London offices, > http://www.erlang-consulting.com/contact.html. > > Please let me know if you are planning to attend, so we know how many > people to expect. Refreshments will be served after the talk. > > It would be great if you could make it. > > Welcome! > Henry Nystrom and Erlang-Consulting > > -- > Jan Henry Nystr?m > > Skolgatan 20B > 753 32 UPPSALA > Sweden > > E-mail: jann@REDACTED > Phone: +46 (0)18 14 24 04 > WWW: http://www.macs.hw.ac.uk/~jann > From pupeno@REDACTED Sat Apr 15 03:08:28 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 15 Apr 2006 03:08:28 +0200 Subject: Public Erlang talk in London at Erlang-Consulting In-Reply-To: References: Message-ID: <200604150308.30818.pupeno@pupeno.com> On Saturday, 15 de April de 2006 00:50, Eric Merritt wrote: > Is there any possibility of getting this recorded and posted somewhere? I'd like that as well. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From david.nospam.hopwood@REDACTED Sat Apr 15 04:12:55 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Sat, 15 Apr 2006 03:12:55 +0100 Subject: Public Erlang talk in London at Erlang-Consulting In-Reply-To: References: Message-ID: <444056A7.6040404@blueyonder.co.uk> It occurs to me that there may be an overlap in potential audience between this talk, and another public talk that is taking place in London on the same day, a short tube ride away: > BCS-FACS Evening Seminar Series > > Joint Event with FME > > Specifying Systems that Connect to the Physical World > > Professor Cliff Jones > (Joint work with Ian Hayes and Michael Jackson) > > 24 April 2006 > > 5.45pm > > BCS London Offices > First Floor, The Davidson Building > 5 Southampton Street > London WC2E 7HA > > We all know about developing programs from formal specifications. For "closed" > systems, such methods offer a gold standard against which less formal > approaches can be measured. But there is an increasing demand for "open systems" > which interact with the physical world. The overall system might include sensors > and actuators whose signals flow to and from some control program. The task of > obtaining a specification for the control program can be more challenging than > that of deriving a program from that specification. This talk argues that > recording an initial specification of the behaviour of the whole system in the > physical world gives a way to derive a specification of a control system and > also to record precisely the assumptions being made about those components > which sit outside the computer. > > > Refreshments will be served from 5.15pm > > The seminar is free of charge and open to everyone. If you would like to attend, > please email Paul Boca your name by 19 April 2006. > Pre-registration is required, as security at the BCS Offices is tight. The timing is very tight, though, especially with the Q&A session after the Erlang talk: 16:30 - 17:30 Erlang talk (excluding Q&A) walk to Liverpool Street (~500 m) Liverpool Street -> Temple on the Circle Line walk to BCS offices (~650 m) 17:45 - BCS talk Can the Erlang talk possibly be moved, say, half an hour earlier? How many people would be interested in attending both talks? Eric Merritt wrote: > Is there any possibility of getting this recorded and posted somewhere? I have a video camera. I'm not absolutely sure yet that I will be able to attend, though. > On 4/14/06, Jan Henry Nystrom wrote: > >>Hi All, >> >>On Monday, April 24th, I will present the results of a three >>year research project conducted at Heriot-Watt University in collaboration >>with Motorola Labs in Basingstoke. The project aim has been to produce >>scientific evidence that Erlang can improve distributed quality and >>productivity, and to investigate the impact of programming constructs on >>distributed software. This talk focuses on a comparative study done on a >>Motorola distributed C++ application that has been re-engineered in >>Erlang. The study clearly indicates that great benefits can be gained >>from using Erlang for this type of applications. >> >>The talk will start at 16.30 pm, and is expected to take about an hour, >>followed by a Q&A session. It will be held in the conference room of >>Erlang_Consulting's London offices, >>http://www.erlang-consulting.com/contact.html. >> >>Please let me know if you are planning to attend, so we know how many >>people to expect. Refreshments will be served after the talk. >> >>It would be great if you could make it. >> >>Welcome! >>Henry Nystrom and Erlang-Consulting >> >>-- >>Jan Henry Nystr?m >> >>Skolgatan 20B >>753 32 UPPSALA >>Sweden >> >>E-mail: jann@REDACTED >>Phone: +46 (0)18 14 24 04 >>WWW: http://www.macs.hw.ac.uk/~jann -- David Hopwood From david.nospam.hopwood@REDACTED Sat Apr 15 05:38:35 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Sat, 15 Apr 2006 04:38:35 +0100 Subject: Public Erlang talk in London at Erlang-Consulting In-Reply-To: <444056A7.6040404@blueyonder.co.uk> References: <444056A7.6040404@blueyonder.co.uk> Message-ID: <44406ABB.7060504@blueyonder.co.uk> David Hopwood wrote: > It occurs to me that there may be an overlap in potential audience between > this talk, and another public talk that is taking place in London on the > same day, a short tube ride away: > > [...] > The timing is very tight, though, especially with the Q&A session after the > Erlang talk: > > 16:30 - 17:30 Erlang talk (excluding Q&A) > > walk to Liverpool Street (~500 m) > > > Liverpool Street -> Temple on the Circle Line > > > walk to BCS offices (~650 m) > Here is a clearer map: > 17:45 - BCS talk I forgot to mention that the BCS talks typically end at about 19:15. > Can the Erlang talk possibly be moved, say, half an hour earlier? How many people > would be interested in attending both talks? -- David Hopwood From jeremie@REDACTED Sun Apr 16 23:00:51 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Sun, 16 Apr 2006 23:00:51 +0200 Subject: Bug with ets? Or feature? Message-ID: <2b7b425b0604161400s70838690ue0a460a9a6edde6d@mail.gmail.com> Hello, The following Erlang session demonstrates something I've found: 29> ets:new(tmp, [set, public]). 17 30> ets:insert(17, {this, is, a, test}). true 31> ets:lookup(17, this). [{this,is,a,test}] 32> [] = ets:lookup(17, this). =ERROR REPORT==== 16-Apr-2006::22:57:50 === Error in process <0.70.0> with exit value: {{badmatch,[{this,is,a,test}]},[{erl_ eval,expr,3}]} ** exited: {{badmatch,[{this,is,a,test}]},[{erl_eval,expr,3}]} ** 33> ets:lookup(17, this). =ERROR REPORT==== 16-Apr-2006::22:57:52 === Error in process <0.76.0> with exit value: {badarg,[{ets,lookup,[17,this]},{erl_ eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {badarg,[{ets,lookup,[17,this]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** It seems the bad match (I know it was bad), destroyed the table 17, somehow, as it does not appear in ets:i() anymore after that first error. I'm pretty certain that this is normal, but I do not see where it is documented?and I'm reporting on the off-chance that it might be a bug. Regards, J?r?mie Lumbroso -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Sun Apr 16 23:30:25 2006 From: matthias@REDACTED (Matthias Lang) Date: Sun, 16 Apr 2006 23:30:25 +0200 Subject: Bug with ets? Or feature? In-Reply-To: <2b7b425b0604161400s70838690ue0a460a9a6edde6d@mail.gmail.com> References: <2b7b425b0604161400s70838690ue0a460a9a6edde6d@mail.gmail.com> Message-ID: <17474.46961.155597.99730@antilipe.corelatus.se> Hi, By default, the ets table is owned by the process which creates it. When an ets table's owner terminates, the ets table is automatically destroyed. In your case the shell is the owner. The badmatch kills the shell process. Try evaluating self() before and after the lookup. As you predicted, you haven't found a bug. You've discovered a feature. It's documented, albeit semi-implicitly, in the ETS manpage. Matthias ---------------------------------------------------------------------- J?r?mie Lumbroso writes: > Hello, > > The following Erlang session demonstrates something I've found: > > 29> ets:new(tmp, [set, public]). > 17 > 30> ets:insert(17, {this, is, a, test}). > true > 31> ets:lookup(17, this). > [{this,is,a,test}] > 32> [] = ets:lookup(17, this). > > =ERROR REPORT==== 16-Apr-2006::22:57:50 === > Error in process <0.70.0> with exit value: > {{badmatch,[{this,is,a,test}]},[{erl_ > eval,expr,3}]} > > ** exited: {{badmatch,[{this,is,a,test}]},[{erl_eval,expr,3}]} ** > 33> ets:lookup(17, this). > > =ERROR REPORT==== 16-Apr-2006::22:57:52 === > Error in process <0.76.0> with exit value: > {badarg,[{ets,lookup,[17,this]},{erl_ > eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {badarg,[{ets,lookup,[17,this]}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > > It seems the bad match (I know it was bad), destroyed the table 17, somehow, > as it does not appear in ets:i() anymore after that first error. > > I'm pretty certain that this is normal, but I do not see where it is > documented?and I'm reporting on the off-chance that it might be a bug. > > Regards, > > J?r?mie Lumbroso From jeremie@REDACTED Sun Apr 16 23:32:04 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Sun, 16 Apr 2006 23:32:04 +0200 Subject: Bug with ets? Or feature? In-Reply-To: <17474.46961.155597.99730@antilipe.corelatus.se> References: <2b7b425b0604161400s70838690ue0a460a9a6edde6d@mail.gmail.com> <17474.46961.155597.99730@antilipe.corelatus.se> Message-ID: <2b7b425b0604161432m56c5ffefp9eb076c0fa14557e@mail.gmail.com> Thanks for the explanation Matthias! J?r?mie -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremie@REDACTED Mon Apr 17 04:19:49 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Mon, 17 Apr 2006 04:19:49 +0200 Subject: Records & pattern matching Message-ID: <2b7b425b0604161919ndb0e665h16b18c42b43d8f71@mail.gmail.com> Hello, I am trying to do a regular pattern matching using the #record{name = "Me", _='_'} construct to do regular pattern matching. But it does not seem to work as expected (I am not using the match_object method of anything). Am I obligated to explicitly define my tuplet for the pattern matching, i.e. do {record, _, _, _, "Me", _}? Regards, J?r?mie -------------- next part -------------- An HTML attachment was scrubbed... URL: From ft@REDACTED Mon Apr 17 05:34:10 2006 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 17 Apr 2006 05:34:10 +0200 Subject: Records & pattern matching In-Reply-To: <2b7b425b0604161919ndb0e665h16b18c42b43d8f71@mail.gmail.com> References: <2b7b425b0604161919ndb0e665h16b18c42b43d8f71@mail.gmail.com> Message-ID: <200604170534.10567.ft@it.su.se> On Monday 17 April 2006 04:19, J?r?mie Lumbroso wrote: > Hello, > > I am trying to do a regular pattern matching using the #record{name = > "Me", _='_'} construct to do regular pattern matching. But it does > not seem to work as expected (I am not using the match_object method > of anything). Am I obligated to explicitly define my tuplet for the > pattern matching, i.e. do {record, > _, _, _, "Me", _}? You only have to specify the fields you want to match on, so you write case X of #record{name = "Me"} -> ... not case X of #record{name = "Me", _ = '_'} -> /Fredrik From sean.hinde@REDACTED Mon Apr 17 05:41:12 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 17 Apr 2006 04:41:12 +0100 Subject: Records & pattern matching In-Reply-To: <2b7b425b0604161919ndb0e665h16b18c42b43d8f71@mail.gmail.com> References: <2b7b425b0604161919ndb0e665h16b18c42b43d8f71@mail.gmail.com> Message-ID: <659AE898-9ABA-485F-A1AE-279CFB563B2F@gmail.com> #record{name = "Me"} = #record{name = "Me", answered = "You"}. or was that not the question? Sean On 17 Apr 2006, at 03:19, J?r?mie Lumbroso wrote: > Hello, > > I am trying to do a regular pattern matching using the #record{name > = "Me", _='_'} construct to do regular pattern matching. But it > does not seem to work as expected (I am not using the match_object > method of anything). Am I obligated to explicitly define my tuplet > for the pattern matching, i.e. do {record, _, _, _, "Me", _}? > > Regards, > > J?r?mie From erlang@REDACTED Mon Apr 17 10:42:51 2006 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 17 Apr 2006 01:42:51 -0700 Subject: mnesia no disk write after restart Message-ID: <20060417084251.GU964@delora.autosys.us> BRIEF: module using mnesia works fine the first time I start it (when the schema and table get created), and the db is persistent for the next restart. Henceforth, no records write to disk, they only exist in memory, and further restarts lose all but the records written on the initial start (when the table was created). LONG: My goal is a *persistent* database when restarting my module. I am running R10B-10 on Linux. I have abbreviated the following code. I think all the pertinent bits are there. I start my module with the following fun: start() -> erlang:set_cookie( node(), some_cookie ) mnesia:create_schema([node()]) , mnesia:start() , case catch mnesia:table_info(?DB, attributes) of L when is_list(L) -> ok ; _ -> mnesia:create_table(?DB , [ {disc_copies, [node()]} , {attributes, record_info(fields, ?DB)} , {type, set} ]) end, mnesia:wait_for_tables([?DB,schema], 21000) . the write function is: write(Rec) -> Trans = fun() -> mnesia:write(Rec) end , mnesia:transaction(Trans) , os:cmd("/bin/sync") . I run a loop that waits for messages of records to write. I start the module from a script containing: #!/bin/sh HOST=`/bin/hostname` /bin/su mmcdanie -c "cd /home/erl ; /usr/local/bin/erl \ -sname ${HOST}_block -config /home/erl/sys.config \ -setcookie xus -env TERM linux -env HOME /home/erl \ -home /home/erl -heart -detached \ -s block start /var/log/auth" #% end and the contents of sys.config: [{mnesia, [{dir, "/home/erl/Mnesia.block"} , %% {debug, trace} , {schema_location, disc}]}]. I start the application the first time with no Mnesia.block directory created. Module starts fine, directory and db files are created, and I can send messages which get written to the database. I see the .LOG file change and the record.DCL file get created. I stop the module and restart it and I can see the records in the database. I send more messages and the records get written though only to memory. A new record.DCL file never gets created. The .LOG file(s) never change. 'Never' is waiting for over 10 minutes (and {dump_log_time_threshold,180000}). I run mnesia:system_info from another node: (fu@REDACTED)2> mnesia:system_info(). ===> System info in version "4.2.5", debug level = none <=== disc. Directory "/home/erl/Mnesia.block" is used. use fallback at restart = false running db nodes = [www_block@REDACTED,fu@REDACTED] stopped db nodes = [] master node tables = [] remote = [ip] ram_copies = [schema] disc_copies = [] disc_only_copies = [] [{fu@REDACTED,ram_copies},{www_block@REDACTED,disc_copies}] = [schema] [{www_block@REDACTED,disc_copies}] = [ip] 3 transactions committed, 0 aborted, 0 restarted, 0 logged to disc 0 held locks, 0 in queue; 0 local transactions, 0 remote 0 transactions waits for other nodes: [] yes The '0 logged to disc' is after having written a new record that does show in the database. QUESTIONS: 1) Does anyone see something obvious I am overlooking here? 2) Any suggestions on what to do differently? 3) What is the next bit of information anyone needs to help? thanks, ~Michael P.S. I am doing essentially the same thing in another module that I start from yaws and it works fine (i.e. persistent db between restarts). I have not sleuthed out the cause of the different behaviours! In the other module (that works) I do not even have the case statement protecting the create_table/2 fun. From nm@REDACTED Mon Apr 17 11:45:47 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Mon, 17 Apr 2006 14:45:47 +0500 Subject: analog of C condition?truebranch:falsebranch operator ??? Message-ID: <444363CB.6090706@web.am> Hello! Are there any construct like C ?: operator in Erlang? sometimes there is need in some simple assignments which I've now write as cases or if operators - which takes too much space ;) Thanks in advance. -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From pupeno@REDACTED Mon Apr 17 12:10:46 2006 From: pupeno@REDACTED (Pupeno) Date: Mon, 17 Apr 2006 12:10:46 +0200 Subject: [ANN] Serlvers 0.1.0 released Message-ID: <200604171010.49237.pupeno@pupeno.com> Announcement: http://pupeno.com/blog/serlvers-0-1-0-released Serlvers: http://pupeno.com/software/serlvers Serlvers is a set of Erlang modules designed to help in the implementation of IP services (that is TCP/IP or Internet servers). Serlvers consists of a set of behaviours abstract the internals of each protocol and other modules help with the infrastructure. The goal is that when making a server you would only worry about how to store, handle, prosses, etc the information instead of the internals of each protocol (to save you for countless hours of RFC reading). At this stage only 4 protocols are supported: - `Echo (RFC862) `__ - `Chargen (RFC864) `__ - `Daytime (RFC867) `__ - `Time (RFC868) `__ They are a bit useless but they are here for a purpose: To be an example and a prof of concept. They are examples of how a protocol is implemented but they are also examples of the quality I am aiming with Serlvers, on code quality, on code style and on documentation quality and extension. An example of how Serlvers is used can be found on `Fanterlastic Four `__. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From matthias@REDACTED Mon Apr 17 12:23:07 2006 From: matthias@REDACTED (Matthias Lang) Date: Mon, 17 Apr 2006 12:23:07 +0200 Subject: analog of C condition?truebranch:falsebranch operator ??? In-Reply-To: <444363CB.6090706@web.am> References: <444363CB.6090706@web.am> Message-ID: <17475.27787.448279.829719@antilipe.corelatus.se> Gaspar Chilingarov writes: > Are there any construct like C ?: operator in Erlang? Sure, except in Erlang it's the ?_ operator, and you need to define it: -define(_(C,A,B), case C of true -> A; _ -> B end). you use it like this: ?_(condition, true_branch, false_branch) Beautiful, isn't it? Matthias From pupeno@REDACTED Mon Apr 17 15:50:33 2006 From: pupeno@REDACTED (Pupeno) Date: Mon, 17 Apr 2006 13:50:33 +0000 Subject: Errors in Erlang Message-ID: <200604171350.35479.pupeno@pupeno.com> Hello, I tend to have a problem in Erlang. Most runtime errors doesn't give any clues about what happened. I run application:start(fanterlasticfour). and all I get is: =INFO REPORT==== 17-Apr-2006::13:32:43 === application: fanterlasticfour exited: {shutdown,{fanterlasticfour_app,start,[normal,[]]}} type: temporary {error,{shutdown,{fanterlasticfour_app,start,[normal,[]]}}} it didn't start, but I have no idea where or why it died. How do you proceed when you have something like this ? Or how do I avoid it ? Thank you. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From lennart.ohman@REDACTED Mon Apr 17 18:23:13 2006 From: lennart.ohman@REDACTED (Lennart Ohman) Date: Mon, 17 Apr 2006 18:23:13 +0200 Subject: Errors in Erlang In-Reply-To: <200604171350.35479.pupeno@pupeno.com> Message-ID: <001f01c6623b$41efb9a0$0600a8c0@st.se> Hi, since your application stops "spontainously" (that is you do not call application:stop/1), the answer is somewhere in your supervisor structure spanning the processes belonging to it. My first suggestion is that you make sure you have the sasl application running before starting your own application. In that way you will get supervisor reports on what actually starts and where it goes wrong. Best regards, Lennart ------------------------------------------------------------- Lennart Ohman office : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 67 35 Sehlstedtsgatan 6 fax : +46-8-667 82 30 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > -----Original Message----- > From: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Pupeno > Sent: Monday, April 17, 2006 3:51 PM > To: erlang-questions@REDACTED > Subject: Errors in Erlang > > Hello, > I tend to have a problem in Erlang. Most runtime errors doesn't give any > clues > about what happened. I run application:start(fanterlasticfour). and all I > get > is: > > =INFO REPORT==== 17-Apr-2006::13:32:43 === > application: fanterlasticfour > exited: {shutdown,{fanterlasticfour_app,start,[normal,[]]}} > type: temporary > {error,{shutdown,{fanterlasticfour_app,start,[normal,[]]}}} > > it didn't start, but I have no idea where or why it died. How do you > proceed > when you have something like this ? Or how do I avoid it ? > Thank you. > -- > Pupeno (http://pupeno.com) From ulf@REDACTED Mon Apr 17 21:40:51 2006 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 17 Apr 2006 21:40:51 +0200 Subject: Errors in Erlang In-Reply-To: <200604171350.35479.pupeno@pupeno.com> References: <200604171350.35479.pupeno@pupeno.com> Message-ID: Den 2006-04-17 15:50:33 skrev Pupeno : > =INFO REPORT==== 17-Apr-2006::13:32:43 === > application: fanterlasticfour > exited: {shutdown,{fanterlasticfour_app,start,[normal,[]]}} > type: temporary > {error,{shutdown,{fanterlasticfour_app,start,[normal,[]]}}} > > it didn't start, but I have no idea where or why it died. How do you > proceed when you have something like this ? Or how do I avoid it ? > Thank you. This typically means that some process has crashed in its init function during application start. A good guess is that the 'shutdown' error code comes from this function in supervisor.erl: init_children(State, StartSpec) -> SupName = State#state.name, case check_startspec(StartSpec) of {ok, Children} -> case start_children(Children, SupName) of {ok, NChildren} -> {ok, State#state{children = NChildren}}; {error, NChildren} -> terminate_children(NChildren, SupName), {stop, shutdown} end; Error -> {stop, {start_spec, Error}} end. But if that's the case, you should get an error report. As Lennart says, you should make sure to have SASL running, in order to get all error reports. Also, on how to avoid it. One tip is to do only what's absolutely necessary in the init functions. The init phase during application start is very sensitive, and any error will terminate your entire application. You get better error handling once your processes have been started and are supervised in a normal way. BR, Ulf Wiger -- Ulf Wiger From erlang@REDACTED Mon Apr 17 23:11:17 2006 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 17 Apr 2006 14:11:17 -0700 Subject: mnesia no disk write after restart In-Reply-To: <20060417084251.GU964@delora.autosys.us> References: <20060417084251.GU964@delora.autosys.us> Message-ID: <20060417211117.GA964@delora.autosys.us> I changed the record name from ip to ipm with same behaviour. What I *did* find, though is that the following sequence causes the problem: 1) start module as described below (in original post) 2) enter records as described below (in original post) 3) from command line run: erl -sname fu -config sys.config -s file script checkblock \ -s erlang halt where checkblock contains: mnesia:start(). timer:sleep(200). mnesia:wait_for_tables([ip,schema], 7000) , X = block:dirty_sorted_list_table_localtime(). Z = global:registered_names(). io:format('~p~n~p entries~nregistered names: ~p~n', [X, length(X), Z]). mnesia:stop(). and sys.config contents are described below (in original post) 4) stop/restart module and no records get written to disk. Actually, if I do step '3' above before the first records get written to disk then they never will (get written). The contents of block:dirty_sorted_list_table_localtime() is: dirty_sorted_list_table_localtime() -> io:format('*** LOCAL time ***~n',[]) , lists:keysort(5, ?MODULE:dlt_localtime()) . and dlt_localtime() is: dlt_localtime() -> [ {element(1, X), element(2,X), element(3,X), element(4,X), calendar:universal_time_to_local_time(element(5,X)), element(6,X)} || X <- mnesia:dirty_match_object(ipm, {ipm, '_', '_', '_', '_', '_'}) ] . So, it appears to be the heisenberg principal and the more I observerved, the less it worked. It appears that running step '3)' above causes mnesia to get confused about whether it should write to disk or ram; how can this be? Also, in original post I mentioned sending messages to module of what records to write. That is one method of entering records. During these tests, the module itself is reading the tail of a file and looking for patterns which triggers it to create a record and write to mnesia. So, I am only entering text into a file to trigger record writing. I mention this to eliminate conjecture that my sending process (there isn't one) is interfering with the module writing mnesia. If anything, it appears that my observation (step '3)') causes a permanent problem with mnesia and/or my module function. Now, the question is "why is this happening?". I need to be able to look at the db from an external program. Is there some other 'proper' way I should be checking the db contents? thanks, ~Michael On Mon, Apr 17, 2006 at 01:42:51AM -0700, Michael McDaniel wrote: > BRIEF: module using mnesia works fine the first time I start it > (when the schema and table get created), and the db is > persistent for the next restart. Henceforth, no records > write to disk, they only exist in memory, and further > restarts lose all but the records written on the initial > start (when the table was created). > > > LONG: > > My goal is a *persistent* database when restarting my module. > > I am running R10B-10 on Linux. > > I have abbreviated the following code. I think all the pertinent > bits are there. > > I start my module with the following fun: > > > start() -> > > erlang:set_cookie( node(), some_cookie ) > > mnesia:create_schema([node()]) , > mnesia:start() , > > > case catch mnesia:table_info(?DB, attributes) of > > L when is_list(L) -> > ok ; > > _ -> > mnesia:create_table(?DB , > [ {disc_copies, [node()]} , > {attributes, record_info(fields, ?DB)} , > {type, set} > ]) > > end, > > mnesia:wait_for_tables([?DB,schema], 21000) > . > > > the write function is: > > write(Rec) -> > Trans = fun() -> mnesia:write(Rec) end , > mnesia:transaction(Trans) , > os:cmd("/bin/sync") > . > > > I run a loop that waits for messages of records to write. > > I start the module from a script containing: > > > #!/bin/sh > > HOST=`/bin/hostname` > > /bin/su mmcdanie -c "cd /home/erl ; /usr/local/bin/erl \ > -sname ${HOST}_block -config /home/erl/sys.config \ > -setcookie xus -env TERM linux -env HOME /home/erl \ > -home /home/erl -heart -detached \ > -s block start /var/log/auth" > #% end > > > and the contents of sys.config: > > [{mnesia, [{dir, "/home/erl/Mnesia.block"} , > %% {debug, trace} , > {schema_location, disc}]}]. > > > I start the application the first time with no Mnesia.block > directory created. Module starts fine, directory and db files > are created, and I can send messages which get written to > the database. I see the .LOG file change and the record.DCL > file get created. > > I stop the module and restart it and I can see the records > in the database. > > I send more messages and the records get written though only > to memory. A new record.DCL file never gets created. The > .LOG file(s) never change. 'Never' is waiting for over 10 > minutes (and {dump_log_time_threshold,180000}). > > I run mnesia:system_info from another node: > > (fu@REDACTED)2> mnesia:system_info(). > ===> System info in version "4.2.5", debug level = none <=== > disc. Directory "/home/erl/Mnesia.block" is used. > use fallback at restart = false > running db nodes = [www_block@REDACTED,fu@REDACTED] > stopped db nodes = [] > master node tables = [] > remote = [ip] > ram_copies = [schema] > disc_copies = [] > disc_only_copies = [] > [{fu@REDACTED,ram_copies},{www_block@REDACTED,disc_copies}] = [schema] > [{www_block@REDACTED,disc_copies}] = [ip] > 3 transactions committed, 0 aborted, 0 restarted, 0 logged to disc > 0 held locks, 0 in queue; 0 local transactions, 0 remote > 0 transactions waits for other nodes: [] > yes > > > The '0 logged to disc' is after having written a new record that > does show in the database. > > > QUESTIONS: > > 1) Does anyone see something obvious I am overlooking here? > > 2) Any suggestions on what to do differently? > > 3) What is the next bit of information anyone needs to help? > > > thanks, > > ~Michael > P.S. I am doing essentially the same thing in another module > that I start from yaws and it works fine (i.e. persistent db > between restarts). I have not sleuthed out the cause of the > different behaviours! In the other module (that works) I do > not even have the case statement protecting the create_table/2 > fun. -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From erlang@REDACTED Mon Apr 17 23:42:08 2006 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 17 Apr 2006 14:42:08 -0700 Subject: mnesia no disk write after restart In-Reply-To: <20060417211117.GA964@delora.autosys.us> References: <20060417084251.GU964@delora.autosys.us> <20060417211117.GA964@delora.autosys.us> Message-ID: <20060417214208.GB964@delora.autosys.us> Now that I realize that it is my observer program gumming up mnesia's gears, I have looked closer at the command I was using with my other (working) module. Aha! different. Here is the observation command I need to use to not break mnesia: erl -sname fu -mnesia extra_db_nodes [module_nodename@REDACTED] \ -s file script checkblock -s init stop where "[module_nodename@REDACTED]" is the module's -sname on this host (i.e. the module which created and 'owns' the db). I am grateful for any insight on the particular point of why '-config sys.config' breaks mnesia, though. Even though it specifies the mnesia directory, I am only reading the db. ~Michael On Mon, Apr 17, 2006 at 02:11:17PM -0700, Michael McDaniel wrote: > > I changed the record name from ip to ipm with same behaviour. > > What I *did* find, though is that the following sequence causes > the problem: > > 1) start module as described below (in original post) > > 2) enter records as described below (in original post) > > 3) from command line run: > erl -sname fu -config sys.config -s file script checkblock \ > -s erlang halt > > where checkblock contains: > > mnesia:start(). > timer:sleep(200). > mnesia:wait_for_tables([ip,schema], 7000) , > X = block:dirty_sorted_list_table_localtime(). > Z = global:registered_names(). > io:format('~p~n~p entries~nregistered names: ~p~n', [X, length(X), Z]). > mnesia:stop(). > > and sys.config contents are described below (in original post) > > 4) stop/restart module and no records get written to disk. Actually, > if I do step '3' above before the first records get written to disk > then they never will (get written). > > The contents of block:dirty_sorted_list_table_localtime() is: > > dirty_sorted_list_table_localtime() -> > io:format('*** LOCAL time ***~n',[]) , > lists:keysort(5, ?MODULE:dlt_localtime()) . > > and dlt_localtime() is: > > dlt_localtime() -> > [ {element(1, X), element(2,X), element(3,X), element(4,X), > calendar:universal_time_to_local_time(element(5,X)), element(6,X)} > || X <- mnesia:dirty_match_object(ipm, {ipm, '_', '_', '_', '_', '_'}) > ] . > > > > So, it appears to be the heisenberg principal and the more I observerved, > the less it worked. > > It appears that running step '3)' above causes mnesia to get confused > about whether it should write to disk or ram; how can this be? > > Also, in original post I mentioned sending messages to module of what > records to write. That is one method of entering records. During these > tests, the module itself is reading the tail of a file and looking for > patterns which triggers it to create a record and write to mnesia. So, > I am only entering text into a file to trigger record writing. I > mention this to eliminate conjecture that my sending process (there > isn't one) is interfering with the module writing mnesia. If anything, > it appears that my observation (step '3)') causes a permanent problem > with mnesia and/or my module function. > > Now, the question is "why is this happening?". I need to be able to > look at the db from an external program. > > Is there some other 'proper' way I should be checking the db contents? > > thanks, > > ~Michael > > > > > On Mon, Apr 17, 2006 at 01:42:51AM -0700, Michael McDaniel wrote: > > BRIEF: module using mnesia works fine the first time I start it > > (when the schema and table get created), and the db is > > persistent for the next restart. Henceforth, no records > > write to disk, they only exist in memory, and further > > restarts lose all but the records written on the initial > > start (when the table was created). > > > > > > LONG: > > > > My goal is a *persistent* database when restarting my module. > > > > I am running R10B-10 on Linux. > > > > I have abbreviated the following code. I think all the pertinent > > bits are there. > > > > I start my module with the following fun: > > > > > > start() -> > > > > erlang:set_cookie( node(), some_cookie ) > > > > mnesia:create_schema([node()]) , > > mnesia:start() , > > > > > > case catch mnesia:table_info(?DB, attributes) of > > > > L when is_list(L) -> > > ok ; > > > > _ -> > > mnesia:create_table(?DB , > > [ {disc_copies, [node()]} , > > {attributes, record_info(fields, ?DB)} , > > {type, set} > > ]) > > > > end, > > > > mnesia:wait_for_tables([?DB,schema], 21000) > > . > > > > > > the write function is: > > > > write(Rec) -> > > Trans = fun() -> mnesia:write(Rec) end , > > mnesia:transaction(Trans) , > > os:cmd("/bin/sync") > > . > > > > > > I run a loop that waits for messages of records to write. > > > > I start the module from a script containing: > > > > > > #!/bin/sh > > > > HOST=`/bin/hostname` > > > > /bin/su mmcdanie -c "cd /home/erl ; /usr/local/bin/erl \ > > -sname ${HOST}_block -config /home/erl/sys.config \ > > -setcookie xus -env TERM linux -env HOME /home/erl \ > > -home /home/erl -heart -detached \ > > -s block start /var/log/auth" > > #% end > > > > > > and the contents of sys.config: > > > > [{mnesia, [{dir, "/home/erl/Mnesia.block"} , > > %% {debug, trace} , > > {schema_location, disc}]}]. > > > > > > I start the application the first time with no Mnesia.block > > directory created. Module starts fine, directory and db files > > are created, and I can send messages which get written to > > the database. I see the .LOG file change and the record.DCL > > file get created. > > > > I stop the module and restart it and I can see the records > > in the database. > > > > I send more messages and the records get written though only > > to memory. A new record.DCL file never gets created. The > > .LOG file(s) never change. 'Never' is waiting for over 10 > > minutes (and {dump_log_time_threshold,180000}). > > > > I run mnesia:system_info from another node: > > > > (fu@REDACTED)2> mnesia:system_info(). > > ===> System info in version "4.2.5", debug level = none <=== > > disc. Directory "/home/erl/Mnesia.block" is used. > > use fallback at restart = false > > running db nodes = [www_block@REDACTED,fu@REDACTED] > > stopped db nodes = [] > > master node tables = [] > > remote = [ip] > > ram_copies = [schema] > > disc_copies = [] > > disc_only_copies = [] > > [{fu@REDACTED,ram_copies},{www_block@REDACTED,disc_copies}] = [schema] > > [{www_block@REDACTED,disc_copies}] = [ip] > > 3 transactions committed, 0 aborted, 0 restarted, 0 logged to disc > > 0 held locks, 0 in queue; 0 local transactions, 0 remote > > 0 transactions waits for other nodes: [] > > yes > > > > > > The '0 logged to disc' is after having written a new record that > > does show in the database. > > > > > > QUESTIONS: > > > > 1) Does anyone see something obvious I am overlooking here? > > > > 2) Any suggestions on what to do differently? > > > > 3) What is the next bit of information anyone needs to help? > > > > > > thanks, > > > > ~Michael > > P.S. I am doing essentially the same thing in another module > > that I start from yaws and it works fine (i.e. persistent db > > between restarts). I have not sleuthed out the cause of the > > different behaviours! In the other module (that works) I do > > not even have the case statement protecting the create_table/2 > > fun. > > -- > Michael McDaniel > Portland, Oregon, USA > http://autosys.us > +1 503 283 5284 -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From vances@REDACTED Tue Apr 18 01:09:24 2006 From: vances@REDACTED (Vance Shipley) Date: Mon, 17 Apr 2006 19:09:24 -0400 Subject: mnesia no disk write after restart In-Reply-To: <20060417214208.GB964@delora.autosys.us> References: <20060417084251.GU964@delora.autosys.us> <20060417211117.GA964@delora.autosys.us> <20060417214208.GB964@delora.autosys.us> Message-ID: <20060417230924.GB51423@frogman.motivity.ca> On Mon, Apr 17, 2006 at 02:42:08PM -0700, Michael McDaniel wrote: } } I am grateful for any insight on the particular point of why } '-config sys.config' breaks mnesia, though. Even though it The syntax is '-config sys'. -Vance From mhao@REDACTED Fri Apr 14 21:03:40 2006 From: mhao@REDACTED (Hao, Ming) Date: Fri, 14 Apr 2006 12:03:40 -0700 Subject: Scheduling on CMP Message-ID: <4014A11792AA1747BBE84A29E6383B87A5C949@exchg-sea3-03.ant.amazon.com> Sorry if this question has been asked. With multiple processors available in a machine, can an erlang virtual machines schedule processes to run on them? Or you have to run multiple erlang virtual machines in order to do it? Thanks. -ming -------------- next part -------------- An HTML attachment was scrubbed... URL: From jaiswal.vikash@REDACTED Mon Apr 17 09:17:52 2006 From: jaiswal.vikash@REDACTED (jaiswal.vikash@REDACTED) Date: Mon, 17 Apr 2006 12:47:52 +0530 Subject: How to handle gs error ? Message-ID: Hello sir , I had posted a query with reference to the error given below : ( Please refer : http://article.gmane.org/gmane.comp.lang.erlang.general/14761 for the query and it's response ) gs error: =ERROR REPORT==== 6-Apr-2006::09:37:10 === Error in process <0.35.0> on node 'msa@REDACTED' with exit value: {{badmatch,[]},[{gstk_db,opt,3},{gstk_window,event,5},{gstk,doit,2},{gst k,loop,1}]} user backend died reason {{badmatch,[]},[{gstk_db,opt,3},{gstk_window,event,5},{gstk,doit,2},{gst k,loop,1}]} My sincere thanks to Mr.. Gunilla Arendt for the reply .As put in the reply it is a GS application problem . Here I would like to know how could I handle this error . As per my understanding the following files in erlang needs to be modified : gstk_db.erl gstk_window.erl gstk.erl Can anyone suggest me what exactly should be the modifications so as to handle the error . Also is there any way I can see the log messages for GS application itself . Regards , Vikash The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From trinder@REDACTED Mon Apr 17 11:46:47 2006 From: trinder@REDACTED (Phil Trinder) Date: Mon, 17 Apr 2006 10:46:47 +0100 (BST) Subject: 2006 Erlang Workshop Message-ID: <3523.82.41.12.29.1145267207.squirrel@www.macs.hw.ac.uk> Folks, Don't forget the 2006 ACM SIGPLAN Erlang Workshop, September 26th in Portland, Oregon (http://www.erlang.se/workshop/2006/). The workshop is a forum for the Erlang open-source, academic, and industrial communities. We welcome high-quality papers outlining new Erlang language developments, techniques, tools and novel applications. The workshop is co-located with ICFP'06 (http://icfp06.cs.uchicago.edu/). The submission deadline is early June, and even if you don't have a paper, it's a good place to find out what's happening in the Erlang community. See you there! Phil -------------------------------------------------- Phil Trinder School of Mathematical and Computer Sciences Heriot-Watt University Edinburgh, EH14 4AS E-mail: trinder@REDACTED Teleph: +44 (0)131 451 3435 Depart: +44 (0)131 451 3328 Fasmly: +44 (0)131 451 3327 Intrnt: http://www.macs.hw.ac.uk/~trinder From mats.cronqvist@REDACTED Tue Apr 18 09:05:50 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 18 Apr 2006 09:05:50 +0200 Subject: process runtime, time and simulation in erlang In-Reply-To: <000001c66010$aec754c0$0600a8c0@st.se> References: <000001c66010$aec754c0$0600a8c0@st.se> Message-ID: <44448FCE.8060501@ericsson.com> Lennart Ohman wrote: > Hi, > one way of doing it is using the trace functionality. Use > erlang:trace/3 to turn the 'running' 'timestamp' and 'cpu_timestamp' > flag on for all processes. You will the get 'in' and 'out' trace > messages for every process. > > Look at erlang:trace/3 in the erlang module in kernel application > for more details. > > Note cpu timestamp currently only works on Solaris as far as I know. linux as well. > Best Regards, > Lennart > From launoja@REDACTED Tue Apr 18 09:29:32 2006 From: launoja@REDACTED (launoja@REDACTED) Date: Tue, 18 Apr 2006 10:29:32 +0300 (EEST) Subject: Scheduling on CMP In-Reply-To: <4014A11792AA1747BBE84A29E6383B87A5C949@exchg-sea3-03.ant.amazon.com> References: <4014A11792AA1747BBE84A29E6383B87A5C949@exchg-sea3-03.ant.amazon.com> Message-ID: <1145345372.4444955c51825@webmail.dnainternet.net> Lainaus "Hao, Ming" : > Sorry if this question has been asked. With multiple processors > available in a machine, can an erlang virtual machines schedule > processes to run on them? Or you have to run multiple erlang virtual > machines in order to do it? Thanks. The Erlang Virtual Machine is not yet multithreaded (except for asynchronous I/O), but there's development snapshot of multithreading Erlang Virtual Machine available at http://www.erlang.org/download/snapshots/otp_src_P11B_2006-02-26.tar.gz . Compile it with: ./configure --enable-smp-support --disable-lock-checking My initial experiences indicate that either it doesn't scale in Mnesia's bench or Mac OS X's Mach-microkernel holds it back. I've got some results from my Mac Mini Core Duo, but I run some more tests soon. My feeling is that it does scale quite nicely when there's no contention to ets (which Mnesia is based on) as Joe's & CO's experiments hints: http://www.erlang-stuff.net/blog/ >From the list: http://www.erlang.org/ml-archive/erlang-questions/200602/msg00467.html http://www.erlang.org/ml-archive/erlang-questions/200603/msg00019.html http://www.erlang.org/ml-archive/erlang-questions/200603/msg00142.html > -ming > Jani Launonen From serge@REDACTED Tue Apr 18 13:15:17 2006 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 18 Apr 2006 07:15:17 -0400 Subject: bug or feature? Message-ID: <4444CA45.10605@hq.idt.net> Could anyone explain why matches #5 and #6 below fail? I didn't find in documentation a limitation of not being able to specify a variable as the first argument of the '++' transform. Eshell V5.4.13 (abort with ^G) (a@REDACTED)1> Prefix = "200". "200" (a@REDACTED)2> Suffix = "100". "100" (a@REDACTED)3> "200" ++ "100" = "200100". "200100" (a@REDACTED)4> "200" ++ Suffix = "200100". "200100" (a@REDACTED)5> Prefix ++ "100" = "200100". ** 1: illegal pattern ** (a@REDACTED)6> Prefix ++ Suffix = "200100". ** 1: illegal pattern ** (a@REDACTED)7> Prefix ++ Suffix. "200100" (a@REDACTED)9> "200" ++ Suffix = v(7). "200100" Regards, Serge From gunilla@REDACTED Tue Apr 18 13:47:30 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Tue, 18 Apr 2006 13:47:30 +0200 Subject: bug or feature? In-Reply-To: <4444CA45.10605@hq.idt.net> References: <4444CA45.10605@hq.idt.net> Message-ID: <4444D1D2.8010000@erix.ericsson.se> From the reference manual: 6.4.2 String Prefix in Patterns When matching strings, the following is a valid pattern: f("prefix" ++ Str) -> ... This is syntactic sugar for the equivalent, but harder to read f([$p,$r,$e,$f,$i,$x | Str]) -> ... Regards, Gunilla Serge Aleynikov wrote: > Could anyone explain why matches #5 and #6 below fail? I didn't find in > documentation a limitation of not being able to specify a variable as > the first argument of the '++' transform. > > Eshell V5.4.13 (abort with ^G) > (a@REDACTED)1> Prefix = "200". > "200" > (a@REDACTED)2> Suffix = "100". > "100" > (a@REDACTED)3> "200" ++ "100" = "200100". > "200100" > (a@REDACTED)4> "200" ++ Suffix = "200100". > "200100" > (a@REDACTED)5> Prefix ++ "100" = "200100". > ** 1: illegal pattern ** > (a@REDACTED)6> Prefix ++ Suffix = "200100". > ** 1: illegal pattern ** > (a@REDACTED)7> Prefix ++ Suffix. > "200100" > (a@REDACTED)9> "200" ++ Suffix = v(7). > "200100" > > Regards, > > Serge > > From richardc@REDACTED Tue Apr 18 14:34:25 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 18 Apr 2006 14:34:25 +0200 Subject: bug or feature? In-Reply-To: <4444CA45.10605@hq.idt.net> References: <4444CA45.10605@hq.idt.net> Message-ID: <4444DCD1.2080709@it.uu.se> Serge Aleynikov wrote: > Could anyone explain why matches #5 and #6 below fail? I didn't find in > documentation a limitation of not being able to specify a variable as > the first argument of the '++' transform. > > Eshell V5.4.13 (abort with ^G) > (a@REDACTED)5> Prefix ++ "100" = "200100". > ** 1: illegal pattern ** > (a@REDACTED)6> Prefix ++ Suffix = "200100". > ** 1: illegal pattern ** A pattern "fred" ++ Suffix is equivalent to [$f, $r, $e, $d | Suffix], which is easy to match on. For a pattern Prefix ++ Suffix, when Prefix is previously bound to some value (unknown at compile time), you could imagine the compiler generating code to perform the match as a loop (much like you'd match String = "foo" for a previously bound String) but there are some complications: what does it mean if Prefix turns out to be a non-list, or if it is not nil-terminated? Then, the pattern itself is illegal (just like the *expression* Prefix ++ Suffix). Should you get a "badarg" error instead of just a nonmatch? And if the pattern occurs in the second clause of a case, but the first clause matches, should you still get a badarg or not? The current limitation makes sure that patterns are always legal regardless of the runtime values. (I'm not saying that it would not be convenient to have that kind of matching available, along with general regexps - it would, but it is not obvious that it can be made to fit in with the semantics of clause matching in Erlang, which has the advantage of predictability.) /Richard From ulf.wiger@REDACTED Tue Apr 18 16:36:20 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 18 Apr 2006 16:36:20 +0200 Subject: HELP ME, please Message-ID: Couldn't this little code snippet be made into an official OTP function, somewhere? It's a little bit too complicated to hold in memory, and the docs are a little bit too terse to allow people to figure it out each time. At least, it could become an example in the docs for syntax_tools or beam_lib? Then, people'd have something to copy-paste from. BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Mats Cronqvist > Sent: den 13 april 2006 12:54 > To: erlang-questions@REDACTED > Subject: Re: HELP ME, please > > if the beam file was generated with erlc +debug_info this > ought to work; > > {ok,{_,[{abstract_code,{_,AC}}]}}=beam_lib:chunks(BeamFileName > ,[abstract_code]). > io:fwrite("~s~n",[erl_prettypr:format(erl_syntax:form_list(AC))]). > > mats > > Daniele Andreasi wrote: > > Hallo, > > > > I have a big problem: i loose my ".erl" file!, but i have > the ".beam"; > > > > Do anybody know if exist a way to rebuild a file ".erl" by > a file ".beam"? > > ANY WAY. > > > > Thanks > From mats.cronqvist@REDACTED Tue Apr 18 16:56:26 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 18 Apr 2006 16:56:26 +0200 Subject: HELP ME, please In-Reply-To: References: Message-ID: <4444FE1A.1080008@ericsson.com> maybe the FAQ? mats Ulf Wiger (AL/EAB) wrote: > Couldn't this little code snippet be made into an official > OTP function, somewhere? > > It's a little bit too complicated to hold in memory, > and the docs are a little bit too terse to allow > people to figure it out each time. > > At least, it could become an example in the docs > for syntax_tools or beam_lib? Then, people'd have > something to copy-paste from. > > BR, > Ulf W > > >>-----Original Message----- >>From: owner-erlang-questions@REDACTED >>[mailto:owner-erlang-questions@REDACTED] On Behalf Of Mats Cronqvist >>Sent: den 13 april 2006 12:54 >>To: erlang-questions@REDACTED >>Subject: Re: HELP ME, please >> >> if the beam file was generated with erlc +debug_info this >>ought to work; >> >>{ok,{_,[{abstract_code,{_,AC}}]}}=beam_lib:chunks(BeamFileName >>,[abstract_code]). >>io:fwrite("~s~n",[erl_prettypr:format(erl_syntax:form_list(AC))]). >> >> mats >> >>Daniele Andreasi wrote: >> >>>Hallo, >>> >>>I have a big problem: i loose my ".erl" file!, but i have >> >>the ".beam"; >> >>>Do anybody know if exist a way to rebuild a file ".erl" by >> >>a file ".beam"? >> >>>ANY WAY. >>> >>>Thanks >> From serge@REDACTED Tue Apr 18 17:59:51 2006 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 18 Apr 2006 11:59:51 -0400 Subject: bug or feature? In-Reply-To: <4444DCD1.2080709@it.uu.se> References: <4444CA45.10605@hq.idt.net> <4444DCD1.2080709@it.uu.se> Message-ID: <44450CF7.1060006@hq.idt.net> It seems like for a previously bound Prefix, a compiler could add a is_list(Prefix) check, and convert Prefix ++ Suffix into a loop, failing with badarg if the first check fails. I find this quite useful, as it would allow for doing things like: strip_prefix(Prefix ++ Suffix, Prefix) -> Suffix; strip_prefix(String) -> String. instead of: strip_prefix(String, Prefix) -> strip_prefix2(String, Prefix, String). strip_prefix2(Suffix, [], _String) -> Suffix; strip_prefix2([C | Tail], [C | PrefTail], String) -> strip_prefix2(Tail, PrefTail, String); strip_prefix2(_, _, String) -> String. There's no doubt that the first choice is much easier to read. Regards, Serge Richard Carlsson wrote: > Serge Aleynikov wrote: > >> Could anyone explain why matches #5 and #6 below fail? I didn't find >> in documentation a limitation of not being able to specify a variable >> as the first argument of the '++' transform. >> >> Eshell V5.4.13 (abort with ^G) >> (a@REDACTED)5> Prefix ++ "100" = "200100". >> ** 1: illegal pattern ** >> (a@REDACTED)6> Prefix ++ Suffix = "200100". >> ** 1: illegal pattern ** > > > A pattern "fred" ++ Suffix is equivalent to [$f, $r, $e, $d | Suffix], > which is easy to match on. For a pattern Prefix ++ Suffix, when Prefix > is previously bound to some value (unknown at compile time), you could > imagine the compiler generating code to perform the match as a loop > (much like you'd match String = "foo" for a previously bound String) > but there are some complications: what does it mean if Prefix turns out > to be a non-list, or if it is not nil-terminated? Then, the pattern > itself is illegal (just like the *expression* Prefix ++ Suffix). Should > you get a "badarg" error instead of just a nonmatch? And if the pattern > occurs in the second clause of a case, but the first clause matches, > should you still get a badarg or not? The current limitation makes > sure that patterns are always legal regardless of the runtime values. > > (I'm not saying that it would not be convenient to have that kind of > matching available, along with general regexps - it would, but it is > not obvious that it can be made to fit in with the semantics of clause > matching in Erlang, which has the advantage of predictability.) > > /Richard > > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From ulf.wiger@REDACTED Tue Apr 18 18:35:25 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 18 Apr 2006 18:35:25 +0200 Subject: auto-generated record access functions Message-ID: I've written a small(-ish) parse transform that generates code for accessing exported records. I did read through ROK's abstract patterns proposal once more, but decided that it would be too much to try to implement _that_. The current hack does use function names that are somewhat similar to ROK's abstract patterns, but I don't think that will be a problem (mainly because I don't envision that anyone would use this stuff if the abstract patterns were available.) The idea is to use records as before, but for module- local use. For outside callers, records are 'exported' by including a -export_records([RecName]) directive. The following code extract illustrates the kind of code laid out by the parse_transform: -module(test). -compile({parse_transform, exprecs}). -record(a, {a, b, c}). -export_records([a]). %%% generated code -export(['#new-a'/0, '#new-a'/1, '#get-a'/2, '#set-a'/2, '#info-a'/1]). '#new-a'() -> #a{}. '#new-a'(Vals) -> '#set-a'(Vals, #a{}). '#get-a'(Attrs, R) when is_list(Attrs) -> ['#get-a'(A, R) || A <- Attrs]; '#get-a'(a, R) -> R#a.a; '#get-a'(b, R) -> R#a.b; '#get-a'(c, R) -> R#a.c. '#set-a'(Vals, Rec) -> F = fun ([], R, _F1) -> R; ([{a, V} | T], R, F1) -> F1(T, R#a{a = V}, F1); ([{b, V} | T], R, F1) -> F1(T, R#a{b = V}, F1); ([{c, V} | T], R, F1) -> F1(T, R#a{c = V}, F1) end, F(Vals, Rec, F). '#info-a'(fields) -> record_info(fields, a). %%% end generated code A short shell dialogue to illustrate the use: Eshell V5.4.12 (abort with ^G) 1> test:'#new-a'(). {a,undefined,undefined,undefined} 2> test:'#set-a'([{a,1},{c,3}], v(1)). {a,1,undefined,3} 3> test:'#set-a'([{b,2}], v(2)). {a,1,2,3} 4> test:'#get-a'(b, v(3)). 2 5> test:'#get-a'([a,c], v(3)). [1,3] 6> test:'#info-a'(fields). [a,b,c] Parse transformery attached. It's based on the stools_id_trans module that I posted a while back, but with improved error handling (controlled errors in the parse_transform module are reported as regular compilation errors.) BR, Ulf W -------------- next part -------------- A non-text attachment was scrubbed... Name: exprecs.erl Type: application/octet-stream Size: 9558 bytes Desc: exprecs.erl URL: From richardc@REDACTED Wed Apr 19 00:43:06 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 19 Apr 2006 00:43:06 +0200 Subject: EUnit 2.0 alpha testers wanted Message-ID: <44456B7A.1060609@it.uu.se> I have sort of stolen the EUnit project from Mickael Remond, with his permission (and he even lets me use his svn server). The new EUnit is based on some ideas I once used for automated testing of student assignments (plus the usual unit testing ideas from JUnit, PyUnit, etc.) Some features: - extremely compact notation; tests are _really_ easy to write - powerful primitives: run tests in order or in parallel, in separate subprocesses, on separate nodes, or all at once - easy combination of tests into test suites - run OS commands as tests and check status and/or output - watching of modules - when a module is reloaded, its tests can be executed and reported automatically - other stuff that I forget at the moment - no documentation (yet) - use the Source! (many examples can be found in the code) Tarball here: http://user.it.uu.se/~richardc/eunit/ Remember, this is alpha testing - you are expected to have some patience finding out how to use it, and not be too upset if some interface details change later (possibly as a consequence of feedback from alpha testers). Let me know what you think! /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From ok@REDACTED Wed Apr 19 03:51:01 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 19 Apr 2006 13:51:01 +1200 (NZST) Subject: bug or feature? Message-ID: <200604190151.k3J1p1ub102116@atlas.otago.ac.nz> Serge Aleynikov wrote that strip_prefix(Prefix ++ Suffix, Prefix) -> Suffix; strip_prefix(String, _Prefix) -> % fixed String. would be "much easier to read" than strip_prefix(String, Prefix) -> strip_prefix2(String, Prefix, String). strip_prefix2(Suffix, [], _String) -> Suffix; strip_prefix2([C|Tail], [C|PrefTail], String) -> strip_prefix2(Tail, PrefTail, String); strip_prefix2(_, _, String) -> String. I don't find either of them particularly easy to read, because the code contradicts the name. However implemented, this function DOESN'T always strip a prefix. By the time that has been addressed with a fair comment explaining what the function really does, there is little to choose between these functions. strip_prefix(List, Prefix) -> case lists:prefix(Prefix, List) of true -> lists:nthtail(length(Prefix), List) ; false -> List end. is only one line longer than the ++ version, and seems pretty clear (except for the non-intention-revealing name). From raould@REDACTED Tue Apr 18 22:12:44 2006 From: raould@REDACTED (Raoul Duke) Date: Tue, 18 Apr 2006 13:12:44 -0700 Subject: Emulator syntax question Message-ID: <91a2ba3e0604181312t5506dcd9obca4ecd644c2be30@mail.gmail.com> Hello, (The search of the archives is giving me "Internal Server Error" so I apologies if this is something already covered in the past. I didn't yet notice it in the FAQ.) I'm attempting to learn Erlang, at least a little, and am running into issues right off the bat with the 'BEAM' emulator - presumably an impedence mismatch between my expectations from other interactive shells and Erlang's actual approach. The basic problem is that I'm trying to enter a function definition with the syntax one would use in a module file, and it doesn't work in the emulator. I can't use tabs to indent things like I see in the tutorials (tab shows me a list of commands), so I try to do them on a single line using ";" and "." and maybe "end". If I try to do "foo(1) -> 'hello'." (w/out the double quotes in all these examples) I get "** 1: syntax error before: '->' **". But I think that's the syntax you would see in a file; I made foo.erl with the appropriate module and export lines, and function definition and it all worked. I can get the function to work if I bind an anonymous one to a variable, but then I can't figure out how to do more than one function clause e.g. like what you'd do for factorial. "Xg = fun(1) -> 'hello' end." works but "Xg = fun(1) -> 'hello'; fun(2) -> throw({myerror, abc}) end." nets me "** 1: syntax error before: 'fun' **" Any clues would be most appreciated by this Erlang newbie. sincerely. From mhao@REDACTED Tue Apr 18 19:36:46 2006 From: mhao@REDACTED (Ming Hao) Date: Tue, 18 Apr 2006 10:36:46 -0700 (PDT) Subject: Scheduling on CMP In-Reply-To: <1145345372.4444955c51825@webmail.dnainternet.net> References: <4014A11792AA1747BBE84A29E6383B87A5C949@exchg-sea3-03.ant.amazon.com> <1145345372.4444955c51825@webmail.dnainternet.net> Message-ID: Thanks. I am really excited to see who well the multi-threaded erlang machine works with multiple CPU cores. -ming On Tue, 18 Apr 2006 launoja@REDACTED wrote: > Lainaus "Hao, Ming" : > > > Sorry if this question has been asked. With multiple processors > > available in a machine, can an erlang virtual machines schedule > > processes to run on them? Or you have to run multiple erlang virtual > > machines in order to do it? Thanks. > > The Erlang Virtual Machine is not yet multithreaded (except for asynchronous > I/O), but there's development snapshot of multithreading Erlang Virtual Machine > available at > http://www.erlang.org/download/snapshots/otp_src_P11B_2006-02-26.tar.gz . > Compile it with: ./configure --enable-smp-support --disable-lock-checking > > My initial experiences indicate that either it doesn't scale in Mnesia's bench > or Mac OS X's Mach-microkernel holds it back. I've got some results from my Mac > Mini Core Duo, but I run some more tests soon. My feeling is that it does scale > quite nicely when there's no contention to ets (which Mnesia is based on) as > Joe's & CO's experiments hints: > http://www.erlang-stuff.net/blog/ > > From the list: > http://www.erlang.org/ml-archive/erlang-questions/200602/msg00467.html > http://www.erlang.org/ml-archive/erlang-questions/200603/msg00019.html > http://www.erlang.org/ml-archive/erlang-questions/200603/msg00142.html > > > -ming > > > > > > Jani Launonen > From vlad.xx.dumitrescu@REDACTED Wed Apr 19 09:26:50 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Wed, 19 Apr 2006 09:26:50 +0200 Subject: Emulator syntax question Message-ID: <11498CB7D3FCB54897058DE63BE3897C017F5FB4@esealmw105.eemea.ericsson.se> Hello, and welcome! The short answer is that in the shell you can only define anonymous functions, like you have discovered. Defining one with several clauses is written like this Xg = fun(1) -> hello; (2) -> throw({myerror, abc}) end. It may be easier to use modules and files instead of fighting the shell (where some things are different than usual). Emacs with the Erlang mode is useful, you can have the file and the shell accessible directly. Hope this helps. Regards, Vlad > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Raoul Duke > The basic problem is that I'm trying to enter a function > definition with the syntax one would use in a module file, > and it doesn't work in the emulator. I can't use tabs to > indent things like I see in the tutorials (tab shows me a > list of commands), so I try to do them on a single line using > ";" and "." and maybe "end". > > I can get the function to work if I bind an anonymous one to > a variable, but then I can't figure out how to do more than > one function clause e.g. like what you'd do for factorial. > "Xg = fun(1) -> 'hello' > end." works but "Xg = fun(1) -> 'hello'; fun(2) -> throw({myerror, > abc}) end." nets me "** 1: syntax error before: 'fun' **" From matthias@REDACTED Wed Apr 19 09:30:27 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 19 Apr 2006 09:30:27 +0200 Subject: Emulator syntax question In-Reply-To: <91a2ba3e0604181312t5506dcd9obca4ecd644c2be30@mail.gmail.com> References: <91a2ba3e0604181312t5506dcd9obca4ecd644c2be30@mail.gmail.com> Message-ID: <17477.59155.600770.479377@antilipe.corelatus.se> Raoul Duke writes: > I'm attempting to learn Erlang, at least a little, and am running into > issues right off the bat with the 'BEAM' emulator - presumably an > impedence mismatch between my expectations from other interactive > shells and Erlang's actual approach. Yep, that's it. You're expecting the shell to interpret Erlang programs, whereas it only interprets Erlang expressions. So while things like 1> 3 + 9. 12 2> lists:reverse("ekuD luoaR"). "Raoul Duke" work, you can't define a normal function in the shell. As you figured out, you can define anonymous functions in the shell, but I don't think it's a pleasant way of playing around with Erlang. And you have to resort to tricks to get recursion. Bottom line: the normal way to write Erlang code is to put it in a file and compile the file. > "Xg = fun(1) -> 'hello'; fun(2) -> throw({myerror, abc}) end." > nets me "** 1: syntax error before: 'fun' **" Try deleting the second occurrance of "fun", i.e. 3> Xg = fun(1) -> 'hello'; (2) -> throw({myerror,abc}) end. #Fun Matthias From karol.skocik@REDACTED Wed Apr 19 09:44:58 2006 From: karol.skocik@REDACTED (karol skocik) Date: Wed, 19 Apr 2006 09:44:58 +0200 Subject: SNMP manager problem in handle_register_agent/4 Message-ID: Hi dear Erlangers! I am having an obscure problem with SNMP manager. I have developed a SNMP agent application in Erlang couple months ago (my first Erlang app!! hopefully not last :-), and now, at the time of integration and internal testing, I am not able to make the manager running for testing of the agent. I have tried many times a configuration changes with snmp:config(), dumbing SNMP to v1 with no security (not really usable for us, but to achieve a minimum functionality), and also I have tried trapexit's howto, but no luck so far. I am quite puzzled, since I think I didn't change anything in the process of configuration, but since no other Erlang user is signalling problems with the manager, it seems that the problem must be on my side. When I start erl with config files for manager, and I do application:start(snmp) I get immediately a very badly formated error (because it was stringified), which after unstringing and some indentation looks like this : md@REDACTED ~/md_projects/snmp/manager $ ./run_manager Erlang (BEAM) emulator version 5.4.13 [source] [hipe] Eshell V5.4.13 (abort with ^G) (manager@REDACTED)1> application:start(snmp). =ERROR REPORT==== 19-Apr-2006::09:10:55 === [snmpm_config] init exit: {{badmatch,{error,not_found}}, [{snmpm_config,handle_register_agent,4}, {snmpm_config,init_agent_config,1}, {snmpm_config,init_agents_config,1}, {snmpm_config,do_init,1}, {snmpm_config,init,1}, {gen_server,init_it,6}, {proc_lib,init_p,5}]} =INFO REPORT==== 19-Apr-2006::09:10:55 === application: snmp exited: invalid return value from snmp_app:start(normal,[]) -> {'EXIT',{{badmatch,{error, {shutdown, {child, undefined, snmpm_supervisor, {snmpm_supervisor, start_link,[normal, [{priority,normal}, {versions,[v1]}, {config,[{dir,"/home/md/md_projects/snmp/manager/conf/"}, {verbosity,silence}, {db_dir,"/home/md/md_projects/snmp/manager/db/"}, {repair,true}, {auto_save,5000}]}, {inform_request_behaviour,auto}, {mibs,[]}, {server, [{timeout,30000}, {verbosity,silence}]}, {note_store, [{timeout,30000}, {verbosity,silence}]}, {net_if, [{module,snmpm_net_if}, {verbosity,log}, {options, [{bind_to,false}, {no_reuse,false}]}]}, {def_user_mod, snmpm_user_default}, {def_user_data, undefined}]]}, transient,2000, supervisor,[snmpm_supervisor,supervisor]}}}}, [{snmp_app,start,2},{application_master,start_it_old,4}]}} type: temporary {error,"invalid return value from snmp_app:start(normal,[]) -> {'EXIT',{{... the same error here stringified " I am running on : md@REDACTED ~/md_projects $ uname -a Linux saturn 2.6.14-gentoo-r4 #5 SMP PREEMPT Sun Jan 29 09:45:05 CET 2006 i686 Intel(R) Celeron(R) M processor 1.40GHz GenuineIntel GNU/Linux The config files (the paths must be changed) are in the attachment, I hope somebody with the Erlang SNMP knowledge will take a look at that, and tell the rookie what is the problem. (And help spreading Erlang in our company & beyond ;-) Thanks for your time, Karol Skocik -------------- next part -------------- A non-text attachment was scrubbed... Name: snmp.tar.gz Type: application/x-gzip Size: 4557 bytes Desc: not available URL: From bmk@REDACTED Wed Apr 19 10:34:09 2006 From: bmk@REDACTED (Micael Karlberg) Date: Wed, 19 Apr 2006 10:34:09 +0200 Subject: SNMP manager problem in handle_register_agent/4 In-Reply-To: References: Message-ID: <4445F601.10601@erix.ericsson.se> Hi, I changed the paths in your config file, and it ran just fine. Try running this after enabling verbosity for config (set it to trace instead of silence). Also, just to be sure, you don't have a machine named 'default' do you? /BMK karol skocik wrote: > Hi dear Erlangers! > I am having an obscure problem with SNMP manager. I have developed a > SNMP agent application in Erlang couple months ago (my first Erlang > app!! hopefully not last :-), and now, at the time of integration and > internal testing, I am not able to make the manager running for > testing of the agent. I have tried many times a configuration changes > with snmp:config(), dumbing SNMP to v1 with no security (not really > usable for us, but to achieve a minimum functionality), and also I > have tried trapexit's howto, but no luck so far. I am quite puzzled, > since I think I didn't change anything in the process of > configuration, but since no other Erlang user is signalling problems > with the manager, it seems that the problem must be on my side. > > When I start erl with config files for manager, and I do > application:start(snmp) I get immediately a very badly formated error > (because it was stringified), which after unstringing and some > indentation looks like this : > > md@REDACTED ~/md_projects/snmp/manager $ ./run_manager > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] > > Eshell V5.4.13 (abort with ^G) > (manager@REDACTED)1> application:start(snmp). > > =ERROR REPORT==== 19-Apr-2006::09:10:55 === > [snmpm_config] init exit: {{badmatch,{error,not_found}}, > [{snmpm_config,handle_register_agent,4}, > {snmpm_config,init_agent_config,1}, > {snmpm_config,init_agents_config,1}, > {snmpm_config,do_init,1}, > {snmpm_config,init,1}, > {gen_server,init_it,6}, > {proc_lib,init_p,5}]} > > =INFO REPORT==== 19-Apr-2006::09:10:55 === > application: snmp > exited: invalid return value from snmp_app:start(normal,[]) -> > {'EXIT',{{badmatch,{error, > {shutdown, > {child, > undefined, > snmpm_supervisor, > {snmpm_supervisor, > start_link,[normal, > [{priority,normal}, > {versions,[v1]}, > {config,[{dir,"/home/md/md_projects/snmp/manager/conf/"}, > {verbosity,silence}, > {db_dir,"/home/md/md_projects/snmp/manager/db/"}, > {repair,true}, > {auto_save,5000}]}, > {inform_request_behaviour,auto}, > {mibs,[]}, > {server, > [{timeout,30000}, > {verbosity,silence}]}, > {note_store, > [{timeout,30000}, > {verbosity,silence}]}, > {net_if, > [{module,snmpm_net_if}, > {verbosity,log}, > {options, > [{bind_to,false}, > {no_reuse,false}]}]}, > {def_user_mod, > snmpm_user_default}, > {def_user_data, > undefined}]]}, > transient,2000, > supervisor,[snmpm_supervisor,supervisor]}}}}, > [{snmp_app,start,2},{application_master,start_it_old,4}]}} > type: temporary > {error,"invalid return value from snmp_app:start(normal,[]) -> > {'EXIT',{{... the same error here stringified " > > I am running on : > md@REDACTED ~/md_projects $ uname -a > Linux saturn 2.6.14-gentoo-r4 #5 SMP PREEMPT Sun Jan 29 09:45:05 CET > 2006 i686 Intel(R) Celeron(R) M processor 1.40GHz GenuineIntel > GNU/Linux > > The config files (the paths must be changed) are in the attachment, I > hope somebody with the Erlang SNMP knowledge will take a look at that, > and tell the rookie what is the problem. (And help spreading Erlang in > our company & beyond ;-) > > Thanks for your time, > Karol Skocik From erlang@REDACTED Wed Apr 19 10:35:58 2006 From: erlang@REDACTED (Michael McDaniel) Date: Wed, 19 Apr 2006 01:35:58 -0700 Subject: mnesia no disk write after restart In-Reply-To: <20060417230924.GB51423@frogman.motivity.ca> References: <20060417084251.GU964@delora.autosys.us> <20060417211117.GA964@delora.autosys.us> <20060417214208.GB964@delora.autosys.us> <20060417230924.GB51423@frogman.motivity.ca> Message-ID: <20060419083558.GO7007@delora.autosys.us> On Mon, Apr 17, 2006 at 07:09:24PM -0400, Vance Shipley wrote: > On Mon, Apr 17, 2006 at 02:42:08PM -0700, Michael McDaniel wrote: > } > } I am grateful for any insight on the particular point of why > } '-config sys.config' breaks mnesia, though. Even though it > > > The syntax is '-config sys'. > > -Vance ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oh, thank you, I see what you mean. From erl -man erl ... " -config Config: Specifies the name of a configuration file, Config.config, which is used to configure applications. See app(4) and application(3). " Not close enough reading on my part the first time around. However, '-config sys.config' is working when running the module from my script; -config sys.config properly points the module to use the directory defined in sys.config (and also, I added {dump_log_time_threshold, 30000} and from running mnesia:system_info(all) I could see the time was actually changed from the default 180000. Recall from original post, the content of sys.config is [{mnesia, [{dir, "/home/erl/Mnesia.block"} , %% {debug, trace} , {schema_location, disc}]}]. The problem is that when I start the observer program as erl -sname fu -config sys.config -s file script checkblock \ -s erlang halt then mnesia will no longer write to disk *from the previously started and running module*. I believe the -config sys.config is getting properly read due to tests. However, starting the observer program as erl -sname fu -mnesia extra_db_nodes [module_nodename@REDACTED] \ -s file script checkblock -s init stop works fine and mnesia continues to write to disk fine from the previously started and running module. The original running module and the observer module are both started with different -sname nodename. My shallow understanding of how this works is that the observer node communicates with mnesia as well as to the node which created the database. And that by providing the directory path of the database to the observer node, things break; the observer node is using mnesia ram_only and somehow that gets carried over to the database when providing the directory path. Anyway, that is what I have concluded. Whether or not it is mnesia design behaviour or a bug, that is what appears to be happening. I have the combination that works for me; I would still would like to understand the mechanism by which providing the directory path of the database to the observer program causes mnesia to henceforth be a ram_only database (even from the originally started and running module which created the database and which is listed from mnesia:system_info(all) as a disc_copy node). Contents of checkblock are... mnesia:start(). timer:sleep(200). mnesia:wait_for_tables([ip,schema], 7000) , X = block:dirty_sorted_list_table_localtime(). Z = global:registered_names(). io:format('~p~n~p entries~nregistered names: ~p~n', [X, length(X), Z]). mnesia:stop(). If anyone would like more context, please see my previous (to this) post on this subject. ~Michael From vlad_dumitrescu@REDACTED Wed Apr 19 14:41:29 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 19 Apr 2006 14:41:29 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <44456B7A.1060609@it.uu.se> Message-ID: Very cool! I like it! There is one feature that I'd like to see on the todo list (I use it in a homebrewn testing solution): capture output from tests and if the test failed print it out, otherwise remain silent. Of course, I don't mean "print to the console", but to the logging handler. The tricky part would be making it as simple to use as the rest. The reason for this is that if a test fails, I like to see the debug printouts to be able to pinpoint the problem. Rerunning the test with debug enabled takes away from the elegance, doesn't it? Also, it would be nice to have this integrated in Erlide ;-) so if the user response will be good I can give it an Eclipse GUI. Regards, Vlad > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Richard Carlsson > > I have sort of stolen the EUnit project from Mickael Remond, > with his permission (and he even lets me use his svn server). > The new EUnit is based on some ideas I once used for > automated testing of student assignments (plus the usual unit > testing ideas from JUnit, PyUnit, etc.) From richardc@REDACTED Wed Apr 19 15:09:40 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 19 Apr 2006 15:09:40 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: References: Message-ID: <44463694.2040403@it.uu.se> Vlad Dumitrescu wrote: > There is one feature that I'd like to see on the todo list (I use it in a > homebrewn testing solution): capture output from tests and if the test > failed print it out, otherwise remain silent. Of course, I don't mean "print > to the console", but to the logging handler. The tricky part would be making > it as simple to use as the rest. > The reason for this is that if a test fails, I like to see the debug > printouts to be able to pinpoint the problem. Rerunning the test with debug > enabled takes away from the elegance, doesn't it? I guess you mean "output from tests" as in "erlang io output produced by the test code". That could easily be redirected to the logger, and should be fixed right away. Silly me to not think about it before. /Richard From vlad_dumitrescu@REDACTED Wed Apr 19 15:19:24 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 19 Apr 2006 15:19:24 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <44463694.2040403@it.uu.se> Message-ID: > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Richard Carlsson > > Vlad Dumitrescu wrote: > > There is one feature that I'd like to see on the todo list > (I use it > > in a homebrewn testing solution): capture output from tests > and if the > > test failed print it out, otherwise remain silent. Of > course, I don't > > mean "print to the console", but to the logging handler. The tricky > > part would be making it as simple to use as the rest. > > I guess you mean "output from tests" as in "erlang io output > produced by the test code". That could easily be redirected > to the logger, and should be fixed right away. Silly me to > not think about it before. Yes, that's basically what I meant, io output is what I use today. In the bigger picture, it's not io output that's most interesting, but any Erlang term. Rendering the term is then left to the corresponding frontend. Regards, Vlad From serge@REDACTED Wed Apr 19 18:33:26 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 19 Apr 2006 12:33:26 -0400 Subject: bug or feature? In-Reply-To: <200604190151.k3J1p1ub102116@atlas.otago.ac.nz> References: <200604190151.k3J1p1ub102116@atlas.otago.ac.nz> Message-ID: <44466656.3010602@hq.idt.net> In a general case you are absolutely right as the complexity of the proposed solution is still linear. Would anyone care that the other approach would work 2 to 3 times faster? When it comes to soft-real-time applications with extensive prefix analysis, I would. Though I realize that the majority of apps don't care. A more rhetorical question would be that if '++' is a "syntactic sugar" why wouldn't that syntactic sugar apply for bound Prefix variables as well to make it more generic? Serge Richard A. O'Keefe wrote: > Serge Aleynikov wrote that > > strip_prefix(Prefix ++ Suffix, Prefix) -> > Suffix; > strip_prefix(String, _Prefix) -> % fixed > String. > > would be "much easier to read" than > > strip_prefix(String, Prefix) -> > strip_prefix2(String, Prefix, String). > > strip_prefix2(Suffix, [], _String) -> > Suffix; > strip_prefix2([C|Tail], [C|PrefTail], String) -> > strip_prefix2(Tail, PrefTail, String); > strip_prefix2(_, _, String) -> > String. > > I don't find either of them particularly easy to read, because the > code contradicts the name. However implemented, this function DOESN'T > always strip a prefix. By the time that has been addressed with a > fair comment explaining what the function really does, there is little > to choose between these functions. > > strip_prefix(List, Prefix) -> > case lists:prefix(Prefix, List) > of true -> lists:nthtail(length(Prefix), List) > ; false -> List > end. > > is only one line longer than the ++ version, and seems pretty clear > (except for the non-intention-revealing name). From richardc@REDACTED Wed Apr 19 19:47:12 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 19 Apr 2006 19:47:12 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: References: Message-ID: <444677A0.6020407@it.uu.se> Vlad Dumitrescu wrote: > In the bigger picture, it's not io output that's most interesting, but any > Erlang term. Rendering the term is then left to the corresponding frontend. Note that if the test returns a value, then it succeeds by definition, so there is little point in displaying that value, and if many tests yield large values, it would cause a lot of unnecessary sending of data which would normally be discarded by the client anyway. However, if you write a test such as ?_test(ok = foo()), and that fails, you will get the erroneous term included in the exception, and that is part of the error report. So I think I/O is the only missing piece. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From thomaswhitcomb@REDACTED Wed Apr 19 19:56:03 2006 From: thomaswhitcomb@REDACTED (Tom Whitcomb) Date: Wed, 19 Apr 2006 13:56:03 -0400 Subject: URI encoding Message-ID: <7D0C0309.00613DF6.72A78FD1@netscape.net> Is there a function for encoding/decoding URIs (ietf rfc 2396)? I looked through the online http, httpd and httpd_util modules definitions and couldn't find one. tom __________________________________________________________________ Switch to Netscape Internet Service. As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp From serge@REDACTED Wed Apr 19 20:20:49 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 19 Apr 2006 14:20:49 -0400 Subject: URI encoding In-Reply-To: <7D0C0309.00613DF6.72A78FD1@netscape.net> References: <7D0C0309.00613DF6.72A78FD1@netscape.net> Message-ID: <44467F81.1060804@hq.idt.net> Decoding can be done like this: 1> http_uri:parse("http://host.net/dir/index.html#test"). {http,"host.net",80,"/dir/index.html","#test"} I am not sure if there's a standard encoding function. Serge Tom Whitcomb wrote: > Is there a function for encoding/decoding URIs (ietf rfc 2396)? I looked through the online http, httpd and httpd_util modules definitions and couldn't find one. > > tom > > > __________________________________________________________________ > Switch to Netscape Internet Service. > As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register > > Netscape. Just the Net You Need. > > New! Netscape Toolbar for Internet Explorer > Search from anywhere on the Web and block those annoying pop-ups. > Download now at http://channels.netscape.com/ns/search/install.jsp From simon@REDACTED Wed Apr 19 20:32:30 2006 From: simon@REDACTED (Simon Aurell) Date: Wed, 19 Apr 2006 19:32:30 +0100 Subject: URI encoding In-Reply-To: <7D0C0309.00613DF6.72A78FD1@netscape.net> References: <7D0C0309.00613DF6.72A78FD1@netscape.net> Message-ID: <4446823E.6060202@erlang-consulting.com> There are two functions in yaws_api for this. From the documentation: url_decode(Str) Decode url-encoded string. A URL ncoded string is a string where all alfa numeric characters and the the character _ are pre- served and all other characters are encode as "%XY" where X and Y are the hex values of the least respective most significat 4 bits in the 8 bit character. url_encode(Str) Url-encodes a string. All URLs in HTML documents must be URL encoded. Tom Whitcomb wrote: >Is there a function for encoding/decoding URIs (ietf rfc 2396)? I looked through the online http, httpd and httpd_util modules definitions and couldn't find one. > >tom > > -- http://www.erlang-consulting.com From vlad_dumitrescu@REDACTED Wed Apr 19 22:24:43 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 19 Apr 2006 22:24:43 +0200 Subject: EUnit 2.0 alpha testers wanted References: <444677A0.6020407@it.uu.se> Message-ID: ----- Original Message ----- From: "Richard Carlsson" > Vlad Dumitrescu wrote: >> In the bigger picture, it's not io output that's most interesting, but >> any >> Erlang term. Rendering the term is then left to the corresponding >> frontend. > > Note that if the test returns a value, then it succeeds by definition, > so there is little point in displaying that value, and if many tests yield > large values, it would cause a lot of unnecessary sending of data which > would normally be discarded by the client anyway. > > However, if you write a test such as ?_test(ok = foo()), and that fails, > you will get the erroneous term included in the exception, and that is > part of the error report. So I think I/O is the only missing piece. I didn't explain properly. I don't mean the result of the test function, but what normally is (as you say) printed out with io:formats in the code. What I mean is that instead of capturing the results of io:format (i.e. the displayed strings), I may want to get the original terms, so that another renderer than io:format could display it in a more apropriate way (for example folding long terms, or maybe having the terms describe a graphical picture). One simple way would be to have a ?_message(Format, [Terms]) that in the simplest form translates to an io:format call, but not necessarily. Or maybe I am just making life more complicated than it should be and there is a better way right under my nose... :-) regards, Vlad From richardc@REDACTED Wed Apr 19 22:46:35 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 19 Apr 2006 22:46:35 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: References: <444677A0.6020407@it.uu.se> Message-ID: <4446A1AB.3080003@it.uu.se> Vlad Dumitrescu wrote: > I didn't explain properly. I don't mean the result of the test function, > but what normally is (as you say) printed out with io:formats in the > code. What I mean is that instead of capturing the results of io:format > (i.e. the displayed strings), I may want to get the original terms, so > that another renderer than io:format could display it in a more > apropriate way (for example folding long terms, or maybe having the > terms describe a graphical picture). > > One simple way would be to have a ?_message(Format, [Terms]) that in the > simplest form translates to an io:format call, but not necessarily. I think I see now. You want a standard way of inserting _new_ "debugging printouts" (or breadcrumbs or whatever you might want to call them), and not merely handle existing printouts (perhaps enabled by defining DEBUG in a makefile) in existing code. Interesting. I'll have to think about it. > Or maybe I am just making life more complicated than it should be and > there is a better way right under my nose... :-) Tell me if you find it. /Richard PS. Oh, by the way, I've just fixed the I/O redirection thing. Had to find a good way of collecting the output and associating it with the corresponding test (even when a single process runs several tests), but it could actually be done in a very nice way with minimal overhead. -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From vlad_dumitrescu@REDACTED Wed Apr 19 22:49:54 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 19 Apr 2006 22:49:54 +0200 Subject: EUnit 2.0 alpha testers wanted References: <444677A0.6020407@it.uu.se> <4446A1AB.3080003@it.uu.se> Message-ID: ----- Original Message ----- From: "Richard Carlsson" >> One simple way would be to have a ?_message(Format, [Terms]) that in the >> simplest form translates to an io:format call, but not necessarily. > > I think I see now. You want a standard way of inserting _new_ "debugging > printouts" (or breadcrumbs or whatever you might want to call them), and > not merely handle existing printouts (perhaps enabled by defining DEBUG > in a makefile) in existing code. Interesting. I'll have to think about it. Exactly! It's my usual method of debugging. > PS. Oh, by the way, I've just fixed the I/O redirection thing. Had to > find a good way of collecting the output and associating it with the > corresponding test (even when a single process runs several tests), > but it could actually be done in a very nice way with minimal overhead. Cool, it will be interesting to check out. regards, Vlad From thomaswhitcomb@REDACTED Thu Apr 20 01:46:11 2006 From: thomaswhitcomb@REDACTED (Tom Whitcomb) Date: Wed, 19 Apr 2006 19:46:11 -0400 Subject: URI encoding Message-ID: <655AAB71.050C623E.72A78FD1@netscape.net> Simon Aurell wrote: >There are two functions in yaws_api for this. From the documentation: > > url_decode(Str) > Decode url-encoded string. A URL ncoded string is a string where > all alfa numeric characters and the the character _ are pre- > served and all other characters are encode as "%XY" where X and > Y are the hex values of the least respective most significat 4 > bits in the 8 bit character. > > > url_encode(Str) > Url-encodes a string. All URLs in HTML documents must be URL > encoded. > > >Tom Whitcomb wrote: > >>Is there a function for encoding/decoding URIs (ietf rfc 2396)? I looked through the online http, httpd and httpd_util modules definitions and couldn't find one. >> >>tom >> >> >-- > >http://www.erlang-consulting.com > > Thanks. It's perfect. tom __________________________________________________________________ Switch to Netscape Internet Service. As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp From ok@REDACTED Thu Apr 20 05:29:34 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 20 Apr 2006 15:29:34 +1200 (NZST) Subject: bug or feature? Message-ID: <200604200329.k3K3TY5D050662@atlas.otago.ac.nz> I wrote a short clear solution to the "remove a prefix if present otherwise do nothing" problem that uses only existing features and functions. Serge Aleynikov wrote: In a general case you are absolutely right as the complexity of the proposed solution is still linear. Would anyone care that the other approach would work 2 to 3 times faster? Which other approach? The message I was replying to had two. When it comes to soft-real-time applications with extensive prefix analysis, I would. If you have EXTENSIVE prefix analysis, ALL the solutions on the table must count as inefficient. This is actually a wonderful example of what I have come to call "the PERL effect". The language offers you a feature that makes it simple, straightforward, incredibly easy ... to do the wrong thing. What do I mean in this case? All three of the solutions (the two that work and the one that isn't (yet) legal syntax) require O(|Prefix|) time to check for a prefix. If we have N prefixes, an average of P characters long, the time to check them all is O(P.N). Using a binary search tree takes this down to O(P.lg N). Using a trie instead takes the time down to O(P). And the key trick is to see the problem as doing MANY prefix checks, not as doing one. The difference between a built-in reversible ++ and one you program hardly matters compared with an O(N) speedup. Of course, if "extensive prefix analysis" means analysing many strings using a small number of prefixes, it's easy enough to generate an Erlang function (checking for those particular prefixes) *as a data structure* and cause it to be compiled, so that even in that case the main result from the generalised "feature" would be to prevent you thinking of a better solution. A more rhetorical question would be that if '++' is a "syntactic sugar" why wouldn't that syntactic sugar apply for bound Prefix variables as well to make it more generic? The term "syntactic sugar" refers to a construct which can be simply and mechanically replaced by some other construct(s) in the language and exists only to make the language more convenient. The pattern "c1...cn" ++ Pat is justly called "syntactic sugar" because it is syntactic sugar *FOR* something, namely [$c1|[$c2|...[$cn|Pat]...]] with a KNOWN number of pairs. The pattern Var ++ Pat should it ever exist, would NOT be syntactic sugar at all; there is nothing that could replace it, no combination of existing pattern notation could be made to do the same thing. To say that "Var ++ Pat" would not be syntactic sugar is not to say that it would not be a useful extension but only to say that it WOULD be a non-trivial extension of the language. You couldn't hack it just be a small change to the front end of the compiler, as literal++Pat was. Personally, I believe that it would NOT be a useful extension to the language; it is just too specialised, and the problems it is good for have better solutions. From raould@REDACTED Wed Apr 19 19:53:01 2006 From: raould@REDACTED (Raoul Duke) Date: Wed, 19 Apr 2006 10:53:01 -0700 Subject: Emulator syntax question Message-ID: <91a2ba3e0604191053t76d4073exca3c19cfab58e5b1@mail.gmail.com> Many thanks for the replies and information! I will switch to using the Emacs mode :-) sincerely. From igor@REDACTED Thu Apr 20 17:26:36 2006 From: igor@REDACTED (Igor Goryachev) Date: Thu, 20 Apr 2006 19:26:36 +0400 Subject: corba client using erlang Message-ID: <87k69kz2s3.fsf@goryachev.org> Hello. I am erlang newbie and trying to write corba client using orber interface for using in the omniORB environment. I have already read orber users guide, but it did not help me match. Something still goes wrong. The steps I perform: % erl -mnesia dir '"mnesia.orberdb"' goryachev@REDACTED:~/corba/idl% erl -mnesia dir '"mnesia.orberdb"' Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] [kernel-poll] Eshell V5.4.13 (abort with ^G) 1> mnesia:create_schema([node()]). ok 2> mnesia:start(). ok 3> corba:orb_init([{domain, "MyDiscSingleNodeORB"},{orbInitRef,"NameService=corbaloc:iiop:192.168.2.10:2809/NameService"},{interceptors, {native,[orber_iiop_tracer_stealth]}},{orber_debug_level, 10}]). ok 4> orber:install([node()],[{ifr_storage_type,disc_copies},{nameservice_storage_type, disc_copies}]). ok 5> orber:start(). ok 6> NS = corba:resolve_initial_references("NameService"). =INFO REPORT==== 20-Apr-2006::18:38:52 === =============== new_out_connection ======= Node : nonode@REDACTED >From : 192.168.1.53:41010 To : 192.168.2.10:2809 ========================================== =INFO REPORT==== 20-Apr-2006::18:38:52 === =============== out_request ============== Connection: {"192.168.2.10",2809,"192.168.1.53",41010} Operation : '_non_existent' ========================================== =INFO REPORT==== 20-Apr-2006::18:38:52 === =============== in_reply ================= Connection: {"192.168.2.10",2809,"192.168.1.53",41010} Operation : '_non_existent' ========================================== {'IOP_IOR',"IDL:omg.org/CosNaming/NamingContext:1.0", [{'IOP_TaggedProfile',0, {'IIOP_ProfileBody_1_0', {'IIOP_Version',1,0}, "192.168.2.10", 2809, "NameService"}}]} 7> NC = lname_component:set_id(lname_component:create(), "A_B"). {'CosNaming_NameComponent',"A_B",[]} 8> N = lname:insert_component(lname:create(), 1, NC). [{'CosNaming_NameComponent',"A_B",[]}] 9> 'CosNaming_NamingContext':resolve(NS, N). =INFO REPORT==== 20-Apr-2006::18:40:00 === =============== out_request ============== Connection: {"192.168.2.10",2809,"192.168.1.53",41010} Operation : resolve ========================================== =INFO REPORT==== 20-Apr-2006::18:40:00 === =============== in_reply ================= Connection: {"192.168.2.10",2809,"192.168.1.53",41010} Operation : resolve ========================================== ** exited: {{nocatch,{'EXCEPTION',{'CosNaming_NamingContext_NotFound', "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0", missing_node, [{'CosNaming_NameComponent',"A_B",[]}]}}}, [{corba,raise,1},{shell,exprs,6},{shell,eval_loop,3}]} ** =ERROR REPORT==== 20-Apr-2006::18:40:00 === Error in process <0.31.0> with exit value: {{nocatch,{'EXCEPTION',{'CosNaming_Naming Context_NotFound',"IDL:omg.org/CosNaming/NamingContext/NotFound:1.0",missing_node,[{ 'CosNaming_NameComponent',"A_B",[]}]}}},[{corba,raise,1},{shell,exprs,6},{shell,eval_loop,3}]} Here is orber:info() output: =INFO REPORT==== 20-Apr-2006::18:48:13 === ======= Orber Execution Environment ====== Orber version.................: 3.6.2 Orber domain..................: MyDiscSingleNodeORB IIOP port number..............: 4001 IIOP NAT port number..........: 4001 Interface(s)..................: ["127.0.1.1"] Interface(s) NAT..............: ["127.0.1.1"] Local Interface (default).....: [] Nodes in domain...............: [nonode@REDACTED] GIOP version (default)........: 1.1 IIOP out timeout..............: infinity msec IIOP out connection timeout...: infinity msec IIOP setup connection timeout.: infinity msec IIOP out ports................: 0 IIOP out connections..........: [] IIOP out connections (pending): [] IIOP in connections...........: [] IIOP in connection timeout....: infinity msec IIOP max fragments............: infinity IIOP max in requests..........: infinity IIOP max in connections.......: infinity IIOP backlog..................: 5 IIOP ACL......................: [] IIOP maximum packet size......: infinity Object Keys GC interval.......: infinity Using Interceptors............: {native,[orber_iiop_tracer_stealth]} Using Local Interceptors......: false Debug Level...................: 10 orbInitRef....................: "NameService=corbaloc:iiop:192.168.2.10:2809/NameService" orbDefaultInitRef.............: undefined System Flags Set..............: - ========================================= What is my mistake? What additional information should I provide? Thank you very much for the attention. -- Igor Goryachev E-Mail/Jabber: igor@REDACTED From erlang@REDACTED Thu Apr 20 18:45:47 2006 From: erlang@REDACTED (Michael McDaniel) Date: Thu, 20 Apr 2006 09:45:47 -0700 Subject: corba client using erlang In-Reply-To: <87k69kz2s3.fsf@goryachev.org> References: <87k69kz2s3.fsf@goryachev.org> Message-ID: <20060420164547.GH7007@delora.autosys.us> On Thu, Apr 20, 2006 at 07:26:36PM +0400, Igor Goryachev wrote: > Hello. > > I am erlang newbie and trying to write corba client using orber > interface for using in the omniORB environment. I have already read > orber users guide, but it did not help me match. Something still > goes wrong. > > The steps I perform: > > % erl -mnesia dir '"mnesia.orberdb"' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Try adding a node name when you start, for example: % erl -sname my_node -mnesia dir '"mnesia.orberdb"' That is the only suggestion I have; I am not familiar with orber. ~Michael > > goryachev@REDACTED:~/corba/idl% erl -mnesia dir '"mnesia.orberdb"' > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] > [kernel-poll] > > Eshell V5.4.13 (abort with ^G) > 1> mnesia:create_schema([node()]). > ok > 2> mnesia:start(). > ok > 3> corba:orb_init([{domain, "MyDiscSingleNodeORB"},{orbInitRef,"NameService=corbaloc:iiop:192.168.2.10:2809/NameService"},{interceptors, {native,[orber_iiop_tracer_stealth]}},{orber_debug_level, 10}]). > ok > 4> orber:install([node()],[{ifr_storage_type,disc_copies},{nameservice_storage_type, disc_copies}]). > ok > 5> orber:start(). > ok > 6> NS = corba:resolve_initial_references("NameService"). > > =INFO REPORT==== 20-Apr-2006::18:38:52 === > =============== new_out_connection ======= > Node : nonode@REDACTED > From : 192.168.1.53:41010 > To : 192.168.2.10:2809 > ========================================== > > =INFO REPORT==== 20-Apr-2006::18:38:52 === > =============== out_request ============== > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : '_non_existent' > ========================================== > > =INFO REPORT==== 20-Apr-2006::18:38:52 === > =============== in_reply ================= > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : '_non_existent' > ========================================== > {'IOP_IOR',"IDL:omg.org/CosNaming/NamingContext:1.0", > [{'IOP_TaggedProfile',0, > {'IIOP_ProfileBody_1_0', > {'IIOP_Version',1,0}, > "192.168.2.10", > 2809, > "NameService"}}]} > 7> NC = lname_component:set_id(lname_component:create(), "A_B"). > {'CosNaming_NameComponent',"A_B",[]} > 8> N = lname:insert_component(lname:create(), 1, NC). > [{'CosNaming_NameComponent',"A_B",[]}] > 9> 'CosNaming_NamingContext':resolve(NS, N). > > > =INFO REPORT==== 20-Apr-2006::18:40:00 === > =============== out_request ============== > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : resolve > ========================================== > > =INFO REPORT==== 20-Apr-2006::18:40:00 === > =============== in_reply ================= > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : resolve > ========================================== > ** exited: {{nocatch,{'EXCEPTION',{'CosNaming_NamingContext_NotFound', > "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0", > missing_node, > [{'CosNaming_NameComponent',"A_B",[]}]}}}, > [{corba,raise,1},{shell,exprs,6},{shell,eval_loop,3}]} ** > > =ERROR REPORT==== 20-Apr-2006::18:40:00 === > Error in process <0.31.0> with exit value: > {{nocatch,{'EXCEPTION',{'CosNaming_Naming > Context_NotFound',"IDL:omg.org/CosNaming/NamingContext/NotFound:1.0",missing_node,[{ > 'CosNaming_NameComponent',"A_B",[]}]}}},[{corba,raise,1},{shell,exprs,6},{shell,eval_loop,3}]} > > > Here is orber:info() output: > > =INFO REPORT==== 20-Apr-2006::18:48:13 === > ======= Orber Execution Environment ====== > Orber version.................: 3.6.2 > Orber domain..................: MyDiscSingleNodeORB > IIOP port number..............: 4001 > IIOP NAT port number..........: 4001 > Interface(s)..................: ["127.0.1.1"] > Interface(s) NAT..............: ["127.0.1.1"] > Local Interface (default).....: [] > Nodes in domain...............: [nonode@REDACTED] > GIOP version (default)........: 1.1 > IIOP out timeout..............: infinity msec > IIOP out connection timeout...: infinity msec > IIOP setup connection timeout.: infinity msec > IIOP out ports................: 0 > IIOP out connections..........: [] > IIOP out connections (pending): [] > IIOP in connections...........: [] > IIOP in connection timeout....: infinity msec > IIOP max fragments............: infinity > IIOP max in requests..........: infinity > IIOP max in connections.......: infinity > IIOP backlog..................: 5 > IIOP ACL......................: [] > IIOP maximum packet size......: infinity > Object Keys GC interval.......: infinity > Using Interceptors............: {native,[orber_iiop_tracer_stealth]} > Using Local Interceptors......: false > Debug Level...................: 10 > orbInitRef....................: "NameService=corbaloc:iiop:192.168.2.10:2809/NameService" > orbDefaultInitRef.............: undefined > System Flags Set..............: - > ========================================= > > What is my mistake? What additional information should I provide? > > Thank you very much for the attention. > > > -- > Igor Goryachev E-Mail/Jabber: igor@REDACTED From chandrashekhar.mullaparthi@REDACTED Thu Apr 20 19:21:26 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 20 Apr 2006 18:21:26 +0100 Subject: corba client using erlang In-Reply-To: <87k69kz2s3.fsf@goryachev.org> References: <87k69kz2s3.fsf@goryachev.org> Message-ID: On 20/04/06, Igor Goryachev wrote: > > Hello. > > I am erlang newbie and trying to write corba client using orber > interface for using in the omniORB environment. I have already read > orber users guide, but it did not help me match. Something still > goes wrong. > > The steps I perform: > > % erl -mnesia dir '"mnesia.orberdb"' > > goryachev@REDACTED:~/corba/idl% erl -mnesia dir '"mnesia.orberdb"' > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] > [kernel-poll] > > Eshell V5.4.13 (abort with ^G) > 1> mnesia:create_schema([node()]). > ok > 2> mnesia:start(). > ok > 3> corba:orb_init([{domain, > "MyDiscSingleNodeORB"},{orbInitRef,"NameService=corbaloc:iiop: > 192.168.2.10:2809/NameService"},{interceptors, > {native,[orber_iiop_tracer_stealth]}},{orber_debug_level, 10}]). > ok > 4> > orber:install([node()],[{ifr_storage_type,disc_copies},{nameservice_storage_type, > disc_copies}]). > ok > 5> orber:start(). > ok > You don't seem to have run the oe_register function to register your interfaces. See #2 in http://www.erlang.org/ml-archive/erlang-questions/200603/msg00049.html hth Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Thu Apr 20 22:32:02 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 20 Apr 2006 16:32:02 -0400 Subject: bug or feature? In-Reply-To: <200604200329.k3K3TY5D050662@atlas.otago.ac.nz> References: <200604200329.k3K3TY5D050662@atlas.otago.ac.nz> Message-ID: <4447EFC2.8010904@hq.idt.net> Richard A. O'Keefe wrote: > Of course, if "extensive prefix analysis" means analysing many strings > using a small number of prefixes, it's easy enough to generate an > Erlang function (checking for those particular prefixes) *as a data structure* > and cause it to be compiled, so that even in that case the main result from > the generalised "feature" would be to prevent you thinking of a better > solution. Actually this is exactly the problem and the approach we took that triggered this email thread. Given a relatively small number of prefixes (unknown at compile time) and analysing many strings, we tried to generate a function doing a pattern match of a string against each prefix. It looked like having a fun(Prefix ++ Suffix, Prefix) notation would be a convenient representation for this task, when we realised it was an illegal expression. Regards, Serge From nick@REDACTED Fri Apr 21 09:53:46 2006 From: nick@REDACTED (Niclas Eklund) Date: Fri, 21 Apr 2006 09:53:46 +0200 (MEST) Subject: corba client using erlang In-Reply-To: <87k69kz2s3.fsf@goryachev.org> Message-ID: Hello! I cannot tell why the omniORB-application throws that exception. Make sure that an IOR or NamingContext is registered as "A_B" in the omniORB nameservice. Don't confuse 'missing_node' with an Erlang-node (it's just one out of three reasons, missing_node, not_context and not_object, why the request to the nameservice failed. Hence, sname will make no difference. What you can do after you've started Orber and omniORB, is to use: erl> orber_diagnostics:nameservice(). or: erl> orber_diagnostics:nameservice(16#01). This will show wwhat's stored in the remote nameservice. You can also switch to more verbose built-in interceptor to get more information (see for example the Debugging chapter in Orber's User's Guide). Is there a special reason why the interface is set to? Interface(s)..................: ["127.0.1.1"] I assume that you intend to run Orber as a pure client-side ORB. /Nick PS The NameService is registered in the IFR when invoking orber:install(..). But you must remember to register the IDL-specifications you've written (e.g. os_MyModule:oe_register()). DS On Thu, 20 Apr 2006, Igor Goryachev wrote: > Hello. > > I am erlang newbie and trying to write corba client using orber > interface for using in the omniORB environment. I have already read > orber users guide, but it did not help me match. Something still > goes wrong. > > The steps I perform: > > % erl -mnesia dir '"mnesia.orberdb"' > > goryachev@REDACTED:~/corba/idl% erl -mnesia dir '"mnesia.orberdb"' > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] > [kernel-poll] > > Eshell V5.4.13 (abort with ^G) > 1> mnesia:create_schema([node()]). > ok > 2> mnesia:start(). > ok > 3> corba:orb_init([{domain, "MyDiscSingleNodeORB"},{orbInitRef,"NameService=corbaloc:iiop:192.168.2.10:2809/NameService"},{interceptors, {native,[orber_iiop_tracer_stealth]}},{orber_debug_level, 10}]). > ok > 4> orber:install([node()],[{ifr_storage_type,disc_copies},{nameservice_storage_type, disc_copies}]). > ok > 5> orber:start(). > ok > 6> NS = corba:resolve_initial_references("NameService"). > > =INFO REPORT==== 20-Apr-2006::18:38:52 === > =============== new_out_connection ======= > Node : nonode@REDACTED > >From : 192.168.1.53:41010 > To : 192.168.2.10:2809 > ========================================== > > =INFO REPORT==== 20-Apr-2006::18:38:52 === > =============== out_request ============== > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : '_non_existent' > ========================================== > > =INFO REPORT==== 20-Apr-2006::18:38:52 === > =============== in_reply ================= > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : '_non_existent' > ========================================== > {'IOP_IOR',"IDL:omg.org/CosNaming/NamingContext:1.0", > [{'IOP_TaggedProfile',0, > {'IIOP_ProfileBody_1_0', > {'IIOP_Version',1,0}, > "192.168.2.10", > 2809, > "NameService"}}]} > 7> NC = lname_component:set_id(lname_component:create(), "A_B"). > {'CosNaming_NameComponent',"A_B",[]} > 8> N = lname:insert_component(lname:create(), 1, NC). > [{'CosNaming_NameComponent',"A_B",[]}] > 9> 'CosNaming_NamingContext':resolve(NS, N). > > > =INFO REPORT==== 20-Apr-2006::18:40:00 === > =============== out_request ============== > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : resolve > ========================================== > > =INFO REPORT==== 20-Apr-2006::18:40:00 === > =============== in_reply ================= > Connection: {"192.168.2.10",2809,"192.168.1.53",41010} > Operation : resolve > ========================================== > ** exited: {{nocatch,{'EXCEPTION',{'CosNaming_NamingContext_NotFound', > "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0", > missing_node, > [{'CosNaming_NameComponent',"A_B",[]}]}}}, > [{corba,raise,1},{shell,exprs,6},{shell,eval_loop,3}]} ** > > =ERROR REPORT==== 20-Apr-2006::18:40:00 === > Error in process <0.31.0> with exit value: > {{nocatch,{'EXCEPTION',{'CosNaming_Naming > Context_NotFound',"IDL:omg.org/CosNaming/NamingContext/NotFound:1.0",missing_node,[{ > 'CosNaming_NameComponent',"A_B",[]}]}}},[{corba,raise,1},{shell,exprs,6},{shell,eval_loop,3}]} > > > Here is orber:info() output: > > =INFO REPORT==== 20-Apr-2006::18:48:13 === > ======= Orber Execution Environment ====== > Orber version.................: 3.6.2 > Orber domain..................: MyDiscSingleNodeORB > IIOP port number..............: 4001 > IIOP NAT port number..........: 4001 > Interface(s)..................: ["127.0.1.1"] > Interface(s) NAT..............: ["127.0.1.1"] > Local Interface (default).....: [] > Nodes in domain...............: [nonode@REDACTED] > GIOP version (default)........: 1.1 > IIOP out timeout..............: infinity msec > IIOP out connection timeout...: infinity msec > IIOP setup connection timeout.: infinity msec > IIOP out ports................: 0 > IIOP out connections..........: [] > IIOP out connections (pending): [] > IIOP in connections...........: [] > IIOP in connection timeout....: infinity msec > IIOP max fragments............: infinity > IIOP max in requests..........: infinity > IIOP max in connections.......: infinity > IIOP backlog..................: 5 > IIOP ACL......................: [] > IIOP maximum packet size......: infinity > Object Keys GC interval.......: infinity > Using Interceptors............: {native,[orber_iiop_tracer_stealth]} > Using Local Interceptors......: false > Debug Level...................: 10 > orbInitRef....................: "NameService=corbaloc:iiop:192.168.2.10:2809/NameService" > orbDefaultInitRef.............: undefined > System Flags Set..............: - > ========================================= > > What is my mistake? What additional information should I provide? > > Thank you very much for the attention. > > > -- > Igor Goryachev E-Mail/Jabber: igor@REDACTED From marthin@REDACTED Fri Apr 21 17:30:14 2006 From: marthin@REDACTED (Marthin Laubscher) Date: Fri, 21 Apr 2006 17:30:14 +0200 Subject: enotsock again Message-ID: <200604211530.k3LFUfc04560@hades.cslab.ericsson.net> Hey all, I'm being snookered by the same distributed system startup/socket error problem that seems to have done the rounds before. (http://www.erlang.org/ml-archive/erlang-questions/200507/msg00081.html, http://www.erlang.org/ml-archive/erlang-questions/200411/msg00120.html seems evidence of two previous times). Further clues I can offer those in the know are: I have several machines running XP SP2 with all the latest updates, only one of which has the problem. The (notebook) with the problem is has multiple interfaces (dialup shared on LAN). In response to previous comments, yes, the network interface(s) works just fine (several applications). Testing indicates that it is neither the windows firewall nor Symantec's that is causing the problem. The timing of the occurrences of the problem does not seem to support the notion that it's some M$ security update that breaks the socket library (unless they keep making the same booboo and fixing it every couple of months). Even more unlikely with only one bum machine out of several running at exactly the same level of updates. One current hypothesis is that the disturbance is caused by choosing incorrectly amongst multiple interfaces. An attempt to gen_tcp:listen(...,[.,{ip,{LAN ip address}}]) did however not yield any different result - still {error,enotsock}. However, somebody might be able to make something of the following: Starting (w)erl -sname abc yields the unformatted trace mentioned in the previous posts. Those can be reduced to the following error Erlang (BEAM) emulator version 5.4.13 [threads:0] Eshell V5.4.13 (abort with ^G) 1> net_kernel:start([aname]). =INFO REPORT==== 21-Apr-2006::16:32:57 === Protocol: "inet_tcp": register/listen error: enotsock {error,{shutdown,{child,undefined, net_sup_dynamic, {erl_distribution,start_link,[[aname]]}, permanent, 1000, supervisor, [erl_distribution]}}} 2> A further clue: R10B-8 (which I'm still using for my current project) does not even start in non-distributed mode when the dialup connection is disconnected. The error story follows: {error_logger,{{2006,4,21},{17,9,3}},supervisor_report,[{supervisor,{local,k ernel_sup}},{errorContext,start_error},{reason,{'DOWN',#Ref<0.0.0.14>,proces s,<0.16.0>,normal}},{offender,[{pid,undefined},{name,code_server},{mfa,{code ,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker }]}]} {error_logger,{{2006,4,21},{17,9,3}},crash_report,[[{pid,<0.7.0>},{registere d_name,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call, {application_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_con troller,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,globa l_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,ne t_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel ,[]},[application,application_controller,application_master,application_star ter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_di stribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file, file_server,old_file_server,file_io_server,prim_file,global,global_group,glo bal_search,group,heart,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_h osts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_adm ,net_kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_ log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp ,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,pg2,s eq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{an cestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5 .0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,987},{sta ck_size,21},{reductions,1062}],[]]} {error_logger,{{2006,4,21},{17,9,3}},std_info,[{application,kernel},{exited, {shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller,shutdown} The 'DOWN' reason on line 1 suggests to some extent that it is trying to access an interface that is down - i.e. the dialup connection. I have run the same version o a machine with only a dialup connection (GPRS) and it worked fine. A final "clue" is that on the troubled machine, in distributed mode or not, successful or not, R10B-8 or R10B-10, there seems to be a much longer pause while (w)erl is starting up during which there is no impact on CPU load - it may be some os-level timeout that's involved. This problem has hit me, as always, at the most inopportune time - on "holiday" 1000 miles away from my normal and stable development environment, with urgent modification to make and test. Any advice or help (short of reinstalling XP which isn't an option at the moment) will be greatly appreciated. Thanks, Marthin -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Fri Apr 21 18:05:17 2006 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 21 Apr 2006 12:05:17 -0400 Subject: enotsock again In-Reply-To: <200604211530.k3LFUfc04560@hades.cslab.ericsson.net> References: <200604211530.k3LFUfc04560@hades.cslab.ericsson.net> Message-ID: <444902BD.4060803@hq.idt.net> I'm not sure if this would help in your case, but I had a similar problem a couple of years ago on WinXP, and found a solution by shutting down nearly all services on the box (other then vital ones). I don't recall being able to isolate which particular service conflicted with Erlang. Also the following config startup option can help binding distributed Erlang to a specific IpAddress: {kernel, [{inet_dist_use_interface, IpAddress}]} Good luck, Serge Marthin Laubscher wrote: > Hey all, > > > > I?m being snookered by the same distributed system startup/socket error > problem that seems to have done the rounds before. > > > > (http://www.erlang.org/ml-archive/erlang-questions/200507/msg00081.html, > > http://www.erlang.org/ml-archive/erlang-questions/200411/msg00120.html > seems evidence of two previous times). > > > > Further clues I can offer those in the know are: > > I have several machines running XP SP2 with all the latest updates, only > one of which has the problem. > > The (notebook) with the problem is has multiple interfaces (dialup > shared on LAN). > > In response to previous comments, yes, the network interface(s) works > just fine (several applications). > > Testing indicates that it is neither the windows firewall nor Symantec?s > that is causing the problem. > > The timing of the occurrences of the problem does not seem to support > the notion that it?s some M$ security update that breaks the socket > library (unless they keep making the same booboo and fixing it every > couple of months). Even more unlikely with only one bum machine out of > several running at exactly the same level of updates. > > One current hypothesis is that the disturbance is caused by choosing > incorrectly amongst multiple interfaces. An attempt to > gen_tcp:listen(...,[?,{ip,{LAN ip address}}]) did however not yield any > different result ? still {error,enotsock}. > > However, somebody might be able to make something of the following: > > Starting (w)erl ?sname abc yields the unformatted trace mentioned in the > previous posts. Those can be reduced to the following error > > > > Erlang (BEAM) emulator version 5.4.13 [threads:0] > > > > Eshell V5.4.13 (abort with ^G) > > 1> net_kernel:start([aname]). > > > > =INFO REPORT==== 21-Apr-2006::16:32:57 === > > Protocol: "inet_tcp": register/listen error: enotsock > > {error,{shutdown,{child,undefined, > > net_sup_dynamic, > > {erl_distribution,start_link,[[aname]]}, > > permanent, > > 1000, > > supervisor, > > [erl_distribution]}}} > > 2> > > > > A further clue: R10B-8 (which I?m still using for my current project) > does not even start in non-distributed mode when the dialup connection > is disconnected. The error story follows: > > {error_logger,{{2006,4,21},{17,9,3}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{'DOWN',#Ref<0.0.0.14>,process,<0.16.0>,normal}},{offender,[{pid,undefined},{name,code_server},{mfa,{code,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} > > {error_logger,{{2006,4,21},{17,9,3}},crash_report,[[{pid,<0.7.0>},{registered_name,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call,{application_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_controller,erl_reply,auth,boot_server,code_server,disk_log_server,disk_log_sup,erl_prim_loader,error_logger,file_server,file_server_2,fixtable_server,global_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,net_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel,[]},[application,application_controller,application_master,application_starter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_distribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file,file_server,old_file_server,file_io_server,prim_file,global,global_group,global_search,group,heart,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_hosts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_ad m,net_kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,pg2,seq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{ancestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,21},{reductions,1062}],[]]} > > {error_logger,{{2006,4,21},{17,9,3}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} > > {"Kernel pid terminated",application_controller,shutdown} > > > > The ?DOWN? reason on line 1 suggests to some extent that it is trying to > access an interface that is down ? i.e. the dialup connection. I have > run the same version o a machine with only a dialup connection (GPRS) > and it worked fine. > > > > A final ?clue? is that on the troubled machine, in distributed mode or > not, successful or not, R10B-8 or R10B-10, there seems to be a much > longer pause while (w)erl is starting up during which there is no impact > on CPU load ? it may be some os-level timeout that?s involved. > > > > This problem has hit me, as always, at the most inopportune time ? on > ?holiday? 1000 miles away from my normal and stable development > environment, with urgent modification to make and test. Any advice or > help (short of reinstalling XP which isn?t an option at the moment) will > be greatly appreciated. > > > > Thanks, > > > > Marthin > > > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From marthin@REDACTED Fri Apr 21 18:57:52 2006 From: marthin@REDACTED (Marthin Laubscher) Date: Fri, 21 Apr 2006 18:57:52 +0200 Subject: enotsock again In-Reply-To: <444902BD.4060803@hq.idt.net> Message-ID: <200604211658.k3LGwGc04939@hades.cslab.ericsson.net> It seems like the "interface selection" hypothesis is busted - explicitly setting with {kernel, [{inet_dist_use_interface, IpAddress}]} which interface the dist code should use made no difference. I'll be working my way through possibly conflicting services. -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Serge Aleynikov Sent: 21 April 2006 06:05 PM To: Marthin Laubscher Cc: erlang-questions@REDACTED Subject: Re: enotsock again I'm not sure if this would help in your case, but I had a similar problem a couple of years ago on WinXP, and found a solution by shutting down nearly all services on the box (other then vital ones). I don't recall being able to isolate which particular service conflicted with Erlang. Also the following config startup option can help binding distributed Erlang to a specific IpAddress: {kernel, [{inet_dist_use_interface, IpAddress}]} Good luck, Serge Marthin Laubscher wrote: > Hey all, > > > > I'm being snookered by the same distributed system startup/socket error > problem that seems to have done the rounds before. > > > > (http://www.erlang.org/ml-archive/erlang-questions/200507/msg00081.html, > > http://www.erlang.org/ml-archive/erlang-questions/200411/msg00120.html > seems evidence of two previous times). > > > > Further clues I can offer those in the know are: > > I have several machines running XP SP2 with all the latest updates, only > one of which has the problem. > > The (notebook) with the problem is has multiple interfaces (dialup > shared on LAN). > > In response to previous comments, yes, the network interface(s) works > just fine (several applications). > > Testing indicates that it is neither the windows firewall nor Symantec's > that is causing the problem. > > The timing of the occurrences of the problem does not seem to support > the notion that it's some M$ security update that breaks the socket > library (unless they keep making the same booboo and fixing it every > couple of months). Even more unlikely with only one bum machine out of > several running at exactly the same level of updates. > > One current hypothesis is that the disturbance is caused by choosing > incorrectly amongst multiple interfaces. An attempt to > gen_tcp:listen(...,[.,{ip,{LAN ip address}}]) did however not yield any > different result - still {error,enotsock}. > > However, somebody might be able to make something of the following: > > Starting (w)erl -sname abc yields the unformatted trace mentioned in the > previous posts. Those can be reduced to the following error > > > > Erlang (BEAM) emulator version 5.4.13 [threads:0] > > > > Eshell V5.4.13 (abort with ^G) > > 1> net_kernel:start([aname]). > > > > =INFO REPORT==== 21-Apr-2006::16:32:57 === > > Protocol: "inet_tcp": register/listen error: enotsock > > {error,{shutdown,{child,undefined, > > net_sup_dynamic, > > {erl_distribution,start_link,[[aname]]}, > > permanent, > > 1000, > > supervisor, > > [erl_distribution]}}} > > 2> > > > > A further clue: R10B-8 (which I'm still using for my current project) > does not even start in non-distributed mode when the dialup connection > is disconnected. The error story follows: > > {error_logger,{{2006,4,21},{17,9,3}},supervisor_report,[{supervisor,{local,k ernel_sup}},{errorContext,start_error},{reason,{'DOWN',#Ref<0.0.0.14>,proces s,<0.16.0>,normal}},{offender,[{pid,undefined},{name,code_server},{mfa,{code ,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker }]}]} > > {error_logger,{{2006,4,21},{17,9,3}},crash_report,[[{pid,<0.7.0>},{registere d_name,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call, {application_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_con troller,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,globa l_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,ne t_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel ,[]},[application,application_controller,application_master,application_star ter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_di stribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file, file_server,old_file_server,file_io_server,prim_file,global,global_group,glo bal_search,group,heart,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_h osts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_ad m,net_kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk _log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_ud p,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,pg2, seq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{a ncestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0. 5.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,987},{st ack_size,21},{reductions,1062}],[]]} > > {error_logger,{{2006,4,21},{17,9,3}},std_info,[{application,kernel},{exited, {shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} > > {"Kernel pid terminated",application_controller,shutdown} > > > > The 'DOWN' reason on line 1 suggests to some extent that it is trying to > access an interface that is down - i.e. the dialup connection. I have > run the same version o a machine with only a dialup connection (GPRS) > and it worked fine. > > > > A final "clue" is that on the troubled machine, in distributed mode or > not, successful or not, R10B-8 or R10B-10, there seems to be a much > longer pause while (w)erl is starting up during which there is no impact > on CPU load - it may be some os-level timeout that's involved. > > > > This problem has hit me, as always, at the most inopportune time - on > "holiday" 1000 miles away from my normal and stable development > environment, with urgent modification to make and test. Any advice or > help (short of reinstalling XP which isn't an option at the moment) will > be greatly appreciated. > > > > Thanks, > > > > Marthin > > > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From ulf.wiger@REDACTED Fri Apr 21 19:00:45 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 21 Apr 2006 19:00:45 +0200 Subject: shootout - nsieve-bits benchmark Message-ID: I noticed that Erlang HiPE times out on the nsieve-bits benchmark. That's not very flattering, since the upper limit is 3600 seconds. (: (http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsievebits&lan g=all) I did some tests with the posted Erlang version, and it does take a _very_ long time for large input (it also seems to return incorrect values as N increases. I don't know why.) I attach a version that uses an ordered_set ets table for a bit array. It at least puts Erlang at the level of Tcl/JavaScript, and well before Ruby (assuming that the Pentium 4 box performs at least as well as my SunBLADE). It also matches the output of the other implementations (it also seems to agree with Doug Bagley's old sieve program, found at http://www.erlang.org/ml-archive/erlang-questions/200009/msg00010.html) I haven't submitted it. Does anyone have a better implementation? 1> c(sv,[native]). {ok,sv} 2> timer:tc(sv,main,[["9"]]). Primes up to 5120000 356244 Primes up to 2560000 187134 Primes up to 1280000 98610 {69606490,98610} BR, Ulf W -------------- next part -------------- A non-text attachment was scrubbed... Name: sv.erl Type: application/octet-stream Size: 3409 bytes Desc: sv.erl URL: From jeremie@REDACTED Fri Apr 21 19:34:14 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Fri, 21 Apr 2006 19:34:14 +0200 Subject: Requeuing a message in receive construct Message-ID: <2b7b425b0604211034r3e6c70fcn21bc9cad0af0986e@mail.gmail.com> Hello, I'm use the very practical receive ... end. construct in Erlang to handle messages. Everything is fine except that I would like an elegant way to delay messages. I thought of keeping track of the bytes sent, and then decreasing that amount every second. But I am unable to do this elegantly. How do you periodly decrease that variable while still maintaining that receive ... end. construct (or do you suggest starting a process which's only task is to decrease X by a given amount every second?). Anyway, at one point---and I'm not sure I'm going to end up using it, but it might become useful---I was wondering whether or not it's possible to requeue a message? Obviously, sending to self() would work, but then it would be at the bottom of a queue, and when order matters, that could be a problem. Is there a way to catch a message, and then "uncatch" it? Or that simply not idiomatic? Regards, J?r?mie -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sat Apr 22 00:58:17 2006 From: erlang@REDACTED (Michael McDaniel) Date: Fri, 21 Apr 2006 15:58:17 -0700 Subject: where are the processes? Message-ID: <20060421225816.GY7007@delora.autosys.us> SHORT: etop says 'procs 734506' and 'runq 15902' though I can't find the processes LONG: ... SYSTEM: yaws 1.56 compiled and running on R10B-10 on Linux Everything is started from yaws except for the process that the 404 error handler sends messages to. one appmod sends/receives messages with a persistent process another persistent process does some file monitoring a special 404 error handler sends a message to another persistent process (started independent of yaws). I start yaws thusly: /bin/su root -c " /usr/local/bin/yaws -sname yaws_autosys -heart \ -pa /var/yaws/ebin -D -x \ -erlarg \"-config /var/yaws/ebin/sys.config\" \ " and contents of sys.config are [{mnesia, [{dir, "/var/yaws/Mnesia.yaws_autosys"}]}]. Everything seems to work fine. This all runs on a remote machine. I login to that machine via ssh and run the following: I have been noticing that, when running etop as $ erl -sname etop -hidden -s etop -s erlang halt -output text \ -lines 27 -interval 33 -node 'yaws_autosys@REDACTED' I am seeing an increasing number of processes and also of run queue processes, for example, ======================================================================== yaws_autosys@REDACTED 20:25:01 Load: cpu 0 Memory: total 756842 binary 121 procs 734563 processes 0 code 543 runq 15736 atom 4626 ets 342 ------------------------------------------------------------------------ When first starting, the procs is less than 1000, runq is zero or single digit count, and total memory is less than ten megabytes. binary, code, ets, atom stay about the same. Now, when I remote shell as follows, $ erl -sname fu -remsh yaws_autosys@REDACTED Erlang (BEAM) emulator version 5.4.13 [hipe] Eshell V5.4.13 (abort with ^G) (yaws_autosys@REDACTED)1> erlang:statistics(run_queue). 0 (yaws_autosys@REDACTED)2> User switch command --> q $ The zero processes from erlang:statistics/1 has me confused compared to what I am seeing using erlang:statistics/1 and what etop is showing me. I am concerned about all these processes I can't find and the large runq shown by etop. I can do etop:config(lines, 300) there are less than 300 processes listed; same for i() from the remote shell. QUESTIONS: 1) what are the two different run queues from erlang:statistics/1 and the runq shown by etop? 2) how can I see (via some text mode tool) what the actual processes and processes in the runq that etop says exist ? thanks, ~Michael From jeremie@REDACTED Sat Apr 22 02:45:08 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Sat, 22 Apr 2006 02:45:08 +0200 Subject: Server handling lots of connections ... Message-ID: <2b7b425b0604211745n39ab6367uc4665579be078ca3@mail.gmail.com> Hello, Just wanted to know, typically, how would you handle a server with these methods: start(Port) -> ... stop(Port) -> ... I've seen an astute programmer have the start/1 function create a thread and register it using the atom created by: list_to_atom("serverProcess_" ++ integer_to_list(Port)). However I've also read that creating atoms like that is not good. Is there something more idiomatic? I've also thought of using an ETS table that maps a port to a process. In both cases, there's a look up time?but what is more efficient? How would you do it? Also, by the way, does anybody have a good link that introduces how to write applications that take advantage of several nodes? I know that Erlang handles this transparently, but what does transparent mean? My Best Regards, - J?r?mie -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sat Apr 22 06:47:13 2006 From: erlang@REDACTED (Michael McDaniel) Date: Fri, 21 Apr 2006 21:47:13 -0700 Subject: where are the processes? In-Reply-To: <20060421225816.GY7007@delora.autosys.us> References: <20060421225816.GY7007@delora.autosys.us> Message-ID: <20060422044713.GA24024@delora.autosys.us> On Fri, Apr 21, 2006 at 03:58:17PM -0700, Michael McDaniel wrote: > SHORT: etop says 'procs 734506' and 'runq 15902' though I can't > find the processes > > LONG: ... > > > SYSTEM: > > yaws 1.56 compiled and running on R10B-10 on Linux > > Everything is started from yaws except for the process > that the 404 error handler sends messages to. > > one appmod sends/receives messages with a persistent process > > another persistent process does some file monitoring > > a special 404 error handler sends a message to another > persistent process (started independent of yaws). > > > I start yaws thusly: > > /bin/su root -c " /usr/local/bin/yaws -sname yaws_autosys -heart \ > -pa /var/yaws/ebin -D -x \ > -erlarg \"-config /var/yaws/ebin/sys.config\" \ > " > > and contents of sys.config are > > [{mnesia, [{dir, "/var/yaws/Mnesia.yaws_autosys"}]}]. > > > > Everything seems to work fine. This all runs on a remote machine. > I login to that machine via ssh and run the following: > > > I have been noticing that, when running etop as > > $ erl -sname etop -hidden -s etop -s erlang halt -output text \ > -lines 27 -interval 33 -node 'yaws_autosys@REDACTED' > > I am seeing an increasing number of processes and also of > run queue processes, for example, > > ======================================================================== > yaws_autosys@REDACTED 20:25:01 > > Load: cpu 0 Memory: total 756842 binary 121 > procs 734563 processes 0 code 543 > runq 15736 atom 4626 ets 342 > > ------------------------------------------------------------------------ > > When first starting, the procs is less than 1000, runq is zero or single > digit count, and total memory is less than ten megabytes. binary, code, > ets, atom stay about the same. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ correction: should be "When first starting ... runq is under one hundred ..." ~M > > Now, when I remote shell as follows, > > $ erl -sname fu -remsh yaws_autosys@REDACTED > Erlang (BEAM) emulator version 5.4.13 [hipe] > > Eshell V5.4.13 (abort with ^G) > (yaws_autosys@REDACTED)1> erlang:statistics(run_queue). > 0 > (yaws_autosys@REDACTED)2> > User switch command > --> q > $ > > The zero processes from erlang:statistics/1 has me confused compared to > what I am seeing using erlang:statistics/1 and what etop is showing me. > > I am concerned about all these processes I can't find and the large runq > shown by etop. > > I can do etop:config(lines, 300) there are less than 300 processes listed; > same for i() from the remote shell. > > > > QUESTIONS: > > 1) what are the two different run queues from erlang:statistics/1 > and the runq shown by etop? > > 2) how can I see (via some text mode tool) what the actual processes > and processes in the runq that etop says exist ? > > > thanks, > > ~Michael -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From rikard.johansson@REDACTED Sat Apr 22 11:07:59 2006 From: rikard.johansson@REDACTED (Rikard Johansson) Date: Sat, 22 Apr 2006 11:07:59 +0200 Subject: where are the processes? In-Reply-To: <20060422044713.GA24024@delora.autosys.us> References: <20060421225816.GY7007@delora.autosys.us> <20060422044713.GA24024@delora.autosys.us> Message-ID: <63BAC82F-9A97-40B3-B4AD-144D6E38DEA3@mobilearts.se> Hi, Note that there is a bug in the output from etop_txt, values are printed on the wrong location, i.e. with wrong label. The bug existed in at least R10B6. This patch corrects the problem: 57,59c57,59 < io:fwrite(Fd,?SYSFORM, [Config#opts.node,Clock,Cpu,Tot,NProcs,Procs, < RQ,Atom,Bin,Code,Ets]), < io:nl(Fd), --- > io:fwrite(Fd,?SYSFORM, [Config#opts.node,Clock, Cpu,Tot,Bin,NProcs, > Procs,Code,RQ,Atom,Ets]), > io:nl(Fd), SYSFORM as defined in etop_defs.hrl: -define(SYSFORM, " ~-72w~10s~n" " Load: cpu ~8w Memory: total ~8w binary ~8w~n" " procs~8w processes~8w code ~8w~n" " runq ~8w atom ~8w ets ~8w~n"). I have previously submitted this patch to erlang-patches, but I have not seen if it has made it way into any of the later releases. /Rikard 22 apr 2006 kl. 06.47 skrev Michael McDaniel: > > On Fri, Apr 21, 2006 at 03:58:17PM -0700, Michael McDaniel wrote: >> SHORT: etop says 'procs 734506' and 'runq 15902' though I can't >> find the processes >> >> LONG: ... >> >> >> SYSTEM: >> >> yaws 1.56 compiled and running on R10B-10 on Linux >> >> Everything is started from yaws except for the process >> that the 404 error handler sends messages to. >> >> one appmod sends/receives messages with a persistent process >> >> another persistent process does some file monitoring >> >> a special 404 error handler sends a message to another >> persistent process (started independent of yaws). >> >> >> I start yaws thusly: >> >> /bin/su root -c " /usr/local/bin/yaws -sname yaws_autosys -heart \ >> -pa /var/yaws/ebin -D -x \ >> -erlarg \"-config /var/yaws/ebin/sys.config\" \ >> " >> >> and contents of sys.config are >> >> [{mnesia, [{dir, "/var/yaws/Mnesia.yaws_autosys"}]}]. >> >> >> >> Everything seems to work fine. This all runs on a remote machine. >> I login to that machine via ssh and run the following: >> >> >> I have been noticing that, when running etop as >> >> $ erl -sname etop -hidden -s etop -s erlang halt -output text \ >> -lines 27 -interval 33 -node 'yaws_autosys@REDACTED' >> >> I am seeing an increasing number of processes and also of >> run queue processes, for example, >> >> ===================================================================== >> === >> yaws_autosys@REDACTED >> 20:25:01 >> >> Load: cpu 0 Memory: total 756842 >> binary 121 >> procs 734563 processes 0 >> code 543 >> runq 15736 atom 4626 >> ets 342 >> >> --------------------------------------------------------------------- >> --- >> >> When first starting, the procs is less than 1000, runq is zero or >> single >> digit count, and total memory is less than ten megabytes. binary, >> code, >> ets, atom stay about the same. >> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > correction: > > should be "When first starting ... runq is under one hundred ..." > > ~M > > >> >> Now, when I remote shell as follows, >> >> $ erl -sname fu -remsh yaws_autosys@REDACTED >> Erlang (BEAM) emulator version 5.4.13 [hipe] >> >> Eshell V5.4.13 (abort with ^G) >> (yaws_autosys@REDACTED)1> erlang:statistics(run_queue). >> 0 >> (yaws_autosys@REDACTED)2> >> User switch command >> --> q >> $ >> >> The zero processes from erlang:statistics/1 has me confused >> compared to >> what I am seeing using erlang:statistics/1 and what etop is >> showing me. >> >> I am concerned about all these processes I can't find and the >> large runq >> shown by etop. >> >> I can do etop:config(lines, 300) there are less than 300 processes >> listed; >> same for i() from the remote shell. >> >> >> >> QUESTIONS: >> >> 1) what are the two different run queues from erlang:statistics/1 >> and the runq shown by etop? >> >> 2) how can I see (via some text mode tool) what the actual processes >> and processes in the runq that etop says exist ? >> >> >> thanks, >> >> ~Michael > > -- > Michael McDaniel > Portland, Oregon, USA > http://autosys.us > +1 503 283 5284 > From ulf@REDACTED Sat Apr 22 11:40:14 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 22 Apr 2006 11:40:14 +0200 Subject: Server handling lots of connections ... In-Reply-To: <2b7b425b0604211745n39ab6367uc4665579be078ca3@mail.gmail.com> References: <2b7b425b0604211745n39ab6367uc4665579be078ca3@mail.gmail.com> Message-ID: Den 2006-04-22 02:45:08 skrev J?r?mie Lumbroso"" : > I've seen an astute programmer have the start/1 function create a thread > and register it using the atom created by: > list_to_atom("serverProcess_" ++ integer_to_list(Port)). > However I've also read that creating atoms like that is not good. Is > there something more idiomatic? 1) In the example above, you're creating an atom from a finite (in practice) namespace. The BIF list_to_existing_atom/1 can increase safety somewhat in this case. 2) The proc utility (in jungerl) has semantics similar to the local process registry, but allows you to register any term. There are of course some drawbacks, for example that you can't quite as transparently send a message to a process registered in this fashion (it works more like global, in that you get to call proc:send(Alias, Msg)) 3) You can of course use global in the same way as proc. If you have only one node, global will effectively work like a local process registry. Both global and proc allow you to register a process using any term, and also to register more than one alias per process. Global is, of course, a standard OTP module. Proc isn't. BR, Ulf W -- Ulf Wiger From pupeno@REDACTED Sat Apr 22 13:25:48 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 22 Apr 2006 11:25:48 +0000 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <44456B7A.1060609@it.uu.se> References: <44456B7A.1060609@it.uu.se> Message-ID: <200604221126.05733.pupeno@pupeno.com> Are there any chances of releasing under both licences, the ERLANG PUBLIC LICENSE and a GPL-compatible one ? like GNU General Public License or GUN Leaser General Public License ? Thank you. On Tuesday, 18 de April de 2006 22:43, Richard Carlsson wrote: > I have sort of stolen the EUnit project from Mickael Remond, > with his permission (and he even lets me use his svn server). > The new EUnit is based on some ideas I once used for automated > testing of student assignments (plus the usual unit testing > ideas from JUnit, PyUnit, etc.) > > Some features: > - extremely compact notation; tests are _really_ easy to write > - powerful primitives: run tests in order or in parallel, > in separate subprocesses, on separate nodes, or all at once > - easy combination of tests into test suites > - run OS commands as tests and check status and/or output > - watching of modules - when a module is reloaded, its tests > can be executed and reported automatically > - other stuff that I forget at the moment > - no documentation (yet) - use the Source! (many examples can > be found in the code) > > Tarball here: > http://user.it.uu.se/~richardc/eunit/ > > Remember, this is alpha testing - you are expected to have > some patience finding out how to use it, and not be too upset if > some interface details change later (possibly as a consequence of > feedback from alpha testers). > > Let me know what you think! > > /Richard -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From pupeno@REDACTED Sat Apr 22 17:09:44 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 22 Apr 2006 15:09:44 +0000 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <200604221126.05733.pupeno@pupeno.com> References: <44456B7A.1060609@it.uu.se> <200604221126.05733.pupeno@pupeno.com> Message-ID: <200604221509.44993.pupeno@pupeno.com> On Saturday, 22 de April de 2006 11:25, Pupeno wrote: > GUN > Leaser General Public License ? Sorry for the ugly miss-spelling, I meant GNU Leaser General Public License. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From erlang@REDACTED Sat Apr 22 18:41:25 2006 From: erlang@REDACTED (Michael McDaniel) Date: Sat, 22 Apr 2006 09:41:25 -0700 Subject: where are the processes? In-Reply-To: <63BAC82F-9A97-40B3-B4AD-144D6E38DEA3@mobilearts.se> References: <20060421225816.GY7007@delora.autosys.us> <20060422044713.GA24024@delora.autosys.us> <63BAC82F-9A97-40B3-B4AD-144D6E38DEA3@mobilearts.se> Message-ID: <20060422164125.GB24024@delora.autosys.us> On Sat, Apr 22, 2006 at 11:07:59AM +0200, Rikard Johansson wrote: > > Hi, > > Note that there is a bug in the output from etop_txt, values are > printed on the wrong location, i.e. with wrong label. > The bug existed in at least R10B6. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Gosh, duly noted; and patched. Thank you. Things are now starting to make more sense to me regarding resource usage. I do hope the patch gets into the next release. ~Michael > This patch corrects the problem: > > > 57,59c57,59 > < io:fwrite(Fd,?SYSFORM, > [Config#opts.node,Clock,Cpu,Tot,NProcs,Procs, > < RQ,Atom,Bin,Code,Ets]), > < io:nl(Fd), > --- > > io:fwrite(Fd,?SYSFORM, [Config#opts.node,Clock, > Cpu,Tot,Bin,NProcs, > > Procs,Code,RQ,Atom,Ets]), > > io:nl(Fd), > > SYSFORM as defined in etop_defs.hrl: > -define(SYSFORM, > " ~-72w~10s~n" > " Load: cpu ~8w Memory: total ~8w binary > ~8w~n" > " procs~8w processes~8w code > ~8w~n" > " runq ~8w atom ~8w ets > ~8w~n"). > > I have previously submitted this patch to erlang-patches, but I have > not seen if it has made it way into any of the later releases. > > > /Rikard > > > > > 22 apr 2006 kl. 06.47 skrev Michael McDaniel: > > > > >On Fri, Apr 21, 2006 at 03:58:17PM -0700, Michael McDaniel wrote: > >>SHORT: etop says 'procs 734506' and 'runq 15902' though I can't > >> find the processes > >> > >>LONG: ... > >> > >> > >>SYSTEM: > >> > >> yaws 1.56 compiled and running on R10B-10 on Linux > >> > >> Everything is started from yaws except for the process > >> that the 404 error handler sends messages to. > >> > >> one appmod sends/receives messages with a persistent process > >> > >> another persistent process does some file monitoring > >> > >> a special 404 error handler sends a message to another > >> persistent process (started independent of yaws). > >> > >> > >> I start yaws thusly: > >> > >> /bin/su root -c " /usr/local/bin/yaws -sname yaws_autosys -heart \ > >> -pa /var/yaws/ebin -D -x \ > >> -erlarg \"-config /var/yaws/ebin/sys.config\" \ > >> " > >> > >> and contents of sys.config are > >> > >> [{mnesia, [{dir, "/var/yaws/Mnesia.yaws_autosys"}]}]. > >> > >> > >> > >>Everything seems to work fine. This all runs on a remote machine. > >>I login to that machine via ssh and run the following: > >> > >> > >>I have been noticing that, when running etop as > >> > >>$ erl -sname etop -hidden -s etop -s erlang halt -output text \ > >> -lines 27 -interval 33 -node 'yaws_autosys@REDACTED' > >> > >>I am seeing an increasing number of processes and also of > >>run queue processes, for example, > >> > >>===================================================================== > >>=== > >>yaws_autosys@REDACTED > >>20:25:01 > >> > >>Load: cpu 0 Memory: total 756842 > >>binary 121 > >> procs 734563 processes 0 > >>code 543 > >> runq 15736 atom 4626 > >>ets 342 > >> > >>--------------------------------------------------------------------- > >>--- > >> > >>When first starting, the procs is less than 1000, runq is zero or > >>single > >>digit count, and total memory is less than ten megabytes. binary, > >>code, > >>ets, atom stay about the same. > >> > >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >correction: > > > > should be "When first starting ... runq is under one hundred ..." > > > >~M > > > > > >> > >>Now, when I remote shell as follows, > >> > >>$ erl -sname fu -remsh yaws_autosys@REDACTED > >>Erlang (BEAM) emulator version 5.4.13 [hipe] > >> > >>Eshell V5.4.13 (abort with ^G) > >>(yaws_autosys@REDACTED)1> erlang:statistics(run_queue). > >>0 > >>(yaws_autosys@REDACTED)2> > >>User switch command > >> --> q > >>$ > >> > >>The zero processes from erlang:statistics/1 has me confused > >>compared to > >>what I am seeing using erlang:statistics/1 and what etop is > >>showing me. > >> > >>I am concerned about all these processes I can't find and the > >>large runq > >>shown by etop. > >> > >>I can do etop:config(lines, 300) there are less than 300 processes > >>listed; > >>same for i() from the remote shell. > >> > >> > >> > >>QUESTIONS: > >> > >>1) what are the two different run queues from erlang:statistics/1 > >> and the runq shown by etop? > >> > >>2) how can I see (via some text mode tool) what the actual processes > >> and processes in the runq that etop says exist ? > >> > >> > >>thanks, > >> > >>~Michael > > > >-- > >Michael McDaniel > >Portland, Oregon, USA > >http://autosys.us > >+1 503 283 5284 > > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From pupeno@REDACTED Sat Apr 22 18:55:27 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 22 Apr 2006 16:55:27 +0000 Subject: Includes Message-ID: <200604221655.27698.pupeno@pupeno.com> Hello, I am trying to install EUnit2 on my system to use it from one of my packages and it lead to some general questions about includes/header files. Where should header files needed for others to use my library go ? I have Erlang on /usr/lib/erlang/ so my project, let's suppose Serlvers, go into: /usr/lib/erlang/serlvers-x.y.z/ where x.y.z is the version (0.1.0 now, 0.2.0 soon). Is that right ? wrong ? nobody knows ? Then include files would go on: /usr/lib/erlang/serlvers-x.y.z/include/ right ? How should then the applications using Serlvers include those files ? -include("/usr/lib/erlang/serlvers-0.1.0/include/dns.hrl"). I don't think full paths are right here. -include("serlvers-0.1.0/include/dns.hrl"). and adding -l /usr/lib/erlang/ at build time ? Then in the next patchlevel serlvers-0.1.1, whatever was using serlvers won't work. -include("dns.hrl"). then the build system should find out what version of serlvers are there and which one to use to pass to -l, nasty. And this takes me to a more problematic point: How should header files of project A include header files of project A and project B ? Supouse that I have /usr/lib/erlang/serlvers-x.y.z/include/common.hrl, should dns.hrl -include("common.hrl") ? -include("include/common.hrl") ? -include("serlvers-0.1.0/include/common.hrl")* ? or what ? * it would requiring changing all the include paths each time I change versions. Any help is really appreciated, I am lost here. Thank you. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From serge@REDACTED Sat Apr 22 20:40:25 2006 From: serge@REDACTED (Serge Aleynikov) Date: Sat, 22 Apr 2006 14:40:25 -0400 Subject: Includes In-Reply-To: <200604221655.27698.pupeno@pupeno.com> References: <200604221655.27698.pupeno@pupeno.com> Message-ID: <444A7899.1080908@hq.idt.net> Pupeno wrote: > Where should header files needed for others to use my library go ? > I have Erlang on /usr/lib/erlang/ so my project, let's suppose Serlvers, go > into: > /usr/lib/erlang/serlvers-x.y.z/ > where x.y.z is the version (0.1.0 now, 0.2.0 soon). Is that right ? wrong ? > nobody knows ? A more traditional location would be: /usr/lib/erlang/lib/serlvers-x.y.z/ Though, you have other options, such as: 1. Assign some other common directory for custom applications, and use "-pa PATH" option of the compiler to include the paths to those apps. 2. Use embedded systems approach (see "Embedded Systems User's Guide") for building and distributing your application. In this case you don't need to create "serlvers-x.y.z" folders for different releases, and just use "serlvers" in your development environment. The systools:make_script/2, systools:make_tar/2 will take care of including paths with proper application versioning. This makes it quite convenient to do an embedded distribution of your app together with the Erlang virtual machine on hosts that don't have Erlang installed. This is a more advanced task, and I would suggest that you would experiment with only if you need to get a good understanding of the OTP release handling principles. > Then include files would go on: > /usr/lib/erlang/serlvers-x.y.z/include/ > right ? /usr/lib/erlang/lib/serlvers-x.y.z/include/ > How should then the applications using Serlvers include those files ? > -include("/usr/lib/erlang/serlvers-0.1.0/include/dns.hrl"). I don't > think full paths are right here. > -include("serlvers-0.1.0/include/dns.hrl"). and adding -l /usr/lib/erlang/ at > build time ? Then in the next patchlevel serlvers-0.1.1, whatever was > using serlvers won't work. Refer to section 4.2.4 of the Erlang Reference Manual. -include("dns.hrl"). and then use the following to compile a source code file: erlc -I /usr/lib/erlang/lib/serlvers-x.y.z/include ... your_file.erl Alternatively, use: -include_lib("serlvers/include/dns.hrl"). in this case you don't need to specify the full path "/usr/lib/erlang/lib/serlvers-x.y.z/include" at compile time, as the compiler should be able to locate the latest version of your serlvers application automatically. > And this takes me to a more problematic point: How should header files of > project A include header files of project A and project B ? > > Supouse that I have /usr/lib/erlang/serlvers-x.y.z/include/common.hrl, should > dns.hrl -include("common.hrl") ? -include("include/common.hrl") ? Frankly I don't think it's a good idea, as it makes code analysis more confusing, but others may have a different opinion on this coding style. > Any help is really appreciated, I am lost here. Hope this helps. Serge From vlad_dumitrescu@REDACTED Sat Apr 22 20:39:53 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Sat, 22 Apr 2006 20:39:53 +0200 Subject: Includes References: <200604221655.27698.pupeno@pupeno.com> Message-ID: Hi. >I have Erlang on /usr/lib/erlang/ so my project, let's suppose Serlvers, go >into:/usr/lib/erlang/serlvers-x.y.z/ >where x.y.z is the version (0.1.0 now, 0.2.0 soon). Is that right ? wrong ? >nobody knows ? It is right. >Then include files would go on:/usr/lib/erlang/serlvers-x.y.z/include/ >right ? >How should then the applications using Serlvers include those files ? Try -include_lib("serlvers/include/common.hrl"). The compiler will know how to find the latest version. regards, Vlad From vlad_dumitrescu@REDACTED Sat Apr 22 20:53:36 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Sat, 22 Apr 2006 20:53:36 +0200 Subject: Includes References: <200604221655.27698.pupeno@pupeno.com> <444A7899.1080908@hq.idt.net> Message-ID: ----- Original Message ----- From: "Serge Aleynikov" > A more traditional location would be: > /usr/lib/erlang/lib/serlvers-x.y.z/ Oh, yes, I had missed that the second "lib" was missing :-) /Vlad From pupeno@REDACTED Sat Apr 22 21:46:56 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 22 Apr 2006 19:46:56 +0000 Subject: Includes In-Reply-To: <444A7899.1080908@hq.idt.net> References: <200604221655.27698.pupeno@pupeno.com> <444A7899.1080908@hq.idt.net> Message-ID: <200604221947.23823.pupeno@pupeno.com> On Saturday, 22 de April de 2006 18:40, Serge Aleynikov wrote: > Pupeno wrote: > > Where should header files needed for others to use my library go ? > > I have Erlang on /usr/lib/erlang/ so my project, let's suppose Serlvers, > > go into: > > /usr/lib/erlang/serlvers-x.y.z/ > > where x.y.z is the version (0.1.0 now, 0.2.0 soon). Is that right ? wrong > > ? nobody knows ? > > A more traditional location would be: > /usr/lib/erlang/lib/serlvers-x.y.z/ That's what I meant, it was a typo. > Though, you have other options, such as: > > 1. Assign some other common directory for custom applications, and use > "-pa PATH" option of the compiler to include the paths to those apps. > > 2. Use embedded systems approach (see "Embedded Systems User's Guide") > for building and distributing your application. In this case you don't > need to create "serlvers-x.y.z" folders for different releases, and just > use "serlvers" in your development environment. The > systools:make_script/2, systools:make_tar/2 will take care of including > paths with proper application versioning. This makes it quite > convenient to do an embedded distribution of your app together with the > Erlang virtual machine on hosts that don't have Erlang installed. This > is a more advanced task, and I would suggest that you would experiment > with only if you need to get a good understanding of the OTP release > handling principles. > > > Then include files would go on: > > /usr/lib/erlang/serlvers-x.y.z/include/ > > right ? > > /usr/lib/erlang/lib/serlvers-x.y.z/include/ Again a typo. > > How should then the applications using Serlvers include those files ? > > > > -include("/usr/lib/erlang/serlvers-0.1.0/include/dns.hrl"). I don't > > think full paths are right here. > > -include("serlvers-0.1.0/include/dns.hrl"). and adding -l > > /usr/lib/erlang/ at > > > build time ? Then in the next patchlevel serlvers-0.1.1, whatever was > > using serlvers won't work. > > Refer to section 4.2.4 of the Erlang Reference Manual. > > -include("dns.hrl"). > > and then use the following to compile a source code file: > > erlc -I /usr/lib/erlang/lib/serlvers-x.y.z/include ... your_file.erl > > Alternatively, use: > > -include_lib("serlvers/include/dns.hrl"). > > in this case you don't need to specify the full path > "/usr/lib/erlang/lib/serlvers-x.y.z/include" at compile time, as the > compiler should be able to locate the latest version of your serlvers > application automatically. I see; it seems you have to start erl AFTER having put the code there, otherwise it doesn't work and that was my problem. > > And this takes me to a more problematic point: How should header files of > > project A include header files of project A and project B ? > > > > Supouse that I have /usr/lib/erlang/serlvers-x.y.z/include/common.hrl, > > should dns.hrl -include("common.hrl") ? -include("include/common.hrl") ? > > Frankly I don't think it's a good idea, as it makes code analysis more > confusing, but others may have a different opinion on this coding style. There's code that already does it. > > Any help is really appreciated, I am lost here. > > Hope this helps. Yes, it does. Thank you. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From pupeno@REDACTED Sat Apr 22 22:08:22 2006 From: pupeno@REDACTED (Pupeno) Date: Sat, 22 Apr 2006 20:08:22 +0000 Subject: Includes In-Reply-To: References: <200604221655.27698.pupeno@pupeno.com> Message-ID: <200604222008.23388.pupeno@pupeno.com> You are right, thank you. I gave some more details on the other thread. The case is more or less solved. On Saturday, 22 de April de 2006 18:39, Vlad Dumitrescu wrote: > Hi. > > >I have Erlang on /usr/lib/erlang/ so my project, let's suppose Serlvers, > > go into:/usr/lib/erlang/serlvers-x.y.z/ > >where x.y.z is the version (0.1.0 now, 0.2.0 soon). Is that right ? wrong > > ? nobody knows ? > > It is right. > > >Then include files would go on:/usr/lib/erlang/serlvers-x.y.z/include/ > >right ? > >How should then the applications using Serlvers include those files ? > > Try > -include_lib("serlvers/include/common.hrl"). > The compiler will know how to find the latest version. > > regards, > Vlad -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From richardc@REDACTED Sun Apr 23 12:32:21 2006 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 23 Apr 2006 12:32:21 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <200604221126.05733.pupeno@pupeno.com> References: <44456B7A.1060609@it.uu.se> <200604221126.05733.pupeno@pupeno.com> Message-ID: <444B57B5.30809@it.uu.se> Pupeno wrote: > Are there any chances of releasing under both licences, the ERLANG PUBLIC > LICENSE and a GPL-compatible one ? like GNU General Public License or GUN > Leaser General Public License ? > Thank you. Yes, that is possible. I usually use LGPL for my hobby projects, but since the existing eunit 1.0 was published under EPL, I kept that for the time being. We'll see. Maybe this is a good time to ask people in general: do you prefer the EPL or the LGPL? Does it affect your ability to use it in your work? (I know that some corporate types are irrational about all things GPL, and might not accept the LGPL either.) On Saturday, 22 de April de 2006 11:25, Pupeno wrote: > > GUN > > Leaser General Public License ? > Sorry for the ugly miss-spelling, I meant GNU Leaser General Public License. No, you meant the GNU Lesser General Public License. ;-) But a "Gun Leaser" general public license sounds like fun. /Richard From pupeno@REDACTED Sun Apr 23 13:18:29 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 23 Apr 2006 11:18:29 +0000 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <444B57B5.30809@it.uu.se> References: <44456B7A.1060609@it.uu.se> <200604221126.05733.pupeno@pupeno.com> <444B57B5.30809@it.uu.se> Message-ID: <200604231118.37751.pupeno@pupeno.com> On Sunday, 23 de April de 2006 10:32, Richard Carlsson wrote: > Pupeno wrote: > > Are there any chances of releasing under both licences, the ERLANG PUBLIC > > LICENSE and a GPL-compatible one ? like GNU General Public License or GUN > > Leaser General Public License ? > > Thank you. > > Yes, that is possible. I usually use LGPL for my hobby projects, but > since the existing eunit 1.0 was published under EPL, I kept that for > the time being. We'll see. You should ask for permission to the original author of EUnit to be able to release under another license[2]. > Maybe this is a good time to ask people in general: do you prefer the > EPL or the LGPL? Does it affect your ability to use it in your work? > (I know that some corporate types are irrational about all things GPL, > and might not accept the LGPL either.) For me, the ELP is problematic. I use Erlang because it is worth it[1]; but having to make exceptions in all my header to link against an EPL is not nice. I would preffer for everything to be released under GPL-compatible licenses (GPL, LGPL and others like BSD), after all, you are not loosing anything by using GPL or LGPL *instead* of EPL, I think. And releasing under both is trivial, there are lot of projects that do that. -- Pupeno (http://pupeno.com) [1] I would hesitate to use a library that is not GPL-compatible and I would hesitate to give back code to a non-GPL-compatible library. Sometimes there's real worry because there are a lot of nasty licenses out there and sometimes it is just because I don't wan to read yet-another-license. I know GPL, I know how it works, I trust the people making it and backing it up. [2] If you do it, I'd recommend you to ask for permission and releasing under GPLv2 or latter; so you'd be able to move to GPLv3. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From richardc@REDACTED Sun Apr 23 13:46:21 2006 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 23 Apr 2006 13:46:21 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <200604231118.37751.pupeno@pupeno.com> References: <44456B7A.1060609@it.uu.se> <200604221126.05733.pupeno@pupeno.com> <444B57B5.30809@it.uu.se> <200604231118.37751.pupeno@pupeno.com> Message-ID: <444B690D.8020304@it.uu.se> Pupeno wrote: > You should ask for permission to the original author of EUnit to be able to > release under another license[2]. Of course. When I said "We'll see", I meant myself and Mickael Remond. I should have made that clearer. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From rprice@REDACTED Sun Apr 23 15:02:03 2006 From: rprice@REDACTED (Roger Price) Date: Sun, 23 Apr 2006 15:02:03 +0200 (CEST) Subject: EPL vs GPL; was: EUnit 2.0 alpha testers wanted In-Reply-To: <200604231118.37751.pupeno@pupeno.com> References: <44456B7A.1060609@it.uu.se> <200604221126.05733.pupeno@pupeno.com> <444B57B5.30809@it.uu.se> <200604231118.37751.pupeno@pupeno.com> Message-ID: On Sun, 23 Apr 2006, Pupeno wrote: > [1] I would hesitate to use a library that is not GPL-compatible ... Lots of people assume that since the Mozilla license is not GPL-compatible, and since the EPL was inspired by Mozilla, then EPL is not compatible with GPL. This may be true under US federal law, but is it true under Swedish law? Swedish law and IP practice are different to that of the US, and until I hear a Swedish IP lawyer giving an informed legal opinion, the question of compatibility for me is still open. Roger From pupeno@REDACTED Sun Apr 23 15:53:13 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 23 Apr 2006 13:53:13 +0000 Subject: EPL vs GPL; was: EUnit 2.0 alpha testers wanted In-Reply-To: References: <44456B7A.1060609@it.uu.se> <200604231118.37751.pupeno@pupeno.com> Message-ID: <200604231353.14440.pupeno@pupeno.com> On Sunday, 23 de April de 2006 13:02, Roger Price wrote: > On Sun, 23 Apr 2006, Pupeno wrote: > > [1] I would hesitate to use a library that is not GPL-compatible ... > > Lots of people assume that since the Mozilla license is not > GPL-compatible, and since the EPL was inspired by Mozilla, then EPL is not > compatible with GPL. This may be true under US federal law, but is it > true under Swedish law? Swedish law and IP practice are different to that > of the US, and until I hear a Swedish IP lawyer giving an informed legal > opinion, the question of compatibility for me is still open. Just the fact that there's uncertainty makes me preffer the GPL. If EPL is compatible with GPL only under Swedish law it is of no use for the rest of the world, am I right ? I'd like to see what the FSF has to say about EPL, but I bet they are too busy now. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From david.nospam.hopwood@REDACTED Sun Apr 23 16:00:54 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Sun, 23 Apr 2006 15:00:54 +0100 Subject: EPL vs GPL; was: EUnit 2.0 alpha testers wanted In-Reply-To: References: <44456B7A.1060609@it.uu.se> <200604221126.05733.pupeno@pupeno.com> <444B57B5.30809@it.uu.se> <200604231118.37751.pupeno@pupeno.com> Message-ID: <444B8896.1030702@blueyonder.co.uk> Roger Price wrote: > On Sun, 23 Apr 2006, Pupeno wrote: > >>[1] I would hesitate to use a library that is not GPL-compatible ... > > Lots of people assume that since the Mozilla license is not > GPL-compatible, and since the EPL was inspired by Mozilla, then EPL is not > compatible with GPL. This may be true under US federal law, but is it > true under Swedish law? Swedish law and IP practice are different to that > of the US, and until I hear a Swedish IP lawyer giving an informed legal > opinion, the question of compatibility for me is still open. For me, this just means that I have to assume it might not be GPL-compatible. -- David Hopwood From pupeno@REDACTED Sun Apr 23 18:52:03 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 23 Apr 2006 16:52:03 +0000 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <44456B7A.1060609@it.uu.se> References: <44456B7A.1060609@it.uu.se> Message-ID: <200604231652.10609.pupeno@pupeno.com> Hello, I've been using EUnit 2.0 quite successfully (after I've found that src/test.erl was the set of examples after which I could make my own tests, please, mention that somewhere). I am making a behavior for a DNS server and I am writting the functions to parse DNS messages. I am using EUnit 2.0 to test those functions. At first it was very boring but now I gave it a twist: I have a small set of data that can generate a DNS message and I combinate it in all possible ways to generate a huge list of possible messages. Since tests are generated dynamically I generate tests for each of them. The code for it is on: http://software.pupeno.com/cgi-bin/darcs.cgi/Serlvers/src/gen_dns.erl?c=annotate from %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% Testing %%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% up to %%%%%%%%%%%%%%%%%% Old boring tests %%%%%%%%%%%%%%%%%%%%%%%%%%% Thank you! -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From richardc@REDACTED Sun Apr 23 19:20:31 2006 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 23 Apr 2006 19:20:31 +0200 Subject: shootout - nsieve-bits benchmark In-Reply-To: References: Message-ID: <444BB75F.7000603@it.uu.se> Ulf Wiger (AL/EAB) wrote: > I noticed that Erlang HiPE times out on the nsieve-bits benchmark. > That's not very flattering, since the upper limit is 3600 seconds. (: > [...] > I attach a version that uses an ordered_set ets table for a bit array. > It at least puts Erlang at the level of Tcl/JavaScript, and well before > Ruby (assuming that the Pentium 4 box performs at least as well as my > SunBLADE). It also matches the output of the other implementations (it > also seems to agree with Doug Bagley's old sieve program, found at > http://www.erlang.org/ml-archive/erlang-questions/200009/msg00010.html) > > I haven't submitted it. Does anyone have a better implementation? A nice challenge. Try the attached file - it's more than twice as fast as yours. That should put Erlang on the same level as Python and Smalltalk. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: bsieve.erl URL: From joelr1@REDACTED Sun Apr 23 20:34:59 2006 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 23 Apr 2006 19:34:59 +0100 Subject: Billion-triple store Message-ID: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> Folks, How would I store a billion triples with Erlang? I don't necessarily need the full power of RDF as storing triples in the form of {"Joel", has_a, daughter} would suffice. I would not mind complying with RDF of course but it seems that would be an extra burder due to the necessity of storing everything as strings, the need to implement tries for those and the way Erlang stores strings. I'm not sure how to go about storing a billion of such triples in Mnesia. I suppose I would need to use a 64-bit machine and a disc_only_copy table. Any suggestions? Thanks, Joel -- http://wagerlabs.com/ From richardc@REDACTED Sun Apr 23 20:48:43 2006 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 23 Apr 2006 20:48:43 +0200 Subject: shootout - nsieve-bits benchmark In-Reply-To: <444BB75F.7000603@it.uu.se> References: <444BB75F.7000603@it.uu.se> Message-ID: <444BCC0B.3030307@it.uu.se> Richard Carlsson wrote: > Try the attached file - it's more than twice as fast as yours. Correction - yours gets a proportionally higher speedup when native compiled, so my version is only 1.7 times faster. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From kostis@REDACTED Sun Apr 23 21:12:30 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Sun, 23 Apr 2006 21:12:30 +0200 (MEST) Subject: shootout - nsieve-bits benchmark In-Reply-To: Mail from 'Richard Carlsson ' dated: Sun, 23 Apr 2006 19:20:31 +0200 Message-ID: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> Richard Carlsson wrote: > Ulf Wiger (AL/EAB) wrote: > > I noticed that Erlang HiPE times out on the nsieve-bits benchmark. > > That's not very flattering, since the upper limit is 3600 seconds. (: > > [...] > > > I attach a version that uses an ordered_set ets table for a bit array. > > It at least puts Erlang at the level of Tcl/JavaScript, and well before > > Ruby (assuming that the Pentium 4 box performs at least as well as my > > SunBLADE). It also matches the output of the other implementations (it > > also seems to agree with Doug Bagley's old sieve program, found at > > http://www.erlang.org/ml-archive/erlang-questions/200009/msg00010.html) > > > > I haven't submitted it. Does anyone have a better implementation? > > A nice challenge. Try the attached file - it's more than twice as fast > as yours. That should put Erlang on the same level as Python and Smalltalk. I've kept quiet till now, because I did not want to reveal the HiPE magic to the world, but since I see that all Erlang solutions are ets-based, I find little reason not to send this post... Try the program below. Currently, it uses byte arrays rather than bits, but converting it to use bits should be straightforward. It is about 20 times faster than Yffe's program and about 10 times faster than Richard's. Oh, it is also about 3 to 5 times smaller... Kostis. %%------------------------------------------------------------------ %% HiPE program contributed by Kostis Sagonas -module(nsievebits). -export([main/1]). main([Arg]) -> N = list_to_integer(Arg), lists:foreach(fun(I) -> nsieve(10000 bsl (N-I)) end, [0,1,2]), halt(0). nsieve(M) -> io:format("Primes up to ~8w~8w\n", [M, nsieve(array(M), 2, M-1, 0)]). nsieve(A, P, Sz, C) when P =< Sz -> NC = case hipe_bifs:bytearray_sub(A, P) of 0 -> C; _ -> nsieve_sub(A, P+P, Sz, P), C+1 end, nsieve(A, P+1, Sz, NC); nsieve(_A, _P, _M, C) -> C. nsieve_sub(A, I, Sz, P) when I =< Sz -> hipe_bifs:bytearray_update(A, I, 0), % clear position nsieve_sub(A, I+P, Sz, P); nsieve_sub(_, _, _, _) -> ok. array(M) -> hipe_bifs:bytearray(M+1, 16#ff). % an Erlang binary From richardc@REDACTED Sun Apr 23 21:21:35 2006 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 23 Apr 2006 21:21:35 +0200 Subject: Requeuing a message in receive construct In-Reply-To: <2b7b425b0604211034r3e6c70fcn21bc9cad0af0986e@mail.gmail.com> References: <2b7b425b0604211034r3e6c70fcn21bc9cad0af0986e@mail.gmail.com> Message-ID: <444BD3BF.8010108@it.uu.se> J?r?mie Lumbroso wrote: > Everything is fine except that I would like an elegant way to delay > messages. I thought of keeping track of the bytes sent, and then > decreasing that amount every second. But I am unable to do this > elegantly. How do you periodly decrease that variable while still > maintaining that receive ... end. construct (or do you suggest starting > a process which's only task is to decrease X by a given amount every > second?). > > Anyway, at one point---and I'm not sure I'm going to end up using it, > but it might become useful---I was wondering whether or not it's > possible to requeue a message? Obviously, sending to self() would work, > but then it would be at the bottom of a queue, and when order matters, > that could be a problem. Is there a way to catch a message, and then > "uncatch" it? Or that simply not idiomatic? There's no way to push back a message. As you say, you can send it to self(), but that places it at the end of the queue. Perhaps, if you explained more exactly what it is you want to do, someone might be able to help. In what way do you want to "delay messages"? What is the situation? /Richard From thomasl_erlang@REDACTED Sun Apr 23 21:30:27 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 23 Apr 2006 12:30:27 -0700 (PDT) Subject: shootout - nsieve-bits benchmark In-Reply-To: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> Message-ID: <20060423193027.10658.qmail@web38810.mail.mud.yahoo.com> --- Kostis Sagonas wrote: > > I've kept quiet till now, because I did not want to > reveal the HiPE > magic to the world, but since I see that all Erlang > solutions are > ets-based, I find little reason not to send this > post... Has the time finally come for destructively updated terms, then? :-) As a final touch, I'd recommend putting it inside a monad: clean and efficient. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From kostis@REDACTED Sun Apr 23 21:41:47 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Sun, 23 Apr 2006 21:41:47 +0200 (MEST) Subject: shootout - nsieve-bits benchmark In-Reply-To: Mail from 'Thomas Lindgren ' dated: Sun, 23 Apr 2006 12:30:27 -0700 (PDT) Message-ID: <200604231941.k3NJfld2019259@spikklubban.it.uu.se> > > I've kept quiet till now, because I did not want to > > reveal the HiPE magic to the world, but since I see > > that all Erlang solutions are> ets-based, I find > > little reason not to send this post... > > Has the time finally come for destructively updated > terms, then? :-) No, nothing as drastic as that. It is just that HiPE has an interface for arrays of bytes (implemented using binaries) and arrays of immediates -- e.g. fixnums. Kostis From ok@REDACTED Mon Apr 24 00:21:37 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 24 Apr 2006 10:21:37 +1200 (NZST) Subject: bug or feature? Message-ID: <200604232221.k3NMLbsL124744@atlas.otago.ac.nz> I wrote: > Of course, if "extensive prefix analysis" means analysing many strings > using a small number of prefixes, it's easy enough to generate an > Erlang function (checking for those particular prefixes) *as a data structure* > and cause it to be compiled, so that even in that case the main result from > the generalised "feature" would be to prevent you thinking of a better > solution. Serge Aleynikov replied: Actually this is exactly the problem and the approach we took that triggered this email thread. Given a relatively small number of prefixes (unknown at compile time) and analysing many strings, we tried to generate a function doing a pattern match of a string against each prefix. It looked like having a fun(Prefix ++ Suffix, Prefix) notation would be a convenient representation for this task, when we realised it was an illegal expression. No, from the sound of it, the approach you tried is NOT "exactly the approach" that I'm talking about but very different indeed. The approach I am talking about would NOT use fun(Prefix++Suffix, Prefix) -- in which I for one would expect the first occurrence of Prefix to count as NOT BOUND. Let's take an example. Suppose the prefixes are http: https: ftp: tftp: Here's the function: f(S0) -> [C1|S1] = S0, case C1 of $h -> [C2|S2] = S1, case C2 of $t -> [C3|S3] = S2, case C3 of $t -> [C4|S4] = S3, case C4 of $p -> [C5|S5] = S4, case C4 of $: -> /* Suffix is */ S5 ; $s -> [C6|S6] = S5, case C6 of $: -> /* Suffix is */ S6 ; _ -> S0 end ; _ -> S0 end oh the heck with it, you get the idea. It's a trie. It's not the kind of code you want to write by hand (which is why I didn't want to finish it), but it's the kind of code that is very easy to generate by computer. It's fast: each character of the input is examined at most once. It generates no intermediate data structures. And it has absolutely NO use for Prefix++Suffix in any form anywhere. Ideally, if you wrote f("http:" ++ S) -> S; f("https:" ++ S) -> S; f("ftp:" ++ S) -> S; f("tftp:" ++ S) -> S; f( S) -> S. the compiler would generate essentially the same trie. Certainly that's what I would expect a Haskell or SML compiler to do. I don't know what the current Erlang compiler will do with it, which is why I mention the possibility of generating your own trie code. It's really easy to do, once you have got your head around how to represent Erlang code as data structures. From ke.han@REDACTED Mon Apr 24 00:56:22 2006 From: ke.han@REDACTED (ke han) Date: Mon, 24 Apr 2006 06:56:22 +0800 Subject: mnesia text search ? Message-ID: <346A2F60-9994-4D8B-99D3-F281E9791F9B@redstarling.com> I need to do a very simple text search on fields in mnesia tables. I can't seem to find a simple method to accomplish this. I looked at qlc, pattern matching, etc, but I just can't put it together. I have a table named product and want to be able to find all product records where fields name, description and customerId are searched for inclusion of a string. That is, regexp match in its simplest form. I don't care if the current implementation is efficient. I just need a simple way to get it done. BTW, I notice that Ulf's rdbms has some searching features. Is this code in a working state? Any examples? thanks, ke han From serge@REDACTED Mon Apr 24 06:17:09 2006 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 24 Apr 2006 00:17:09 -0400 Subject: shootout - nsieve-bits benchmark In-Reply-To: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> References: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> Message-ID: <444C5145.8090709@hq.idt.net> Kostis, Is there a reason for functions in hipe_bifs to be available on Linux/UNIX but not on Windows? 1> os:type(). {win32,nt} 2> hipe_bifs:bytearray(10, 16#99). ** exited: {undef,[{hipe_bifs,bytearray,[10,153]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** Serge Kostis Sagonas wrote: > Richard Carlsson wrote: > > Ulf Wiger (AL/EAB) wrote: > > > I noticed that Erlang HiPE times out on the nsieve-bits benchmark. > > > That's not very flattering, since the upper limit is 3600 seconds. (: > > > [...] > > > > > I attach a version that uses an ordered_set ets table for a bit array. > > > It at least puts Erlang at the level of Tcl/JavaScript, and well before > > > Ruby (assuming that the Pentium 4 box performs at least as well as my > > > SunBLADE). It also matches the output of the other implementations (it > > > also seems to agree with Doug Bagley's old sieve program, found at > > > http://www.erlang.org/ml-archive/erlang-questions/200009/msg00010.html) > > > > > > I haven't submitted it. Does anyone have a better implementation? > > > > A nice challenge. Try the attached file - it's more than twice as fast > > as yours. That should put Erlang on the same level as Python and Smalltalk. > > I've kept quiet till now, because I did not want to reveal the HiPE > magic to the world, but since I see that all Erlang solutions are > ets-based, I find little reason not to send this post... > > Try the program below. Currently, it uses byte arrays rather than bits, > but converting it to use bits should be straightforward. It is about 20 > times faster than Yffe's program and about 10 times faster than Richard's. > > Oh, it is also about 3 to 5 times smaller... > > Kostis. > > %%------------------------------------------------------------------ > %% HiPE program contributed by Kostis Sagonas > > -module(nsievebits). > -export([main/1]). > > main([Arg]) -> > N = list_to_integer(Arg), > lists:foreach(fun(I) -> nsieve(10000 bsl (N-I)) end, [0,1,2]), > halt(0). > > nsieve(M) -> > io:format("Primes up to ~8w~8w\n", [M, nsieve(array(M), 2, M-1, 0)]). > > nsieve(A, P, Sz, C) when P =< Sz -> > NC = case hipe_bifs:bytearray_sub(A, P) of > 0 -> C; > _ -> nsieve_sub(A, P+P, Sz, P), C+1 > end, > nsieve(A, P+1, Sz, NC); > nsieve(_A, _P, _M, C) -> C. > > nsieve_sub(A, I, Sz, P) when I =< Sz -> > hipe_bifs:bytearray_update(A, I, 0), % clear position > nsieve_sub(A, I+P, Sz, P); > nsieve_sub(_, _, _, _) -> ok. > > array(M) -> hipe_bifs:bytearray(M+1, 16#ff). % an Erlang binary From serge@REDACTED Mon Apr 24 06:42:08 2006 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 24 Apr 2006 00:42:08 -0400 Subject: bug or feature? In-Reply-To: <200604232221.k3NMLbsL124744@atlas.otago.ac.nz> References: <200604232221.k3NMLbsL124744@atlas.otago.ac.nz> Message-ID: <444C5720.9070506@hq.idt.net> Richard A. O'Keefe wrote: [...] > No, from the sound of it, the approach you tried is NOT "exactly the > approach" that I'm talking about but very different indeed. The approach > I am talking about would NOT use fun(Prefix++Suffix, Prefix) -- in which > I for one would expect the first occurrence of Prefix to count as NOT BOUND. [...] > Let's take an example. Suppose the prefixes are > http: > https: > ftp: > tftp: [...] > Ideally, if you wrote > > f("http:" ++ S) -> S; > f("https:" ++ S) -> S; > f("ftp:" ++ S) -> S; > f("tftp:" ++ S) -> S; > f( S) -> S. [...] > the compiler would generate essentially the same trie. Certainly that's > what I would expect a Haskell or SML compiler to do. I don't know what > the current Erlang compiler will do with it, which is why I mention the > possibility of generating your own trie code. It's really easy to do, > once you have got your head around how to represent Erlang code as data > structures. Well, this all seems clear indeed if you know the exact values of Prefixes at compile-time, so that you can construct a pattern match such as: f("http:" ++ S) -> S; Perhaps I am missing your point, but if you have to obtain the prefix list from an external source at run-time, such as: % get_prefixes_to_be_stripped() -> PrefixList % PrefixList = [ Prefix ] % Prefix = string() then the only way to use your recommendation would be to construct a string, such as: "fun" ++ lists:flatten( ["(" ++ Prefix ++ "++ S) -> S;" || Prefix <- get_prefixes_to_be_stripped()]) ++ "(S) -> S." and then use erl_parse module to parse this string into a fun callable at run-time. Correct? It seems though that the "fun(Prefix++Suffix, Prefix)" notation would be a little bit less obscure, though, admittedly less efficient. Regards, Serge From ok@REDACTED Mon Apr 24 07:13:19 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 24 Apr 2006 17:13:19 +1200 (NZST) Subject: bug or feature? Message-ID: <200604240513.k3O5DJnW135667@atlas.otago.ac.nz> I wrote that the way to handle "extensive" prefix matching at run time was to CONSTRUCT A FUNCTION AT RUN TIME, and in my previous message showed (using source code syntax) what that function would look like. Serge Aleynikov replied: Well, this all seems clear indeed if you know the exact values of Prefixes at compile-time, ... Perhaps I am missing your point, but if you have to obtain the prefix list from an external source at run-time, such as: then the only way to use your recommendation would be to construct a string, ... and then use erl_parse module to parse this string into a fun callable at run-time. Correct? There are other alternatives, such as writing it out to a file and then compiling and loading as usual, but yes. It seems though that the "fun(Prefix++Suffix, Prefix)" notation would be a little bit less obscure, though, admittedly less efficient. If you only have one clause with f(Prefix, Prefix++Suffix) -> Suffix; % currently illegal f(_, String) -> String. and you have LOTS of prefixes, then you have to call that function LOTS of times. So we are not talking about a _little_ bit "less efficient", but "STUNNINGLY INEFFICIENT". It is so inefficient compared with the code generation version that (a) the difference between the version using the novel form of ++ and the current pure Erlang version I gave is invisible to the naked eye, by comparison, and (b) *interpreting* a trie is likely to be faster than running the compiled Prefix++Suffix code. If I had to match oodles of prefixes and for some reason was shy of generating code at run time, I would use a ternary search tree. A simple data structure which is just about perfect for this job. The technique of generating code at run time is a GENERAL technique with many uses. So far, we have only one known use for Prefix++Suffix with Prefix known at run time but not compile time. It seems to me that it is this highly specialised use of ++ which is obscure. I mean, with the run-time code generation version, you really cannot help noticing what is happening. I note that there are tools around to let you generate code at run time in C and Java... From bjorn@REDACTED Mon Apr 24 07:40:45 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 24 Apr 2006 07:40:45 +0200 Subject: bug or feature? In-Reply-To: <200604232221.k3NMLbsL124744@atlas.otago.ac.nz> References: <200604232221.k3NMLbsL124744@atlas.otago.ac.nz> Message-ID: "Richard A. O'Keefe" writes: > Ideally, if you wrote > > f("http:" ++ S) -> S; > f("https:" ++ S) -> S; > f("ftp:" ++ S) -> S; > f("tftp:" ++ S) -> S; > f( S) -> S. > > the compiler would generate essentially the same trie. It will. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kostis@REDACTED Mon Apr 24 08:39:40 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 24 Apr 2006 08:39:40 +0200 (MEST) Subject: shootout - nsieve-bits benchmark In-Reply-To: Mail from 'Serge Aleynikov ' dated: Mon, 24 Apr 2006 00:17:09 -0400 Message-ID: <200604240639.k3O6deoc012402@spikklubban.it.uu.se> Serge Aleynikov asked: > > Is there a reason for functions in hipe_bifs to be available on > Linux/UNIX but not on Windows? These functions exist for supporting HiPE; they were not intended for general use. As Windows has no HiPE port, there is little reason for them to be available there. But if you know how to build from source on Windows, it is just a matter of configuring the system with --enable-hipe. Kostis From thomasl_erlang@REDACTED Mon Apr 24 10:22:10 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 24 Apr 2006 01:22:10 -0700 (PDT) Subject: shootout - nsieve-bits benchmark In-Reply-To: <200604231941.k3NJfld2019259@spikklubban.it.uu.se> Message-ID: <20060424082210.80676.qmail@web38815.mail.mud.yahoo.com> --- Kostis Sagonas wrote: > > Has the time finally come for destructively > updated > > terms, then? :-) > > No, nothing as drastic as that. It is just that > HiPE has an > interface for arrays of bytes (implemented using > binaries) > and arrays of immediates -- e.g. fixnums. Well, that seems handy (esp. in a compiler). The array update function seemed to be destructive though? So I guess my question is: do these arrays behave like ets tables or like terms? For example, what happens if array A is sent from P to Q, then updated in P -- will Q see the update? My approximation would be: If A is "ets-like" then yes, if A is "term-like" then no. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From Reddy_P@REDACTED Mon Apr 24 10:53:30 2006 From: Reddy_P@REDACTED (Primanathan Reddy [ MTN - Innovation Centre ]) Date: Mon, 24 Apr 2006 10:53:30 +0200 Subject: Erlang R9-C2 and REDHAT 4 update 3 Message-ID: <23684C9CDF88C04FA8800AA825EADF5102E86ABC@MTNMAIL.mtn.co.za> Hello Has anyone experienced problems with threads on Linux Redhat 4 update 3. I have ran ./configure&&make with threads enabled. OS: Rehat 4 update 3 (AS) Started Erlang with +A 255 to enable additional 255 threads. Any idea on howto check if the erl runtime is using the additional threads? Thanks in advance :-) Prima NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/disclaimer -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Mon Apr 24 11:13:39 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 24 Apr 2006 11:13:39 +0200 (MEST) Subject: shootout - nsieve-bits benchmark In-Reply-To: Mail from 'Thomas Lindgren ' dated: Mon, 24 Apr 2006 01:22:10 -0700 (PDT) Message-ID: <200604240913.k3O9DdAu001641@spikklubban.it.uu.se> > Well, that seems handy (esp. in a compiler). The array > update function seemed to be destructive though? Yes. > So I guess my question is: do these arrays behave like > ets tables or like terms? For example, what happens if > array A is sent from P to Q, then updated in P -- will > Q see the update? For most uses (i.e., when the array is big enough) the binary is stored off-heap, so for practical purposes the answer is "yes". But this has not been our concern in uses so far. Kostis From ulf.wiger@REDACTED Mon Apr 24 13:05:38 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 24 Apr 2006 13:05:38 +0200 Subject: mnesia text search ? Message-ID: ke han wrote: > > I have a table named product and want to be able to find all > product records where fields name, description and customerId > are searched for inclusion of a string. That is, regexp > match in its simplest form. > > I don't care if the current implementation is efficient. I > just need a simple way to get it done. > > BTW, I notice that Ulf's rdbms has some searching features. > Is this code in a working state? Any examples? There is a test suite, and I have some beta testers. I'm currently revising the indexing callback structure in order to allow an "indexing pipeline" (being able to index on derived info, such as a parsed form of wiki text, etc.) The change will affect the second argument of the indexing callback (it will become a proplist, from which you can fetch the results of intermediate steps. One effect will be that any attribute index will be able to fetch the entire object through the proplist, since element(Pos, Obj) will become one such intermediate calculation step.) Rdbms contains some modules for free text searches, but they haven't been properly integrated yet. My hope is that it will eventually support word stem indexes. The current challenge is how to handle frequency values, since they are not local to the object. If you're looking for ways to do word lookups, then here's an example from the rdbms test suite, slightly cleaned up and with a few explanatory comments: rdbms_ix(Config) when is_list(Config) -> {atomic,ok} = rdbms:create_table( ix1, [{disc_copies, [node()]}, {attributes, [key, value]}, {rdbms, [ {indexes, [{{value,words}, ?MODULE,word_attr_ix,[],[]}]} ]} ]), Tab = ix1, %% create a few objects with 1-letter "words". %% O1 and O2 both contain the word "a". O1 = {Tab,1,"a b c d"}, O2 = {Tab,2,"a b"}, O3 = {Tab,3,"b c d"}, O4 = {Tab,4,"e f"}, O5 = {Tab,5,"f g"}, trans(fun() -> lists:foreach( fun(O) -> mnesia:write(O) end, [O1,O2,O3,O4,O5]) end), %% try index lookups using the word index trans(fun() -> [O1,O2,O3] = lists:sort( mnesia:index_read(Tab, "b", {value,words})), [O1,O3] = lists:sort( mnesia:index_read(Tab, "d", {value,words})) end). %% the index callback word_attr_ix(Str, _) -> [to_lower(W) || W <- string:tokens(Str, " \t\rn")]. to_lower(Word) -> lists:map(fun(C) when $A =< C, C =< $Z -> $a + (C - $A); (C) -> C end, Word). (One may observe that even this indexing function is really a two-step process: convert to lowercase + extract words, except it's done in the reverse order above.) BR, Ulf W From leifj@REDACTED Mon Apr 24 13:53:58 2006 From: leifj@REDACTED (Leif Johansson) Date: Mon, 24 Apr 2006 13:53:58 +0200 Subject: Billion-triple store In-Reply-To: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> Message-ID: <444CBC56.6020408@it.su.se> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Joel Reymont wrote: > Folks, > > How would I store a billion triples with Erlang? > > I don't necessarily need the full power of RDF as storing triples in the > form of {"Joel", has_a, daughter} would suffice. I would not mind > complying with RDF of course but it seems that would be an extra burder > due to the necessity of storing everything as strings, the need to > implement tries for those and the way Erlang stores strings. > > I'm not sure how to go about storing a billion of such triples in > Mnesia. I suppose I would need to use a 64-bit machine and a > disc_only_copy table. > > Any suggestions? > > Thanks, Joel > > -- > http://wagerlabs.com/ > > > > > I'd also like an answer to that question. I did some experiments but don't understand the way to get mnesia to play nice. I assume you have looked at the way tripplestores are typically built with rdbms ? Some of the schemes used in things like 3store, sesame, kowari (?) might be translatable... I am interested in working on this. Cheers Leif -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFETLxW8Jx8FtbMZncRAhxSAKCrPoCF5+PLZ5edZCdZlR4P2tKnDgCgkAbW p14gq/mqOKcUv+ZUSNhZ2bM= =8MHa -----END PGP SIGNATURE----- From rasmussen.bryan@REDACTED Mon Apr 24 14:15:25 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Mon, 24 Apr 2006 14:15:25 +0200 Subject: idx-xmnesia? Message-ID: <3bb44c6e0604240515m63008d47i99f440a1073da9e4@mail.gmail.com> Is idx-xmnesia still a running project, if so where can one find current information on it? From roger.larsson@REDACTED Mon Apr 24 14:28:55 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Mon, 24 Apr 2006 14:28:55 +0200 Subject: binaries (byte array) In-Reply-To: <200604240913.k3O9DdAu001641@spikklubban.it.uu.se> References: <200604240913.k3O9DdAu001641@spikklubban.it.uu.se> Message-ID: <200604241428.56410.roger.larsson@norran.net> On m?ndag 24 april 2006 11.13, Kostis Sagonas wrote: > > Well, that seems handy (esp. in a compiler). The array > > update function seemed to be destructive though? > > Yes. > > > So I guess my question is: do these arrays behave like > > ets tables or like terms? For example, what happens if > > array A is sent from P to Q, then updated in P -- will > > Q see the update? > > For most uses (i.e., when the array is big enough) the > binary is stored off-heap, so for practical purposes the > answer is "yes". But this has not been our concern in > uses so far. Time to decide? small -> on heap -> local big -> off heap -> global sent to other Erlang node -> local (but might be global on that node). Or: I have played with the idea to let the reference contain a generation in cases like this. And to generate an exception if trying to access an array of the wrong generation. Thus send the array (by reference but with generation) if you as the creator guarantees that it will not change until the receiver has processed the contents. (Syncrounous calls, or when giving up ones own reference). In other cases you is better of sending a process id for abstract accesses... /RogerL From mickael.remond@REDACTED Mon Apr 24 15:03:40 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 24 Apr 2006 15:03:40 +0200 Subject: idx-xmnesia? In-Reply-To: <3bb44c6e0604240515m63008d47i99f440a1073da9e4@mail.gmail.com> References: <3bb44c6e0604240515m63008d47i99f440a1073da9e4@mail.gmail.com> Message-ID: <20060424130340.GB804@memphis.ilius.fr> * bryan rasmussen [2006-04-24 14:15:25 +0200]: > Is idx-xmnesia still a running project, if so where can one find > current information on it? Hello Bryan, The project is dead. The code is rather old and unmaintenained, so I do not know if it could still be usefull today. -- Micka?l R?mond http://www.process-one.net/ From serge@REDACTED Mon Apr 24 15:09:25 2006 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 24 Apr 2006 09:09:25 -0400 Subject: Erlang R9-C2 and REDHAT 4 update 3 In-Reply-To: <23684C9CDF88C04FA8800AA825EADF5102E86ABC@MTNMAIL.mtn.co.za> References: <23684C9CDF88C04FA8800AA825EADF5102E86ABC@MTNMAIL.mtn.co.za> Message-ID: <444CCE05.2010904@hq.idt.net> When you start the emulator built with thread support you should see the "[threads:N]" clause at startup: $ erl +A255 Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:255] Eshell V5.4.13 (abort with ^G) 1> Also process list should show the matching (+1) number of entries: $ pstree | grep beam | |-sshd---sshd---bash---beam---256*[{beam}] Serge Primanathan Reddy [ MTN - Innovation Centre ] wrote: > Hello > > Has anyone experienced problems with threads on Linux Redhat 4 update 3. > > I have ran ./configure&&make with threads enabled. > > OS: Rehat 4 update 3 (AS) > > Started Erlang with +A 255 to enable additional 255 threads. > > Any idea on howto check if the erl runtime is using the additional threads? > > Thanks in advance J > > Prima From ke.han@REDACTED Mon Apr 24 16:55:34 2006 From: ke.han@REDACTED (ke han) Date: Mon, 24 Apr 2006 22:55:34 +0800 Subject: mnesia text search ? In-Reply-To: References: Message-ID: I have coded the following, which has a compile error (I can't seem to find it). erlc reports the error as being syntax error before: '.' on the last line. Any ideas on the error as well as if this code is an acceptable way to solve my search problem? thanks, ke han findProduct(SearchString, Industry, Client) -> RecordPattern = case {Industry, Client} of {undefined, undefined} -> Product#product{}; {Industry, undefined} when list(Industry) -> Product#product{industry = Industry}; {undefined, Client} when list(Client) -> Product#product{client = Client}; {Industry, Client} when list(Industry), list(Client) -> Product#product{industry = Industry, client = Client} end, SearchStringFun = case SearchString of undefined -> fun(Product) -> true end; SearchString when list(SearchString) -> {ok, RegExp} = regexp:parse(SearchString), fun(Product#product{clientProductId = ClientProductId, name = Name, description = Description}) -> case regexp:first_match(ClientProductId, RegExp) of {match, _} -> true; _ -> case regexp:first_match(Name, RegExp) of {match, _} -> true; _ -> case regexp:first_match(Description, RegExp) of {match, _} -> true; _ -> false end end end end, Fun = fun(Record, NewAcc) when Record = RecordPattern -> case SearchStringFun(Record) of true -> [Record | NewAcc]; _ -> NewAcc end; (_, NewAcc) -> NewAcc end, mnesia:foldl(Fun, [], product). From ulf.wiger@REDACTED Mon Apr 24 17:24:02 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 24 Apr 2006 17:24:02 +0200 Subject: mnesia text search ? Message-ID: Aren't you missing an 'end' to close the SearchString = case ... construct? BR, Ulf W > -----Original Message----- > From: ke han [mailto:ke.han@REDACTED] > Sent: den 24 april 2006 16:56 > To: Ulf Wiger (AL/EAB) > Cc: erlang-questions@REDACTED > Subject: Re: mnesia text search ? > > I have coded the following, which has a compile error (I > can't seem to find it). erlc reports the error as being > syntax error before: > '.' on the last line. > Any ideas on the error as well as if this code is an > acceptable way to solve my search problem? > thanks, ke han > > findProduct(SearchString, Industry, Client) -> > RecordPattern = case {Industry, Client} of > {undefined, undefined} > -> > Product#product{}; > {Industry, undefined} when list(Industry) > -> > Product#product{industry = Industry}; > {undefined, Client} when list(Client) > -> > Product#product{client = Client}; > {Industry, Client} when list(Industry), > list(Client) -> > Product#product{industry = Industry, > client = Client} > end, > > SearchStringFun = case SearchString of > undefined > -> > fun(Product) -> > true end; > SearchString when list(SearchString) -> > {ok, RegExp} = regexp:parse(SearchString), > fun(Product#product{clientProductId = > ClientProductId, name = Name, description = Description}) -> > case > regexp:first_match(ClientProductId, RegExp) of > {match, _} -> true; > _ -> > case > regexp:first_match(Name, RegExp) of > {match, _} -> true; > _ -> > case > regexp:first_match(Description, RegExp) of > {match, _} -> true; > _ > -> false > end > end > end > end, > > Fun = > fun(Record, NewAcc) when Record = RecordPattern -> > case SearchStringFun(Record) of > true -> [Record | NewAcc]; > _ -> NewAcc > end; > (_, NewAcc) -> NewAcc > end, > mnesia:foldl(Fun, [], product). > > > > From ke.han@REDACTED Mon Apr 24 17:55:01 2006 From: ke.han@REDACTED (ke han) Date: Mon, 24 Apr 2006 23:55:01 +0800 Subject: mnesia text search ? In-Reply-To: References: Message-ID: yes, thanks...after fixing that syntax error,, I realized my other syntax errors ;-). Now that I have a clean compile, I still can't get the function to work as expected. Any ideas? I am testing the simple case of product:findProduct("name", undefined, undefined). I get back an empty list when I know that name matches the regexp of one of the fields. I am suspicious that the cluase in Fun: RecordPattern = Record -> is not a valid way to match. But it complies and runs without error, so I'm a bit confused. thanks, ke han findProduct(SearchString, Industry, Client) -> RecordPattern = case {Industry, Client} of {undefined, undefined} -> #product{}; {Industry, undefined} when list(Industry) -> #product{industry = Industry}; {undefined, Client} when list(Client) -> #product{client = Client}; {Industry, Client} when list(Industry), list(Client) -> #product{industry = Industry, client = Client} end, SearchStringFun = case SearchString of undefined -> fun(Product) -> true end; SearchString when list(SearchString) -> {ok, RegExp} = regexp:parse(SearchString), fun(#product{clientProductId = ClientProductId, name = Name, description = Description}) -> case regexp:first_match(ClientProductId, RegExp) of {match, _} -> true; _ -> case regexp:first_match(Name, RegExp) of {match, _} -> true; _ -> case regexp:first_match(Description, RegExp) of {match, _} -> true; _ -> false end end end end end, Fun = fun(Record, NewAcc) -> case Record of RecordPattern = Record -> case SearchStringFun(Record) of true -> [Record | NewAcc]; _ -> NewAcc end; _ -> NewAcc end end, {atomic, Products} = mnesia:transaction(fun() -> mnesia:foldl(Fun, [], product) end), Products. On Apr 24, 2006, at 11:24 PM, Ulf Wiger ((AL/EAB)) wrote: > > Aren't you missing an 'end' to close the > SearchString = case ... construct? > > BR, > Ulf W > >> -----Original Message----- >> From: ke han [mailto:ke.han@REDACTED] >> Sent: den 24 april 2006 16:56 >> To: Ulf Wiger (AL/EAB) >> Cc: erlang-questions@REDACTED >> Subject: Re: mnesia text search ? >> >> I have coded the following, which has a compile error (I >> can't seem to find it). erlc reports the error as being >> syntax error before: >> '.' on the last line. >> Any ideas on the error as well as if this code is an >> acceptable way to solve my search problem? >> thanks, ke han >> >> findProduct(SearchString, Industry, Client) -> >> RecordPattern = case {Industry, Client} of >> {undefined, undefined} >> -> >> Product#product{}; >> {Industry, undefined} when list(Industry) >> -> >> Product#product{industry = Industry}; >> {undefined, Client} when list(Client) >> -> >> Product#product{client = Client}; >> {Industry, Client} when list(Industry), >> list(Client) -> >> Product#product{industry = Industry, >> client = Client} >> end, >> >> SearchStringFun = case SearchString of >> undefined >> -> >> fun(Product) -> >> true end; >> SearchString when list(SearchString) -> >> {ok, RegExp} = regexp:parse(SearchString), >> fun(Product#product{clientProductId = >> ClientProductId, name = Name, description = Description}) -> >> case >> regexp:first_match(ClientProductId, RegExp) of >> {match, _} -> true; >> _ -> >> case >> regexp:first_match(Name, RegExp) of >> {match, _} -> true; >> _ -> >> case >> regexp:first_match(Description, RegExp) of >> {match, _} -> true; >> _ >> -> false >> end >> end >> end >> end, >> >> Fun = >> fun(Record, NewAcc) when Record = RecordPattern -> >> case SearchStringFun(Record) of >> true -> [Record | NewAcc]; >> _ -> NewAcc >> end; >> (_, NewAcc) -> NewAcc >> end, >> mnesia:foldl(Fun, [], product). >> >> >> >> From ulf@REDACTED Mon Apr 24 22:34:21 2006 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 24 Apr 2006 22:34:21 +0200 Subject: mnesia text search ? In-Reply-To: References: Message-ID: Den 2006-04-24 17:55:01 skrev ke han : > yes, thanks...after fixing that syntax error,, I realized my other > syntax errors ;-). Now that I have a clean compile, I still can't get > the function to work as expected. Any ideas? I am testing the simple > case of product:findProduct("name", undefined, undefined). I get back > an empty list when I know that name matches the regexp of one of the > fields. > I am suspicious that the cluase in Fun: > RecordPattern = Record -> > is not a valid way to match. It's valid, but your RecordPattern is an instantiation of a #product{} record with default values for e.g. the clientProductId and name attributes. So it will almost certainly never match what you want. Beware that the record syntax performs different functions at instantiation and during pattern match. When creating a record, omitted attributes get assigned default values. When using a record pattern in a match, omitted attributes are ignored. But in your case, you're testing equality between the Record variable (which is probably bound to one record) and the RecordPattern variable, which is bound to another record. One way to match the Industry and Client values would be findProduct(SearchString, Industry, Client) -> MatchIndustry = fun(#product{industry = I}) when is_list(Industry) -> I == Industry; (_) -> true end, MatchClient = fun(#product{client = C}) when is_list(Client) -> C == Client; (_) -> true end, ..., Fun = fun(Record, Acc) -> case (MatchIndustry(Record) orelse MatchClient(Record)) andalso SearchStringFun(Record) of true -> [Record|Acc] false -> Acc end end, BR, Ulf W -- Ulf Wiger From xpdoka@REDACTED Mon Apr 24 23:19:29 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Mon, 24 Apr 2006 23:19:29 +0200 Subject: Requeuing a message in receive construct In-Reply-To: <2b7b425b0604211034r3e6c70fcn21bc9cad0af0986e@mail.gmail.com> References: <2b7b425b0604211034r3e6c70fcn21bc9cad0af0986e@mail.gmail.com> Message-ID: <444D40E1.5030607@dominicwilliams.net> J?r?mie Lumbroso a ?crit : > > Hello, > > I'm use the very practical receive ... end. construct in Erlang to > handle messages. > > Everything is fine except that I would like an elegant way to delay > messages. I thought of keeping track of the bytes sent, and then > decreasing that amount every second. But I am unable to do this > elegantly. How do you periodly decrease that variable while still > maintaining that receive ... end. construct (or do you suggest > starting a process which's only task is to decrease X by a given > amount every second?). I'm not sure what you're trying to achieve, but you could use timer:send_after/2 to resend yourself the message after the required delay, then receive selectively to handle that message first. Another possibility is to use timer:apply_after/4 to do whatever you want to do with the message a bit later (or achieve the same thing by spawning, waiting, then processing. spawn ( fun() -> timer:sleep(...), process_message(...) end), ... It depends on why you want to wait, and whether you can already determine exactly what you want to do later, or whether that could depend on messages that arrive in the meantime... Hope that helps, Dominic Williams http://www.dominicwilliams.net ---- From danie@REDACTED Tue Apr 25 07:44:34 2006 From: danie@REDACTED (Danie Schutte) Date: Tue, 25 Apr 2006 07:44:34 +0200 Subject: Off topic - Erlang Jobs Message-ID: <200604250744.35222.danie@erlfinsys.net> anyone interested in erlang jobs in United Arab Emirates, there are a few openings for contractors or permanent personnel, starting 14 May 2006. Varying from 1 - 12 months on the contracts. Some experience required. If you are interested contact me, or send a CV. Telco experience a benefit. Kind regards Daniel Schutte From ulf.wiger@REDACTED Tue Apr 25 08:53:29 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 25 Apr 2006 08:53:29 +0200 Subject: Off topic - Erlang Jobs Message-ID: For those not familiar with the UAE, it's a nice place. I've been to Dubai - very pleasant, and very cosmopolitan. Many people speak English. (Not that I'm volunteering, but that's for other reasons. :) BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Danie Schutte > Sent: den 25 april 2006 07:45 > To: erlang-questions@REDACTED > Subject: Off topic - Erlang Jobs > > > anyone interested in erlang jobs in United Arab Emirates, > there are a few openings for contractors or permanent > personnel, starting 14 May 2006. > > Varying from 1 - 12 months on the contracts. > Some experience required. > > If you are interested contact me, or send a CV. > > Telco experience a benefit. > > Kind regards > > Daniel Schutte > From andrae@REDACTED Tue Apr 25 11:01:33 2006 From: andrae@REDACTED (Andrae Muys) Date: Tue, 25 Apr 2006 19:01:33 +1000 Subject: Billion-triple store In-Reply-To: <444CBC56.6020408@it.su.se> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> Message-ID: <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> On 24/04/2006, at 9:53 PM, Leif Johansson wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Joel Reymont wrote: >> Folks, >> >> How would I store a billion triples with Erlang? >> >> I don't necessarily need the full power of RDF as storing triples >> in the >> form of {"Joel", has_a, daughter} would suffice. I would not mind >> complying with RDF of course but it seems that would be an extra >> burder >> due to the necessity of storing everything as strings, the need to >> implement tries for those and the way Erlang stores strings. >> >> I'm not sure how to go about storing a billion of such triples in >> Mnesia. I suppose I would need to use a 64-bit machine and a >> disc_only_copy table. >> >> Any suggestions? > > I'd also like an answer to that question. I did some experiments but > don't understand the way to get mnesia to play nice. I assume you have > looked at the way tripplestores are typically built with rdbms ? Some > of the schemes used in things like 3store, sesame, kowari (?) might > be translatable... > > I am interested in working on this. Well as the lead maintainer of kowari, I would be very happy to discuss any requirements you might have, and see if we can't help you. Currently the largest scalability test I am aware of for kowari was 500million, but those results indicated that we hadn't reached our limit yet. One of the store-layers designers did some calculations that indicate that we should be able to scale to 1-2billion without difficulty; although as one of the primary developers of the query layer I am aware of some bottle necks that are likely to interfere with any queries requiring extremely large intermediate results (~1e6 tuples). At the same time, there are plans to address these issues, and to break the scalability bottle necks that are preventing us reaching 1e10 and 1e11 at the moment, these include promising prototypes of a new store design to improve locality and throughput that should result in us scaling comfortably to 1e10. As far as interfacing with erlang is concerned, we currently support rmi and soap, as well as in-process java funcalls. I am currently working on xmlrpc support, and I am aware of plans to introduce a rest interface as well. Please let me know if there is anything I can do to help. Andrae -- Andrae Muys andrae@REDACTED Principal Kowari Consultant Netymon Pty Ltd From gunilla@REDACTED Tue Apr 25 13:50:11 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Tue, 25 Apr 2006 13:50:11 +0200 Subject: where are the processes? In-Reply-To: <20060422164125.GB24024@delora.autosys.us> References: <20060421225816.GY7007@delora.autosys.us> <20060422044713.GA24024@delora.autosys.us> <63BAC82F-9A97-40B3-B4AD-144D6E38DEA3@mobilearts.se> <20060422164125.GB24024@delora.autosys.us> Message-ID: <444E0CF3.9070804@erix.ericsson.se> Yes, the patch is included in R11B. Regards, Gunilla Michael McDaniel wrote: > On Sat, Apr 22, 2006 at 11:07:59AM +0200, Rikard Johansson wrote: >> Hi, >> >> Note that there is a bug in the output from etop_txt, values are >> printed on the wrong location, i.e. with wrong label. >> The bug existed in at least R10B6. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Gosh, duly noted; and patched. Thank you. Things are now > starting to make more sense to me regarding resource usage. > > I do hope the patch gets into the next release. > > ~Michael > > >> This patch corrects the problem: >> >> >> 57,59c57,59 >> < io:fwrite(Fd,?SYSFORM, >> [Config#opts.node,Clock,Cpu,Tot,NProcs,Procs, >> < RQ,Atom,Bin,Code,Ets]), >> < io:nl(Fd), >> --- >>> io:fwrite(Fd,?SYSFORM, [Config#opts.node,Clock, >> Cpu,Tot,Bin,NProcs, >>> Procs,Code,RQ,Atom,Ets]), >>> io:nl(Fd), >> SYSFORM as defined in etop_defs.hrl: >> -define(SYSFORM, >> " ~-72w~10s~n" >> " Load: cpu ~8w Memory: total ~8w binary >> ~8w~n" >> " procs~8w processes~8w code >> ~8w~n" >> " runq ~8w atom ~8w ets >> ~8w~n"). >> >> I have previously submitted this patch to erlang-patches, but I have >> not seen if it has made it way into any of the later releases. >> >> >> /Rikard >> >> >> >> >> 22 apr 2006 kl. 06.47 skrev Michael McDaniel: >> >>> On Fri, Apr 21, 2006 at 03:58:17PM -0700, Michael McDaniel wrote: >>>> SHORT: etop says 'procs 734506' and 'runq 15902' though I can't >>>> find the processes >>>> >>>> LONG: ... >>>> >>>> >>>> SYSTEM: >>>> >>>> yaws 1.56 compiled and running on R10B-10 on Linux >>>> >>>> Everything is started from yaws except for the process >>>> that the 404 error handler sends messages to. >>>> >>>> one appmod sends/receives messages with a persistent process >>>> >>>> another persistent process does some file monitoring >>>> >>>> a special 404 error handler sends a message to another >>>> persistent process (started independent of yaws). >>>> >>>> >>>> I start yaws thusly: >>>> >>>> /bin/su root -c " /usr/local/bin/yaws -sname yaws_autosys -heart \ >>>> -pa /var/yaws/ebin -D -x \ >>>> -erlarg \"-config /var/yaws/ebin/sys.config\" \ >>>> " >>>> >>>> and contents of sys.config are >>>> >>>> [{mnesia, [{dir, "/var/yaws/Mnesia.yaws_autosys"}]}]. >>>> >>>> >>>> >>>> Everything seems to work fine. This all runs on a remote machine. >>>> I login to that machine via ssh and run the following: >>>> >>>> >>>> I have been noticing that, when running etop as >>>> >>>> $ erl -sname etop -hidden -s etop -s erlang halt -output text \ >>>> -lines 27 -interval 33 -node 'yaws_autosys@REDACTED' >>>> >>>> I am seeing an increasing number of processes and also of >>>> run queue processes, for example, >>>> >>>> ===================================================================== >>>> === >>>> yaws_autosys@REDACTED >>>> 20:25:01 >>>> >>>> Load: cpu 0 Memory: total 756842 >>>> binary 121 >>>> procs 734563 processes 0 >>>> code 543 >>>> runq 15736 atom 4626 >>>> ets 342 >>>> >>>> --------------------------------------------------------------------- >>>> --- >>>> >>>> When first starting, the procs is less than 1000, runq is zero or >>>> single >>>> digit count, and total memory is less than ten megabytes. binary, >>>> code, >>>> ets, atom stay about the same. >>>> >>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> correction: >>> >>> should be "When first starting ... runq is under one hundred ..." >>> >>> ~M >>> >>> >>>> Now, when I remote shell as follows, >>>> >>>> $ erl -sname fu -remsh yaws_autosys@REDACTED >>>> Erlang (BEAM) emulator version 5.4.13 [hipe] >>>> >>>> Eshell V5.4.13 (abort with ^G) >>>> (yaws_autosys@REDACTED)1> erlang:statistics(run_queue). >>>> 0 >>>> (yaws_autosys@REDACTED)2> >>>> User switch command >>>> --> q >>>> $ >>>> >>>> The zero processes from erlang:statistics/1 has me confused >>>> compared to >>>> what I am seeing using erlang:statistics/1 and what etop is >>>> showing me. >>>> >>>> I am concerned about all these processes I can't find and the >>>> large runq >>>> shown by etop. >>>> >>>> I can do etop:config(lines, 300) there are less than 300 processes >>>> listed; >>>> same for i() from the remote shell. >>>> >>>> >>>> >>>> QUESTIONS: >>>> >>>> 1) what are the two different run queues from erlang:statistics/1 >>>> and the runq shown by etop? >>>> >>>> 2) how can I see (via some text mode tool) what the actual processes >>>> and processes in the runq that etop says exist ? >>>> >>>> >>>> thanks, >>>> >>>> ~Michael >>> -- >>> Michael McDaniel >>> Portland, Oregon, USA >>> http://autosys.us >>> +1 503 283 5284 >>> > From yani.dzhurov@REDACTED Tue Apr 25 14:34:49 2006 From: yani.dzhurov@REDACTED (Yani Dzhurov) Date: Tue, 25 Apr 2006 15:34:49 +0300 Subject: process sleeps Message-ID: <001e01c66864$a4d2e220$1500a8c0@name3d6d1f4b1d> Hi guys, I wondered whether timer:sleep(0) would cause a process to sleep or it will just pass it ? For instance if I have spawned process with fun(); fun()-> bar(), baz(), timer:sleep(0), bar(). Would the process sleep after baz(), or not ? 10x, yani -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3326 bytes Desc: not available URL: From ulf.wiger@REDACTED Tue Apr 25 15:37:14 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 25 Apr 2006 15:37:14 +0200 Subject: process sleeps Message-ID: No, it will just fall through. timer:sleep(0) is equivalent to receive after 0 -> ok end There is nothing to wait for, so the process won't sleep. BR, Ulf W ________________________________ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Yani Dzhurov Sent: den 25 april 2006 14:35 To: erlang-questions@REDACTED Subject: process sleeps Hi guys, I wondered whether timer:sleep(0) would cause a process to sleep or it will just pass it ? For instance if I have spawned process with fun(); fun()-> bar(), baz(), timer:sleep(0), bar(). Would the process sleep after baz(), or not ? 10x, yani -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo@REDACTED Tue Apr 25 16:05:28 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 25 Apr 2006 16:05:28 +0200 Subject: process sleeps References: <001e01c66864$a4d2e220$1500a8c0@name3d6d1f4b1d> Message-ID: yani.dzhurov@REDACTED (Yani Dzhurov) writes: If you read the source code for timer.erl: sleep(T) -> receive after T -> ok end. you will see that timer:sleep(0) will become receive after 0 -> ok end. and that will not even schedule out the current process. To do that you should use erlang:yield(). instead. > Hi guys, > > > > I wondered whether timer:sleep(0) would cause a process to sleep or it will > just pass it ? > > For instance if I have spawned process with fun(); > > > > fun()-> > > bar(), > > baz(), > > timer:sleep(0), > > bar(). > > Would the process sleep after baz(), or not ? > > > > 10x, > > > > yani > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From hakan@REDACTED Tue Apr 25 18:01:20 2006 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 25 Apr 2006 18:01:20 +0200 (CEST) Subject: Billion-triple store In-Reply-To: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> Message-ID: On Sun, 23 Apr 2006, Joel Reymont wrote: JR> How would I store a billion triples with Erlang? JR> JR> I don't necessarily need the full power of RDF as JR> storing triples in the form of {"Joel", has_a, JR> daughter} would suffice. I would not mind complying JR> with RDF of course but it seems that would be an extra JR> burder due to the necessity of storing everything as JR> strings, the need to implement tries for those and the JR> way Erlang stores strings. JR> JR> I'm not sure how to go about storing a billion of such JR> triples in Mnesia. I suppose I would need to use a JR> 64-bit machine and a disc_only_copy table. JR> JR> Any suggestions? Storing a billion records in a single dets file does not feel so appealing. The repair time of such a file would probably be loooooong. You can however obtain a more manageable file size by using a fragmented Mnesia table. I don't know how many fragments that are optimal, but you can start with 1000 or so and then measure the system characteristics for different number of fragments. If you do not need the ACID properties of Mnesia, you can also gain some performance by fragmenting the dets file yourself. It is quite easy to implement a customized fragmentation logic directly on top of dets. /H?kan From kostis@REDACTED Tue Apr 25 18:49:44 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 25 Apr 2006 18:49:44 +0200 (MEST) Subject: Documentation and uses of ets:info/1 Message-ID: <200604251649.k3PGni1j021421@spikklubban.it.uu.se> The documentation of 'ets:info/1' reads: info(Tab) -> tuple() | undefined while it should probably read: info(Tab) -> [tuple()] | undefined This causes confusion in other parts of Erlang/OTP. For example, in 'snmpa_general_db', there is code which reads: info({ets, Name, _}) -> case ets:info(Name) of T when tuple(T) -> tuple_to_list(T); L -> L end. Another discrepancy discovered by Dialyzer... Kostis From pupeno@REDACTED Tue Apr 25 19:11:34 2006 From: pupeno@REDACTED (Pupeno) Date: Tue, 25 Apr 2006 17:11:34 +0000 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <44456B7A.1060609@it.uu.se> References: <44456B7A.1060609@it.uu.se> Message-ID: <200604251711.40978.pupeno@pupeno.com> My unit tests using EUnit 2.0 have grown a lot, in fact, since I am doing a kind of meta-testing, they grow exponentially as my data structures grows. I've already reached the point where Erlang crashed after exhausting all my 700 MB or RAM (or so it seemed after the error message). Can I continue to work with a huge number of tests but not having take make a list of all of them ? That is, testing one at a time and and either try all the tests and return how many failed and how many didn't or halt at first failed test and show the debugging output to solve the problem. (If I make a change and suddenly 5000 tests don't pass, then I'll have to wait more than 30 seconds for Emacs to show all the output of the failure and I am interested only in the first one). Up to now I am simply testing with eunit:test/1; maybe my answer relies on eunit_server ? I couldn't really understand how it works. Thanks. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From bjorn@REDACTED Tue Apr 25 19:16:55 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 25 Apr 2006 19:16:55 +0200 Subject: Documentation and uses of ets:info/1 In-Reply-To: <200604251649.k3PGni1j021421@spikklubban.it.uu.se> References: <200604251649.k3PGni1j021421@spikklubban.it.uu.se> Message-ID: That is an incompatible change we have decided to make in R11B, since the old behaviour of returning a tuple is very strange. (That is, you are probably looking at the documentation for R10B, but running an R11B snapshot.) The code in the snmp application is written the way it is in order to work in both R10B and R11B. /Bj?rn Kostis Sagonas writes: > The documentation of 'ets:info/1' reads: > > info(Tab) -> tuple() | undefined > > while it should probably read: > > info(Tab) -> [tuple()] | undefined > > This causes confusion in other parts of Erlang/OTP. > For example, in 'snmpa_general_db', there is code which reads: > > info({ets, Name, _}) -> > case ets:info(Name) of > T when tuple(T) -> > tuple_to_list(T); > L -> > L > end. > > > Another discrepancy discovered by Dialyzer... > > > Kostis > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From klacke@REDACTED Tue Apr 25 20:30:13 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 25 Apr 2006 20:30:13 +0200 Subject: Billion-triple store In-Reply-To: References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> Message-ID: <444E6AB5.2040304@hyber.org> Hakan Mattsson wrote: > > Storing a billion records in a single dets file does > not feel so appealing. The repair time of such a file > would probably be loooooong. > Yes, but so would the corresponding disaster recovery be for other databases as well. Unless beam coredumps, there is a kernel panic or power failure, the dets file should never have to be repaired. Even then, the dets file mau very well be closed due to the autoclosing code in dets. The real limit is that that the size of dets files is limited. dets internally use 32 bit offsets, thus limiting the filesize to 4G (or possibly less ??) The obvious remedy is to hack dets to use 64 bit offsets instead. Easy. B.t.w, what is the time to repair a max size dets file ? anyone knows ? /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From joelr1@REDACTED Tue Apr 25 22:33:51 2006 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 25 Apr 2006 21:33:51 +0100 Subject: RSS client Message-ID: <7FD6A3B3-ED4E-44B2-894E-8080D4BF86DE@gmail.com> Is there such a beast for Erlang? -- http://wagerlabs.com/ From tzheng@REDACTED Tue Apr 25 22:02:27 2006 From: tzheng@REDACTED (Tony Zheng) Date: Tue, 25 Apr 2006 13:02:27 -0700 Subject: mnesia node replication Message-ID: <1145995347.8756.25.camel@gateway> Hi I created two mnesia nodes(one@REDACTED and two@REDACTED) and they can replicate very well. I want to add a new node on server3(three@REDACTED) and make it to replicate all data from one@REDACTED or two@REDACTED, how can I do it? I used mnesia:create_schema([three@REDACTED]) and mnesia:add_table_copy(Tab, three@REDACTED, Type), but it didn't work. Thanks. tony From richardc@REDACTED Wed Apr 26 00:09:17 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 26 Apr 2006 00:09:17 +0200 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <200604251711.40978.pupeno@pupeno.com> References: <44456B7A.1060609@it.uu.se> <200604251711.40978.pupeno@pupeno.com> Message-ID: <444E9E0D.7090609@it.uu.se> Pupeno wrote: > My unit tests using EUnit 2.0 have grown a lot, in fact, since I am doing a > kind of meta-testing, they grow exponentially as my data structures grows. > I've already reached the point where Erlang crashed after exhausting all my > 700 MB or RAM (or so it seemed after the error message). > Can I continue to work with a huge number of tests but not having take make a > list of all of them ? That is, testing one at a time and and either try all > the tests and return how many failed and how many didn't or halt at first > failed test and show the debugging output to solve the problem. (If I make a > change and suddenly 5000 tests don't pass, then I'll have to wait more than > 30 seconds for Emacs to show all the output of the failure and I am > interested only in the first one). > Up to now I am simply testing with eunit:test/1; maybe my answer relies on > eunit_server ? I couldn't really understand how it works. > Thanks. It is a sort of weakness of the current implementation that it assumes that you can produce a complete list of all the tests in advance. I did not expect to run into trouble so quickly, but you have shown that this needs to be addressed somehow. Thank you for giving the system such a thorough workout. :-) Meanwhile, I can only suggest that you try to generate and run smaller subsets of tests one at a time. Also, you might want to think about whether you really want to do exhaustive testing. Perhaps you should have a look at QuickCheck, and try some probability-based checking. /Richard From joelr1@REDACTED Wed Apr 26 01:10:20 2006 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 26 Apr 2006 00:10:20 +0100 Subject: Jabber client library Message-ID: <9BD60995-71C9-4DE5-A600-5951C57A1AA2@gmail.com> Folks, Is there a Jabber/ICQ/Yahoo/etc client library written in Erlang? If there is one then is there sample code to have it find a gateway to other IM services and connect? I would like to write a bot that connects to MSN, Yahoo and others via a Jabber server. Thanks, Joel -- http://wagerlabs.com/ From chris.double@REDACTED Wed Apr 26 02:02:40 2006 From: chris.double@REDACTED (Chris Double) Date: Wed, 26 Apr 2006 12:02:40 +1200 Subject: Jabber client library In-Reply-To: <9BD60995-71C9-4DE5-A600-5951C57A1AA2@gmail.com> References: <9BD60995-71C9-4DE5-A600-5951C57A1AA2@gmail.com> Message-ID: > Is there a Jabber/ICQ/Yahoo/etc client library written in Erlang? Have you looked at jabberlang? http://www.erlang-projects.org/Public/projects/libraries/jabberlang_0.2/view Chris. -- http://www.bluishcoder.co.nz From garris@REDACTED Wed Apr 26 03:23:29 2006 From: garris@REDACTED (Erik Garrison) Date: Tue, 25 Apr 2006 21:23:29 -0400 (EDT) Subject: RSS client In-Reply-To: <7FD6A3B3-ED4E-44B2-894E-8080D4BF86DE@gmail.com> References: <7FD6A3B3-ED4E-44B2-894E-8080D4BF86DE@gmail.com> Message-ID: http://www.trapexit.org/docs/howto/howto_rss_aggregator.html On Tue, 25 Apr 2006, Joel Reymont wrote: > Is there such a beast for Erlang? > > -- > http://wagerlabs.com/ > > > > > From surindar.shanthi@REDACTED Wed Apr 26 06:25:07 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 26 Apr 2006 09:55:07 +0530 Subject: Killing Supervisor Message-ID: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> Dear all, I have a supervision tree. We have built in functions to kill the child process. I want to kill the supervisor thereby terminating the whole supervision tree. Is there any way to do that. Please do my favour -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From ft@REDACTED Wed Apr 26 08:09:50 2006 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 26 Apr 2006 08:09:50 +0200 Subject: mnesia node replication In-Reply-To: <1145995347.8756.25.camel@gateway> References: <1145995347.8756.25.camel@gateway> Message-ID: <200604260809.50690.ft@it.su.se> On Tuesday 25 April 2006 22:02, Tony Zheng wrote: > Hi > > I created two mnesia nodes(one@REDACTED and two@REDACTED) and they can > replicate very well. I want to add a new node on > server3(three@REDACTED) and make it to replicate all data from > one@REDACTED or two@REDACTED, how can I do it? > I used mnesia:create_schema([three@REDACTED]) and > mnesia:add_table_copy(Tab, three@REDACTED, Type), but it didn't work. > > Thanks. > > tony Roughly (on three@REDACTED) : mnesia:start(), mnesia:change_config(extra_db_nodes, [MasterNode]), DiscC = mnesia:table_info(Table, disc_copies), case lists:member(node(), DiscC) of true -> %% table already present on node ok; false -> RamC = mnesia:table_info(Table, ram_copies), case lists:member(node(), RamC) of true -> mnesia:change_table_copy_type(Table, node(), disc_copies); false -> mnesia:add_table_copy(Table, node(), disc_copies) end end. That is how I do it in YXA (see src/bootstrap.erl). It converts RAM copies to disc copies, or just add a disc copy if table is not present on node(). /Fredrik From pupeno@REDACTED Wed Apr 26 12:28:29 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 26 Apr 2006 10:28:29 +0000 Subject: EUnit 2.0 alpha testers wanted In-Reply-To: <444E9E0D.7090609@it.uu.se> References: <44456B7A.1060609@it.uu.se> <200604251711.40978.pupeno@pupeno.com> <444E9E0D.7090609@it.uu.se> Message-ID: <200604261028.30382.pupeno@pupeno.com> On Tuesday, 25 de April de 2006 22:09, Richard Carlsson wrote: > Pupeno wrote: > > My unit tests using EUnit 2.0 have grown a lot, in fact, since I am doing > > a kind of meta-testing, they grow exponentially as my data structures > > grows. I've already reached the point where Erlang crashed after > > exhausting all my 700 MB or RAM (or so it seemed after the error > > message). > > Can I continue to work with a huge number of tests but not having take > > make a list of all of them ? That is, testing one at a time and and > > either try all the tests and return how many failed and how many didn't > > or halt at first failed test and show the debugging output to solve the > > problem. (If I make a change and suddenly 5000 tests don't pass, then > > I'll have to wait more than 30 seconds for Emacs to show all the output > > of the failure and I am interested only in the first one). > > Up to now I am simply testing with eunit:test/1; maybe my answer relies > > on eunit_server ? I couldn't really understand how it works. > > Thanks. > > It is a sort of weakness of the current implementation that it assumes > that you can produce a complete list of all the tests in advance. I did > not expect to run into trouble so quickly, but you have shown that this > needs to be addressed somehow. Thank you for giving the system such a > thorough workout. :-) I think a way to solve it is that the test function would take a 'previous result' as parameter and give a result, so as you run tests you can go getting results and accumulating, wether you stop at first failure or not would be up to the user (with some function to test if in a result there's a failure). The result structure would contain tests made, passed, etc and a list of errors if neccesary. > Meanwhile, I can only suggest that you try to generate and run smaller > subsets of tests one at a time. Also, you might want to think about > whether you really want to do exhaustive testing. Perhaps you should > have a look at QuickCheck, and try some probability-based checking. I kinda emulated QuickCheck with Eunit by generating big lists and picking up some cases, I loved QuickCheck when codding on Haskell. I didn't expect to find an implementation of QuickCheck for Erlang and there seems to be a kind of: http://www.math.chalmers.se/~rjmh/ErlangQC/ I'll take a look at it. Thank you. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From serge@REDACTED Wed Apr 26 13:19:58 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 26 Apr 2006 07:19:58 -0400 Subject: Killing Supervisor In-Reply-To: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> Message-ID: <444F575E.6090304@hq.idt.net> exit(whereis(SupervisorPid), kill). Surindar Sivanesan wrote: > Dear all, > I have a supervision tree. We have built in functions to kill the child > process. > I want to kill the supervisor thereby terminating the whole supervision > tree. Is there any way to do that. > Please do my favour > > -- > with regards, > S.Surindar From joelr1@REDACTED Wed Apr 26 13:24:52 2006 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 26 Apr 2006 12:24:52 +0100 Subject: Jabber client library In-Reply-To: References: <9BD60995-71C9-4DE5-A600-5951C57A1AA2@gmail.com> Message-ID: <85A17A36-66D3-4657-9473-2112B4D341F5@gmail.com> Thanks Chris. Are there any examples of how to connect to other services via Jabber? On Apr 26, 2006, at 1:02 AM, Chris Double wrote: > http://www.erlang-projects.org/Public/projects/libraries/ > jabberlang_0.2/view -- http://wagerlabs.com/ From joelr1@REDACTED Wed Apr 26 13:25:12 2006 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 26 Apr 2006 12:25:12 +0100 Subject: RSS client In-Reply-To: References: <7FD6A3B3-ED4E-44B2-894E-8080D4BF86DE@gmail.com> Message-ID: <0F166FB5-C484-47BE-9A7F-A0AD169C101D@gmail.com> Erik, Thanks for the tip! On Apr 26, 2006, at 2:23 AM, Erik Garrison wrote: > http://www.trapexit.org/docs/howto/howto_rss_aggregator.html > -- http://wagerlabs.com/ From serge@REDACTED Wed Apr 26 13:36:36 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 26 Apr 2006 07:36:36 -0400 Subject: Killing Supervisor In-Reply-To: <444F575E.6090304@hq.idt.net> References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> <444F575E.6090304@hq.idt.net> Message-ID: <444F5B44.5010605@hq.idt.net> Sorry, I typed too fast. It should've been SupervisorName instead: exit(whereis(SupervisorName), kill). Serge Aleynikov wrote: > exit(whereis(SupervisorPid), kill). > > Surindar Sivanesan wrote: > >> Dear all, >> I have a supervision tree. We have built in functions to kill the >> child process. >> I want to kill the supervisor thereby terminating the whole >> supervision tree. Is there any way to do that. >> Please do my favour >> >> -- >> with regards, >> S.Surindar > > > From joelr1@REDACTED Wed Apr 26 13:37:12 2006 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 26 Apr 2006 12:37:12 +0100 Subject: ejabberd osx Message-ID: <6E238C44-5132-4A05-A83B-BDAA2C25DDD6@gmail.com> Has anyone successfully compiled ejabberd 1.1 on OSX? I get bigdaddy:/tmp/ejabberd-1.1.0/src joelr$ make gcc -Wall -g -O2 \ expat_erl.c \ -lexpat \ -L/opt/local/lib/erlang/lib/erl_interface-3.5.4/lib - lerl_interface -lei -I/opt/local/lib/erlang/lib/erl_interface-3.5.4/ include -I/opt/local/lib/erlang/usr/include \ -o expat_erl.so -fpic -shared powerpc-apple-darwin8-gcc-4.0.0: unrecognized option '-shared' expat_erl.c:1: warning: -fpic is not supported; -fPIC assumed expat_erl.c: In function 'ei_x_encode_string_len_fixed': expat_erl.c:81: warning: implicit declaration of function 'x_fix_buff' /usr/bin/ld: Undefined symbols: _main _driver_alloc _driver_alloc_binary _driver_free _set_port_control_flags collect2: ld returned 1 exit status make: *** [expat_erl.so] Error 1 -- http://wagerlabs.com/ From ft@REDACTED Wed Apr 26 13:48:13 2006 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 26 Apr 2006 13:48:13 +0200 Subject: ejabberd osx In-Reply-To: <6E238C44-5132-4A05-A83B-BDAA2C25DDD6@gmail.com> References: <6E238C44-5132-4A05-A83B-BDAA2C25DDD6@gmail.com> Message-ID: <200604261348.13417.ft@it.su.se> On Wednesday 26 April 2006 13:37, Joel Reymont wrote: > Has anyone successfully compiled ejabberd 1.1 on OSX? I get Isn't there an ejabberd-users mailinglist where problems with compiling ejabberd would be more appropriate? /Fredrik From Lennart.Ohman@REDACTED Wed Apr 26 13:48:44 2006 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Wed, 26 Apr 2006 13:48:44 +0200 Subject: SV: Killing Supervisor References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> <444F575E.6090304@hq.idt.net> <444F5B44.5010605@hq.idt.net> Message-ID: Hi every one. The suggested answer is of course perfectly correct. However I believe that that is not exactly what Surindar is looking for. He writes that he wants to terminate the entire supervision tree using this function. That indicates to me that this is about stopping a part of his system, in an ordered way. My suggestion is to think of the supevisor as a child to a higher layer supervisor. Hence the higher layer supervisor should be told, using the supevisor API, to stop the child which is the supervisor in question. If you simply do exit(Pid,kill) on the supervisor, it will not be given the chance of terminating its children in an ordered way. Best Regards, Lennart ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sj?land & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED ________________________________ Fr?n: owner-erlang-questions@REDACTED genom Serge Aleynikov Skickat: on 2006-04-26 13:36 Till: Surindar Sivanesan Kopia: erlang-questions@REDACTED ?mne: Re: Killing Supervisor Sorry, I typed too fast. It should've been SupervisorName instead: exit(whereis(SupervisorName), kill). Serge Aleynikov wrote: > exit(whereis(SupervisorPid), kill). > > Surindar Sivanesan wrote: > >> Dear all, >> I have a supervision tree. We have built in functions to kill the >> child process. >> I want to kill the supervisor thereby terminating the whole >> supervision tree. Is there any way to do that. >> Please do my favour >> >> -- >> with regards, >> S.Surindar > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuel@REDACTED Wed Apr 26 16:31:07 2006 From: samuel@REDACTED (Samuel Rivas) Date: Wed, 26 Apr 2006 16:31:07 +0200 Subject: SV: Killing Supervisor In-Reply-To: References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> <444F575E.6090304@hq.idt.net> <444F5B44.5010605@hq.idt.net> Message-ID: <20060426143107.GA2265@nodo2.lambdastream.com> Lennart ?hman wrote: > If you simply do exit(Pid,kill) on the supervisor, it will not > be given the chance of terminating its children in an ordered > way. Calling exit(SupervisorPid, shutdown) in the supervisor's parent process would do the trick. Regards -- Samuel From karol.skocik@REDACTED Wed Apr 26 16:28:56 2006 From: karol.skocik@REDACTED (karol skocik) Date: Wed, 26 Apr 2006 16:28:56 +0200 Subject: XMERL - path to DTD directory Message-ID: Hi, I hope that I did not overlooked something obvious in manual, but it there any way to tell XMERL where to search for DTD files needed for parsing? In the module xmerl_scan, the only option involving directories is {xmlbase, Dir} which does not help. Thank you, Karol From Lennart.Ohman@REDACTED Wed Apr 26 16:51:37 2006 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Wed, 26 Apr 2006 16:51:37 +0200 Subject: SV: SV: Killing Supervisor References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> <444F575E.6090304@hq.idt.net> <444F5B44.5010605@hq.idt.net> <20060426143107.GA2265@nodo2.lambdastream.com> Message-ID: Hi, But still the higher level supervisor will see this as that the child-supervisor you just terminated has terminated due to a fault. It will try to restart it according to the type (temporary, transient or permenant) and restart intensity. If one wants to get rid of children, the supervisor API supervisor:terminate_child/2 should be used. http://www.erlang.se/doc/doc-5.4.13/lib/stdlib-1.13.12/doc/html/index.html Best regards, Lennart ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sj?land & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED ________________________________ Fr?n: owner-erlang-questions@REDACTED genom Samuel Rivas Skickat: on 2006-04-26 16:31 Till: erlang-questions@REDACTED ?mne: Re: SV: Killing Supervisor Lennart ?hman wrote: > If you simply do exit(Pid,kill) on the supervisor, it will not > be given the chance of terminating its children in an ordered > way. Calling exit(SupervisorPid, shutdown) in the supervisor's parent process would do the trick. Regards -- Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuel@REDACTED Wed Apr 26 17:02:07 2006 From: samuel@REDACTED (Samuel Rivas) Date: Wed, 26 Apr 2006 17:02:07 +0200 Subject: SV: SV: Killing Supervisor In-Reply-To: References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> <444F575E.6090304@hq.idt.net> <444F5B44.5010605@hq.idt.net> <20060426143107.GA2265@nodo2.lambdastream.com> Message-ID: <20060426150207.GA2818@nodo2.lambdastream.com> > > > If you simply do exit(Pid,kill) on the supervisor, it will not > > > be given the chance of terminating its children in an ordered > > > way. > > > > Calling exit(SupervisorPid, shutdown) in the supervisor's parent > > process would do the trick. > > > > But still the higher level supervisor will see this as that the > child-supervisor you just terminated has terminated due to a fault. > It will try to restart it according to the type (temporary, transient > or permenant) and restart intensity. > > If one wants to get rid of children, the supervisor API > supervisor:terminate_child/2 should be used. Of course, if the parent process is a supervisor it is much more sensible to use the API to shutdown his children ;-) Regards -- Samuel From eranga@REDACTED Wed Apr 26 16:02:11 2006 From: eranga@REDACTED (Eranga Udesh) Date: Wed, 26 Apr 2006 20:02:11 +0600 Subject: SNMP Association file directory Message-ID: <20060426142813.A1D5A19DC05B@mail.wavenet.lk> Hi, In a release where should the Association file located? I installed in the directory which I specified as the db_dir in the SNMP config file, but it doesn't seem to be loading that file. The compiled MIB files (.bin) are also located in that directory. Also I had to give the full path to the .bin file (it didn't get it from the db_dir parameter place). What could be wrong? Thanks, - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Apr 26 20:17:35 2006 From: erlang@REDACTED (Michael McDaniel) Date: Wed, 26 Apr 2006 11:17:35 -0700 Subject: XMERL - path to DTD directory In-Reply-To: References: Message-ID: <20060426181735.GS24024@delora.autosys.us> I give explicit path to dtd file ... {XMLn, _} = xmerl_scan:string( Xml, [{space, normalize} , {doctype_DTD, "/path/to/some/file.dtd"}, {validation, true}]) , which does not really help if you have no information as to *which* dtd file should be used, though maybe you can consolidate some dtd files which cover various Xml input for different stages of operation. I wind up having something like -record( dtd, { rcv = "/path/to/include/rcv.dtd" , xmit = "/path/to/include/xmit.dtd" , query = "/path/to/include/query.dtd" , qRequest = "/path/to/include/qRequest.dtd" , qResponse = "/path/to/include/qResponse.dtd" }). and then use the appropriate field depending on what state the application is in {XMLn, _} = xmerl_scan:string( Xml, [{space, normalize} , {doctype_DTD, ConfRec#dtd.query}, {validation, true}]) , Following link was very helpful to me when I created the application: http://www.erlang.org/ml-archive/erlang-questions/200501/msg00192.html ~Michael On Wed, Apr 26, 2006 at 04:28:56PM +0200, karol skocik wrote: > Hi, > I hope that I did not overlooked something obvious in manual, but it > there any way to tell XMERL where to search for DTD files needed for > parsing? In the module xmerl_scan, the only option involving > directories is {xmlbase, Dir} which does not help. > > Thank you, > Karol From karol.skocik@REDACTED Wed Apr 26 20:49:25 2006 From: karol.skocik@REDACTED (karol skocik) Date: Wed, 26 Apr 2006 20:49:25 +0200 Subject: XMERL - path to DTD directory In-Reply-To: <20060426181735.GS24024@delora.autosys.us> References: <20060426181735.GS24024@delora.autosys.us> Message-ID: That's it! Thank you, Karol On 4/26/06, Michael McDaniel wrote: > I give explicit path to dtd file ... > > > {XMLn, _} = xmerl_scan:string( Xml, [{space, normalize} , > {doctype_DTD, "/path/to/some/file.dtd"}, > {validation, true}]) , > > > which does not really help if you have no information as to *which* > dtd file should be used, though maybe you can consolidate some dtd > files which cover various Xml input for different stages of operation. > > I wind up having something like > > -record( dtd, { > rcv = "/path/to/include/rcv.dtd" , > xmit = "/path/to/include/xmit.dtd" , > query = "/path/to/include/query.dtd" , > qRequest = "/path/to/include/qRequest.dtd" , > qResponse = "/path/to/include/qResponse.dtd" > }). > > > and then use the appropriate field depending on what state the > application is in > > {XMLn, _} = xmerl_scan:string( Xml, [{space, normalize} , > {doctype_DTD, ConfRec#dtd.query}, > {validation, true}]) , > > > > Following link was very helpful to me when I created the application: > http://www.erlang.org/ml-archive/erlang-questions/200501/msg00192.html > > > ~Michael > > > On Wed, Apr 26, 2006 at 04:28:56PM +0200, karol skocik wrote: > > Hi, > > I hope that I did not overlooked something obvious in manual, but it > > there any way to tell XMERL where to search for DTD files needed for > > parsing? In the module xmerl_scan, the only option involving > > directories is {xmlbase, Dir} which does not help. > > > > Thank you, > > Karol > From mickael.remond@REDACTED Wed Apr 26 23:27:17 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 26 Apr 2006 23:27:17 +0200 Subject: ejabberd 1.1.0 Message-ID: <20060426212717.GB18163@memphis.process-one.net> ejabberd 1.1.0 has been released. From Erlang developer point of view, we made several architectural change and optimization that could be interesting. We are using more extensively the framework OTP, the active once socket mode for better TCP/IP regulation. The clustering code has also been improved. All those features and code improvement should hopefully make ejabberd an even better example of Erlang use on a large scale, production system, real life project. Your comments, patches and suggestions are of course welcome. More informations can be found on: http://www.process-one.net/en/projects/ejabberd/ Release note is found on: http://www.process-one.net/en/projects/ejabberd/releases/release_1.1.0.html Cheers, -- Micka?l R?mond http://www.process-one.net/ From joelr1@REDACTED Thu Apr 27 00:15:34 2006 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 26 Apr 2006 23:15:34 +0100 Subject: ejabberd 1.1.0 In-Reply-To: <20060426212717.GB18163@memphis.process-one.net> References: <20060426212717.GB18163@memphis.process-one.net> Message-ID: Mickael, I don't see the OSX version under binary downloads, am I missing something? Thanks, Joel -- http://wagerlabs.com/ From mickael.remond@REDACTED Thu Apr 27 00:48:38 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 27 Apr 2006 00:48:38 +0200 Subject: ejabberd 1.1.0 In-Reply-To: References: <20060426212717.GB18163@memphis.process-one.net> Message-ID: <20060426224838.GC13361@memphis.process-one.net> * Joel Reymont [2006-04-26 23:15:34 +0100]: > Mickael, > > I don't see the OSX version under binary downloads, am I missing > something? It has just been released: http://www.process-one.net/en/projects/ejabberd/download/1.1.0/ejabberd-1.1.0_1-osx-installer.app.zip Cheers, -- Micka?l R?mond http://www.process-one.net/ From kg9020@REDACTED Thu Apr 27 06:13:21 2006 From: kg9020@REDACTED (a) Date: Wed, 26 Apr 2006 23:13:21 -0500 Subject: hello Message-ID: <4983B74E-353A-4147-BBDB-C41F8BB83BF6@gmail.com> hello test test art From yani.dzhurov@REDACTED Thu Apr 27 08:57:35 2006 From: yani.dzhurov@REDACTED (Yani Dzhurov) Date: Thu, 27 Apr 2006 09:57:35 +0300 Subject: Segmentation fault (core dumped) Message-ID: <000801c669c7$dd5c2610$1500a8c0@name3d6d1f4b1d> How is it possible to get segmentation fault with Erlang ? And how can analyze the core file to find out the reason for the segfault? 10x, yani -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3326 bytes Desc: not available URL: From bmk@REDACTED Thu Apr 27 10:06:49 2006 From: bmk@REDACTED (Micael Karlberg) Date: Thu, 27 Apr 2006 10:06:49 +0200 Subject: SNMP Association file directory In-Reply-To: <20060426142813.A1D5A19DC05B@mail.wavenet.lk> References: <20060426142813.A1D5A19DC05B@mail.wavenet.lk> Message-ID: <44507B99.4040708@erix.ericsson.se> Hi, Eranga Udesh wrote: > Hi, > > > > In a release where should the Association file located? Association file? Do you mean the .funcs files? > I installed in > the directory which I specified as the db_dir in the SNMP config file, db_dir is just a place for the snmp application to store internal data. It does not care what else you put into that directory, as long as you don't mess with the files created by the snmp application. But in principle, I would leave that directory to the snmp application (and not put my own stuff into it). > but it doesn?t seem to be loading that file. The compiled MIB files > (.bin) are also located in that directory. Also I had to give the full > path to the .bin file (it didn?t get it from the db_dir parameter place). > Most of this stuff is described in the documentation. > > > What could be wrong? > > > > Thanks, > > - Eranga > /BMK From samuel@REDACTED Thu Apr 27 11:18:43 2006 From: samuel@REDACTED (Samuel Rivas) Date: Thu, 27 Apr 2006 11:18:43 +0200 Subject: erl_parse/erl_scan documentation Message-ID: <20060427091843.GA14768@nodo2.lambdastream.com> Hi, I think that the "Error Information" section is wrong. Where it reads: "A string which describes the error is obtained with the following call: apply(Module, format_error, ErrorDescriptor)" it should read: "A string which describes the error is obtained with the following call: apply(Module, format_error, [ErrorDescriptor])" Regards. -- Samuel From eranga@REDACTED Thu Apr 27 09:57:09 2006 From: eranga@REDACTED (Eranga Udesh) Date: Thu, 27 Apr 2006 13:57:09 +0600 Subject: SNMP Association file directory In-Reply-To: <44507B99.4040708@erix.ericsson.se> Message-ID: <20060427082227.9C62E19DC071@mail.wavenet.lk> Hi, Thanks for the reply. Yes, I am talking about the .funcs files. Where should I place them in a release? As per my knowledge the SNMP application (in my case SNMP Agent) loads those files when loading the MIBs (compiled), correct? So, how can I give the corresponding .funcs file for a certain MIB when loading? In my .config file for the release I have below entries. {snmp, [{agent, [ ...., {db_dir, "/usr2/omni_oam/system/lib/omni_oam-2.0/priv/snmp/agent/db"}, ...., {config, [{dir, "/usr2/omni_oam/system/lib/omni_oam-2.0/priv/snmp/agent/conf"},{force_load, true},{verbosity, silence}]}, ....}]}]}, I have placed the compiled MIB files (.bin) in the directory specified by db_dir parameter, but when I try to do snmpa:load_mibs/2 with just the name of the MIB file, it doesn't work (error - noent). But if I give the full path to the MIB file, it loads the file. But still I don't see it loading the .funcs file, though I have the .funcs file in the same directory where the .bin file is located. Please help if you see any problem I do. Thanks, - Eranga -----Original Message----- From: Micael Karlberg [mailto:bmk@REDACTED] Sent: Thursday, April 27, 2006 2:07 PM To: Eranga Udesh Cc: erlang-questions@REDACTED Subject: Re: SNMP Association file directory Hi, Eranga Udesh wrote: > Hi, > > > > In a release where should the Association file located? Association file? Do you mean the .funcs files? > I installed in > the directory which I specified as the db_dir in the SNMP config file, db_dir is just a place for the snmp application to store internal data. It does not care what else you put into that directory, as long as you don't mess with the files created by the snmp application. But in principle, I would leave that directory to the snmp application (and not put my own stuff into it). > but it doesn't seem to be loading that file. The compiled MIB files > (.bin) are also located in that directory. Also I had to give the full > path to the .bin file (it didn't get it from the db_dir parameter place). > Most of this stuff is described in the documentation. > > > What could be wrong? > > > > Thanks, > > - Eranga > /BMK From ulf.wiger@REDACTED Thu Apr 27 13:28:00 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 27 Apr 2006 13:28:00 +0200 Subject: erlang at www.ericsson.com Message-ID: For those of you who want a link to some official Ericsson web site that mentions Erlang, there is one now, three clicks away from the main page: http://www.ericsson.com/technology/open_source/ or http://www.ericsson.com/technology/opensource/erlang/ Regards, Ulf Wiger From bengt.kleberg@REDACTED Thu Apr 27 14:04:34 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 27 Apr 2006 14:04:34 +0200 Subject: SNMP Association file directory In-Reply-To: <20060427082227.9C62E19DC071@mail.wavenet.lk> References: <20060427082227.9C62E19DC071@mail.wavenet.lk> Message-ID: <4450B352.1060508@ericsson.com> On 2006-04-27 09:57, Eranga Udesh wrote: ...deleted > path to the MIB file, it loads the file. But still I don't see it loading > the .funcs file, though I have the .funcs file in the same directory where > the .bin file is located. imho the compilation uses both the .mib and the .funcs files to create the .bin file. bengt From mats.cronqvist@REDACTED Thu Apr 27 14:09:53 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 27 Apr 2006 14:09:53 +0200 Subject: erlang at www.ericsson.com In-Reply-To: References: Message-ID: <4450B491.8010700@ericsson.com> but who are the people illustrating erlang use in ericsson? a representative sample of your coders? mats http://www.ericsson.com/technology/opensource/images/girls_office_comp_145.jpg Ulf Wiger (AL/EAB) wrote: > For those of you who want a link to some official Ericsson web site that > mentions Erlang, there is one now, three clicks away from the main page: > > http://www.ericsson.com/technology/open_source/ > > or > > http://www.ericsson.com/technology/opensource/erlang/ > > > Regards, > Ulf Wiger > From serge@REDACTED Thu Apr 27 14:21:39 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 27 Apr 2006 08:21:39 -0400 Subject: erlang at www.ericsson.com In-Reply-To: References: Message-ID: <4450B753.5060704@hq.idt.net> One of the documents on that site mentions an xerl tool: http://www.ericsson.com/ericsson/corpinfo/publications/review/1997_01/files/1997012.pdf xerl A complete integrated Erlang environment, xerl is an X Window-based interface to the standard Erlang shell. The interface may be used to compile, edit, debug and run Erlang. Moreover, because xerl is sensitive to Erlang syntax, it checks and formats code as it is written. Is there such an IDE, or was it something withdrawn from OTP long time ago? Serge Ulf Wiger (AL/EAB) wrote: > For those of you who want a link to some official Ericsson web site that > mentions Erlang, there is one now, three clicks away from the main page: > > http://www.ericsson.com/technology/open_source/ > > or > > http://www.ericsson.com/technology/opensource/erlang/ > > > Regards, > Ulf Wiger > > From bmk@REDACTED Thu Apr 27 14:41:57 2006 From: bmk@REDACTED (Micael Karlberg) Date: Thu, 27 Apr 2006 14:41:57 +0200 Subject: SNMP Association file directory In-Reply-To: <20060427082227.9C62E19DC071@mail.wavenet.lk> References: <20060427082227.9C62E19DC071@mail.wavenet.lk> Message-ID: <4450BC15.8070307@erix.ericsson.se> Hi, Eranga Udesh wrote: > Hi, > > Thanks for the reply. > > Yes, I am talking about the .funcs files. Where should I place them in a > release? As per my knowledge the SNMP application (in my case SNMP Agent) > loads those files when loading the MIBs (compiled), correct? So, how can I > give the corresponding .funcs file for a certain MIB when loading? > The data of the funcs-file (an MFA) is compiled into the MIB, so you only have to make sure that your node has the path to the module implementing the functions referenced in the funcs-file. > In my .config file for the release I have below entries. > > {snmp, > [{agent, > [ > ...., > {db_dir, "/usr2/omni_oam/system/lib/omni_oam-2.0/priv/snmp/agent/db"}, > ...., > {config, [{dir, > "/usr2/omni_oam/system/lib/omni_oam-2.0/priv/snmp/agent/conf"},{force_load, > true},{verbosity, silence}]}, > ....}]}]}, > > I have placed the compiled MIB files (.bin) in the directory specified by > db_dir parameter, but when I try to do snmpa:load_mibs/2 with just the name > of the MIB file, it doesn't work (error - noent). But if I give the full > path to the MIB file, it loads the file. But still I don't see it loading > the .funcs file, though I have the .funcs file in the same directory where > the .bin file is located. As stated by the documentation, you have to give the full path to the MIB-file. You can put your MIB-files anywhere you like. As I wrote in my previous mail, db_dir is just a place for the snmp application to store internal data. > > Please help if you see any problem I do. > > Thanks, > - Eranga > /BMK > > > -----Original Message----- > From: Micael Karlberg [mailto:bmk@REDACTED] > Sent: Thursday, April 27, 2006 2:07 PM > To: Eranga Udesh > Cc: erlang-questions@REDACTED > Subject: Re: SNMP Association file directory > > Hi, > > Eranga Udesh wrote: >> Hi, >> >> >> >> In a release where should the Association file located? > > Association file? Do you mean the .funcs files? > >> I installed in >> the directory which I specified as the db_dir in the SNMP config file, > > db_dir is just a place for the snmp application to store internal data. > It does not care what else you put into that directory, as long as you > don't mess with the files created by the snmp application. But in > principle, I would leave that directory to the snmp application (and not > put my own stuff into it). > >> but it doesn't seem to be loading that file. The compiled MIB files >> (.bin) are also located in that directory. Also I had to give the full >> path to the .bin file (it didn't get it from the db_dir parameter place). >> > > Most of this stuff is described in the documentation. > >> >> >> What could be wrong? >> >> >> >> Thanks, >> >> - Eranga >> > > /BMK > > > From kg9020@REDACTED Thu Apr 27 15:33:32 2006 From: kg9020@REDACTED (a) Date: Thu, 27 Apr 2006 08:33:32 -0500 Subject: test Message-ID: test post art From kenneth.lundin@REDACTED Thu Apr 27 17:46:13 2006 From: kenneth.lundin@REDACTED (Kenneth Lundin (AS/EAB)) Date: Thu, 27 Apr 2006 17:46:13 +0200 Subject: erlang at www.ericsson.com Message-ID: <4AFFBE68BCD2C04EB6EEA03FBC9CF4BE014EEF10@esealmw115.eemea.ericsson.se> The xerl "IDE" for Erlang has been withdrawn from the distribution since a long time ago (around 1997-1998). Note that the article http://www.ericsson.com/ericsson/corpinfo/publications/review/1997_01/fi les/1997012.pdf was written when the OTP (Open Telecom Platform) part of Erlang/OTP was something completely new at Ericsson. Ericsson Review is a publication where Ericsson present new concepts and solutions to the public. /Kenneth -------------- next part -------------- An HTML attachment was scrubbed... URL: From kg9020@REDACTED Thu Apr 27 19:21:51 2006 From: kg9020@REDACTED (k vin) Date: Thu, 27 Apr 2006 12:21:51 -0500 Subject: test post Message-ID: <96fd17a20604271021r19ea5643nbed4c6b7780b6c6d@mail.gmail.com> test post art -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Thu Apr 27 22:14:19 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 27 Apr 2006 22:14:19 +0200 Subject: yaws 1.61 Message-ID: <4451261B.4040108@hyber.org> We have a new release. 1.61 relnotes and code as usual at http://yaws.hyber.org Enjoy, /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From surindar.shanthi@REDACTED Fri Apr 28 06:08:39 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 28 Apr 2006 09:38:39 +0530 Subject: SV: Killing Supervisor In-Reply-To: <20060426143107.GA2265@nodo2.lambdastream.com> References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> <444F575E.6090304@hq.idt.net> <444F5B44.5010605@hq.idt.net> <20060426143107.GA2265@nodo2.lambdastream.com> Message-ID: <42ea5fb60604272108v50ce5cbau24d0755ec182322@mail.gmail.com> Hi, I thank Serge, Lennart and Samuel for the reply to my doubt. But still I haven't get the clear idea of stopping the entire supervision tree. Kindly do my favour. Best Regards, S.Surindar On 4/26/06, Samuel Rivas wrote: > > Lennart ?hman wrote: > > If you simply do exit(Pid,kill) on the supervisor, it will not > > be given the chance of terminating its children in an ordered > > way. > > Calling exit(SupervisorPid, shutdown) in the supervisor's parent > process would do the trick. > > Regards > -- > Samuel > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuel@REDACTED Fri Apr 28 08:56:18 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 28 Apr 2006 08:56:18 +0200 Subject: SV: Killing Supervisor In-Reply-To: <42ea5fb60604272108v50ce5cbau24d0755ec182322@mail.gmail.com> References: <42ea5fb60604252125m37013e84q87f30b1de2556993@mail.gmail.com> <444F575E.6090304@hq.idt.net> <444F5B44.5010605@hq.idt.net> <20060426143107.GA2265@nodo2.lambdastream.com> <42ea5fb60604272108v50ce5cbau24d0755ec182322@mail.gmail.com> Message-ID: <20060428065618.GA29140@nodo2.lambdastream.com> Surindar Sivanesan wrote: > Hi, > I thank Serge, Lennart and Samuel for the reply to my doubt. > But still I haven't get the clear idea of stopping the entire supervision > tree. Kindly do my favour. > > On 4/26/06, Samuel Rivas wrote: > > Lennart ?hman wrote: > > If you simply do exit(Pid,kill) on the supervisor, it will not > > be given the chance of terminating its children in an ordered > > way. > > Calling exit(SupervisorPid, shutdown) in the supervisor's parent > process would do the trick. Take a look to Erlang Design Principles, specially to: http://erlang.se/doc/doc-5.4.13/doc/design_principles/sup_princ.html#5.10 OTP behaviours define a standard shutdown process. The clean way to shutdown a supervisor is, as Lennart said, to make it child of another supervisor and use supervisor API to stop it. Obviously, you need a top supervisor. You can shutdown the top supervisor if you start it as part of an OTP application. What happens with the two workarounds proposed is: - exit(Pid, kill) sends Pid an exit signal that cannot be trapped, so the supervisor dies instantaneously and the exit signal propagates to its children since they are linked. Children die in an unspecified order. - exit(Pid, shutdown) makes what a parent supervisor would do to terminate the supervisor. That way, the supervisor receives the signal, stops its children cleanly and terminates itself. Regards -- Samuel From fred@REDACTED Thu Apr 27 18:48:40 2006 From: fred@REDACTED (=?ISO-8859-1?Q?Lars-=C5ke_Fredlund?=) Date: Thu, 27 Apr 2006 18:48:40 +0200 Subject: who teaches erlang? In-Reply-To: References: Message-ID: <4450F5E8.4020508@babel.ls.fi.upm.es> Ulf Wiger (AL/EAB) wrote: > Poll: > Raise your hand, anyone who knows of a > university that teaches Erlang. > > Here at the Facultad de Inform?tica of Universidad Polit?cnica de Madrid I recently gave a couple lectures on Erlang in a PhD course on "Software based on components", as an example solution for developing distributed systems. Also there is at least one student doing a Master thesis project related with Erlang. /Lars-?ke Fredlund From karol.skocik@REDACTED Fri Apr 28 10:20:45 2006 From: karol.skocik@REDACTED (karol skocik) Date: Fri, 28 Apr 2006 10:20:45 +0200 Subject: XMERL - why fatal errors? Message-ID: Hi all, I am working with XMERL and I am curious why XMERL reacs so "brutally" when it failes to validate file agains some DTD. If I don't wrap xmerl_scan:parse_string in catch, it kills my server recieving for XML server. Parsing of a simple but wrong file results in : 3229- fatal: {error,{error_missing_element_declaration_in_DTD, 'add-group-cacaca'}} !!!!! {'EXIT',{fatal,{{error,{error_missing_element_declaration_in_DTD, 'add-group-cacaca'}}, {file,file_name_unknown}, {line,4}, {col,6}}}} Why? Why not simple as {error, validation_failed} or something? Is there any way to prevent XMERL fail to fatal panic when validation fails or should I cope with it myself? Karol From thomasl_erlang@REDACTED Fri Apr 28 10:32:30 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 28 Apr 2006 01:32:30 -0700 (PDT) Subject: erlang at www.ericsson.com In-Reply-To: Message-ID: <20060428083230.93511.qmail@web38811.mail.mud.yahoo.com> --- "Ulf Wiger (AL/EAB)" wrote: > > For those of you who want a link to some official > Ericsson web site that > mentions Erlang, there is one now, three clicks away > from the main page: > > http://www.ericsson.com/technology/open_source/ Unless I missed it, do add convenient links to erlang.org and "download latest". Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From eranga@REDACTED Fri Apr 28 10:00:09 2006 From: eranga@REDACTED (Eranga Udesh) Date: Fri, 28 Apr 2006 14:00:09 +0600 Subject: SNMP Association file directory In-Reply-To: <4450BC15.8070307@erix.ericsson.se> Message-ID: <20060428082505.6B35419DC0A5@mail.wavenet.lk> Hi, I have made the mistake and thought the .funcs files are loaded in run-time. But after your advice, I moved the .funcs files to the directory where the MIBs files are located, compiled the MIBs and loaded to BIN (compiled MIB) files to the SNMP agent (giving the full path) and now it's working perfectly. Thank you very much for your advice. Regards, - Eranga -----Original Message----- From: Micael Karlberg [mailto:bmk@REDACTED] Sent: Thursday, April 27, 2006 6:42 PM To: Eranga Udesh Cc: erlang-questions@REDACTED Subject: Re: SNMP Association file directory Hi, Eranga Udesh wrote: > Hi, > > Thanks for the reply. > > Yes, I am talking about the .funcs files. Where should I place them in a > release? As per my knowledge the SNMP application (in my case SNMP Agent) > loads those files when loading the MIBs (compiled), correct? So, how can I > give the corresponding .funcs file for a certain MIB when loading? > The data of the funcs-file (an MFA) is compiled into the MIB, so you only have to make sure that your node has the path to the module implementing the functions referenced in the funcs-file. > In my .config file for the release I have below entries. > > {snmp, > [{agent, > [ > ...., > {db_dir, "/usr2/omni_oam/system/lib/omni_oam-2.0/priv/snmp/agent/db"}, > ...., > {config, [{dir, > "/usr2/omni_oam/system/lib/omni_oam-2.0/priv/snmp/agent/conf"},{force_load, > true},{verbosity, silence}]}, > ....}]}]}, > > I have placed the compiled MIB files (.bin) in the directory specified by > db_dir parameter, but when I try to do snmpa:load_mibs/2 with just the name > of the MIB file, it doesn't work (error - noent). But if I give the full > path to the MIB file, it loads the file. But still I don't see it loading > the .funcs file, though I have the .funcs file in the same directory where > the .bin file is located. As stated by the documentation, you have to give the full path to the MIB-file. You can put your MIB-files anywhere you like. As I wrote in my previous mail, db_dir is just a place for the snmp application to store internal data. > > Please help if you see any problem I do. > > Thanks, > - Eranga > /BMK > > > -----Original Message----- > From: Micael Karlberg [mailto:bmk@REDACTED] > Sent: Thursday, April 27, 2006 2:07 PM > To: Eranga Udesh > Cc: erlang-questions@REDACTED > Subject: Re: SNMP Association file directory > > Hi, > > Eranga Udesh wrote: >> Hi, >> >> >> >> In a release where should the Association file located? > > Association file? Do you mean the .funcs files? > >> I installed in >> the directory which I specified as the db_dir in the SNMP config file, > > db_dir is just a place for the snmp application to store internal data. > It does not care what else you put into that directory, as long as you > don't mess with the files created by the snmp application. But in > principle, I would leave that directory to the snmp application (and not > put my own stuff into it). > >> but it doesn't seem to be loading that file. The compiled MIB files >> (.bin) are also located in that directory. Also I had to give the full >> path to the .bin file (it didn't get it from the db_dir parameter place). >> > > Most of this stuff is described in the documentation. > >> >> >> What could be wrong? >> >> >> >> Thanks, >> >> - Eranga >> > > /BMK > > > From bertil.karlsson@REDACTED Fri Apr 28 13:29:22 2006 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Fri, 28 Apr 2006 13:29:22 +0200 Subject: XMERL - why fatal errors? In-Reply-To: References: Message-ID: <4451FC92.8060408@ericsson.com> Hi, The present version of xmerl does not distinguish between fatal errors and validation errors . This is also commented in the User's Guide of xmerl. Another error strategy is under development, but not entirely finished. With that strategy it will continue parsing even though a minor error is encountered and return a parse/validation error as a tuple {error, Reason(s)} /Bertil karol skocik wrote: > Hi all, > I am working with XMERL and I am curious why XMERL reacs so > "brutally" when it failes to validate file agains some DTD. If I don't > wrap xmerl_scan:parse_string in catch, it kills my server recieving > for XML server. Parsing of a simple but wrong file results in : > > 3229- fatal: {error,{error_missing_element_declaration_in_DTD, > 'add-group-cacaca'}} > !!!!! {'EXIT',{fatal,{{error,{error_missing_element_declaration_in_DTD, > 'add-group-cacaca'}}, > {file,file_name_unknown}, > {line,4}, > {col,6}}}} > > Why? Why not simple as {error, validation_failed} or something? > > Is there any way to prevent XMERL fail to fatal panic when validation > fails or should I cope with it myself? > > Karol From ulf.wiger@REDACTED Fri Apr 28 13:31:00 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 28 Apr 2006 13:31:00 +0200 Subject: SV: Killing Supervisor Message-ID: Samuel Rivas wrote: > > - exit(Pid, kill) sends Pid an exit signal that cannot be > trapped, so the supervisor dies instantaneously and the exit > signal propagates to its children since they are linked. > Children die in an unspecified order. Just to be clear: {'EXIT', Pid, kill} messages are converted to {'EXIT', Pid, killed} when they propagate to linked processes. It is only the original kill that is untrappable. Supervisors and OTP behaviours always terminate if the parent terminates (unless the link is removed for some reason.) If reason is anything other than normal or shutdown, a crash report is generated. Note also that the behaviours know which process is the parent, so they are not so easily fooled. That's one reason why the first exit might need to be exit(Top, kill) in some cases. /Ulf W From ulf.wiger@REDACTED Fri Apr 28 13:31:24 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 28 Apr 2006 13:31:24 +0200 Subject: who teaches erlang? Message-ID: Good news, and thank you for the info. /U > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Lars-?ke Fredlund > Sent: den 27 april 2006 18:49 > To: erlang-questions@REDACTED > Subject: Re: who teaches erlang? > > Ulf Wiger (AL/EAB) wrote: > > Poll: > > Raise your hand, anyone who knows of a university that > teaches Erlang. > > > > > Here at the Facultad de Inform?tica of Universidad > Polit?cnica de Madrid I recently gave a couple lectures on > Erlang in a PhD course on "Software based on components", as > an example solution for developing distributed systems. Also > there is at least one student doing a Master thesis project > related with Erlang. > > /Lars-?ke Fredlund > From ulf.wiger@REDACTED Fri Apr 28 13:34:34 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 28 Apr 2006 13:34:34 +0200 Subject: erlang at www.ericsson.com Message-ID: Thomas Lindgren wrote: > > > http://www.ericsson.com/technology/open_source/ > > Unless I missed it, do add convenient links to erlang.org and > "download latest". The link to erlang.org is there (you missed it), under "Related links" to the right. /U From samuel@REDACTED Fri Apr 28 13:48:55 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 28 Apr 2006 13:48:55 +0200 Subject: SV: Killing Supervisor In-Reply-To: References: Message-ID: <20060428114855.GA796@nodo2.lambdastream.com> Ulf Wiger (AL/EAB) wrote: > Note also that the behaviours know which process is the parent, > so they are not so easily fooled. That's one reason why the > first exit might need to be exit(Top, kill) in some cases. Can they be fooled in any way? Parent pid is kept in gen_server main loop ... (Just curious) My proposal was not to fool the supervisor but to be the actual supervisor parent. Regards -- Samuel From thomasl_erlang@REDACTED Fri Apr 28 14:47:51 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 28 Apr 2006 05:47:51 -0700 (PDT) Subject: erlang at www.ericsson.com In-Reply-To: Message-ID: <20060428124751.14908.qmail@web38802.mail.mud.yahoo.com> --- "Ulf Wiger (AL/EAB)" wrote: > The link to erlang.org is there (you missed it), > under "Related > links" to the right. Indeed I did. It sort of melded with the other articles; looking at it once more, I nearly missed it again :-) Sorry about the false alarm. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ulf.wiger@REDACTED Fri Apr 28 14:57:44 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 28 Apr 2006 14:57:44 +0200 Subject: SV: Killing Supervisor Message-ID: Samuel Rivas wrote: > > Ulf Wiger (AL/EAB) wrote: > > Note also that the behaviours know which process is the parent, so > > they are not so easily fooled. That's one reason why the first exit > > might need to be exit(Top, kill) in some cases. > > Can they be fooled in any way? Parent pid is kept in > gen_server main loop ... (Just curious) Well, sure: 3> {dictionary, Dict} = process_info(whereis(sasl_sup), dictionary). {dictionary,[{'$ancestors',[<0.30.0>]}, {'$initial_call',{gen,init_it, [gen_server, <0.30.0>, <0.30.0>, {local,sasl_sup}, supervisor, {{local,sasl_sup},sasl,[]}, []]}}]} 4> [[SaslParent|_]] = [A || {'$ancestors',A} <- Dict]. [[<0.30.0>]] 5> sasl_sup ! {'EXIT', SaslParent, shutdown}. {'EXIT',<0.30.0>,shutdown} 6> =INFO REPORT==== 28-Apr-2006::14:56:53 === application: sasl exited: shutdown type: permanent {"Kernel pid terminated",application_controller,"{application_terminated,sasl,shutdow n}"} Crash dump was written to: erl_crash.dump Kernel pid terminated (application_controller) ({application_terminated,sasl,shutdown}) /Ulf W From samuel@REDACTED Fri Apr 28 15:05:59 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 28 Apr 2006 15:05:59 +0200 Subject: SV: Killing Supervisor In-Reply-To: References: Message-ID: <20060428130559.GA1996@nodo2.lambdastream.com> Ulf Wiger (AL/EAB) wrote: > > > Samuel Rivas wrote: > > > > Ulf Wiger (AL/EAB) wrote: > > > Note also that the behaviours know which process is the parent, so > > > they are not so easily fooled. That's one reason why the first exit > > > might need to be exit(Top, kill) in some cases. > > > > Can they be fooled in any way? Parent pid is kept in > > gen_server main loop ... (Just curious) > > Well, sure: > 3> {dictionary, Dict} = process_info(whereis(sasl_sup), dictionary). > [... snipped ...] Wicked! :) -- Samuel From Hans.Bolinder@REDACTED Fri Apr 28 16:16:34 2006 From: Hans.Bolinder@REDACTED (Hans.Bolinder@REDACTED) Date: Fri, 28 Apr 2006 16:16:34 +0200 Subject: keysort + removing duplicate keys In-Reply-To: References: Message-ID: <17490.9154.734039.490118@gargle.gargle.HOWL> [Ulf Wiger:] > At least I found this slightly surprising: > > 2> lists:ukeysort(1,[{1,a},{1,b}]). > [{1,a},{1,b}] > 3> lists:ukeysort(1,[{1,a},{1,a}]). > [{1,a}] > > The man page says that lists:ukeysort/2 removes > consecutive duplicates. I just assumed that it meant > _duplicate keys_, but apparently not. Thanks for pointing it out. We have decided to make an incompatible change of the functionality, in the hope that it will be more useful. Starting with R11B, ukeysort will remove duplicates by comparing the keys only. The file_sorter module will be changed in a similar way (this makes it behave more like Unix sort(1)). For the sake of consistency, lists:usort/2 will be modified too: all but the first of the elements comparing equal will be removed. Best regards, Hans Bolinder, Erlang/OTP From kg9020@REDACTED Fri Apr 28 18:41:01 2006 From: kg9020@REDACTED (a) Date: Fri, 28 Apr 2006 11:41:01 -0500 Subject: erlang packet sniffer scanner Message-ID: New I would like to use erlang in a school assignment writing a packet sniffer I am new to this langauge but what I have read it appears to scale better than java threads ... and with the ip support it appears to take less code than java.... Any direction or guidance would be welcomed thanks Art From paris@REDACTED Fri Apr 28 19:09:54 2006 From: paris@REDACTED (Javier =?iso-8859-1?q?Par=EDs_Fern=E1ndez?=) Date: Fri, 28 Apr 2006 19:09:54 +0200 Subject: erlang packet sniffer scanner In-Reply-To: References: Message-ID: <200604281909.55136.paris@dc.fi.udc.es> El Viernes, 28 de Abril de 2006 18:41, a escribi?: > New > > I would like to use erlang in a school assignment writing a packet > sniffer I am new to this langauge > but what I have read it appears to scale better than java > threads ... and with the ip support it appears > to take less code than java.... Any direction or guidance would be > welcomed Mmm, writing a packet sniffer has two challenges: - Capturing all the packets: Ok, you cannot really use only Erlang for this. You will have to write a C Port that either uses a raw socket (this is in linux), or for better portability, uses the libpcap library (I don't know if your school will consider this cheating). To be fair, I don't think this can be done natively in Java either. - Analyzing the packets you are receiving. For this Erlang bit syntax will make your life easy. This part will probably be much easier in Erlang than in Java. However, I don't understand why you want a large number of threads for this. I think that one thread doing the capture work and another one making the analysis should be enough... (Maybe I'm wrong on this) Regards. Javier. From rprice@REDACTED Fri Apr 28 19:52:58 2006 From: rprice@REDACTED (Roger Price) Date: Fri, 28 Apr 2006 19:52:58 +0200 (CEST) Subject: erlang packet sniffer scanner In-Reply-To: References: Message-ID: On Fri, 28 Apr 2006, a wrote: > I would like to use erlang in a school assignment writing a packet sniffer Hello Art, Watch out for legal liabilities if you start testing such a program. Even professional sysadmins with a real need to debug networks have gotten into trouble for sniffing without authorisation. Make sure you have written approval from your school, and that the school understands what a sniffer is. Good luck with your project! Roger From luke@REDACTED Fri Apr 28 23:51:48 2006 From: luke@REDACTED (Luke Gorrie) Date: Fri, 28 Apr 2006 23:51:48 +0200 Subject: erlang packet sniffer scanner References: <200604281909.55136.paris@dc.fi.udc.es> Message-ID: Javier Par?s Fern?ndez writes: > - Capturing all the packets: Ok, you cannot really use only Erlang for this. > You will have to write a C Port that either uses a raw socket (this is in > linux), or for better portability, uses the libpcap library (I don't know if > your school will consider this cheating). To be fair, I don't think this can > be done natively in Java either. NB: psocket program in the sourceforge project Jungerl supports PF_PACKET sockets on Linux. These are for sniffing network interfaces. From joelr1@REDACTED Sat Apr 29 00:38:37 2006 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 28 Apr 2006 23:38:37 +0100 Subject: Behavior undefined warning Message-ID: <94570F84-F1D4-475F-BE5A-4D9B8A0C6497@gmail.com> Folks, How do I fix this warning? src/xmpp_echo_behaviour.erl:9: Warning: behaviour gen_xmpp_client undefined The code looks like this -module(xmpp_echo_behaviour). -behaviour(gen_xmpp_client). and I definitely have gen_xmpp_client.beam Thanks, Joel -- http://wagerlabs.com/ From sean.hinde@REDACTED Sat Apr 29 01:10:23 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Sat, 29 Apr 2006 00:10:23 +0100 Subject: Behavior undefined warning In-Reply-To: <94570F84-F1D4-475F-BE5A-4D9B8A0C6497@gmail.com> References: <94570F84-F1D4-475F-BE5A-4D9B8A0C6497@gmail.com> Message-ID: <97E835AD-24DC-4825-BA00-1B2888073322@gmail.com> http://www.erlang.org/doc/doc-5.4.13/doc/design_principles/ spec_proc.html#6.3 Sean On 28 Apr 2006, at 23:38, Joel Reymont wrote: > Folks, > > How do I fix this warning? > > src/xmpp_echo_behaviour.erl:9: Warning: behaviour gen_xmpp_client > undefined > > The code looks like this > > -module(xmpp_echo_behaviour). > -behaviour(gen_xmpp_client). > > and I definitely have gen_xmpp_client.beam > > Thanks, Joel > > -- > http://wagerlabs.com/ > > > > > From joelr1@REDACTED Sat Apr 29 01:21:28 2006 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 29 Apr 2006 00:21:28 +0100 Subject: Behavior undefined warning In-Reply-To: <97E835AD-24DC-4825-BA00-1B2888073322@gmail.com> References: <94570F84-F1D4-475F-BE5A-4D9B8A0C6497@gmail.com> <97E835AD-24DC-4825-BA00-1B2888073322@gmail.com> Message-ID: On Apr 29, 2006, at 12:10 AM, Sean Hinde wrote: > http://www.erlang.org/doc/doc-5.4.13/doc/design_principles/ > spec_proc.html#6.3 Something does not add up since I (Mickael actually) have the requisite functions exported but still get the warning. -module(gen_xmpp_client). -export([behaviour_info/1]). -export([start/3, start_link/3]). -include("xmpp.hrl"). %% defining expected callbacks in the behaviour code behaviour_info(callbacks) -> [{init, 2}, {presence, 5}, {message, 7}, {iq, 7}]; behaviour_info(_Other) -> undefined. ------ -module(xmpp_echo_behaviour). -behaviour(gen_xmpp_client). %% XMPP configuration attributes -host("localhost"). %% -port(5222). -username("echo"). -authentication({password,"echo"}). -resource("Erlang echo behaviour"). %% Optional: -include("xmpp.hrl"). %% Behaviour callbacks -export([init/2, presence/5, message/7, iq/7]). -export([start/0]). -- http://wagerlabs.com/ From joelr1@REDACTED Sat Apr 29 01:27:23 2006 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 29 Apr 2006 00:27:23 +0100 Subject: Erlang NLP Message-ID: <033E814B-E715-4EEB-86B9-A15E827CC68A@gmail.com> Are there any examples of using Erlang for natural language processing? I have a copy of Paradigms of Artificial Intelligence and know Lisp so I'll probably just have to translate the Eliza code. Still, I thought I would ask. Thanks, Joel -- http://wagerlabs.com/ From ulf@REDACTED Sat Apr 29 13:33:55 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 29 Apr 2006 13:33:55 +0200 Subject: Behavior undefined warning In-Reply-To: <94570F84-F1D4-475F-BE5A-4D9B8A0C6497@gmail.com> References: <94570F84-F1D4-475F-BE5A-4D9B8A0C6497@gmail.com> Message-ID: Den 2006-04-29 00:38:37 skrev Joel Reymont : > Folks, > > How do I fix this warning? > > src/xmpp_echo_behaviour.erl:9: Warning: behaviour gen_xmpp_client > undefined > > The code looks like this > > -module(xmpp_echo_behaviour). > -behaviour(gen_xmpp_client). > > and I definitely have gen_xmpp_client.beam > > Thanks, Joel The linter must be able to call the function gen_xmpp_client:behaviour_info(callbacks) during compile-time. Usually, the problem is that one forgets to add a -pa (or -pz) flag to erlc. /Ulf W -- Ulf Wiger From rprice@REDACTED Sat Apr 29 16:20:43 2006 From: rprice@REDACTED (Roger Price) Date: Sat, 29 Apr 2006 16:20:43 +0200 (CEST) Subject: [1,[2|3]] vs [1,2|3] Message-ID: Dear List, The Erlang (BEAM) emulator version 5.4.9 [source] [hipe] with Eshell V5.4.9 reports: 1> [1,[2|3]] . %% Valid list [1,[2|3]] 2> [1,2|3] . %% Not a list [1,2|3] My understanding is that [1,[2|3]] = 1::[2|3]::nil = 1::(2::3)::nil and [1,2|3] = 1::2::3 using the ML infix notation. Is this correct? Thanks, Roger From samuel@REDACTED Sat Apr 29 17:32:08 2006 From: samuel@REDACTED (Samuel Rivas) Date: Sat, 29 Apr 2006 17:32:08 +0200 Subject: [1,[2|3]] vs [1,2|3] In-Reply-To: References: Message-ID: <20060429153208.GA18800@nodo2.lambdastream.com> Roger Price wrote: > Dear List, > > The Erlang (BEAM) emulator version 5.4.9 [source] [hipe] with > Eshell V5.4.9 reports: > > 1> [1,[2|3]] . %% Valid list > [1,[2|3]] > 2> [1,2|3] . %% Not a list > [1,2|3] > > My understanding is that [1,[2|3]] = 1::[2|3]::nil = 1::(2::3)::nil > and [1,2|3] = 1::2::3 > using the ML infix notation. > > Is this correct? [A,B|C] is a shorthand for [A|[B|C]] so [1,2|3] = [1|[2|3]] which is exactly 1::2::3 in ML. Both examples contain non proper lists though: you are using something that is not a list (3) as tail in the cons operator 1> [1,[2|[3]]]. [1,[2,3]] 2> [1,2|[3]]. [1,2,3] Regards -- Samuel From garris@REDACTED Sun Apr 30 02:59:21 2006 From: garris@REDACTED (Erik Garrison) Date: Sat, 29 Apr 2006 20:59:21 -0400 (EDT) Subject: loading a table from file doesn't work unless inside erl shell In-Reply-To: <20060429153208.GA18800@nodo2.lambdastream.com> References: <20060429153208.GA18800@nodo2.lambdastream.com> Message-ID: I've been attempting to use ets:file2tab and ets:tab2file to save/load configuration options into a simulation environment I've created. I can load a saved table from a file in the interactive shell, but I am unable to do so in any program started from the command line using "erl -run Mod Func". I would like to be able to use a bash script to string together a series of successive program runs, but unless I can load a table from a file this will be impossible. What am I missing? -Erik Garrison From ayrnieu@REDACTED Sun Apr 30 08:04:12 2006 From: ayrnieu@REDACTED (Julian Fondren) Date: Sun, 30 Apr 2006 01:04:12 -0500 Subject: strange httpd Message-ID: I have this in my httpd access logs: 58.218.149.30 - - [27/Apr/2006:07:49:12 -0500] "GET http://www.qq.com/ HTTP/1.1" 200 [54,52,56] 220.134.13.167 - - [28/Apr/2006:06:05:05 -0500] "GET http://www.ebay.com/ HTTP/1.1" 200 [54,52,56] 217.160.249.106 - - [29/Apr/2006:07:41:29 -0500] "GET http://66.29.102.2/~antigoth/printenv.php HTTP/1.1" 404 0 219.132.23.120 - - [29/Apr/2006:09:17:22 -0500] "GET http://verify.qq.com/getimage?0.5770163684465186 HTTP/1.1" 404 0 ... in which it seems that someone is randomly trying to use my server as a proxy. I wouldn't be disturbed, except that the first two requests seem to have /succeeded/ -- and neither I nor the httpd documentation know what [54,52,56] mean as 'lengths'. Can someone explain what happened? Thanks. From matthias@REDACTED Sun Apr 30 10:01:57 2006 From: matthias@REDACTED (Matthias Lang) Date: Sun, 30 Apr 2006 10:01:57 +0200 Subject: loading a table from file doesn't work unless inside erl shell In-Reply-To: References: <20060429153208.GA18800@nodo2.lambdastream.com> Message-ID: <17492.28405.413126.935219@antilipe.corelatus.se> If you'd posted a cut-down-but-still-working example of the problem as well as some output showing what happens when you try and run it, then it'd be a bit easier to see where you're getting stuck. As plan B, looking at the alignment of Beta-centauri and using a combination of modular theory and a Hebbian model of the brain, my wild guess is that you're trying to pass arguments to your start function and you're making incorrect assumptions about the format of those arguments. Can you run 'hello world' from bash? If you can do that, then you can do anything, i.e. there's nothing special about ets. Here's an example: Here's hello world: -module(hw). -export([go/1]). go(X) -> io:fwrite("Hello world. My arguments are ~p\n", [X]). After compiling this, you can run it from the command line: tmp >erl -noshell -s hw go five boxing wizards -s init stop Hello world. My arguments are [five,boxing,wizards] Matthias ---------------------------------------------------------------------- Erik Garrison writes: > I've been attempting to use ets:file2tab and ets:tab2file to save/load > configuration options into a simulation environment I've created. > > I can load a saved table from a file in the interactive shell, but I am > unable to do so in any program started from the command line using "erl > -run Mod Func". I would like to be able to use a bash script to string > together a series of successive program runs, but unless I can load a > table from a file this will be impossible. > > What am I missing? > > -Erik Garrison From ayrnieu@REDACTED Sun Apr 30 10:29:39 2006 From: ayrnieu@REDACTED (Julian Fondren) Date: Sun, 30 Apr 2006 03:29:39 -0500 Subject: strange httpd In-Reply-To: References: Message-ID: On 4/30/06, Julian Fondren wrote: > I have this in my httpd access logs: > I wouldn't be disturbed, except that the first two > requests seem to have /succeeded/ ah, nevermind. Those succeeded because, stripped of the protocol and hostname, they were just requests for "/". Sorry for not first ktrace'ing w3m to remember enough of the protocol to ask the server myself :-/ From klacke@REDACTED Sun Apr 30 11:17:59 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Sun, 30 Apr 2006 11:17:59 +0200 Subject: loading a table from file doesn't work unless inside erl shell In-Reply-To: <17492.28405.413126.935219@antilipe.corelatus.se> References: <20060429153208.GA18800@nodo2.lambdastream.com> <17492.28405.413126.935219@antilipe.corelatus.se> Message-ID: <445480C7.3020806@hyber.org> Matthias Lang wrote: > Can you run 'hello world' from bash? If you can do that, then you can > do anything, i.e. there's nothing special about ets. Here's an > example: > > Here's hello world: > > -module(hw). > -export([go/1]). > > go(X) -> > io:fwrite("Hello world. My arguments are ~p\n", [X]). Except that the process owning the ets table must continue to live. When an ets-owning process dies, all ets tables created by the process dies. Thus: go(File) -> spawn(fun() -> ets:file2tab(File), timer:sleep(infinity) end). /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From mickael.remond@REDACTED Sun Apr 30 20:41:40 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Sun, 30 Apr 2006 20:41:40 +0200 Subject: erts_alloc and carriers Message-ID: <20060430184140.GD6844@memphis.process-one.net> Hello, I have been recently doing some tuning based on the erts_alloc parameters. I was wondering if there were parameters or strategies to facilitate the consolidation of the memory used in less carriersi (to reduce the number of carriers used), when far less memory is needed. Thank you in advance for tips or advices. -- Micka?l R?mond From garris@REDACTED Sun Apr 30 23:04:06 2006 From: garris@REDACTED (Erik Garrison) Date: Sun, 30 Apr 2006 17:04:06 -0400 (EDT) Subject: loading a table from file doesn't work unless inside erl shell In-Reply-To: <445480C7.3020806@hyber.org> References: <20060429153208.GA18800@nodo2.lambdastream.com> <17492.28405.413126.935219@antilipe.corelatus.se> <445480C7.3020806@hyber.org> Message-ID: > Matthias Lang wrote: > > > Can you run 'hello world' from bash? If you can do that, then you can > > do anything, i.e. there's nothing special about ets. Here's an > > example: > > > > Here's hello world: > > > > -module(hw). > > -export([go/1]). > > > > go(X) -> > > io:fwrite("Hello world. My arguments are ~p\n", [X]). This wasn't my problem, but the effort and psychological divination are greatly appreciated! I'll be more clear in the future. (Good to know that things are *fully* generalized in terms of what you can do from bash.) On Sun, 30 Apr 2006, Claes Wikstrom wrote: > > Except that the process owning the ets table must > continue to live. When an ets-owning process dies, all ets > tables created by the process dies. > > Thus: > > go(File) -> > spawn(fun() -> > ets:file2tab(File), > timer:sleep(infinity) > end). > This is exactly the problem. When I run the program from the Erlang shell, I run an initializing function which starts up the simulation, loads the ets table state from file, etc. This function then ends. In this case, the owning process is the shell itself, so everything is groovy. However, when I run it from the bash shell, I get an immediate error because the startup process dies. Subsequent trials agree. -Erik From casper2000a@REDACTED Thu Apr 13 19:23:28 2006 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Fri, 5 May 2006 07:23:28 +051800 Subject: ASNI IS-41 protocol stack Message-ID: <1146794008.445ab018df96c@www.omnibis.com> Hi, Is there anybody out there with an ANSI and ITU CAMEL SS7 protocol stack (ASN1.?), ready to compile in Erlang? I am looking for ANSI IS-41/TCAP and CAMEL layers. If anybody willing to discuss the commercial terms, pls drop me an email off the list. Thanks, - Eranga --------------This mail sent through OmniBIS.com-------------- From casper2000a@REDACTED Thu Apr 13 19:27:43 2006 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Fri, 5 May 2006 07:27:43 +051800 Subject: ANSI IS-41 protocol stack Message-ID: <1146794263.445ab117cffe4@www.omnibis.com> Hi, Is there anybody with an ANSI and CAMEL ss7 protocol stack, ready to compile in Erlang? I am looking for ANSI TCAP/IS-41 and ITU-T CAMEL layers. Even somebody who can do the development of such stack is also welcome. Anybody interested to discuss commercial terms, please drop me an email off the list. Thanks, - Eranga --------------This mail sent through OmniBIS.com--------------