From saleyn@REDACTED Thu Nov 1 04:45:02 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 31 Oct 2007 22:45:02 -0500 Subject: [erlang-questions] port_close/1 problem In-Reply-To: <200710311638.l9VGcNUl022987@pluto.hedeland.org> References: <200710311638.l9VGcNUl022987@pluto.hedeland.org> Message-ID: <47294BBE.1070809@gmail.com> Thanks Per, this is quite clever! Serge Per Hedeland wrote: > 1> Exe = "sleep 1000". > "sleep 1000" > 2> Wrapper = "echo $$ | awk '{printf \"%c%c%s\",0,length($1),$1}' >&4; exec ". > "echo $$ | awk '{printf \"%c%c%s\",0,length($1),$1}' >&4; exec " > 3> Settings = [binary, {packet, 2}, nouse_stdio, exit_status]. > [binary,{packet,2},nouse_stdio,exit_status] > 4> Port = open_port({spawn, Wrapper ++ Exe}, Settings). > #Port<0.95> > 5> Pid = receive {Port, {data, P}} -> binary_to_list(P) end. > "97122" > 6> os:cmd("kill " ++ Pid). > [] > 7> Status = receive {Port, {exit_status, S}} -> S end. > 143 > 8> > > --Per > From jay@REDACTED Thu Nov 1 07:01:56 2007 From: jay@REDACTED (Jay Nelson) Date: Wed, 31 Oct 2007 23:01:56 -0700 Subject: [erlang-questions] how: logging messages to another node Message-ID: I am working on a scenario with diskless nodes talking to a back end node with a disk. I want to forward error_logger messages to the backend node. Here is the chain of events: 1) Start the diskless node a) installs an event_handler to capture error_logger messages b) messages are queued up until the backend node connects 2) Start the backend node 3) Detect node up and forward messages to backend I could put a server on the backend node and forward messages to it, but it seemed that there should be a way to leverage the existing error_logger. My first attempts were trying to get the process id of the error_logger on another node, but there was no way to do this that I could find. I could monitor that process using {error_logger, Node} but I couldn't figure out a way to remotely obtain the process_id. Is there a way? I have a working version now, which feels a bit of a hack to me which works as follows: Backend machine: - global:register_name(logger, whereis(error_logger)). Diskless machine: - Pid = global:whereis_name(logger), - group_leader(Pid, self()), - error_logger:error_report(Msg) Voila, the message appears on the backend node. I don't like the idea of using the group_leader / error_logger approach or the magic 'logger' global name. It seems there should be an easier way to reach out to the remote error_logger process, especially since I can monitor it using the {RegName, Node}, but I can't find any other functions for discovering the process_id. Any suggestions for an alternate approach? jay From per@REDACTED Thu Nov 1 08:06:44 2007 From: per@REDACTED (Per Hedeland) Date: Thu, 1 Nov 2007 08:06:44 +0100 (CET) Subject: [erlang-questions] port_close/1 problem In-Reply-To: <47294BBE.1070809@gmail.com> Message-ID: <200711010706.lA176i2g041023@pluto.hedeland.org> Serge Aleynikov wrote: > >Thanks Per, this is quite clever! Though it's probably better to write the wrapper in C - some versions of awk refuse to print NUL characters (e.g. the default one on Solaris - /usr/xpg4/bin/awk a.k.a. nawk works there though, so it could be fixed by setting $PATH) - or if you don't mind a dependency on perl, that would be more "portable". --Per From ulf.wiger@REDACTED Thu Nov 1 08:17:53 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 01 Nov 2007 08:17:53 +0100 Subject: [erlang-questions] how: logging messages to another node In-Reply-To: References: Message-ID: <47297DA1.9070102@ericsson.com> Why not just install a local handler in the error_logger on the diskless nodes, which forwards to the backend node? BR, Ulf W Jay Nelson wrote: > I am working on a scenario with diskless nodes talking to a back end > node with a disk. I want to forward error_logger messages to the > backend node. Here is the chain of events: > > 1) Start the diskless node > a) installs an event_handler to capture error_logger messages > b) messages are queued up until the backend node connects > 2) Start the backend node > 3) Detect node up and forward messages to backend > > I could put a server on the backend node and forward messages to it, > but it seemed that there should be a way to leverage the existing > error_logger. My first attempts were trying to get the process id of > the error_logger on another node, but there was no way to do this > that I could find. I could monitor that process using {error_logger, > Node} but I couldn't figure out a way to remotely obtain the > process_id. Is there a way? > > I have a working version now, which feels a bit of a hack to me which > works as follows: > > Backend machine: > - global:register_name(logger, whereis(error_logger)). > > Diskless machine: > - Pid = global:whereis_name(logger), > - group_leader(Pid, self()), > - error_logger:error_report(Msg) > > Voila, the message appears on the backend node. I don't like the > idea of using the group_leader / error_logger approach or the magic > 'logger' global name. It seems there should be an easier way to > reach out to the remote error_logger process, especially since I can > monitor it using the {RegName, Node}, but I can't find any other > functions for discovering the process_id. > > Any suggestions for an alternate approach? > > jay > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From valentin@REDACTED Thu Nov 1 06:54:05 2007 From: valentin@REDACTED (Valentin Micic) Date: Thu, 1 Nov 2007 07:54:05 +0200 Subject: [erlang-questions] Erlang "jar" file? References: <13501250.post@talk.nabble.com> Message-ID: <010901c81c4b$9e2997b0$6401a8c0@moneymaker2> On occasion we do on-line incremental upgrade (code purge/delete) of a particular module... how would this aspect work with respect to this change? For example, assuming that we have a module M, that has been loaded as a part of the archive A. Than, at the later stage, if one upgrade module M, well, if archive A is already "on the path", how do we avoid loading old M? By removing it from the archive A? That's ok, but how do we roll-back the changes, i.e. roll-back to the old version of M? Yes, one can extract the old file, than remove it, if possible... in other words, quite cumbersome. Then if you have two teams developing independently, both using module X, and both teams deciding that they'd like to put it in independent archives. Brrrrr... nightmare. While archive may make some tasks simpler, it might complicate others. One may afford some degree of complexity when the time is not an issue. However, when one needs to panel-beat the system to satisfy some ad-hoc tests (usually politically motivated), complexity is something you would try to avoid. V. ----- Original Message ----- From: "Kenneth Lundin" To: "Geoff Cant" Cc: "Bernhard Damberger" ; Sent: Wednesday, October 31, 2007 11:23 PM Subject: Re: [erlang-questions] Erlang "jar" file? > Hi, > > Loading code from zip archives or whatever other archive format has > already been implemented but not released. > > We tried code loading from zip files with focus on compatibility and > improved speed for > code loading (it is easier if you skip the compatibility or make the > user to choose between ordinary code loading as of today and archive > loading) > There was no speed improvement so we did not release it. > But now we are considering adding support for code loading from > archive files again, > not for the sake of improved speed but for the reduced number of files you > need > to distribute. > > This will most probably show up in a R12B-x release next year. > > /Kenneth (Erlang/OTP team at Ericsson) > > On 10/31/07, Geoff Cant wrote: >> Bernhard Damberger writes: >> >> > Does erlang support the idea of an archived collection of compiled >> > code, like >> > a jar file? I know that Joe Armstrong wrote a tool called ear that >> > creates >> > an archive for stand alone erlang (see >> > http://www.sics.se/~joe/sae.html). >> > But I got the impression that this is not supported by the standard >> > erlang >> > distribution (or is no longer being actively developed). >> > >> > All the interpreter really needs to do is to be able to load the .beam >> > files >> > in from an archived file (say zip format). So, can it currently do so? >> > >> > _bernhard >> >> I tried building a zip loader as an exercise and it turned out not to be >> too difficult. (http://git.erlang.geek.nz/?p=ssae.git;a=summary) >> >> It probably needs to be taken further so that you can do something like >> 'erl -s ssae init -s yourmodule init' and only distribute ssae.beam. >> >> It would be good if the people who are interested in SAE to put together >> a wiki page detailing what they expect out of SAE - then we could see >> how difficult it would be to provide that. My guess is that modifying >> the runtime system to load beam files out of a zip section in the >> runtime binary would be tricky - but maybe that's not the requirement. >> >> Cheers, >> -- >> Geoff Cant >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Thu Nov 1 09:17:51 2007 From: erlang@REDACTED (Peter Lund) Date: Thu, 01 Nov 2007 09:17:51 +0100 Subject: [erlang-questions] video: announce In-Reply-To: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> References: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> Message-ID: <47298BAF.4060802@lundata.se> Great videos / interviews / discussions ! Listened through both part 1 and 2 yesterday. I guess this will be a mind opener for many current "legacy code" programmers :) Maybe they'll even buy your new book after watching them. /Peter Joe Armstrong skrev: > http://channel9.msdn.com/ShowPost.aspx?PostID=351659#351659 > > :-) > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From ingela@REDACTED Thu Nov 1 10:42:17 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 01 Nov 2007 10:42:17 +0100 Subject: [erlang-questions] port_close/1 problem (Serge Aleynikov) In-Reply-To: References: Message-ID: <47299F79.10906@erix.ericsson.se> Hi! A suggestion is to solve this little problem the way that the odbc-port-program does. The odbc port-program has two threads one supervisor thread and one thread that does the actual work. Both threads set up an ordinary socket to the erlang process and then communicates through them. The supervisor thread waits for a message from erlang and if it gets it it will exit the c-process. So the erlang process can at any time for any reason it sees fit terminate the c-process. Of course there are other reasons why the odbc port-program does want to use sockets and not at all use the pipe to communicate with erlang, except initially. (These are not relevant here, let me just say it has to do with handling all sorts of ill behaved odbc-drivers) Another suggestion could be to try to use the supervisor_bridge functionality, I have never had the chance to use it in reality so I have no hands on knowledge of it, but it could be worth considering. Regards Ingela - OTP team > I reread this email and realized that I forgot to mention the fact that > in my understanding port_close/1 merely closes its end of the pipe used > to communicate with the port process. So in this case if the running > port program is in the middle of a blocking call it won't detect the > closing of the file descriptor it uses to communicate with Erlang and > will continue running. So if I wanted to kill that port by sending an > appropriate signal from Erlang how can I determine the OS pid of the port? > > The obvious answer is to communicate that OS pid back to Erlang through > the pipe, but in this particular case it takes over two to three minutes > before the port loads all components and starts reading its end of the > pipe, and I'd like to be able to kill it prior to that. > > Any suggestions From heinz.eriksson@REDACTED Thu Nov 1 10:54:49 2007 From: heinz.eriksson@REDACTED (Heinz Eriksson) Date: Thu, 1 Nov 2007 02:54:49 -0700 (PDT) Subject: [erlang-questions] video: announce In-Reply-To: <47298BAF.4060802@lundata.se> References: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> <47298BAF.4060802@lundata.se> Message-ID: <13525245.post@talk.nabble.com> Great videos / interviews / discussions ! I agree. I watched/listened to those, but also to a number of others. "Important" people agreeing about "Why OO Sucks", although some of them can't say it right out:-) Erik Meijer (VB, C#) and Dave Thomas (Smalltalk, Eclipse) http://channel9.msdn.com/ShowPost.aspx?PostID=349220 The core of Microsoft language developers: http://channel9.msdn.com/ShowPost.aspx?PostID=273697 Including Anders Hejlsberg http://blogs.msdn.com/charlie/archive/2007/01/26/anders-hejlsberg-on-linq-and-functional-programming.aspx Maybe you already knew to what degree Haskell is osmosing into C# etc. I didn't until yesterday. / -- View this message in context: http://www.nabble.com/video%3A-announce-tf4714955.html#a13525245 Sent from the Erlang Questions mailing list archive at Nabble.com. From raimo+erlang-questions@REDACTED Thu Nov 1 11:23:26 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 1 Nov 2007 11:23:26 +0100 Subject: [erlang-questions] idea: tagging subject line in this group In-Reply-To: <9b08084c0710261056u7bd59927ic71959d9a3e91758@mail.gmail.com> References: <9b08084c0710261056u7bd59927ic71959d9a3e91758@mail.gmail.com> Message-ID: <20071101102326.GA643@erix.ericsson.se> I have now configured the topic filter. Not that I will use it because I want to do my own filtering on the client side. But at least the topics are now defined. The default topic filtering is to receive all messages, topic tagged or not. Topic filtering is done by searching the Subject: line for any of the defined topic tags. The topic tags are case insensitive, start on a word boundary and end with a colon. You can find the current topic definitions at your own mailing list membership configuration page: http://www.erlang.org/mailman/options/erlang-questions They are roughly as Joe suggested: idea: An idea you want to share and get feedback on how: A request for technical info erlounge: Announce an erlounge beginner: A beginners question clarify: Anyone please clarify program: I've written a fun program ... ad: An advertisement for something job: A job advertisement or similar link: Read this article it's interesting ot: Off topic for this mailing list, but I think many will find it interesting anyway Topics may be added later, but this is something better not changed too frequently since it may affect many members. On Fri, Oct 26, 2007 at 07:56:16PM +0200, Joe Armstrong wrote: > This group is getting pretty busy. It's also a useful resource for > finding out how to get this done. > > Can I suggest a simple tagging of the subject line. As follows: > > idea: An idea you want to share and get feedback on > how: A request for technical info > > Replies are just follow ups to the original posting. > > erlounge: announce an erlounge > beginner: a beginners question > clarify: please clarify ... > program: I've written a fun program ... > ad: an advertisement for something > jobad: a job ad > link: read this article it's interesting > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From matthias@REDACTED Thu Nov 1 10:41:24 2007 From: matthias@REDACTED (Matthias Lang) Date: Thu, 1 Nov 2007 10:41:24 +0100 Subject: [erlang-questions] Erlang "jar" file? In-Reply-To: <4728FDA5.9020301@pmp.com.au> References: <13501250.post@talk.nabble.com> <4728FDA5.9020301@pmp.com.au> Message-ID: <18217.40772.393299.540435@cors.corelatus.se> Benjamin Tolputt writes: > This is the primary reason for "stand-alone Erlang" for me (though, as I ... > I realise the dream of a two file deployment is a long way off (if it is > even on the map!), but the idea is so good I can't let go of it! If it's that important, you can always go back to the future and use the hacked R9B version: http://www.sics.se/~joe/sae.html The download still works, so there's a reasonable chance the whole shebang will still work, at least on the *nixes. Matt From chsu79@REDACTED Thu Nov 1 11:48:08 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 1 Nov 2007 11:48:08 +0100 Subject: [erlang-questions] clarify: ETS and large binaries Message-ID: Using the standard memory layout, large binaries are ref-counted in a special binary heap. When messaging large binaries between processes, the messages are creating only a new reference in the destination process and incrementing the ref-count in the binary. What happens when one store large binaries in ets? Will ets only store references or will it copy the binary into ets memory space, so any lookup yielding said binary creates a new, but duplicate, large binary? From raimo+erlang-questions@REDACTED Thu Nov 1 11:48:52 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 1 Nov 2007 11:48:52 +0100 Subject: [erlang-questions] Topic filtering Message-ID: <20071101104852.GA2399@erix.ericsson.se> This list now uses topic filtering. You may configure your topic filter at your membership configuration page, or do nothing and continue to receive all mails, topic tagged or not. http://www.erlang.org/mailman/options/erlang-questions The existing topic definitions can also be found there and I urge you all to start using the topic tags in your posts to facilitate topic filtering, either with Mailman's topic filter or in the mail clients, even if you do not use topic filtering yourselves. The current topics are: idea: An idea you want to share and get feedback on how: A request for technical info erlounge: Announce an erlounge beginner: A beginners question clarify: Anyone please clarify program: I've written a fun program ... ad: An advertisement for something job: A job advertisement or similar link: Read this article it's interesting ot: Off topic for this mailing list, but I think many will find it interesting anyway -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From monch1962@REDACTED Thu Nov 1 11:55:39 2007 From: monch1962@REDACTED (David Mitchell) Date: Thu, 1 Nov 2007 21:55:39 +1100 Subject: [erlang-questions] Looking for info on hot code updates Message-ID: Hello all, Pure and simple - I'm looking for a pointer to info on doing hot code updates (i.e. update code while a server is running) in Erlang. I've seen lots of talk about it, but nothing on: - how to do it - pros/cons/caveats/assumptions - what happens when that code is currently being executed by a running process If there's some magic combination of keywords that'll get me this info in Google, I can't work out what it is. It's probably covered extensively at www.erlang.org under the Documentation link, but I can't find anything there either (probably just looking in the wrong place). Sorry if the request sounds pathetic, but I'm just confused why I can't find this info when pretty much everything else on Erlang is easy to find. Maybe it's just a slow brain day for me today Thanks in advance Dave M. From heinz.eriksson@REDACTED Thu Nov 1 12:20:22 2007 From: heinz.eriksson@REDACTED (Heinz Eriksson) Date: Thu, 1 Nov 2007 04:20:22 -0700 (PDT) Subject: [erlang-questions] idea: tagging subject line in this group In-Reply-To: <20071101102326.GA643@erix.ericsson.se> References: <9b08084c0710261056u7bd59927ic71959d9a3e91758@mail.gmail.com> <20071101102326.GA643@erix.ericsson.se> Message-ID: <13526742.post@talk.nabble.com> There is no tag which fully fits what I read this list for; 'prinicple'. Discussions on selective receive for keeping state machines manageble, COP, let it crash, better record data type, static/dynamic typing, why process dictionary is bad and referential transparency is good and how the principle apply (or fail) in Erlang. So my tag proposal is 'principle', but it could also be 'philosophy' or even 'religion':-) (I would not be surprised if the tagging idea dies out within a few weeks though. ) /hz Raimo Niskanen-2 wrote: > > I have now configured the topic filter. Not that I will use it > because I want to do my own filtering on the client side. > But at least the topics are now defined. The default topic > filtering is to receive all messages, topic tagged or not. > > Topic filtering is done by searching the Subject: line for any of > the defined topic tags. The topic tags are case insensitive, > start on a word boundary and end with a colon. > > You can find the current topic definitions at your own > mailing list membership configuration page: > http://www.erlang.org/mailman/options/erlang-questions > They are roughly as Joe suggested: > > idea: An idea you want to share and get feedback on > how: A request for technical info > erlounge: Announce an erlounge > beginner: A beginners question > clarify: Anyone please clarify > program: I've written a fun program ... > ad: An advertisement for something > job: A job advertisement or similar > link: Read this article it's interesting > ot: Off topic for this mailing list, but I think many will > find it interesting anyway > > Topics may be added later, but this is something better not changed > too frequently since it may affect many members. > > > > On Fri, Oct 26, 2007 at 07:56:16PM +0200, Joe Armstrong wrote: >> This group is getting pretty busy. It's also a useful resource for >> finding out how to get this done. >> >> Can I suggest a simple tagging of the subject line. As follows: >> >> idea: An idea you want to share and get feedback on >> how: A request for technical info >> >> Replies are just follow ups to the original posting. >> >> erlounge: announce an erlounge >> beginner: a beginners question >> clarify: please clarify ... >> program: I've written a fun program ... >> ad: an advertisement for something >> jobad: a job ad >> link: read this article it's interesting >> >> /Joe >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/idea%3A-tagging-subject-line-in-this-group-tf4698917.html#a13526742 Sent from the Erlang Questions mailing list archive at Nabble.com. From saleyn@REDACTED Thu Nov 1 13:37:51 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 01 Nov 2007 07:37:51 -0500 Subject: [erlang-questions] how: logging messages to another node In-Reply-To: References: Message-ID: <4729C89F.8090701@gmail.com> Hmm, seems like this is what you want to do: rpc:call(Node, erlang, whereis, [error_logger]). on the other hand as Uffe said you can propagate the error reports to other (e.g. backend) nodes. In the LAMA jungerl contrib (which's a bit outdated, as I haven't had time to upload the latest version) there's an event handler that has similar functionality. The idea is to use macros in your code to report an error locally or broadcast it to error_loggers on known nodes (code is stripped from lama/include/logger.hrl and lama/src/lama_syslog_h.erl): -define(ERROR(Str_, Args_), error_logger:error_report({lama,error}, {false, {Str_, Args_}})). -define(DIST_ERROR(Str_, Args_), error_logger:error_report({lama,error}, {true, {Str_, Args_}})). And have an error handler that would do something along the line of what LAMA does in the distribute/2 function: handle_event({error_report, GL, {Pid, {lama,Type}, {Distr,Report}}}, State) -> % Send distributed messages to other nodes, and also if the % Type is in [warning,error] forward it other gen_event handlers or % print [info,debug] messages to screen distribute(Distr, {error_report, GL, {Pid,{lama,Type},Report}}, State), {ok, State}; distribute(false = _Distr, {_, _GL, {_Pid, {_,Type},_Rep}} = Report, State) -> distribute2(Type, Report, State); distribute(true, {_, _GL, {_Pid, {_,Type},_Rep}} = Report, State) -> % Make sure the other nodes don't drop this message DistRep = setelement(2, Report, lama), _ = [gen_event:notify({error_logger, N}, DistRep) || N <- nodes()], distribute2(Type, Report, State). Serge Jay Nelson wrote: > I am working on a scenario with diskless nodes talking to a back end > node with a disk. I want to forward error_logger messages to the > backend node. Here is the chain of events: > > 1) Start the diskless node > a) installs an event_handler to capture error_logger messages > b) messages are queued up until the backend node connects > 2) Start the backend node > 3) Detect node up and forward messages to backend > > I could put a server on the backend node and forward messages to it, > but it seemed that there should be a way to leverage the existing > error_logger. My first attempts were trying to get the process id of > the error_logger on another node, but there was no way to do this > that I could find. I could monitor that process using {error_logger, > Node} but I couldn't figure out a way to remotely obtain the > process_id. Is there a way? > > I have a working version now, which feels a bit of a hack to me which > works as follows: > > Backend machine: > - global:register_name(logger, whereis(error_logger)). > > Diskless machine: > - Pid = global:whereis_name(logger), > - group_leader(Pid, self()), > - error_logger:error_report(Msg) > > Voila, the message appears on the backend node. I don't like the > idea of using the group_leader / error_logger approach or the magic > 'logger' global name. It seems there should be an easier way to > reach out to the remote error_logger process, especially since I can > monitor it using the {RegName, Node}, but I can't find any other > functions for discovering the process_id. > > Any suggestions for an alternate approach? > > jay > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rsaccon@REDACTED Thu Nov 1 12:43:44 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 1 Nov 2007 08:43:44 -0300 Subject: [erlang-questions] Looking for info on hot code updates In-Reply-To: References: Message-ID: On 11/1/07, David Mitchell wrote: > Hello all, > > Pure and simple - I'm looking for a pointer to info on doing hot code > updates (i.e. update code while a server is running) in Erlang. I've > seen lots of talk about it, but nothing on: > - how to do it if you use Emakefiles, then do in the shell make:all([load]) that compiles and reloads modules the actual function is: code:load_file > - pros/cons/caveats/assumptions > - what happens when that code is currently being executed by a running process There are callbacks, so you can define what will happen, take a look at the OTP server behavior > > If there's some magic combination of keywords that'll get me this info > in Google, I can't work out what it is. It's probably covered > extensively at www.erlang.org under the Documentation link, but I > can't find anything there either (probably just looking in the wrong > place). > > Sorry if the request sounds pathetic, but I'm just confused why I > can't find this info when pretty much everything else on Erlang is > easy to find. Maybe it's just a slow brain day for me today > > Thanks in advance > > Dave M. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From chsu79@REDACTED Thu Nov 1 12:57:42 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 1 Nov 2007 12:57:42 +0100 Subject: [erlang-questions] beginner: Looking for info on hot code updates Message-ID: I think I read about the mechanism in Concurrent Programming in Erlang http://www.erlang.org/download/erlang-book-part1.pdf And as far as I understand "everyone" that use code upgrading practically do so by basing every process on OTP behaviors. See the code_switch callback in a gen_server for example. The gen_server elects to be notified of a new version of the behavioral module, so it can code switch to it. All you have to do is to write the code that transform the old data structures to the new version. 2007/11/1, David Mitchell : > Hello all, > > Pure and simple - I'm looking for a pointer to info on doing hot code > updates (i.e. update code while a server is running) in Erlang. I've > seen lots of talk about it, but nothing on: > - how to do it > - pros/cons/caveats/assumptions > - what happens when that code is currently being executed by a running process > > If there's some magic combination of keywords that'll get me this info > in Google, I can't work out what it is. It's probably covered > extensively at www.erlang.org under the Documentation link, but I > can't find anything there either (probably just looking in the wrong > place). > > Sorry if the request sounds pathetic, but I'm just confused why I > can't find this info when pretty much everything else on Erlang is > easy to find. Maybe it's just a slow brain day for me today > > Thanks in advance > > Dave M. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From saleyn@REDACTED Thu Nov 1 14:08:32 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 01 Nov 2007 08:08:32 -0500 Subject: [erlang-questions] port_close/1 problem (Serge Aleynikov) In-Reply-To: <47299F79.10906@erix.ericsson.se> References: <47299F79.10906@erix.ericsson.se> Message-ID: <4729CFD0.6030801@gmail.com> Thanks for the suggestion, I'll take a look at the odbc code. Supervisor_bridge behavior is what I am currently using to ensure proper cleanup of the managed port and other resources. Serge Ingela Anderton Andin wrote: > Hi! > > A suggestion is to solve this little problem the way that the > odbc-port-program does. > The odbc port-program has two threads one supervisor thread and one > thread that does > the actual work. Both threads set up an ordinary socket to the erlang > process and then > communicates through them. The supervisor thread waits for a message > from erlang and > if it gets it it will exit the c-process. So the erlang process can at > any time for any reason it sees fit > terminate the c-process. Of course there are other reasons why the odbc > port-program does want to use sockets and not at all use the pipe to > communicate with erlang, except initially. (These are not relevant here, > let me just say it has to do with handling all sorts of ill behaved > odbc-drivers) > > Another suggestion could be to try to use the supervisor_bridge > functionality, I have never had the chance > to use it in reality so I have no hands on knowledge of it, but it could > be worth considering. > > Regards Ingela - OTP team > >> I reread this email and realized that I forgot to mention the fact >> that in my understanding port_close/1 merely closes its end of the >> pipe used to communicate with the port process. So in this case if >> the running port program is in the middle of a blocking call it won't >> detect the closing of the file descriptor it uses to communicate with >> Erlang and will continue running. So if I wanted to kill that port by >> sending an appropriate signal from Erlang how can I determine the OS >> pid of the port? >> >> The obvious answer is to communicate that OS pid back to Erlang >> through the pipe, but in this particular case it takes over two to >> three minutes before the port loads all components and starts reading >> its end of the pipe, and I'd like to be able to kill it prior to that. >> >> Any suggestions > From casper2000a@REDACTED Thu Nov 1 13:38:37 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Thu, 1 Nov 2007 18:08:37 +0530 Subject: [erlang-questions] Looking for info on hot code updates In-Reply-To: References: Message-ID: <00e101c81c84$206f6050$614e20f0$@com> Hot code update is not complicated as it sounds. Copy your new beam file to the place where you have the old module beam file. If you are updating a code of a non-running module, just run, l(). c:l(). code:purge(). If the code is running (eg. gen_server, gen_fsm, spawned process, etc.) If the state is not changing due to the module change and if the process is OTP compliant, you can run code:soft_purge(). code:load_file(). If the state is changing and still the process is OTP compliant, then you need to write the state conversion method under the code_change to return the new state, extracted from the old state. If the process is not OTP compliant, just use l/1, c:l/1 or code:purge/1, but in this case the process will actually terminate and if it's started through a supervisor, will restart. Otherwise manual restart will require. Above is only for a single module update. If you want to do a full release update, see Release Handling under OTP Design Principles in the Erlang Manual. BRgds, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of David Mitchell Sent: Thursday, November 01, 2007 4:26 PM To: Erlang Subject: [erlang-questions] Looking for info on hot code updates Hello all, Pure and simple - I'm looking for a pointer to info on doing hot code updates (i.e. update code while a server is running) in Erlang. I've seen lots of talk about it, but nothing on: - how to do it - pros/cons/caveats/assumptions - what happens when that code is currently being executed by a running process If there's some magic combination of keywords that'll get me this info in Google, I can't work out what it is. It's probably covered extensively at www.erlang.org under the Documentation link, but I can't find anything there either (probably just looking in the wrong place). Sorry if the request sounds pathetic, but I'm just confused why I can't find this info when pretty much everything else on Erlang is easy to find. Maybe it's just a slow brain day for me today Thanks in advance Dave M. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Thu Nov 1 14:25:44 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 1 Nov 2007 14:25:44 +0100 Subject: [erlang-questions] : idea: tagging subject line in this group In-Reply-To: <13526742.post@talk.nabble.com> References: <9b08084c0710261056u7bd59927ic71959d9a3e91758@mail.gmail.com> <20071101102326.GA643@erix.ericsson.se> <13526742.post@talk.nabble.com> Message-ID: <20071101132544.GA4383@erix.ericsson.se> On Thu, Nov 01, 2007 at 04:20:22AM -0700, Heinz Eriksson wrote: > > There is no tag which fully fits what I read this list for; 'prinicple'. > Discussions on selective receive for keeping state machines manageble, COP, > let it crash, better record data type, static/dynamic typing, why process > dictionary is bad and referential transparency is good and how the principle > apply (or fail) in Erlang. > A bit like clairfy: but why, and philosophically...? > So my tag proposal is 'principle', but it could also be 'philosophy' or even > 'religion':-) > More suggestions? I think I like `religion', with `philosophy' as a close runner-up. > (I would not be surprised if the tagging idea dies out within a few weeks > though. ) > Maybe. I have been thinking about some kind of sublisting since the last EUC, and since Joe brought it up there is a good chance members will start using it. And if there is a much better chance the right members read your post (many important members filter out uninteresting subjects) if you tag it, it might even continue to be used. The future will tell... > /hz > > > Raimo Niskanen-2 wrote: > > > > I have now configured the topic filter. Not that I will use it > > because I want to do my own filtering on the client side. > > But at least the topics are now defined. The default topic > > filtering is to receive all messages, topic tagged or not. > > > > Topic filtering is done by searching the Subject: line for any of > > the defined topic tags. The topic tags are case insensitive, > > start on a word boundary and end with a colon. > > > > You can find the current topic definitions at your own > > mailing list membership configuration page: > > http://www.erlang.org/mailman/options/erlang-questions > > They are roughly as Joe suggested: > > > > idea: An idea you want to share and get feedback on > > how: A request for technical info > > erlounge: Announce an erlounge > > beginner: A beginners question > > clarify: Anyone please clarify > > program: I've written a fun program ... > > ad: An advertisement for something > > job: A job advertisement or similar > > link: Read this article it's interesting > > ot: Off topic for this mailing list, but I think many will > > find it interesting anyway > > > > Topics may be added later, but this is something better not changed > > too frequently since it may affect many members. > > > > > > > > On Fri, Oct 26, 2007 at 07:56:16PM +0200, Joe Armstrong wrote: > >> This group is getting pretty busy. It's also a useful resource for > >> finding out how to get this done. > >> > >> Can I suggest a simple tagging of the subject line. As follows: > >> > >> idea: An idea you want to share and get feedback on > >> how: A request for technical info > >> > >> Replies are just follow ups to the original posting. > >> > >> erlounge: announce an erlounge > >> beginner: a beginners question > >> clarify: please clarify ... > >> program: I've written a fun program ... > >> ad: an advertisement for something > >> jobad: a job ad > >> link: read this article it's interesting > >> > >> /Joe > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > View this message in context: http://www.nabble.com/idea%3A-tagging-subject-line-in-this-group-tf4698917.html#a13526742 > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Thu Nov 1 13:51:52 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 1 Nov 2007 05:51:52 -0700 (PDT) Subject: [erlang-questions] Looking for info on hot code updates In-Reply-To: Message-ID: <364208.33509.qm@web38808.mail.mud.yahoo.com> --- David Mitchell wrote: > Hello all, > > Pure and simple - I'm looking for a pointer to info > on doing hot code > updates (i.e. update code while a server is running) > in Erlang. I've > seen lots of talk about it, but nothing on: > - how to do it > - pros/cons/caveats/assumptions > - what happens when that code is currently being > executed by a running process > > If there's some magic combination of keywords > that'll get me this info > in Google, I can't work out what it is. Look for "erlang hot code loading". See also the code(3) documentation and the OTP docs for applications, releases, gen_* and so on. I think the old Erlang book (available from erlang.org) has a bit about this. The low-level principles are these: 1. There can be up to two versions of a module loaded at a given time, the 'old' version and the 'latest' version. (The terminology is not quite standardized.) 2. Remote calls, m:f(...) always invoke the latest version of a module. Thus, you often switch to "the new code" by making a remote tail-call to yourself. Local calls f(...) remain in the same module. 3. When a new version of a module is loaded, the 'latest' version becomes the 'old' version and the old version is purged from the system/VM. When a module version is purged, all processes referring to it are killed (to avoid dead return addresses). OTP and the gen_* framework then builds functionality on top of this, e.g., "formal" upgrades and downgrades and so on. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From thomasl_erlang@REDACTED Thu Nov 1 15:14:49 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 1 Nov 2007 07:14:49 -0700 (PDT) Subject: [erlang-questions] widefinder update In-Reply-To: Message-ID: <318661.2753.qm@web38814.mail.mud.yahoo.com> --- Anders Nygren wrote: > On 10/29/07, Thomas Lindgren > wrote: > > > > --- Steve Vinoski wrote: > > > > > On 10/28/07, Anders Nygren > > > > wrote: > > > > > > > > On 10/28/07, Hynek Vychodil > > > wrote: > > > > > Hi Anders, > > > > > I rewrote your code a little. I removed all > > > remaining binary bindings > > > > > and it is noticeable faster again. Try > > > wf_pichi3.erl. > > > > > > > > > > > > > Hynek > > > > that was great, Your change brings my > wfinder1_1 + > > > wfbm4_ets1_1 > > > > down to > > > > real 0m1.118s > > > > user 0m1.640s > > > > sys 0m0.368s > > > > on my 1.66 GHz dual core laptop. > > > > > > > > > And on the 8-core 2.33GHz Intel Xeon Linux box > with > > > 2 GB RAM, this version > > > is extremely fast: > > > > > > real 0m0.567s > > > user 0m2.249s > > > sys 0m0.956s > > > > (I'll ignore the unexplained sys time below. That > > makes the discussion a bit preliminary; perhaps > the > > derived results should be computed some other way. > > Apply grain of salt appropriately.) > > > > For those keeping track, the latest result is > fully > > 2.7 times faster than the best previous version > (which > > was block read), and 17.3 times faster than the > > initial version. The latest speedup is basically > due > > to doing less work. > > Are we doing less work? > Not really, over 3 versions wfinder, wfinder1 and > wfinder1_1 > the only differences are how we do binary matching > - do NOT create sub binaries > - keep "pointers" for offsets inside one big binary > The reason that it get so much faster seems to be > that > we have much less garbage collection. Just to be clear, here I put memory allocation and reclamation in the category of 'work'. So doing less work in this sense means being more efficient for the same data set. In the case of widefinder, the user time has steadily decreased with new versions, which I take to indicate precisely this. > - When doing folds over large binaries do not > repetedly > split the binary in head and tail parts for > recursive calls. > Keep an offset counter to track the position in the > binary. Yes, this pitfall turns up time and again (along with the issue of repeatedly appending data to binaries :-). > - One reason that it is even possible to solve the > wide finder > in parallel is that it is possible to "resync" at a > random place > in the file by locating a newline. Right, good point. The data structure, or file format in this case, has to lend itself to parallelization too. Text works in the ordinary case because single lines are nearly always short, so you won't run into problems looking for the end of line. So you can chop the file into chunks and 'repair' it into lines afterwards. (In contrast, we have other formats like BER, or in my case, diameter packets that can be 2^24 bytes.) Other approaches might be to start the file with a directory of sections to speed up traversal. (Even simpler, though it defeats the purpose of this exercise: generate many files of reasonable size and process each one independently ...) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From jay@REDACTED Thu Nov 1 15:58:18 2007 From: jay@REDACTED (Jay Nelson) Date: Thu, 1 Nov 2007 07:58:18 -0700 Subject: [erlang-questions] how: logging messages to another node Message-ID: Serge wrote: > Hmm, seems like this is what you want to do: > rpc:call(Node, erlang, whereis, [error_logger]). Doh! I never use rpc: so it didn't occur to me at all that any function I use locally can be trivially invoked using rpc:call. That is a good tool when coordinating activity between two nodes. I guess that is the solution to finding an arbitrary process id on any node in a cluster. Makes sense that all other calls can work this way, except monitor and demonitor -- no wonder I found ways to do it with those but not with anything else. Ulf wrote: > Why not just install a local handler in the error_logger > on the diskless nodes, which forwards to the backend node? This is what I am doing, but I want it to be somewhat robust. The diskless node may be up when the backend is not, so I created a gen_server: process logs error --> error_handler --> local gen_server --> backend node The local gen_server saves a queue of messages when the backend is disconnected. Once it reconnects I want to forward the messages that I've accumulated: 1) If I just change gen_leader on the diskless node, I can't necessarily "guarantee" that messages get to the backend 2) With serge's lama suggestion it gets closer I think, but I don't know if the gen_event:notify gets received by the backend (and I'm not sure if I want the local gen_server doing blocking calls to get acked from the backend, but I can ensure that all messages arriving to local gen_server are asynchronous) What I've created so far is the following: 1) diskless gen_server which can: a) asynchronously receive messages from error_handler installed on local error_logger b) queue which allows head to be retrieved and sent async to backend c) delete of head once ack comes from backend d) b&c are easily changed to batch a block of messages 2) backend error_logger / error_handler that does proper message logging for my app I would like to expand to having clustered backend and more reliable logging without knowing magic global names, etc. After thinking on it last night while I was sleeping I am going to approach it as follows: 1) Quick hook up using serge's approach to get the process_id via rpc:call of whereis using the currently known single backend node name 2) Longer term, detect backend machines: a) Create a process which monitors a global_group of backends b) When a node connects, rpc a probe process to discover process ids, config of backend c) Send this information back to the monitor process d) Monitor then signals local message queue gen_server to start forwarding messages The key features I want are: 1) Transparent local error_logger calls 2) Somewhat more reliable logging capture guarantees 3) Dynamic backend configuration and crash/recovery 4) Transparent local backend error_logger calls for backend problems which don't get confused with error logging already properly tagged and formatted on diskless node Thanks for the tips, I at least have a plan of attack now. jay From anders.nygren@REDACTED Thu Nov 1 16:00:42 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 1 Nov 2007 09:00:42 -0600 Subject: [erlang-questions] widefinder update In-Reply-To: <318661.2753.qm@web38814.mail.mud.yahoo.com> References: <318661.2753.qm@web38814.mail.mud.yahoo.com> Message-ID: On 11/1/07, Thomas Lindgren wrote: > > --- Anders Nygren wrote: > > > On 10/29/07, Thomas Lindgren > > wrote: > > > > > > --- Steve Vinoski wrote: > > > > > > > On 10/28/07, Anders Nygren > > > > > > wrote: > > > > > > > > > > On 10/28/07, Hynek Vychodil > > > > wrote: > > > > > > Hi Anders, > > > > > > I rewrote your code a little. I removed all > > > > remaining binary bindings > > > > > > and it is noticeable faster again. Try > > > > wf_pichi3.erl. > > > > > > > > > > > > > > > > Hynek > > > > > that was great, Your change brings my > > wfinder1_1 + > > > > wfbm4_ets1_1 > > > > > down to > > > > > real 0m1.118s > > > > > user 0m1.640s > > > > > sys 0m0.368s > > > > > on my 1.66 GHz dual core laptop. > > > > > > > > > > > > And on the 8-core 2.33GHz Intel Xeon Linux box > > with > > > > 2 GB RAM, this version > > > > is extremely fast: > > > > > > > > real 0m0.567s > > > > user 0m2.249s > > > > sys 0m0.956s > > > > > > (I'll ignore the unexplained sys time below. That > > > makes the discussion a bit preliminary; perhaps > > the > > > derived results should be computed some other way. > > > Apply grain of salt appropriately.) > > > > > > For those keeping track, the latest result is > > fully > > > 2.7 times faster than the best previous version > > (which > > > was block read), and 17.3 times faster than the > > > initial version. The latest speedup is basically > > due > > > to doing less work. > > > > Are we doing less work? > > Not really, over 3 versions wfinder, wfinder1 and > > wfinder1_1 > > the only differences are how we do binary matching > > - do NOT create sub binaries > > - keep "pointers" for offsets inside one big binary > > The reason that it get so much faster seems to be > > that > > we have much less garbage collection. > > Just to be clear, here I put memory allocation and > reclamation in the category of 'work'. So doing less > work in this sense means being more efficient for the > same data set. In the case of widefinder, the user > time has steadily decreased with new versions, which I > take to indicate precisely this. > Yes, I understood that, but my point was that we had not decreased the amount of work by any fundamentally different algorithms. /Anders From ulf.wiger@REDACTED Thu Nov 1 16:21:22 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 01 Nov 2007 16:21:22 +0100 Subject: [erlang-questions] how: logging messages to another node In-Reply-To: References: Message-ID: <4729EEF2.6060609@ericsson.com> Jay Nelson wrote: > Serge wrote: > > > Hmm, seems like this is what you want to do: > > rpc:call(Node, erlang, whereis, [error_logger]). > > Doh! I never use rpc: so it didn't occur to me at all that any > function I use locally can be trivially invoked using rpc:call. That > is a good tool when coordinating activity between two nodes. Just spend some time meditating over the use of group_leader() in error_logger, the io system and rpc. When you use rpc:call(), the remote process spawned to service the call is given the same group leader as the caller. The point is to make printouts appear on the caller's node. The error_logger_tty_h handler looks at the group leader of the origin and skips it if the group leader is from another node. When I tried it, the error report appeared on both nodes. It's a mystery that I didn't fully unravel. BR, Ulf W From dmercer@REDACTED Thu Nov 1 16:27:57 2007 From: dmercer@REDACTED (David Mercer) Date: Thu, 1 Nov 2007 10:27:57 -0500 Subject: [erlang-questions] idea: tagging subject line in this group In-Reply-To: <13526742.post@talk.nabble.com> References: <9b08084c0710261056u7bd59927ic71959d9a3e91758@mail.gmail.com><20071101102326.GA643@erix.ericsson.se> <13526742.post@talk.nabble.com> Message-ID: <004501c81c9b$c862b5c0$891ea8c0@SSI.CORP> Would these be accurately described by the "beginner" tag? Even if you are loathe to consider yourself a mere beginner, the questions are those of a novice asking the masters for advice. DBM -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Heinz Eriksson Sent: Thursday, November 01, 2007 06:20 To: erlang-questions@REDACTED Subject: Re: [erlang-questions] idea: tagging subject line in this group There is no tag which fully fits what I read this list for; 'prinicple'. Discussions on selective receive for keeping state machines manageble, COP, let it crash, better record data type, static/dynamic typing, why process dictionary is bad and referential transparency is good and how the principle apply (or fail) in Erlang. So my tag proposal is 'principle', but it could also be 'philosophy' or even 'religion':-) (I would not be surprised if the tagging idea dies out within a few weeks though. ) /hz Raimo Niskanen-2 wrote: > > I have now configured the topic filter. Not that I will use it > because I want to do my own filtering on the client side. > But at least the topics are now defined. The default topic > filtering is to receive all messages, topic tagged or not. > > Topic filtering is done by searching the Subject: line for any of > the defined topic tags. The topic tags are case insensitive, > start on a word boundary and end with a colon. > > You can find the current topic definitions at your own > mailing list membership configuration page: > http://www.erlang.org/mailman/options/erlang-questions > They are roughly as Joe suggested: > > idea: An idea you want to share and get feedback on > how: A request for technical info > erlounge: Announce an erlounge > beginner: A beginners question > clarify: Anyone please clarify > program: I've written a fun program ... > ad: An advertisement for something > job: A job advertisement or similar > link: Read this article it's interesting > ot: Off topic for this mailing list, but I think many will > find it interesting anyway > > Topics may be added later, but this is something better not changed > too frequently since it may affect many members. > > > > On Fri, Oct 26, 2007 at 07:56:16PM +0200, Joe Armstrong wrote: >> This group is getting pretty busy. It's also a useful resource for >> finding out how to get this done. >> >> Can I suggest a simple tagging of the subject line. As follows: >> >> idea: An idea you want to share and get feedback on >> how: A request for technical info >> >> Replies are just follow ups to the original posting. >> >> erlounge: announce an erlounge >> beginner: a beginners question >> clarify: please clarify ... >> program: I've written a fun program ... >> ad: an advertisement for something >> jobad: a job ad >> link: read this article it's interesting >> >> /Joe >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/idea%3A-tagging-subject-line-in-this-group-tf4698917.h tml#a13526742 Sent from the Erlang Questions mailing list archive at Nabble.com. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Thu Nov 1 16:38:30 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 1 Nov 2007 16:38:30 +0100 Subject: [erlang-questions] : idea: tagging subject line in this group In-Reply-To: <20071101132544.GA4383@erix.ericsson.se> References: <9b08084c0710261056u7bd59927ic71959d9a3e91758@mail.gmail.com> <20071101102326.GA643@erix.ericsson.se> <13526742.post@talk.nabble.com> <20071101132544.GA4383@erix.ericsson.se> Message-ID: If anything should change, it should be to less tags. Although, lets try out the current tagging scheme before we change it. > More suggestions? I think I like `religion', with `philosophy' > as a close runner-up. From bjorn@REDACTED Thu Nov 1 17:05:32 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 01 Nov 2007 17:05:32 +0100 Subject: [erlang-questions] clarify: ETS and large binaries In-Reply-To: References: Message-ID: "Christian S" writes: > What happens when one store large binaries in ets? Will ets only store > references or will it copy the binary into ets memory space, so any > lookup yielding said binary creates a new, but duplicate, large > binary? Ets will only store a reference to the binary. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kenneth.lundin@REDACTED Thu Nov 1 17:24:16 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 1 Nov 2007 17:24:16 +0100 Subject: [erlang-questions] Erlang "jar" file? In-Reply-To: <010901c81c4b$9e2997b0$6401a8c0@moneymaker2> References: <13501250.post@talk.nabble.com> <010901c81c4b$9e2997b0$6401a8c0@moneymaker2> Message-ID: On 11/1/07, Valentin Micic wrote: > On occasion we do on-line incremental upgrade (code purge/delete) of a > particular module... how would this aspect work with respect to this change? > For example, assuming that we have a module M, that has been loaded as a > part of the archive A. Than, at the later stage, if one upgrade module M, > well, if archive A is already "on the path", how do we avoid loading old M? > By removing it from the archive A? That's ok, but how do we roll-back the > changes, i.e. roll-back to the old version of M? Yes, one can extract the > old file, than remove it, if possible... in other words, quite cumbersome. > Then if you have two teams developing independently, both using module X, > and both teams deciding that they'd like to put it in independent archives. > Brrrrr... nightmare. We are not planning to introduce the loading from archive files and other features in the Standalone Erlang direction as changes. It will just be additional choices which can be used for products that would benefit from being distributed that way. I can think of many products that you can develop with Erlang that don't need to be upgraded during service. Just stop, replace and restart with new version. > > While archive may make some tasks simpler, it might complicate others. One > may afford some degree of complexity when the time is not an issue. However, > when one needs to panel-beat the system to satisfy some ad-hoc tests > (usually politically motivated), complexity is something you would try to > avoid. > > V. > /Kenneth (Erlang/OTP team at Ericsson) From ulf.wiger@REDACTED Thu Nov 1 18:19:05 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 01 Nov 2007 18:19:05 +0100 Subject: [erlang-questions] video: announce In-Reply-To: <13525245.post@talk.nabble.com> References: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> <47298BAF.4060802@lundata.se> <13525245.post@talk.nabble.com> Message-ID: <472A0A89.2060307@ericsson.com> A strong testament to the increasing popularity of functional programming: This is "off-line" at the Java and Object-Oriented conference, and all the gurus are talking about how important functional programming is. Very good interviews. BR, Ulf W Heinz Eriksson wrote: > > Great videos / interviews / discussions ! > > I agree. I watched/listened to those, but also to a number of others. > > "Important" people agreeing about "Why OO Sucks", although some of them > can't say it right out:-) > > Erik Meijer (VB, C#) and Dave Thomas (Smalltalk, Eclipse) > http://channel9.msdn.com/ShowPost.aspx?PostID=349220 > > The core of Microsoft language developers: > http://channel9.msdn.com/ShowPost.aspx?PostID=273697 > > Including Anders Hejlsberg > http://blogs.msdn.com/charlie/archive/2007/01/26/anders-hejlsberg-on-linq-and-functional-programming.aspx > > Maybe you already knew to what degree Haskell is osmosing into C# etc. I > didn't until yesterday. > > / > From cadr4u@REDACTED Thu Nov 1 19:21:51 2007 From: cadr4u@REDACTED (Jakob Sievers) Date: Thu, 1 Nov 2007 19:21:51 +0100 Subject: [erlang-questions] program: eburg, an iburg-style code generator generator Message-ID: Ahoy! Since a burg-clone was the only major compiler tool not yet available for Erlang, I figured I'd implement one. I've uploaded the first public version of eburg to trapexit: http://forum.trapexit.org/viewtopic.php?p=33406 For those readers unfamiliar with burg, its somewhat similar to yacc but instead of generating string parsers, it generates tree parsers (which are most commonly used as code generators). For details, see the iburg paper available here: http://storage.webhop.net/documents/iburg.pdf While the test suite is reasonably thorough, undoubtedly bugs remain. If you encounter any, please let me know. Also, if you have any feature requests, I'd probably be happy to implement them. In particular, I'd be interested to hear what people think about having to quote subject tree operators since they're all upper case (I personally don't mind but it's trivially changeable if anyone does). I've only tested eburg using R11B3 on x86 so far - do send me mail if there are issues on other platforms. Cheers, -jakob From gbulmer@REDACTED Thu Nov 1 20:05:02 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 1 Nov 2007 19:05:02 +0000 Subject: [erlang-questions] =?windows-1252?q?link=3A_Michael_Stonebraker?= =?windows-1252?q?=2C__=22The_End_of_an_Architectural_Era_=28It=92s_Time_f?= =?windows-1252?q?or_a_Complete_Rewrite=29=22?= Message-ID: <1EDFF1B3-A6E9-4B92-B914-0499403C3E26@gmail.com> Partly because of the Berkeley DB + Erlang thread, I've read this paper: "The End of an Architectural Era (It?s Time for a Complete Rewrite)" by Michael Stonebraker et al. Stonebraker was the architect for Ingres, PostgreSQL and (I believe) Vertica, so he has credibility. http://web.mit.edu/dna/www/vldb07hstore.pdf Here's my overview. The quotes are impressive (82x faster), but I've written these comments to give a summary picture. Summary: - There are several problem areas where RDBMS's are used, but are not a good solution, but everyone assumed OLTP is their sweet spot. This paper sets out to compare an experimental database (H-Store) which indicates OLTP is not the RDBMS sweet spot either. Their premise is: RDBMS are based on 25+ old architectures whose requirements and assumptions no longer apply. - They take a very different approach, exploiting modern hardware and software, and willingly examining non-traditional techniques (it reads a bit like a 'Hennesy & Patterson' approach - i.e. smart solution using proper analysis of key factors, unconstrained by 'convention') - The experiment is based on the TPC-C (order processing) OLTP benchmark Key results: - H-Store is 82x faster than a commercial DB at TPC-C on a dual core desktop - Hence H-Store is within 50% of the world-record (set by a 128 core SMP server) using only this 2-core desktop - H-Store is their experimental database, intended to prove the disk- based RDBMS's can be improved on by 1-2 orders of magnitude. The H-Store database system has significant pieces missing or undemonstrated, but the paper gives views on the research directions. - An H-Store is partitioned to be a 'share-nothing' system, with memory partitioned on a per-core basis on each machine, each partition of core+memory is a 'site'. A system is intended to be a grid of 'sites' across many machines. Data is distributed for performance, HA & scalability - H-Stores major themes: - horizontal scalability through share-nothing application of cores, memory and machines, - significant software simplification: avoiding concurrency control, multi-threading, locking, and undo logs, and replaces with in-memory, *single threaded*, lock-free transactions which can be efficiently executed in parallel across many 'sites', - huge performance improvements by fully using memory and minimising disk use. - High Availability by replication built in from the start, and not 'bolted on' later - no ad-hoc queries - There are no ad-hoc query transactions, all queries must be 'pre- submitted' and compiled. The paper claims that most commercial OLTP uses of RDBMS avoid ad hoc queries anyway, so this isn't a serious problem. (I largely agree). - Properties of queries are identified in 'compilation' which allow the system to execute the transaction most efficiently. These properties also help identify how the database may be partitioned across the share-nothing sites. - They don't see most database need to be fully relational. - They implement a major subset of the TPC-C benchmark on H-Store, but I couldn't work out how much difference the omissions would have. - The experiment uses a single dual core machine, and compares with a commercial database implementation using stored procedures. (There is no multi-machine experiment, and this may be because they haven't got the multi-machine stuff working - I don't know.) -------------- QUOTES: "Both DBMSs were run on a dual-core 2.8GHz CPU computer system, with 4 Gbytes of main memory and four 250 GB SATA disk drives. ... " "On this configuration, H-Store ran 70,416 TPC-C transactions per second. In contrast, we could only coax 850 transactions per second from the commercial system, in spite of several days of tuning by a professional DBA, who specializes in this vendor?s product. Hence, H- Store ran a factor of 82 faster (almost two orders of magnitude). " "Finally, though we did not implement all of the TPC-C specification (we did not, for example, model wait times), it is also instructive to compare our partial TPC-C implementation with TPC-C performance records on the TPC website2. The highest performing TPC-C implementation executes about 4 million new-order transactions per minute, or a total of about 133,000 total transactions per second. This is on a 128 core shared memory machine, so this implementation is getting about 1000 transactions per core. Contrast this with 425 transactions per core in our benchmark on a commercial system on a (rather pokey) desktop machine, or 35,000 transactions per core in H- Store! Also, note that H-Store is within a factor of two of the best TPC-C results on a low- end machine. " "In summary, the conclusion to be reached is that nearly two orders of magnitude in performance improvement are available to a system designed along the lines of H-Store." -------------- There are several weaknesses of the experiment, but H-Store *is* very quick so I wont whinge too much. I think the TPC-C "new-order" transaction *should* work very well on their architecture (and I'd hope it's the major transaction in the mix :-), but I'd like to understand what variation (i.e. query) might push H-Store out of its sweet spot. One of their ideas is to use Ruby on Rails as the programming language embedded in it! I wondered if anyone at Ericsson might like to encourage the folks at MIT to combine H-Store (which is C++) with Erlang, then .... ;-) Anyway, it is a fun paper, and an interesting follow up to their end of "One Size Fits All" (data warehouse stuff): http://www.databasecolumn.com/2007/09/one-size-fits-all.html http://www.cs.brown.edu/~ugur/fits_all.pdf - ?One Size Fits All?: An Idea Whose Time Has Come and Gone http://nms.csail.mit.edu/~stavros/pubs/osfa.pdf - One Size Fits All? ? Part 2: Benchmarking Results I hope this is interesting/useful. GB PS - See y'all next week at EUP From thomasl_erlang@REDACTED Thu Nov 1 20:32:14 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 1 Nov 2007 12:32:14 -0700 (PDT) Subject: [erlang-questions] program: eburg, an iburg-style code generator generator In-Reply-To: Message-ID: <862206.46835.qm@web38813.mail.mud.yahoo.com> --- Jakob Sievers wrote: > Ahoy! > Since a burg-clone was the only major compiler tool > not yet available > for Erlang, I figured I'd implement one. Excellent! I'll have a look. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From hughperkins@REDACTED Thu Nov 1 20:39:27 2007 From: hughperkins@REDACTED (Hugh Perkins) Date: Thu, 1 Nov 2007 20:39:27 +0100 Subject: [erlang-questions] Instant Erlang? In-Reply-To: References: Message-ID: <837db430711011239t17a52bc4h5b13da93cc713cb1@mail.gmail.com> Otherwise there's always Vmware and Softricity :-D From csanto@REDACTED Fri Nov 2 00:21:20 2007 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 02 Nov 2007 00:21:20 +0100 Subject: [erlang-questions] how: problems running wings3D Message-ID: <472A5F70.9000104@diit.unict.it> Hi all, I've downloaded the latest version of wings3D. After compiling it, I've tried to run it, but this is what I've got: corrado@REDACTED:~/software/packages/erlang/wings-0.98.36$ erl -pa ebin -run wings_start start_halt Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] {"init terminating in do_boot",{function_clause,[{filename,join,[{error,bad_name},"patches"]},{wings_start,get_patches,0},{wings_start,common_start,1},{init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () Any hint??? Thanks, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From bjt@REDACTED Fri Nov 2 01:19:16 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Fri, 02 Nov 2007 11:19:16 +1100 Subject: [erlang-questions] Erlang "jar" file? In-Reply-To: <18217.40772.393299.540435@cors.corelatus.se> References: <13501250.post@talk.nabble.com> <4728FDA5.9020301@pmp.com.au> <18217.40772.393299.540435@cors.corelatus.se> Message-ID: <472A6D04.6020803@pmp.com.au> Matthias Lang wrote: > If it's that important, you can always go back to the future and use > the hacked R9B version: > > http://www.sics.se/~joe/sae.html > > The download still works, so there's a reasonable chance the whole shebang > will still work, at least on the *nixes. > And miss out on the improvements & support that comes with the latest version of Erlang? *laugh* Even if I could convince myself it was worth it (which, given the fact I evangelize the SMP & concurrency tie-in of Erlang alot, is a hard task), I doubt I could make it fly with management as soon as it comes out it is soon to be THREE major versions behind. Funnily enough, the source for Erlang/OTP still has remenants of the SAE code lying around. I never got an answer from the "Powers That Be" (i.e. core Erlang developers) as to whether this is just waiting on being cleaned out or whether it is there for later incorporation/improvement... I am assuming the former but would be pleasantly surprised if it were the latter. Regards, B.J.Tolputt From robi123@REDACTED Fri Nov 2 04:25:50 2007 From: robi123@REDACTED (Robin Bhattacharyya) Date: Thu, 1 Nov 2007 20:25:50 -0700 Subject: [erlang-questions] mnesia and escript? Message-ID: <4e6744df0711012025s5c876337x18feca5a45f51354@mail.gmail.com> I read the mnesia manual and no where could I find a way to specify the mnesia dir programatically. I understand that you can execute "erl -mnesia dir "/ldisc/scratch/Mnesia.Company" to set the mnesia dir, but is there a way to do this from an escript? From mogorman@REDACTED Fri Nov 2 04:51:37 2007 From: mogorman@REDACTED (Matthew O'Gorman) Date: Thu, 1 Nov 2007 22:51:37 -0500 Subject: [erlang-questions] mnesia and escript? In-Reply-To: <4e6744df0711012025s5c876337x18feca5a45f51354@mail.gmail.com> References: <4e6744df0711012025s5c876337x18feca5a45f51354@mail.gmail.com> Message-ID: application:set_env(mnesia, dir, Dir); should work i think right? mog On 11/1/07, Robin Bhattacharyya wrote: > I read the mnesia manual and no where could I find a way to specify > the mnesia dir programatically. I understand that you can execute > "erl -mnesia dir "/ldisc/scratch/Mnesia.Company" to set the mnesia > dir, but is there a way to do this from an escript? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From yerl@REDACTED Fri Nov 2 10:22:53 2007 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 2 Nov 2007 10:22:53 +0100 Subject: [erlang-questions] how: problems running wings3D Message-ID: Hi ! Have a look to the following shell scripts: o Install Wings3D : http://yhafri.club.fr/crux/wings/Pkgfile http://yhafri.club.fr/crux/wings/wings-0.98.36.patch o Start Wings3D : http://yhafri.club.fr/crux/wings/wings cheers Y. ----Message d'origine---- >Date: Fri, 02 Nov 2007 00:21:20 +0100 >De: Corrado Santoro >A: erlang-questions@REDACTED >Sujet: [erlang-questions] how: problems running wings3D > > > >Hi all, > >I've downloaded the latest version of wings3D. After compiling it, I've >tried to run it, but this is what I've got: > >corrado@REDACTED:~/software/packages/erlang/wings-0.98.36$ erl -pa ebin >-run wings_start start_halt > >Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] >[kernel-poll:false] > >{"init terminating in >do_boot",{function_clause,[{filename,join,[{error,bad_name},"patches"]},{wings_start,get_patches,0},{wings_start,common_start,1},{init,start_it,1},{init,start_em,1}]}} > >Crash dump was written to: erl_crash.dump >init terminating in do_boot () > >Any hint??? > >Thanks, >--Corrado > >-- >================================================================== >Eng. Corrado Santoro, Ph.D. >University of Catania - ITALY - Engineering Faculty > >Tel: +39 095 7382380 VoIP: sip:7035@REDACTED > >Personal Home Page: http://www.diit.unict.it/users/csanto > NUXI Home Page: http://nuxi.diit.unict.it >================================================================== > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Fri Nov 2 10:10:17 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 2 Nov 2007 02:10:17 -0700 (PDT) Subject: [erlang-questions] Erlang "jar" file? In-Reply-To: <472A6D04.6020803@pmp.com.au> Message-ID: <784845.78529.qm@web38812.mail.mud.yahoo.com> --- Benjamin Tolputt wrote: > And miss out on the improvements & support that > comes with the latest > version of Erlang? *laugh* Even if I could convince > myself it was worth > it (which, given the fact I evangelize the SMP & > concurrency tie-in of > Erlang alot, is a hard task), I doubt I could make > it fly with > management as soon as it comes out it is soon to be > THREE major versions > behind. If all you need is a way to archive beam files into a single file, then how about something like this: -module(ear). -compile(export_all). %% as an example make_ear(File) -> make_ear(File, code:all_loaded()). %% create ear make_ear(File, Mods) -> Bin = term_to_binary([ beam(Mod) || Mod <- Mods ]), file:write_file(File, Bin). beam({M, preloaded}) -> []; beam({M, F}) -> {ok, B} = file:read_file(F), {M, F, B}. %% load ear load_ear(File) -> {ok, Bin} = file:read_file(File), lists:foreach( fun({M, F, B}) -> io:format("Loading ~p -> ~p\n", [M, code:load_binary(M, F, B)]); ([]) -> ok end, binary_to_term(Bin)). Testing it with "erl -nostick" quickly and successfully saved and loaded all the OTP modules available on startup, as far as I could tell. The ear file is 2.6 MB for 73 modules. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From daniel.kwiecinski@REDACTED Thu Nov 1 12:48:02 2007 From: daniel.kwiecinski@REDACTED (Daniel Kwiecinski) Date: Thu, 1 Nov 2007 11:48:02 +0000 Subject: [erlang-questions] Mnesia is overloaded Message-ID: <958FF358-FDFE-4308-A7E0-826B416DF1E1@gmail.com> Hi erlang list, On 31-Oct-2007::11:10:39 I've started my application. No writes or reads application is doing yet although mnesia is started. (a@REDACTED)1> mnesia:info(). ---> Processes holding locks <--- ---> Processes waiting for locks <--- ---> Participant transactions <--- ---> Coordinator transactions <--- ---> Uncertain transactions <--- ---> Active tables <--- schema : with 1 records occupying 390 words of mem ===> System info in version "4.3.5", debug level = none <=== opt_disc. Directory "/Users/daniello/work/ex-erlang/mnesia_schema" is used. use fallback at restart = false running db nodes = ['a@REDACTED'] stopped db nodes = [] master node tables = [] remote = [] ram_copies = [] disc_copies = [schema] disc_only_copies = [] [{'a@REDACTED',disc_copies}] = [schema] 2 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: [] ok On 1-Nov-2007::09:52:14 lots of warnings appeared in log. It was 330 identical messages (yes time too): =ERROR REPORT==== 1-Nov-2007::09:52:14 === Mnesia('a@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, time_threshold} ...... =ERROR REPORT==== 1-Nov-2007::09:52:14 === Mnesia('a@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, time_threshold} Since then no other messages were written to the log (Current time is 1-Nov-2007::11:46:43) Any ideas on this issue? Thank you in advance. Kind Regards, Daniel Kwiecinski -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Fri Nov 2 16:22:12 2007 From: peter@REDACTED (Peter K Chan) Date: Fri, 2 Nov 2007 16:22:12 +0100 Subject: [erlang-questions] Mnesia is overloaded In-Reply-To: <958FF358-FDFE-4308-A7E0-826B416DF1E1@gmail.com> References: <958FF358-FDFE-4308-A7E0-826B416DF1E1@gmail.com> Message-ID: Did you, by chance, hibernate your computer or put it to sleep? I usually see consecutive warning messages from mnesia after I put my laptop to sleep. In any case, you can search the archive for past discussion on this, but I think the general idea is that this is just a warning and you can ignore it. Peter From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Daniel Kwiecinski Sent: Thursday, November 01, 2007 6:48 AM To: erlang-questions Subject: [erlang-questions] Mnesia is overloaded Hi erlang list, On 31-Oct-2007::11:10:39 I've started my application. No writes or reads application is doing yet although mnesia is started. (a@REDACTED)1> mnesia:info(). ---> Processes holding locks <--- ---> Processes waiting for locks <--- ---> Participant transactions <--- ---> Coordinator transactions <--- ---> Uncertain transactions <--- ---> Active tables <--- schema : with 1 records occupying 390 words of mem ===> System info in version "4.3.5", debug level = none <=== opt_disc. Directory "/Users/daniello/work/ex-erlang/mnesia_schema" is used. use fallback at restart = false running db nodes = ['a@REDACTED'] stopped db nodes = [] master node tables = [] remote = [] ram_copies = [] disc_copies = [schema] disc_only_copies = [] [{'a@REDACTED',disc_copies}] = [schema] 2 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: [] ok On 1-Nov-2007::09:52:14 lots of warnings appeared in log. It was 330 identical messages (yes time too): =ERROR REPORT==== 1-Nov-2007::09:52:14 === Mnesia('a@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, time_threshold} ...... =ERROR REPORT==== 1-Nov-2007::09:52:14 === Mnesia('a@REDACTED'): ** WARNING ** Mnesia is overloaded: {dump_log, time_threshold} Since then no other messages were written to the log (Current time is 1-Nov-2007::11:46:43) Any ideas on this issue? Thank you in advance. Kind Regards, Daniel Kwiecinski -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsuraan@REDACTED Fri Nov 2 21:48:43 2007 From: tsuraan@REDACTED (tsuraan) Date: Fri, 2 Nov 2007 15:48:43 -0500 Subject: [erlang-questions] video: announce In-Reply-To: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> References: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> Message-ID: <84fb38e30711021348l632250cdg869e9d24a042d44b@mail.gmail.com> Is this available in any actual video format, or only as an MS plug-in? The replies make it sound interesting, but MS hasn't released Silverlight for any computer I own... On 29/10/2007, Joe Armstrong wrote: > > http://channel9.msdn.com/ShowPost.aspx?PostID=351659#351659 > > :-) > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Fri Nov 2 23:49:43 2007 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Fri, 2 Nov 2007 23:49:43 +0100 Subject: [erlang-questions] beginner: how: problems with starting an application that uses a utility application like stdlib Message-ID: Hi. I have created my own little utility application util-0.1 which has simple Erlang modules for doing logging (they are implemented as gen_event handlers - nothing fancy). I have an application my_app-0.1 which creates an event manager and then uses the two modules from util-0.1 to do logging to either screen or file. My problem is that I have to start util before I can start my_app like this: 1> application:start(util). 2> application:start(my_app). When I do the simple thing it looks like this: 1> application:start(my_app) {error, {not_started,util}} To the best of my knowledge my util-0.1 application should be exactly like stdlib, but I never get complaints about stdlib not being started when I start something up. Cheers, Torben -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Fri Nov 2 23:58:50 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 2 Nov 2007 16:58:50 -0600 Subject: [erlang-questions] widefinder analysis Message-ID: Hi After spending to much time on the widefinder problem I thought I should make a summary of the situation and try to get some help from help from VM and CPU gurus to figure out why it does not scale up properly with increasing number of CPU cores. The discussion here will be about my wfinder8.erl, that is attached, for anyone to test it. I would love to get some results from machines with more than 2 cores, and preferably some that are not XEON 4 or 8 cores. The basic algorithm ------------------------------- The main process just checks the number of scheduler threads, and the size of the file. It then starts one worker process for each scheduler thread assigning it a part of the file to process. Then it just waits for the results from the workers. Each worker process 1- opens the file 2- reads a block of 200 k bytes 3- start a new sub worker process that processes the block 4- reads the next block 5- wait for the sub worker to terminate 6- goto 3 Intuitively this feel like a reasonable way to solve the problem. But the results do not fit my intuition :) Results ------- I have tested this on 3 different machines 1- my 1.66 GHz dual core centrino laptop 2- Caoyuan's 4-core XEON 3- Steve Vinoski's 8-core XEON An earlier version has been tried by Tim Bray on a Sun T2150. I have asked him to test the latest one too but I do not have any results yet. My laptop, 1.66GHz dual core centrino ------------------------------------- 1million lines schedulers real user sys total total/real 1 1.731 1.588 0.132 1.72000 0.994 (1) 2 0.977 1.612 0.180 1.79200 1.83 (2) (1) total/real ~1, ;I take that to mean that I get 100% CPU usage, on one core. (2) total/real 1.83, ideally this should be 2, so we are not utilizing the CPU to the max. But I suppose that it is OK since the OS and other stuff on the machine must get some CPU time also. I run OpenSuSE 10.3/KDE and it seems to idle at ~5% cpu load. Speedup from 1 to 2 schedulers 1.77, not too bad. Different file sizes Real Time (s) Speedup Throughput MB/s Lines Bytes 1 sched 2 sched 1 sched 2 sched 10k 2M 0.169 0.167 1.01 11.83 11.97 100k 20M 0.305 0.240 1.27 65.57 83.33 1M 192M 1.643 0.999 1.64 116.86 192.19 2M 384M 3.235 1.888 1.71 118.70 203.39 4M 767M 6.118 3.269 1.87 125.37 234.63 So it seems like the constant time for running this is ~ 0.165s Caoyuan's 4-CPU Intel Xeon 2.80GHz ---------------------------------- 1million lines schedulers real user sys total total/real 1 1.351 1.128 0.224 1.352 1.00 2 0.836 1.336 0.208 1.544 1.85 (1) 4 0.796 2.156 0.468 2.624 3.30 (2) (1) The CPU utilization should be closer to two, since there are free cpus/cores for other tasks on the machine. (2) Two thing to take note of here. 1, The user and system times have increased significantly. 2, The CPU utilization is way to low. Speedup from 1 to 2 schedulers 1.62, Similar to my laptop 2 to 4 schedulers 1.05, Pathetic!! 1 to 4 schedulers 1.70 Not to impressive So why does it not perform better? We will see more of this below in the section about the 8 core XEON. Different file sizes File Size Real Time (s) Speedup Throughput MB/s Lines Bytes 1 sched 2 sched 4 sched 1-2 2-4 1 sched 2 sched 4 sched 10k 2M 0.150 0.149 0.148 1.00 1.00 13.33 13.42 13.51 1M 192M 1.351 0.836 0.796 1.62 1.05 142.12 229.66 241.20 5M 926M 5.742 3.559 3.512 1.61 1.01 161.27 260.18 263.67 Steve's 8-core XEON ------------------- Dual 2.33 GHz Intel Xeon (8 cores total) with 8 GB of RAM, a load average of 0.04, running RedHat Enterprise Linux 4. Erlang is R11B-5. 1,167,948 lines schedulers real user sys total total/real 1 1.277 1.049 0.243 1.292 1.01 2 1.124 1.795 0.334 2.129 1.89 (1) 4 0.810 1.936 0.759 2.695 3.33 8 0.724 2.429 1.402 3.831 5.29 (1) Again a large increases in user and system times, this time for each increase in schedulers. Does the fact that it is a dual CPU machine explain why the user and sys times increase so much when increasing the number of schedulers? Speedup from 1 to 2 schedulers 1.14 2 to 4 schedulers 1.38 4 to 8 schedulers 1.12 1 to 4 schedulers 1.58 1 to 8 schedulers 1.76 Different file sizes File Size Real Time (s) Throughput MB/s Lines Bytes 8 sched 8 sched 10L 2M 0.135 14.81 1M 225M 0.64 351.56 2M 450M 1.017 442.48 4M 900M 1.732 519.63 8M 1800M 3.183 565.50 16M 3600M 5.998 600.20 This machine really gets going when the files grows. Tim's Sun T2150 --------------- This is based on Sun's new Niagara T2 processor 8 cores 2 integer units/core 8 threads/core 1 4 MB L2 cache Solaris and erlang sees this as an 64 processor machine. This data is for a different version of my program. The test was using a file with 4,625,236 lines 971,538,252 bytes real user system total total/real 6.46 34.07 8.02 42.09 6.52 File size Throughput MB/s 926M 143 So again it seems like it is not able to use all available CPU cycles. Speculation ----------- The speedup when going from 1 to 2 schedulers on a dual core machine was pretty good, 1.77. But on the 4 or 8 core machines the speedup from 1 to 4(8) cores was only about 1.7-1.78. Which is not very impressive. I really do not know enough about modern CPUs, but I will not let that stop me from making a wild guess. The Boyer-Moore search algorithm used in this case only inspects, on average, every twentieth byte. Is it possible that when there are 4, 8 or more cores sharing one cache, and all cores runs code that only looks at every twentieth byte that we get very poor cache utilization? So to test that I modified wfinder8.erl to count space and newline characters. And on Steve's 8 core machine we got the following speedups with different number of schedulers. cores speedup 1-2 1.08 2-4 1.72 4-8 1.52 1-4 1.86 1-8 2.83 Are there any other things that can explain why it seems to scale so poorly? -------------- next part -------------- A non-text attachment was scrubbed... Name: wfinder8.erl Type: text/x-erlang Size: 6207 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: wfbm4_ets5.erl Type: text/x-erlang Size: 2748 bytes Desc: not available URL: From cyberlync@REDACTED Sat Nov 3 00:50:20 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 2 Nov 2007 15:50:20 -0800 Subject: [erlang-questions] Erlounge Seattle Monday November 5th @ 6:30 Message-ID: A few of us are getting together to drink beer, have a bite and discuss Erlang (In that order) on Monday the 5th of November in Seattle, WA. The venue is Barca, 1510 11th Avenue on Capitol Hill. More info on their site http://www.barcaseattle.com/ From rpettit@REDACTED Sat Nov 3 01:12:29 2007 From: rpettit@REDACTED (Rick Pettit) Date: Fri, 2 Nov 2007 19:12:29 -0500 Subject: [erlang-questions] video: announce In-Reply-To: <84fb38e30711021348l632250cdg869e9d24a042d44b@mail.gmail.com> References: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> <84fb38e30711021348l632250cdg869e9d24a042d44b@mail.gmail.com> Message-ID: <20071103001229.GA1699@vailsys.com> On Fri, Nov 02, 2007 at 03:48:43PM -0500, tsuraan wrote: > Is this available in any actual video format, or only as an MS > plug-in? The replies make it sound interesting, but MS hasn't released > Silverlight for any computer I own... Look for the button labelled "Download"... -Rick > On 29/10/2007, Joe Armstrong wrote: > > > > http://channel9.msdn.com/ShowPost.aspx?PostID=351659#351659 > > > > :-) > > > > /Joe > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From anders.nygren@REDACTED Sat Nov 3 01:42:13 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 2 Nov 2007 18:42:13 -0600 Subject: [erlang-questions] widefinder analysis In-Reply-To: References: Message-ID: After a little more thought I think that a more likely explanation of the results on Steve's 8 core is that since it is a dual cpu machine (but with 4 cores/cpu), the cost of locking and synchronization in the VM is so much higher than in a 1-cpu many core machine. So as the size of the files increase the relative cost of the locking overhead decreases and we get some greate results on really l /Anders From anders.nygren@REDACTED Sat Nov 3 01:43:51 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 2 Nov 2007 18:43:51 -0600 Subject: [erlang-questions] widefinder analysis In-Reply-To: References: Message-ID: Ops, sent before ready After a little more thought I think that a more likely explanation of the results on Steve's 8 core is that since it is a dual cpu machine (but with 4 cores/cpu), the cost of locking and synchronization in the VM is so much higher than in a 1-cpu many core machine. So as the size of the files increase the relative cost of the locking overhead decreases and we get some great results on really large files. /Anders From dbyrne@REDACTED Sat Nov 3 01:21:26 2007 From: dbyrne@REDACTED (Dennis Byrne) Date: Fri, 2 Nov 2007 19:21:26 -0500 Subject: [erlang-questions] source code Message-ID: I am having trouble finding the actual repository for the source code found at http://www.erlang.org/download.html . The closest I can find is the repository for the Erlang Enhancement Process ( http://www.erlang.org/svn/projects/eeps/ ). Please advise. ____________________________________________ Dennis Byrne ThoughtWorks - Chicago 312-505-7965 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbyrne@REDACTED Sat Nov 3 02:23:52 2007 From: dbyrne@REDACTED (Dennis Byrne) Date: Fri, 2 Nov 2007 20:23:52 -0500 Subject: [erlang-questions] source code In-Reply-To: Message-ID: Hi Anders, thanks for the response. Are there any plans to change this? Currently I am not interested in changing the core, just Jinterface. Also, how do we submit patches if we cannot run a diff on our work? BTW, what is used for version control? ____________________________________________ Dennis Byrne ThoughtWorks - Chicago 312-505-7965 "Anders Nygren" wrote on 11/02/2007 08:09:01 PM: > On Nov 2, 2007 6:21 PM, Dennis Byrne wrote: > > > > I am having trouble finding the actual repository for the source code found > > at http://www.erlang.org/download.html . The closest I can find is the > > repository for the Erlang Enhancement Process ( > > http://www.erlang.org/svn/projects/eeps/ ). > > > > There is currently no public repository for erlang. The development is > done internally > in Ericsson. > > /Anders -------------- next part -------------- An HTML attachment was scrubbed... URL: From tsuraan@REDACTED Sat Nov 3 03:47:05 2007 From: tsuraan@REDACTED (tsuraan) Date: Fri, 2 Nov 2007 21:47:05 -0500 Subject: [erlang-questions] video: announce In-Reply-To: <20071103001229.GA1699@vailsys.com> References: <9b08084c0710291443x4d61eb82k6233098f684260be@mail.gmail.com> <84fb38e30711021348l632250cdg869e9d24a042d44b@mail.gmail.com> <20071103001229.GA1699@vailsys.com> Message-ID: <84fb38e30711021947h5d7eb28btc7198e7ceb5ebcd2@mail.gmail.com> > Look for the button labelled "Download"... Wow, what a crazy idea :) And somehow, konqueror is playing a wmv. I wonder when that happened. From lcoquelle@REDACTED Sat Nov 3 03:53:57 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Sat, 3 Nov 2007 10:53:57 +0800 Subject: [erlang-questions] EUnit fixture: return of Setup Message-ID: I have some problem with the EUnit fixture {setup, Setup, Clearup, Instanciator}. >From the doc, I understand that the Instanciator should get the value return by the Setup. But in the following case, the test fail because assertion is "undefined == foo". Am I missing something? (EUnit version that I'm using is from SVN http://svn.process-one.net/contribs/trunk/eunit) simple_init() -> foo. simple_close(R) -> R. simple_do(R) -> ?assert(R == foo). simple_test_() -> { setup, fun simple_init/0, fun simple_close/1, fun simple_do/1 }. -------------- next part -------------- An HTML attachment was scrubbed... URL: From drcabana@REDACTED Sat Nov 3 04:47:35 2007 From: drcabana@REDACTED (David Cabana) Date: Fri, 2 Nov 2007 23:47:35 -0400 Subject: [erlang-questions] Emacs Erlang-mode peculiarity Message-ID: <44ed5e0f0711022047n4d3539fdw6ef7accabe8e87c1@mail.gmail.com> I noticed tonight that I cannot use the letter "C" while in the Erlang Shell provided by the Emacs Erlang mode in response to C-c C-z. The upper case "C" seems to be interpreted as some type of command. Using C-h k to get help on "C" results in C- displaying in the minibuffer, as the help system waits for me to type another character, say s, whereupon I am informed that C s is undefined. My first guess was that I had botched something in my .emacs file, but I noticed this happens on both windows (GNU Emacs 22.0.990.1 ( i386-mingw-nt5.1.2600)) and on OS X (current version of Aquamacs). Has anyone else encountered this? It seems ridiculous to be unable to use the character "C". -------------- next part -------------- An HTML attachment was scrubbed... URL: From mogorman@REDACTED Sat Nov 3 05:23:06 2007 From: mogorman@REDACTED (Matthew O'Gorman) Date: Fri, 2 Nov 2007 23:23:06 -0500 Subject: [erlang-questions] Emacs Erlang-mode peculiarity In-Reply-To: <44ed5e0f0711022047n4d3539fdw6ef7accabe8e87c1@mail.gmail.com> References: <44ed5e0f0711022047n4d3539fdw6ef7accabe8e87c1@mail.gmail.com> Message-ID: i am unable to repeat with emacs 22 and r11b5 mog On 11/2/07, David Cabana wrote: > I noticed tonight that I cannot use the letter "C" while in the Erlang Shell > provided by the Emacs Erlang mode in response to C-c C-z. > > The upper case "C" seems to be interpreted as some type of command. Using > C-h k to get help on "C" results in C- displaying in the minibuffer, as the > help system waits for me to type another character, say s, whereupon I am > informed that C s is undefined. > > My first guess was that I had botched something in my .emacs file, but I > noticed this happens on both windows (GNU Emacs 22.0.990.1 > (i386-mingw-nt5.1.2600)) and on OS X (current version of Aquamacs). > > Has anyone else encountered this? It seems ridiculous to be unable to use > the character "C". > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From matthias@REDACTED Sat Nov 3 08:56:55 2007 From: matthias@REDACTED (Matthias Lang) Date: Sat, 3 Nov 2007 08:56:55 +0100 Subject: [erlang-questions] source code In-Reply-To: References: Message-ID: <18220.10695.971051.744306@cors.corelatus.se> Anders > > There is currently no public repository for erlang. Anders > > The development is done internally in Ericsson Dennis > Are there any plans to change this? Currently I am not Dennis > interested in changing the core, just Jinterface. >From the FAQ: | 3.7. Is there a public CVS server for Erlang? | | The Jungerl is a public CVS server which provides access to more than | fifty Erlang contributions, including an SSH client and the Erlang | wiki. | | Apart from the Jungerl, there is a score of Erlang-based projects on | sourceforge. | | The source to the VM and OTP libraries is currently not available from | a public CVS server. Since full source is freely downloadable, it | would be feasible for someone to maintain such a server and keep it in | sync with official releases from the OTP group. So far, nobody has | felt their need for CVS was large enough to justify the amount of work | required. The OTP group does not provide such a server because they | use clearcase for version control. Marrying clearcase with CVS is | not easy. | http://www.erlang.org/faq/faq.html > Also, how do we submit patches if we cannot run a diff on our work? BTW, > what is used for version control? You run diff against whatever version you changed. And then you post the patch on erlang-questions or erlang-bugs, the former in the case of new development, the latter in the case of fixes. And then you wait with the patience of a saint. Matt From richardc@REDACTED Sat Nov 3 13:08:05 2007 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 03 Nov 2007 13:08:05 +0100 Subject: [erlang-questions] EUnit fixture: return of Setup In-Reply-To: References: Message-ID: <472C64A5.1010906@it.uu.se> Ludovic Coquelle wrote: > I have some problem with the EUnit fixture {setup, Setup, Clearup, > Instanciator}. > > From the doc, I understand that the Instanciator should get the value > return by the Setup. > But in the following case, the test fail because assertion is "undefined > == foo". > Am I missing something? > > simple_init() -> > foo. > simple_close(R) -> > R. > simple_do(R) -> > ?assert(R == foo). > simple_test_() -> > { > setup, > fun simple_init/0, > fun simple_close/1, > fun simple_do/1 > }. It does get the value from Setup during the test phase, but there is a previous phase which tries to enumerate the tests, and that will pass a dummy value ('undefined') to avoid actually running the setup. Note that the name of your 'simple_do/1' function is misleading: since it takes a parameter, EUnit assumes that it is (as you said) an instantiator which should get the value from simple_init/0, and should *return a test descriptor*, not try to run a test. If you try the following, you will see what is happening: simple_do(R) -> eunit:debug(R), ?_assert(R == foo). % note the underscore: return test, don't run it (simple_do/1 is run twice - the first time with R='undefined'). Although EUnit is powerful and compact to write, I know that it can be hard to keep in mind whether you should currently be writing test-running code of test-generating code. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From paul-trapexit@REDACTED Sat Nov 3 16:02:55 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sat, 3 Nov 2007 08:02:55 -0700 (PDT) Subject: [erlang-questions] beginner: mnesia dynamic fragment distribution balancing Message-ID: hi. i want to set up a fragmented table across a set of nodes with dynamic membership, and basically maintain a balanced use of resources while respecting the creation parameters (e.g. n_disc_copies). it appears mnesia initially balances the fragments across the set of nodes at create time but then you are "on your own" as the node pool changes. i can see how to do this manually by inspecting the table (and each fragment) with mnesia:table_info/2, and then taking ownership of a replica with mnesia:add_table_copy/3 and mnesia:del_table_copy/2 as necessary to achieve balance. two questions: 1) has somebody done this already? i don't want to reinvent the wheel. 2) if not, i want to handle the case where multiple nodes are joining and/or leaving at the same time. can i serialize this activity using transaction constructs or should i create a (global) process to synchronize all this activity through? thanks, -- p Optimism is an essential ingredient of innovation. How else can the individual favor change over security? -- Robert Noyce From anders.nygren@REDACTED Sat Nov 3 16:13:02 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Sat, 3 Nov 2007 09:13:02 -0600 Subject: [erlang-questions] wfinder8 on the T2150 Message-ID: Tim has now sent me the results of running my wfinder8 on the T2150. Here is a summary of the data. This is based on Sun's new Niagara T2 processor 8 cores 2 integer units/core 8 threads/core 1 4 MB L2 cache Solaris and erlang sees this as an 64 processor machine. schedulers real user sys total total/real 1 36.108 31.174 4.720 35.894 0.99 2 18.884 31.576 4.826 36.403 1.93 4 10.502 33.026 5.124 38.150 3.63 8 6.394 34.943 5.494 40.437 6.32 16 4.741 38.479 7.404 45.883 9.68 (1) 32 4.420 46.277 12.267 58.544 13.25 (1) 64 4.447 56.132 18.923 75.055 16.88 (1) 128 6.018 2:20.710 24.746 165.456 27.49 (1) (1) When there are more than 8 threads/processes in run state the CPU is not able to correctly track the actual running time. Speedup 1-2 1.91 2-4 1.80 4-8 1.64 8-16 1.35 16-32 1.07 32-64 0.99 64-128 0.74 1-2 1.91 1-4 3.44 1-8 5.65 1-16 7.61 1-32 8.17 1-64 8.12 1-128 6.00 So we get a maximum speedup of a factor 8. And erlang is only 0.04 seconds slower than a Python program that uses separate OS processes to get around the Python global interpreter lock and mmap. And of course that 0.04 seconds is well within variation from run to run. /Anders From lcoquelle@REDACTED Sat Nov 3 16:21:51 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Sat, 3 Nov 2007 23:21:51 +0800 Subject: [erlang-questions] EUnit fixture: return of Setup In-Reply-To: <472C64A5.1010906@it.uu.se> References: <472C64A5.1010906@it.uu.se> Message-ID: I'm discovering that EUnit is really powerful. I'll be more careful next time with test generation/run function. Thanks. On 11/3/07, Richard Carlsson wrote: > > Ludovic Coquelle wrote: > > I have some problem with the EUnit fixture {setup, Setup, Clearup, > > Instanciator}. > > > > From the doc, I understand that the Instanciator should get the value > > return by the Setup. > > But in the following case, the test fail because assertion is "undefined > > == foo". > > Am I missing something? > > > > simple_init() -> > > foo. > > simple_close(R) -> > > R. > > simple_do(R) -> > > ?assert(R == foo). > > simple_test_() -> > > { > > setup, > > fun simple_init/0, > > fun simple_close/1, > > fun simple_do/1 > > }. > > It does get the value from Setup during the test phase, but there is a > previous phase which tries to enumerate the tests, and that will pass > a dummy value ('undefined') to avoid actually running the setup. > > Note that the name of your 'simple_do/1' function is misleading: since > it takes a parameter, EUnit assumes that it is (as you said) an > instantiator which should get the value from simple_init/0, and should > *return a test descriptor*, not try to run a test. > > If you try the following, you will see what is happening: > > simple_do(R) -> > eunit:debug(R), > ?_assert(R == foo). % note the underscore: return test, don't run it > > (simple_do/1 is run twice - the first time with R='undefined'). > > Although EUnit is powerful and compact to write, I know that it > can be hard to keep in mind whether you should currently be writing > test-running code of test-generating code. > > /Richard > > > -- > "Having users is like optimization: the wise course is to delay it." > -- Paul Graham > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robi123@REDACTED Sat Nov 3 16:59:54 2007 From: robi123@REDACTED (Robin Bhattacharyya) Date: Sat, 3 Nov 2007 08:59:54 -0700 Subject: [erlang-questions] name and sname in escript Message-ID: <4e6744df0711030859v6c4b67d9ga12bb52627a75934@mail.gmail.com> In order to call erlang:set_cookie(node(), abc), you need to have specified -name or -sname. How do you you specify -name and -sname programatically from an escript? From anders.nygren@REDACTED Sat Nov 3 17:25:31 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Sat, 3 Nov 2007 10:25:31 -0600 Subject: [erlang-questions] name and sname in escript In-Reply-To: <4e6744df0711030859v6c4b67d9ga12bb52627a75934@mail.gmail.com> References: <4e6744df0711030859v6c4b67d9ga12bb52627a75934@mail.gmail.com> Message-ID: On Nov 3, 2007 9:59 AM, Robin Bhattacharyya wrote: > In order to call erlang:set_cookie(node(), abc), you need to have > specified -name or -sname. > > How do you you specify -name and -sname programatically from an escript? I have not tried it myself but I think net_kernel:start is what You want /Anders From michael.campbell@REDACTED Sat Nov 3 19:03:44 2007 From: michael.campbell@REDACTED (Michael Campbell) Date: Sat, 3 Nov 2007 14:03:44 -0400 Subject: [erlang-questions] Emacs Erlang-mode peculiarity In-Reply-To: References: <44ed5e0f0711022047n4d3539fdw6ef7accabe8e87c1@mail.gmail.com> Message-ID: <811f2f1c0711031103k7097caedyb4f536b15e139019@mail.gmail.com> On Nov 3, 2007 12:23 AM, Matthew O'Gorman wrote: > i am unable to repeat with emacs 22 and r11b5 > > mog Nor me; GNU Emacs 23.0.0.1 (i386-mingw-nt5.1.2600) of 2007-01-01 on DTOP (Windows), r11b5. Tried C-c C-z, got the Erlang shell buffer, then... Eshell V5.5.5 (abort with ^G) 1> C. ** 1: variable 'C' is unbound ** From drcabana@REDACTED Sat Nov 3 19:44:01 2007 From: drcabana@REDACTED (David Cabana) Date: Sat, 3 Nov 2007 14:44:01 -0400 Subject: [erlang-questions] Emacs Erlang-mode peculiarity Message-ID: <44ed5e0f0711031144t213f8f97t2e9d7e458922bfbd@mail.gmail.com> I found the source of the problem, some distel configuration code I shared across several machines. Once I commented out these lines, all was well. ;; A number of the erlang-extended-mode key bindings are useful in the shell too ;; (defconst distel-shell-keys ;; '(("C-M-i" erl-complete) ;; ("M-?" erl-complete) ;; ("M-." erl-find-source-under-point) ;; ("M-," erl-find-source-unwind) ;; ("M-*" erl-find-source-unwind) ;; ) ;; "Additional keys to bind when in Erlang shell.") ;; (add-hook 'erlang-shell-mode-hook ;; (lambda () ;; ;; add some Distel bindings to the Erlang shell ;; (dolist (spec distel-shell-keys) ;; (define-key erlang-shell-mode-map (car spec) (cadr spec)))) ;; ) When I get a chance I take a look at Lauri's suggestion, to see whether I can fix the problem more gracefully. Thanks to everyone for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From qrilka@REDACTED Sat Nov 3 20:28:21 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Sat, 3 Nov 2007 22:28:21 +0300 Subject: [erlang-questions] Emacs Erlang-mode peculiarity In-Reply-To: <44ed5e0f0711031144t213f8f97t2e9d7e458922bfbd@mail.gmail.com> References: <44ed5e0f0711031144t213f8f97t2e9d7e458922bfbd@mail.gmail.com> Message-ID: <337538cb0711031228o19387d68p3742db6fdca3a293@mail.gmail.com> Probably you've got this snippet from Bill Clementson's blogpost, that was discussed in the maillist some months before, you should escape emacs metacharacters and so e.g.: ("M-?" erl-complete) becomes: ("\M-?" erl-complete) Best regards, Kirill. On 11/3/07, David Cabana wrote: > > I found the source of the problem, some distel configuration code I shared > across several machines. Once I commented out these lines, all was well. > > ;; A number of the erlang-extended-mode key bindings are useful in the > shell too > ;; (defconst distel-shell-keys > ;; '(("C-M-i" erl-complete) > ;; ("M-?" erl-complete) > ;; ("M-." erl-find-source-under-point) > ;; ("M-," erl-find-source-unwind) > ;; ("M-*" erl-find-source-unwind) > ;; ) > ;; "Additional keys to bind when in Erlang shell.") > > ;; (add-hook 'erlang-shell-mode-hook > ;; (lambda () > ;; ;; add some Distel bindings to the Erlang shell > ;; (dolist (spec distel-shell-keys) > ;; (define-key erlang-shell-mode-map (car spec) (cadr spec)))) > ;; ) > > When I get a chance I take a look at Lauri's suggestion, to see whether I > can fix the problem more gracefully. Thanks to everyone for your help. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From billclem@REDACTED Sun Nov 4 00:17:35 2007 From: billclem@REDACTED (Bill Clementson) Date: Sat, 03 Nov 2007 16:17:35 -0700 Subject: [erlang-questions] Emacs Erlang-mode peculiarity References: <44ed5e0f0711031144t213f8f97t2e9d7e458922bfbd@mail.gmail.com> <337538cb0711031228o19387d68p3742db6fdca3a293@mail.gmail.com> Message-ID: "Kirill Zaborski" writes: > Probably you've got this snippet from Bill Clementson's blogpost, that was discussed in the maillist some months before, you should escape emacs > metacharacters and so e.g.: > ("M-?" erl-complete) > becomes: > ("\M-?" erl-complete) Yes, in my original blog post, I forgot to "escape" the backslash characters in the code (which meant that they didn't appear in the html). I have since corrected the post: http://bc.tech.coop/blog/070528.html Sorry for any hassles this has caused. -- Bill Clementson From blblack@REDACTED Sun Nov 4 00:37:29 2007 From: blblack@REDACTED (Brandon Black) Date: Sat, 3 Nov 2007 18:37:29 -0500 Subject: [erlang-questions] Random newbie stuff Message-ID: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> Hi, I'm new to Erlang and to FP in general, but I have a fair amount of experience in various non-FP languages. I've gotten about halfway through "Programming Erlang" so far (and skipped ahead on a few things), and I've got some questions I hope someone can answer... 1) "Inheritance" Forgetting for a moment OO <-> Erlang holy wars and battles about syntax and semantics, in a practical sense, is there any way to inherit code for re-use in Erlang? I can imagine many scenarios where it would be useful, here's a concrete one for example: Suppose one were writing an Erlang module that parsed list comprehension syntax and converted it into some sort of SQL equivalent as part of an Erlang <-> RDBMS interface. My first instinct (thinking in regular OO terms) would be to write a well-structured module with a only a few public functions exported, with many little private functions involved in the generation of ANSI-standard SQL92. Then I would write another module for each of the vendor dialects I was going to support. These would inherit/import/whatever most of the functionality from the base SQL92 module, and override a few key small "private" functions here and there to work around that vendor's quirks. Since there is no apparent concept of things like classes and inheritance, how does one accomplish this sort of code reuse? Do I have to export all of the guts in the base module, and then provide explicit stubs to call all of them from the upper-layer module? 2) State Mutability... How important is it to maintain immutable state? Are there classes of problems (classes of applications) which cannot be built without mutable state (for which one would use process dicts or [d]ets)? Does an external interface to a relational database (or even mnesia) "count" as mutable state, or is that ok since it's not in my Erlang? Does the previous answer change depending whether my code makes decisions based on state from the database (like case statements on variables that were populated via a SQL call)? If I decide an app needs mutable state somewhere, what's the fallout (can't be analyzed / proven by some tools that actually exist? Just more difficult to debug?). I keep turning this "mutable state" thing over and over in my head and getting nowhere. These are the kinds of things going through my head: The outside world is full of mutable state. Does that mean that any code with real inputs has mutable state by definition? Input is technically mutable state is it not? If I had an Erlang-based web server which takes different code paths depending on http inputs it loops on, does this not make for mutable state? It would seem that if you take that sort of ultra-conservative view, then the only software one can write that's completely free of mutable state would be one with no inputs (like say, an application that just generates digits of Pi). -- Brandon From dbyrne@REDACTED Sun Nov 4 02:02:45 2007 From: dbyrne@REDACTED (Dennis Byrne) Date: Sat, 3 Nov 2007 20:02:45 -0500 Subject: [erlang-questions] Random newbie stuff In-Reply-To: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> Message-ID: Here are some answers to #2. http://notdennisbyrne.blogspot.com/2007/10/psst-erlang-has-mutable-state.html In short, mutable state limits how concurrent the application can be. ____________________________________________ Dennis Byrne ThoughtWorks - Chicago 312-505-7965 "Brandon Black" Sent by: erlang-questions-bounces@REDACTED 11/03/2007 06:37 PM To erlang-questions@REDACTED cc Subject [erlang-questions] Random newbie stuff Hi, I'm new to Erlang and to FP in general, but I have a fair amount of experience in various non-FP languages. I've gotten about halfway through "Programming Erlang" so far (and skipped ahead on a few things), and I've got some questions I hope someone can answer... 1) "Inheritance" Forgetting for a moment OO <-> Erlang holy wars and battles about syntax and semantics, in a practical sense, is there any way to inherit code for re-use in Erlang? I can imagine many scenarios where it would be useful, here's a concrete one for example: Suppose one were writing an Erlang module that parsed list comprehension syntax and converted it into some sort of SQL equivalent as part of an Erlang <-> RDBMS interface. My first instinct (thinking in regular OO terms) would be to write a well-structured module with a only a few public functions exported, with many little private functions involved in the generation of ANSI-standard SQL92. Then I would write another module for each of the vendor dialects I was going to support. These would inherit/import/whatever most of the functionality from the base SQL92 module, and override a few key small "private" functions here and there to work around that vendor's quirks. Since there is no apparent concept of things like classes and inheritance, how does one accomplish this sort of code reuse? Do I have to export all of the guts in the base module, and then provide explicit stubs to call all of them from the upper-layer module? 2) State Mutability... How important is it to maintain immutable state? Are there classes of problems (classes of applications) which cannot be built without mutable state (for which one would use process dicts or [d]ets)? Does an external interface to a relational database (or even mnesia) "count" as mutable state, or is that ok since it's not in my Erlang? Does the previous answer change depending whether my code makes decisions based on state from the database (like case statements on variables that were populated via a SQL call)? If I decide an app needs mutable state somewhere, what's the fallout (can't be analyzed / proven by some tools that actually exist? Just more difficult to debug?). I keep turning this "mutable state" thing over and over in my head and getting nowhere. These are the kinds of things going through my head: The outside world is full of mutable state. Does that mean that any code with real inputs has mutable state by definition? Input is technically mutable state is it not? If I had an Erlang-based web server which takes different code paths depending on http inputs it loops on, does this not make for mutable state? It would seem that if you take that sort of ultra-conservative view, then the only software one can write that's completely free of mutable state would be one with no inputs (like say, an application that just generates digits of Pi). -- Brandon _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Sun Nov 4 02:33:17 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Sun, 4 Nov 2007 01:33:17 +0000 Subject: [erlang-questions] beginner: how: problems with starting an application that uses a utility application like stdlib In-Reply-To: References: Message-ID: On 02/11/2007, Torben Hoffmann wrote: > Hi. > > I have created my own little utility application util-0.1 which has simple > Erlang modules for doing logging (they are implemented as gen_event handlers > - nothing fancy). > > I have an application my_app-0.1 which creates an event manager and then > uses the two modules from util-0.1 to do logging to either screen or file. > > My problem is that I have to start util before I can start my_app like this: > > 1> application:start(util). > 2> application:start(my_app). > > When I do the simple thing it looks like this: > 1> application:start(my_app) > {error, {not_started,util}} > > To the best of my knowledge my util-0.1 application should be exactly like > stdlib, but I never get complaints about stdlib not being started when I > start something up. > Whenever you start an erlang node, it starts up applications in an order as specified in a .boot file. By default, it is a file called start.boot (do a find under your erlang installation and you will see it). The .boot file is nothing but an erlang term converted to a binary (see below). The default start.boot has the applications kernel, sasl and stdlib. That is why you never see complaints about stdlib not being started. If you want your own applications automatically started, you have to create your own boot file. The systools module has functions to help you do that. cheers Chandru 3> {ok, Bin} = file:read_file("releases/R10B/start.boot"). {ok,<<131,104,3,100,0,6,115,99,114,105,112,116,104,2,107,0,15,79,84,80,32,32,65,80,78,32,49,...>>} 4> binary_to_term(Bin). {script,{"OTP APN 181 01","R10B"}, [{preLoaded,[erlang, erl_prim_loader, prim_file, prim_inet, init, otp_ring0]}, {progress,preloaded}, {path,["$ROOT/lib/kernel-2.10.6/ebin","$ROOT/lib/stdlib-1.13.5/ebin"]}, {primLoad,[error_handler]}, {kernel_load_completed}, {progress,kernel_load_completed}, {path,["$ROOT/lib/kernel-2.10.6/ebin"]}, {primLoad,[zlib, wrap_log_reader, user_sup, user_drv, user, seq_trace, rpc, ram_file, pg2, packages, os, old_file_server, net_kernel, net_adm, net|...]}, {path,["$ROOT/lib/stdlib-1.13.5/ebin"]}, {primLoad,[win32reg, timer, sys, supervisor_bridge, supervisor, string, sofs, slave, shell_default, shell, sets, regexp, random|...]}, {progress,modules_loaded}, {path,["$ROOT/lib/kernel-2.10.6/ebin","$ROOT/lib/stdlib-1.13.5/ebin"]}, {kernelProcess,heart,{heart,start,[]}}, {kernelProcess,error_logger,{error_logger,start_link,[]}}, {kernelProcess,application_controller, {application_controller, start, [{application|...}]}}, {progress,init_kernel_started}, {apply,{application,load,[{application,stdlib|...}]}}, {progress,applications_loaded}, {apply,{application,start_boot,[kernel|...]}}, {apply,{application,start_boot,[...]}}, {apply,{c,erlangrc|...}}, {progress,started}]} From paul-trapexit@REDACTED Sun Nov 4 02:40:18 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sat, 3 Nov 2007 18:40:18 -0700 (PDT) Subject: [erlang-questions] Random newbie stuff In-Reply-To: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> References: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> Message-ID: Hey Brandon. I am also a beginner. I have noticed how to do the "inheritence" bit, it was one of the first things I figured out since the code reuse story bothered me as well. I have yet to use this strategy for anything real, however, so maybe that indicates it's not such a problem in practice. Anyway you could piece together the following: 1. Erlang supports a Module:foo (Args) syntax, where Module can be a variable that has an atom value. This suggests thinking of a tuple { Module, Implementation } as the run-time representation of something doing inheritence. 2. Erlang allows you to query a module at run-time, a form of reflection, via the (automatically generated) module_info/0 and module_info/1 methods. So you can add annotations like -super ([ foo, bar, baz ]). into your module and you can inspect at run-time. 3. Erlang allows you to totally rewrite the function call resolution strategy by making your own error_handler. So you could create an error_handler which would walk the super list of modules depth-first left-to-right until it found something matching the method being invoked. Now back to the "is this a good idea" question. I think one thing that objects achieve in OO languages is code reuse and I would like to see some nice way of doing more code reuse in Erlang. So maybe this is good for that (although the fact that the arguments cannot be "cast" limits the utility ... reminscent of perl objects' arbitrary implementation strategy). If your goal is "objects as containers of mutable state", I think processes are a better fit, with messages being methods. Mutable state looks naturally like a recursive loop in FP and so fits the Erlang process model nicely. -- p On Sat, 3 Nov 2007, Brandon Black wrote: > Hi, > > I'm new to Erlang and to FP in general, but I have a fair amount of > experience in various non-FP languages. I've gotten about halfway > through "Programming Erlang" so far (and skipped ahead on a few > things), and I've got some questions I hope someone can answer... > > 1) "Inheritance" > > Forgetting for a moment OO <-> Erlang holy wars and battles about > syntax and semantics, in a practical sense, is there any way to > inherit code for re-use in Erlang? I can imagine many scenarios where > it would be useful, here's a concrete one for example: Suppose one > were writing an Erlang module that parsed list comprehension syntax > and converted it into some sort of SQL equivalent as part of an Erlang > <-> RDBMS interface. > > My first instinct (thinking in regular OO terms) would be to write a > well-structured module with a only a few public functions exported, > with many little private functions involved in the generation of > ANSI-standard SQL92. Then I would write another module for each of > the vendor dialects I was going to support. These would > inherit/import/whatever most of the functionality from the base SQL92 > module, and override a few key small "private" functions here and > there to work around that vendor's quirks. > > Since there is no apparent concept of things like classes and > inheritance, how does one accomplish this sort of code reuse? Do I > have to export all of the guts in the base module, and then provide > explicit stubs to call all of them from the upper-layer module? > > 2) State Mutability... > > How important is it to maintain immutable state? Are there classes of > problems (classes of applications) which cannot be built without > mutable state (for which one would use process dicts or [d]ets)? > > Does an external interface to a relational database (or even mnesia) > "count" as mutable state, or is that ok since it's not in my Erlang? > > Does the previous answer change depending whether my code makes > decisions based on state from the database (like case statements on > variables that were populated via a SQL call)? > > If I decide an app needs mutable state somewhere, what's the fallout > (can't be analyzed / proven by some tools that actually exist? Just > more difficult to debug?). > > I keep turning this "mutable state" thing over and over in my head and > getting nowhere. These are the kinds of things going through my head: > The outside world is full of mutable state. Does that mean that any > code with real inputs has mutable state by definition? Input is > technically mutable state is it not? If I had an Erlang-based web > server which takes different code paths depending on http inputs it > loops on, does this not make for mutable state? It would seem that if > you take that sort of ultra-conservative view, then the only software > one can write that's completely free of mutable state would be one > with no inputs (like say, an application that just generates digits of > Pi). > > -- Brandon > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Optimism is an essential ingredient of innovation. How else can the individual favor change over security? -- Robert Noyce From jeremie@REDACTED Sun Nov 4 04:05:08 2007 From: jeremie@REDACTED (=?iso-8859-1?Q?J=E9r=E9mie?= Lumbroso) Date: Sun, 4 Nov 2007 04:05:08 +0100 Subject: [erlang-questions] Managing priority heaps. Message-ID: <20071104030508.GA12622@desktop> Hello, I am trying to write a loop: myloop(Lists, PriorityList) where: * Lists is a tuplet of a number X of lists; * PriorityList is a list of numbers N, such that 1 <= N <= X. [Y|PrioRest] = PriorityList On every call, myloop needs to look at the first element of PriorityList, let that element be Y, and select list Y from the tuplet Lists (i.e.: SelectedList = element(Lists, Y) is called). [Fst|Rest] = SelectedList Then myloop must take the first element Fst of SelectedList, process it, get a new priority number Z, and reinsert the element at the *end* of the list Z. A = setElement(Lists, Y, Rest); B = setElement(A, Z, element(A, Z) ++ [Fst]). Once this operation is done, myloop calls itself: myloop(B, PrioRest ++ [Y]). The whole purpose of this operation is to have several priorities. PriorityList, will, for instance, be equal to [1, 2, 1, 2, 1, 3]. My myloop function is long and convoluted, and has lots of bindings, which is quite hellish to manage. The thing is, I assume this sort of functionality must be quite common in Erlang's field of predilection ... and so I'm wondering if there isn't already some module to do this. Is there? And if not, could you help me? Best Regards, JL From anders.nygren@REDACTED Sun Nov 4 04:24:36 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Sat, 3 Nov 2007 21:24:36 -0600 Subject: [erlang-questions] Managing priority heaps. In-Reply-To: <20071104030508.GA12622@desktop> References: <20071104030508.GA12622@desktop> Message-ID: On Nov 3, 2007 9:05 PM, J?r?mie Lumbroso wrote: > Hello, > > I am trying to write a loop: > > myloop(Lists, PriorityList) > > where: > > * Lists is a tuplet of a number X of lists; > * PriorityList is a list of numbers N, such that 1 <= N <= X. > > [Y|PrioRest] = PriorityList > > On every call, myloop needs to look at the first element of PriorityList, > let that element be Y, and select list Y from the tuplet Lists (i.e.: > SelectedList = element(Lists, Y) is called). > > [Fst|Rest] = SelectedList > > Then myloop must take the first element Fst of SelectedList, process it, > get a new priority number Z, and reinsert the element at the *end* of the > list Z. > > A = setElement(Lists, Y, Rest); > B = setElement(A, Z, element(A, Z) ++ [Fst]). > > Once this operation is done, myloop calls itself: > > myloop(B, PrioRest ++ [Y]). > > The whole purpose of this operation is to have several priorities. > PriorityList, will, for instance, be equal to [1, 2, 1, 2, 1, 3]. > > > My myloop function is long and convoluted, and has lots of bindings, which > is quite hellish to manage. > > The thing is, I assume this sort of functionality must be quite common in > Erlang's field of predilection ... and so I'm wondering if there isn't > already some module to do this. > > Is there? And if not, could you help me? > I dont think there is anything ready made for this, but You can look at two modules in stdlib that can be useful. - queue, obviously queue functions, instead of element(A, Z) ++ [Fst] which gets expensive if the lists are long. - ets, with table type ordered set. to make a priority queue in ets store your entries as {{Prio,now()}, Data}, when You read you get the first inserted, using suitable matching/selection functions. -search the archive, priority queue have been discussed several times before. /Anders From als@REDACTED Sun Nov 4 08:29:03 2007 From: als@REDACTED (Anthony Shipman) Date: Sun, 4 Nov 2007 18:29:03 +1100 Subject: [erlang-questions] Managing priority heaps. In-Reply-To: References: <20071104030508.GA12622@desktop> Message-ID: <200711041829.04072.als@iinet.net.au> On Sunday 04 November 2007 14:24, Anders Nygren wrote: > > I dont think there is anything ready made for this, but You can look at two > modules in stdlib that can be useful. > - queue, obviously queue functions, instead of element(A, Z) ++ [Fst] which > gets expensive if the lists are long. > - ets, with table type ordered set. to make a priority queue in ets > store your entries as {{Prio,now()}, Data}, when You read you get the first > inserted, using suitable matching/selection functions. The gb_trees module has functions like take_largest, take_smallest which look like they can be used for heaps. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From ulf@REDACTED Sun Nov 4 13:26:22 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 4 Nov 2007 13:26:22 +0100 Subject: [erlang-questions] Random newbie stuff In-Reply-To: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> References: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> Message-ID: <8209f740711040426uc1056adge9214bb367e4f750@mail.gmail.com> 2007/11/4, Brandon Black : > 1) "Inheritance" > > Forgetting for a moment OO <-> Erlang holy wars and battles about > syntax and semantics, in a practical sense, is there any way to > inherit code for re-use in Erlang? I can imagine many scenarios where > it would be useful, here's a concrete one for example: Suppose one > were writing an Erlang module that parsed list comprehension syntax > and converted it into some sort of SQL equivalent as part of an Erlang > <-> RDBMS interface. Actually, the qlc module does more or less this. It allows you to plug in different table generators, so that you can combine data from different sources in a list comprehension. The generator "plug-ins", are higher-order functions. You can choose to either use modules as "classes", along the lines of the OTP behaviours - gen_server, gen_event, etc. - or "funs" that specialize certain aspects of a function. Xmerl allows the user to provide funs that specialize nearly every aspect of XML processing: one fun that fetches the file, one that accumulates complete elements, one that closes the file, etc. On a smaller scale, the lists module exports functions that can can be specialized using funs: lists:sort/2, lists:zipwith/3, lists:foldl/3, etc. You also have modules like ordsets, which define a data structure with well-known semantics. Ordsets are ordered lists, by definition. The ordsets module exports a number of functions that can be used on sets (deliberatly identical to those of the sets module), but since the data structures are documented as lists, you know that all operations that are valid on lists are also valid on ordsets (although some of them may turn the data into something that is no longer an ordset.) Inheritance is not a first-class citizen in Erlang, but there are many ways to go about achieving code reuse through informal inheritance. Some of these approaches could be made more automatic, but there is always a cost to adding things - tools or syntax. > 2) State Mutability... > > How important is it to maintain immutable state? Are there classes of > problems (classes of applications) which cannot be built without > mutable state (for which one would use process dicts or [d]ets)? One reasonably common problem is when you've designed an interface with a strictly limited set of parameters, and then need to extend the functionality in a way that forces data to be carried across between subsequent calls. You will then need to invent something that can maintain state between calls, unless you can get the caller to do it for you (by passing an opaque parameter). One way to solve this is of course to use a process. Note that the process may well use immutable state internally, but to an outsider, the state appears to change continuously. The thing that you get with immutability is that a piece of data, once bound, is guaranteed not to change. You have to create a new instance by (conceptually) copying the data. Note that the runtime system is free to decide that old data can be reused, just as it can choose to send data by reference between processes sometimes. The main advantage of immutable state is that a function that doesn't "cheat" by using the process dictionary, ets, message passing etc, is guaranteed to always produce the same result every time it is called with the same set of parameters. Of course, this isn't much of a guarantee, at least not to someone used to Haskell. Haskell offers a way to clearly state that something dirty is about to happen. This allows the compiler to know which functions are guaranteed to have the nice property of being fully predictable. Erlang doesn't provide the same level of guarantees, but the programmer can usually still rely on this, as long as some care is taken to keep side-effects grouped together and separate from the large parts of code that really doesn't need them, and which should be 100% predictable. BR, Ulf W From dbyrne@REDACTED Sun Nov 4 14:02:26 2007 From: dbyrne@REDACTED (Dennis Byrne) Date: Sun, 4 Nov 2007 07:02:26 -0600 Subject: [erlang-questions] Random newbie stuff In-Reply-To: <8209f740711040426uc1056adge9214bb367e4f750@mail.gmail.com> Message-ID: Hello Ulf, If you have a function that is 100% predictable, couldn't there be some serious performance gains given that the function is frequently passed the same message? In other words, why put a core to work calculating the result you gave last time someone sent you a given message? It would be better to use this function to spawn a process that could use the process dictionary as a cache (one that would never expire). Unless ... are gets and puts to the dictionary thread safe? ____________________________________________ Dennis Byrne ThoughtWorks - Chicago 312-505-7965 "Ulf Wiger" Sent by: erlang-questions-bounces@REDACTED 11/04/2007 06:26 AM To "Brandon Black" cc erlang-questions@REDACTED Subject Re: [erlang-questions] Random newbie stuff 2007/11/4, Brandon Black : > 1) "Inheritance" > > Forgetting for a moment OO <-> Erlang holy wars and battles about > syntax and semantics, in a practical sense, is there any way to > inherit code for re-use in Erlang? I can imagine many scenarios where > it would be useful, here's a concrete one for example: Suppose one > were writing an Erlang module that parsed list comprehension syntax > and converted it into some sort of SQL equivalent as part of an Erlang > <-> RDBMS interface. Actually, the qlc module does more or less this. It allows you to plug in different table generators, so that you can combine data from different sources in a list comprehension. The generator "plug-ins", are higher-order functions. You can choose to either use modules as "classes", along the lines of the OTP behaviours - gen_server, gen_event, etc. - or "funs" that specialize certain aspects of a function. Xmerl allows the user to provide funs that specialize nearly every aspect of XML processing: one fun that fetches the file, one that accumulates complete elements, one that closes the file, etc. On a smaller scale, the lists module exports functions that can can be specialized using funs: lists:sort/2, lists:zipwith/3, lists:foldl/3, etc. You also have modules like ordsets, which define a data structure with well-known semantics. Ordsets are ordered lists, by definition. The ordsets module exports a number of functions that can be used on sets (deliberatly identical to those of the sets module), but since the data structures are documented as lists, you know that all operations that are valid on lists are also valid on ordsets (although some of them may turn the data into something that is no longer an ordset.) Inheritance is not a first-class citizen in Erlang, but there are many ways to go about achieving code reuse through informal inheritance. Some of these approaches could be made more automatic, but there is always a cost to adding things - tools or syntax. > 2) State Mutability... > > How important is it to maintain immutable state? Are there classes of > problems (classes of applications) which cannot be built without > mutable state (for which one would use process dicts or [d]ets)? One reasonably common problem is when you've designed an interface with a strictly limited set of parameters, and then need to extend the functionality in a way that forces data to be carried across between subsequent calls. You will then need to invent something that can maintain state between calls, unless you can get the caller to do it for you (by passing an opaque parameter). One way to solve this is of course to use a process. Note that the process may well use immutable state internally, but to an outsider, the state appears to change continuously. The thing that you get with immutability is that a piece of data, once bound, is guaranteed not to change. You have to create a new instance by (conceptually) copying the data. Note that the runtime system is free to decide that old data can be reused, just as it can choose to send data by reference between processes sometimes. The main advantage of immutable state is that a function that doesn't "cheat" by using the process dictionary, ets, message passing etc, is guaranteed to always produce the same result every time it is called with the same set of parameters. Of course, this isn't much of a guarantee, at least not to someone used to Haskell. Haskell offers a way to clearly state that something dirty is about to happen. This allows the compiler to know which functions are guaranteed to have the nice property of being fully predictable. Erlang doesn't provide the same level of guarantees, but the programmer can usually still rely on this, as long as some care is taken to keep side-effects grouped together and separate from the large parts of code that really doesn't need them, and which should be 100% predictable. BR, Ulf W _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From byron.hale@REDACTED Sun Nov 4 11:39:30 2007 From: byron.hale@REDACTED (ByronHale) Date: Sun, 04 Nov 2007 02:39:30 -0800 Subject: [erlang-questions] Congratulations on the new SFBA functional programming group: "Bay Area Functional Programmers" Message-ID: <1194172770.704442.197090@v23g2000prn.googlegroups.com> At various times, some of us in the SFBA have met for OCaml, SML97 and Erlang. In our last implementation, we struggled to find a congenial location. It would probably have to be Stanford or Berkeley, due to the overall poor transportation system in the SFBA. The location at Stanford with Cal Train shuttle service, is therefore excellent news. It looks as if there is a critical mass, too! Best Regards, Byron Hale byron.hale@REDACTED For other lists: Next meeting: Wednesday, Nov 7, 7:30 PM Carnegie Institute on the Stanford campus From blblack@REDACTED Sun Nov 4 14:52:02 2007 From: blblack@REDACTED (Brandon Black) Date: Sun, 4 Nov 2007 07:52:02 -0600 Subject: [erlang-questions] Random newbie stuff In-Reply-To: References: <8209f740711040426uc1056adge9214bb367e4f750@mail.gmail.com> Message-ID: <84621a60711040552r5d03529ds18c1b077e4903b70@mail.gmail.com> On 11/4/07, Dennis Byrne wrote: > > > Hello Ulf, > > If you have a function that is 100% predictable, couldn't there be some > serious performance gains given that the function is frequently passed the > same message? In other words, why put a core to work calculating the result > you gave last time someone sent you a given message? It would be better to > use this function to spawn a process that could use the process dictionary > as a cache (one that would never expire). What you're basically asking for there is memoization. It would be interesting to have memoization supported at the language level. The compiler/interpreter isn't smart enough to know when memoization makes the most sense (depends on freq/range of inputs, computational complexity of function), but the programmer probably knows. You would need a syntax for specifying function "attributes" to the compiler/interpreter. Borrowing the ":attrib" syntax from Perl, it would look like: somecomplexfunc(X) :memoize -> ... complex body ... I'm guessing that analysis tools could easily throw an error at you if you've put :memoize on a function which (directly or indirectly by calling other funcs) makes use of mutable state. -- Brandon -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbyrne@REDACTED Sun Nov 4 15:13:39 2007 From: dbyrne@REDACTED (Dennis Byrne) Date: Sun, 4 Nov 2007 08:13:39 -0600 Subject: [erlang-questions] Random newbie stuff In-Reply-To: <84621a60711040552r5d03529ds18c1b077e4903b70@mail.gmail.com> Message-ID: Yeah, memorization is a good way to put it. The closest thing I've seen to this was from a friend of mine who was using aspects to implement method level caching in java. This of course is not supported by the language itself. ____________________________________________ Dennis Byrne ThoughtWorks - Chicago 312-505-7965 "Brandon Black" wrote on 11/04/2007 07:52:02 AM: > > On 11/4/07, Dennis Byrne wrote: > > Hello Ulf, > > If you have a function that is 100% predictable, couldn't there be > some serious performance gains given that the function is frequently > passed the same message? In other words, why put a core to work > calculating the result you gave last time someone sent you a given > message? It would be better to use this function to spawn a process > that could use the process dictionary as a cache (one that would neverexpire). > > > What you're basically asking for there is memoization. It would be > interesting to have memoization supported at the language level. The > compiler/interpreter isn't smart enough to know when memoization makes > the most sense (depends on freq/range of inputs, computational > complexity of function), but the programmer probably knows. You would > need a syntax for specifying function "attributes" to the > compiler/interpreter. Borrowing the ":attrib" syntax from Perl, it > would look like: > > somecomplexfunc(X) :memoize -> ... complex body ... > > I'm guessing that analysis tools could easily throw an error at you if > you've put :memoize on a function which (directly or indirectly by > calling other funcs) makes use of mutable state. > > -- Brandon -------------- next part -------------- An HTML attachment was scrubbed... URL: From blblack@REDACTED Sun Nov 4 15:24:29 2007 From: blblack@REDACTED (Brandon Black) Date: Sun, 4 Nov 2007 08:24:29 -0600 Subject: [erlang-questions] Random newbie stuff In-Reply-To: References: <84621a60711040552r5d03529ds18c1b077e4903b70@mail.gmail.com> Message-ID: <84621a60711040624j4115c9e6lcfc8ea2fb6f3e204@mail.gmail.com> On 11/4/07, Dennis Byrne wrote: > > Yeah, memorization is a good way to put it. The closest thing I've seen to > this was from a friend of mine who was using aspects to implement method > level caching in java. This of course is not supported by the language > itself. In Perl it's not a core language feature either, but basically this module implements generic memoization: http://search.cpan.org/~mjd/Memoize-1.01/ And then this module ties that together with function attributes for prettier syntax: http://search.cpan.org/~dankogai/Attribute-Util-1.02/lib/Attribute/Memoize.pm -- Brandon From thomasl_erlang@REDACTED Sun Nov 4 16:36:01 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 4 Nov 2007 07:36:01 -0800 (PST) Subject: [erlang-questions] Random newbie stuff In-Reply-To: Message-ID: <708814.77097.qm@web38814.mail.mud.yahoo.com> --- Dennis Byrne wrote: > Hello Ulf, > > If you have a function that is 100% predictable, > couldn't there be some > serious performance gains given that the function is > frequently passed the > same message? In other words, why put a core to > work calculating the > result you gave last time someone sent you a given > message? It would be > better to use this function to spawn a process that > could use the process > dictionary as a cache (one that would never expire). > > > Unless ... are gets and puts to the dictionary > thread safe? Since put/get is local to the thread, they are. Anyway, here is global memoization: - start a set table ?memo (not shown) - if M:F(A1,...,An) has been called before, use the precomputed result - otherwise, compute it, store the result and return it -module(memo). ... memo_apply(M, F, As) -> Key = {M, F, As}, case ets:lookup(?memo, Key) of [{_, Res}] -> Res; [] -> case catch apply(M, F, As) of {'EXIT', Rsn} -> exit(Rsn); Res -> ets:insert(?memo, {Key, Res}), Res end end. Do note that in general memoization can leak a lot of memory, and that for Erlang you will have to clear the table when there is code change. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ulf@REDACTED Sun Nov 4 16:51:14 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 4 Nov 2007 16:51:14 +0100 Subject: [erlang-questions] Random newbie stuff In-Reply-To: References: <8209f740711040426uc1056adge9214bb367e4f750@mail.gmail.com> Message-ID: <8209f740711040751r7ef19bl3d5157a3e33a2a75@mail.gmail.com> 2007/11/4, Dennis Byrne : > > > Hello Ulf, > > If you have a function that is 100% predictable, couldn't there be some > serious performance gains given that the function is frequently passed the > same message? In other words, why put a core to work calculating the result > you gave last time someone sent you a given message? It would be better to > use this function to spawn a process that could use the process dictionary > as a cache (one that would never expire). > > Unless ... are gets and puts to the dictionary thread safe? > Hmm, these are two different questions. The immutability part means that stuff like this is not possible in Erlang: void foo( int &i ) { i++; } int main() { int bar = 5; // bar == 5 foo( bar ); // bar == 6 foo( bar ); // bar == 7 return 0; } (from http://developer.kde.org/~wheeler/cpp-pitfalls.html, one of many web pages listing C++ pitfalls). The fact that a function will return the same value every time it is called with the same input, doesn't mean to imply that you have to call it every time you have a certain set of values. (-: It's not a matter of efficiency. It's rather a sanity thing. When you debug functional code, it takes only moments to determine that a function depends only on its input parameters. Once you've done that, you can figure out what it does, and rest assured that this will always hold. BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Sun Nov 4 17:03:49 2007 From: vances@REDACTED (Vance Shipley) Date: Sun, 4 Nov 2007 11:03:49 -0500 Subject: [erlang-questions] Random newbie stuff In-Reply-To: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> References: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> Message-ID: <20071104160349.GB215@little-black-book.motivity.ca> Brandon, I have used what I call cascading behaviours to accomplish what you describe. I wrote about it here: http://www.trapexit.org/Cascading_Behaviours -Vance On Sat, Nov 03, 2007 at 06:37:29PM -0500, Brandon Black wrote: } Forgetting for a moment OO <-> Erlang holy wars and battles about } syntax and semantics, in a practical sense, is there any way to } inherit code for re-use in Erlang? I can imagine many scenarios where } it would be useful, here's a concrete one for example: Suppose one } were writing an Erlang module that parsed list comprehension syntax } and converted it into some sort of SQL equivalent as part of an Erlang } <-> RDBMS interface. From francis.norton@REDACTED Sun Nov 4 18:33:05 2007 From: francis.norton@REDACTED (Francis Norton) Date: Sun, 4 Nov 2007 17:33:05 +0000 Subject: [erlang-questions] Random newbie stuff In-Reply-To: <20071104160349.GB215@little-black-book.motivity.ca> References: <84621a60711031637l1d3294c5g7b7dea4f5faf2683@mail.gmail.com> <20071104160349.GB215@little-black-book.motivity.ca> Message-ID: <24162acd0711040933g757a2f82pcf762d183c8f15ae@mail.gmail.com> I'm also an Erlang newbie, coming from C#. I've tried to put aside my OO preconceptions, but it seems to me that there are some useful conceptual mappings - can I check a couple? Would it be fair to say that Erlang Behaviours achieve code re-use by implementing, in the sense of Martin Fowler's article ( http://martinfowler.com/articles/injection.html), the Inversion of Control pattern with Constructor (or is it Setter?) Dependency Injection? And would it also be fair to describe Vance's Cascading_Behaviours as adding more code re-use via the Decorator pattern ( http://en.wikipedia.org/wiki/Decorator_pattern), at least when taking the option of exporting an identical interface to the callback module as imported? Francis. On 04/11/2007, Vance Shipley wrote: > > Brandon, > > I have used what I call cascading behaviours to accomplish what > you describe. I wrote about it here: > > http://www.trapexit.org/Cascading_Behaviours > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dking@REDACTED Mon Nov 5 05:47:34 2007 From: dking@REDACTED (David King) Date: Sun, 4 Nov 2007 20:47:34 -0800 Subject: [erlang-questions] QLC and mnesia indexes Message-ID: <237D45F4-0EF5-4E06-BBC4-03DB891143E1@ketralnis.com> Is there a way to ask mnesia how many results there are for a given query without evaluating it (either in QLC or otherwise) if it can determine the answer entirely from an index? That is, if I have a set of employees: -record(employee,{id,name,started_on}). And the mnesia table is created like this: {atomic,ok}=mnesia:create_table(employee, [{disc_copies,[node()]}, {attributes, record_info(fields,author)}, {index,[started_on]}]). If I wanted to know how many employees started in the last seven days, I could do: length(qlc:e(qlc:q([ X#employee.id || X <- mnesia:table(employee), X#employee.started_on > SevenDaysAgo ]))). However, I should also be able to find that out without evaluating the query at all, since the index on started_on should contain enough information to figure it out, and given a large number, it can take much less time. Does QLC or Mnesia have a way to do so? From francesco@REDACTED Mon Nov 5 09:33:24 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 05 Nov 2007 08:33:24 +0000 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit Message-ID: <472ED554.8080007@erlang-consulting.com> Hi All, We recently went live with our new User Contributions page on trapexit. In doing so, we migrated all user contributions from erlang.org and merged them with the ones on trapexit. The URL is http://www.trapexit.org/Special:UserContributions New features include the ability to sort based on date, author, popularity and description. We are using the forum to handle this, allowing users to include instructions, updates and links to repositories in the posts. If you have any applications and libraries to contribute, feel free to add them. Just remember to include * Distribution Licence Type * Attachments with source code * Link to repository and/or documentation If you have any questions, let me know. Regards, Francesco -- http://www.erlang-consulting.com From dmitriid@REDACTED Mon Nov 5 10:03:15 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Mon, 05 Nov 2007 11:03:15 +0200 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit In-Reply-To: <472ED554.8080007@erlang-consulting.com> References: <472ED554.8080007@erlang-consulting.com> Message-ID: <472EDC53.8070107@gmail.com> Francesco Cesarini wrote: > Hi All, > > We recently went live with our new User Contributions page on trapexit. > In doing so, we migrated all user contributions from erlang.org and > merged them with the ones on trapexit. The URL is > > http://www.trapexit.org/Special:UserContributions > I'm afraid, contributions to erlang are getting spread out too much. There's CEAN, there's Erlware, there's Trapexit's User Contributions... It may get extremely difficult to find actual versions of various projects with all this... From mogorman@REDACTED Mon Nov 5 10:37:54 2007 From: mogorman@REDACTED (mog) Date: Mon, 05 Nov 2007 03:37:54 -0600 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit In-Reply-To: <472EDC53.8070107@gmail.com> References: <472ED554.8080007@erlang-consulting.com> <472EDC53.8070107@gmail.com> Message-ID: <1194255474.11267.1.camel@metalman.lan> exactly, everyone should use my new erlang repository at ..... it is getting a little ridiculous, I wish everyone would just pick one, im partial to cean myself. At the end of the day its probably a good thing that there is so much development going on mog On Mon, 2007-11-05 at 11:03 +0200, Dmitrii 'Mamut' Dimandt wrote: > Francesco Cesarini wrote: > > Hi All, > > > > We recently went live with our new User Contributions page on trapexit. > > In doing so, we migrated all user contributions from erlang.org and > > merged them with the ones on trapexit. The URL is > > > > http://www.trapexit.org/Special:UserContributions > > > I'm afraid, contributions to erlang are getting spread out too much. > There's CEAN, there's Erlware, there's Trapexit's User Contributions... > > It may get extremely difficult to find actual versions of various > projects with all this... > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- 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 francesco@REDACTED Mon Nov 5 11:04:18 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 05 Nov 2007 10:04:18 +0000 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit In-Reply-To: <1194255474.11267.1.camel@metalman.lan> References: <472ED554.8080007@erlang-consulting.com> <472EDC53.8070107@gmail.com> <1194255474.11267.1.camel@metalman.lan> Message-ID: <472EEAA2.9010404@erlang-consulting.com> Mog, I don't get your point. Comparing CEAN, Erlware and a the trapexit repository is like comparing apples, oranges (and pears). They might overlap in certain areas, but overall have very distinct characteristics and fulfill different requirements. Mostly, they complement each other. Francesco -- http://www.erlang-consulting.com mog wrote: > exactly, everyone should use my new erlang repository at ..... > > it is getting a little ridiculous, I wish everyone would just pick one, > im partial to cean myself. At the end of the day its probably a good > thing that there is so much development going on > > mog > On Mon, 2007-11-05 at 11:03 +0200, Dmitrii 'Mamut' Dimandt wrote: > >> Francesco Cesarini wrote: >> >>> Hi All, >>> >>> We recently went live with our new User Contributions page on trapexit. >>> In doing so, we migrated all user contributions from erlang.org and >>> merged them with the ones on trapexit. The URL is >>> >>> http://www.trapexit.org/Special:UserContributions >>> >>> >> I'm afraid, contributions to erlang are getting spread out too much. >> There's CEAN, there's Erlware, there's Trapexit's User Contributions... >> >> It may get extremely difficult to find actual versions of various >> projects with all this... >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From rsaccon@REDACTED Mon Nov 5 11:01:46 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Mon, 5 Nov 2007 08:01:46 -0200 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit In-Reply-To: <1194255474.11267.1.camel@metalman.lan> References: <472ED554.8080007@erlang-consulting.com> <472EDC53.8070107@gmail.com> <1194255474.11267.1.camel@metalman.lan> Message-ID: Hey, isn't it nice to have a choice ? Image there would be just one type of car ... On 11/5/07, mog wrote: > exactly, everyone should use my new erlang repository at ..... > > it is getting a little ridiculous, I wish everyone would just pick one, > im partial to cean myself. At the end of the day its probably a good > thing that there is so much development going on > > mog > On Mon, 2007-11-05 at 11:03 +0200, Dmitrii 'Mamut' Dimandt wrote: > > Francesco Cesarini wrote: > > > Hi All, > > > > > > We recently went live with our new User Contributions page on trapexit. > > > In doing so, we migrated all user contributions from erlang.org and > > > merged them with the ones on trapexit. The URL is > > > > > > http://www.trapexit.org/Special:UserContributions > > > > > I'm afraid, contributions to erlang are getting spread out too much. > > There's CEAN, there's Erlware, there's Trapexit's User Contributions... > > > > It may get extremely difficult to find actual versions of various > > projects with all this... > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- Roberto Saccon http://rsaccon.com From mazen@REDACTED Mon Nov 5 11:52:36 2007 From: mazen@REDACTED (Mazen Harake) Date: Mon, 05 Nov 2007 10:52:36 +0000 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit In-Reply-To: <1194255474.11267.1.camel@metalman.lan> References: <472ED554.8080007@erlang-consulting.com> <472EDC53.8070107@gmail.com> <1194255474.11267.1.camel@metalman.lan> Message-ID: <472EF5F4.5080602@erlang-consulting.com> Trapexit is much more then just a place for user contribution (or "repository" if you will). It has a forum an a wiki where you can discuss and ask questions about these contributions (and other things as well of course). It also has articles (written by the users) feeds etc. So I would rather classify it as a community portal then just a repository. The best part in my opinion is the followups in the threads on the forum where someone asks how to do something, gets an answer and then replies what they did that worked and how they did it. This creates a really nice reference for other people. /Mazen mog wrote: > exactly, everyone should use my new erlang repository at ..... > > it is getting a little ridiculous, I wish everyone would just pick one, > im partial to cean myself. At the end of the day its probably a good > thing that there is so much development going on > > mog > On Mon, 2007-11-05 at 11:03 +0200, Dmitrii 'Mamut' Dimandt wrote: > >> Francesco Cesarini wrote: >> >>> Hi All, >>> >>> We recently went live with our new User Contributions page on trapexit. >>> In doing so, we migrated all user contributions from erlang.org and >>> merged them with the ones on trapexit. The URL is >>> >>> http://www.trapexit.org/Special:UserContributions >>> >>> >> I'm afraid, contributions to erlang are getting spread out too much. >> There's CEAN, there's Erlware, there's Trapexit's User Contributions... >> >> It may get extremely difficult to find actual versions of various >> projects with all this... >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions -- Mazen Harake Erlang Software Developer and Consultant, Erlang Training & Consulting, Ltd Mobile Phone: +44 (0)795 13 26 317 Office Phone: +44 (0)207 45 61 020 Office Address: 401 London Fruit & Wool Exchange Brushfield St, London, E1 6EL United Kingdom This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of "Erlang Training & Consulting, Ltd". If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error. From olopierpa@REDACTED Sun Nov 4 16:52:19 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Sun, 4 Nov 2007 16:52:19 +0100 Subject: [erlang-questions] Managing priority heaps. In-Reply-To: <20071104030508.GA12622@desktop> References: <20071104030508.GA12622@desktop> Message-ID: <7352e43a0711040752x7a5867ces814b8ecb78923e2c@mail.gmail.com> On 11/4/07, J?r?mie Lumbroso wrote: > Hello, > > I am trying to write a loop: > > myloop(Lists, PriorityList) Maybe the following very simple implementation of priority queues may be useful: http://olopierpa.googlepages.com/skew.erl P. From alexander.lamb@REDACTED Mon Nov 5 15:11:56 2007 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Mon, 5 Nov 2007 15:11:56 +0100 Subject: [erlang-questions] Imagine every (active) entity is a process Message-ID: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> Hello, So I am back with my design questions. I listened to the Armstrong interview and thought a bit more about processes keeping the state of an application. For example, in an application which handles customers, would it make sense to create a process for each customer being worked on? Imagine a user searches for a customer to update his address, another user is creating an invoice for a customer, etc... When a given customer becomes active (in the sense that someone is working on the customer and his data), a process is created. Potentially, if the application is used by many users, you could have hundreds of customer processes being created. I assume this is not a problem with Erlang and encapsulated well the business logic. Going one step further, I would imagine it is better to create only one process for any given customer at any given time. In other words, if I (a user) is updating customer "23" and at the same time, another user is adding an invoice to customer "23", we should both be speaking to the same process. It allows a better encapsulation and avoids mismatches because I would be updating a database with some customer info without the other user seing my update until a refresh. So I imagine it would be a good design to have one and only one process for a given entity with a given primary key. Going this way, I therefore have a question (in addition to understanding if this is a correct way of thinking in Erlang): When I would want to start working on customer "23" for example, I will first need to check if customer "23" is already an active process. If yes, I get the Pid and exchange whatever messages I need with customer "23". If not, I create the process and proceed. Now, obviously, for my process to be known by all potential users of the process, I must register the process using the register(Name,Pid) function. As a name I could concatenate the entity name and its primary key (in my case: "customer_23"). Isn't there a race condition here. Since I have to check first if a process exists before creating it, I might end up in a situation where two other processes are doing the same thing and creating twice a process for the same entity. The second would obviously fail and we could catch the error. But is this a correct way of proceeding? Also, is it possible to have thousands of registered processes (as opposed to non registered processes)? Thanks, Alex -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From taavi@REDACTED Mon Nov 5 16:32:55 2007 From: taavi@REDACTED (Taavi Talvik) Date: Mon, 5 Nov 2007 17:32:55 +0200 Subject: [erlang-questions] Imagine every (active) entity is a process In-Reply-To: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> References: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> Message-ID: > When I would want to start working on customer "23" for example, I > will first need to check if customer "23" is already an active > process. If yes, I get the Pid and exchange whatever messages I need > with customer "23". If not, I create the process and proceed. > Now, obviously, for my process to be known by all potential users of > the process, I must register the process using the register(Name,Pid) > function. As a name I could concatenate the entity name and its > primary key (in my case: "customer_23"). > > Isn't there a race condition here. Since I have to check first if a > process exists before creating it, I might end up in a situation where > two other processes are doing the same thing and creating twice a > process for the same entity. The second would obviously fail and we > could catch the error. But is this a correct way of proceeding? Also, > is it possible to have thousands of registered processes (as opposed > to non registered processes)? You can serialize process lookup and creation - yet another process, which is responsible for looking up "actual serving process" and if necessary creating new process - if you keep names private only way to access workers is through name_resolver and no race any more. - of course this creates new bottleneck look at global http://erlang.org/doc/man/global.html Just register() is only one building block. You need name lookup, new process creation and registration coordinated. references: http://www.erlang.org/pipermail/erlang-questions/2007-September/ 029373.html http://www.erlang.org/pipermail/erlang-questions/2007-September/ 029379.html best regards, taavi From alexander.lamb@REDACTED Mon Nov 5 16:44:37 2007 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Mon, 5 Nov 2007 16:44:37 +0100 Subject: [erlang-questions] Imagine every (active) entity is a process In-Reply-To: References: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> Message-ID: <83061589-8ECB-4805-A30A-E18A3D65D025@rodanotech.ch> And what about just letting the race condition occur: The first one which manages to create a process for a given name succeeds. Obviously, the second one will not succeed with the same name if the process is already registered under that name. No problem, just catch the error and loop back to querying the registered processes for that name (which at that time will exist). Alex Le 5 nov. 07 ? 16:32, Taavi Talvik a ?crit : >> When I would want to start working on customer "23" for example, I >> will first need to check if customer "23" is already an active >> process. If yes, I get the Pid and exchange whatever messages I need >> with customer "23". If not, I create the process and proceed. >> Now, obviously, for my process to be known by all potential users of >> the process, I must register the process using the register(Name,Pid) >> function. As a name I could concatenate the entity name and its >> primary key (in my case: "customer_23"). >> >> Isn't there a race condition here. Since I have to check first if a >> process exists before creating it, I might end up in a situation >> where >> two other processes are doing the same thing and creating twice a >> process for the same entity. The second would obviously fail and we >> could catch the error. But is this a correct way of proceeding? Also, >> is it possible to have thousands of registered processes (as opposed >> to non registered processes)? > > You can serialize process lookup and creation > - yet another process, which is responsible for looking up "actual > serving process" > and if necessary creating new process > - if you keep names private only way to access workers is through > name_resolver and no race any more. > - of course this creates new bottleneck > > look at global http://erlang.org/doc/man/global.html > > Just register() is only one building block. You need name lookup, > new process creation > and registration coordinated. > > references: > http://www.erlang.org/pipermail/erlang-questions/2007-September/029373.html > http://www.erlang.org/pipermail/erlang-questions/2007-September/029379.html > > best regards, > taavi > > -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From mogorman@REDACTED Mon Nov 5 17:31:25 2007 From: mogorman@REDACTED (mog) Date: Mon, 05 Nov 2007 10:31:25 -0600 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit In-Reply-To: References: <472ED554.8080007@erlang-consulting.com> <472EDC53.8070107@gmail.com> <1194255474.11267.1.camel@metalman.lan> Message-ID: <1194280285.31949.4.camel@metalman.lan> Heh sarcasm isnt always very transparent late at night i guess... I think the fact their are several different repos and different types of repos is a good thing. As it means there is an explosion of development / interest as of late, and although it would be nice that there was one repo for source, like cpan or gems etc, it is not "needed" persay. In the long run I think one will win out, and it doesnt matter which or when. Mog On Mon, 2007-11-05 at 08:01 -0200, Roberto Saccon wrote: > Hey, isn't it nice to have a choice ? Image there would be just one > type of car ... > > On 11/5/07, mog wrote: > > exactly, everyone should use my new erlang repository at ..... > > > > it is getting a little ridiculous, I wish everyone would just pick one, > > im partial to cean myself. At the end of the day its probably a good > > thing that there is so much development going on > > > > mog > > On Mon, 2007-11-05 at 11:03 +0200, Dmitrii 'Mamut' Dimandt wrote: > > > Francesco Cesarini wrote: > > > > Hi All, > > > > > > > > We recently went live with our new User Contributions page on trapexit. > > > > In doing so, we migrated all user contributions from erlang.org and > > > > merged them with the ones on trapexit. The URL is > > > > > > > > http://www.trapexit.org/Special:UserContributions > > > > > > > I'm afraid, contributions to erlang are getting spread out too much. > > > There's CEAN, there's Erlware, there's Trapexit's User Contributions... > > > > > > It may get extremely difficult to find actual versions of various > > > projects with all this... > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -------------- next part -------------- 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 dmitriid@REDACTED Mon Nov 5 17:33:49 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Mon, 05 Nov 2007 18:33:49 +0200 Subject: [erlang-questions] New Erlang User Contributions Page on Trapexit In-Reply-To: References: <472ED554.8080007@erlang-consulting.com> <472EDC53.8070107@gmail.com> <1194255474.11267.1.camel@metalman.lan> Message-ID: <472F45ED.1090901@gmail.com> Roberto Saccon wrote: > Hey, isn't it nice to have a choice ? Image there would be just one > type of car ... > > ruby gem install.... ;) From roger.larsson@REDACTED Mon Nov 5 19:53:08 2007 From: roger.larsson@REDACTED (Roger Larsson) Date: Mon, 5 Nov 2007 19:53:08 +0100 Subject: [erlang-questions] Imagine every (active) entity is a process (with a registered name) In-Reply-To: <83061589-8ECB-4805-A30A-E18A3D65D025@rodanotech.ch> References: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> <83061589-8ECB-4805-A30A-E18A3D65D025@rodanotech.ch> Message-ID: <200711051953.08961.roger.larsson@norran.net> But do they need to have a registered name? I would really avoid registering a constructed name like "customer_23", remember that this name has to be kept track of somewhere. And how do you know that it is #23 actually? My guess is that you have made a query in the first place, try to let it return the PID directly instead of 23... /RogerL On m?ndag 05 november 2007, Alexander Lamb wrote: > And what about just letting the race condition occur: > > The first one which manages to create a process for a given name > succeeds. Obviously, the second one will not succeed with the same > name if the process is already registered under that name. > No problem, just catch the error and loop back to querying the > registered processes for that name (which at that time will exist). > > Alex > > Le 5 nov. 07 ? 16:32, Taavi Talvik a ?crit : > >> When I would want to start working on customer "23" for example, I > >> will first need to check if customer "23" is already an active > >> process. If yes, I get the Pid and exchange whatever messages I need > >> with customer "23". If not, I create the process and proceed. > >> Now, obviously, for my process to be known by all potential users of > >> the process, I must register the process using the register(Name,Pid) > >> function. As a name I could concatenate the entity name and its > >> primary key (in my case: "customer_23"). > >> > >> Isn't there a race condition here. Since I have to check first if a > >> process exists before creating it, I might end up in a situation > >> where > >> two other processes are doing the same thing and creating twice a > >> process for the same entity. The second would obviously fail and we > >> could catch the error. But is this a correct way of proceeding? Also, > >> is it possible to have thousands of registered processes (as opposed > >> to non registered processes)? > > > > You can serialize process lookup and creation > > - yet another process, which is responsible for looking up "actual > > serving process" > > and if necessary creating new process > > - if you keep names private only way to access workers is through > > name_resolver and no race any more. > > - of course this creates new bottleneck > > > > look at global http://erlang.org/doc/man/global.html > > > > Just register() is only one building block. You need name lookup, > > new process creation > > and registration coordinated. > > > > references: > > http://www.erlang.org/pipermail/erlang-questions/2007-September/029373.ht > >ml > > http://www.erlang.org/pipermail/erlang-questions/2007-September/029379.ht > >ml > > > > best regards, > > taavi > > -- > Alexander Lamb > Founding Associate > RODANOTECH S?rl > > 4 ch. de la Tour de Champel > 1206 Geneva > Switzerland > > Tel: 022 347 77 37 > Fax: 022 347 77 38 > > http://www.rodanotech.ch > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dougedmunds@REDACTED Mon Nov 5 21:30:22 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Mon, 5 Nov 2007 12:30:22 -0800 Subject: [erlang-questions] Imagine every (active) entity is a process In-Reply-To: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> References: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> Message-ID: I put together a little example called Shopper meets Bagboy3 which starts about midway down on: http://www.dougedmunds.com/z_erlang_wiki/doku.php?id=erlang:supermarket_example There, each 'shopper' is a process. The shopper adds to the shopping cart, then when ready to checkout, the one and only 'bagboy' process is called. Bagboy 'talks'. (Mainly what the bagboy does is put a max of 2 things in each bag, so if a shopper has 7 items, there are 4 bags). As designed there is only one bagboy process, but there could be a pool of rotating bagboys, so if the first was 'busy' the next would be called. I'll leave it to someone else to figure out if the bagboy could possibly put a shopper's items in another shopper's bags if the shoppers were in a checkout 'race'. Just food for thought.... (pun intended) From nindeu@REDACTED Mon Nov 5 23:21:24 2007 From: nindeu@REDACTED (nindeu@REDACTED) Date: Mon, 05 Nov 2007 23:21:24 +0100 Subject: [erlang-questions] Dynamically generated atoms get reused if they are the same? Message-ID: <20071105222124.121380@gmx.net> Hi, According to http://www.erlang.org/doc/efficiency_guide/bif.html#6.1 atoms do not get garbage collected. Meaning if you constantly produce atoms by using list_to_atom/1 you sooner or later will run out of space for them. Now I just wrote a small test program which indicates that as long as you produce the same atom, it will not take up additional space: atomTest() -> NewAtom = list_to_atom("itsme"), io:format("New memory size: ~p, Atoms used: ~p~n", [erlang:memory(atom), erlang:memory(atom_used)]), register(NewAtom, self()), unregister(NewAtom), receive after 1000 -> atomTest() end. So, can anyone confirm, is it correct that dynamically generated Atoms are of no concern as long as you do not produce too many _different_ ones? Thank you! Regards, Eric -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail From kostis@REDACTED Mon Nov 5 23:35:06 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 06 Nov 2007 00:35:06 +0200 Subject: [erlang-questions] Dynamically generated atoms get reused if they are the same? In-Reply-To: <20071105222124.121380@gmx.net> References: <20071105222124.121380@gmx.net> Message-ID: <472F9A9A.8060806@cs.ntua.gr> nindeu@REDACTED wrote: > Hi, > > According to http://www.erlang.org/doc/efficiency_guide/bif.html#6.1 atoms do not get garbage collected. Meaning if you constantly produce atoms by using list_to_atom/1 you sooner or later will run out of space for them. > > Now I just wrote a small test program which indicates that as long as you produce the same atom, it will not take up additional space: > > So, can anyone confirm, is it correct that dynamically generated Atoms are of no concern as long as you do not produce too many _different_ ones? Yes, of course. Kostis From kenneth.lundin@REDACTED Mon Nov 5 23:37:05 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 5 Nov 2007 23:37:05 +0100 Subject: [erlang-questions] Dynamically generated atoms get reused if they are the same? In-Reply-To: <20071105222124.121380@gmx.net> References: <20071105222124.121380@gmx.net> Message-ID: Hi, It is only an increasing number of different atoms which can cause the VM to allocate more and more memory and sooner or later run out of space. So if you use list_to_atom on a limited set of values you are safe. There is also the function list_to_existing_atom which let you convert a string to an atom only if the atom already exist. If for example the atoms are used as literals in the code in some module and this module is loaded then the atoms already exist when list_to_atom creating some of the atoms used in the module is called. /Kenneth Erlang/OTP team at Ericsson On 11/5/07, nindeu@REDACTED wrote: > Hi, > > According to http://www.erlang.org/doc/efficiency_guide/bif.html#6.1 atoms do not get garbage collected. Meaning if you constantly produce atoms by using list_to_atom/1 you sooner or later will run out of space for them. > > Now I just wrote a small test program which indicates that as long as you produce the same atom, it will not take up additional space: > > atomTest() -> > NewAtom = list_to_atom("itsme"), > io:format("New memory size: ~p, Atoms used: ~p~n", > [erlang:memory(atom), erlang:memory(atom_used)]), > register(NewAtom, self()), > unregister(NewAtom), > receive > after 1000 -> > atomTest() > end. > > So, can anyone confirm, is it correct that dynamically generated Atoms are of no concern as long as you do not produce too many _different_ ones? > > Thank you! > > Regards, > Eric > -- > GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. > Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf@REDACTED Mon Nov 5 23:41:02 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 5 Nov 2007 23:41:02 +0100 Subject: [erlang-questions] Dynamically generated atoms get reused if they are the same? In-Reply-To: <20071105222124.121380@gmx.net> References: <20071105222124.121380@gmx.net> Message-ID: <8209f740711051441s4bc5f93fka6a6efc69344ff80@mail.gmail.com> That's correct. BR, Ulf W 2007/11/5, nindeu@REDACTED : > Hi, > > According to http://www.erlang.org/doc/efficiency_guide/bif.html#6.1 atoms do not get garbage collected. Meaning if you constantly produce atoms by using list_to_atom/1 you sooner or later will run out of space for them. > > Now I just wrote a small test program which indicates that as long as you produce the same atom, it will not take up additional space: > > atomTest() -> > NewAtom = list_to_atom("itsme"), > io:format("New memory size: ~p, Atoms used: ~p~n", > [erlang:memory(atom), erlang:memory(atom_used)]), > register(NewAtom, self()), > unregister(NewAtom), > receive > after 1000 -> > atomTest() > end. > > So, can anyone confirm, is it correct that dynamically generated Atoms are of no concern as long as you do not produce too many _different_ ones? > > Thank you! > > Regards, > Eric > -- > GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. > Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From nindeu@REDACTED Mon Nov 5 23:55:49 2007 From: nindeu@REDACTED (nindeu@REDACTED) Date: Mon, 05 Nov 2007 23:55:49 +0100 Subject: [erlang-questions] Dynamically generated atoms get reused if they are the same? In-Reply-To: <8209f740711051441s4bc5f93fka6a6efc69344ff80@mail.gmail.com> References: <20071105222124.121380@gmx.net> <8209f740711051441s4bc5f93fka6a6efc69344ff80@mail.gmail.com> Message-ID: <20071105225549.121380@gmx.net> Thanks to all for your quick answers! Wow! Wished more products had this kind of support! :) I think I need to shamelessly exploit this list with another question. But on a different topic. Regards, Eric -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger From nindeu@REDACTED Mon Nov 5 23:57:34 2007 From: nindeu@REDACTED (nindeu@REDACTED) Date: Mon, 05 Nov 2007 23:57:34 +0100 Subject: [erlang-questions] Design question: addressing multiple e.g. gen_server instances? Message-ID: <20071105225734.121340@gmx.net> Hi, I have a design question that puzzles me since quite some time and so far I did not find any satisfying example or other hint to answer my question. Maybe someone of you has a good idea. I will also explain how I approached this so far. Your input is very welcome! And sorry if this mail becomes a bit long! So my question: --------------- How do you address multiple e.g. gen_server instances connected in a 1:N relationship in a consistent and intelligent way if you want to follow the OTP design principles? Let me explain more detailed what I mean: Please consider a (simplified) system which e.g. reads a log file, parses them and delivers the result to multiple other components which do whatever necessary. You can design this consisting of several gen_whatever components: * a monitor: reads log files or whatever input source. -> parser * a parser: parses the input and generates events. -> event manager * an event manager: distributes the events to the event handlers -> event handlers * event handlers: doing whatever necessary That means the monitor needs to address the parser during the gen_whatever:call or cast, etc. This works fine according to the OTP design principles as long as: a) There is a 1:1 relationship between each following component. b) We are in two dimensional space: There is one instance of all modules. I would call it 3D if you have completely independent input sources and components behind that in the call queue where you do not want them to interfere with each other. Like when you want to process log files of completely different web servers: If the parser for webserver A's log file crashes you do not want that B's parser gets disturbed. So you start the whole set of components once for each input source. And consider you do not simply want to start multiple Erlang instances but put another layer of monitor-parser-etc. above the old one. As long as a+b ar given: Fine! You hardcode module name and registered process name into the predecessor component. But what if there is more than one parser (1:N)? And you do not want to hardcode more than necessary because you would like to regard your components as plugins: Several generic monitors (generic file reader, syslog reader, etc) which just plug into your system? Or one event handler plugin needs to get in contact with another one? And this in 3D process space. My approaches so far: --------------------- I started with giving each layer in 3D a unique name - I call it a domain - and registering all processes with names: class@REDACTED@domain. Class is the type of process (monitor, parser, etc.). This name is unique as long as we do not have two times the same module in one domain. Then I let my supervisors put necessary call target information (module name, registered name) into the startargs of all components. But this approach on the one side does not scale very well and on the other side do you need to know exactly what a component needs to talk to before you start it. Not very good. OK, one step back: I wrote an additional gen_server process: a process registry. Each component at startup only gets told what name it is supposed to register under, which domain it is running and how to reach process registry. Then all processes register themselves during startup with these informations together with class name and module name. Furthermore each component tells process registry what API it has to offer. Now whenever a component needs to get in contact with another one it contacts process registry first, asking for directions. I pretty soon realized that I just had doubled the messages which get sent around and implemented a caching mechanism to cache process registry query results. Still I try to find out where I should store these results best: In the process' state or in an ets table whereas each process owns its own table. And so far I did not deal with processes residing on different nodes. Guess this will get a bit nasty. The process registry approach also has a couple of disadvantages: * Complexity especially during debugging is an order or magnitude higher now. * Slightly less performant. * No guarantee that a target function can be found. Although this could be conquered by first querying all components what functions they will need to access. But my main problem is that I am simply to unexperienced with Erlang to decide whether I am on the right track or there is a much better approach. And I guess I am not the first one dealing with such a design question. Your feedback is very welcome! Regards, Eric -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger From cyberlync@REDACTED Mon Nov 5 23:58:57 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 5 Nov 2007 14:58:57 -0800 Subject: [erlang-questions] Erlounge Seattle Monday November 5th @ 6:30 Message-ID: A few of us are getting together to drink beer, have a bite and discuss Erlang (In that order) on Monday the 5th of November in Seattle, WA. The venue is Barca, 1510 11th Avenue on Capitol Hill. More info on their site http://www.barcaseattle.com/ From roger.larsson@REDACTED Tue Nov 6 00:30:46 2007 From: roger.larsson@REDACTED (Roger Larsson) Date: Tue, 6 Nov 2007 00:30:46 +0100 Subject: [erlang-questions] widefinder analysis In-Reply-To: References: Message-ID: <200711060030.47158.roger.larsson@norran.net> Observations: 1) All tested input filesizes should be cacheable by the kernel. - only the first time it is read it has to be read from the hard drive. compare with [647 MB on my 2 GB Athlon] # time md5sum openSUSE-10.3-GM-Addon-Lang-x86_64.iso real 0m18.749s user 0m3.828s sys 0m1.044s # time md5sum openSUSE-10.3-GM-Addon-Lang-x86_64.iso real 0m3.234s user 0m2.440s sys 0m0.508s # time md5sum openSUSE-10.3-GM-Addon-Lang-x86_64.iso real 0m3.307s user 0m2.768s sys 0m0.500s But doing the same on the DVD.iso can not be cached efficiently as it is bigger than my RAM and will always take about 1m20. # time md5sum openSUSE-10.3-GM-DVD-x86_64.iso real 1m19.695s user 0m25.338s sys 0m8.249s Reading tbray16.erl it looks like it might cause several in Erlang copies of the data. At least one full copy is made with bfile:fread(F, filelib:file_size(File)) but is not that later split into Blksize * schedulers = file_size in split_and_find? => recommended RAM size > 3 * input file size [for input data only!] If it send the Bin and Offset and Size to wfbm4 then wfbm4 also could search for beginning of string by itself (decreasing offset and increasing Size), as wbr4:find could be made to skip all non terminating lines. => recommended RAM size > 2 * input file size Running "vmstat 1" while while running widefinder might show some interesting information. [First run it might even do some swapping si/so to make place for file cache, but after that it should not be necessary. Second time there should be no io - "bi/bo" as the input file should fit in file cache.] 3) The processors have internal caches as well. Some processors share this cache others do not. Linux (and other OS) kernels tries to keep a process/thread on the same processor cache - but does Erlang try to keep an Erlang process on the same thread? /RogerL On fredag 02 november 2007, Anders Nygren wrote: > Hi > > After spending to much time on the widefinder problem > I thought I should make a summary of the situation and > try to get some help from help from VM and CPU gurus > to figure out why it does not scale up properly with > increasing number of CPU cores. > > The discussion here will be about my wfinder8.erl, that > is attached, for anyone to test it. I would love to get > some results from machines with more than 2 cores, and > preferably some that are not XEON 4 or 8 cores. > > The basic algorithm > ------------------------------- > The main process just checks the number of scheduler > threads, and the size of the file. It then starts > one worker process for each scheduler thread assigning > it a part of the file to process. Then it just waits > for the results from the workers. > > Each worker process > 1- opens the file > 2- reads a block of 200 k bytes > 3- start a new sub worker process that processes the block > 4- reads the next block > 5- wait for the sub worker to terminate > 6- goto 3 > > Intuitively this feel like a reasonable way to solve > the problem. But the results do not fit my intuition :) > > Results > ------- > I have tested this on 3 different machines > 1- my 1.66 GHz dual core centrino laptop > 2- Caoyuan's 4-core XEON > 3- Steve Vinoski's 8-core XEON > > An earlier version has been tried by Tim Bray on a > Sun T2150. I have asked him to test the latest one > too but I do not have any results yet. > > > My laptop, 1.66GHz dual core centrino > ------------------------------------- > > 1million lines > schedulers real user sys total total/real > 1 1.731 1.588 0.132 1.72000 0.994 (1) > 2 0.977 1.612 0.180 1.79200 1.83 (2) > > (1) total/real ~1, ;I take that to mean that I get > 100% CPU usage, on one core. > (2) total/real 1.83, ideally this should be 2, so we > are not utilizing the CPU to the max. But I suppose > that it is OK since the OS and other stuff on the > machine must get some CPU time also. > I run OpenSuSE 10.3/KDE and it seems to idle at > ~5% cpu load. > > Speedup from 1 to 2 schedulers 1.77, not too bad. > > Different file sizes > > Real Time (s) Speedup Throughput MB/s > Lines Bytes 1 sched 2 sched 1 sched 2 sched > 10k 2M 0.169 0.167 1.01 11.83 11.97 > 100k 20M 0.305 0.240 1.27 65.57 83.33 > 1M 192M 1.643 0.999 1.64 116.86 192.19 > 2M 384M 3.235 1.888 1.71 118.70 203.39 > 4M 767M 6.118 3.269 1.87 125.37 234.63 > > So it seems like the constant time for running this is ~ 0.165s > > Caoyuan's 4-CPU Intel Xeon 2.80GHz > ---------------------------------- > 1million lines > schedulers real user sys total total/real > 1 1.351 1.128 0.224 1.352 1.00 > 2 0.836 1.336 0.208 1.544 1.85 (1) > 4 0.796 2.156 0.468 2.624 3.30 (2) > > (1) The CPU utilization should be closer to two, since > there are free cpus/cores for other tasks on the > machine. > (2) Two thing to take note of here. 1, The user and system > times have increased significantly. 2, The CPU > utilization is way to low. > > Speedup from > 1 to 2 schedulers 1.62, Similar to my laptop > 2 to 4 schedulers 1.05, Pathetic!! > 1 to 4 schedulers 1.70 Not to impressive > > So why does it not perform better? > We will see more of this below in the section about > the 8 core XEON. > > Different file sizes > > File Size Real Time (s) Speedup Throughput MB/s > Lines Bytes 1 sched 2 sched 4 sched 1-2 2-4 1 sched 2 sched 4 sched > 10k 2M 0.150 0.149 0.148 1.00 1.00 13.33 13.42 13.51 > 1M 192M 1.351 0.836 0.796 1.62 1.05 142.12 229.66 241.20 > 5M 926M 5.742 3.559 3.512 1.61 1.01 161.27 260.18 263.67 > > Steve's 8-core XEON > ------------------- > Dual 2.33 GHz Intel Xeon (8 cores total) with 8 > GB of RAM, a load average of 0.04, running RedHat Enterprise Linux 4. > Erlang is R11B-5. > > 1,167,948 lines > schedulers real user sys total total/real > 1 1.277 1.049 0.243 1.292 1.01 > 2 1.124 1.795 0.334 2.129 1.89 (1) > 4 0.810 1.936 0.759 2.695 3.33 > 8 0.724 2.429 1.402 3.831 5.29 > > (1) Again a large increases in user and system times, this > time for each increase in schedulers. > > Does the fact that it is a dual CPU machine explain why > the user and sys times increase so much when increasing > the number of schedulers? > > Speedup from > 1 to 2 schedulers 1.14 > 2 to 4 schedulers 1.38 > 4 to 8 schedulers 1.12 > > 1 to 4 schedulers 1.58 > 1 to 8 schedulers 1.76 > > > Different file sizes > > File Size Real Time (s) Throughput MB/s > Lines Bytes 8 sched 8 sched > 10L 2M 0.135 14.81 > 1M 225M 0.64 351.56 > 2M 450M 1.017 442.48 > 4M 900M 1.732 519.63 > 8M 1800M 3.183 565.50 > 16M 3600M 5.998 600.20 > > This machine really gets going when the files grows. > > Tim's Sun T2150 > --------------- > This is based on Sun's new Niagara T2 processor > 8 cores > 2 integer units/core > 8 threads/core > 1 4 MB L2 cache > > Solaris and erlang sees this as an 64 processor machine. > > This data is for a different version of my program. > > The test was using a file with > 4,625,236 lines > 971,538,252 bytes > > real user system total total/real > 6.46 34.07 8.02 42.09 6.52 > > File size Throughput MB/s > 926M 143 > > So again it seems like it is not able to use all available > CPU cycles. > > Speculation > ----------- > The speedup when going from 1 to 2 schedulers on a dual core > machine was pretty good, 1.77. > > But on the 4 or 8 core machines the speedup from 1 to 4(8) cores > was only about 1.7-1.78. Which is not very impressive. > > I really do not know enough about modern CPUs, but I will > not let that stop me from making a wild guess. > > The Boyer-Moore search algorithm used in this case only > inspects, on average, every twentieth byte. > > Is it possible that when there are 4, 8 or more cores > sharing one cache, and all cores runs code that only > looks at every twentieth byte that we get very poor > cache utilization? > > So to test that I modified wfinder8.erl to count > space and newline characters. And on Steve's 8 core > machine we got the following speedups with different > number of schedulers. > > cores speedup > 1-2 1.08 > 2-4 1.72 > 4-8 1.52 > > 1-4 1.86 > 1-8 2.83 > > Are there any other things that can explain why it seems > to scale so poorly? From rpettit@REDACTED Tue Nov 6 00:26:52 2007 From: rpettit@REDACTED (Rick Pettit) Date: Mon, 5 Nov 2007 17:26:52 -0600 Subject: [erlang-questions] Design question: addressing multiple e.g. gen_server instances? In-Reply-To: <20071105225734.121340@gmx.net> References: <20071105225734.121340@gmx.net> Message-ID: <20071105232652.GB13691@vailsys.com> On Mon, Nov 05, 2007 at 11:57:34PM +0100, nindeu@REDACTED wrote: > Hi, > > I have a design question that puzzles me since quite some time and so far I did not find any satisfying example or other hint to answer my question. Maybe someone of you has a good idea. I will also explain how I approached this so far. Your input is very welcome! > And sorry if this mail becomes a bit long! I don't have time to give a proper answer at this time, but here are a couple comments: 1) the email subject should have the topic "how" keyword in it 2) take a look at pg2(3) => erl -man pg2 -Rick > So my question: > --------------- > How do you address multiple e.g. gen_server instances connected in a 1:N relationship in a consistent and intelligent way if you want to follow the OTP design principles? > > Let me explain more detailed what I mean: Please consider a (simplified) system which e.g. reads a log file, parses them and delivers the result to multiple other components which do whatever necessary. You can design this consisting of several gen_whatever components: > * a monitor: reads log files or whatever input source. -> parser > * a parser: parses the input and generates events. -> event manager > * an event manager: distributes the events to the event handlers -> event handlers > * event handlers: doing whatever necessary > > That means the monitor needs to address the parser during the gen_whatever:call or cast, etc. This works fine according to the OTP design principles as long as: > > a) There is a 1:1 relationship between each following component. > > b) We are in two dimensional space: There is one instance of all modules. I would call it 3D if you have completely independent input sources and components behind that in the call queue where you do not want them to interfere with each other. Like when you want to process log files of completely different web servers: If the parser for webserver A's log file crashes you do not want that B's parser gets disturbed. So you start the whole set of components once for each input source. And consider you do not simply want to start multiple Erlang instances but put another layer of monitor-parser-etc. above the old one. > > As long as a+b ar given: Fine! You hardcode module name and registered process name into the predecessor component. > > But what if there is more than one parser (1:N)? And you do not want to hardcode more than necessary because you would like to regard your components as plugins: Several generic monitors (generic file reader, syslog reader, etc) which just plug into your system? Or one event handler plugin needs to get in contact with another one? And this in 3D process space. > > My approaches so far: > --------------------- > I started with giving each layer in 3D a unique name - I call it a domain - and registering all processes with names: class@REDACTED@domain. Class is the type of process (monitor, parser, etc.). This name is unique as long as we do not have two times the same module in one domain. > > Then I let my supervisors put necessary call target information (module name, registered name) into the startargs of all components. > But this approach on the one side does not scale very well and on the other side do you need to know exactly what a component needs to talk to before you start it. Not very good. > > OK, one step back: I wrote an additional gen_server process: a process registry. Each component at startup only gets told what name it is supposed to register under, which domain it is running and how to reach process registry. Then all processes register themselves during startup with these informations together with class name and module name. Furthermore each component tells process registry what API it has to offer. > Now whenever a component needs to get in contact with another one it contacts process registry first, asking for directions. > I pretty soon realized that I just had doubled the messages which get sent around and implemented a caching mechanism to cache process registry query results. > Still I try to find out where I should store these results best: In the process' state or in an ets table whereas each process owns its own table. > And so far I did not deal with processes residing on different nodes. Guess this will get a bit nasty. > > The process registry approach also has a couple of disadvantages: > * Complexity especially during debugging is an order or magnitude higher now. > * Slightly less performant. > * No guarantee that a target function can be found. Although this could be conquered by first querying all components what functions they will need to access. > > But my main problem is that I am simply to unexperienced with Erlang to decide whether I am on the right track or there is a much better approach. And I guess I am not the first one dealing with such a design question. > > Your feedback is very welcome! > > > Regards, > Eric > -- > Psssst! Schon vom neuen GMX MultiMessenger geh?rt? > Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From nindeu@REDACTED Tue Nov 6 01:34:12 2007 From: nindeu@REDACTED (nindeu@REDACTED) Date: Tue, 06 Nov 2007 01:34:12 +0100 Subject: [erlang-questions] Design question: addressing multiple e.g. gen_server instances? In-Reply-To: <20071105232652.GB13691@vailsys.com> References: <20071105225734.121340@gmx.net> <20071105232652.GB13691@vailsys.com> Message-ID: <20071106003412.121370@gmx.net> -------- Original-Nachricht -------- > Datum: Mon, 5 Nov 2007 17:26:52 -0600 > Von: Rick Pettit > On Mon, Nov 05, 2007 at 11:57:34PM +0100, nindeu@REDACTED wrote: > > Hi, > > > > I have a design question that puzzles me since quite some time and so > far I did not find any satisfying example or other hint to answer my > question. Maybe someone of you has a good idea. I will also explain how I > approached this so far. Your input is very welcome! > > And sorry if this mail becomes a bit long! > > I don't have time to give a proper answer at this time, but here are a > couple comments: > > 1) the email subject should have the topic "how" keyword in it > > 2) take a look at pg2(3) => erl -man pg2 > > -Rick Sorry, Rick, it was not my intention to break the rules of this mailing list. Where can they be found? Regarding pg2: If one interprets process groups as the same as what I called domain in my example, then pg2 is the same as my process registry with additional support for distributed processes and lacking support for specific process attributes. I guess at the end in my system a process needs to find another process by querying for: class ('I am searching for a parser...'), function API ('... which supports getLine/2') in its process group/domain. And as answer it will need the module where the target's API is implemented as well as the process' PID or name/node. Pg2 is interesting. Bit cleaner than my version. ;) Should have found that myself but I still haven't internalize the whole library functions. Regards, Eric -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal f?r Modem und ISDN: http://www.gmx.net/de/go/smartsurfer From dmercer@REDACTED Tue Nov 6 01:18:47 2007 From: dmercer@REDACTED (David Mercer) Date: Mon, 5 Nov 2007 18:18:47 -0600 Subject: [erlang-questions] Tail Call Optimization and Parameter Ordering Message-ID: <00c201c8200a$99a09960$891ea8c0@SSI.CORP> James Hague in "A deeper look at tail recursion in Erlang" (http://prog21.dadgum.com/1.html) makes an interesting point about optimizing tail recursion by keeping parameters in the same order. This, I think, answers a question I have had in my mind about ordering parameters in functions in a module: is it better to put the main object at the beginning of the parameter list or the end? For example, suppose we have a module "widget" that implements some sort of widget--whatever that is--with a couple of member functions that act on a widget, say "change" and "query". Is it better to implement these functions with the widget object being the first parameter or the last? That is, which is better: change(Widget, Arg1, Arg2) -> . query(Widget, Arg1) -> . or: change(Arg1, Arg2, Widget) -> . query(Arg1, Widget) -> . Based on Hague's insight, I would say the former, with the object up front, is better. Why? Because functions that are used by these functions (and functions that use them) are likely to copy the pattern (in fact, they should), and the Widget argument can therefore fall through in the same position. For example, if change/3 has to call a couple of private functions in the module in order to perform the "change," it is likely these functions will have different arity. If we are in the habit of putting the object at the end of the parameter list, then its position will have changed. If, on the other hand, the object is at the beginning of the parameter list, it will always be in the same position and will cause less stack manipulation. Granted, this optimization only occurs in the case of tail calls, but surely this is a good habit to be in for that case when the tail call optimization can be used. Discuss. Cheers, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From rpettit@REDACTED Tue Nov 6 02:06:16 2007 From: rpettit@REDACTED (Rick Pettit) Date: Mon, 5 Nov 2007 19:06:16 -0600 Subject: [erlang-questions] Tail Call Optimization and Parameter Ordering In-Reply-To: <00c201c8200a$99a09960$891ea8c0@SSI.CORP> References: <00c201c8200a$99a09960$891ea8c0@SSI.CORP> Message-ID: <20071106010616.GB23381@vailsys.com> On Mon, Nov 05, 2007 at 06:18:47PM -0600, David Mercer wrote: > James Hague in "A deeper look at tail recursion in Erlang" > (http://prog21.dadgum.com/1.html) makes an interesting point about > optimizing tail recursion by keeping parameters in the same order. This, I > think, answers a question I have had in my mind about ordering parameters in > functions in a module: is it better to put the main object at the beginning > of the parameter list or the end? > > > > For example, suppose we have a module "widget" that implements some sort of > widget--whatever that is--with a couple of member functions that act on a > widget, say "change" and "query". Is it better to implement these functions > with the widget object being the first parameter or the last? That is, > which is better: > > > > change(Widget, Arg1, Arg2) -> . > > query(Widget, Arg1) -> . > > > > or: > > > > change(Arg1, Arg2, Widget) -> . > > query(Arg1, Widget) -> . > > > > Based on Hague's insight, I would say the former, with the object up front, > is better. Why? Because functions that are used by these functions (and > functions that use them) are likely to copy the pattern (in fact, they > should), and the Widget argument can therefore fall through in the same > position. For example, if change/3 has to call a couple of private > functions in the module in order to perform the "change," it is likely these > functions will have different arity. If we are in the habit of putting the > object at the end of the parameter list, then its position will have > changed. If, on the other hand, the object is at the beginning of the > parameter list, it will always be in the same position and will cause less > stack manipulation. Granted, this optimization only occurs in the case of > tail calls, but surely this is a good habit to be in for that case when the > tail call optimization can be used. I don't know the answer regarding performance, but it seems clear that for reasons of consistency alone one might want to always pass the Widget as the first argument to all functions which operate on Widget. -Rick P.S. Perhaps others on the list could correct me but this might be an instance where the 'clarify' topic would have been useful. From jeremy@REDACTED Tue Nov 6 04:38:40 2007 From: jeremy@REDACTED (Jeremy Wall) Date: Mon, 5 Nov 2007 21:38:40 -0600 Subject: [erlang-questions] how to package a library (not application) for release Message-ID: <69d143cd0711051938k2f883429i11f9ff1cb09e1ffc@mail.gmail.com> Does anyone have any links to good documenation on packaging a library for release? Not an application release just a set of library modules. I've gotten a pretty good handle on using systools for an application style release but the documentation is a little fuzzy on what to do for a plain library app. Is it the same thing pretty much except leave the application specific config values blank or is there more to it? -- Jeremy Wall http://jeremy.marzhillstudios.com http://blog.marzhillstudios.com Jeremy@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.hopwood@REDACTED Tue Nov 6 04:50:58 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Tue, 06 Nov 2007 03:50:58 +0000 Subject: [erlang-questions] widefinder update In-Reply-To: <4d08db370710300524waa574e4t7b14c777b8d8f1d2@mail.gmail.com> References: <4d08db370710280021ja85fcd0s5ac8bba4c4d2fd91@mail.gmail.com> <992686.15039.qm@web38809.mail.mud.yahoo.com> <472528A1.5090005@industrial-designers.co.uk> <4d08db370710300524waa574e4t7b14c777b8d8f1d2@mail.gmail.com> Message-ID: <472FE4A2.7060907@industrial-designers.co.uk> Hynek Vychodil wrote: > On 10/29/07, David Hopwood wrote: >> Anders Nygren wrote: >>> Currently that sequential part is ~ 0.5s on my 1.66GHz >>> dual core laptop. the part of the work that can be run in parallel >>> takes ~2.254 s so theoretically we would get >>> Cores Real time Speedup Rel. speedup by doubling #cores >> [...] >>> 8 0.782 3.523 1.360 >> [...] >>> 256 0.509 5.413 1.017 >>> >>> Which is not very good after 8 cores. >> 0.5 s is not very long, in human terms. For me to be convinced that >> there is any need for further optimization, the problem would have >> to be scaled to a point where the total run-time is something that >> a human might conceivably get impatient waiting for. At that point, >> the sequential part would likely be a smaller proportion of the >> run-time anyway. > > It's bad point of view. What if you would like do it 100 times? Then you would only load the Erlang VM once, not 100 times. And cache effects would also mean that the runtime would not be multiplied by 100. > And what about 20GB instead 200MB? That is "scaling the problem to a point where the total run-time is something that a human might conceivably get impatient waiting for". > The serial part will be 50s, [...] No, there is no a-priori reason to believe that the scaling will be linear. For a start, the in-memory solutions can't be used for 20 GB, on typical hardware. > [...] And what about web service? In that case the problem statement should be refined to specify the distribution of queries (if the query was fixed, we could cache the answer and then the computation time would be independent of the number of clients). In the original problem, the data comes from a logfile; maybe we should be indexing that logfile, and updating the index incrementally as it is extended. > You can use three times cheaper HW to serve same amount of users. > It's not enough? Tim Brays exercise is not only 200MB ~ 1Mrec, but > also 1GB ~ 5Mrec, but in this case 2.5s is long time in human terms > if it will may be Web/UI response. Only if the answer has not been cached. My main point is, you can't reasonably assume that the sequential part will still be the same proportion of the run-time when the problem has been scaled. That will depend on *how* it is scaled. -- David Hopwood From lcoquelle@REDACTED Tue Nov 6 06:43:40 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Tue, 6 Nov 2007 13:43:40 +0800 Subject: [erlang-questions] dialyzer and socket without option 'active' Message-ID: Hi, First, thanks for dialyzer contributors: dialyzer find caveat as fast as I write bug :) However, it seems to fail to understand this code: I open a TCP socket with option [{active, false}, {packet,http}], thus I should be able to write something along the line of: case gen_tcp:recv(Sock, 0, TO) -> {ok, {http_request, M, P, V}} -> ... Any -> ... end The code works, but dialyzer complains that 'case' around gen_tcp:recv can never match {'error',atom()} | {'ok',binary() | possibly_improper_list()} ... looks like dialyzer do not understand the non-documented feature (http packet + active false) Is it a known behaviour? Am I doing something wrong? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobias.lindahl@REDACTED Tue Nov 6 10:03:00 2007 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Tue, 06 Nov 2007 10:03:00 +0100 Subject: [erlang-questions] dialyzer and socket without option 'active' In-Reply-To: References: Message-ID: <47302DC4.7020108@it.uu.se> Ludovic Coquelle wrote: > Hi, > First, thanks for dialyzer contributors: dialyzer find caveat as fast as I > write bug :) Thanks! Good to hear that dialyzer helps. > However, it seems to fail to understand this code: > I open a TCP socket with option [{active, false}, {packet,http}], > thus I should be able to write something along the line of: > case gen_tcp:recv(Sock, 0, TO) -> > {ok, {http_request, M, P, V}} -> ... > Any -> ... > end > > The code works, but dialyzer complains that 'case' around gen_tcp:recv can > never match {'error',atom()} | {'ok',binary() | possibly_improper_list()} > ... looks like dialyzer do not understand the non-documented feature (http > packet + active false) > > Is it a known behaviour? You're right. Dialyzer do not know about this. For some library functions that are commonly used, but implemented in a way that dialyzer (and sometimes we) can't find any good information through analysis, we hard-code the information in Dialyzer. We then have to rely on the documentation to find the information, and sometimes there are undocumented features that we miss. > Am I doing something wrong? I cannot answer this. Should this undocumented feature be relied on? Anybody? If this is the case we will add information about this in Dialyzer, and someone probably should document the behavior. Tobias > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From kostis@REDACTED Tue Nov 6 09:22:27 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 06 Nov 2007 10:22:27 +0200 Subject: [erlang-questions] dialyzer and socket without option 'active' In-Reply-To: References: Message-ID: <47302443.8040407@cs.ntua.gr> Ludovic Coquelle wrote: > Hi, > First, thanks for dialyzer contributors: dialyzer find caveat as fast as > I write bug :) Thanks! We know. We have optimized dialyzer especially for users like you ;-) > However, it seems to fail to understand this code: > I open a TCP socket with option [{active, false}, {packet,http}], > thus I should be able to write something along the line of: > case gen_tcp:recv(Sock, 0, TO) -> > {ok, {http_request, M, P, V}} -> ... > Any -> ... > end > > The code works, but dialyzer complains that 'case' around gen_tcp:recv > can never match {'error',atom()} | {'ok',binary() | > possibly_improper_list()} > ... looks like dialyzer do not understand the non-documented feature > (http packet + active false) > > Is it a known behaviour? Am I doing something wrong? For BIFs that are (mostly) in C, dialyzer has hard-coded information about their arguments mainly by taking the corresponding information from the OTP documentation. For dialyzer that's the only way to know their types. If I understand you correctly -- it's actually kind of hard without a concrete example to test and with the erlang.org site down -- you are using options which are not documented. Since dialyzer knows nothing about these options, the only reasonable reaction is to act as if they are not allowed (i.e., the call will fail). Hence the warning. Since we have no guarantee that the options are "there to stay" we will add information about them only when they become official. Sorry about that. Kostis From ulf.wiger@REDACTED Tue Nov 6 09:27:27 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 06 Nov 2007 09:27:27 +0100 Subject: [erlang-questions] Imagine every (active) entity is a process In-Reply-To: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> References: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> Message-ID: <4730256F.9070503@ericsson.com> Alexander Lamb wrote: > > Isn't there a race condition here. Since I have to check first if a > process exists before creating it, I might end up in a situation where > two other processes are doing the same thing and creating twice a > process for the same entity. The second would obviously fail and we > could catch the error. But is this a correct way of proceeding? Also, > is it possible to have thousands of registered processes (as opposed > to non registered processes)? You will find a contrib called dispatcher at Trapexit. It does pretty much exactly what you're asking for, including taking care of the inherent race condition. http://forum.trapexit.org/viewtopic.php?p=30165#30165 BR, Ulf W From bengt.kleberg@REDACTED Tue Nov 6 08:18:02 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 06 Nov 2007 08:18:02 +0100 Subject: [erlang-questions] Dynamically generated atoms get reused if they are the same? In-Reply-To: <20071105222124.121380@gmx.net> References: <20071105222124.121380@gmx.net> Message-ID: <4730152A.9080808@ericsson.com> yes, you are correct. only different atoms need ''different'' space. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-11-05 23:21, nindeu@REDACTED wrote: > Hi, > > According to http://www.erlang.org/doc/efficiency_guide/bif.html#6.1 atoms do not get garbage collected. Meaning if you constantly produce atoms by using list_to_atom/1 you sooner or later will run out of space for them. > > Now I just wrote a small test program which indicates that as long as you produce the same atom, it will not take up additional space: > > atomTest() -> > NewAtom = list_to_atom("itsme"), > io:format("New memory size: ~p, Atoms used: ~p~n", > [erlang:memory(atom), erlang:memory(atom_used)]), > register(NewAtom, self()), > unregister(NewAtom), > receive > after 1000 -> > atomTest() > end. > > So, can anyone confirm, is it correct that dynamically generated Atoms are of no concern as long as you do not produce too many _different_ ones? > > Thank you! > > Regards, > Eric From alexander.lamb@REDACTED Tue Nov 6 10:17:16 2007 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Tue, 6 Nov 2007 10:17:16 +0100 Subject: [erlang-questions] Imagine every (active) entity is a process In-Reply-To: <4730256F.9070503@ericsson.com> References: <16ADEF88-D183-4A79-9CD5-E8BA25A83466@rodanotech.ch> <4730256F.9070503@ericsson.com> Message-ID: <46EAF381-987B-471E-8466-527DE66B3E7A@rodanotech.ch> Thanks a lot. I am starting to get a better picture of what is possible. Alex Le 6 nov. 07 ? 09:27, Ulf Wiger (TN/EAB) a ?crit : > Alexander Lamb wrote: >> Isn't there a race condition here. Since I have to check first if >> a process exists before creating it, I might end up in a situation >> where two other processes are doing the same thing and creating >> twice a process for the same entity. The second would obviously >> fail and we could catch the error. But is this a correct way of >> proceeding? Also, is it possible to have thousands of registered >> processes (as opposed to non registered processes)? > > You will find a contrib called dispatcher at Trapexit. > It does pretty much exactly what you're asking for, including > taking care of the inherent race condition. > > http://forum.trapexit.org/viewtopic.php?p=30165#30165 > > BR, > Ulf W > -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From bjorn@REDACTED Tue Nov 6 12:09:21 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 06 Nov 2007 12:09:21 +0100 Subject: [erlang-questions] dialyzer and socket without option 'active' In-Reply-To: <47302DC4.7020108@it.uu.se> References: <47302DC4.7020108@it.uu.se> Message-ID: Tobias Lindahl writes: > > Am I doing something wrong? > > I cannot answer this. Should this undocumented feature be relied on? > Anybody? If this is the case we will add information about this in > Dialyzer, and someone probably should document the behavior. It is likely that we will document {packet,http} in a future release. Note that there have been some bugs reported in {packet,http}. If time permits, those bugs will be fixed in the upcoming R12B release. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From glpunzi@REDACTED Tue Nov 6 13:23:35 2007 From: glpunzi@REDACTED (glpunzi@REDACTED) Date: Tue, 6 Nov 2007 13:23:35 +0100 (CET) Subject: [erlang-questions] QUestions about erlang Message-ID: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> Hi all My name is Giuseppe Luigi, and I write from Murcia, Spain. I have experience in .NET, Delphi, VB and other languages. Searching for better languages/enviroments to learn, I'm seeking Squeak (Smalltalk), and discovered erlang. The information I saw, looks nice, and I would like to know, if erlang is a good choice for my needs. At the moment, we want start 2 new project (well, more projects, but now this is the most important). One, will be a Point Of Sale software, and the other a little app to connect to a MS Access database for some maintenance tasks, and I have some questions. - Is erlang fast? - How is the persistence/database connection? - Is fully object oriented? - What about graphical interface for the apps? and web frontend? - PocketPC, Palm support? - What about the community for support? - Spanish erlang-developers? I think this is all at the moment, but, sure, I will post some other questions later. Thanks for your time, and sorry for my bad english. From bjorn@REDACTED Tue Nov 6 14:33:11 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 06 Nov 2007 14:33:11 +0100 Subject: [erlang-questions] Tail Call Optimization and Parameter Ordering In-Reply-To: <00c201c8200a$99a09960$891ea8c0@SSI.CORP> References: <00c201c8200a$99a09960$891ea8c0@SSI.CORP> Message-ID: "David Mercer" writes: > > If, on the other hand, the object is at the beginning of the > parameter list, it will always be in the same position and will cause less > stack manipulation. Granted, this optimization only occurs in the case of > tail calls, but surely this is a good habit to be in for that case when the > tail call optimization can be used. Arguments are passed in (virtual machine) registers, not on the stack. The same optimization is done for any type of call, tail-recursive or body-recursive; if a value happens to be in the right register, no extra move instructions will be generated. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From chsu79@REDACTED Tue Nov 6 14:27:44 2007 From: chsu79@REDACTED (Christian S) Date: Tue, 6 Nov 2007 14:27:44 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> Message-ID: I can hear how other subscribers are tapping away their mail response to you, so prepare your mailbox to be erlang-questions-dotted > - Is erlang fast? It is not good as good at number crunching as ocaml or low level imperative languages. It does however build fast systems, see this slide: http://www.slideshare.net/Arbow/comparing-cpp-and-erlang-for-motorola-telecoms-software/ Also, erlang is very succinct and quick coded. That's an important way to be fast. > - How is the persistence/database connection? My opinion: They work, but they're not to impress with. Erlang has a database called mnesia that provide much higher transaction rates than links to external dbs, mnesia also support distribution over several nodes. > - Is fully object oriented? It is fully concurrency oriented. Erlang is religiously against hiding mutable state inside objects. > - What about graphical interface for the apps? and web frontend? You can create desktop guis using the 'gs' application which is back ended in Tcl/Tk. This will not impress anyone. There is 'gtknode', a c-node, a way for erlang to communicate with a c program running GTK+ to exchange events. I dont have experience with it, but it seems great and you can build the GUI part in Glade. There is soon a number of web server alternatives popping up. Yaws is the popular one so far, but I think that might change now that other commercially used and tested web servers are going open source. > - PocketPC, Palm support? There is an ARM port of erlang, might require some assembly. > - What about the community for support? Ridiculously good. If I dont get an answer in freenode #erlang within minutes I get a very good answer from this list in an hour. If it is during swedish office hours you often get support from the author directly. It's good to be small. > - Spanish erlang-developers? I can't say I have noticed any larger group of spanish erlang developers. From glpunzi@REDACTED Tue Nov 6 14:50:40 2007 From: glpunzi@REDACTED (Giuseppe Luigi Punzi Ruiz) Date: Tue, 6 Nov 2007 14:50:40 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> Message-ID: Hi again, El 06/11/2007, a las 14:27, Christian S escribi?: > I can hear how other subscribers are tapping away their mail response > to you, so prepare your mailbox to be erlang-questions-dotted Yes, mail rules created :D > >> - Is erlang fast? > > It is not good as good at number crunching as ocaml or low level > imperative languages. It does however build fast systems, see this > slide: > > http://www.slideshare.net/Arbow/comparing-cpp-and-erlang-for- > motorola-telecoms-software/ > > Also, erlang is very succinct and quick coded. That's an important way > to be fast. Well, this questions was stupid. I know Wings, and is great in perfomance I think. > >> - How is the persistence/database connection? > > My opinion: They work, but they're not to impress with. > Erlang has a database called mnesia that provide much higher > transaction rates than links to external dbs, mnesia also support > distribution over several nodes. And, on the other hand, you can access too to postgresql, mysql? > >> - What about graphical interface for the apps? and web frontend? > > You can create desktop guis using the 'gs' application which is back > ended in Tcl/Tk. This will not impress anyone. There is 'gtknode', a > c-node, a way for erlang to communicate with a c program running GTK+ > to exchange events. I dont have experience with it, but it seems great > and you can build the GUI part in Glade. interesting. Some documentation about this? > There is soon a number of web server alternatives popping up. Yaws is > the popular one so far, but I think that might change now that other > commercially used and tested web servers are going open source. Yes, but not all webservers accepts erlang. > >> - PocketPC, Palm support? > > There is an ARM port of erlang, might require some assembly. Is not important at the moment. > >> - What about the community for support? > > Ridiculously good. If I dont get an answer in freenode #erlang within > minutes I get a very good answer from this list in an hour. If it is > during swedish office hours you often get support from the author > directly. It's good to be small. Yes, in the smalltalk community happens the same. > >> - Spanish erlang-developers? > > I can't say I have noticed any larger group of spanish erlang > developers. Ok. From the point of view of a newbie, I see erlang as a lenguaje for great scale apps. What do you think about use it for a small company thath develop small software, like a POS, or something similar? Thanks for your answers :D From ulf.wiger@REDACTED Tue Nov 6 15:06:48 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 06 Nov 2007 15:06:48 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> Message-ID: <473074F8.80307@ericsson.com> glpunzi@REDACTED wrote: > Hi all > > My name is Giuseppe Luigi, and I write from Murcia, Spain. Nice part of the world. I spent my honeymoon driving around near Altea and once had the pleasure of celebrating San Juan in Alicante. (: > At the moment, we want start 2 new project (well, more projects, > but now this is the most important). One, will be a Point Of Sale > software, and the other a little app to connect to a MS Access > database for some maintenance tasks, and I have some questions. > > - Is erlang fast? Most likely fast enough for this type of application. If you connect to MS Access via ODBC, communication cost is likely to be the dominating factor. > - How is the persistence/database connection? Erlang has a built-in persistent database which you might find useful from time to time. But if your primary target is MS Access, then the ODBC application is probably what you want. http://www.erlang.org/doc/apps/odbc/index.html I'll let someone else account for experiences using Erlang's ODBC with MS Access. > - Is fully object oriented? Yes. (: Actually, you will find that Erlang follows other modeling principles (concurrency-oriented programming using a mostly functional language). It is by no means less powerful than an OO language I noted Christian's answer, so I will refer to his mail on the next three: > - What about graphical interface for the apps? and web frontend? > - PocketPC, Palm support? > - What about the community for support? > - Spanish erlang-developers? The ones I know of are Universidade da Coru?a, and some good people at Universidad Polit?cnica de Madrid. Then of course, there is LambdaStream: http://www.lambdastream.com/web/ BR, Ulf W From glpunzi@REDACTED Tue Nov 6 15:16:17 2007 From: glpunzi@REDACTED (Giuseppe Luigi Punzi Ruiz) Date: Tue, 6 Nov 2007 15:16:17 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <473074F8.80307@ericsson.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <473074F8.80307@ericsson.com> Message-ID: <63F675F3-2344-4822-B92E-1FFC0E94F5F0@lordzealon.com> Hi Ulf, thanks for your answers. El 06/11/2007, a las 15:06, Ulf Wiger (TN/EAB) escribi?: > glpunzi@REDACTED wrote: >> Hi all >> My name is Giuseppe Luigi, and I write from Murcia, Spain. > > Nice part of the world. I spent my honeymoon driving around > near Altea and once had the pleasure of celebrating San Juan > in Alicante. (: > Cool :D > > Most likely fast enough for this type of application. > If you connect to MS Access via ODBC, communication > cost is likely to be the dominating factor. > >> - How is the persistence/database connection? > > Erlang has a built-in persistent database which you > might find useful from time to time. But if your > primary target is MS Access, then the ODBC application > is probably what you want. > > http://www.erlang.org/doc/apps/odbc/index.html > > I'll let someone else account for experiences using > Erlang's ODBC with MS Access. Well, MSAccess is not my primary target. I want an app thath connect to it only to maintain old software. The new POS software will have other database of course. From mats.cronqvist@REDACTED Tue Nov 6 15:51:39 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Tue, 06 Nov 2007 15:51:39 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> Message-ID: <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Tue, 2007-11-06 at 14:50 +0100, Giuseppe Luigi Punzi Ruiz wrote: > Hi again, > > El 06/11/2007, a las 14:27, Christian S escribi?: > > > >> - What about graphical interface for the apps? and web frontend? > > > > You can create desktop guis using the 'gs' application which is back > > ended in Tcl/Tk. This will not impress anyone. There is 'gtknode', a > > c-node, a way for erlang to communicate with a c program running GTK+ > > to exchange events. I dont have experience with it, but it seems great > > and you can build the GUI part in Glade. > > interesting. Some documentation about this? and there are some examples, but documentation is sorely lacking. but it's pretty simple if you are used to glade; you just give the signal handler as "erl". when the signal is triggered the erlang process will receive a message. the widgets are represented as erlang processes with registered names (in the c-node), so you send GTK primitives as messages. the code is here; http://code.google.com/p/gtknode/ mats From Dmitri.Girenko@REDACTED Tue Nov 6 15:57:36 2007 From: Dmitri.Girenko@REDACTED (Dmitri Girenko) Date: Tue, 6 Nov 2007 16:57:36 +0200 Subject: [erlang-questions] how: mnesia: id/generator in a cluster Message-ID: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> Hi all, Having come from J2EE world I find it very difficult to get rid of all the patterns that I'm used to. There is one that can be named ID generator. I have a set of unique objects that have to be stored in the DB (mnesia). I have to generate short unique numeric ID for those items. In my previous life usually a DB procedure/generators were used to ensure ID uniqueness in a cluster environment. But how can I achieve this functionality in OTP? Here are a few ideas that come to my mind: 1. use ordered_set and select last.id + 1. Adds 1 extra select per insert. 2. use table size + 1. 1 extra query, but maybe it's optimized enough? Both these have runtime overhead + race conditions. 3. create a separate singleton process that initializes counter to table_size + 1 and dispatches the "next values". OMG. Singleton in a cluster. Maybe application with failover is better? But why waste a whole application on just sequence generator. 4. Use phash(Item). but how to handle collisions then? Any recommendations? Best regards, Dmitri Girenko From ulf.wiger@REDACTED Tue Nov 6 17:25:44 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 06 Nov 2007 17:25:44 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <63F675F3-2344-4822-B92E-1FFC0E94F5F0@lordzealon.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <473074F8.80307@ericsson.com> <63F675F3-2344-4822-B92E-1FFC0E94F5F0@lordzealon.com> Message-ID: <47309588.1070607@ericsson.com> Giuseppe Luigi Punzi Ruiz wrote: > > Well, MSAccess is not my primary target. I want an app thath connect > to it only to maintain old software. The new POS software will have > other database of course. > Then you might want to take a look at ErlyDB: http://code.google.com/p/erlydb/ It currently supports MySQL, with Postgresql in the works, and other DBMSes may well be added. Yariv, the link to the blog is broken: http://yarivsblog.com/articles/tag/erlydb BR, Ulf W From peter@REDACTED Tue Nov 6 17:20:18 2007 From: peter@REDACTED (Peter K Chan) Date: Tue, 6 Nov 2007 17:20:18 +0100 Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> Message-ID: That's a good question. I wonder about the same thing myself. Here are some of my immature thoughts at the moment: - You may not have to use entity-relation; store the entity data directly in each table. - Use a local ID generator that generates {node(), ID} - I am not sure about your first two methods of using the table's size or ordering for ID generation. What happens if you remove a record? Peter -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Dmitri Girenko Sent: Tuesday, November 06, 2007 8:58 AM To: erlang-questions@REDACTED Subject: [erlang-questions] how: mnesia: id/generator in a cluster Hi all, Having come from J2EE world I find it very difficult to get rid of all the patterns that I'm used to. There is one that can be named ID generator. I have a set of unique objects that have to be stored in the DB (mnesia). I have to generate short unique numeric ID for those items. In my previous life usually a DB procedure/generators were used to ensure ID uniqueness in a cluster environment. But how can I achieve this functionality in OTP? Here are a few ideas that come to my mind: 1. use ordered_set and select last.id + 1. Adds 1 extra select per insert. 2. use table size + 1. 1 extra query, but maybe it's optimized enough? Both these have runtime overhead + race conditions. 3. create a separate singleton process that initializes counter to table_size + 1 and dispatches the "next values". OMG. Singleton in a cluster. Maybe application with failover is better? But why waste a whole application on just sequence generator. 4. Use phash(Item). but how to handle collisions then? Any recommendations? Best regards, Dmitri Girenko _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From lenartlad@REDACTED Tue Nov 6 17:55:33 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 06 Nov 2007 17:55:33 +0100 Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> Message-ID: <47309C85.9090307@volny.cz> Dmitri Girenko wrote: > Hi all, > > Having come from J2EE world I find it very difficult to get rid of all > the patterns that I'm used to. There is one that can be named ID > generator. > > I have a set of unique objects that have to be stored in the DB > (mnesia). I have to generate short unique numeric ID for those items. In > my previous life usually a DB procedure/generators were used to ensure > ID uniqueness in a cluster environment. But how can I achieve this > functionality in OTP? > > Here are a few ideas that come to my mind: > > 1. use ordered_set and select last.id + 1. > Adds 1 extra select per insert. > > 2. use table size + 1. > 1 extra query, but maybe it's optimized enough? > > > Both these have runtime overhead + race conditions. > > > 3. create a separate singleton process that initializes counter to > table_size + 1 and dispatches the "next values". > OMG. Singleton in a cluster. Maybe application with failover is > better? But why waste a whole application on just sequence generator. > > 4. Use phash(Item). > but how to handle collisions then? > > Any recommendations? Hello, See mnesia:dirty_update_counter/3 and mnesia:dirty_read/2. They might be exactly what you are looking for. Hope this helps, Ladislav Lenart From ulf.wiger@REDACTED Tue Nov 6 17:56:35 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 06 Nov 2007 17:56:35 +0100 Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> Message-ID: <47309CC3.2000609@ericsson.com> Dmitri Girenko wrote: > Hi all, > > Having come from J2EE world I find it very difficult to get rid of all > the patterns that I'm used to. There is one that can be named ID > generator. > > I have a set of unique objects that have to be stored in the DB > (mnesia). I have to generate short unique numeric ID for those items. In > my previous life usually a DB procedure/generators were used to ensure > ID uniqueness in a cluster environment. But how can I achieve this > functionality in OTP? If you only care that the ID is unique, then {node(), erlang:now()} is pretty simple and fast. There are some extreme cases where it might not be guaranteed to be unique (primarily if the system clock is changed back a significant amount). BR, Ulf W From matthew@REDACTED Tue Nov 6 19:12:02 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 6 Nov 2007 10:12:02 -0800 Subject: [erlang-questions] MochiWeb on Google Code Message-ID: It's official: MochiWeb is now hosted on Google Code. The source code is available at http://code.google.com/p/mochiweb/ and the mailing list at http://groups.google.com/group/mochiweb/. If you haven't heard of MochiWeb, it's a HTTP library for writing lightweight, high-performance web applications. At Mochi Media, we use it (along with egeoip and eswf---both on Google Code as well) to power our MochiBot and MochiAds services, which each serve dynamically generated Flash content to millions of users every day. We also use it extensively in our internal tools to provide interfaces for non-Erlang applications. Go check it out, do something awesome with it, and let us know. :-) -- Matthew Dempsky http://www.mochimedia.com +1.415.680.3742 From mpquique@REDACTED Tue Nov 6 19:15:56 2007 From: mpquique@REDACTED (=?ISO-8859-1?Q?Enrique_Marcote_Pe=F1a?=) Date: Tue, 6 Nov 2007 19:15:56 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> Message-ID: Hi (Hola) Giuseppe, As Ulf mentioned, there are mainly two erlang communities in Spain, one in A Coru?a and another one in Madrid (you may even find erlang/ OTP courses in Spain :-). I personally work in a small company where we use erlang on our daily basis. I would say that using erlang does not depend on the size (of your projects or company), but on the kind of projects you develop. IMHO I wouldn't point out erlang to be the best choice for desktop applications. Regardless erlang is the best choice for the two projects you have in mind right now (and I'm afraid not), you should certainly give it a try, you won't be disappointed. The erlang community is excellent and erlang/OTP is unbeatable for the kind of projects it was originally conceived for. Please feel free to contact me outside of the list if you want to share some thoughts in spanish :-) Find my contact details below. Regards, -- Enrique Marcote Pe?a Nomasystems, S.L. C/ Juan Fl?rez 8, 5? 15004, A Coru?a Land line: (+34) 902 056 155 Mobile: (+34) 628 095 484 Web Phone: http://www.nomasystems.com (ext 202) enrique(dot)marcote(at)omasystems(dot)com El 06/11/2007, a las 14:50, Giuseppe Luigi Punzi Ruiz escribi?: > Hi again, > > El 06/11/2007, a las 14:27, Christian S escribi?: > >> I can hear how other subscribers are tapping away their mail response >> to you, so prepare your mailbox to be erlang-questions-dotted > > Yes, mail rules created :D > >> >>> - Is erlang fast? >> >> It is not good as good at number crunching as ocaml or low level >> imperative languages. It does however build fast systems, see this >> slide: >> >> http://www.slideshare.net/Arbow/comparing-cpp-and-erlang-for- >> motorola-telecoms-software/ >> >> Also, erlang is very succinct and quick coded. That's an important >> way >> to be fast. > > Well, this questions was stupid. I know Wings, and is great in > perfomance I think. > >> >>> - How is the persistence/database connection? >> >> My opinion: They work, but they're not to impress with. >> Erlang has a database called mnesia that provide much higher >> transaction rates than links to external dbs, mnesia also support >> distribution over several nodes. > > And, on the other hand, you can access too to postgresql, mysql? > > >> >>> - What about graphical interface for the apps? and web frontend? >> >> You can create desktop guis using the 'gs' application which is back >> ended in Tcl/Tk. This will not impress anyone. There is 'gtknode', a >> c-node, a way for erlang to communicate with a c program running GTK+ >> to exchange events. I dont have experience with it, but it seems >> great >> and you can build the GUI part in Glade. > > interesting. Some documentation about this? > >> There is soon a number of web server alternatives popping up. Yaws is >> the popular one so far, but I think that might change now that other >> commercially used and tested web servers are going open source. > > Yes, but not all webservers accepts erlang. > >> >>> - PocketPC, Palm support? >> >> There is an ARM port of erlang, might require some assembly. > > Is not important at the moment. > >> >>> - What about the community for support? >> >> Ridiculously good. If I dont get an answer in freenode #erlang within >> minutes I get a very good answer from this list in an hour. If it is >> during swedish office hours you often get support from the author >> directly. It's good to be small. > > Yes, in the smalltalk community happens the same. > >> >>> - Spanish erlang-developers? >> >> I can't say I have noticed any larger group of spanish erlang >> developers. > > Ok. > > From the point of view of a newbie, I see erlang as a lenguaje for > great scale apps. What do you think about use it for a small company > thath develop small software, like a POS, or something similar? > > Thanks for your answers :D > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From puzza007@REDACTED Tue Nov 6 19:56:55 2007 From: puzza007@REDACTED (Paul Oliver) Date: Tue, 6 Nov 2007 18:56:55 +0000 Subject: [erlang-questions] Erlang Blowfish implementation Message-ID: Hi, Can anyone point me at an Erlang Blowfish implementation? Cheers, Paul. From michael.regen@REDACTED Tue Nov 6 22:19:59 2007 From: michael.regen@REDACTED (Michael Regen) Date: Tue, 6 Nov 2007 22:19:59 +0100 Subject: [erlang-questions] How: SSL for distribution in R11B-5? Message-ID: <9b59d0270711061319r479c8c5xa8d0fb5c71b3c896@mail.gmail.com> Got lots of problems when trying to use SSL as distribution protocol for Erlang R11B-5. At the end I either get a crash dump or a pang. I am not very experienced with SSL and I'd really appreciate if someone here can help! Currently I am stuck at this point: Everything starts fine but as soon as I want to ping the second node I get a pang. If I issue a openssl s_client -connect localhost:56047 -showcerts I get the following output (... means lines omitted): CONNECTED(00000003) ... verify error:num=18:self signed certificate ... No client certificate CA names sent --- SSL handshake has read 950 bytes and written 316 bytes --- New, TLSv1/SSLv3, Cipher is AES256-SHA Server public key is 1024 bit Compression: NONE Expansion: NONE SSL-Session: Protocol : TLSv1 Cipher : AES256-SHA ... Key-Arg : None Start Time: 1194383094 Timeout : 300 (sec) Verify return code: 18 (self signed certificate) Does that mean I made something wrong with the certificates? Just for now I don't need anything else than self signed certificates. What I did so far Unfortunately the Erlang user guide for SSL distribution is not easy to understand and seems to miss some points. The explanation how a certificate should be created does not really work. Whatever certificate I try in the SSL examples folder ends with a crash dump. Same for certificates built with the make_certs.erl program. The tutorial 'Distributed erlang using ssl through firewalls' on trapexit also leaves out this point. This posting here is the only reference I could find which told me how the certificate should look like: http://www.trapexit.org/forum/viewtopic.php?p=22483&sid=c1b22ed8f4db4feb8e4997dcaa3122e0 Ah, certificate and key need to be in one file. At the end I followed this guide to create my certificate: http://sial.org/howto/openssl/self-signed/ I also patched ssl_prim.erl following http://www.erlang.org/pipermail/erlang-questions/2007-July/027879.html. If I don't patch it, openssl s_client stops after the line 'CONNECTED(00000003)'. Nevertheless netstat --tcp -n still shows me some bytes hanging in the Recv-Q of the Erlang server. Bruce is also right when saying that setting ERL_SSL_DEBUG stops erts from starting up: http://www.erlang.org/pipermail/erlang-questions/2007-July/027879.html So for now I am stuck since I don't know what options I have left. Anyone here who can help? Thanks in advance! Cheers, Michael From xpdoka@REDACTED Tue Nov 6 22:53:58 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Tue, 6 Nov 2007 22:53:58 +0100 Subject: [erlang-questions] Why do two processes appear after a spawn? Message-ID: <53BA9F06-A6FD-4E87-B80F-D9E45AA80608@dominicwilliams.net> Hello, Can someone explain to me what is going on here? Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.4 (abort with ^G) 1> F = fun() -> P=processes(), {length(P), lists:member(self(),P)} end. #Fun 2> G = fun() -> P=F(), timer:sleep(500), Q=F(), io:fwrite("~p~n", [{P,Q}]) end. #Fun 3> F(). {24,true} 4> spawn(G). <0.35.0> {{25,true},{26,true}} So the newly spawned process is immediately listed by processes(), but a bit later another one appears. What is this 26th process? Upon further investigation: 6> H = fun(P, Q) -> [process_info(Pid) || Pid <- Q -- P] end. #Fun 7> J = fun() -> P=processes(), timer:sleep(500), Q=processes(), io:fwrite("~p~n",[H(P,Q)]) end. #Fun 8> F(). {24,true} 9> spawn(J). <0.42.0> [[{current_function,{io,wait_io_mon_reply,2}}, {initial_call,{erlang,apply,2}}, {status,waiting}, {message_queue_len,0}, {messages,[]}, {links,[<0.25.0>]}, {dictionary,[]}, {trap_exit,false}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0.24.0>}, {heap_size,233}, {stack_size,6}, {reductions,15}, {garbage_collection,[{fullsweep_after,65535}]}]] Any explanation? Thanks, Dominic Williams http://dominicwilliams.net ---- From anders.nygren@REDACTED Tue Nov 6 22:56:34 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 6 Nov 2007 15:56:34 -0600 Subject: [erlang-questions] How: SSL for distribution in R11B-5? In-Reply-To: <9b59d0270711061319r479c8c5xa8d0fb5c71b3c896@mail.gmail.com> References: <9b59d0270711061319r479c8c5xa8d0fb5c71b3c896@mail.gmail.com> Message-ID: On Nov 6, 2007 3:19 PM, Michael Regen wrote: > Got lots of problems when trying to use SSL as distribution protocol > for Erlang R11B-5. At the end I either get a crash dump or a pang. I > am not very experienced with SSL and I'd really appreciate if someone > here can help! > > Currently I am stuck at this point: Everything starts fine but as soon > as I want to ping the second node I get a pang. > If I issue a openssl s_client -connect localhost:56047 -showcerts > I get the following output (... means lines omitted): > > CONNECTED(00000003) > ... > verify error:num=18:self signed certificate > ... > No client certificate CA names sent > --- > SSL handshake has read 950 bytes and written 316 bytes > --- > New, TLSv1/SSLv3, Cipher is AES256-SHA > Server public key is 1024 bit > Compression: NONE > Expansion: NONE > SSL-Session: > Protocol : TLSv1 > Cipher : AES256-SHA > ... > Key-Arg : None > Start Time: 1194383094 > Timeout : 300 (sec) > Verify return code: 18 (self signed certificate) > > Does that mean I made something wrong with the certificates? Just for > now I don't need anything else than self signed certificates. > > What I did so far > Unfortunately the Erlang user guide for SSL distribution is not easy > to understand and seems to miss some points. The explanation how a > certificate should be created does not really work. Whatever > certificate I try in the SSL examples folder ends with a crash dump. > Same for certificates built with the make_certs.erl program. > The tutorial 'Distributed erlang using ssl through firewalls' on > trapexit also leaves out this point. > > This posting here is the only reference I could find which told me how > the certificate should look like: > http://www.trapexit.org/forum/viewtopic.php?p=22483&sid=c1b22ed8f4db4feb8e4997dcaa3122e0 > > Ah, certificate and key need to be in one file. At the end I followed > this guide to create my certificate: > http://sial.org/howto/openssl/self-signed/ > > I also patched ssl_prim.erl following > http://www.erlang.org/pipermail/erlang-questions/2007-July/027879.html. > If I don't patch it, openssl s_client stops after the line > 'CONNECTED(00000003)'. > > Nevertheless netstat --tcp -n still shows me some bytes hanging in the > Recv-Q of the Erlang server. > > Bruce is also right when saying that setting ERL_SSL_DEBUG stops erts > from starting up: > http://www.erlang.org/pipermail/erlang-questions/2007-July/027879.html > > So for now I am stuck since I don't know what options I have left. > Anyone here who can help? Thanks in advance! > > It seems ssl distribution is broken in R11B-5 See these messages for more http://www.erlang.org/pipermail/erlang-bugs/2007-July/000386.html http://www.erlang.org/pipermail/erlang-patches/2007-July/000184.html /Anders > Cheers, > Michael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From glpunzi@REDACTED Wed Nov 7 00:01:28 2007 From: glpunzi@REDACTED (Giuseppe Luigi Punzi Ruiz) Date: Wed, 7 Nov 2007 00:01:28 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> Message-ID: Glade could be nice, but I can't find a Glade port to OSX. A spanish guy told me about ESDL, and I think this is the unique option as far as I can see. I need a stable UI and seems thath ESDL is the unique stable. El 06/11/2007, a las 15:51, mats cronqvist escribi?: > On Tue, 2007-11-06 at 14:50 +0100, Giuseppe Luigi Punzi Ruiz wrote: >> Hi again, >> >> El 06/11/2007, a las 14:27, Christian S escribi?: > >>> >>>> - What about graphical interface for the apps? and web frontend? >>> >>> You can create desktop guis using the 'gs' application which is back >>> ended in Tcl/Tk. This will not impress anyone. There is 'gtknode', a >>> c-node, a way for erlang to communicate with a c program running >>> GTK+ >>> to exchange events. I dont have experience with it, but it seems >>> great >>> and you can build the GUI part in Glade. >> >> interesting. Some documentation about this? > > and there are some examples, but documentation is sorely lacking. > > but it's pretty simple if you are used to glade; you just give the > signal handler as "erl". when the signal is triggered the erlang > process > will receive a message. the widgets are represented as erlang > processes > with registered names (in the c-node), so you send GTK primitives as > messages. > > the code is here; > http://code.google.com/p/gtknode/ > > mats > From michael.regen@REDACTED Wed Nov 7 00:06:05 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 7 Nov 2007 00:06:05 +0100 Subject: [erlang-questions] How: SSL for distribution in R11B-5? In-Reply-To: References: <9b59d0270711061319r479c8c5xa8d0fb5c71b3c896@mail.gmail.com> Message-ID: <9b59d0270711061506h31591c33jf1f61e6f31f9eec5@mail.gmail.com> > It seems ssl distribution is broken in R11B-5 > See these messages for more > > http://www.erlang.org/pipermail/erlang-bugs/2007-July/000386.html > > http://www.erlang.org/pipermail/erlang-patches/2007-July/000184.html > > /Anders Thank you, Anders, the second link's patches did the job. Very good! And thanks to Bruce for providing the patches. Let's hope they find their way into the next version of Erlang. And if someone from the Erlang maintainer reads this: setting '-ssl debug true' or the environment variable ERL_SSL_DEBUG leads to a Erlang system which does not really start up. Setting '-ssl msgdebug true' will print a few lines and you end up in your Linux shell afterwards. Which rules out a lot of debugging options. Cheers, Michael From nc@REDACTED Wed Nov 7 00:20:13 2007 From: nc@REDACTED (Nicolas Charpentier) Date: Tue, 6 Nov 2007 18:20:13 -0500 (EST) Subject: [erlang-questions] Why do two processes appear after a spawn? In-Reply-To: <53BA9F06-A6FD-4E87-B80F-D9E45AA80608@dominicwilliams.net> References: <53BA9F06-A6FD-4E87-B80F-D9E45AA80608@dominicwilliams.net> Message-ID: <25272.217.128.75.198.1194391213.squirrel@www.geekisp.com> Hi, I used dbg module to produce some traces which can be useful to 'erlang gurus' for the explanation. 1> F = fun() -> P=processes(), {length(P), lists:member(self(),P)} end. #Fun 2> G = fun() -> P=F(), timer:sleep(500), Q=F(), io:fwrite("~p~n", [{P,Q}]) end. #Fun 3> F(). {24,true} 4>dbg:tracer(). 5>dbg:p(all,[p]). 6>spawn(G). (<0.38.0>) exit {ok,[{call,2,{atom,2,spawn},[{var,2,'G'}]}],3} (<0.25.0>) getting_unlinked <0.38.0> (<0.30.0>) spawn <0.39.0> as erlang:apply(#Fun,[]) (<0.25.0>) spawn <0.40.0> as erlang:apply(#Fun,[]) (<0.25.0>) link <0.40.0> (<0.2.0>) getting_unlinked #Port<0.99> (<0.39.0>) exit normal I removed those lines from the output as they are function results: <0.39.0> {{27,true},{28,true}} Regards. ---- Nicolas Charpentier http://charpi.net From jeffm@REDACTED Wed Nov 7 01:34:10 2007 From: jeffm@REDACTED (jm) Date: Wed, 07 Nov 2007 11:34:10 +1100 Subject: [erlang-questions] how: erlang interface to version control In-Reply-To: <4722F3D9.4030008@ericsson.com> References: <4722B821.5080003@ghostgun.com> <4722F3D9.4030008@ericsson.com> Message-ID: <47310802.8070106@ghostgun.com> Ulf Wiger (TN/EAB) wrote: > Since I had no need for updating CVS via the web server, > I haven't done any work on that. > > (I've only attached the source code of the CVS plugin) > Thanks. I'll take a look at it. I was rather hoping for subversion. Never mind. This will give me a better idea of how to go about it. Thanks again. Jeff. From bruce@REDACTED Wed Nov 7 02:30:43 2007 From: bruce@REDACTED (Bruce Fitzsimons) Date: Wed, 07 Nov 2007 14:30:43 +1300 Subject: [erlang-questions] How: SSL for distribution in R11B-5? In-Reply-To: <9b59d0270711061506h31591c33jf1f61e6f31f9eec5@mail.gmail.com> References: <9b59d0270711061319r479c8c5xa8d0fb5c71b3c896@mail.gmail.com> <9b59d0270711061506h31591c33jf1f61e6f31f9eec5@mail.gmail.com> Message-ID: <47311543.60105@fitzsimons.org> Michael Regen wrote: >> It seems ssl distribution is broken in R11B-5 >> See these messages for more >> >> http://www.erlang.org/pipermail/erlang-bugs/2007-July/000386.html >> >> http://www.erlang.org/pipermail/erlang-patches/2007-July/000184.html >> >> /Anders >> > > Thank you, Anders, the second link's patches did the job. Very good! > And thanks to Bruce for providing the patches. Let's hope they find > their way into the next version of Erlang. > And if someone from the Erlang maintainer reads this: setting '-ssl > debug true' or the environment variable ERL_SSL_DEBUG leads to a > Erlang system which does not really start up. Setting '-ssl msgdebug > true' will print a few lines and you end up in your Linux shell > afterwards. Which rules out a lot of debugging options. > I'm gald you've got it working, if I could remove that first, incorrect, "Success!!" email from the archives I would :-( This issue has been impacting a few people, and I will not hold my patches up as the ultimate answer. They solve the distribution problem but I may have subtly borked SSL; I'd like to see if the test suite ran successfully at least. If I'd had another weekend to spend I would have reworked the code into something that didn't have so many side-effects and/or reached enlightenment about the reasoning behind the existing code structure. I would ask that SSL distribution gets added to the test suite though as this code compiled cleanly but could never have worked. I don't know of any development shop that would willingly let such a thing occur. (and dear /// I apologise if the tone of my original reports was offensive. I was frustrated.) Regards, Bruce From Dmitri.Girenko@REDACTED Wed Nov 7 09:02:29 2007 From: Dmitri.Girenko@REDACTED (Dmitri Girenko) Date: Wed, 7 Nov 2007 10:02:29 +0200 Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <47309C85.9090307@volny.cz> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> <47309C85.9090307@volny.cz> Message-ID: <697074A35ED91748882E3850BDCE295EC8E62F@leenu.akumiitti.net> Thanks Ladislav, dirty_update_counter is exactly what I've been looking for. {node(), now()} is also a good idea, but I need a short and numeric ID to embed into URL. > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Ladislav Lenart > Sent: 6. marraskuuta 2007 18:56 > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] how: mnesia: id/generator in a cluster > > Dmitri Girenko wrote: > > Hi all, > > > > Having come from J2EE world I find it very difficult to get rid of all > > the patterns that I'm used to. There is one that can be named ID > > generator. > > > > I have a set of unique objects that have to be stored in the DB > > (mnesia). I have to generate short unique numeric ID for those items. In > > my previous life usually a DB procedure/generators were used to ensure > > ID uniqueness in a cluster environment. But how can I achieve this > > functionality in OTP? > > > > Here are a few ideas that come to my mind: > > > > 1. use ordered_set and select last.id + 1. > > Adds 1 extra select per insert. > > > > 2. use table size + 1. > > 1 extra query, but maybe it's optimized enough? > > > > > > Both these have runtime overhead + race conditions. > > > > > > 3. create a separate singleton process that initializes counter to > > table_size + 1 and dispatches the "next values". > > OMG. Singleton in a cluster. Maybe application with failover is > > better? But why waste a whole application on just sequence generator. > > > > 4. Use phash(Item). > > but how to handle collisions then? > > > > Any recommendations? > > Hello, > > See mnesia:dirty_update_counter/3 and mnesia:dirty_read/2. > They might be exactly what you are looking for. > > Hope this helps, > > Ladislav Lenart > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Wed Nov 7 09:16:26 2007 From: chsu79@REDACTED (Christian S) Date: Wed, 7 Nov 2007 09:16:26 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> Message-ID: 2007/11/7, Giuseppe Luigi Punzi Ruiz : > Glade could be nice, but I can't find a Glade port to OSX. > > A spanish guy told me about ESDL, and I think this is the unique > option as far as I can see. > > I need a stable UI and seems thath ESDL is the unique stable. Isn't ESDL a bit low level? Lacking the concept of widgets and being a good buddy in a desktop in terms of cut and paste, resizing windows and so on. Joel Reymont have spent time thinking about how to connect erlang with osx' gui. He might even have produced some code. Is your point of sale terminal platform based on os x? I would have thought that cheap tiny ARM computers running linux would be the most budget:ish alternative (and thus GTK). > > There is soon a number of web server alternatives popping up. Yaws is > > the popular one so far, but I think that might change now that other > > commercially used and tested web servers are going open source. > > Yes, but not all webservers accepts erlang. I think I know what you mean. What we do is that we run the webserver itself in Erlang. What I meant is that there are more all-erlang webservers popping up now. Besides yaws (all erlang), you have mochiweb (all erlang), plain old inets web server (all erlang), im trying to make iserve handy (all erlang). And on top of this you have multiple choices in template languages. Another alternative would be to write a FastCGI server in erlang, since apache and IIS seem to be capable of relaying requests via FastCGI, as do the tiny ?ber-optimized ones (nginx). FastCGI seem like a sensible protocol. PS. Have anyone implemented a FastCGI server? I see the {packet, fcgi} protocol in gen_tcp, but not any code making use of it. Can it be used for building a FastCGI server in erlang? From ulf.wiger@REDACTED Wed Nov 7 09:16:54 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 07 Nov 2007 09:16:54 +0100 Subject: [erlang-questions] Why do two processes appear after a spawn? In-Reply-To: <53BA9F06-A6FD-4E87-B80F-D9E45AA80608@dominicwilliams.net> References: <53BA9F06-A6FD-4E87-B80F-D9E45AA80608@dominicwilliams.net> Message-ID: <47317476.3070104@ericsson.com> Dominic Williams wrote: > Hello, > > Can someone explain to me what is going on here? > > Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.5.4 (abort with ^G) > 1> F = fun() -> P=processes(), {length(P), lists:member(self(),P)} end. > #Fun > 2> G = fun() -> P=F(), timer:sleep(500), Q=F(), io:fwrite("~p~n", > [{P,Q}]) end. > #Fun > 3> F(). > {24,true} > 4> spawn(G). > <0.35.0> > {{25,true},{26,true}} > > So the newly spawned process is immediately listed by processes(), > but a bit later another one appears. What is this 26th process? The shell evaluator spawns a process that parses the command line. It returns the parsed expression using exit(io:parse_erl_exprs(Prompt)). So, on when hitting return after "spawn(G).", the current parser process exits. Then, your requested spawn operation is executed, which leads to the first call to processes(). While the new process sleeps, the shell has time to start a new parser process to handle the next command, and it appears in the second call to processes(). BR, Ulf W From chsu79@REDACTED Wed Nov 7 09:24:49 2007 From: chsu79@REDACTED (Christian S) Date: Wed, 7 Nov 2007 09:24:49 +0100 Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <697074A35ED91748882E3850BDCE295EC8E62F@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> <47309C85.9090307@volny.cz> <697074A35ED91748882E3850BDCE295EC8E62F@leenu.akumiitti.net> Message-ID: 2007/11/7, Dmitri Girenko : > Thanks Ladislav, dirty_update_counter is exactly what I've been looking > for. What happens if you have distributed mnesia, and a 'sequences' table where two nodes run dirty_update_counter at the same time? My guess is that both could get the same number? Thinking out loud: If so, I guess one could use {local_content, true} on each node's "sequence" table and make the key one have be {node(), SequenceId}. From ulf.wiger@REDACTED Wed Nov 7 09:31:11 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 07 Nov 2007 09:31:11 +0100 Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <697074A35ED91748882E3850BDCE295EC8E62F@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> <47309C85.9090307@volny.cz> <697074A35ED91748882E3850BDCE295EC8E62F@leenu.akumiitti.net> Message-ID: <473177CF.7020506@ericsson.com> Dmitri Girenko wrote: > Thanks Ladislav, dirty_update_counter is exactly what I've been looking > for. > > {node(), now()} is also a good idea, but I need a short and numeric ID > to embed into URL. It's a bit tricky if you want it really short, but still unique (and also numeric). I once wrote the following code, which I've never used in any real product. The idea is that you have a counter per erlang node in your cluster, and then assign each node an index; the combination of node index and counter value becomes your unique id (unique to your cluster, that is). The new() operation is fast, as long as the counter stays within the predefined bounds (32 bits), but then, a new node index is checked out, which is a heavier operation. A simple extension would be to remember which node ids have been assigned to each node. That would allow you to determine the source node of each unique id. Note well that I never used it. See it as a sketch of one possible solution. BR, Ulf W -module(bbsOid). -export([new/0, incr_vsn/1, add_branch/2, add_peer_node/1]). -define(MAX_SEQ, 16#ffffFFFF) new() -> MyNode = node(), NodeId = mnesia:read_table_property(schema, {bbs_node_id,MyNode}), case mnesia:dirty_update_counter(bbsOid, MyNode, 1) of NodeSeq when NodeSeq > ?MAX_SEQ -> NewNodeId = set_new_node_id(MyNode), mnesia:dirty_write({bbsOid, MyNode, 1}), {NewNodeId, 1}; NodeSeq -> {NodeId, NodeSeq} end. add_peer_node(Node) -> mnesia_schema:schema_transaction( fun() -> case is_peer_node(Node) of true -> mnesia:abort({peer_node_exists, Node}); false -> do_set_new_node_id(Node) end end). set_new_node_id(Node) -> mnesia_schema:schema_transaction( fun() -> case is_peer_node(Node) of true -> do_set_new_node_id(Node); false -> mnesia:abort({not_a_peer_node, Node}) end end). do_set_new_node_id(Node) -> PeerNodes = read_property(bbs_peer_nodes, ordsets:new()), OldCtr = read_property(bbs_node_id_ctr, 0), NewCtr = OldCtr + 1, write_property({bbs_node_id_ctr, NewCtr}), write_property({{bbs_node_id, Node}, NewCtr}), write_property({bbs_peer_nodes, ordsets:add_element(Node, PeerNodes)}), NewCtr. read_property(P, Default) -> case mnesia_schema:do_read_table_property( schema, P) of undefined -> Default; Value -> Value end. is_peer_node(Node) -> Peers = read_property(bbs_peer_nodes, ordsets:new()), ordsets:is_element(Node, Peers). write_property(P, Value) -> mnesia_schema:do_write_table_property(schema, {P, Value}). From michael.regen@REDACTED Wed Nov 7 10:40:20 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 7 Nov 2007 10:40:20 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> Message-ID: <9b59d0270711070140o3d1294d5p18319cb97b315e07@mail.gmail.com> Regarding a GUI for Erlang - I just stumbled on http://www.gtk-server.org/ So far I have no experience with it and cannot really comment on it. But the way these guys provide a gui to even AWK and KSH scripts is so unique and interesting that I think it at least deserves to be mentioned. They also mention how to compile it under OSX. Cheers, Michael From michael.regen@REDACTED Wed Nov 7 11:17:42 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 7 Nov 2007 11:17:42 +0100 Subject: [erlang-questions] How: SSL for distribution in R11B-5? In-Reply-To: <47311543.60105@fitzsimons.org> References: <9b59d0270711061319r479c8c5xa8d0fb5c71b3c896@mail.gmail.com> <9b59d0270711061506h31591c33jf1f61e6f31f9eec5@mail.gmail.com> <47311543.60105@fitzsimons.org> Message-ID: <9b59d0270711070217h5717a6bl91334c35cccd0186@mail.gmail.com> On Nov 7, 2007 2:30 AM, Bruce Fitzsimons wrote: > I'm gald you've got it working, if I could remove that first, incorrect, > "Success!!" email from the archives I would :-( No worries! I even saw your second mail that explained your first patched did only solve half the problem during I browsed the mailing list search hits for ssl. But my brain was not able to bring both mails into relation. :) > > This issue has been impacting a few people, and I will not hold my > patches up as the ultimate answer. They solve the distribution problem > but I may have subtly borked SSL; I'd like to see if the test suite ran > successfully at least. If I'd had another weekend to spend I would have > reworked the code into something that didn't have so many side-effects > and/or reached enlightenment about the reasoning behind the existing > code structure. Thanks for the warning. We very likely won't need ssl distribution in production until R12 comes out. I just tried to test it to be prepared for the time we will need it. And I think we can rely on our Erlang maintainers that they will fix ssl in the next release. Another maybe quite dangerous problem with the current SSL implementation: Even if I trun on -ssl_dist_opt verify 1 depth 1 server side and use completely bogus self-signed certificates on the client, Erlang gladly greets me with a prompt. In my understanding if I turn on verify, SSL should verify the certificates, realize that no chain of trust can be built and send me to hell!? Apologies up-front if this behaviour is normal and I misunderstood something completely! > > I would ask that SSL distribution gets added to the test suite though as > this code compiled cleanly but could never have worked. I don't know of > any development shop that would willingly let such a thing occur. > > (and dear /// I apologise if the tone of my original reports was > offensive. I was frustrated.) Since it's probably questionable whether tiny Michael is allowed to criticize people who dedicate a tremendous amount of time to build such a terrific system as Erlang, I hope the following is rather interpreted as fair comment: Please test cryptography packages before letting them out into the wild! Cheers, Michael From ulf.wiger@REDACTED Wed Nov 7 11:24:50 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 07 Nov 2007 11:24:50 +0100 Subject: [erlang-questions] erlang and Kara Message-ID: <47319272.2000301@ericsson.com> I subscribe to press releases from the Swedish Government (that's a lot of press releases), and one of the most recent ones was a non-committal promise to work extra hard to increase the number of women in the IT sector. The simple reasoning being that, since there's a shortage of IT expertise, it doesn't make sense to recruit from (mainly) only half the population. Naturally, I thought about the excellent presentation at the Erlang workshop in Freiburg, where Frank Huch talked about using Kara and Ladybugs to teach high-school girls programming. Here are the slides, and a paper, which are perhaps not as fun as the interactive session in Freiburg was: http://www.erlang.se/workshop/2007/proceedings/12huch.pdf http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 Quote: "After three days programming with Kara, we introduce Erlang?s features for concurrent and distributed programming to the pupils, which usually results in an 'Oh, what a pity!', when telling them that we do not program with Kara anymore." Then, the students go on to implement a chat system. Recall that these are high-school students with no previous programming experience. There was a lot of interest at the workshop in seeing Kara released as an Open Source project. Has anything happened with that? Maybe one could even get a research grant for adopting Kara to Swedish education...? I guess we should start learning to say "ladybug" in lots of different languages: (: German : Marienk?fer Swedish : nyckelpiga Spanish : mariquita French : coccinelle Italian : coccinella Dutch : Het lieveheersbeestje Japanese: tentoumushi (*) Corrections are welcome (probably also necessary). (*) "ladybug" translated on-line to Kanji, then transliterated on-line to Romanji. At least, this translates back to "ladybug" in a romanji-to-English on-line translation." BR, Ulf W From mats.cronqvist@REDACTED Wed Nov 7 11:40:32 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Wed, 07 Nov 2007 11:40:32 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <9b59d0270711070140o3d1294d5p18319cb97b315e07@mail.gmail.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> <9b59d0270711070140o3d1294d5p18319cb97b315e07@mail.gmail.com> Message-ID: <1194432032.6207.36.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Wed, 2007-11-07 at 10:40 +0100, Michael Regen wrote: > Regarding a GUI for Erlang - I just stumbled on http://www.gtk-server.org/ > So far I have no experience with it and cannot really comment on it. > But the way these guys provide a gui to even AWK and KSH scripts is so > unique and interesting that I think it at least deserves to be > mentioned. > > They also mention how to compile it under OSX. gtk-server is similar in philosophy to gtknode, and hence very cool :> i can see two advantages to using gtknode; glade support and the use of the erlang distribution for communication. of course, i am not a gtk-server expert, so I might be mistaken about glade support. on the other hand, i'm sure the gtk-server guys are much better C programmers than me. and as far as i can tell neither one uses native widgets on windows or mac. mats From bjorn@REDACTED Wed Nov 7 12:30:21 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Nov 2007 12:30:21 +0100 Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: "Ulf Wiger (TN/EAB)" writes: > > I guess we should start learning to say "ladybug" in lots > of different languages: (: > > German : Marienk?fer > Swedish : nyckelpiga > Spanish : mariquita > French : coccinelle > Italian : coccinella > Dutch : Het lieveheersbeestje > Japanese: tentoumushi (*) Russian : bozjakorovka (literally "God's little cow") /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From qrilka@REDACTED Wed Nov 7 13:30:53 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Wed, 7 Nov 2007 15:30:53 +0300 Subject: [erlang-questions] erlang and Kara In-Reply-To: References: <47319272.2000301@ericsson.com> Message-ID: <337538cb0711070430w7d8adc48g921a605e23e3745b@mail.gmail.com> Actually it's 2 words bozhya korovka (God's cow) And in Cyrillic it's "????? ???????" Best regards, Kirill On 07 Nov 2007 12:30:21 +0100, Bjorn Gustavsson wrote: > "Ulf Wiger (TN/EAB)" writes: > > > > > I guess we should start learning to say "ladybug" in lots > > of different languages: (: > > > > German : Marienk?fer > > Swedish : nyckelpiga > > Spanish : mariquita > > French : coccinelle > > Italian : coccinella > > Dutch : Het lieveheersbeestje > > Japanese: tentoumushi (*) > > Russian : bozjakorovka (literally "God's little cow") > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Wed Nov 7 14:39:32 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Wed, 07 Nov 2007 14:39:32 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> Message-ID: <1194442772.6207.50.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Wed, 2007-11-07 at 00:01 +0100, Giuseppe Luigi Punzi Ruiz wrote: > Glade could be nice, but I can't find a Glade port to OSX. google says; http://glade.darwinports.com mats From sh@REDACTED Wed Nov 7 14:23:04 2007 From: sh@REDACTED (=?iso-8859-1?Q?S=F8ren_Hilmer?=) Date: Wed, 7 Nov 2007 14:23:04 +0100 (CET) Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: <31428.193.3.142.121.1194441784.squirrel@www.widetrail.dk> Danish : marieh?ne -- S?ren Hilmer, M.Sc., M.Crypt. wideTrail Phone: +45 25481225 Pilev?nget 41 Email: sh@REDACTED DK-8961 Alling?bro Web: www.widetrail.dk On Wed, November 7, 2007 11:24, Ulf Wiger (TN/EAB) wrote: > > I subscribe to press releases from the Swedish Government > (that's a lot of press releases), and one of the most > recent ones was a non-committal promise to work extra > hard to increase the number of women in the IT sector. > The simple reasoning being that, since there's a shortage > of IT expertise, it doesn't make sense to recruit from > (mainly) only half the population. > > Naturally, I thought about the excellent presentation > at the Erlang workshop in Freiburg, where Frank Huch > talked about using Kara and Ladybugs to teach high-school > girls programming. > > Here are the slides, and a paper, which are perhaps not as > fun as the interactive session in Freiburg was: > > http://www.erlang.se/workshop/2007/proceedings/12huch.pdf > http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 > > Quote: > "After three days programming with Kara, we introduce Erlang?s > features for concurrent and distributed programming to the pupils, > which usually results in an 'Oh, what a pity!', when telling them > that we do not program with Kara anymore." > > Then, the students go on to implement a chat system. > Recall that these are high-school students with no > previous programming experience. > > > There was a lot of interest at the workshop in seeing > Kara released as an Open Source project. Has anything > happened with that? > > Maybe one could even get a research grant for adopting > Kara to Swedish education...? > > > > I guess we should start learning to say "ladybug" in lots > of different languages: (: > > German : Marienk?fer > Swedish : nyckelpiga > Spanish : mariquita > French : coccinelle > Italian : coccinella > Dutch : Het lieveheersbeestje > Japanese: tentoumushi (*) > > Corrections are welcome (probably also necessary). > > (*) "ladybug" translated on-line to Kanji, then transliterated > on-line to Romanji. At least, this translates back to "ladybug" > in a romanji-to-English on-line translation." > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vladdu55@REDACTED Wed Nov 7 15:16:16 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 7 Nov 2007 15:16:16 +0100 Subject: [erlang-questions] erlang and Kara In-Reply-To: <31428.193.3.142.121.1194441784.squirrel@www.widetrail.dk> References: <47319272.2000301@ericsson.com> <31428.193.3.142.121.1194441784.squirrel@www.widetrail.dk> Message-ID: <95be1d3b0711070616t1f40ca1eqf5fefce5f00743de@mail.gmail.com> And Romanian: g?rg?ri?? /Vlad On 11/7/07, S?ren Hilmer wrote: > Danish : marieh?ne > > -- > S?ren Hilmer, M.Sc., M.Crypt. > wideTrail Phone: +45 25481225 > Pilev?nget 41 Email: sh@REDACTED > DK-8961 Alling?bro Web: www.widetrail.dk > > On Wed, November 7, 2007 11:24, Ulf Wiger (TN/EAB) wrote: > > > > I subscribe to press releases from the Swedish Government > > (that's a lot of press releases), and one of the most > > recent ones was a non-committal promise to work extra > > hard to increase the number of women in the IT sector. > > The simple reasoning being that, since there's a shortage > > of IT expertise, it doesn't make sense to recruit from > > (mainly) only half the population. > > > > Naturally, I thought about the excellent presentation > > at the Erlang workshop in Freiburg, where Frank Huch > > talked about using Kara and Ladybugs to teach high-school > > girls programming. > > > > Here are the slides, and a paper, which are perhaps not as > > fun as the interactive session in Freiburg was: > > > > http://www.erlang.se/workshop/2007/proceedings/12huch.pdf > > http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 > > > > Quote: > > "After three days programming with Kara, we introduce Erlang's > > features for concurrent and distributed programming to the pupils, > > which usually results in an 'Oh, what a pity!', when telling them > > that we do not program with Kara anymore." > > > > Then, the students go on to implement a chat system. > > Recall that these are high-school students with no > > previous programming experience. > > > > > > There was a lot of interest at the workshop in seeing > > Kara released as an Open Source project. Has anything > > happened with that? > > > > Maybe one could even get a research grant for adopting > > Kara to Swedish education...? > > > > > > > > I guess we should start learning to say "ladybug" in lots > > of different languages: (: > > > > German : Marienk?fer > > Swedish : nyckelpiga > > Spanish : mariquita > > French : coccinelle > > Italian : coccinella > > Dutch : Het lieveheersbeestje > > Japanese: tentoumushi (*) > > > > Corrections are welcome (probably also necessary). > > > > (*) "ladybug" translated on-line to Kanji, then transliterated > > on-line to Romanji. At least, this translates back to "ladybug" > > in a romanji-to-English on-line translation." > > > > BR, > > Ulf W > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From twanvds@REDACTED Wed Nov 7 14:59:15 2007 From: twanvds@REDACTED (twanvds@REDACTED) Date: Wed, 7 Nov 2007 14:59:15 +0100 (CET) Subject: [erlang-questions] erlang and Kara Message-ID: <11590.83.80.64.66.1194443955.squirrel@webmail.xs4all.nl> Hi Ulf, Just "lieveheersbeestje" will do nicely. The article "het" is not part of the noun ;-) br Twan > > I subscribe to press releases from the Swedish Government > (that's a lot of press releases), and one of the most > recent ones was a non-committal promise to work extra > hard to increase the number of women in the IT sector. > The simple reasoning being that, since there's a shortage > of IT expertise, it doesn't make sense to recruit from > (mainly) only half the population. > > Naturally, I thought about the excellent presentation > at the Erlang workshop in Freiburg, where Frank Huch > talked about using Kara and Ladybugs to teach high-school > girls programming. > > Here are the slides, and a paper, which are perhaps not as > fun as the interactive session in Freiburg was: > > http://www.erlang.se/workshop/2007/proceedings/12huch.pdf > http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 > > Quote: > "After three days programming with Kara, we introduce Erlang?s > features for concurrent and distributed programming to the pupils, > which usually results in an 'Oh, what a pity!', when telling them > that we do not program with Kara anymore." > > Then, the students go on to implement a chat system. > Recall that these are high-school students with no > previous programming experience. > > > There was a lot of interest at the workshop in seeing > Kara released as an Open Source project. Has anything > happened with that? > > Maybe one could even get a research grant for adopting > Kara to Swedish education...? > > > > I guess we should start learning to say "ladybug" in lots > of different languages: (: > > German : Marienk?fer > Swedish : nyckelpiga > Spanish : mariquita > French : coccinelle > Italian : coccinella > Dutch : Het lieveheersbeestje > Japanese: tentoumushi (*) > > Corrections are welcome (probably also necessary). > > (*) "ladybug" translated on-line to Kanji, then transliterated > on-line to Romanji. At least, this translates back to "ladybug" > in a romanji-to-English on-line translation." > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From launoja@REDACTED Wed Nov 7 15:43:41 2007 From: launoja@REDACTED (Jani Launonen) Date: Wed, 7 Nov 2007 16:43:41 +0200 Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: <1A0843E9-A2AC-4ECF-8188-39D4120220CA@omanetti.fi> Ulf Wiger (TN/EAB) kirjoitti 7.11.2007 kello 12.24: > I guess we should start learning to say "ladybug" in lots > of different languages: (: > > German : Marienk?fer > Swedish : nyckelpiga > Spanish : mariquita > French : coccinelle > Italian : coccinella > Dutch : Het lieveheersbeestje > Japanese: tentoumushi (*) Finnish: lepp?kerttu > > Corrections are welcome (probably also necessary). > > (*) "ladybug" translated on-line to Kanji, then transliterated > on-line to Romanji. At least, this translates back to "ladybug" > in a romanji-to-English on-line translation." > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From puzza007@REDACTED Wed Nov 7 15:40:04 2007 From: puzza007@REDACTED (Paul Oliver) Date: Wed, 7 Nov 2007 14:40:04 +0000 Subject: [erlang-questions] erlang and Kara In-Reply-To: <95be1d3b0711070616t1f40ca1eqf5fefce5f00743de@mail.gmail.com> References: <47319272.2000301@ericsson.com> <31428.193.3.142.121.1194441784.squirrel@www.widetrail.dk> <95be1d3b0711070616t1f40ca1eqf5fefce5f00743de@mail.gmail.com> Message-ID: Polish: biedronka or... bo?a kr?wka. On 11/7/07, Vlad Dumitrescu wrote: > And Romanian: g?rg?ri?? > > /Vlad > > On 11/7/07, S?ren Hilmer wrote: > > Danish : marieh?ne > > > > -- > > S?ren Hilmer, M.Sc., M.Crypt. > > wideTrail Phone: +45 25481225 > > Pilev?nget 41 Email: sh@REDACTED > > DK-8961 Alling?bro Web: www.widetrail.dk > > > > On Wed, November 7, 2007 11:24, Ulf Wiger (TN/EAB) wrote: > > > > > > I subscribe to press releases from the Swedish Government > > > (that's a lot of press releases), and one of the most > > > recent ones was a non-committal promise to work extra > > > hard to increase the number of women in the IT sector. > > > The simple reasoning being that, since there's a shortage > > > of IT expertise, it doesn't make sense to recruit from > > > (mainly) only half the population. > > > > > > Naturally, I thought about the excellent presentation > > > at the Erlang workshop in Freiburg, where Frank Huch > > > talked about using Kara and Ladybugs to teach high-school > > > girls programming. > > > > > > Here are the slides, and a paper, which are perhaps not as > > > fun as the interactive session in Freiburg was: > > > > > > http://www.erlang.se/workshop/2007/proceedings/12huch.pdf > > > http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 > > > > > > Quote: > > > "After three days programming with Kara, we introduce Erlang's > > > features for concurrent and distributed programming to the pupils, > > > which usually results in an 'Oh, what a pity!', when telling them > > > that we do not program with Kara anymore." > > > > > > Then, the students go on to implement a chat system. > > > Recall that these are high-school students with no > > > previous programming experience. > > > > > > > > > There was a lot of interest at the workshop in seeing > > > Kara released as an Open Source project. Has anything > > > happened with that? > > > > > > Maybe one could even get a research grant for adopting > > > Kara to Swedish education...? > > > > > > > > > > > > I guess we should start learning to say "ladybug" in lots > > > of different languages: (: > > > > > > German : Marienk?fer > > > Swedish : nyckelpiga > > > Spanish : mariquita > > > French : coccinelle > > > Italian : coccinella > > > Dutch : Het lieveheersbeestje > > > Japanese: tentoumushi (*) > > > > > > Corrections are welcome (probably also necessary). > > > > > > (*) "ladybug" translated on-line to Kanji, then transliterated > > > on-line to Romanji. At least, this translates back to "ladybug" > > > in a romanji-to-English on-line translation." > > > > > > BR, > > > Ulf W > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- http://mosangeles.net From ulf.wiger@REDACTED Wed Nov 7 15:43:27 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 07 Nov 2007 15:43:27 +0100 Subject: [erlang-questions] erlang and Kara In-Reply-To: <11590.83.80.64.66.1194443955.squirrel@webmail.xs4all.nl> References: <11590.83.80.64.66.1194443955.squirrel@webmail.xs4all.nl> Message-ID: <4731CF0F.9070003@ericsson.com> twanvds@REDACTED wrote: > Hi Ulf, > > Just "lieveheersbeestje" will do nicely. The article "het" is not part of > the noun ;-) Thanks. So I've learned. (: I will blame the free online translator, but I guess you get what you pay for... Encouraged by a short lesson in Dutch grammar, I started trying to rip the word apart: lieve = "beloved" heers = "gentlemen" beest = "animal" je = (diminutive) ...according to the free translator that led me astray the first time. Determined to waste even more time, I finally came across some explanation suggesting that "lieve heer" means "Sweet Lord", meaning "God". God's little bug, then? You learn something new every day. BR, Ulf W From jay@REDACTED Wed Nov 7 16:13:47 2007 From: jay@REDACTED (Jay Nelson) Date: Wed, 7 Nov 2007 07:13:47 -0800 Subject: [erlang-questions] how: Monitor nodeup _and_ nodedown Message-ID: <0639F081-E7E8-4567-AB56-0DC96C50412B@duomark.com> I must be leaving something out. I am trying to monitor another node. My initial attempt was to just use the erlang monitor: erlang:monitor_node(NodeName, true). receive Any -> Any after 30000 -> timeout end. This only receives {nodedown, NodeName} if the node is not already started, or if it goes down. I never see a {nodeup, NodeName}. Rereading the documentation and thinking about it a bit, I could understand why this might be the case. (I then wrote my own node monitoring before realizing that net_kernel had a function. It does what I want -- single node monitor, initial state reporting, both nodeup and nodedown.) Switching to net_kernel: net_kernel:monitor_nodes(true). receive Any -> Any after 30000 -> timeout end. Bringing up my other node (on the same Mac OSX laptop) gives me a {nodeup, NodeName} when I do a net_adm:ping(MonitorNode), but quitting the shell doesn't give me a {nodedown, NodeName}. I tried with and without cookies, and made sure that my receive after timeout is greater than the default netticktime of 15000. The documentation clearly shows that nodeup and nodedown should be available. 1) Am I leaving out a step? 2) Is there a way to only watch one node instead of all nodes? 3) In any case, I haven't seen the behavior that you get the initial state when the monitor is first started (e.g., if the node is already up, there is no indication until it goes down -- but erlang:monitor_node does give a nodedown if it is already down) jay From richardc@REDACTED Wed Nov 7 16:04:59 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 07 Nov 2007 16:04:59 +0100 Subject: [erlang-questions] erlang and Kara In-Reply-To: <1A0843E9-A2AC-4ECF-8188-39D4120220CA@omanetti.fi> References: <47319272.2000301@ericsson.com> <1A0843E9-A2AC-4ECF-8188-39D4120220CA@omanetti.fi> Message-ID: <4731D41B.6000407@it.uu.se> Jani Launonen wrote: > Finnish: lepp?kerttu Or "pistepirkko", as in the band name "22-pistepirkko". /Richard From jerith@REDACTED Wed Nov 7 16:37:31 2007 From: jerith@REDACTED (Jeremy Thurgood) Date: Wed, 07 Nov 2007 17:37:31 +0200 Subject: [erlang-questions] erlang and Kara In-Reply-To: <4731CF0F.9070003@ericsson.com> References: <11590.83.80.64.66.1194443955.squirrel@webmail.xs4all.nl> <4731CF0F.9070003@ericsson.com> Message-ID: <4731DBBB.3020004@jerith.za.net> Ulf Wiger (TN/EAB) wrote: > twanvds@REDACTED wrote: >> Hi Ulf, >> >> Just "lieveheersbeestje" will do nicely. The article "het" is not part of >> the noun ;-) > > Thanks. So I've learned. (: > I will blame the free online translator, but I guess you get > what you pay for... > > Encouraged by a short lesson in Dutch grammar, I started > trying to rip the word apart: > > lieve = "beloved" > heers = "gentlemen" > beest = "animal" > je = (diminutive) > > ...according to the free translator that led me astray the > first time. Determined to waste even more time, I finally > came across some explanation suggesting that "lieve heer" > means "Sweet Lord", meaning "God". God's little bug, then? The Afrikaans is very similar to the Dutch: lieweheersbesie The translation is the same as well. --J From erlang@REDACTED Wed Nov 7 16:40:53 2007 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 7 Nov 2007 16:40:53 +0100 Subject: [erlang-questions] ad: erlang course Message-ID: <9b08084c0711070740o66cd5d23p6e4857651c7d45e1@mail.gmail.com> http://pragmaticstudio.com/erlang/ /Joe Armstrong From babo.online@REDACTED Wed Nov 7 16:44:57 2007 From: babo.online@REDACTED (Attila Babo) Date: Wed, 7 Nov 2007 17:44:57 +0200 Subject: [erlang-questions] erlang and Kara In-Reply-To: <4731CF0F.9070003@ericsson.com> References: <11590.83.80.64.66.1194443955.squirrel@webmail.xs4all.nl> <4731CF0F.9070003@ericsson.com> Message-ID: <597c69660711070744w2ac786fbta381a7f6d0a289fb@mail.gmail.com> Hungarian: katicabog?r -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitriid@REDACTED Wed Nov 7 16:48:27 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Wed, 07 Nov 2007 17:48:27 +0200 Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: <4731DE4B.5060404@gmail.com> > I guess we should start learning to say "ladybug" in lots > of different languages: (: In Turkish: - u?ur b?ce?i (luck bug) or - han?mb?ce?i (ladybug) From ivica@REDACTED Wed Nov 7 17:29:30 2007 From: ivica@REDACTED (Ivica Munitic) Date: Wed, 7 Nov 2007 17:29:30 +0100 Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: <20071107172930.5de23171@bitchva> On Wed, 07 Nov 2007 11:24:50 +0100 "Ulf Wiger (TN/EAB)" wrote: > > I subscribe to press releases from the Swedish Government > (that's a lot of press releases), and one of the most > recent ones was a non-committal promise to work extra > hard to increase the number of women in the IT sector. > The simple reasoning being that, since there's a shortage > of IT expertise, it doesn't make sense to recruit from > (mainly) only half the population. > > Naturally, I thought about the excellent presentation > at the Erlang workshop in Freiburg, where Frank Huch > talked about using Kara and Ladybugs to teach high-school > girls programming. > > Here are the slides, and a paper, which are perhaps not as > fun as the interactive session in Freiburg was: > > http://www.erlang.se/workshop/2007/proceedings/12huch.pdf > http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 > > Quote: > "After three days programming with Kara, we introduce Erlang?s > features for concurrent and distributed programming to the pupils, > which usually results in an 'Oh, what a pity!', when telling them > that we do not program with Kara anymore." > > Then, the students go on to implement a chat system. > Recall that these are high-school students with no > previous programming experience. > > > There was a lot of interest at the workshop in seeing > Kara released as an Open Source project. Has anything > happened with that? > > Maybe one could even get a research grant for adopting > Kara to Swedish education...? > > > > I guess we should start learning to say "ladybug" in lots > of different languages: (: > > German : Marienk?fer > Swedish : nyckelpiga > Spanish : mariquita > French : coccinelle > Italian : coccinella > Dutch : Het lieveheersbeestje > Japanese: tentoumushi (*) > Croatian: bubamara > Corrections are welcome (probably also necessary). > > (*) "ladybug" translated on-line to Kanji, then transliterated > on-line to Romanji. At least, this translates back to "ladybug" > in a romanji-to-English on-line translation." > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From sean.hinde@REDACTED Wed Nov 7 18:19:58 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 7 Nov 2007 17:19:58 +0000 Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: > I guess we should start learning to say "ladybug" in lots > of different languages: (: > > German : Marienk?fer > Swedish : nyckelpiga > Spanish : mariquita > French : coccinelle > Italian : coccinella > Dutch : Het lieveheersbeestje > Japanese: tentoumushi (*) > > Corrections are welcome (probably also necessary). In English: Ladybird Sean From kip.macy@REDACTED Wed Nov 7 18:32:02 2007 From: kip.macy@REDACTED (Kip Macy) Date: Wed, 7 Nov 2007 09:32:02 -0800 Subject: [erlang-questions] erlang and Kara In-Reply-To: References: <47319272.2000301@ericsson.com> Message-ID: On 11/7/07, Sean Hinde wrote: > > > I guess we should start learning to say "ladybug" in lots > > of different languages: (: > > > > German : Marienk?fer > > Swedish : nyckelpiga > > Spanish : mariquita > > French : coccinelle > > Italian : coccinella > > Dutch : Het lieveheersbeestje > > Japanese: tentoumushi (*) > > > > Corrections are welcome (probably also necessary). > > In English: Ladybird > You mean British English, there are a fair number of people who speak that "other" variant. :D From mogorman@REDACTED Wed Nov 7 17:31:17 2007 From: mogorman@REDACTED (mog) Date: Wed, 07 Nov 2007 10:31:17 -0600 Subject: [erlang-questions] program: adding flymake (emacs) support for erlang! Message-ID: <1194453077.4096.2.camel@metalman.lan> add this to your .emacs (when (load "flymake" t) (defun flymake-erlang-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "eflymake" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.erl\\'" flymake-erlang-init))) and add this to your path somewhere filename: eflymake #!/usr/bin/env escript -export([main/1]). main([File_Name]) -> compile:file(File_Name, [warn_obsolete_guard, warn_unused_import, warn_shadow_vars, warn_export_vars, strong_validation, report]). then just turn on flymake and rock out while you develop. mog -------------- 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 anders.nygren@REDACTED Wed Nov 7 19:13:56 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Wed, 7 Nov 2007 12:13:56 -0600 Subject: [erlang-questions] program: adding flymake (emacs) support for erlang! In-Reply-To: <1194453077.4096.2.camel@metalman.lan> References: <1194453077.4096.2.camel@metalman.lan> Message-ID: On Nov 7, 2007 10:31 AM, mog wrote: > add this to your .emacs > > (when (load "flymake" t) > (defun flymake-erlang-init () > (let* ((temp-file (flymake-init-create-temp-buffer-copy > 'flymake-create-temp-inplace)) > (local-file (file-relative-name > temp-file > (file-name-directory buffer-file-name)))) > (list "eflymake" (list local-file)))) > > (add-to-list 'flymake-allowed-file-name-masks > '("\\.erl\\'" flymake-erlang-init))) > > and add this to your path somewhere > > filename: eflymake > #!/usr/bin/env escript > -export([main/1]). > > main([File_Name]) -> > compile:file(File_Name, [warn_obsolete_guard, warn_unused_import, > warn_shadow_vars, warn_export_vars, strong_validation, report]). > > > then just turn on flymake and rock out while you develop. > Sorry to be quite helpless with emacs tweaking, how do I "just turn on flymake"? /Anders From anders.nygren@REDACTED Wed Nov 7 19:24:02 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Wed, 7 Nov 2007 12:24:02 -0600 Subject: [erlang-questions] program: adding flymake (emacs) support for erlang! In-Reply-To: References: <1194453077.4096.2.camel@metalman.lan> Message-ID: On Nov 7, 2007 12:13 PM, Anders Nygren wrote: > > On Nov 7, 2007 10:31 AM, mog wrote: > > add this to your .emacs > > > > (when (load "flymake" t) > > (defun flymake-erlang-init () > > (let* ((temp-file (flymake-init-create-temp-buffer-copy > > 'flymake-create-temp-inplace)) > > (local-file (file-relative-name > > temp-file > > (file-name-directory buffer-file-name)))) > > (list "eflymake" (list local-file)))) > > > > (add-to-list 'flymake-allowed-file-name-masks > > '("\\.erl\\'" flymake-erlang-init))) > > > > and add this to your path somewhere > > > > filename: eflymake > > #!/usr/bin/env escript > > -export([main/1]). > > > > main([File_Name]) -> > > compile:file(File_Name, [warn_obsolete_guard, warn_unused_import, > > warn_shadow_vars, warn_export_vars, strong_validation, report]). > > > > > > then just turn on flymake and rock out while you develop. > > > > Sorry to be quite helpless with emacs tweaking, how do I > "just turn on flymake"? > > /Anders > Nevermind, I found that adding (add-hook 'find-file-hook 'flymake-find-file-hook) in my .emacs fixes it. /Anders From monch1962@REDACTED Wed Nov 7 21:15:50 2007 From: monch1962@REDACTED (David Mitchell) Date: Thu, 8 Nov 2007 07:15:50 +1100 Subject: [erlang-questions] Looking for EBCDIC <-> ASCII conversion library Message-ID: Hello everyone, I'm looking for a library that will allow me to convert EBCDIC to ASCII and vice-versa. Since my app has to run under both Windows and Linux and the servers are reasonably locked down, I'd prefer if this library was in pure Erlang - I'm aware that I could use iconv to do this, but that would involve installing additional code and I'm not sure that The Powers That Be would smile on this suggestion. It's hard enough to get them to accept Erlang ;-> Any pointers or suggestions? Thanks in advance Dave M. From glpunzi@REDACTED Wed Nov 7 21:49:25 2007 From: glpunzi@REDACTED (Giuseppe Luigi Punzi Ruiz) Date: Wed, 7 Nov 2007 21:49:25 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <1194442772.6207.50.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <1194360699.6207.16.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> <1194442772.6207.50.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> Message-ID: <1A3FB4BC-3513-4520-92A8-8E1FD4E97DA4@lordzealon.com> Yes, I tried but, I didn't get any output......until I discovered -d parameter for port command (10 minutes ago), and now, glade3 is downloading and compiling. Thanks a lot. At the moment, I'm looking at some documentation on the net, for learn the languaje. I need to understand how to use my knowledge in devloping (OO, Delphi, etc...) to this languaje because at the moment, i don't understand very well how to apply my ideas. El 07/11/2007, a las 14:39, mats cronqvist escribi?: > On Wed, 2007-11-07 at 00:01 +0100, Giuseppe Luigi Punzi Ruiz wrote: >> Glade could be nice, but I can't find a Glade port to OSX. > > google says; > http://glade.darwinports.com > > mats > > From olopierpa@REDACTED Wed Nov 7 21:53:13 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Wed, 7 Nov 2007 21:53:13 +0100 Subject: [erlang-questions] Looking for EBCDIC <-> ASCII conversion library In-Reply-To: References: Message-ID: <7352e43a0711071253t74b113aej3026ce9103602262@mail.gmail.com> On 11/7/07, David Mitchell wrote: > Hello everyone, > > I'm looking for a library that will allow me to convert EBCDIC to > ASCII and vice-versa. > Any pointers or suggestions? > > Thanks in advance -module(ebcdic). -export([to_ascii/1, from_ascii/1]). to_ascii(0) -> "insert here an appropriate number"; to_ascii(1) -> "insert here an appropriate number"; ... from_ascii(0) -> "insert here an appropriate number"; ... > It's hard enough to get them to accept Erlang ;-> No doubt. P. From tobbe@REDACTED Thu Nov 8 00:55:16 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 08 Nov 2007 00:55:16 +0100 Subject: [erlang-questions] use of sendfile Message-ID: There were a sendfile patch floating around some years ago. Not sure what happend to it. http://www.erlang.org/pipermail/erlang-patches/2003-November/000068.html I just wrote a minimal sendfile linked-in driver. I compared the performance with a yaws server but didn't see any difference in performance. Is that expected ? I probably did something wrong. Anyway if anyone is interested it is described here: http://blog.tornkvist.org/ Cheers, Tobbe From kevin@REDACTED Thu Nov 8 04:16:36 2007 From: kevin@REDACTED (Kevin A. Smith) Date: Wed, 7 Nov 2007 22:16:36 -0500 Subject: [erlang-questions] OTP & Global Names Message-ID: <628B0FB0-44F5-496E-81F4-AC760C4C8C00@hypotheticalabs.com> I've been playing around with OTP a bit and have run into some behavior I'm not understanding. I have two nodes running on my laptop, foo and bar. Node foo is a erl shell started with the -sname parameter. Node bar is also an erl shell but is started -sname and with a boot script for a very simple OTP application. The app starts two gen_servers, calc and cache. Cache is started with the tuple {local, ?SERVER}. I expect cache to only be visible directly on its node and it is. On the other hand, calc is started with the tuple {global, ?SERVER}. I'd expect calc to be visible via global:registered_names() on node foo. Sadly for me, registered_names() returns an empty list. I've tested and verified basic networking between the two nodes via net_adm:ping() so I believe the nodes can see each other. What have I missed? I can provide copies of my .rel and .app files if it would help diagnose the problem. --Kevin From jao@REDACTED Thu Nov 8 04:25:05 2007 From: jao@REDACTED (Jack Orenstein) Date: Wed, 7 Nov 2007 22:25:05 -0500 Subject: [erlang-questions] OTP & Global Names In-Reply-To: <628B0FB0-44F5-496E-81F4-AC760C4C8C00@hypotheticalabs.com> References: <628B0FB0-44F5-496E-81F4-AC760C4C8C00@hypotheticalabs.com> Message-ID: <87561E6D-83BC-4CA0-A45D-EA1AACF8BC61@geophile.com> I ran into a similar problem, and used global:sync/0 to make sure that all names were known on all nodes. I'm not positive that this is necessary, or a recommended technique, but it seemed to do the trick. Jack On Nov 7, 2007, at 10:16 PM, Kevin A. Smith wrote: > I've been playing around with OTP a bit and have run into some > behavior I'm not understanding. > > I have two nodes running on my laptop, foo and bar. Node foo is a erl > shell started with the -sname parameter. Node bar is also an erl shell > but is started -sname and with a boot script for a very simple OTP > application. The app starts two gen_servers, calc and cache. Cache is > started with the tuple {local, ?SERVER}. I expect cache to only be > visible directly on its node and it is. > > On the other hand, calc is started with the tuple {global, ?SERVER}. > I'd expect calc to be visible via global:registered_names() on node > foo. Sadly for me, registered_names() returns an empty list. I've > tested and verified basic networking between the two nodes via > net_adm:ping() so I believe the nodes can see each other. > > What have I missed? I can provide copies of my .rel and .app files if > it would help diagnose the problem. > > --Kevin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jeffm@REDACTED Thu Nov 8 04:53:31 2007 From: jeffm@REDACTED (jm) Date: Thu, 08 Nov 2007 14:53:31 +1100 Subject: [erlang-questions] autoconf and erlang Message-ID: <4732883B.3000909@ghostgun.com> In attempting to package up my inotify port for erlang I'm using or rather trying to use autoconf and automake. I've sort of got it working for the C part of the code but not for the erlang parts. Based on Romain Lenglet's "Using GNU Autoconf to Configure Erlang Programs" EUC 2006 presentation slides I've ended up with the configure.ac shown below. My questions are: 1) How do I work out where to put the beam files and the compiled c-port? 2) What is the best way to alter the code so that the open_port() function knowns what to execute? At the moment, there's a -define(PORTPROG, "./inotify"). near the top of the erlang source file. Include file? How do i go about finding the correct path and inserting this automatically? 3) Any good similar examples out there that can be used as a reference for a starting point? 4) Any other suggestions? # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) AC_INIT(erlang-notify, 0.1, jeffm@REDACTED) AC_CONFIG_SRCDIR([src]) #AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE(1.9.5) # Checks for programs. AC_PROG_CC # Checks for libraries. # FIXME: Replace `main' with a function in `-lei': AC_CHECK_LIB([ei], [ei_decode_atom]) # FIXME: Replace `main' with a function in `-lerl_interface': AC_CHECK_LIB([erl_interface], [erl_connect_init]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h stdint.h stdlib.h string.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_HEADER_TIME AC_TYPE_UINT32_T # Checks for library functions. AC_FUNC_LSTAT AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_FUNC_REALLOC AC_FUNC_SELECT_ARGTYPES AC_CHECK_FUNCS([memset select strerror]) AC_ERLANG_NEED_ERLC #AC_ERLANG_CHECK_LIB() AC_ERLANG_CHECK_LIB(erl_interface) AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT --- Makefile.am in basedir SUBDIRS = src -- Makefile.am in src bin_PROGRAMS = inotify_erlang inotify_erlang_SOURCES = erl_comm.c inotify_driver.c inotify_erlang.c From berlin.brown@REDACTED Thu Nov 8 04:31:18 2007 From: berlin.brown@REDACTED (Berlin Brown) Date: Wed, 07 Nov 2007 22:31:18 -0500 Subject: [erlang-questions] Scheme in Erlang? In-Reply-To: References: <1194453077.4096.2.camel@metalman.lan> Message-ID: <47328306.4000607@gmail.com> This article on scheme in erlang is pretty popular? Does anyone know of an scheme interpreter and tutorial for erlgang? http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/evaluator2.html From paul-trapexit@REDACTED Thu Nov 8 05:25:49 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Wed, 7 Nov 2007 20:25:49 -0800 (PST) Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? Message-ID: hi. i've attached a very short erlang program which tries to open two udp ports with reuseaddr option. it works under linux but fails under darwin. is this a known problem? i can see the following in the ktrace: -------- % ktrace -id -t c erl -eval 'test:test ()' -noshell -noinput -s init stop -------- the kdump.out contains: -------- 28042 beam CALL socket(0x2,0x2,0x11) 28042 beam RET socket 9 28042 beam CALL fcntl(0x9,0x3,0) 28042 beam RET fcntl 2 28042 beam CALL fcntl(0x9,0x4,0x6) 28042 beam RET fcntl 0 28042 beam CALL setsockopt(0x9,0xffff,0x1002,0xbfffe1fc,0x4) 28042 beam RET setsockopt 0 28042 beam CALL setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) 28042 beam RET setsockopt 0 28042 beam CALL bind(0x9,0xbfffe0e0,0x10) 28042 beam RET bind -1 errno 48 Address already in use -------- setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) looks right: -------- % grep -e SO_REUSEADDR -e SOL_SOCKET /usr/include/sys/socket.h #define SO_REUSEADDR 0x0004 /* allow local address reuse */ #define SOL_SOCKET 0xffff /* options for socket level */ -------- the only thing i can't verify is that 0xbfffe1fc is a pointer to one. thanks, -- p % dpkg -s erlang-otp | grep Version Version: 11b-5-1 % erl -version Erlang (ASYNC_THREADS) (BEAM) emulator version 5.5.5 Optimism is an essential ingredient of innovation. How else can the individual favor change over security? -- Robert Noyce -------------- next part -------------- -module (test). -compile (export_all). test () -> Port = 4545, { ok, Socket } = gen_udp:open (Port, [ { reuseaddr, true } ]), { ok, SocketTwo } = gen_udp:open (Port, [ { reuseaddr, true } ]), { Socket, SocketTwo }. From michael.campbell@REDACTED Thu Nov 8 07:43:46 2007 From: michael.campbell@REDACTED (Michael Campbell) Date: Thu, 8 Nov 2007 01:43:46 -0500 Subject: [erlang-questions] Scheme in Erlang? In-Reply-To: <47328306.4000607@gmail.com> References: <1194453077.4096.2.camel@metalman.lan> <47328306.4000607@gmail.com> Message-ID: <811f2f1c0711072243s524b8ddat55bc113316ef7b80@mail.gmail.com> On Nov 7, 2007 10:31 PM, Berlin Brown wrote: > This article on scheme in erlang is pretty popular? Does anyone know of > an scheme interpreter and tutorial for erlgang? > > http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/evaluator2.html I'm probably missing something, but that looks like Scheme in Haskell to me. From nc@REDACTED Thu Nov 8 08:06:59 2007 From: nc@REDACTED (Nicolas Charpentier) Date: Thu, 08 Nov 2007 08:06:59 +0100 Subject: [erlang-questions] OTP & Global Names In-Reply-To: <87561E6D-83BC-4CA0-A45D-EA1AACF8BC61@geophile.com> References: <628B0FB0-44F5-496E-81F4-AC760C4C8C00@hypotheticalabs.com> <87561E6D-83BC-4CA0-A45D-EA1AACF8BC61@geophile.com> Message-ID: <4732B593.90508@charpi.net> Hi, Jack Orenstein wrote: > I ran into a similar problem, and used global:sync/0 to make sure > that all names were known on all nodes. I'm not positive that this is > necessary, or a recommended technique, but it seemed to do the trick. > Maybe you can try to configure the kernel application. I think about those parameters, which may be used for nodes synchronization: sync_nodes_mandatory, sync_nodes_optional, sync_nodes_timeout. BR --- Nicolas Charpentier http://charpi.net From glpunzi@REDACTED Thu Nov 8 09:25:42 2007 From: glpunzi@REDACTED (glpunzi@REDACTED) Date: Thu, 8 Nov 2007 09:25:42 +0100 (CET) Subject: [erlang-questions] Now, starting with erlang Message-ID: <21822.83.40.172.193.1194510342.squirrel@lordzealon.com> Hi again. After your responses, probably, erlang could be suitable for my needs. THen, now, I need, some tutorial, paper, etc.. to learn about the syntax, and the more important, how to apply my concepts in develop, to this languaje. For example,I know, how to develop on Delphi, building a "form" and developing over the events, the behaviour I want for the app. Connecting to DDBB etc.. But, I don't know how to apply this to erlang. How is the normal procedure to start a project on it. Or some tutorial about writing desktop applications on erlang. All I found is about developing server side applications, and this, is not my primary goal. Cheers and thanks. From matthias@REDACTED Thu Nov 8 09:37:52 2007 From: matthias@REDACTED (Matthias Radestock) Date: Thu, 08 Nov 2007 08:37:52 +0000 Subject: [erlang-questions] ordering guarantees when linking or monitoring processes Message-ID: <4732CAE0.7040706@sorted.org> Say I have a process P that is linked to a process Q and traps exits. Q sends message M to P and then dies. Is P guaranteed to receive M before the 'EXIT' message? What happens if, instead of linking, P monitors Q? Is P guaranteed to receive M before the 'DOWN' message? Matthias From opendev@REDACTED Thu Nov 8 09:54:03 2007 From: opendev@REDACTED (Joern) Date: Thu, 8 Nov 2007 09:54:03 +0100 Subject: [erlang-questions] Soft realtime stats Message-ID: <9e009ad0711080054l5bb2c616i83e40b3c3ddcbf7d@mail.gmail.com> Dear erlang-questions, I am looking for papers or documentation regarding the (amount or lack thereof) runtime determinism of the Erlang VM. Any pointers? Best regards, Joern -- From valentin@REDACTED Thu Nov 8 08:45:22 2007 From: valentin@REDACTED (Valentin Micic) Date: Thu, 8 Nov 2007 09:45:22 +0200 Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? References: Message-ID: <010801c821db$5f4e4aa0$6401a8c0@moneymaker2> In your program, you're attempting to use the sampe port while the socket is still active -- SO_REUSEADDR does not serve that purpose. Rather, it means that when owner of the socket no longer needs it (i.e. issue close socket, or terminates), another process may reuse the same port immediately without waiting for TIME_WAIT period to expire. V. ----- Original Message ----- From: "Paul Mineiro" To: Sent: Thursday, November 08, 2007 6:25 AM Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? > hi. > > i've attached a very short erlang program which tries to open two udp > ports with reuseaddr option. it works under linux but fails under darwin. > > is this a known problem? > > i can see the following in the ktrace: > > -------- > % ktrace -id -t c erl -eval 'test:test ()' -noshell -noinput -s init stop > -------- > > the kdump.out contains: > > -------- > 28042 beam CALL socket(0x2,0x2,0x11) > 28042 beam RET socket 9 > 28042 beam CALL fcntl(0x9,0x3,0) > 28042 beam RET fcntl 2 > 28042 beam CALL fcntl(0x9,0x4,0x6) > 28042 beam RET fcntl 0 > 28042 beam CALL setsockopt(0x9,0xffff,0x1002,0xbfffe1fc,0x4) > 28042 beam RET setsockopt 0 > 28042 beam CALL setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) > 28042 beam RET setsockopt 0 > 28042 beam CALL bind(0x9,0xbfffe0e0,0x10) > 28042 beam RET bind -1 errno 48 Address already in use > -------- > > setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) looks right: > > -------- > % grep -e SO_REUSEADDR -e SOL_SOCKET /usr/include/sys/socket.h > #define SO_REUSEADDR 0x0004 /* allow local address reuse */ > #define SOL_SOCKET 0xffff /* options for socket level */ > -------- > > the only thing i can't verify is that 0xbfffe1fc is a pointer to one. > > thanks, > > -- p > > % dpkg -s erlang-otp | grep Version > Version: 11b-5-1 > % erl -version > Erlang (ASYNC_THREADS) (BEAM) emulator version 5.5.5 > > Optimism is an essential ingredient of innovation. How else can the > individual favor change over security? > > -- Robert Noyce -------------------------------------------------------------------------------- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bbmaj7@REDACTED Thu Nov 8 12:06:27 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Thu, 8 Nov 2007 22:06:27 +1100 (EST) Subject: [erlang-questions] Now, starting with erlang In-Reply-To: <21822.83.40.172.193.1194510342.squirrel@lordzealon.com> Message-ID: <681035.35907.qm@web52004.mail.re2.yahoo.com> --- glpunzi@REDACTED wrote: > But, I don't know how to apply this to erlang. How is the normal procedure > to start a project on it. Or some tutorial about writing desktop > applications on erlang. All I found is about developing server side > applications, and this, is not my primary goal. > > Cheers and thanks. I have not used it but you might find this useful: http://wxerlang.sourceforge.net/ National Bingo Night. Play along for the chance to win $10,000 every week. Download your gamecard now at Yahoo!7 TV. http://au.blogs.yahoo.com/national-bingo-night/ From mpquique@REDACTED Thu Nov 8 12:25:44 2007 From: mpquique@REDACTED (Enrique Marcote) Date: Thu, 8 Nov 2007 12:25:44 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> Message-ID: <868840700711080325ob56a0b7yf0a52d4188b43ed5@mail.gmail.com> Sorry, let me correct myself (I meant "is not"). Of course that's just my personal opinion. > erlang is not > the best choice for the two projects you have in mind right now > El 06/11/2007, a las 14:50, Giuseppe Luigi Punzi Ruiz escribi?: > > > Hi again, > > > > El 06/11/2007, a las 14:27, Christian S escribi?: > > > >> I can hear how other subscribers are tapping away their mail response > >> to you, so prepare your mailbox to be erlang-questions-dotted > > > > Yes, mail rules created :D > > > >> > >>> - Is erlang fast? > >> > >> It is not good as good at number crunching as ocaml or low level > >> imperative languages. It does however build fast systems, see this > >> slide: > >> > >> http://www.slideshare.net/Arbow/comparing-cpp-and-erlang-for- > >> motorola-telecoms-software/ > >> > >> Also, erlang is very succinct and quick coded. That's an important > >> way > >> to be fast. > > > > Well, this questions was stupid. I know Wings, and is great in > > perfomance I think. > > > >> > >>> - How is the persistence/database connection? > >> > >> My opinion: They work, but they're not to impress with. > >> Erlang has a database called mnesia that provide much higher > >> transaction rates than links to external dbs, mnesia also support > >> distribution over several nodes. > > > > And, on the other hand, you can access too to postgresql, mysql? > > > > > >> > >>> - What about graphical interface for the apps? and web frontend? > >> > >> You can create desktop guis using the 'gs' application which is back > >> ended in Tcl/Tk. This will not impress anyone. There is 'gtknode', a > >> c-node, a way for erlang to communicate with a c program running GTK+ > >> to exchange events. I dont have experience with it, but it seems > >> great > >> and you can build the GUI part in Glade. > > > > interesting. Some documentation about this? > > > >> There is soon a number of web server alternatives popping up. Yaws is > >> the popular one so far, but I think that might change now that other > >> commercially used and tested web servers are going open source. > > > > Yes, but not all webservers accepts erlang. > > > >> > >>> - PocketPC, Palm support? > >> > >> There is an ARM port of erlang, might require some assembly. > > > > Is not important at the moment. > > > >> > >>> - What about the community for support? > >> > >> Ridiculously good. If I dont get an answer in freenode #erlang within > >> minutes I get a very good answer from this list in an hour. If it is > >> during swedish office hours you often get support from the author > >> directly. It's good to be small. > > > > Yes, in the smalltalk community happens the same. > > > >> > >>> - Spanish erlang-developers? > >> > >> I can't say I have noticed any larger group of spanish erlang > >> developers. > > > > Ok. > > > > From the point of view of a newbie, I see erlang as a lenguaje for > > great scale apps. What do you think about use it for a small company > > thath develop small software, like a POS, or something similar? > > > > Thanks for your answers :D > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > From kevin@REDACTED Thu Nov 8 12:30:31 2007 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 8 Nov 2007 06:30:31 -0500 Subject: [erlang-questions] Now, starting with erlang In-Reply-To: <21822.83.40.172.193.1194510342.squirrel@lordzealon.com> References: <21822.83.40.172.193.1194510342.squirrel@lordzealon.com> Message-ID: <9E4F6B77-4016-4F7D-8FF9-A644EA7545B2@hypotheticalabs.com> Sounds like you're new to Erlang. If that's the case, I'd recommend Joe Armstrong's book, Programming Erlang. --Kevin On Nov 8, 2007, at 3:25 AM, glpunzi@REDACTED wrote: > Hi again. > > After your responses, probably, erlang could be suitable for my needs. > > THen, now, I need, some tutorial, paper, etc.. to learn about the > syntax, > and the more important, how to apply my concepts in develop, to this > languaje. > > For example,I know, how to develop on Delphi, building a "form" and > developing over the events, the behaviour I want for the app. > Connecting > to DDBB etc.. > > But, I don't know how to apply this to erlang. How is the normal > procedure > to start a project on it. Or some tutorial about writing desktop > applications on erlang. All I found is about developing server side > applications, and this, is not my primary goal. > > Cheers and thanks. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From glpunzi@REDACTED Thu Nov 8 12:39:44 2007 From: glpunzi@REDACTED (glpunzi@REDACTED) Date: Thu, 8 Nov 2007 12:39:44 +0100 (CET) Subject: [erlang-questions] Now, starting with erlang In-Reply-To: <681035.35907.qm@web52004.mail.re2.yahoo.com> References: <681035.35907.qm@web52004.mail.re2.yahoo.com> Message-ID: <23662.83.40.172.193.1194521984.squirrel@lordzealon.com> I saw the web yesterday and thinked was outdated, but on sf.net there are recent packages. The web is outdated. I will check when neccessary. Now, I need to study about how can I "paste" my ideas in erlang code. Thanks. > > --- glpunzi@REDACTED wrote: > >> But, I don't know how to apply this to erlang. How is the normal >> procedure >> to start a project on it. Or some tutorial about writing desktop >> applications on erlang. All I found is about developing server side >> applications, and this, is not my primary goal. >> >> Cheers and thanks. > > I have not used it but you might find this useful: > > http://wxerlang.sourceforge.net/ > > > > > > National Bingo Night. Play along for the chance to win $10,000 every week. > Download your gamecard now at Yahoo!7 TV. > http://au.blogs.yahoo.com/national-bingo-night/ > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From codewalkerjoe@REDACTED Thu Nov 8 13:29:18 2007 From: codewalkerjoe@REDACTED (joe lee) Date: Thu, 8 Nov 2007 07:29:18 -0500 Subject: [erlang-questions] Both yaws install by cean and on cygwin failing Message-ID: <50ec7a2e0711080429h125a51f8ge4e5109e6bc17bd4@mail.gmail.com> Yaws install in cygwin is failing on make: ./configure --prefix=/usr/local/yaws When I tried doing "make", I am getting the following error: if [ ! -z "" ]; then \ echo > charset.def; \ else rm charset.def 2> /dev/null; touch charset.def; fi /cygdrive/i/Program Files/erl5.5.5/bin/erl -noshell -pa ../ebin -s mime_type_c compile make[1]: /cygdrive/i/Program: Command not found make[1]: *** [mime_types.erl] Error 127 make[1]: Leaving directory `/home/joe/apps/yaws-1.73/src' make: *** [all] Error 1 I also tried to install yaws through cean:install(yaws), I get an error as: 2> cean:install(yaws). error: yaws not found in download error I have erlang 5.5.5 OTP R11B and have it installed on windows xp at i:\Program Files\erl5.5.5 thanks, joe From jao@REDACTED Thu Nov 8 13:50:21 2007 From: jao@REDACTED (Jack Orenstein) Date: Thu, 8 Nov 2007 07:50:21 -0500 Subject: [erlang-questions] OTP & Global Names In-Reply-To: <4732B593.90508@charpi.net> References: <628B0FB0-44F5-496E-81F4-AC760C4C8C00@hypotheticalabs.com> <87561E6D-83BC-4CA0-A45D-EA1AACF8BC61@geophile.com> <4732B593.90508@charpi.net> Message-ID: <1966B621-4314-4C09-B1B5-66FB47EFD40C@geophile.com> On Nov 8, 2007, at 2:06 AM, Nicolas Charpentier wrote: > Hi, > > > Jack Orenstein wrote: >> I ran into a similar problem, and used global:sync/0 to make sure >> that all names were known on all nodes. I'm not positive that this >> is necessary, or a recommended technique, but it seemed to do the >> trick. > > Maybe you can try to configure the kernel application. I think > about those parameters, which may be used for nodes > synchronization: sync_nodes_mandatory, sync_nodes_optional, > sync_nodes_timeout. But the problem isn't seeing other nodes, it's the registration of global names from other nodes. (Of the parameters you mention only sync_nodes_timeout helps, and the doc suggests that it's doing global:sync.) Jack From kevin@REDACTED Thu Nov 8 15:21:01 2007 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 8 Nov 2007 09:21:01 -0500 Subject: [erlang-questions] OTP & Global Names In-Reply-To: <87561E6D-83BC-4CA0-A45D-EA1AACF8BC61@geophile.com> References: <628B0FB0-44F5-496E-81F4-AC760C4C8C00@hypotheticalabs.com> <87561E6D-83BC-4CA0-A45D-EA1AACF8BC61@geophile.com> Message-ID: That did the trick! Interesting part is I left the nodes up overnight and the name never did become available without calling global:sync/0. Curious... --Kevin On Nov 7, 2007, at 10:25 PM, Jack Orenstein wrote: > I ran into a similar problem, and used global:sync/0 to make sure > that all names were known on all nodes. I'm not positive that this > is necessary, or a recommended technique, but it seemed to do the > trick. > > Jack > > On Nov 7, 2007, at 10:16 PM, Kevin A. Smith wrote: > >> I've been playing around with OTP a bit and have run into some >> behavior I'm not understanding. >> >> I have two nodes running on my laptop, foo and bar. Node foo is a erl >> shell started with the -sname parameter. Node bar is also an erl >> shell >> but is started -sname and with a boot script for a very simple OTP >> application. The app starts two gen_servers, calc and cache. Cache is >> started with the tuple {local, ?SERVER}. I expect cache to only be >> visible directly on its node and it is. >> >> On the other hand, calc is started with the tuple {global, ?SERVER}. >> I'd expect calc to be visible via global:registered_names() on node >> foo. Sadly for me, registered_names() returns an empty list. I've >> tested and verified basic networking between the two nodes via >> net_adm:ping() so I believe the nodes can see each other. >> >> What have I missed? I can provide copies of my .rel and .app files if >> it would help diagnose the problem. >> >> --Kevin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > From paul-trapexit@REDACTED Thu Nov 8 16:19:46 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Thu, 8 Nov 2007 07:19:46 -0800 (PST) Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: <010801c821db$5f4e4aa0$6401a8c0@moneymaker2> References: <010801c821db$5f4e4aa0$6401a8c0@moneymaker2> Message-ID: Ok. This problem arose because a multicast application I'm writing won't let two nodes on the same box work under darwin but does under linux. However this link says that for multicast ports, SO_REUSEADDR is the same as SO_REUSEPORT. http://www.unixguide.net/network/socketfaq/4.11.shtml So my modified version of test (attached), still fails under darwin and succeeds under linux. Is this a known problem under darwin? Is there a way to specify SO_REUSEPORT for gen_udp:open ? Thanks, -- p On Thu, 8 Nov 2007, Valentin Micic wrote: > In your program, you're attempting to use the sampe port while the socket is > still active -- SO_REUSEADDR does not serve that purpose. > Rather, it means that when owner of the socket no longer needs it (i.e. > issue close socket, or terminates), another process may reuse the same port > immediately without waiting for TIME_WAIT period to expire. > > V. > > > ----- Original Message ----- > From: "Paul Mineiro" > To: > Sent: Thursday, November 08, 2007 6:25 AM > Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? > > > > hi. > > > > i've attached a very short erlang program which tries to open two udp > > ports with reuseaddr option. it works under linux but fails under darwin. > > > > is this a known problem? > > > > i can see the following in the ktrace: > > > > -------- > > % ktrace -id -t c erl -eval 'test:test ()' -noshell -noinput -s init stop > > -------- > > > > the kdump.out contains: > > > > -------- > > 28042 beam CALL socket(0x2,0x2,0x11) > > 28042 beam RET socket 9 > > 28042 beam CALL fcntl(0x9,0x3,0) > > 28042 beam RET fcntl 2 > > 28042 beam CALL fcntl(0x9,0x4,0x6) > > 28042 beam RET fcntl 0 > > 28042 beam CALL setsockopt(0x9,0xffff,0x1002,0xbfffe1fc,0x4) > > 28042 beam RET setsockopt 0 > > 28042 beam CALL setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) > > 28042 beam RET setsockopt 0 > > 28042 beam CALL bind(0x9,0xbfffe0e0,0x10) > > 28042 beam RET bind -1 errno 48 Address already in use > > -------- > > > > setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) looks right: > > > > -------- > > % grep -e SO_REUSEADDR -e SOL_SOCKET /usr/include/sys/socket.h > > #define SO_REUSEADDR 0x0004 /* allow local address reuse */ > > #define SOL_SOCKET 0xffff /* options for socket level */ > > -------- > > > > the only thing i can't verify is that 0xbfffe1fc is a pointer to one. > > > > thanks, > > > > -- p > > > > % dpkg -s erlang-otp | grep Version > > Version: 11b-5-1 > > % erl -version > > Erlang (ASYNC_THREADS) (BEAM) emulator version 5.5.5 > > > > Optimism is an essential ingredient of innovation. How else can the > > individual favor change over security? > > > > -- Robert Noyce > > > -------------------------------------------------------------------------------- > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Optimism is an essential ingredient of innovation. How else can the individual favor change over security? -- Robert Noyce -------------- next part -------------- -module (test). -compile (export_all). test () -> Addr = { 226, 0, 0, 1 }, Port = 4545, { ok, Socket } = gen_udp:open (Port, [ { active, true }, { add_membership, { Addr, { 0, 0, 0, 0 } } }, { multicast_loop, true }, { reuseaddr, true }, list ]), { ok, SocketTwo } = gen_udp:open (Port, [ { active, true }, { add_membership, { Addr, { 0, 0, 0, 0 } } }, { multicast_loop, true }, { reuseaddr, true }, list ]), { Socket, SocketTwo }. From dot@REDACTED Thu Nov 8 17:58:54 2007 From: dot@REDACTED (Tony Finch) Date: Thu, 8 Nov 2007 16:58:54 +0000 Subject: [erlang-questions] use of sendfile In-Reply-To: References: Message-ID: On Thu, 8 Nov 2007, Torbjorn Tornkvist wrote: > > I just wrote a minimal sendfile linked-in driver. I compared the > performance with a yaws server but didn't see any difference in > performance. Is that expected ? Sendfile is most useful when your working set is larger than RAM, because it deals better with disk latency and buffer sharing between disk and network code in the kernel. Tony. -- f.a.n.finch http://dotat.at/ VIKING: CYCLONIC BECOMING NORTHWEST SEVERE GALE 9 TO VIOLENT STORM 11, DECREASING GALE 8 LATER. HIGH BECOMING VERY HIGH FOR A TIME. RAIN THEN SQUALLY SHOWERS. VERY POOR, BECOMING MAINLY GOOD. From paul-trapexit@REDACTED Thu Nov 8 19:24:32 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Thu, 8 Nov 2007 10:24:32 -0800 (PST) Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: References: <010801c821db$5f4e4aa0$6401a8c0@moneymaker2> Message-ID: I ended up doing the following. It seems dangerous. -------- % This is correct for darwin and freebsd 4.1, but no guarantees SoReusePort = { raw, 16#ffff, 16#0200, <<1:32/native>> }, { ok, Socket } = try gen_udp:open (Port, [ SoReusePort | Opts ]) catch exit : badarg -> % perhaps no support for SO_REUSEPORT gen_udp:open (Port, Opts) end, -------- The danger arises because 1) I'm counting on the BSD variants using 0x200 for SO_REUSEPORT (i checked darwin and freebsd 4.1, this is true) and 2) I'm counting on 0x200 not meaning anything to another nixes (i checked linux, this is true). It would be super cool for better portability if 1. soreuseport was supported and ignored as platform appropriate, or 2. there was a (public) way to get a socket that was unbound and then bind it later. the problem is i need to set this option before binding. there is such a way with prim_inet but I thought it was more dangerous to replicate the guts of inet_udp than to do the above try/catch, or 3. there was a way to specify optional options to gen_(udp|tcp):open which were allowed to fail. right now if any return error the entire open fails. If somebody has a better way of going about this, I'd love to hear it. -- p On Thu, 8 Nov 2007, Paul Mineiro wrote: > Ok. > > This problem arose because a multicast application I'm writing won't let > two nodes on the same box work under darwin but does under linux. > > However this link says that for multicast ports, SO_REUSEADDR is the same > as SO_REUSEPORT. > > http://www.unixguide.net/network/socketfaq/4.11.shtml > > So my modified version of test (attached), still fails under darwin and > succeeds under linux. > > Is this a known problem under darwin? > > Is there a way to specify SO_REUSEPORT for gen_udp:open ? > > Thanks, > > -- p > > On Thu, 8 Nov 2007, Valentin Micic wrote: > > > In your program, you're attempting to use the sampe port while the socket is > > still active -- SO_REUSEADDR does not serve that purpose. > > Rather, it means that when owner of the socket no longer needs it (i.e. > > issue close socket, or terminates), another process may reuse the same port > > immediately without waiting for TIME_WAIT period to expire. > > > > V. > > > > > > ----- Original Message ----- > > From: "Paul Mineiro" > > To: > > Sent: Thursday, November 08, 2007 6:25 AM > > Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? > > > > > > > hi. > > > > > > i've attached a very short erlang program which tries to open two udp > > > ports with reuseaddr option. it works under linux but fails under darwin. > > > > > > is this a known problem? > > > > > > i can see the following in the ktrace: > > > > > > -------- > > > % ktrace -id -t c erl -eval 'test:test ()' -noshell -noinput -s init stop > > > -------- > > > > > > the kdump.out contains: > > > > > > -------- > > > 28042 beam CALL socket(0x2,0x2,0x11) > > > 28042 beam RET socket 9 > > > 28042 beam CALL fcntl(0x9,0x3,0) > > > 28042 beam RET fcntl 2 > > > 28042 beam CALL fcntl(0x9,0x4,0x6) > > > 28042 beam RET fcntl 0 > > > 28042 beam CALL setsockopt(0x9,0xffff,0x1002,0xbfffe1fc,0x4) > > > 28042 beam RET setsockopt 0 > > > 28042 beam CALL setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) > > > 28042 beam RET setsockopt 0 > > > 28042 beam CALL bind(0x9,0xbfffe0e0,0x10) > > > 28042 beam RET bind -1 errno 48 Address already in use > > > -------- > > > > > > setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) looks right: > > > > > > -------- > > > % grep -e SO_REUSEADDR -e SOL_SOCKET /usr/include/sys/socket.h > > > #define SO_REUSEADDR 0x0004 /* allow local address reuse */ > > > #define SOL_SOCKET 0xffff /* options for socket level */ > > > -------- > > > > > > the only thing i can't verify is that 0xbfffe1fc is a pointer to one. > > > > > > thanks, > > > > > > -- p > > > > > > % dpkg -s erlang-otp | grep Version > > > Version: 11b-5-1 > > > % erl -version > > > Erlang (ASYNC_THREADS) (BEAM) emulator version 5.5.5 > > > > > > Optimism is an essential ingredient of innovation. How else can the > > > individual favor change over security? > > > > > > -- Robert Noyce > > > > > > -------------------------------------------------------------------------------- > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > Optimism is an essential ingredient of innovation. How else can the > individual favor change over security? > > -- Robert Noyce Optimism is an essential ingredient of innovation. How else can the individual favor change over security? -- Robert Noyce From exta7@REDACTED Thu Nov 8 21:05:21 2007 From: exta7@REDACTED (Zvi) Date: Thu, 8 Nov 2007 12:05:21 -0800 (PST) Subject: [erlang-questions] Dynamically generated atoms get reused if they are the same? In-Reply-To: <472F9A9A.8060806@cs.ntua.gr> References: <20071105222124.121380@gmx.net> <472F9A9A.8060806@cs.ntua.gr> Message-ID: <13654685.post@talk.nabble.com> Hi, is this a wise idea to implement English->English dictionary using atoms? (the other choice is binaries, lists are out of question, since they taking 16 words/character on 64bit machine). Example of such a dictionary is mapping a word to the list of synonymous words, i.e: get_synonims(job) -> [work,task,gig]. Of course after dictionary once filled, only list_to_existing_atom will be used and let's say there is maximum 100K words. Thanks in advance, Zvi Kostis Sagonas-2 wrote: > > nindeu@REDACTED wrote: >> Hi, >> >> According to http://www.erlang.org/doc/efficiency_guide/bif.html#6.1 >> atoms do not get garbage collected. Meaning if you constantly produce >> atoms by using list_to_atom/1 you sooner or later will run out of space >> for them. >> >> Now I just wrote a small test program which indicates that as long as you >> produce the same atom, it will not take up additional space: >> >> So, can anyone confirm, is it correct that dynamically generated Atoms >> are of no concern as long as you do not produce too many _different_ >> ones? > > Yes, of course. > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Dynamically-generated-atoms-get-reused-if-they-are-the-same--tf4754859.html#a13654685 Sent from the Erlang Questions mailing list archive at Nabble.com. From exta7@REDACTED Thu Nov 8 21:20:07 2007 From: exta7@REDACTED (Zvi) Date: Thu, 8 Nov 2007 12:20:07 -0800 (PST) Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: <13654990.post@talk.nabble.com> In Hebrew: ??? ??? ???? "Parat Moshe Rabenu" Literally: "Our Teacher Moses' Cow" ;-) Zvi -- View this message in context: http://www.nabble.com/erlang-and-Kara-tf4763872.html#a13654990 Sent from the Erlang Questions mailing list archive at Nabble.com. From monch1962@REDACTED Thu Nov 8 20:42:27 2007 From: monch1962@REDACTED (David Mitchell) Date: Fri, 9 Nov 2007 06:42:27 +1100 Subject: [erlang-questions] Now, starting with erlang In-Reply-To: <21822.83.40.172.193.1194510342.squirrel@lordzealon.com> References: <21822.83.40.172.193.1194510342.squirrel@lordzealon.com> Message-ID: As others have said, you might find Erlang is not well suited to building desktop applications. I find it great for building servers, but I wouldn't even attempt to use it for desktop apps - the library support really doesn't look that great, and there would be a LOT of work to do in creating a GUI. If you're used to Delphi, you'll probably become very frustrated very quickly. Why not keep building your desktop apps with Delphi, and consider switching to Erlang for any server-side components? That would seem to give you the best of both worlds Regards Dave M. On 08/11/2007, glpunzi@REDACTED wrote: > Hi again. > > After your responses, probably, erlang could be suitable for my needs. > > THen, now, I need, some tutorial, paper, etc.. to learn about the syntax, > and the more important, how to apply my concepts in develop, to this > languaje. > > For example,I know, how to develop on Delphi, building a "form" and > developing over the events, the behaviour I want for the app. Connecting > to DDBB etc.. > > But, I don't know how to apply this to erlang. How is the normal procedure > to start a project on it. Or some tutorial about writing desktop > applications on erlang. All I found is about developing server side > applications, and this, is not my primary goal. > > Cheers and thanks. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From exta7@REDACTED Thu Nov 8 23:05:02 2007 From: exta7@REDACTED (Zvi) Date: Thu, 8 Nov 2007 14:05:02 -0800 (PST) Subject: [erlang-questions] how: Erlang cluster on Windows Message-ID: <13656948.post@talk.nabble.com> Hi, I have let's say 50 Windows XP nodes each with 4 CPU cores and with shared disk drive. So I installed Erlang on the shared drive, let's say X:\erl . Now I'm able to launce erl.exe on remote nodes from the management node. The problem is that I need to run 200 Erlang nodes, i.e. 4 per host (since Erlang doesn't support SMP on Windows). Do I need just to launce 4 erl.exe processes on each node or I need specify CPU affinity for each erl.exe process, using some Affinity Mask tool/utility? Maybe there is some undocumented command line options for erl.exe on SMP / multicore Windows? Thanks in advance Zvi -- View this message in context: http://www.nabble.com/how%3A-Erlang-cluster-on-Windows-tf4773977.html#a13656948 Sent from the Erlang Questions mailing list archive at Nabble.com. From exta7@REDACTED Thu Nov 8 23:06:11 2007 From: exta7@REDACTED (Zvi) Date: Thu, 8 Nov 2007 14:06:11 -0800 (PST) Subject: [erlang-questions] how: Erlang cluster on Windows Message-ID: <13656948.post@talk.nabble.com> Hi, I have let's say 50 Windows XP nodes each with 4 CPU cores and with shared disk drive. So I installed Erlang on the shared drive, let's say X:\erl . Now I'm able to launch erl.exe on remote nodes from the management node. The problem is that I need to run 200 Erlang nodes, i.e. 4 per host (since Erlang doesn't support SMP on Windows). Do I need just to launch 4 erl.exe processes on each node or I need specify CPU affinity for each erl.exe process, using some Affinity Mask tool/utility? Maybe there is some undocumented command line options for erl.exe on SMP / multicore Windows? Thanks in advance Zvi -- View this message in context: http://www.nabble.com/how%3A-Erlang-cluster-on-Windows-tf4773977.html#a13656948 Sent from the Erlang Questions mailing list archive at Nabble.com. From michael.regen@REDACTED Fri Nov 9 04:13:53 2007 From: michael.regen@REDACTED (Michael Regen) Date: Fri, 9 Nov 2007 04:13:53 +0100 Subject: [erlang-questions] how: connect to ssh_sshd with something else than OpenSSH client (including howto) Message-ID: <9b59d0270711081913w6aceab68of4e579b5fb79289a@mail.gmail.com> Did anyone of you have success with connecing to ssh_sshd except with the OpenSSH client? After fiddling with ssh_sshd I managed to connect to it with my brave OpenSSH client (Windows and Linux). Fine. But every other ssh client I tried so far did not work: With putty v 0.58 I could enter my user name and password, saw the usual Erlang greetings and the prompt 1> and could not enter anything although it looked like putty believed in a connection which can be used. Turning on various echos, etc did not really help. There was never a response from sshd. With putty 0.60 I see an empty screen. No chance to enter any username, etc. Since putty only supports xterm terminal emulation I tried the current version of SecureCRT 5.5.3 which besides a lot of others, also supports vt100. Same as with putty 0.58. TeraTermPro (yes, the one which supports SSH2) simply disappears as soon as you enter your password and press enter. No idea where to get F-Secure SSH client for testing. I do not think there are many actively developed ssh clients for the windows platform left. At least not many you could expect at your customer's PCs. Did I do something wrong or shouldn't we consider ssh_sshd as production ready? BTW it took me some time and browsing through the source code to make ssh_sshd work. Maybe it helps someone else, this is what I did under Linux: http://www.erlang.org/pipermail/erlang-questions/2005-December/018190.html is right, the documentation is a bit terse. :) First, create your private/public keys. ssh_sshd will not run and let someone connect if you choose other file names or omit one of the keys - as far as I saw. I am also wondering a bit why you have to create keys for protocol version 1. I hope ssh1 is not supported, otherwise we might want to have an option to turn it off. ssh-keygen -t rsa1 -f ssh_host_key -C '' -N '' ssh-keygen -f ssh_host_rsa_key -t rsa -N '' ssh-keygen -f ssh_host_dsa_key -t dsa -N '' % start erlang and then first the crypto server crypto:start(). % next start ssh_sshd on e.g. 127.0.0.1:12345 {ok,SshPID} = ssh_sshd:listen({127,0,0,1}, 12345, [{system_dir, "/directory/where/you/stored/your/keys"}, {user_passwords, [{"bob", "ilovealice"}]}]). Of course you can also omit creating your own keys, make the keys in /etc/ssh readable for the user who starts Erlang and omit the system_dir parameter. But I guess this is not what you typically want. Cheers, Michael From bengt.kleberg@REDACTED Fri Nov 9 07:47:48 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 09 Nov 2007 07:47:48 +0100 Subject: [erlang-questions] Soft realtime stats In-Reply-To: <9e009ad0711080054l5bb2c616i83e40b3c3ddcbf7d@mail.gmail.com> References: <9e009ad0711080054l5bb2c616i83e40b3c3ddcbf7d@mail.gmail.com> Message-ID: <47340294.6000300@ericsson.com> greetings, at the erlang user conference yesterday we where told that there is no determinism in the erlang garbage collector. i consider that as part of the VM, so you will have no runtime determinism. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 2007-11-08 09:54, Joern wrote: > Dear erlang-questions, > > I am looking for papers or documentation regarding the (amount or lack > thereof) runtime determinism of the Erlang VM. Any pointers? > > Best regards, > > > Joern > -- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From per@REDACTED Fri Nov 9 08:35:26 2007 From: per@REDACTED (Per Hedeland) Date: Fri, 9 Nov 2007 08:35:26 +0100 (CET) Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: Message-ID: <200711090735.lA97ZQkD085869@pluto.hedeland.org> Paul Mineiro wrote: >If somebody has a better way of going about this, I'd love to hear it. >> However this link says that for multicast ports, SO_REUSEADDR is the same >> as SO_REUSEPORT. Actually no, it says that for multicast *addresses*, it is (there's no such thing as a multicast port:-). And this seems to be true on all of Linux, Darwin, and FreeBSD. I.e. you need to pass in an actual multicast address to bind to, instead of letting it default to the wildcard address - then reuseaddr is enough: mars 9> uname -sr FreeBSD 6.2-STABLE-200709 mars 10> erl Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] Eshell V5.5.5 (abort with ^G) 1> Port=4545. 4545 2> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). {ok,#Port<0.96>} 3> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). {ok,#Port<0.97>} 4> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). {ok,#Port<0.98>} The Linux behaviour seems like a bug to me. --Per Hedeland From richardc@REDACTED Fri Nov 9 11:01:43 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 09 Nov 2007 11:01:43 +0100 Subject: [erlang-questions] Scheme in Erlang? In-Reply-To: <47328306.4000607@gmail.com> References: <1194453077.4096.2.camel@metalman.lan> <47328306.4000607@gmail.com> Message-ID: <47343007.8010907@it.uu.se> Berlin Brown wrote: > This article on scheme in erlang is pretty popular? Does anyone know of > an scheme interpreter and tutorial for erlgang? Once upon a time, Luke Gorrie did a Lisp in Erlang, called "lersp": http://cean.process-one.net/packages/index.yaws?action=detail&name=lersp /Richard From richardc@REDACTED Fri Nov 9 11:27:54 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 09 Nov 2007 11:27:54 +0100 Subject: [erlang-questions] Soft realtime stats In-Reply-To: <9e009ad0711080054l5bb2c616i83e40b3c3ddcbf7d@mail.gmail.com> References: <9e009ad0711080054l5bb2c616i83e40b3c3ddcbf7d@mail.gmail.com> Message-ID: <4734362A.1040501@it.uu.se> Joern wrote: > Dear erlang-questions, > > I am looking for papers or documentation regarding the (amount or lack > thereof) runtime determinism of the Erlang VM. Any pointers? No papers, as far as I know, but this is basically how things work: 1. The scheduler is in itself very deterministic, so if you run on a single-core cpu (or with a single scheduler on a multicore cpu) and you don't get any timeouts, then the execution tends to be quite deterministic. (In fact, too deterministic, because it means that it is harder to be sure that you have tested your program properly - you may have missed some interleavings that can cause problems if you run it on a more indeterministic system.) 2. Multiple schedulers on SMP add true indeterminism (between schedulers), and of course, the different schedulers can influence each other if a process on one scheduler sends a message to a process on another. 3. I/O and operating system events of course add indeterminism. 4. Timeouts while waiting for messages are another source of indeterminism, since timers are never exact. /Richard From joelr1@REDACTED Fri Nov 9 11:54:08 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 9 Nov 2007 10:54:08 +0000 Subject: [erlang-questions] Book: Hardcore Erlang Message-ID: I signed up with Pragmatic Programmers to write a new Erlang book. Working title is Hardcore Erlang and it will be built around OpenPoker. The emphasis of the book will be more on showing how to write scalable Erlang servers and less on how to write a poker server. Apart from the following topics, are there any other topics you would like me to cover? Thanks, Joel ---- - The architecture of a poker server from far above - Thinking processes instead of objects - Game logic - Stacking state machines - Swapping logic - Storing data in Mnesia - State machines (gen_fsm) - OTP behaviours - Poker bots - Simulating players - Scripting - Designing a network protocol - Binary parsing - Pickler combinators - Automatic clustering - Fault tolerance and fail-over - Load balancing - Testing a network server - Debugging Erlang software Thanks, Joel -- http://wagerlabs.com From goryachev@REDACTED Fri Nov 9 12:57:58 2007 From: goryachev@REDACTED (Igor Goryachev) Date: Fri, 09 Nov 2007 14:57:58 +0300 Subject: [erlang-questions] how: safe recovery from inconsistent_database/running_partitioned_network error In-Reply-To: <4722B821.5080003@ghostgun.com> (jm's message of "Sat\, 27 Oct 2007 14\:01\:37 +1000") References: <4722B821.5080003@ghostgun.com> Message-ID: <87r6iziqbd.fsf@yandex-team.ru> Hello everyone, I am thinking on implementing a safe recovery routine against inconsistent_database/running_partitioned_network errors which occur sometimes in our network environment (because of network failures) with our cluster of 4 nodes powered by erlang/otp. For now working (but dirty!) solution looks like restarting all except one nodes in order they could sync mnesia once again. I am thinking of something that doesn't require to restart nodes or do mnesia:stop/start. The table I want to resync safely is stored in RAM and is cleaned of foreign nodes records (after inconsistent database error detected). Any suggestions? -- Igor Goryachev Yandex development team. From benbutlercole@REDACTED Fri Nov 9 12:27:13 2007 From: benbutlercole@REDACTED (Ben Butler-Cole) Date: Fri, 9 Nov 2007 03:27:13 -0800 (PST) Subject: [erlang-questions] Book: Hardcore Erlang Message-ID: <459204.58394.qm@web30803.mail.mud.yahoo.com> Another couple of things I'd like to hear about are: - upgrading distributed systems - examples of other architectures Ben ----- Original Message ---- From: Joel Reymont To: Erlang Questions Sent: Friday, November 9, 2007 10:54:08 AM Subject: [erlang-questions] Book: Hardcore Erlang I signed up with Pragmatic Programmers to write a new Erlang book. Working title is Hardcore Erlang and it will be built around OpenPoker. The emphasis of the book will be more on showing how to write scalable Erlang servers and less on how to write a poker server. Apart from the following topics, are there any other topics you would like me to cover? Thanks, Joel ---- - The architecture of a poker server from far above - Thinking processes instead of objects - Game logic - Stacking state machines - Swapping logic - Storing data in Mnesia - State machines (gen_fsm) - OTP behaviours - Poker bots - Simulating players - Scripting - Designing a network protocol - Binary parsing - Pickler combinators - Automatic clustering - Fault tolerance and fail-over - Load balancing - Testing a network server - Debugging Erlang software Thanks, Joel -- http://wagerlabs.com _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From jao@REDACTED Fri Nov 9 13:45:31 2007 From: jao@REDACTED (Jack Orenstein) Date: Fri, 9 Nov 2007 07:45:31 -0500 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: <2284D713-47C1-41A6-869D-C90EBC9ECA76@geophile.com> > - Fault tolerance and fail-over I'd include startup and shutdown in this part. A system that is not completely up may be on it's way up (startup), on its way down (shutdown) or failing over. Doing the right thing for each scenario (and in a way that doesn't break the others) is sometimes very tricky. Sounds like a very useful book. Jack From saleyn@REDACTED Fri Nov 9 14:00:24 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 09 Nov 2007 08:00:24 -0500 Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: <200711090735.lA97ZQkD085869@pluto.hedeland.org> References: <200711090735.lA97ZQkD085869@pluto.hedeland.org> Message-ID: <473459E8.8080301@gmail.com> Per Hedeland wrote: > Actually no, it says that for multicast *addresses*, it is (there's no > such thing as a multicast port:-). And this seems to be true on all of > Linux, Darwin, and FreeBSD. I.e. you need to pass in an actual multicast > address to bind to, instead of letting it default to the wildcard > address - then reuseaddr is enough: > > mars 9> uname -sr > FreeBSD 6.2-STABLE-200709 > mars 10> erl > Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] > > Eshell V5.5.5 (abort with ^G) > 1> Port=4545. > 4545 > 2> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). > {ok,#Port<0.96>} > 3> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). > {ok,#Port<0.97>} > 4> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). > {ok,#Port<0.98>} Is this the "right" way of joining a multicast group though? I've been using the "undocumented" add_membership inet option to accomplish that (though haven't tried it on anything other than Win, Linux, Solaris): gen_udp:open(Port, [{reuseaddr, true}, {add_membership, {Addr, Interface}}]). I haven't checked the inet_drv, but does it actually check if in the {ip, Addr} option Addr refers to a multicast range and sets the IP_ADD_MEMBERSHIP option? Serge From alexander.lamb@REDACTED Fri Nov 9 14:09:18 2007 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Fri, 9 Nov 2007 14:09:18 +0100 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: Some items: - how to bridge to other systems (through a message bus maybe, e.g. RabbitMQ) to "push data out" - how to handle state for a connected user and bridge to a user interface (Web or other) - how to handle updates of data formats (records) without breaking all the chain Looking forward to read it (now I finished Joe's book:-). When can we expect to see it on the shelves? Alex Le 9 nov. 07 ? 11:54, Joel Reymont a ?crit : > I signed up with Pragmatic Programmers to write a new Erlang book. > > Working title is Hardcore Erlang and it will be built around > OpenPoker. The emphasis of the book will be more on showing how to > write scalable Erlang servers and less on how to write a poker server. > > Apart from the following topics, are there any other topics you would > like me to cover? > > Thanks, Joel > > ---- > > - The architecture of a poker server from far above > > - Thinking processes instead of objects > > - Game logic > - Stacking state machines > - Swapping logic > > - Storing data in Mnesia > > - State machines (gen_fsm) > > - OTP behaviours > > - Poker bots > - Simulating players > - Scripting > > - Designing a network protocol > - Binary parsing > - Pickler combinators > > - Automatic clustering > > - Fault tolerance and fail-over > > - Load balancing > > - Testing a network server > > - Debugging Erlang software > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch From joelr1@REDACTED Fri Nov 9 14:18:59 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 9 Nov 2007 13:18:59 +0000 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: <685E99CD-9BA9-4C2F-AA2F-E37B560FEEE3@gmail.com> On Nov 9, 2007, at 1:09 PM, Alexander Lamb wrote: > Looking forward to read it (now I finished Joe's book:-). When can > we expect to see it on the shelves? 6 months is my goal. You should start seeing drafts much earlier. Thanks, Joel -- http://wagerlabs.com From exta7@REDACTED Fri Nov 9 15:44:11 2007 From: exta7@REDACTED (Zvi) Date: Fri, 9 Nov 2007 06:44:11 -0800 (PST) Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> Message-ID: <13668269.post@talk.nabble.com> Hi, Can't GUID or make_ref/0 be used for this somehow? make_ref() -> ref() Returns an almost unique reference. The returned reference will reoccur after approximately 2^82 calls; therefore it is unique enough for practical purposes. > make_ref(). #Ref<0.0.0.135> Dmitri Girenko wrote: > > Hi all, > > Having come from J2EE world I find it very difficult to get rid of all > the patterns that I'm used to. There is one that can be named ID > generator. > > I have a set of unique objects that have to be stored in the DB > (mnesia). I have to generate short unique numeric ID for those items. In > my previous life usually a DB procedure/generators were used to ensure > ID uniqueness in a cluster environment. But how can I achieve this > functionality in OTP? > > Here are a few ideas that come to my mind: > > 1. use ordered_set and select last.id + 1. > Adds 1 extra select per insert. > > 2. use table size + 1. > 1 extra query, but maybe it's optimized enough? > > > Both these have runtime overhead + race conditions. > > > 3. create a separate singleton process that initializes counter to > table_size + 1 and dispatches the "next values". > OMG. Singleton in a cluster. Maybe application with failover is > better? But why waste a whole application on just sequence generator. > > 4. Use phash(Item). > but how to handle collisions then? > > Any recommendations? > > Best regards, > Dmitri Girenko > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/how%3A-mnesia%3A-id-generator-in-a-cluster-tf4759227.html#a13668269 Sent from the Erlang Questions mailing list archive at Nabble.com. From exta7@REDACTED Fri Nov 9 15:44:54 2007 From: exta7@REDACTED (Zvi) Date: Fri, 9 Nov 2007 06:44:54 -0800 (PST) Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295EC8E62B@leenu.akumiitti.net> Message-ID: <13668269.post@talk.nabble.com> Hi, Can't GUID or make_ref/0 be used for this somehow? make_ref() -> ref() Returns an almost unique reference. The returned reference will reoccur after approximately 2^82 calls; therefore it is unique enough for practical purposes. > make_ref(). #Ref<0.0.0.135> -- View this message in context: http://www.nabble.com/how%3A-mnesia%3A-id-generator-in-a-cluster-tf4759227.html#a13668269 Sent from the Erlang Questions mailing list archive at Nabble.com. From exta7@REDACTED Fri Nov 9 15:51:26 2007 From: exta7@REDACTED (Zvi) Date: Fri, 9 Nov 2007 06:51:26 -0800 (PST) Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: <13668363.post@talk.nabble.com> I would like to see full real-life example of how to deploy OpenPoker on AWS (EC2, S3) and full life-cycle management of such a system: * initial deployment * monitoring and management * handling Mnesia persistence and distribution * hot code upgrades Zvi Joel Reymont wrote: > > I signed up with Pragmatic Programmers to write a new Erlang book. > > Working title is Hardcore Erlang and it will be built around > OpenPoker. The emphasis of the book will be more on showing how to > write scalable Erlang servers and less on how to write a poker server. > > Apart from the following topics, are there any other topics you would > like me to cover? > > Thanks, Joel > > ---- > > - The architecture of a poker server from far above > > - Thinking processes instead of objects > > - Game logic > - Stacking state machines > - Swapping logic > > - Storing data in Mnesia > > - State machines (gen_fsm) > > - OTP behaviours > > - Poker bots > - Simulating players > - Scripting > > - Designing a network protocol > - Binary parsing > - Pickler combinators > > - Automatic clustering > > - Fault tolerance and fail-over > > - Load balancing > > - Testing a network server > > - Debugging Erlang software > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Book%3A-Hardcore-Erlang-tf4776984.html#a13668363 Sent from the Erlang Questions mailing list archive at Nabble.com. From joelr1@REDACTED Fri Nov 9 16:24:07 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 9 Nov 2007 15:24:07 +0000 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: <13668363.post@talk.nabble.com> References: <13668363.post@talk.nabble.com> Message-ID: <4D33F2F6-3102-4108-855F-A80B6FFDD4EE@gmail.com> It will be done! On Nov 9, 2007, at 2:51 PM, Zvi wrote: > I would like to see full real-life example of how to deploy > OpenPoker on AWS > (EC2, S3) and full life-cycle management of such a system: > * initial deployment > * monitoring and management > * handling Mnesia persistence and distribution > * hot code upgrades -- http://wagerlabs.com From dmitriid@REDACTED Fri Nov 9 16:35:01 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Fri, 09 Nov 2007 17:35:01 +0200 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: <47347E25.7010209@gmail.com> Joel Reymont wrote: > I signed up with Pragmatic Programmers to write a new Erlang book. > > Working title is Hardcore Erlang and it will be built around > OpenPoker. The emphasis of the book will be more on showing how to > write scalable Erlang servers and less on how to write a poker server. > > Amazing! Hoping to get to read it as soon as possible! From greg.burri@REDACTED Fri Nov 9 16:48:29 2007 From: greg.burri@REDACTED (Greg Burri) Date: Fri, 9 Nov 2007 16:48:29 +0100 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: <60ed8a460711090748w357376dv936f428fde77c8ed@mail.gmail.com> Hi, Vendetta Online is a MMORPG which use Erlang for the servers. This can be an good idea to ask the development team about their experience. Here is the website : http://www.vendetta-online.com/ Greg On 11/9/07, Joel Reymont wrote: > I signed up with Pragmatic Programmers to write a new Erlang book. > > Working title is Hardcore Erlang and it will be built around > OpenPoker. The emphasis of the book will be more on showing how to > write scalable Erlang servers and less on how to write a poker server. > > Apart from the following topics, are there any other topics you would > like me to cover? > > Thanks, Joel > > ---- > > - The architecture of a poker server from far above > > - Thinking processes instead of objects > > - Game logic > - Stacking state machines > - Swapping logic > > - Storing data in Mnesia > > - State machines (gen_fsm) > > - OTP behaviours > > - Poker bots > - Simulating players > - Scripting > > - Designing a network protocol > - Binary parsing > - Pickler combinators > > - Automatic clustering > > - Fault tolerance and fail-over > > - Load balancing > > - Testing a network server > > - Debugging Erlang software > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vladdu55@REDACTED Fri Nov 9 16:23:16 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 9 Nov 2007 16:23:16 +0100 Subject: [erlang-questions] {eep} Metaprogramming in Erlang In-Reply-To: <95be1d3b0710230447i3e6decf4se4fde0064aeb7005@mail.gmail.com> References: <95be1d3b0710230447i3e6decf4se4fde0064aeb7005@mail.gmail.com> Message-ID: <95be1d3b0711090723s709f0b0p5564b9ffeae31f59@mail.gmail.com> Hi all, I am a little confused about the fact that there's been no reaction regarding my metaprogramming suggestion. From earlier discussions about this kind of issues, the only thing I wasn't expecting was almost complete silence :-) So I would like to make another call for feedback. Is it unneeded/redundant/silly? Is an implementation called for so that one can get a feeling of what it means in practice? Are more-to-the-point use-cases needed? Is the document too long and boring and nobody remained awake past chapter 1? best regards, Vlad From dking@REDACTED Fri Nov 9 17:08:41 2007 From: dking@REDACTED (David King) Date: Fri, 9 Nov 2007 08:08:41 -0800 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: <75ED8071-A753-4F4F-80D2-8627BC5C5A22@ketralnis.com> > I signed up with Pragmatic Programmers to write a new Erlang book. > Working title is Hardcore Erlang and it will be built around > OpenPoker. The emphasis of the book will be more on showing how to > write scalable Erlang servers and less on how to write a poker server. > Apart from the following topics, are there any other topics you would > like me to cover? I'd be especially interested in seeing some operational issues * One of my servers has a process that has jumped to 100% CPU. How do I find out what's going on? * One of my gen_servers is in a restart loop. How can I trace it and find out why? * The mnesia server has too much I/O load, so we want to add another fragment node. How do I do it? etc > Thanks, Joel > ---- > > - The architecture of a poker server from far above > > - Thinking processes instead of objects > > - Game logic > - Stacking state machines > - Swapping logic > > - Storing data in Mnesia > > - State machines (gen_fsm) > > - OTP behaviours > > - Poker bots > - Simulating players > - Scripting > > - Designing a network protocol > - Binary parsing > - Pickler combinators > > - Automatic clustering > > - Fault tolerance and fail-over > > - Load balancing > > - Testing a network server > > - Debugging Erlang software > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlangx@REDACTED Fri Nov 9 17:56:31 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Fri, 9 Nov 2007 08:56:31 -0800 Subject: [erlang-questions] how: what are the valid subject tags ? Message-ID: <20071109165631.GT21717@delora.autosys.us> I haven't found my list of valid subject tags for erlang-questions. (of course, I can find the message thread in the erlang-questions archive) I mailed to erlang-questions-request@REDACTED with a help subject and an info subject. I received information, though not the list of valid subject tags. A request: 1) Raimo, would you please add the suggested subject tags to the response from the help command to erlang-questions-request@REDACTED (and maybe add a 'request:' tag) thank you, ~Michael From anders.nygren@REDACTED Fri Nov 9 18:08:32 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 9 Nov 2007 11:08:32 -0600 Subject: [erlang-questions] parent of a slave node Message-ID: I have noticed that when I start a slave node, it gets as the parent process PPID=1. Which is not the PID of the process that started the slave node. Is that a bug or just me not understanding things? /Anders From per.gustafsson@REDACTED Fri Nov 9 19:21:27 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Fri, 09 Nov 2007 19:21:27 +0100 Subject: [erlang-questions] {eep} Metaprogramming in Erlang In-Reply-To: <95be1d3b0711090723s709f0b0p5564b9ffeae31f59@mail.gmail.com> References: <95be1d3b0710230447i3e6decf4se4fde0064aeb7005@mail.gmail.com> <95be1d3b0711090723s709f0b0p5564b9ffeae31f59@mail.gmail.com> Message-ID: <4734A527.6040502@it.uu.se> Vlad Dumitrescu wrote: > Hi all, > > I am a little confused about the fact that there's been no reaction > regarding my metaprogramming suggestion. From earlier discussions > about this kind of issues, the only thing I wasn't expecting was > almost complete silence :-) > > So I would like to make another call for feedback. > > Is it unneeded/redundant/silly? > I think this could be a really good addition to Erlang if done right > Is an implementation called for so that one can get a feeling of what > it means in practice? > I think this would be really good. Together with some examples it would give us some idea what we would be able to do > Are more-to-the-point use-cases needed? > Is the document too long and boring and nobody remained awake past chapter 1? > > I read it all the way through. It was pretty easy to read, but in order to be able to give good comments is really hard without having something to experiment with. What kind of limitations would one run into, what would be hard to express. It is difficult to get a feel for this by just reading the document. Per > best regards, > Vlad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From anders.nygren@REDACTED Fri Nov 9 19:53:30 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 9 Nov 2007 12:53:30 -0600 Subject: [erlang-questions] slave nodes and ets Message-ID: When converting a program from using the SMP emulator to use slave nodes I noticed one thing that I can not figure out how or why it is working. - On the master node I create an ETS table. - The table id is included as an argument to a function that is called on the slave node - The slave node is able to insert data in the table on the master node. At first I thought that I just didn't execute on the slave nodes, but after adding a number of printouts that prints node() and self() and ets:i() and rpc:call(Master,ets,i,[]) I an convinced that it actually works. The documentation for slave does not mention anything about how ets behaves between master and slave nodes. Can someone please explain if - I am hallucinating? - is it supposed to work this way? - is it supported? - is it documented somewhere? /Anders From valentin@REDACTED Fri Nov 9 18:43:39 2007 From: valentin@REDACTED (Valentin Micic) Date: Fri, 9 Nov 2007 19:43:39 +0200 Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? References: <200711090735.lA97ZQkD085869@pluto.hedeland.org> <473459E8.8080301@gmail.com> Message-ID: <019701c822f8$1253e160$6401a8c0@moneymaker2> The way this worked with C/C++ was to first bind to an UDP port, using "normal" interface (ip address) and then add memebership via setsockopt system call. I think that something similar (undocumented as it might be) should be applicable for ERLANG too. Combining it wiht gen_udp:open, may create a wrong impression... I mean, you are actually receiving the traffic via the "real" interface after all. V. ----- Original Message ----- From: "Serge Aleynikov" To: "Per Hedeland" Cc: Sent: Friday, November 09, 2007 3:00 PM Subject: Re: [erlang-questions] clarify: SO_REUSEADDR under darwin? > Per Hedeland wrote: >> Actually no, it says that for multicast *addresses*, it is (there's no >> such thing as a multicast port:-). And this seems to be true on all of >> Linux, Darwin, and FreeBSD. I.e. you need to pass in an actual multicast >> address to bind to, instead of letting it default to the wildcard >> address - then reuseaddr is enough: >> >> mars 9> uname -sr >> FreeBSD 6.2-STABLE-200709 >> mars 10> erl >> Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] >> >> Eshell V5.5.5 (abort with ^G) >> 1> Port=4545. >> 4545 >> 2> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). >> {ok,#Port<0.96>} >> 3> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). >> {ok,#Port<0.97>} >> 4> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). >> {ok,#Port<0.98>} > > Is this the "right" way of joining a multicast group though? I've been > using the "undocumented" add_membership inet option to accomplish that > (though haven't tried it on anything other than Win, Linux, Solaris): > > gen_udp:open(Port, [{reuseaddr, true}, {add_membership, {Addr, > Interface}}]). > > I haven't checked the inet_drv, but does it actually check if in the > {ip, Addr} option Addr refers to a multicast range and sets the > IP_ADD_MEMBERSHIP option? > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From per@REDACTED Fri Nov 9 21:59:47 2007 From: per@REDACTED (Per Hedeland) Date: Fri, 9 Nov 2007 21:59:47 +0100 (CET) Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: <019701c822f8$1253e160$6401a8c0@moneymaker2> Message-ID: <200711092059.lA9KxlQx001544@pluto.hedeland.org> "Valentin Micic" wrote: > >The way this worked with C/C++ was to first bind to an UDP port, using >"normal" interface (ip address) and then add memebership via setsockopt >system call. I think that something similar (undocumented as it might be) >should be applicable for ERLANG too. Combining it wiht gen_udp:open, may >create a wrong impression... I mean, you are actually receiving the traffic >via the "real" interface after all. Well, the only thing I've ever done with multicast is sending them (from Erlang though), and that didn't require any membership (on Linux), so take this with a grain of salt, but the unicast address(es) configured on the physical interface(s) shouldn't be relevant. You could/would use it/them with add_membership to select interface(s) in case there are several possible (but at least FreeBSD and Linux allows for using the "interface index" instead), but binding the socket to one of those addresses seems pointless if not "wrong", even if it works. "Serge Aleynikov" wrote: > >> Per Hedeland wrote: >>> 4> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). >>> {ok,#Port<0.98>} >> >> Is this the "right" way of joining a multicast group though? No - but I didn't say that it was.:-) >> I've been >> using the "undocumented" add_membership inet option to accomplish that This seems to be right - and at least per FreeBSD ip(4), you can do add_membership multiple times, to join the group on multiple interfaces. Which could perhaps be another reason to do it via inet:setopts/2 afterwards instead, but I guess it will work to have multiple add_membership in the Options list for gen_udp:open/2 too. With C you will have to do one thing at a time.:-) >> (though haven't tried it on anything other than Win, Linux, Solaris): >> >> gen_udp:open(Port, [{reuseaddr, true}, {add_membership, {Addr, >> Interface}}]). (Where Interface is actually an IP address.) So this will bind to the wildcard address like the OP's original attempt, and won't work for multiple sockets on FreeBSD (probably *BSD) or Darwin. But combining them should be fine: gen_udp:open(Port, [{reuseaddr, true}, {ip, Addr}, {add_membership, {Addr, Interface}}]). >> I haven't checked the inet_drv, but does it actually check if in the >> {ip, Addr} option Addr refers to a multicast range and sets the >> IP_ADD_MEMBERSHIP option? No. --Per From paul-trapexit@REDACTED Fri Nov 9 23:21:17 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Fri, 9 Nov 2007 14:21:17 -0800 (PST) Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: <200711092059.lA9KxlQx001544@pluto.hedeland.org> References: <200711092059.lA9KxlQx001544@pluto.hedeland.org> Message-ID: Adding the { ip, Addr } option to gen_udp:open does make my application work under both darwin and linux and allows me to remove the ugly raw option that i introduced previously. Thanks guys! -- p p.z. There still seems to be a call for an soreuseport option for multiply binding unicast (to be ignored as appropriate). On Fri, 9 Nov 2007, Per Hedeland wrote: > "Valentin Micic" wrote: > > > >The way this worked with C/C++ was to first bind to an UDP port, using > >"normal" interface (ip address) and then add memebership via setsockopt > >system call. I think that something similar (undocumented as it might be) > >should be applicable for ERLANG too. Combining it wiht gen_udp:open, may > >create a wrong impression... I mean, you are actually receiving the traffic > >via the "real" interface after all. > > Well, the only thing I've ever done with multicast is sending them (from > Erlang though), and that didn't require any membership (on Linux), so > take this with a grain of salt, but the unicast address(es) configured > on the physical interface(s) shouldn't be relevant. You could/would use > it/them with add_membership to select interface(s) in case there are > several possible (but at least FreeBSD and Linux allows for using the > "interface index" instead), but binding the socket to one of those > addresses seems pointless if not "wrong", even if it works. > > "Serge Aleynikov" wrote: > > > >> Per Hedeland wrote: > >>> 4> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). > >>> {ok,#Port<0.98>} > >> > >> Is this the "right" way of joining a multicast group though? > > No - but I didn't say that it was.:-) > > >> I've been > >> using the "undocumented" add_membership inet option to accomplish that > > This seems to be right - and at least per FreeBSD ip(4), you can do > add_membership multiple times, to join the group on multiple interfaces. > Which could perhaps be another reason to do it via inet:setopts/2 > afterwards instead, but I guess it will work to have multiple > add_membership in the Options list for gen_udp:open/2 too. With C you > will have to do one thing at a time.:-) > > >> (though haven't tried it on anything other than Win, Linux, Solaris): > >> > >> gen_udp:open(Port, [{reuseaddr, true}, {add_membership, {Addr, > >> Interface}}]). > > (Where Interface is actually an IP address.) So this will bind to the > wildcard address like the OP's original attempt, and won't work for > multiple sockets on FreeBSD (probably *BSD) or Darwin. But combining > them should be fine: > > gen_udp:open(Port, [{reuseaddr, true}, {ip, Addr}, > {add_membership, {Addr, Interface}}]). > > >> I haven't checked the inet_drv, but does it actually check if in the > >> {ip, Addr} option Addr refers to a multicast range and sets the > >> IP_ADD_MEMBERSHIP option? > > No. > > --Per > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Optimism is an essential ingredient of innovation. How else can the individual favor change over security? -- Robert Noyce From rvirding@REDACTED Fri Nov 9 23:31:28 2007 From: rvirding@REDACTED (Robert Virding) Date: Fri, 9 Nov 2007 23:31:28 +0100 Subject: [erlang-questions] Scheme in Erlang? In-Reply-To: <47328306.4000607@gmail.com> References: <1194453077.4096.2.camel@metalman.lan> <47328306.4000607@gmail.com> Message-ID: <3dbc6d1c0711091431i7e91052bi5ed3b6416d853e4a@mail.gmail.com> What exactly are you after? Do you want a real standard Scheme or "just" a tutorial on how you could implement a Scheme subset in Erlang. Like the one for Haskell which you reference? N.B. They do not implement a full Scheme skipping over some the difficult bits to do in a non-destructive language, like vector-set! and string-set!. Or, perhaps, a Scheme like interface to Erlang. Robert On 08/11/2007, Berlin Brown wrote: > > This article on scheme in erlang is pretty popular? Does anyone know of > an scheme interpreter and tutorial for erlgang? > > > http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/evaluator2.html > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Sat Nov 10 00:36:40 2007 From: jeffm@REDACTED (jm) Date: Sat, 10 Nov 2007 10:36:40 +1100 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: <13668363.post@talk.nabble.com> References: <13668363.post@talk.nabble.com> Message-ID: <4734EF08.3050807@ghostgun.com> Zvi wrote: > I would like to see full real-life example of how to deploy OpenPoker on AWS > (EC2, S3) and full life-cycle management of such a system: > * initial deployment > * monitoring and management > * handling Mnesia persistence and distribution > * hot code upgrades > I second this. There's a bit out there now on developing in erlang, but very little on deployment. May be a section entitled "Moving from development to deployment" covering such things as tightening things down, automated start up of the various components/application, node startup, getting it to play nice with unix startup scripts. Actually, on that note I've been thinking it might be useful to have a node start up script and separate application[1] start up scripts for a System V style startup, ie, to would look something like starting erlang node red... ok starting erlang node blue... ok starting app1 on node red... ok starting app1 on node blue... ok starting app2 on node red... ok starting app3 on node blue.. ok etc. This might make erlang integrate better with unix (on other OSes) and not appear so isolated/strange to the everyday system admin which would in turn make addoption easier by lowering the learning curve from the admin's perspective. [1] By application here I mean a "macro-application" which may be made up of one or more erlang or "micro-" applications. Jeff. From per@REDACTED Sat Nov 10 00:57:14 2007 From: per@REDACTED (Per Hedeland) Date: Sat, 10 Nov 2007 00:57:14 +0100 (CET) Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: <01da01c8231c$e99df9c0$6401a8c0@moneymaker2> Message-ID: <200711092357.lA9NvERU005170@pluto.hedeland.org> "Valentin Micic" wrote: > >Not that it matters much but... a specific interface is important >considering what happens on a link-level. Certainly, but the interface's unicast address(es) aren't. And I don't think binding the socket to a particular unicast address will select the corresponding interface for multicast on a host that has multiple interfaces - that's one of the things add_membership is for. >I have experimented with this quite a long time ago, when Ethernet segment >just exactly that... I would be interested to know how does L-3 switch >handle multicasts these days? Is there any special configuration required by >a switch? I think "it varies". See e.g. http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/ipmulti.htm#wp1020671 and make a guess at what a low-end switch without a high-end one to back it up does (my guess is that it does "the default", i.e. treats multicast as broadcast). --Per From valentin@REDACTED Fri Nov 9 23:07:22 2007 From: valentin@REDACTED (Valentin Micic) Date: Sat, 10 Nov 2007 00:07:22 +0200 Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? References: <200711092059.lA9KxlQx001544@pluto.hedeland.org> Message-ID: <01da01c8231c$e99df9c0$6401a8c0@moneymaker2> Not that it matters much but... a specific interface is important considering what happens on a link-level. By default, there are two MAC addresses that are supported by link layer: broadcast (FF-FF-FF-FF-FF-FF), and unique MAC address of the network adapter. AFAIK, when one adds membership to a multicast group, this results in an association of additional link-level (MAC) address, something to the tune of FF-FF-E0-00-00-01 (for 224.0.0.1). Similarly, when packet is sent to multicast address, i.e. 224.0.0.1, destination MAC address is set to FF-FF-E0-00-00-01. I have experimented with this quite a long time ago, when Ethernet segment just exactly that... I would be interested to know how does L-3 switch handle multicasts these days? Is there any special configuration required by a switch? V. ----- Original Message ----- From: "Per Hedeland" To: ; Cc: Sent: Friday, November 09, 2007 10:59 PM Subject: Re: [erlang-questions] clarify: SO_REUSEADDR under darwin? > "Valentin Micic" wrote: >> >>The way this worked with C/C++ was to first bind to an UDP port, using >>"normal" interface (ip address) and then add memebership via setsockopt >>system call. I think that something similar (undocumented as it might be) >>should be applicable for ERLANG too. Combining it wiht gen_udp:open, may >>create a wrong impression... I mean, you are actually receiving the >>traffic >>via the "real" interface after all. > > Well, the only thing I've ever done with multicast is sending them (from > Erlang though), and that didn't require any membership (on Linux), so > take this with a grain of salt, but the unicast address(es) configured > on the physical interface(s) shouldn't be relevant. You could/would use > it/them with add_membership to select interface(s) in case there are > several possible (but at least FreeBSD and Linux allows for using the > "interface index" instead), but binding the socket to one of those > addresses seems pointless if not "wrong", even if it works. > > "Serge Aleynikov" wrote: >> >>> Per Hedeland wrote: >>>> 4> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]). >>>> {ok,#Port<0.98>} >>> >>> Is this the "right" way of joining a multicast group though? > > No - but I didn't say that it was.:-) > >>> I've been >>> using the "undocumented" add_membership inet option to accomplish that > > This seems to be right - and at least per FreeBSD ip(4), you can do > add_membership multiple times, to join the group on multiple interfaces. > Which could perhaps be another reason to do it via inet:setopts/2 > afterwards instead, but I guess it will work to have multiple > add_membership in the Options list for gen_udp:open/2 too. With C you > will have to do one thing at a time.:-) > >>> (though haven't tried it on anything other than Win, Linux, Solaris): >>> >>> gen_udp:open(Port, [{reuseaddr, true}, {add_membership, {Addr, >>> Interface}}]). > > (Where Interface is actually an IP address.) So this will bind to the > wildcard address like the OP's original attempt, and won't work for > multiple sockets on FreeBSD (probably *BSD) or Darwin. But combining > them should be fine: > > gen_udp:open(Port, [{reuseaddr, true}, {ip, Addr}, > {add_membership, {Addr, Interface}}]). > >>> I haven't checked the inet_drv, but does it actually check if in the >>> {ip, Addr} option Addr refers to a multicast range and sets the >>> IP_ADD_MEMBERSHIP option? > > No. > > --Per > From codewalkerjoe@REDACTED Sat Nov 10 00:20:45 2007 From: codewalkerjoe@REDACTED (joe lee) Date: Fri, 9 Nov 2007 18:20:45 -0500 Subject: [erlang-questions] Both yaws install by cean and on cygwin failing In-Reply-To: <50ec7a2e0711080429h125a51f8ge4e5109e6bc17bd4@mail.gmail.com> References: <50ec7a2e0711080429h125a51f8ge4e5109e6bc17bd4@mail.gmail.com> Message-ID: <50ec7a2e0711091520k64837ac8l8734c5e43e644bf1@mail.gmail.com> I fixed the make by following the blog: http://bloggablea.wordpress.com/2007/04/21/building-yaws-for-windows/ Now, when I do "make install", I get extra "/" in front, like this: //usr/local/yaws. I am not sure where this extra forward slash is coming from. Anyone knows why you get the extra /? ./configure --prefix=/usr/local/yaws make make install "make install" problem: set -e ; \ for d in c_src src man www/shopingcart www/code doc scripts ; do \ if [ -f $d/Makefile ]; then ( cd $d && make install ) || exit 1 ; fi ; \ done make[1]: Entering directory `/home/joe/apps/yaws-1.73/c_src' /usr/bin/install -c -d //usr/local/yaws/lib/yaws/priv/lib /usr/bin/install: cannot create directory `//usr': No such host or network path make[1]: *** [install] Error 1 make[1]: Leaving directory `/home/joe/apps/yaws-1.73/c_src' make: *** [install] Error 1 thnx, joe On Nov 8, 2007 7:29 AM, joe lee wrote: > Yaws install in cygwin is failing on make: > > ./configure --prefix=/usr/local/yaws > > When I tried doing "make", I am getting the following error: > > if [ ! -z "" ]; then \ > echo > charset.def; \ > else rm charset.def 2> /dev/null; touch charset.def; fi > /cygdrive/i/Program Files/erl5.5.5/bin/erl -noshell -pa ../ebin -s mime_type_c > compile > make[1]: /cygdrive/i/Program: Command not found > make[1]: *** [mime_types.erl] Error 127 > make[1]: Leaving directory `/home/joe/apps/yaws-1.73/src' > make: *** [all] Error 1 > > > I also tried to install yaws through cean:install(yaws), I get an error as: > > 2> cean:install(yaws). > error: yaws not found in download > error > > I have erlang 5.5.5 OTP R11B and have it installed on windows xp at > i:\Program Files\erl5.5.5 > > thanks, > joe > From yinso.chen@REDACTED Sat Nov 10 03:45:08 2007 From: yinso.chen@REDACTED (YC) Date: Fri, 9 Nov 2007 18:45:08 -0800 Subject: [erlang-questions] design: singleton application or multiple instance application? Message-ID: <779bf2730711091845v1e5a1f7dia5202b31ec231194@mail.gmail.com> Hi all - I have a gen_server that reads from a list of definition files containing erlang terms and hold it in memory to serve other processes needing the data. Aside from a periodic refresh when the underlying data changes, the only thing the server does is to serve the data read from files. There will be multiple processes accessing this gen_server concurrently as they need the data @ different times. My question is - would a singleton suffice for the concurrent access? Or do I need to startup multiple instances? What's the best practice for server to client ratio for such scenario? Thanks for any insights, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: From francis.norton@REDACTED Sat Nov 10 09:12:30 2007 From: francis.norton@REDACTED (Francis Norton) Date: Sat, 10 Nov 2007 08:12:30 +0000 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: <24162acd0711100012p43a6bbfl432498ed7f16b1a0@mail.gmail.com> Hi Joel, On 09/11/2007, Joel Reymont wrote: > > - Storing data in Mnesia I think your compliance and security officer would like to have a replicated copy of the database that can be used to data-mine for suspicious patterns of play. As live as possible, but without complex queries slowing down the live DB. Francis. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Nov 10 12:19:48 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 10 Nov 2007 12:19:48 +0100 Subject: [erlang-questions] program: custom output filters in the shell Message-ID: <8209f740711100319l49771f20v96a65fb07772a700@mail.gmail.com> Richard's presentation of the array module at the EUC inspired me to try to address one of the notable drawbacks of using modules like dict, gb_trees, xmerl, et al: when you get output in the shell, they are not pretty to look at. But the shell can be told to recognize records, and pretty-print them. Why can't I tell it how to recognize other data structures as well? I include a hack of io_lib_pretty.erl and shell.erl that makes it so. It is, as far as I can tell, backwards compatible, but allows you to provide a fun along these lines: fun(Term) -> {custom,Tag,Recurse,Output} | no where Tag = atom() Recurse = boolean() Output = any() Recurse tells the pretty-printer whether to apply the filter fun recursively to Output as well. (I think it could rather easily be extended to also support e.g. {pre_formatted, Tag, IoList}, but I didn't do that.) New shell commands: fa(Tag, Fun) - registers a filter fun fl() - lists filter funs fr(Tag) - removes a filter fun Example: 1> dict:from_list([{N,a} || N <- lists:seq(1,5)]). {dict,5, 16, 16, 8, 80, 48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, {{[], [[3|a]], [], [], [], [], [[2|a]], [[5|a]], [], [], [], [[1|a]], [[4|a]], [], [], []}}} 2> rr(code:which(dict)). [dict] 3> fa(dict,fun(#dict{}=D) -> {custom,dict,true,dict:dict_to_list(D)};(_) -> no end). true 4> v(1). <|dict:[{3,a},{2,a},{5,a},{1,a},{4,a}]|> 5> xmerl_scan:string("Example doc

chapter 1

some text

chapter 2

some more text

"). {{xmlElement,doc, ....}} % I'll spare you the agony 6> rr("/usr/local/lib/erlang/lib/xmerl-1.1.2/include/xmerl.hrl"). [xmerl_event,...] 7> fa(xmerl,fun(#xmlElement{}=E) -> {custom,xml,true,xmerl_lib:simplify_element(E)}; (_) -> no end). true 8> v(5). {<|xml:{doc,[], [{title,[],["Example doc"]}, {h1,[],["chapter 1"]}, {p,[],["some text"]}, {h1,[],["chapter 2"]}, {p,[],["some more text"]}]}|>, []} BR, Ulf W -------------- next part -------------- A non-text attachment was scrubbed... Name: filter_funs.tgz Type: application/x-gzip Size: 15198 bytes Desc: not available URL: From matthew.reilly@REDACTED Thu Nov 8 06:03:16 2007 From: matthew.reilly@REDACTED (Matthew Reilly) Date: Wed, 07 Nov 2007 21:03:16 -0800 Subject: [erlang-questions] clarify: SO_REUSEADDR under darwin? In-Reply-To: References: Message-ID: <47329894.9040600@sipphone.com> Is this on Leopard? Leopard changed Darwin's behavior (a bug?) w/ respect to UDP ports and bind(). In some cases it returns EADDRINUSE when binding a UDP ports under certain conditions. This issue has caused many apps that use reSIProcate (an open source SIP library) to fail under Leopard. See e.g. http://list.resiprocate.org/archive/resiprocate-devel/msg06360.html (Note: that link says "disconnect a UDP port", but reSIProcate implemented that by binding the UDP port to 0.0.0.0:0, so it was a bind() issue) Paul Mineiro wrote: > hi. > > i've attached a very short erlang program which tries to open two udp > ports with reuseaddr option. it works under linux but fails under darwin. > > is this a known problem? > > i can see the following in the ktrace: > > -------- > % ktrace -id -t c erl -eval 'test:test ()' -noshell -noinput -s init stop > -------- > > the kdump.out contains: > > -------- > 28042 beam CALL socket(0x2,0x2,0x11) > 28042 beam RET socket 9 > 28042 beam CALL fcntl(0x9,0x3,0) > 28042 beam RET fcntl 2 > 28042 beam CALL fcntl(0x9,0x4,0x6) > 28042 beam RET fcntl 0 > 28042 beam CALL setsockopt(0x9,0xffff,0x1002,0xbfffe1fc,0x4) > 28042 beam RET setsockopt 0 > 28042 beam CALL setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) > 28042 beam RET setsockopt 0 > 28042 beam CALL bind(0x9,0xbfffe0e0,0x10) > 28042 beam RET bind -1 errno 48 Address already in use > -------- > > setsockopt(0x9,0xffff,0x4,0xbfffe1fc,0x4) looks right: > > -------- > % grep -e SO_REUSEADDR -e SOL_SOCKET /usr/include/sys/socket.h > #define SO_REUSEADDR 0x0004 /* allow local address reuse */ > #define SOL_SOCKET 0xffff /* options for socket level */ > -------- > > the only thing i can't verify is that 0xbfffe1fc is a pointer to one. > > thanks, > > -- p > > % dpkg -s erlang-otp | grep Version > Version: 11b-5-1 > % erl -version > Erlang (ASYNC_THREADS) (BEAM) emulator version 5.5.5 > > Optimism is an essential ingredient of innovation. How else can the > individual favor change over security? > > -- Robert Noyce > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Sat Nov 10 14:25:46 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 10 Nov 2007 13:25:46 +0000 Subject: [erlang-questions] EUC '07 papers and slides Message-ID: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com> Are they available yet? I'm particularly interested in the non-destructive array updates. Thanks, Joel -- http://wagerlabs.com From klacke@REDACTED Sat Nov 10 16:43:39 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Sat, 10 Nov 2007 16:43:39 +0100 Subject: [erlang-questions] how: can I get live keyboard input in the Erlang shell? In-Reply-To: <9b08084c0710261102v2775f288rb598afc706dc4edc@mail.gmail.com> References: <9b08084c0710261102v2775f288rb598afc706dc4edc@mail.gmail.com> Message-ID: <4735D1AB.1010207@hyber.org> Joe Armstrong wrote: > There we go, I'm using my subject line tagging > > Once upon a long time ago I knew how to do this (I wrote the code) - > but it was a long time ago > and the code has probably been rewritten many times. Is there a > defined way of doing this? > > It would be nice to turn echoing off (say for inputting passwords) and > respond to *every* character. I did some work on this quite a few years ago. It's still in jungerl, and it's an interface to slang http://www.s-lang.org/ /klacke From Lennart.Ohman@REDACTED Sat Nov 10 21:05:26 2007 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Sat, 10 Nov 2007 21:05:26 +0100 Subject: [erlang-questions] Sweater found at EUC07 ErlLounge Message-ID: If you attended EUC07 ErlLounge last Thursday and missing your brown Polo sweater, it has been found. Best Regards Lennart --------------------------------------------------------------------------- Lennart ?hman phone : +46-8-587 623 27 Sj?land & Thyselius Telecom AB cellular: +46-70-552 6735 H?lsingegatan 43, 10th floor fax : +46-8-667 8230 SE-113 31 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From joelr1@REDACTED Sun Nov 11 02:58:39 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 11 Nov 2007 01:58:39 +0000 Subject: [erlang-questions] Lets build a stock exchange! Message-ID: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> http://wagerlabs.com/archives/129.html I want you to start an Amazon EC2 instance and join the "Hardcore Erlang" cluster. I want to build the biggest Erlang cluster in the world and push Erlang to its limits. I want to build a stock exchange and show you how to do it. And of course I want to write a book about it. The focus of the book is not changing, it's still fault-tolerance, scalability, distribution, etc. What's changing is the software the book is built around. Reading about how to build a stock exchange sure as hell beats reading about a poker server. What do you think? Thanks, Joel -- http://wagerlabs.com From yinso.chen@REDACTED Sun Nov 11 03:24:17 2007 From: yinso.chen@REDACTED (YC) Date: Sat, 10 Nov 2007 18:24:17 -0800 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> Message-ID: <779bf2730711101824j29efd455q6c85a0ced24563ca@mail.gmail.com> Cool idea, Joel! Yes - agreed that a stock exchange is a lot more interesting than a poker server (but poker isn't bad either). Is the goal to have a truly functional stock exchange that interfaces with other stock exchanges? Or one that has the capability but not the hook up? yc On Nov 10, 2007 5:58 PM, Joel Reymont wrote: > http://wagerlabs.com/archives/129.html > > I want you to start an Amazon EC2 instance and join the "Hardcore > Erlang" cluster. > > I want to build the biggest Erlang cluster in the world and push > Erlang to its limits. > > I want to build a stock exchange and show you how to do it. > > And of course I want to write a book about it. > > The focus of the book is not changing, it's still fault-tolerance, > scalability, distribution, etc. What's changing is the software the > book is built around. Reading about how to build a stock exchange sure > as hell beats reading about a poker server. > > What do you think? > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From headspin@REDACTED Sun Nov 11 10:19:58 2007 From: headspin@REDACTED (dda) Date: Sun, 11 Nov 2007 17:19:58 +0800 Subject: [erlang-questions] erlang and Kara In-Reply-To: <13654990.post@talk.nabble.com> References: <47319272.2000301@ericsson.com> <13654990.post@talk.nabble.com> Message-ID: In Korean ???? mudang b?lle, "witch/shaman insect". -- dda On Nov 9, 2007 4:20 AM, Zvi wrote: > > In Hebrew: ??? ??? ???? > "Parat Moshe Rabenu" > Literally: "Our Teacher Moses' Cow" ;-) > > Zvi From Dmitri.Girenko@REDACTED Sun Nov 11 10:45:28 2007 From: Dmitri.Girenko@REDACTED (Dmitri Girenko) Date: Sun, 11 Nov 2007 11:45:28 +0200 Subject: [erlang-questions] sinan not working Message-ID: <697074A35ED91748882E3850BDCE295E06C580@leenu.akumiitti.net> Hi all, I've just tried to set up faxien and sinan. Faxien was ok, but sinan does not work. Both installed by root into /usr/local/erlware/bin I get the following error: ~$ sinan gen {error_logger,{{2007,11,11},{11,31,40}},"No build config found!!~n",[]} {error_logger,{{2007,11,11},{11,31,40}},"unexpected error ~p: ~p~n",[no_build_config,[{sin_engine,handle_build_config,2},{sin_engine,start_run,3},{sin_engine,run_engine,3},{sin_engine,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]]} {error_logger,{{2007,11,11},{11,31,40}},"run complete~n",[]} looks like it's missing _build.cfg file, but I just want to create a new OTP project from scratch.. What did I do wrong? BR Dmitri From joelr1@REDACTED Sun Nov 11 11:24:34 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 11 Nov 2007 10:24:34 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <779bf2730711101824j29efd455q6c85a0ced24563ca@mail.gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <779bf2730711101824j29efd455q6c85a0ced24563ca@mail.gmail.com> Message-ID: On Nov 11, 2007, at 2:24 AM, YC wrote: > Is the goal to have a truly functional stock exchange that > interfaces with > other stock exchanges? Or one that has the capability but not the > hook up? I'm writing a book first and foremost so I'll probably leave the hook up for later. It will depend on the amount of material in the book and my time constraints. Thanks, Joel -- http://wagerlabs.com From francis.norton@REDACTED Sun Nov 11 11:54:17 2007 From: francis.norton@REDACTED (Francis Norton) Date: Sun, 11 Nov 2007 10:54:17 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> Message-ID: <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> The EC2 idea is interesting - I think the poker site would demonstrate Erlang ideas just as well as a stock exchange, but an application which demonstrates Erlang doing what it does best, over an interesting new feature of the internet landscape like EC2 would certainly attract my attention. Francis. On 11/11/2007, Joel Reymont wrote: > > http://wagerlabs.com/archives/129.html > > I want you to start an Amazon EC2 instance and join the "Hardcore > Erlang" cluster. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Sun Nov 11 20:54:55 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sun, 11 Nov 2007 13:54:55 -0600 Subject: [erlang-questions] how: mnesia: id/generator in a cluster In-Reply-To: Message of "Wed, 07 Nov 2007 09:31:11 +0100." <473177CF.7020506@ericsson.com> Message-ID: <200711111954.lABJsuwE004201@snookles.snookles.com> >>>>> "uw" == Ulf Wiger (TN/EAB) writes: uw> I once wrote the following code, which I've never used in any real uw> product. The idea is that you have a counter per erlang node in uw> your cluster, and then assign each node an index; the combination uw> of node index and counter value becomes your unique id (unique to uw> your cluster, that is). I've used a similar scheme, to great success. A single Mnesia key/value pair keeps track of the next unused value. Any counter client that wants exclusive rights to a range of values above that counter, say C through C + 999, will use a Mnesia transaction simply increment the key's value by 1000. (*Not* using the dirty counter mechanism.) Then that client can use the values C..(C+999) in any way it sees fit, without touching Mnesia again. "Gaps" in counter assignment aren't a problem for this app, and strictly monotonically increasing counters weren't required. Uniqueness and speed were. If strictly monotonically increasing counters aren't necessary, do not go to the effort of trying to make them. Laziness is good. :-) -Scott From chsu79@REDACTED Sun Nov 11 21:43:18 2007 From: chsu79@REDACTED (Christian S) Date: Sun, 11 Nov 2007 21:43:18 +0100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: Anyone know a book on technical requirements that brokers put on stock exchanges? Order matching procedures, what information do tax offices want, typical features as in stop-loss rules... Oh, and yes. A stock exchange is cooler than poker. From francesco@REDACTED Sun Nov 11 21:58:31 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Sun, 11 Nov 2007 20:58:31 +0000 Subject: [erlang-questions] EUC 2007 oversubscribed In-Reply-To: <015001c81a40$729e8680$6401a8c0@moneymaker2> References: <4d08db370710280021ja85fcd0s5ac8bba4c4d2fd91@mail.gmail.com><992686.15039.qm@web38809.mail.mud.yahoo.com><4d08db370710280732g3c784a9bnc0873a0a8c37b155@mail.gmail.com><006a01c81986$1a359390$e751d854@Dell><811f2f1c0710281141m4a69e6ddge4f94881b986e757@mail.gmail.com><4724DB0A.9000903@diit.unict.it> <015001c81a40$729e8680$6401a8c0@moneymaker2> Message-ID: <47376CF7.9070107@erlang-consulting.com> We've wanted to keep a low profile about it until after EUC... We are now glad to announce that Erlang Training and Consulting together with UK based Skillsmatter have already reserved a venue in London on the 26th and 27th of June 2008 for an Erlang conference. We are going to call it the Erlang Exchange. Many excellent speakers, tutorials and workshops have already been booked; they will be complemented by many more. Stay tuned, as we will soon be coming out with more information very soon. Francesco -- http://www.erlang-consulsing.com Valentin Micic wrote: > How about South Africa? You could enjoy nice weather, food & wine too, but > you can get mugged any time of the day, as an added bonus -- surely nothing > can beat that! > > V. > > ----- Original Message ----- > From: "dda" > To: > Sent: Monday, October 29, 2007 3:24 PM > Subject: Re: [erlang-questions] EUC 2007 oversubscribed > > > >> Well if weather is a concern, you wimps ;-), Hong Kong is an >> appropriate venue then! It's 26? C today, at 21:22. There *are* >> appropriate conference facilities, good food, and proselytising >> outside the Western world would do Erlang some good! >> >> -- >> Didier >> >> On 10/29/07, Corrado Santoro wrote: >> >>> Michael Campbell wrote: >>> >>>> There are some really nice convention halls in Atlanta GA and Orlando >>>> FL... =) >>>> >>> ... but the weather in Sicily, in November, is still very nice... >>> (Francesco knows)... and we have very huge halls too ;-) >>> >>> --Corrado >>> >>> -- >>> ================================================================== >>> Eng. Corrado Santoro, Ph.D. >>> University of Catania - ITALY - Engineering Faculty >>> >>> Tel: +39 095 7382380 VoIP: sip:7035@REDACTED >>> >>> Personal Home Page: http://www.diit.unict.it/users/csanto >>> NUXI Home Page: http://nuxi.diit.unict.it >>> ================================================================== >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From torben.lehoff@REDACTED Sun Nov 11 22:10:22 2007 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Sun, 11 Nov 2007 22:10:22 +0100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: On Nov 11, 2007 9:43 PM, Christian S wrote: > Anyone know a book on technical requirements that brokers put on stock > exchanges? Order matching procedures, what information do tax offices > want, typical features as in stop-loss rules... > > Oh, and yes. A stock exchange is cooler than poker. It may very well be the case that a stock exchange is cooler than poker, but I think that the poker server has some interesting aspects that could inspire others. E.g., the dynamic allocation of a server to run a new table as well as the handling of the messages between the players is similar in nature to some of the challenges there is in telecom with regards to group calls and where to "host" the call. Furthermore, I would rather see a well-written book on hard-core Erlang hit its window of opportunity than see the whole thing turn into "let's make the coolest application that will never run in real life just in order to spice up a programming book"-kind of projects. A well written book with a clear example of usage including discussions about where the general ideas can be applied is what I would bet my money on. If a potential buyer of the hard-core Erlang book cannot abstract from the specific case study used to teach the principles then it is time to utter "Joe, We have a problem!" ;-) Cheers, Torben P.S. My first reaction to the stock exchange idea was "Wow!! Cool!!!", but then my analytical side issued a kill to that process for the reason listed above. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sun Nov 11 22:45:32 2007 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 11 Nov 2007 22:45:32 +0100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> This sounds like a great idea. I have no idea whether it would succeed or fail - if it succeeds then (gulp) If it fails the interesting thing is not that it failed but WHY it failed. If things fail and we know why we can do research and fix things. It is the existence of things that don't work that stimulates software research and development. Interesting problems are very difficult to think up - asking the right question is often the really difficult bit - once asked lots of brains can try and find the solution. Joels suggesting poses a difficult question - great - let's try and answer it. If Joel can in any way structure the problem then there are loads of us that can try and write the individual bits. Breaking the system is great - a program that breaks the compiler is far better than 100 that work. A program that breaks mnesia is far better than 1000 that work. If this breaks Erlang great - we can fix it and make an even better system. Breaking stuff is easy - the interesting point is *where* does the system break! /Joe Armstrong On Nov 11, 2007 10:10 PM, Torben Hoffmann wrote: > > > > On Nov 11, 2007 9:43 PM, Christian S wrote: > > Anyone know a book on technical requirements that brokers put on stock > > exchanges? Order matching procedures, what information do tax offices > > want, typical features as in stop-loss rules... > > > > Oh, and yes. A stock exchange is cooler than poker. > > It may very well be the case that a stock exchange is cooler than poker, but > I think that the poker server has some interesting aspects that could > inspire others. E.g., the dynamic allocation of a server to run a new table > as well as the handling of the messages between the players is similar in > nature to some of the challenges there is in telecom with regards to group > calls and where to "host" the call. > > Furthermore, I would rather see a well-written book on hard-core Erlang hit > its window of opportunity than see the whole thing turn into "let's make the > coolest application that will never run in real life just in order to spice > up a programming book"-kind of projects. > > A well written book with a clear example of usage including discussions > about where the general ideas can be applied is what I would bet my money > on. If a potential buyer of the hard-core Erlang book cannot abstract from > the specific case study used to teach the principles then it is time to > utter "Joe, We have a problem!" ;-) > > Cheers, > Torben > > P.S. My first reaction to the stock exchange idea was "Wow!! Cool!!!", but > then my analytical side issued a kill to that process for the reason listed > above. > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jeffm@REDACTED Mon Nov 12 00:14:29 2007 From: jeffm@REDACTED (jm) Date: Mon, 12 Nov 2007 10:14:29 +1100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: <47378CD5.9020908@ghostgun.com> Christian S wrote: > Anyone know a book on technical requirements that brokers put on stock > exchanges? Order matching procedures, what information do tax offices > want, typical features as in stop-loss rules... > > Oh, and yes. A stock exchange is cooler than poker. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions Was curious so when looking for info on the Australian Stock Exchange (ASX). Try https://www.asxonline.com/intradoc-cgi/idcplg?IdcService=ASX_COLLECTION_DISPLAY&hasCollectionID=true&dCollectionID=10&SortField=dInDate&SortOrder=Desc or http://www.asxonline.com -> Participant (top menu) -> Library (top menu) -> Manuals (in list of item) Some other items listed at this level require a login. I can't find the rules and regulations governing trading, but there is discussion of it in a general sense floating around somewhere on the net which would be accurate enough for the job at hand as the idea is to show case erlang and not to provide a realistic simulation of a real stock exchange. For this to be a viable demostration project, you could ignore most of the trading rules and concentrate on * the interface to the traders (I think that can be found in the above docs) * the phases of the market (closed, pre-open, open, pre-close, etc) * order matching * order tracking * reporting * outstanding orders and market depth * etc As far as the actual trading rules goes you could write your own and show how to make it "easy" to modify the system to change the systems trading rules without taking the system down (hot code updates) or needing a domain specific rule language which would be the port of first call in many another language. This looks to be a much better project than a poker site as this could easily be modified into any type of clearing house site. This type of project is more likely to be of interest to main stream business as they can see the direct applicability to their situation where as a poker site may not have the same impact as intended. Jeff. From michael.regen@REDACTED Mon Nov 12 00:33:03 2007 From: michael.regen@REDACTED (Michael Regen) Date: Mon, 12 Nov 2007 00:33:03 +0100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> Message-ID: <9b59d0270711111533p2db16a44md9f8a8452c506566@mail.gmail.com> What an interesting topic! Just my humble two cents: On Nov 11, 2007 2:58 AM, Joel Reymont wrote: > I want to build the biggest Erlang cluster in the world and push > Erlang to its limits. > > I want to build a stock exchange and show you how to do it. This means either a lot of money and/or people are needed. So, how do we motivate people to spend money or time? I guess it will be easier to make people spend time than money. Choosing the right project will affect very much how many people will join and whether they need to spend money or time. Building a stock exchange is an incredibly interesting aim from the technical point of view and could certainly push Erlang to its limits - if they exist :). But if you want to build the biggest Erlang cluster than you need something which is actually useable in real life for at least some time. That would also be a much bigger benefit for the people to join compared to just build a showcase example. And here I'm not sure how big financial and legal hurdles will be to actually operate a stock exchange. Does anybody have some insight in this topic? Just a half-baked idea and my empty brain was not able to figure out a practical application so far. Anyway, maybe just think about it for a short while and forget it soon if it leads to nothing: What about some kind of socially desirable project. E.g. something one or better more NGOs can use. Something that motivates people to join because they can feel good if they contribute? Feel better than if they just contributed code to the public. Sometimes consulting companies compete hard for poor paid contracts with NGOs just because it will be great PR for them. So there might also be a bigger chance to push Erlang. But I have to agree, this idea is not worth much without an application. And of course, building something which is usable also means responsibility... So I hope this mail only drives people away from the stock exchange idea if someone finds a good application soon. Cheers, Michael From yinso.chen@REDACTED Mon Nov 12 01:10:22 2007 From: yinso.chen@REDACTED (YC) Date: Sun, 11 Nov 2007 16:10:22 -0800 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: <779bf2730711111610k7c438dbex7d00f6f7d15271f@mail.gmail.com> Agreed that cool factor shouldn't be it for a book (since Joel confirmed that book is the first priority), but there probably is an element of marketing there :) IMO the relevance depends on the depth and intimacy the system is explained and covered, and whether author places emphasis on knowledge transfer. I never find much use of the abundant trivial bank examples, and even the shoucast example popularized by Practical Lisp etc. On the other hand, books such as Norvig's PAIP covers examples that are not in common use, but because the author focuses so much more on teaching the subject matter and how to use Lisp to solve them, I found myself walking learning something without ever using the example. Without getting to that level of detail, then best examples are relevant ones - i.e. examples that can be immediately of use by simply copy and paste. To do that would mean narrowing the target audience, but that might actually be a good thing. If going with a relevant angle - then a lot of people today are working on web-based applications and database related applications, so if the example solves at least some of the web and database problems than it won't hurt ;) My 2 cents, yc On Nov 11, 2007 1:10 PM, Torben Hoffmann wrote: > > It may very well be the case that a stock exchange is cooler than poker, > but I think that the poker server has some interesting aspects that could > inspire others. E.g., the dynamic allocation of a server to run a new > table as well as the handling of the messages between the players is similar > in nature to some of the challenges there is in telecom with regards to > group calls and where to "host" the call. > > Furthermore, I would rather see a well-written book on hard-core Erlang > hit its window of opportunity than see the whole thing turn into "let's make > the coolest application that will never run in real life just in order to > spice up a programming book"-kind of projects. > > A well written book with a clear example of usage including discussions > about where the general ideas can be applied is what I would bet my money > on. If a potential buyer of the hard-core Erlang book cannot abstract from > the specific case study used to teach the principles then it is time to > utter "Joe, We have a problem!" ;-) > > Cheers, > Torben > > P.S. My first reaction to the stock exchange idea was "Wow!! Cool!!!", but > then my analytical side issued a kill to that process for the reason listed > above. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From KONGA@REDACTED Mon Nov 12 00:23:14 2007 From: KONGA@REDACTED (Anthony Kong) Date: Mon, 12 Nov 2007 10:23:14 +1100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: <47382987.664A.00DD.0@stgeorge.com.au> Just to share some thought... I think there is no book that can teach one to build a functional stock exchange because of the nature of the problem. It is like those university courses that teaching search technology. When the professors of those courses left the ivory tower and joined Google, they soon realised that everything they taught have been considered/implemented by Google, and Google has a lot more cool thing going on... Reason: Google is the search engine that's being *actively* used, and googlers have to deal with real user requirements/system constraints. These are tactile knowlegde. I am more familiar with Hong Kong Stock exchange. Here is an overview of their system (AMS/3): http://www.hkex.com.hk/infra/ams3/AMS3_OV.pdf It is a pretty simple and easy to read document, and basically cover the basic stuff people wants from an exchange. (more info here http://www.hkex.com.hk/infra/ams3/ams3.htm) A few points I can highlight are: * OG (open gateway): It is a must-have feature because it allows program trading. * Modeling/Design issue: HKSE offers different order type ( such as Limit Order, At action order...) and producs (Equity, ETF, Options, Futures...) etc. It may well be an interesting design exercise. Normally in OO language we can use inheritance to implements these various order/product types. What is the best way to do it in functional language like erlang? * Order Automatching/Auction (Performance issue): some exchanges had been overwhelmed by spike of trade volumes in the past ('Black Friday' for example). It will be very interesting to see how it can be addressed by erlang+EC2 Another interesting info is the "Technical Infrastructure" section: * "AMS/3 is built on Tandem NonStop systems/NotStop kernel.". Erlang can beat Tandem, right? :-) But I think people here may want to model NYSE. After all more people are familiar with NYSE's operations, and the final implementation will be more attractive to general public out there. On the other hand, NYSE is more complex and we have to cover a lot more in term of requirements. (e.g. OTC products) So, I am all for such undertaking. I guess a question back to Joel: how do you manage the scope? It is really no easy task. Once you have a relatively stable scope, the programming part will be 'easy'. Cheers, Anthony >>> "Christian S" 12/11/2007 7:43 am >>> Anyone know a book on technical requirements that brokers put on stock exchanges? Order matching procedures, what information do tax offices want, typical features as in stop-loss rules... Oh, and yes. A stock exchange is cooler than poker. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions ********************************************************************** ***** IMPORTANT INFORMATION ***** This document should be read only by those persons to whom it is addressed and its content is not intended for use by any other persons. If you have received this message in error, please notify us immediately. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. St George Bank Limited AFSL 240997, Advance Asset Management Limited AFSL 240902, St George Life Limited AFSL 240900, ASGARD Capital Management Limited AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. ********************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmorton@REDACTED Mon Nov 12 00:29:12 2007 From: dmorton@REDACTED (Damien Morton) Date: Sun, 11 Nov 2007 18:29:12 -0500 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <47378CD5.9020908@ghostgun.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <47378CD5.9020908@ghostgun.com> Message-ID: <47379048.9060603@bitfurnace.com> A key aspect of any next generation trading system will be the incorporation of streaming-database and continuous-query capabilities into the underlying message bus. On 11/11/2007 6:14 PM, jm wrote: > Christian S wrote: > >> Anyone know a book on technical requirements that brokers put on stock >> exchanges? Order matching procedures, what information do tax offices >> want, typical features as in stop-loss rules... >> >> Oh, and yes. A stock exchange is cooler than poker. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > Was curious so when looking for info on the Australian Stock Exchange > (ASX). Try > > https://www.asxonline.com/intradoc-cgi/idcplg?IdcService=ASX_COLLECTION_DISPLAY&hasCollectionID=true&dCollectionID=10&SortField=dInDate&SortOrder=Desc > > or http://www.asxonline.com > > -> Participant (top menu) > -> Library (top menu) > -> Manuals (in list of item) > > Some other items listed at this level require a login. > > I can't find the rules and regulations governing trading, but there is > discussion of it in a general sense floating around somewhere on the net > which would be accurate enough for the job at hand as the idea is to > show case erlang and not to provide a realistic simulation of a real > stock exchange. For this to be a viable demostration project, you could > ignore most of the trading rules and concentrate on > > * the interface to the traders (I think that can be found in the above docs) > * the phases of the market (closed, pre-open, open, pre-close, etc) > * order matching > * order tracking > * reporting > * outstanding orders and market depth > * etc > > > As far as the actual trading rules goes you could write your own and > show how to make it "easy" to modify the system to change the systems > trading rules without taking the system down (hot code updates) or > needing a domain specific rule language which would be the port of first > call in many another language. > > This looks to be a much better project than a poker site as this could > easily be modified into any type of clearing house site. This type of > project is more likely to be of interest to main stream business as they > can see the direct applicability to their situation where as a poker > site may not have the same impact as intended. > > Jeff. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From joelr1@REDACTED Mon Nov 12 01:58:20 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 00:58:20 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: Torben, On Nov 11, 2007, at 9:10 PM, Torben Hoffmann wrote: > It may very well be the case that a stock exchange is cooler than > poker, but > I think that the poker server has some interesting aspects that could > inspire others. I can always describe the architecture of the poker server in a series of blog articles. > Furthermore, I would rather see a well-written book on hard-core > Erlang hit > its window of opportunity than see the whole thing turn into "let's > make the > coolest application that will never run in real life just in order > to spice > up a programming book"-kind of projects. I firmly plan to hit my window of opportunity, that's my priority #1. I may have confused a lot of people by forgetting to mention that I don't plan to build a business. I do plan to write a book, one with examples based around software. I'm passionate about all things trading and I'm not passionate about poker, so I chose to build and describe stock exchange software instead. > A well written book with a clear example of usage including > discussions > about where the general ideas can be applied is what I would bet my > money > on. It will be done! Thanks, Joel -- http://wagerlabs.com From xushiweizh@REDACTED Mon Nov 12 02:02:04 2007 From: xushiweizh@REDACTED (shiwei xu) Date: Sun, 11 Nov 2007 17:02:04 -0800 Subject: [erlang-questions] EUC '07 papers and slides In-Reply-To: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com> References: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com> Message-ID: http://www.erlang.se/workshop/2007/ On 11/10/07, Joel Reymont wrote: > > Are they available yet? > > I'm particularly interested in the non-destructive array updates. > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Mon Nov 12 02:08:24 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 01:08:24 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <47378CD5.9020908@ghostgun.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <47378CD5.9020908@ghostgun.com> Message-ID: <51E3024A-B9CF-4B34-A62E-B6246536EDFE@gmail.com> On Nov 11, 2007, at 11:14 PM, jm wrote: > As far as the actual trading rules goes you could write your own and > show how to make it "easy" to modify the system to change the systems > trading rules without taking the system down (hot code updates) Great point and excellent ASX pointers as well! > This looks to be a much better project than a poker site as this could > easily be modified into any type of clearing house site. I doubt the world needs another stock exchange. Everybody knows what a stock exchange is, though, and the concept could be extended to other types of "prediction markets". Thanks, Joel -- http://wagerlabs.com From joelr1@REDACTED Mon Nov 12 02:05:21 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 01:05:21 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> Message-ID: <2D64EFEE-A7C1-4931-9CB8-65681669CAD3@gmail.com> Joe, On Nov 11, 2007, at 9:45 PM, Joe Armstrong wrote: > I have no idea whether it would succeed or fail - if it succeeds > then (gulp) > > If it fails the interesting thing is not that it failed but WHY it > failed. I plan to either succeed or fail spectacularly. Either way there will be a great lesson to learn. > If Joel can in any way structure the problem then there are loads of > us that can try and > write the individual bits. I still haven't figured out how to incorporate community feedback. I did create a Google group where the book and ideas can be discussed, though. See http://groups.google.com/group/hardcore_erlang. I assume that not everyone interested in the book or the stock exchange software will be a subscriber to this list. I doubt I will have time to run a full-scale open source project in addition to writing the book and managing my regular consulting assignments. I'll sure I will run into software problems along the way, though. I will put those problems into context and ask for help then. Once the book is written, I should have plenty of time to further develop the concept and associated software. Thanks, Joel -- http://wagerlabs.com From joelr1@REDACTED Mon Nov 12 02:21:57 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 01:21:57 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <9b59d0270711111533p2db16a44md9f8a8452c506566@mail.gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <9b59d0270711111533p2db16a44md9f8a8452c506566@mail.gmail.com> Message-ID: <1BAC557A-853E-4393-9D55-919A10B35E8A@gmail.com> On Nov 11, 2007, at 11:33 PM, Michael Regen wrote: > This means either a lot of money and/or people are needed. I'm looking to write a book and enough software to demonstrate the concepts in the book. I will likely extend the software afterwards but I definitely do not plan to go into the exchange business... at least not at the moment and not a stock exchange. There are other kinds of markets that could be built and run and then there's venture capital! > But if you want to build the biggest Erlang cluster than you need > something which is actually useable in real life for at least some > time. That would also be a much bigger benefit for the people to join > compared to just build a showcase example. I thought about this for quite a while (at least a few minutes). I imagined a cluster of 1k EC2 instances and one of 100k instances. You could probably run a few Erlang nodes per instance as well which will positively make this a huge cluster. I tried to figure out what could entice people to boot up their Erlang EC2 instance and add it to a cluster and I couldn't come up with anything specific, apart from sheer interest and scientific value. You could crawl the internet Google-style or try to build some sort of a virtual world. Trading is my passion so I finally settled on a massive stock exchange. It can be a stock exchange or a prediction market, the essence of the book will stay the same regardless. Thanks, Joel -- http://wagerlabs.com From joelr1@REDACTED Mon Nov 12 02:27:13 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 01:27:13 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <779bf2730711111610k7c438dbex7d00f6f7d15271f@mail.gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <779bf2730711111610k7c438dbex7d00f6f7d15271f@mail.gmail.com> Message-ID: <46AC6DC4-2B4C-4871-8648-3594201E01BD@gmail.com> YC, On Nov 12, 2007, at 12:10 AM, YC wrote: > Agreed that cool factor shouldn't be it for a book (since Joel > confirmed > that book is the first priority), but there probably is an element of > marketing there :) There's a large element of marketing here. > On the other hand, books such as Norvig's PAIP covers examples that > are not > in common use, but because the author focuses so much more on > teaching the > subject matter and how to use Lisp to solve them, I found myself > walking > learning something without ever using the example. I very much like your PAIP suggestion. I'll have to keep it handy while I'm writing. Overall, I received so much excellent feedback and ideas that it's gonna take me some time just to organize them. Between the book, the blog, this mailing list and the book list, I'll have to swear off Reddit, Wall St Journal and my RSS feeds! In fact, I have already unsubscribed from the Haskell and OCaml lists just to keep a tight focus :-). > Without getting to that level of detail, then best examples are > relevant > ones - i.e. examples that can be immediately of use by simply copy and > paste. That would be more of a "cookbook" approach and I'm not looking to write a cookbook. > If going with a relevant angle - then a lot of people today are > working on > web-based applications and database related applications, so if the > example > solves at least some of the web and database problems than it won't > hurt ;) Web apps in Erlang is a whole separate book, one that I don't plan to write. Thanks, Joel -- http://wagerlabs.com From joelr1@REDACTED Mon Nov 12 02:37:06 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 01:37:06 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <47382987.664A.00DD.0@stgeorge.com.au> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <47382987.664A.00DD.0@stgeorge.com.au> Message-ID: On Nov 11, 2007, at 11:23 PM, Anthony Kong wrote: > But I think people here may want to model NYSE. After all more people > are familiar with NYSE's operations, and the final implementation will > be more attractive to general public out there. Anyone familiar with the NYSE operations? Any documents out there? > I guess a question back to Joel: how > do you manage the scope? It is really no easy task. I think I'll go bottom-up here. I will need chapters with in-depth coverage of Mnesia, debugging and testing, profiling and optimization, etc. What I plan to do is write those chapters first to show progress and to gauge how many pages I have written. I will then need to go back and cherry-pick stock exchange modules that would be a good fit for each chapter. Market data (stock quotes) distribution would fit right in profiling and optimization, for example. The book needs to be about 200 pages at a minimum so I may have to include just the choice portions of the stock exchange software and describe the rest in my blog or somewhere else. The software project does not need to end once the book is published and I will not be able to cover everything in the book. I will be tough to strike a balance but I will often ask for your feedback! Thanks, Joel -- http://wagerlabs.com From joelr1@REDACTED Mon Nov 12 02:38:55 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 01:38:55 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <47379048.9060603@bitfurnace.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <47378CD5.9020908@ghostgun.com> <47379048.9060603@bitfurnace.com> Message-ID: On Nov 11, 2007, at 11:29 PM, Damien Morton wrote: > A key aspect of any next generation trading system will be the > incorporation of streaming-database and continuous-query capabilities > into the underlying message bus. Speaking of the message bus, it already exists and is called AMQP which stands for Advanced Message Queuing Protocol. Fortunately for me, there's RabbitMQ which implements AMQP and is written in Erlang. -- http://wagerlabs.com From ellisonbg.net@REDACTED Mon Nov 12 02:48:06 2007 From: ellisonbg.net@REDACTED (Brian Granger) Date: Sun, 11 Nov 2007 18:48:06 -0700 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <779bf2730711101824j29efd455q6c85a0ced24563ca@mail.gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <779bf2730711101824j29efd455q6c85a0ced24563ca@mail.gmail.com> Message-ID: <6ce0ac130711111748j663e9e2ke0f85d145aaf2509@mail.gmail.com> There are two ways in which a stock exchange is extremely interesting as a model application of erlang: 1) The latency demands can be very important. Building a system that scales while maintaining latency constraints is a real challenge. Showing how erlang makes that possible would be very interesting. 2) Reliability. In any system dealing with finacial transactions, reliability must be there in all respects. Erlang is perfect for this type of thing and showing how it can be done would be fantastic. Brian On Nov 10, 2007 7:24 PM, YC wrote: > Cool idea, Joel! > > Yes - agreed that a stock exchange is a lot more interesting than a poker > server (but poker isn't bad either). > > Is the goal to have a truly functional stock exchange that interfaces with > other stock exchanges? Or one that has the capability but not the hook up? > > yc > > > > On Nov 10, 2007 5:58 PM, Joel Reymont wrote: > > http://wagerlabs.com/archives/129.html > > > > I want you to start an Amazon EC2 instance and join the "Hardcore > > Erlang" cluster. > > > > I want to build the biggest Erlang cluster in the world and push > > Erlang to its limits. > > > > I want to build a stock exchange and show you how to do it. > > > > And of course I want to write a book about it. > > > > The focus of the book is not changing, it's still fault-tolerance, > > scalability, distribution, etc. What's changing is the software the > > book is built around. Reading about how to build a stock exchange sure > > as hell beats reading about a poker server. > > > > What do you think? > > > > Thanks, Joel > > > > -- > > http://wagerlabs.com > > > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dougedmunds@REDACTED Mon Nov 12 02:53:00 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Sun, 11 Nov 2007 17:53:00 -0800 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> Message-ID: Here are two simulators that anyone can sign onto for free, then check out how they work. Maybe someone can smooze the programmers for some general stock market design help: http://www.howthemarketworks.com/ http://simulator.investopedia.com/ From dougedmunds@REDACTED Mon Nov 12 02:53:00 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Sun, 11 Nov 2007 17:53:00 -0800 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> Message-ID: Here are two simulators that anyone can sign onto for free, then check out how they work. Maybe someone can smooze the programmers for some general stock market design help: http://www.howthemarketworks.com/ http://simulator.investopedia.com/ From dougedmunds@REDACTED Mon Nov 12 02:53:00 2007 From: dougedmunds@REDACTED (Doug Edmunds) Date: Sun, 11 Nov 2007 17:53:00 -0800 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> Message-ID: Here are two simulators that anyone can sign onto for free, then check out how they work. Maybe someone can smooze the programmers for some general stock market design help: http://www.howthemarketworks.com/ http://simulator.investopedia.com/ From michael.regen@REDACTED Mon Nov 12 04:36:26 2007 From: michael.regen@REDACTED (Michael Regen) Date: Mon, 12 Nov 2007 04:36:26 +0100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <47382987.664A.00DD.0@stgeorge.com.au> Message-ID: <9b59d0270711111936p23876100o2906788547579336@mail.gmail.com> On Nov 12, 2007 2:37 AM, Joel Reymont wrote: > Anyone familiar with the NYSE operations? Any documents out there? Not familiar with it. But there is a quite good description for how their connectivity to the outside looks like: http://www.nysetransacttools.com/ The following gives you some overview how things fit together: http://www.nyse.com/press/1177426714683.html I guess quite a lot of useful search terms can be extracted there. They even published their data dictionary: http://www.nysetransacttools.com/resources/ Cheers, Michael From ulf.wiger@REDACTED Mon Nov 12 08:24:29 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 12 Nov 2007 08:24:29 +0100 Subject: [erlang-questions] EUC '07 papers and slides In-Reply-To: References: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com> Message-ID: <4737FFAD.3060405@ericsson.com> Actually, for the EUC '07, the link would be: http://www.erlang.se/euc/07/ ...but the papers are still not there. BR, Ulf W shiwei xu wrote: > http://www.erlang.se/workshop/2007/ > > On 11/10/07, *Joel Reymont* > > wrote: > > Are they available yet? > > I'm particularly interested in the non-destructive array updates. > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dmitriid@REDACTED Mon Nov 12 08:28:47 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Mon, 12 Nov 2007 09:28:47 +0200 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <47382987.664A.00DD.0@stgeorge.com.au> Message-ID: <473800AF.3030708@gmail.com> > I will then need to go back and cherry-pick stock exchange modules > that would be > a good fit for each chapter. Market data (stock quotes) distribution > would fit > right in profiling and optimization, for example. > > This reminds me of Deitel&Deitel's book on C++. They build an elevator throughout the book adding newer and more advanced features with each chapter. Don't know if this could be applicable to yor book though... From francis.norton@REDACTED Mon Nov 12 08:51:49 2007 From: francis.norton@REDACTED (Francis Norton) Date: Mon, 12 Nov 2007 07:51:49 +0000 Subject: [erlang-questions] EUC '07 papers and slides In-Reply-To: <4737FFAD.3060405@ericsson.com> References: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com> <4737FFAD.3060405@ericsson.com> Message-ID: <24162acd0711112351t1dd54d1cw85df87e3b5c3fc50@mail.gmail.com> Actually the papers *are* at the first location ( http://www.erlang.se/workshop/2007/) - I've just been browsing them! Francis. On 12/11/2007, Ulf Wiger (TN/EAB) wrote: > > > Actually, for the EUC '07, the link would be: > > http://www.erlang.se/euc/07/ > > ...but the papers are still not there. > > BR, > Ulf W > > > shiwei xu wrote: > > http://www.erlang.se/workshop/2007/ > > > > On 11/10/07, *Joel Reymont* > > > wrote: > > > > Are they available yet? > > > > I'm particularly interested in the non-destructive array updates. > > > > Thanks, Joel > > > > -- > > http://wagerlabs.com > > > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mogorman@REDACTED Mon Nov 12 09:01:02 2007 From: mogorman@REDACTED (mog) Date: Mon, 12 Nov 2007 02:01:02 -0600 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address Message-ID: <1194854462.13208.18.camel@metalman.lan> Hi I am looking for a way to set the outbound ip address on udp packets. After the recent thread about multicast I started playing with it, and have it working great. I am able to receive on the multicast address however sending out messages with gen_udp:send are received as the local ip of the interface, not as the multicast address. Is there a way to enable this behavior? Mog -------------- 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 ulf.wiger@REDACTED Mon Nov 12 09:01:09 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 12 Nov 2007 09:01:09 +0100 Subject: [erlang-questions] EUC '07 papers and slides In-Reply-To: <24162acd0711112351t1dd54d1cw85df87e3b5c3fc50@mail.gmail.com> References: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com> <4737FFAD.3060405@ericsson.com> <24162acd0711112351t1dd54d1cw85df87e3b5c3fc50@mail.gmail.com> Message-ID: <47380845.1020202@ericsson.com> Francis Norton wrote: > Actually the papers *are* at the first location > (http://www.erlang.se/workshop/2007/) - I've just been browsing them! Those are presentations given at the SIGPLAN Erlang Workshop in Freiburg, Oct 5. That is not the same as the EUC, which was held in Stockholm (?lvsj?), Nov 8. Joel was asking for EUC presentations. BR, Ulf W From als@REDACTED Mon Nov 12 09:18:32 2007 From: als@REDACTED (Anthony Shipman) Date: Mon, 12 Nov 2007 19:18:32 +1100 Subject: [erlang-questions] Can I stop an application from within one of its servers? Message-ID: <200711121918.32678.als@iinet.net.au> I have a node that I want to shut down by sending a message to its central gen_server. What's the best way to do this? At the moment I have the gen_server call application:stop() which eventually calls erlang:halt(). Calling this from within the callback module of an gen_server seems a bit brutal. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From ulf@REDACTED Mon Nov 12 09:56:15 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 12 Nov 2007 09:56:15 +0100 Subject: [erlang-questions] Can I stop an application from within one of its servers? In-Reply-To: <200711121918.32678.als@iinet.net.au> References: <200711121918.32678.als@iinet.net.au> Message-ID: <8209f740711120056h85d7fa8qfbb1f71f17984d1b@mail.gmail.com> Calling init:stop() is decidedly less brutal than erlang:halt(). While you _can_ call application:stop(A) from within the application itself, it's not very pretty. For one thing, application:stop/1 is synchronous, so the calling process will be blocked while waiting for the call to complete, but one step in its completion is that the supervisor of the caller will try to shut it down gracefully. This will not work, and the caller will be brutally killed. The application will still be stopped, but not without some commotion. Init:stop() is not synchronous, and gives the applications a chance to properly prepare for the shutdown (e.g. closing dets files,etc.) BR, Ulf W 2007/11/12, Anthony Shipman : > I have a node that I want to shut down by sending a message to its central > gen_server. What's the best way to do this? At the moment I have the > gen_server call application:stop() which eventually calls erlang:halt(). > Calling this from within the callback module of an gen_server seems a bit > brutal. > > -- > Anthony Shipman Mamas don't let your babies > als@REDACTED grow up to be outsourced. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bjarne@REDACTED Mon Nov 12 10:25:40 2007 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Mon, 12 Nov 2007 10:25:40 +0100 Subject: [erlang-questions] EUC '07 papers and slides References: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com><4737FFAD.3060405@ericsson.com> <24162acd0711112351t1dd54d1cw85df87e3b5c3fc50@mail.gmail.com> Message-ID: <000001c8250e$37bfddb0$ba2369d4@Dell> We will set up a final EUC'07 website with all the papers and slides in a couple of days. Just hang on. Bjarne ----- Original Message ----- From: Francis Norton To: Ulf Wiger (TN/EAB) Cc: Erlang Questions Sent: Monday, November 12, 2007 8:51 AM Subject: Re: [erlang-questions] EUC '07 papers and slides Actually the papers *are* at the first location (http://www.erlang.se/workshop/2007/) - I've just been browsing them! Francis. On 12/11/2007, Ulf Wiger (TN/EAB) wrote: Actually, for the EUC '07, the link would be: http://www.erlang.se/euc/07/ ...but the papers are still not there. BR, Ulf W shiwei xu wrote: > http://www.erlang.se/workshop/2007/ > > On 11/10/07, *Joel Reymont* > > wrote: > > Are they available yet? > > I'm particularly interested in the non-destructive array updates. > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions ------------------------------------------------------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From opendev@REDACTED Mon Nov 12 10:57:47 2007 From: opendev@REDACTED (Joern) Date: Mon, 12 Nov 2007 10:57:47 +0100 Subject: [erlang-questions] Soft realtime stats In-Reply-To: <4734362A.1040501@it.uu.se> References: <9e009ad0711080054l5bb2c616i83e40b3c3ddcbf7d@mail.gmail.com> <4734362A.1040501@it.uu.se> Message-ID: <9e009ad0711120157jcc8ffb3x51843f99e1fb4a05@mail.gmail.com> Hello Richard, hello Bengt, On 11/9/07, Richard Carlsson wrote: > No papers, as far as I know, but this is basically how things work: Thanks for the information. Best regards, Joern -- From torben.lehoff@REDACTED Mon Nov 12 11:18:39 2007 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 12 Nov 2007 11:18:39 +0100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> Message-ID: Joel, On Nov 12, 2007 1:58 AM, Joel Reymont wrote: > Torben, > > On Nov 11, 2007, at 9:10 PM, Torben Hoffmann wrote: > > > It may very well be the case that a stock exchange is cooler than > > poker, but > > I think that the poker server has some interesting aspects that could > > inspire others. > > I can always describe the architecture of the poker server in a series > of blog articles. > > > Furthermore, I would rather see a well-written book on hard-core > > Erlang hit > > its window of opportunity than see the whole thing turn into "let's > > make the > > coolest application that will never run in real life just in order > > to spice > > up a programming book"-kind of projects. > > I firmly plan to hit my window of opportunity, that's my priority #1. > > I may have confused a lot of people by forgetting to mention that I > don't plan to build a business. I do plan to write a book, one with > examples based around software. I'm passionate about all things > trading and I'm not passionate about poker, so I chose to build and > describe stock exchange software instead. I am very passionate about the success of Erlang so I am just worried that the book might suffer from being written in parallel with the creation of a non-trivial system like a stock exchange. If you take a look a the mails in this thread you see a lot of enthusiastic people - which is good - but my concern for the book is that most of them are enthusiastic about the prospects of building a stock exchange. This is very good indeed, but what Erlang needs the most is to keep momentum and I feel that could be jeopardised if too many things are thrown up into the air at the same time. Living inside a big company (Motorola) it is more important for me to get ammunition that shows the momentum than the particular case study in the book. > > A well written book with a clear example of usage including > > discussions > > about where the general ideas can be applied is what I would bet my > > money > > on. > > It will be done! Super! Cheers, Torben P.S. The views expressed above are 100% my own and is not associated with my employer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alceste@REDACTED Mon Nov 12 11:18:49 2007 From: alceste@REDACTED (Alceste Scalas) Date: Mon, 12 Nov 2007 11:18:49 +0100 Subject: [erlang-questions] autoconf and erlang In-Reply-To: <4732883B.3000909@ghostgun.com> References: <4732883B.3000909@ghostgun.com> Message-ID: <1194862729.31125.48.camel@gnatziu.crs4.it> Il giorno gio, 08/11/2007 alle 14.53 +1100, jm ha scritto: > 1) How do I work out where to put the beam files and the compiled c-port? >From the GNU Autoconf documentation: For the more specific installation of Erlang libraries, the following variables are defined: ? Variable: ERLANG_INSTALL_LIB_DIR The common parent directory of Erlang library installation directories. This variable is set by calling the AC_ERLANG_SUBST_INSTALL_LIB_DIR macro in configure.ac. ? Variable: ERLANG_INSTALL_LIB_DIR_library The installation directory for Erlang library library. This variable is set by calling the `AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(library, version)' macro in configure.ac. > 2) What is the best way to alter the code so that the open_port() > function knowns what to execute? At the moment, there's a > > -define(PORTPROG, "./inotify"). > > near the top of the erlang source file. Include file? How do i go about > finding the correct path and inserting this automatically? You could use code:priv_dir/1 (and possibly put your executable in the module private directory). Regards, -- Alceste Scalas CRS4 - http://www.crs4.it/ From codewalkerjoe@REDACTED Mon Nov 12 14:45:23 2007 From: codewalkerjoe@REDACTED (joe lee) Date: Mon, 12 Nov 2007 08:45:23 -0500 Subject: [erlang-questions] Erlang on Windows: Alternative to "make" Message-ID: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> How do you perform "make" on windows OS, for erlang app? Do you use cygwin and cd into the location of the erlang app in the windows file system, eg. c:\erlang\someapps and then perform make? Is there a way to compile the erlang app in windows? joe From aaron.feng@REDACTED Mon Nov 12 14:50:56 2007 From: aaron.feng@REDACTED (Aaron Feng) Date: Mon, 12 Nov 2007 08:50:56 -0500 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> Message-ID: <4e3934860711120550k248626c2m4f0d4aa2611ad531@mail.gmail.com> I think this would be an interesting and a good idea. For people who are not familiar with Erlang they tend to dismiss Erlang is a language only used in the telecomm industry. It would be great to build a financial application in Erlang since many requirements exists in the telecomm industry also exists in the financial industry. Aaron On Nov 10, 2007 8:58 PM, Joel Reymont wrote: > http://wagerlabs.com/archives/129.html > > I want you to start an Amazon EC2 instance and join the "Hardcore > Erlang" cluster. > > I want to build the biggest Erlang cluster in the world and push > Erlang to its limits. > > I want to build a stock exchange and show you how to do it. > > And of course I want to write a book about it. > > The focus of the book is not changing, it's still fault-tolerance, > scalability, distribution, etc. What's changing is the software the > book is built around. Reading about how to build a stock exchange sure > as hell beats reading about a poker server. > > What do you think? > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsaccon@REDACTED Mon Nov 12 15:09:37 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Mon, 12 Nov 2007 12:09:37 -0200 Subject: [erlang-questions] Erlang on Windows: Alternative to "make" In-Reply-To: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> References: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> Message-ID: if you don't have c sources you can use Emakefiles, which is platform neutral, and then you just call "erl make" or you can use erlc directly (or called from your preferred scripting language if your setup is complex). And in case you mean with your question just the *.app file, that doesn't need to be compiled, just put it in the ebin folder, or where ever you have your beam files. hope that helps. -- Roberto Saccon http://rsaccon.com From brianorourke@REDACTED Mon Nov 12 16:09:02 2007 From: brianorourke@REDACTED (Brian P O'Rourke) Date: Mon, 12 Nov 2007 10:09:02 -0500 Subject: [erlang-questions] erlounge: NYC this week? Message-ID: <314648e0711120709n51f8fd3fx478b5beec1bebecb@mail.gmail.com> Hi all, I happen to be in New York this week, and was curious to see if anyone was interested in getting together for an Erlounge. I haven't seen any announcements on the list for a NYC-area meetup. Anyone interested in getting together in Manhattan this week to discuss their Erlang experiences? --Brian From samuelrivas@REDACTED Mon Nov 12 15:15:40 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Mon, 12 Nov 2007 15:15:40 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <473074F8.80307@ericsson.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <473074F8.80307@ericsson.com> Message-ID: <20071112141540.GA18962@lambdastream.com> Hi, Well, a bit late response, but anyway :) ... Yes, there is an Erlang community in Spain. In A Coru?a (Galicia) there are several researchers involved in the university and some companies doing commercial developments. However, I would say that the important thing is the whole picture, the international (mostly Swedish) community is great, and you can find lots of information and support in this list or in the web (www.erlang.org and www.trapexit.org). About the "speed" of Erlang, as Ulf wrote, is probably enough for most of the situations. Think that usually there are some concrete bottlenecks in one system. For that you may need to optimise a bit, or even "outsource" to other languages such as C, but for most of the logic in an application the bottleneck is the time you spend on designing, coding, and testing them. For that Erlang will help a lot. Saludos :) -- Samuel From frank.blecha@REDACTED Mon Nov 12 16:24:57 2007 From: frank.blecha@REDACTED (Frank Blecha) Date: Mon, 12 Nov 2007 08:24:57 -0700 Subject: [erlang-questions] Erlang on Windows: Alternative to "make" In-Reply-To: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> References: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> Message-ID: Rake works pretty well, and has less maintenance than make imho. http://seangeo.blogspot.com/2007/09/building-erlang-with-rake.html - Frank On Nov 12, 2007 6:45 AM, joe lee wrote: > How do you perform "make" on windows OS, for erlang app? Do you use > cygwin and cd into the location of the erlang app in the windows file > system, eg. c:\erlang\someapps and then perform make? > > Is there a way to compile the erlang app in windows? > > joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Frank Blecha -------------- next part -------------- An HTML attachment was scrubbed... URL: From william.fink@REDACTED Mon Nov 12 16:25:38 2007 From: william.fink@REDACTED (William FINK) Date: Mon, 12 Nov 2007 16:25:38 +0100 Subject: [erlang-questions] Erlang on Windows: Alternative to "make" In-Reply-To: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> References: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> Message-ID: Take a look at MSYS by MinGW (http://www.mingw.org/). Will' On Nov 12, 2007 2:45 PM, joe lee wrote: > How do you perform "make" on windows OS, for erlang app? Do you use > cygwin and cd into the location of the erlang app in the windows file > system, eg. c:\erlang\someapps and then perform make? > > Is there a way to compile the erlang app in windows? > > joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- William FINK -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Mon Nov 12 16:52:45 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 15:52:45 +0000 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <20071112141540.GA18962@lambdastream.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <473074F8.80307@ericsson.com> <20071112141540.GA18962@lambdastream.com> Message-ID: <982F748D-FB7C-4E40-9605-BEEE45CF3420@gmail.com> On Nov 12, 2007, at 2:15 PM, Samuel Rivas wrote: > Yes, there is an Erlang community in Spain. In A Coru?a (Galicia) > there are > several researchers involved in the university and some companies > doing > commercial developments. Granted, one person does not a community make, but Tenerife was part of Spain last time I checked :-). Saludos, Joel -- http://wagerlabs.com From samuelrivas@REDACTED Mon Nov 12 17:08:32 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Mon, 12 Nov 2007 17:08:32 +0100 Subject: [erlang-questions] QUestions about erlang In-Reply-To: <982F748D-FB7C-4E40-9605-BEEE45CF3420@gmail.com> References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com> <473074F8.80307@ericsson.com> <20071112141540.GA18962@lambdastream.com> <982F748D-FB7C-4E40-9605-BEEE45CF3420@gmail.com> Message-ID: <20071112160832.GA20569@lambdastream.com> Joel Reymont wrote: >> Yes, there is an Erlang community in Spain. In A Coru?a (Galicia) there >> are >> several researchers involved in the university and some companies doing >> commercial developments. > > Granted, one person does not a community make, but Tenerife was part of > Spain last time I checked :-). Well, I did not mean to be excluding other groups/persons. Just talking about the people I know more closely :) Aside, I did not realise that my address for this list is from udc.es (University of A Coru?a), but I am also (and mainly) working for LambdaStream (there will be some slides about that in the EUC page for this year :). Best regards -- Samuel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From valentin@REDACTED Mon Nov 12 16:22:30 2007 From: valentin@REDACTED (Valentin Micic) Date: Mon, 12 Nov 2007 17:22:30 +0200 Subject: [erlang-questions] Lets build a stock exchange! References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com><24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> Message-ID: <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> Would not like to sound negative, but how many people would actually have a chance to do something similar (i.e. build a stock exchange system) in their careers? To me, this sounds like teaching someone to build affordable housing by explaining how to build a pyramid. If the main goal of writing a book is to popularize a specific subject, the stock exchange system, IMHO, would not cut. If you want a popular support, write a book about popular subject. For example, I think that erlang's implementation of jabber protocol (XMPP, etc), did a great deal to erlang's popularity...But then again, how many books do we need? V. ----- Original Message ----- From: "Joe Armstrong" To: "Torben Hoffmann" Cc: "Erlang Questions" Sent: Sunday, November 11, 2007 11:45 PM Subject: Re: [erlang-questions] Lets build a stock exchange! > This sounds like a great idea. > > I have no idea whether it would succeed or fail - if it succeeds then > (gulp) > > If it fails the interesting thing is not that it failed but WHY it failed. > > If things fail and we know why we can do research and fix things. It > is the existence of things > that don't work that stimulates software research and development. > > Interesting problems are very difficult to think up - asking the right > question is > often the really difficult bit - once asked lots of brains can try and > find the solution. > > Joels suggesting poses a difficult question - great - let's try and answer > it. > > If Joel can in any way structure the problem then there are loads of > us that can try and > write the individual bits. > > Breaking the system is great - a program that breaks the compiler is > far better than 100 that work. > > A program that breaks mnesia is far better than 1000 that work. > > If this breaks Erlang great - we can fix it and make an even better > system. > > Breaking stuff is easy - the interesting point is *where* does the system > break! > > /Joe Armstrong > > > > On Nov 11, 2007 10:10 PM, Torben Hoffmann > wrote: >> >> >> >> On Nov 11, 2007 9:43 PM, Christian S wrote: >> > Anyone know a book on technical requirements that brokers put on stock >> > exchanges? Order matching procedures, what information do tax offices >> > want, typical features as in stop-loss rules... >> > >> > Oh, and yes. A stock exchange is cooler than poker. >> >> It may very well be the case that a stock exchange is cooler than poker, >> but >> I think that the poker server has some interesting aspects that could >> inspire others. E.g., the dynamic allocation of a server to run a new >> table >> as well as the handling of the messages between the players is similar in >> nature to some of the challenges there is in telecom with regards to >> group >> calls and where to "host" the call. >> >> Furthermore, I would rather see a well-written book on hard-core Erlang >> hit >> its window of opportunity than see the whole thing turn into "let's make >> the >> coolest application that will never run in real life just in order to >> spice >> up a programming book"-kind of projects. >> >> A well written book with a clear example of usage including discussions >> about where the general ideas can be applied is what I would bet my money >> on. If a potential buyer of the hard-core Erlang book cannot abstract >> from >> the specific case study used to teach the principles then it is time to >> utter "Joe, We have a problem!" ;-) >> >> Cheers, >> Torben >> >> P.S. My first reaction to the stock exchange idea was "Wow!! Cool!!!", >> but >> then my analytical side issued a kill to that process for the reason >> listed >> above. >> >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlangx@REDACTED Mon Nov 12 18:16:22 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Mon, 12 Nov 2007 09:16:22 -0800 Subject: [erlang-questions] idea: apology re MAILER-DAEMON Message-ID: <20071112171622.GI21717@delora.autosys.us> I apologize if some of you have been getting MAILER-DAEMON error messages from my domain. I broke DNS and postfix was not happy. This error is corrected. If my address was blocked from erlang-questions please unblock now. thanks, ~Michael From dmercer@REDACTED Mon Nov 12 18:28:38 2007 From: dmercer@REDACTED (David Mercer) Date: Mon, 12 Nov 2007 11:28:38 -0600 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com><24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com><9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> Message-ID: <007b01c82551$77832040$891ea8c0@SSI.CORP> Sure, I may not ever build a stock exchange, but I may be building an e-commerce engine, or a hospital information system, or something else that may have very similar reliability, scalability, security, and audit requirements. For that matter, if I plan to build a poker server, I could probably apply much of what is learned from building a stock exchange. The opposite is not necessarily true. I'd much rather see an application that hits more the sweet spot of Erlang (massive soft-real-time systems) than a toy application conjured up to illustrate the same. Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Valentin Micic Sent: Monday, November 12, 2007 09:23 To: Joe Armstrong; Torben Hoffmann Cc: Erlang Questions Subject: Re: [erlang-questions] Lets build a stock exchange! Would not like to sound negative, but how many people would actually have a chance to do something similar (i.e. build a stock exchange system) in their careers? To me, this sounds like teaching someone to build affordable housing by explaining how to build a pyramid. If the main goal of writing a book is to popularize a specific subject, the stock exchange system, IMHO, would not cut. If you want a popular support, write a book about popular subject. For example, I think that erlang's implementation of jabber protocol (XMPP, etc), did a great deal to erlang's popularity...But then again, how many books do we need? V. ----- Original Message ----- From: "Joe Armstrong" To: "Torben Hoffmann" Cc: "Erlang Questions" Sent: Sunday, November 11, 2007 11:45 PM Subject: Re: [erlang-questions] Lets build a stock exchange! > This sounds like a great idea. > > I have no idea whether it would succeed or fail - if it succeeds then > (gulp) > > If it fails the interesting thing is not that it failed but WHY it failed. > > If things fail and we know why we can do research and fix things. It > is the existence of things > that don't work that stimulates software research and development. > > Interesting problems are very difficult to think up - asking the right > question is > often the really difficult bit - once asked lots of brains can try and > find the solution. > > Joels suggesting poses a difficult question - great - let's try and answer > it. > > If Joel can in any way structure the problem then there are loads of > us that can try and > write the individual bits. > > Breaking the system is great - a program that breaks the compiler is > far better than 100 that work. > > A program that breaks mnesia is far better than 1000 that work. > > If this breaks Erlang great - we can fix it and make an even better > system. > > Breaking stuff is easy - the interesting point is *where* does the system > break! > > /Joe Armstrong > > > > On Nov 11, 2007 10:10 PM, Torben Hoffmann > wrote: >> >> >> >> On Nov 11, 2007 9:43 PM, Christian S wrote: >> > Anyone know a book on technical requirements that brokers put on stock >> > exchanges? Order matching procedures, what information do tax offices >> > want, typical features as in stop-loss rules... >> > >> > Oh, and yes. A stock exchange is cooler than poker. >> >> It may very well be the case that a stock exchange is cooler than poker, >> but >> I think that the poker server has some interesting aspects that could >> inspire others. E.g., the dynamic allocation of a server to run a new >> table >> as well as the handling of the messages between the players is similar in >> nature to some of the challenges there is in telecom with regards to >> group >> calls and where to "host" the call. >> >> Furthermore, I would rather see a well-written book on hard-core Erlang >> hit >> its window of opportunity than see the whole thing turn into "let's make >> the >> coolest application that will never run in real life just in order to >> spice >> up a programming book"-kind of projects. >> >> A well written book with a clear example of usage including discussions >> about where the general ideas can be applied is what I would bet my money >> on. If a potential buyer of the hard-core Erlang book cannot abstract >> from >> the specific case study used to teach the principles then it is time to >> utter "Joe, We have a problem!" ;-) >> >> Cheers, >> Torben >> >> P.S. My first reaction to the stock exchange idea was "Wow!! Cool!!!", >> but >> then my analytical side issued a kill to that process for the reason >> listed >> above. >> >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Mon Nov 12 18:37:58 2007 From: chsu79@REDACTED (Christian S) Date: Mon, 12 Nov 2007 18:37:58 +0100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> Message-ID: We need many books. Enough to drown the Java books. Yes we do! I imagine the stock exchange to be an example of something that needs throughput and high service levels. Lessons learned will be applicable for other projects. A system related to the financial sector can also help to popularize Erlang more there. 2007/11/12, Valentin Micic : > Would not like to sound negative, but how many people would actually have a > chance to do something similar (i.e. build a stock exchange system) in their > careers? To me, this sounds like teaching someone to build affordable > housing by explaining how to build a pyramid. If the main goal of writing a > book is to popularize a specific subject, the stock exchange system, IMHO, > would not cut. If you want a popular support, write a book about popular > subject. For example, I think that erlang's implementation of jabber > protocol (XMPP, etc), did a great deal to erlang's popularity...But then > again, how many books do we need? > > V. > > ----- Original Message ----- > From: "Joe Armstrong" > To: "Torben Hoffmann" > Cc: "Erlang Questions" > Sent: Sunday, November 11, 2007 11:45 PM > Subject: Re: [erlang-questions] Lets build a stock exchange! > > > > This sounds like a great idea. > > > > I have no idea whether it would succeed or fail - if it succeeds then > > (gulp) > > > > If it fails the interesting thing is not that it failed but WHY it failed. > > > > If things fail and we know why we can do research and fix things. It > > is the existence of things > > that don't work that stimulates software research and development. > > > > Interesting problems are very difficult to think up - asking the right > > question is > > often the really difficult bit - once asked lots of brains can try and > > find the solution. > > > > Joels suggesting poses a difficult question - great - let's try and answer > > it. > > > > If Joel can in any way structure the problem then there are loads of > > us that can try and > > write the individual bits. > > > > Breaking the system is great - a program that breaks the compiler is > > far better than 100 that work. > > > > A program that breaks mnesia is far better than 1000 that work. > > > > If this breaks Erlang great - we can fix it and make an even better > > system. > > > > Breaking stuff is easy - the interesting point is *where* does the system > > break! > > > > /Joe Armstrong > > > > > > > > On Nov 11, 2007 10:10 PM, Torben Hoffmann > > wrote: > >> > >> > >> > >> On Nov 11, 2007 9:43 PM, Christian S wrote: > >> > Anyone know a book on technical requirements that brokers put on stock > >> > exchanges? Order matching procedures, what information do tax offices > >> > want, typical features as in stop-loss rules... > >> > > >> > Oh, and yes. A stock exchange is cooler than poker. > >> > >> It may very well be the case that a stock exchange is cooler than poker, > >> but > >> I think that the poker server has some interesting aspects that could > >> inspire others. E.g., the dynamic allocation of a server to run a new > >> table > >> as well as the handling of the messages between the players is similar in > >> nature to some of the challenges there is in telecom with regards to > >> group > >> calls and where to "host" the call. > >> > >> Furthermore, I would rather see a well-written book on hard-core Erlang > >> hit > >> its window of opportunity than see the whole thing turn into "let's make > >> the > >> coolest application that will never run in real life just in order to > >> spice > >> up a programming book"-kind of projects. > >> > >> A well written book with a clear example of usage including discussions > >> about where the general ideas can be applied is what I would bet my money > >> on. If a potential buyer of the hard-core Erlang book cannot abstract > >> from > >> the specific case study used to teach the principles then it is time to > >> utter "Joe, We have a problem!" ;-) > >> > >> Cheers, > >> Torben > >> > >> P.S. My first reaction to the stock exchange idea was "Wow!! Cool!!!", > >> but > >> then my analytical side issued a kill to that process for the reason > >> listed > >> above. > >> > >> > > >> > _______________________________________________ > >> > erlang-questions mailing list > >> > erlang-questions@REDACTED > >> > http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > >> > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From patrickdlogan@REDACTED Mon Nov 12 20:00:23 2007 From: patrickdlogan@REDACTED (Patrick Logan) Date: Mon, 12 Nov 2007 11:00:23 -0800 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> Message-ID: > For example, I think that erlang's implementation of jabber > protocol (XMPP, etc), did a great deal to erlang's popularity...But then > again, how many books do we need? Given that the existing XMPP books are so old as to be labeled "Jabber" maybe a book could serve multiple purposes: * Building a large system with Erlang. * Providing newer information about XMPP, e.g. Pub/Sub. * Demonstrating the use of XMPP in an integration rather than IM scenario. From joelr1@REDACTED Mon Nov 12 22:11:43 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 12 Nov 2007 21:11:43 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> Message-ID: I would venture a guess that anyone interested enough in implementing XMPP can just go and read the ejabberd source code or the spec. Any book about the same is automatically destined to gather dust on the shelves. When I buy a book I want to read about something exciting, something that challenges my skills and imagination. I may not get to build a pyramid or a stock exchange but neither do I want to read about affordable housing! Joel On Nov 12, 2007, at 7:00 PM, Patrick Logan wrote: >> * Building a large system with Erlang. > * Providing newer information about XMPP, e.g. Pub/Sub. > * Demonstrating the use of XMPP in an integration rather than IM > scenario. -- http://wagerlabs.com From monch1962@REDACTED Tue Nov 13 01:16:19 2007 From: monch1962@REDACTED (David Mitchell) Date: Tue, 13 Nov 2007 11:16:19 +1100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com> <24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com> <9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com> <00b001c8253f$db70f6c0$6401a8c0@moneymaker2> Message-ID: Count me very interested. There's better coders than me around, but I work for a broker now, was on the trading floor in Australia in October 1987 and thus experienced first hand what happens when trading systems fail, and have traded my own futures account since 1999 and thus have a significant interest on several levels. Bring it on Dave M On 11/13/07, Joel Reymont wrote: > I would venture a guess that anyone interested enough in implementing > XMPP can just go and read the ejabberd source code or the spec. Any > book about the same is automatically destined to gather dust on the > shelves. > > When I buy a book I want to read about something exciting, something > that challenges my skills and imagination. I may not get to build a > pyramid or a stock exchange but neither do I want to read about > affordable housing! > > Joel > > On Nov 12, 2007, at 7:00 PM, Patrick Logan wrote: > > >> * Building a large system with Erlang. > > * Providing newer information about XMPP, e.g. Pub/Sub. > > * Demonstrating the use of XMPP in an integration rather than IM > > scenario. > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From gbulmer@REDACTED Tue Nov 13 02:09:17 2007 From: gbulmer@REDACTED (G Bulmer) Date: Tue, 13 Nov 2007 01:09:17 +0000 Subject: [erlang-questions] Lets build a stock exchange! Message-ID: > From: Joel Reymont ... > I want you to start an Amazon EC2 instance and join the "Hardcore > Erlang" cluster. > > I want to build the biggest Erlang cluster in the world and push > Erlang to its limits. How big would that be? > I want to build a stock exchange and show you how to do it. Why not build something that we could use? > And of course I want to write a book about it. As long as it's interesting, the more the merrier. > The focus of the book is not changing, it's still fault-tolerance, > scalability, distribution, etc. I'd like to read about that. > What's changing is the software the > book is built around. Reading about how to build a stock exchange sure > as hell beats reading about a poker server. I agree, poker is a bit dull. > What do you think? Sorry to be out of step, but I'd prefer something that *I* could imagine using. How about a replacement for eBay auctions (or is Erlang what the e mans now?-)? eBay has fault-tolerance, scale, distribution challenges. I could sell my old programming books, which have become useless to me, now that I have started using Erlang ;-) Craig's list (http://sfbay.craigslist.org/) has shown that a free classified-ads system can become popular in over 50 countries. Go the next step, and provide classified ads and auctions. To make it more fun, you could provide several bidding systems, not just highest bidder, like Dutch Auction, etc. There has been some pretty sneaky work on designing auctions (a well known one was the scheme used by the UK government when selling the 3G mobile phone spectrum), so there is lots of scope for extending and enhancing the business-process side if anyone wants to do that. Anyone who sells anything at auction could use it. Probably payment would be pushed off to paypal, or any other payment mechanism. A good solution would support 'live auctions', and keep the bids in sequence. It'd have some of the challenges of a stock market, but you'd avoid having to provide liquidity to make it useable (I realise your focus is a book, but wouldn't you like millions of people to use the software?). Just a thought, G Bulmer From jeffm@REDACTED Tue Nov 13 03:24:24 2007 From: jeffm@REDACTED (jm) Date: Tue, 13 Nov 2007 13:24:24 +1100 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: Message-ID: <47390AD8.1060707@ghostgun.com> G Bulmer wrote: >> What do you think? > > Sorry to be out of step, but I'd prefer something that *I* could > imagine using. > > How about a replacement for eBay auctions (or is Erlang what the e > mans now?-)? eBay has fault-tolerance, scale, distribution challenges. > I could sell my old programming books, which have become useless to > me, now that I have started using Erlang ;-) > > Craig's list (http://sfbay.craigslist.org/) has shown that a free > classified-ads system can become popular in over 50 countries. > Go the next step, and provide classified ads and auctions. > > To make it more fun, you could provide several bidding systems, not > just highest bidder, like Dutch Auction, etc. > There has been some pretty sneaky work on designing auctions (a well > known one was the scheme used by the UK government when selling the > 3G mobile phone spectrum), so there is lots of scope for extending > and enhancing the business-process side if anyone wants to do that. > > Anyone who sells anything at auction could use it. Probably payment > would be pushed off to paypal, or any other payment mechanism. > > A good solution would support 'live auctions', and keep the bids in > sequence. Stock market are well suited to the buying and selling any classes of items which are identitical, eg, equity in a company, futures contracts, commodities (beef, gold, etc) and are more common than may you at first think. The auction model is more suited to individual and unique items, eg. antiques, spectrum blocks, second hand goods, etc. Both are open makets though. In the middle is a whole range of markets including the one you bought your new fridge in. There's certainly a lot around on the theory of designing a good auction just type "auction theory" into your favorite search engine or look at wikipedia's page on the subject http://en.wikipedia.org/wiki/Auction_theory The most common market at a guess would be those in the middle either B2B or B2C trying to find a plumber, a new desk, or a manufacturer for your new widget. So if your shooting for the potential size of audience that's where you'd aim, but I think that is also the weakest in that it is ill defined. I suppose comes down to finding a topic which highlights Erlangs good side, inspires the potential reader to buy the book, motivates the reader to try things, and proves valuable as a reference far into the future. As such I'd rather any proposed book not be too heavy on the web stuff and much more on the infrastructure side of things. That being said I don't think either the auction or stock market ideas are bad and it would be nice to see something less teleco/web industry centric discussed in depth. Jeff. From saleyn@REDACTED Tue Nov 13 04:42:50 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 12 Nov 2007 22:42:50 -0500 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <1194854462.13208.18.camel@metalman.lan> References: <1194854462.13208.18.camel@metalman.lan> Message-ID: <47391D3A.1030702@gmail.com> Though I haven't tried this with multicast packets, I suppose it would work the same way as when a host has multiple interfaces and there's a need for an inbound UDP packet to contain the ip address of the interface it was received on. This information is usually delivered as ancillary data (IP_RECVDSTADDR sockopt), however Erlang's inet driver doesn't support this feature. Serge mog wrote: > Hi I am looking for a way to set the outbound ip address on udp packets. > After the recent thread about multicast I started playing with it, and > have it working great. I am able to receive on the multicast address > however sending out messages with gen_udp:send are received as the local > ip of the interface, not as the multicast address. Is there a way to > enable this behavior? > > Mog > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From mogorman@REDACTED Tue Nov 13 05:14:25 2007 From: mogorman@REDACTED (mog) Date: Mon, 12 Nov 2007 22:14:25 -0600 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <47391D3A.1030702@gmail.com> References: <1194854462.13208.18.camel@metalman.lan> <47391D3A.1030702@gmail.com> Message-ID: <1194927265.10778.5.camel@metalman.lan> Sorry If my question was not clearer. Although IP_RECVDSTADDR is something erlang should also support as I will often use multiple interfaces. However this was not the problem I was refering to. When I send a message with gen_udp:send it is received at the end point as the Local Address it was sent out on. gen_udp:open(Port, [binary, {active, false}, {reuseaddr, true}, {ip, Addr}, {add_membership, {Addr, LAddr}}]). Where Addr is my multicast Ip, LAddr is my network ip, so sent messages are received as 192.168.1.50 instead of 224.0.1.185. Mog On Mon, 2007-11-12 at 22:42 -0500, Serge Aleynikov wrote: > Though I haven't tried this with multicast packets, I suppose it would > work the same way as when a host has multiple interfaces and there's a > need for an inbound UDP packet to contain the ip address of the > interface it was received on. This information is usually delivered as > ancillary data (IP_RECVDSTADDR sockopt), however Erlang's inet driver > doesn't support this feature. > > Serge > > mog wrote: > > Hi I am looking for a way to set the outbound ip address on udp packets. > > After the recent thread about multicast I started playing with it, and > > have it working great. I am able to receive on the multicast address > > however sending out messages with gen_udp:send are received as the local > > ip of the interface, not as the multicast address. Is there a way to > > enable this behavior? > > > > Mog > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- 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 per@REDACTED Tue Nov 13 08:51:52 2007 From: per@REDACTED (Per Hedeland) Date: Tue, 13 Nov 2007 08:51:52 +0100 (CET) Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <1194927265.10778.5.camel@metalman.lan> Message-ID: <200711130751.lAD7pqOu007371@pluto.hedeland.org> mog wrote: > >Sorry If my question was not clearer. Although IP_RECVDSTADDR is >something erlang should also support as I will often use multiple >interfaces. Well, that is OS-specific too unfortunately, the inferior/conventional method is to use multiple sockets, each bound to one of the addresses (assuming you do need to care about the address that is, you can of course use multiple interfaces w/o doing that). >However this was not the problem I was refering to. When I send a >message with gen_udp:send it is received at the end point as the Local >Address it was sent out on. > >gen_udp:open(Port, [binary, {active, false}, {reuseaddr, true}, {ip, >Addr}, {add_membership, {Addr, LAddr}}]). > >Where Addr is my multicast Ip, LAddr is my network ip, so sent messages >are received as 192.168.1.50 instead of 224.0.1.185. Hm, I'm afraid I still can't parse the "message received as address" part:-) - are you referring to the source address of the multicast packets you send out? If so, why would you expect it to be anything other than the unicast address of the sender? Sending packets with a multicast source address should be almost as bad as sending with a broadcast source address, and such packets will probably be dropped by most receiving stacks. --Per Hedeland From babo.online@REDACTED Tue Nov 13 14:55:29 2007 From: babo.online@REDACTED (Attila Babo) Date: Tue, 13 Nov 2007 15:55:29 +0200 Subject: [erlang-questions] Erlang on Windows: Alternative to "make" In-Reply-To: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> References: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> Message-ID: <597c69660711130555r4f2e3d9dkef13388dd3323be1@mail.gmail.com> Take a look at Erlang's own make module, this works well on Windows and very simple to use. A one line no brainer Emakefile is enough for a lot of small application. Attila From mogorman@REDACTED Tue Nov 13 15:13:21 2007 From: mogorman@REDACTED (mog) Date: Tue, 13 Nov 2007 08:13:21 -0600 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <200711130751.lAD7pqOu007371@pluto.hedeland.org> References: <200711130751.lAD7pqOu007371@pluto.hedeland.org> Message-ID: <1194963201.19396.8.camel@metalman.lan> > > > >gen_udp:open(Port, [binary, {active, false}, {reuseaddr, true}, {ip, > >Addr}, {add_membership, {Addr, LAddr}}]). > > > >Where Addr is my multicast Ip, LAddr is my network ip, so sent messages > >are received as 192.168.1.50 instead of 224.0.1.185. > > Hm, I'm afraid I still can't parse the "message received as address" > part:-) - are you referring to the source address of the multicast > packets you send out? If so, why would you expect it to be anything > other than the unicast address of the sender? Sending packets with a > multicast source address should be almost as bad as sending with a > broadcast source address, and such packets will probably be dropped by > most receiving stacks. So udp packets have the following structure. +-------------------+ | Source Address | | Dest Address | | Etc | +-------------------+ so I have machine A which is in the multicast loop, 224.0.1.185, and its local address 192.168.1.50 and machine B which is not, lets say 192.168.1.30. so Machine B sends Machine A a packet which looks like +-------------------------------+ | Source Address: 192.168.1.30 | | Dest Address: 224.0.1.185 | +-------------------------------+ which is right it is 192.168.1.30 and it sent a packet to machine A via its multicast address. when I respond, so machine A sends message to machine B it looks like this +-------------------------------+ | Source Address: 192.168.1.50 | | Dest Address: 192.168.1.30 | +-------------------------------+ which is not what i want. I want this +-------------------------------+ | Source Address: 224.0.1.185 | | Dest Address: 192.168.1.30 | +-------------------------------+ Now im not talking about the protocol im using im talking about the lowest level udp/ip part of the packet that erlang builds for me. thanks for your time everyone Mog -------------- 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 ulf@REDACTED Tue Nov 13 16:52:31 2007 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 13 Nov 2007 16:52:31 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell Message-ID: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> No one commented on my output filters for the shell. Oh well, perhaps it wasn't weird enough... (: Personally, I love them. Working with dicts in the shell has become much more pleasant. Here's a more outlandish idea: Allow for arbitrary syntax to be inserted in the shell, by catching lines starting with '@' (only because this is what Joe used in his ML9). Here's an example: Eshell V5.5.4 (abort with ^G) 1> @ syntax(erlang),import(X,Y). -module(a). -define(X,x). f() -> ?X. @ Env = [{call,1,{atom,1,syntax},[{atom,1,erlang}]}, {call,1,{atom,1,import},[{var,1,'X'},{var,1,'Y'}]}] String = "-module(a).\n-define(X,x).\n\nf() -> ?X.\n\n" (This was as far as I have come. The shell only prints out what it collected.) If a '@' is entered (with an optional sequence of erlang expressions describing what will follow, terminated by a period), the shell will just collect whatever text follows, and return this, instead of calling erl_parse:parse_erl_exprs(). My initial thought was that the default behaviour would be to preprocess String, accepting macro definitions etc, and then expanding macros in the source. This would be configurable in the environment: 2> @ pp(false). L = [a,b,c]. lists:reverse(L). @ [c,b,a] 3> Eventually, this might evolve into accepting a module declaration, but that would require first deciding what to do with the module, once parsed. Compile to binary and then load it? A few ideas about what could be done with this: - by default, no variables would be imported, but selective import might be possible: 4> L = [1,2,3]. 5> @ import(L). lists:reverse(L) @ [3,2,1] - It would be easy to also declare which variables to remember, export(X,Y,Z). - An obvious use of this would be to make it easier to deal with multi- line expressions in the shell. Ever had to copy a multi-line expression *from* the shell, and having to edit away all the garbage? - QuickCheck uses macros a lot. This could offer a way to use QuickCheck with the useful macros from within the shell. (Mats Cronqvist already wrote a preprocessor that pretty much works for this purpose.) - There are a few X-to-Erlang parsers (scheme, haskell, ...) that could be plugged in and used with this. Plug in your own parser. (Should it be possible to import/export variables...? Why not?) I'd have to write some more code to make it reasonably useful, but not too much. It won't break any of the existing stuff. (: Thoughts, flames? BR, Ulf W From rsaccon@REDACTED Tue Nov 13 17:34:26 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Tue, 13 Nov 2007 14:34:26 -0200 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> Message-ID: Ulf, that is great stuff ! Most of all I liked the idea of plugging in an X-to-Erlang parser. I have a real use case for that (I am writing a Javascript to Erlang Parser) regards On Nov 13, 2007 1:52 PM, Ulf Wiger wrote: > No one commented on my output filters for the shell. > Oh well, perhaps it wasn't weird enough... (: > Personally, I love them. Working with dicts in the shell has > become much more pleasant. > > Here's a more outlandish idea: > > Allow for arbitrary syntax to be inserted in the shell, by > catching lines starting with '@' (only because this is what > Joe used in his ML9). > > Here's an example: > > Eshell V5.5.4 (abort with ^G) > 1> @ syntax(erlang),import(X,Y). > -module(a). > -define(X,x). > > f() -> ?X. > > @ > Env = [{call,1,{atom,1,syntax},[{atom,1,erlang}]}, > {call,1,{atom,1,import},[{var,1,'X'},{var,1,'Y'}]}] > String = "-module(a).\n-define(X,x).\n\nf() -> ?X.\n\n" > > (This was as far as I have come. The shell only prints out > what it collected.) > > If a '@' is entered (with an optional sequence of erlang > expressions describing what will follow, terminated by > a period), the shell will just collect whatever text follows, > and return this, instead of calling erl_parse:parse_erl_exprs(). > > My initial thought was that the default behaviour would be > to preprocess String, accepting macro definitions etc, and > then expanding macros in the source. This would be configurable > in the environment: > > 2> @ pp(false). > L = [a,b,c]. > lists:reverse(L). > @ > [c,b,a] > 3> > > Eventually, this might evolve into accepting a module declaration, > but that would require first deciding what to do with the module, > once parsed. Compile to binary and then load it? > > A few ideas about what could be done with this: > > - by default, no variables would be imported, but selective > import might be possible: > > 4> L = [1,2,3]. > 5> @ import(L). > lists:reverse(L) > @ > [3,2,1] > > - It would be easy to also declare which variables to remember, > export(X,Y,Z). > > - An obvious use of this would be to make it easier to deal with multi- > line expressions in the shell. Ever had to copy a multi-line expression > *from* the shell, and having to edit away all the garbage? > > - QuickCheck uses macros a lot. This could offer a way to use > QuickCheck with the useful macros from within the shell. > (Mats Cronqvist already wrote a preprocessor that pretty much > works for this purpose.) > > - There are a few X-to-Erlang parsers (scheme, haskell, ...) that could > be plugged in and used with this. Plug in your own parser. > (Should it be possible to import/export variables...? Why not?) > > I'd have to write some more code to make it reasonably useful, > but not too much. It won't break any of the existing stuff. (: > > Thoughts, flames? > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From ellisonbg.net@REDACTED Tue Nov 13 17:48:21 2007 From: ellisonbg.net@REDACTED (Brian Granger) Date: Tue, 13 Nov 2007 09:48:21 -0700 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: Message-ID: <6ce0ac130711130848u167f2bf8n36fa07edd8126723@mail.gmail.com> > How about a replacement for eBay auctions (or is Erlang what the e > mans now?-)? eBay has fault-tolerance, scale, distribution challenges. > I could sell my old programming books, which have become useless to > me, now that I have started using Erlang ;-) > > Craig's list (http://sfbay.craigslist.org/) has shown that a free > classified-ads system can become popular in over 50 countries. > Go the next step, and provide classified ads and auctions. > > To make it more fun, you could provide several bidding systems, not > just highest bidder, like Dutch Auction, etc. > There has been some pretty sneaky work on designing auctions (a well > known one was the scheme used by the UK government when selling the > 3G mobile phone spectrum), so there is lots of scope for extending > and enhancing the business-process side if anyone wants to do that. > > Anyone who sells anything at auction could use it. Probably payment > would be pushed off to paypal, or any other payment mechanism. > > A good solution would support 'live auctions', and keep the bids in > sequence. > > It'd have some of the challenges of a stock market, but you'd avoid > having to provide liquidity to make it useable (I realise your focus > is a book, but wouldn't you like millions of people to use the > software?). These problem domains lack one thing that makes a stock exchange such an interesting problem - the need for low latency! Building a large scale, distributed, fault-tolerant system is one thing - doing it while maintaining low latency is a whole different ball game. Showing that Erlang is well matched to these problems is a huge thing. > Just a thought, > G Bulmer > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bob@REDACTED Tue Nov 13 18:06:03 2007 From: bob@REDACTED (Bob Ippolito) Date: Tue, 13 Nov 2007 09:06:03 -0800 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> Message-ID: <6a36e7290711130906l53e34e62l80d9f63259eb185b@mail.gmail.com> Output filters sound really useful, I missed the message because I was traveling :) -bob On 11/13/07, Roberto Saccon wrote: > Ulf, that is great stuff ! Most of all I liked the idea of plugging in > an X-to-Erlang parser. I have a real use case for that (I am writing a > Javascript to Erlang Parser) > > regards > > On Nov 13, 2007 1:52 PM, Ulf Wiger wrote: > > No one commented on my output filters for the shell. > > Oh well, perhaps it wasn't weird enough... (: > > Personally, I love them. Working with dicts in the shell has > > become much more pleasant. > > > > Here's a more outlandish idea: > > > > Allow for arbitrary syntax to be inserted in the shell, by > > catching lines starting with '@' (only because this is what > > Joe used in his ML9). > > > > Here's an example: > > > > Eshell V5.5.4 (abort with ^G) > > 1> @ syntax(erlang),import(X,Y). > > -module(a). > > -define(X,x). > > > > f() -> ?X. > > > > @ > > Env = [{call,1,{atom,1,syntax},[{atom,1,erlang}]}, > > {call,1,{atom,1,import},[{var,1,'X'},{var,1,'Y'}]}] > > String = "-module(a).\n-define(X,x).\n\nf() -> ?X.\n\n" > > > > (This was as far as I have come. The shell only prints out > > what it collected.) > > > > If a '@' is entered (with an optional sequence of erlang > > expressions describing what will follow, terminated by > > a period), the shell will just collect whatever text follows, > > and return this, instead of calling erl_parse:parse_erl_exprs(). > > > > My initial thought was that the default behaviour would be > > to preprocess String, accepting macro definitions etc, and > > then expanding macros in the source. This would be configurable > > in the environment: > > > > 2> @ pp(false). > > L = [a,b,c]. > > lists:reverse(L). > > @ > > [c,b,a] > > 3> > > > > Eventually, this might evolve into accepting a module declaration, > > but that would require first deciding what to do with the module, > > once parsed. Compile to binary and then load it? > > > > A few ideas about what could be done with this: > > > > - by default, no variables would be imported, but selective > > import might be possible: > > > > 4> L = [1,2,3]. > > 5> @ import(L). > > lists:reverse(L) > > @ > > [3,2,1] > > > > - It would be easy to also declare which variables to remember, > > export(X,Y,Z). > > > > - An obvious use of this would be to make it easier to deal with multi- > > line expressions in the shell. Ever had to copy a multi-line expression > > *from* the shell, and having to edit away all the garbage? > > > > - QuickCheck uses macros a lot. This could offer a way to use > > QuickCheck with the useful macros from within the shell. > > (Mats Cronqvist already wrote a preprocessor that pretty much > > works for this purpose.) > > > > - There are a few X-to-Erlang parsers (scheme, haskell, ...) that could > > be plugged in and used with this. Plug in your own parser. > > (Should it be possible to import/export variables...? Why not?) > > > > I'd have to write some more code to make it reasonably useful, > > but not too much. It won't break any of the existing stuff. (: > > > > Thoughts, flames? > > > > BR, > > Ulf W > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Roberto Saccon > http://rsaccon.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From gbulmer@REDACTED Tue Nov 13 19:09:23 2007 From: gbulmer@REDACTED (G Bulmer) Date: Tue, 13 Nov 2007 18:09:23 +0000 Subject: [erlang-questions] DTrace for Erlang Message-ID: Is anyone working on building an Erlang DTrace provider? I realise DTrace isn't available on all Erlang platforms, but now that DTrace is available Mac OS X (Leopard), as well as Solaris (and FeeeBSD), I feel it might be worth doing. About DTrace ------------------- For those of you unfamiliar with DTrace, it is, basically, magic. DTrace provides facilities to trace any program, and many aspects of the OS kernel. It has several critical properties: 1. A program does not need any changes (no need to compile for debug, or anything like that). All existing programs work (to some extent). 2. When not DTrace'ing, the cost of being DTrace-able is almost zero (claimed < 0.5%) and this cost is already included (on Solaris & OS X). 3. It is 'secure', it honours the access control mechanisms of the host OS. 4. DTrace can cross process boundaries, and trace the kernel itself (if you have the appropriate security privileges) These features allow DTrace to be used in *PRODUCTION*. Put another way: it is straightforward to trace through a program in a user process, back out through the kernel, then into other processes. Tracing can be activated *after* a program has been deployed and started *without* changing the program or restarting it. DTrace overhead, when not tracing a program is (claimed to be) essentially zero, and DTrace costs when activated are (claimed to be) low. DTrace is programmable, with a scripting language a bit like awk but without loops; instead of awk text patterns, DTrace probes are pattern matched to trigger script actions. Scripting lets you correlate events across processes and the kernel, and scripts can process the data so that 'noise' can be filtered out. For example, it is feasible to trace from an incoming HTTP request through a web server, through the kernel, to an application server, and back again and correlate many concurrent flows. You might want to time that end- to-end flow, or gather intermediate timing, or watch for a particular access to a specific file, or ..., and the scripting language and functions are powerful enough to do that. If you are interested look at http://www.sun.com/bigadmin/content/ dtrace/ There is an outline about how to add probes to an application here: http://docs.sun.com/app/docs/doc/817-6223/chp-usdt Here is a little bit about providers and naming the probes: http:// www.solarisinternals.com/wiki/index.php/DTrace_Topics_Providers Here's an article: http://www.devx.com/Java/Article/33943 (trying google "DTrace Java examples") Here's more DTrace bloggyness at the 'Dtrace Three': http:// blogs.sun.com/ahl/ http://blogs.sun.com/bmc/ http://blogs.sun.com/mws/ I believe there is work on Ruby, Perl and Python DTrace providers too. Why an Erlang DTrace provider? --------------------------------------- So I hear you ask, why build a DTrace provider for erl when DTrace already works (on Solaris and Leopard) with erl? Well, DTrace will show which functions are called in the erl program (and which file descriptors and sockets are used, etc.), but will *not* show you the Erlang program events directly. Java 6 implement a DTrace provider, which surfaces Java method calls, class loading/unloading, the garbage collector, concurrency monitors etc. (rather than the details of the JVM, which are available anyway). So, I am suggesting an erl DTrace provider would show similar things, specifically: - module loading/unloading, - function calls (and maybe exits), - garbage collection events, - Erlang-process state/context-switching, - message send/receive. This would likely be sufficient for most purposes when combined with the existing DTrace support for tracing TCP and UDP sockets, file access etc from the erl process. Mac OS X 'Leopard' comes with a fancy GUI to show DTrace events, so that would give something like the new Percept but for many different types of event, not just process state. If I were building a large, complex system, availability of DTrace would be an important consideration. I believe several companies claim they moved to Solaris to get DTrace, and having used it for simple debugging and tuning, I can believe that. DTrace is so useful, that the erl developers and maintainers may find it extremely useful for debugging, testing, and tuning Erlang itself. Could I raise it as an EEP, or is it already on the TODO list? Garry From jan@REDACTED Tue Nov 13 19:20:56 2007 From: jan@REDACTED (Jan Henry Nystrom) Date: Tue, 13 Nov 2007 19:20:56 +0100 Subject: [erlang-questions] DTrace for Erlang In-Reply-To: References: Message-ID: <4739EB08.9010206@erlang-consulting.com> Hi Garry, You should probably have a look at the trace functionality built in in Erlang(the trace bif with the dbg library). That extended with a few bits and bobs would probably provide you with most of you need. /Cheers Henry G Bulmer wrote: > Is anyone working on building an Erlang DTrace provider? > > I realise DTrace isn't available on all Erlang platforms, but now > that DTrace is available Mac OS X (Leopard), as well as Solaris (and > FeeeBSD), I feel it might be worth doing. > > About DTrace > ------------------- > For those of you unfamiliar with DTrace, it is, basically, magic. > > DTrace provides facilities to trace any program, and many aspects of > the OS kernel. It has several critical properties: > 1. A program does not need any changes (no need to compile for debug, > or anything like that). All existing programs work (to some extent). > 2. When not DTrace'ing, the cost of being DTrace-able is almost zero > (claimed < 0.5%) and this cost is already included (on Solaris & OS X). > 3. It is 'secure', it honours the access control mechanisms of the > host OS. > 4. DTrace can cross process boundaries, and trace the kernel itself > (if you have the appropriate security privileges) > These features allow DTrace to be used in *PRODUCTION*. > > Put another way: it is straightforward to trace through a program in > a user process, back out through the kernel, then into other > processes. Tracing can be activated *after* a program has been > deployed and started *without* changing the program or restarting it. > DTrace overhead, when not tracing a program is (claimed to be) > essentially zero, and DTrace costs when activated are (claimed to be) > low. > > DTrace is programmable, with a scripting language a bit like awk but > without loops; instead of awk text patterns, DTrace probes are > pattern matched to trigger script actions. Scripting lets you > correlate events across processes and the kernel, and scripts can > process the data so that 'noise' can be filtered out. For example, it > is feasible to trace from an incoming HTTP request through a web > server, through the kernel, to an application server, and back again > and correlate many concurrent flows. You might want to time that end- > to-end flow, or gather intermediate timing, or watch for a particular > access to a specific file, or ..., and the scripting language and > functions are powerful enough to do that. > > If you are interested look at http://www.sun.com/bigadmin/content/ > dtrace/ > There is an outline about how to add probes to an application here: > http://docs.sun.com/app/docs/doc/817-6223/chp-usdt > Here is a little bit about providers and naming the probes: http:// > www.solarisinternals.com/wiki/index.php/DTrace_Topics_Providers > Here's an article: http://www.devx.com/Java/Article/33943 (trying > google "DTrace Java examples") > Here's more DTrace bloggyness at the 'Dtrace Three': http:// > blogs.sun.com/ahl/ http://blogs.sun.com/bmc/ http://blogs.sun.com/mws/ > > I believe there is work on Ruby, Perl and Python DTrace providers too. > > > Why an Erlang DTrace provider? > --------------------------------------- > So I hear you ask, why build a DTrace provider for erl when DTrace > already works (on Solaris and Leopard) with erl? > > Well, DTrace will show which functions are called in the erl program > (and which file descriptors and sockets are used, etc.), but will > *not* show you the Erlang program events directly. > > Java 6 implement a DTrace provider, which surfaces Java method calls, > class loading/unloading, the garbage collector, concurrency monitors > etc. (rather than the details of the JVM, which are available anyway). > > So, I am suggesting an erl DTrace provider would show similar things, > specifically: > - module loading/unloading, > - function calls (and maybe exits), > - garbage collection events, > - Erlang-process state/context-switching, > - message send/receive. > This would likely be sufficient for most purposes when combined with > the existing DTrace support for tracing TCP and UDP sockets, file > access etc from the erl process. Mac OS X 'Leopard' comes with a > fancy GUI to show DTrace events, so that would give something like > the new Percept but for many different types of event, not just > process state. > > If I were building a large, complex system, availability of DTrace > would be an important consideration. I believe several companies > claim they moved to Solaris to get DTrace, and having used it for > simple debugging and tuning, I can believe that. > > DTrace is so useful, that the erl developers and maintainers may find > it extremely useful for debugging, testing, and tuning Erlang itself. > > > Could I raise it as an EEP, or is it already on the TODO list? > > Garry > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Jan Henry Nystrom Training & Research Manager @ Erlang Training and Consulting Ltd http://www.erlang-consulting.com From jan@REDACTED Tue Nov 13 19:30:25 2007 From: jan@REDACTED (Jan Henry Nystrom) Date: Tue, 13 Nov 2007 19:30:25 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> Message-ID: <4739ED41.6030609@erlang-consulting.com> Ulf Wiger wrote: > No one commented on my output filters for the shell. > Oh well, perhaps it wasn't weird enough... (: Now I loved the output filter idea, but did not really have the time to say so. But here I am not so sure. The syntax is, at least to me far from obvious, and I have not felt the shell especially constricting. When I have had to do something more exotic that really got too complicated for the shell, it has always paid of to write a module. That is since I generally have had use of the very same technique again. But since it do not break any existing stuff, fine. But whatever you do, do not get into the general syntax or I will have to learn to read your code :-) /Cheers Henry > Personally, I love them. Working with dicts in the shell has > become much more pleasant. > > Here's a more outlandish idea: > > Allow for arbitrary syntax to be inserted in the shell, by > catching lines starting with '@' (only because this is what > Joe used in his ML9). > > Here's an example: > > Eshell V5.5.4 (abort with ^G) > 1> @ syntax(erlang),import(X,Y). > -module(a). > -define(X,x). > > f() -> ?X. > > @ > Env = [{call,1,{atom,1,syntax},[{atom,1,erlang}]}, > {call,1,{atom,1,import},[{var,1,'X'},{var,1,'Y'}]}] > String = "-module(a).\n-define(X,x).\n\nf() -> ?X.\n\n" > > (This was as far as I have come. The shell only prints out > what it collected.) > > If a '@' is entered (with an optional sequence of erlang > expressions describing what will follow, terminated by > a period), the shell will just collect whatever text follows, > and return this, instead of calling erl_parse:parse_erl_exprs(). > > My initial thought was that the default behaviour would be > to preprocess String, accepting macro definitions etc, and > then expanding macros in the source. This would be configurable > in the environment: > > 2> @ pp(false). > L = [a,b,c]. > lists:reverse(L). > @ > [c,b,a] > 3> > > Eventually, this might evolve into accepting a module declaration, > but that would require first deciding what to do with the module, > once parsed. Compile to binary and then load it? > > A few ideas about what could be done with this: > > - by default, no variables would be imported, but selective > import might be possible: > > 4> L = [1,2,3]. > 5> @ import(L). > lists:reverse(L) > @ > [3,2,1] > > - It would be easy to also declare which variables to remember, > export(X,Y,Z). > > - An obvious use of this would be to make it easier to deal with multi- > line expressions in the shell. Ever had to copy a multi-line expression > *from* the shell, and having to edit away all the garbage? > > - QuickCheck uses macros a lot. This could offer a way to use > QuickCheck with the useful macros from within the shell. > (Mats Cronqvist already wrote a preprocessor that pretty much > works for this purpose.) > > - There are a few X-to-Erlang parsers (scheme, haskell, ...) that could > be plugged in and used with this. Plug in your own parser. > (Should it be possible to import/export variables...? Why not?) > > I'd have to write some more code to make it reasonably useful, > but not too much. It won't break any of the existing stuff. (: > > Thoughts, flames? > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Jan Henry Nystrom Training & Research Manager @ Erlang Training and Consulting Ltd http://www.erlang-consulting.com From vladdu55@REDACTED Tue Nov 13 20:31:49 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 13 Nov 2007 19:31:49 +0000 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> Message-ID: <95be1d3b0711131131oe38b40cjceaf325a0df3f42a@mail.gmail.com> Hi Ulf, I don't use the shell that much :-) On Nov 13, 2007 3:52 PM, Ulf Wiger wrote: > Allow for arbitrary syntax to be inserted in the shell, by > catching lines starting with '@' (only because this is what > Joe used in his ML9). //snip > - There are a few X-to-Erlang parsers (scheme, haskell, ...) that could > be plugged in and used with this. Plug in your own parser. > (Should it be possible to import/export variables...? Why not?) >From where I am standing I don't see a huge difference between what you propose here and what I suggested in my (almost just as uncommented) eep draft about metaprogramming. Besides the syntax which is debatable anyway, I envisioned to use this in regular code, not in the shell. Your @ parse_as(language_x), import(V). stuff in language x using V @ seems to be equivalent to my <|language_x| stuff in language x using ~V |> There would be differences in the implementation, given the different use cases (in the shell vs in regular code), but it feels that they could be unified in a common framework -- what do you think? best regards, Vlad From toby@REDACTED Tue Nov 13 21:11:38 2007 From: toby@REDACTED (Toby Thain) Date: Tue, 13 Nov 2007 18:11:38 -0200 Subject: [erlang-questions] Erlang on Windows: Alternative to "make" In-Reply-To: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> References: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> Message-ID: <27ED0A65-A2E7-4329-B943-7AD147EBDD0F@smartgames.ca> On 12-Nov-07, at 11:45 AM, joe lee wrote: > How do you perform "make" on windows OS, for erlang app? Do you use > cygwin and cd into the location of the erlang app in the windows file > system, eg. c:\erlang\someapps and then perform make? > > Is there a way to compile the erlang app in windows? Although you received many helpful suggestions, the troll is irresistible: Have you considered alternatives to Windows? :) --T > > joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Tue Nov 13 22:27:53 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 13 Nov 2007 22:27:53 +0100 Subject: [erlang-questions] idea: service pack one Message-ID: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Hi everybody, I got fired up with enthusiasm at the Erlang conference - it seems to me that there are a lot of *simple* things we can do that we should have done years ago. The reason was that even though many aspects of the system suck and can be *easily* improved we have learnt to live with the system (warts and all). Now that the book is done my thoughts returned to the Erlang system. Erlang is becoming popular and now needs to address the problems that our new users encounter. To do this I propose a project called "service pack one" (( its an add-on that can be bolted on top of OTP)) (( I don't want to change anything in OTP - just add a free-standing set of scripts that modify the behavior of the system )) Here's a few very simple things to do: (each of the things starting +++ is a little project --- now I'd like volunteers for each project - most of these are pretty easy to hack together a quick and dirty prototype - but needs a little care in getting all the details right) 1 +++ fix nicer error messages (Done - Kenneth showed this) 2 +++ experiment with inheritance (Richard mentioned this) (( I hacked this together today, together with some code that checks for missing calls in imported libraries)) - I can post a longer explanation if you like 3 +++ make Erlang start fast so that people stop winging about it starting slowly. And fix a *small* distribution - here's a minimal version. ((aside - who cares if Erlang starts slowly - it was designed to start once and never stop - we have systems that have run for 5 years - a two seconds start-up time amortized over 5 years is not *too* bad)) (( If you want to make it fast redo the boot scripts - it's all in the documentation ! )) (I tried this yesterday) it's really easy 1) make a boot file (jboot.erl) {script, {"tiny","1.1"}, [{preLoaded,[erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]}, {primLoad, [tiny]}, {kernel_load_completed}, {apply, {tiny, start, []}}]}. 2) write a minimal erlang program tiny.erl start() -> erlang:display'hello world'), erlang:halt(). 3) compile the boot file systools:script2boot("jboot"). 4) run erl -boot jboot This runs in 0.29 secs on my macbook (( for comparison erl -s init stop takes 1.6 seconds) 5) you also need the erl script: #!/bin/sh ROOTDIR=`pwd` BINDIR=$ROOTDIR EMU=beam PROGNAME=`echo $0 | sed 's/.*\///'` export EMU export ROOTDIR export BINDIR export PROGNAME exec $BINDIR/erlexec ${1+"$@"} 6) copy erlexec and beam from the distribution to a local directory. (these can be stripped to remove symbol table info) 7) the result is $ wc erl erlexec beam jboot.boot tiny.beam 10 20 172 erl 58 277 22012 erlexec 4247 35423 1097316 beam 0 5 203 jboot.boot 5 20 708 tiny.beam 4320 35745 1120411 total 1.1 MB and 6 files - not *too* bad 8) for fun I packed stdlib/kernel/compiler in an archive using boot_tools:mk_lib() which packs everything a single 1.14 meg archive (boot_tools is in $DIST/otp_src_R11B-4/erts/boot/src This means we can pack the compiler and base otp system into half a dozen files and under 2.5 Meg (( this was my old sae sysytem that never really made it to the main release)) 4 +++ compile the @spec definitions in comments into code that *dynamically* checks types who cares if it's slow and can't be checked statically - the dynamic check is very useful while developing 5 +++ bundle ejabberd (or yaws) in a standard configuration that ships with Erlang. I talked to Mickael R. about this - if we shipped ejabberd with every Erlang we could easily get tens of thousands of ejabberd servers up and running in the twinkling of an eye. 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop winging 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie dynamic type checking, xref, cover, dialyzer *without* you having to do anything fancy the defaults for compilation should be to throw all checks possible into the compile cycle 8 ++++ make an *erlang* packing mechanism (put the entire application in a .dets file - and NOT .tar.gz or zip file - then define a bundle structure (look at the MAC for inspiration) add application icons and a desktop interface. 9 ++++ interface to flash using flex 2. Solve the GUI problem once and for all as follows repeat after me: client = flash in the browser, server = erlang. Intermediate protocol = flash AMF There are probably more things I could add - feel free to add you pet annoyance that can be easily fixed and we'll put it into service pack one. Cheers /Joe Armstrong From opendev@REDACTED Tue Nov 13 22:31:17 2007 From: opendev@REDACTED (Joern) Date: Tue, 13 Nov 2007 22:31:17 +0100 Subject: [erlang-questions] Erlang on Windows: Alternative to "make" In-Reply-To: <597c69660711130555r4f2e3d9dkef13388dd3323be1@mail.gmail.com> References: <50ec7a2e0711120545l180a5604r22cb1725789cb916@mail.gmail.com> <597c69660711130555r4f2e3d9dkef13388dd3323be1@mail.gmail.com> Message-ID: <9e009ad0711131331m7b2ef3f0n63c82a3ce871374f@mail.gmail.com> Hi Joe, if you are comfortable using Ruby you should consider taking a look at Rake which I use on win32 and -x to build OTP applications. A small Rakefile (not tested, I just cut out a piece of our reasonably large Rakefile) like this should get you started. The application uses the package format and eunit for testing. There's also a native Erlang alternative to plain make somewhere on google code if memory serves right. require 'rake/clean' require 'find' DBDIR = '\"c:/db\"' VER = '1.0' BASEDIR = "lib/myapp-#{VER}" COOKIE = 'mycookie' ABSOLUTE_DIR = File.expand_path('.') SOURCE_DIR = "#{BASEDIR}/src" BINARY_DIR = "#{BASEDIR}/ebin" INCLUDE_DIR = "#{BASEDIR}/include" SOURCES = Rake::FileList["#{SOURCE_DIR}/**/*.erl" ] BINARIES = SOURCES.ext('beam').sub('/src/', '/ebin/') CLASSPATH = Rake::FileList["#{BINARY_DIR}/**/*"].exclude { |f| !File.directory?(f) }.sub(BASEDIR, '') CLEAN.include(Rake::FileList["#{BINARY_DIR}/**"].exclude("**/*.app")) CLOBBER.include('**/*.beam', '**/*.dump', '**/*.bak', 'log/*') COMPILER_FLAGS = [ '+debug_info'] DEFAULT_OPTIONS = [ '+A256', "-mnesia dir #{DBDIR}", '-smp auto', '-sname myapp', "-pz #{BINARY_DIR}", "-setcookie #{COOKIE}" ] EXTRA_ARGUMENTS = [ "-cfg #{BASEDIR}/priv/myapp.cfg" ] ENV['ERL_COMPILER_OPTIONS'] = %Q!{i, "#{ABSOLUTE_DIR}/#{INCLUDE_DIR}" }! task :default => :test rule '.beam' => lambda { |b| b.ext('erl').sub('/ebin/', '/src/') } do |t| current_package = t.name.pathmap('%d') directory(current_package) Rake::Task[current_package].invoke sh "erlc #{COMPILER_FLAGS.join(' ')} -o #{t.name.pathmap('%d')} #{t.source}" end desc 'Compile all sources.' task :compile => BINARIES desc 'Build the documentation.' task :doc do erl :execute => 'ok = edoc:application(myapp, "lib/myapp-1.0", [ { todo, true }, { packages, true } ]).' end desc 'Open a local console.' task :console do erl :options => "-run c cd #{SOURCE_DIR}", :abort => false end desc 'Run all tests.' task :test => [ :compile ] do erl :execute => 'ok = eunit:test().' end def erl(opts = {}) defaults = { :execute => nil, :abort => true, :options => DEFAULT_OPTIONS } opts = defaults.merge(opts) { |k, ov, nv| ov.is_a?(Array) ? ov << nv : nv } opts[:options] << '-run init stop' if opts[:abort] win32 = RUBY_PLATFORM =~ /(win|w)32$/ if !opts[:abort] && !opts[:execute] && win32 shell = 'werl' else shell = 'erl' end execute = "start #{shell} #{opts[:options].join(' ')} #{EXTRA_ARGUMENTS}" execute = "echo #{opts[:execute]} | #{execute}" if opts[:execute] system execute end rgs/joern -- From opendev@REDACTED Tue Nov 13 22:48:39 2007 From: opendev@REDACTED (Joern) Date: Tue, 13 Nov 2007 22:48:39 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <9e009ad0711131348y50ad7234k63dad46177b1bb1e@mail.gmail.com> Hi Joe, On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > There are probably more things I could add - feel free to add you pet > annoyance that can be easily > fixed and we'll put it into service pack one. - Package format = default = no more imports or '.' package ; maybe a cleanup for the default lib? reorganise the otp libraries sp1 (into packages) and simply delegate to the old syntax? - Type contracts! - Line precise error message when compiling with debug info (if that's nothing that's already covered in your bullet point #1) - User defined guards - No more << Length/16 ... Tail/binary >> -> now_use_the_length_to_get_the_real_payload_and_the_crc_and_what_not_else. Uh. Now that I'm finished I realise that's probably NOT in the scope of an SP1 - so maybe ... can we pipe through werl the way we can with erl in SP1? :-) rgs/joern -- From erlang@REDACTED Tue Nov 13 22:48:47 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 13 Nov 2007 22:48:47 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <9b08084c0711131348o6caa4825vb967326c85479c29@mail.gmail.com> Re: flex 2 - has anybody got a *simple* example of a flex 2 application that can communicate with erlang (through AMF) - I'm just reading up on flex 2/air it seems to be a perfect (client side) fit to Erlang /Joe On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > Hi everybody, > > I got fired up with enthusiasm at the Erlang conference - it seems to > me that there are a lot of *simple* things we > can do that we should have done years ago. The reason was that even > though many aspects of the system > suck and can be *easily* improved we have learnt to live with the > system (warts and all). > > Now that the book is done my thoughts returned to the Erlang system. > > Erlang is becoming popular and now needs to address the problems that > our new users encounter. > > To do this I propose a project called "service pack one" (( its an > add-on that can be bolted on top of OTP)) > > (( I don't want to change anything in OTP - just add a free-standing > set of scripts that modify the behavior > of the system )) > > Here's a few very simple things to do: > > (each of the things starting +++ is a little project --- now I'd like > volunteers for each project - most of these are pretty easy > to hack together a quick and dirty prototype - but needs a little care > in getting all the details right) > > > 1 +++ fix nicer error messages (Done - Kenneth showed this) > > 2 +++ experiment with inheritance (Richard mentioned this) (( I hacked > this together today, together with > some code that checks for missing calls in imported libraries)) > - I can post a longer explanation if you like > > 3 +++ make Erlang start fast so that people stop winging about it > starting slowly. And fix a > *small* distribution - here's a minimal version. > > ((aside - who cares if Erlang starts slowly - it was designed to > start once and never stop - we have systems > that have run for 5 years - a two seconds start-up time amortized over > 5 years is not *too* bad)) > > (( If you want to make it fast redo the boot scripts - it's all in > the documentation ! )) > > (I tried this yesterday) it's really easy > > > 1) make a boot file (jboot.erl) > > {script, {"tiny","1.1"}, > [{preLoaded,[erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]}, > {primLoad, [tiny]}, > {kernel_load_completed}, > {apply, {tiny, start, []}}]}. > > 2) write a minimal erlang program > tiny.erl > start() -> erlang:display'hello world'), erlang:halt(). > > 3) compile the boot file > systools:script2boot("jboot"). > > 4) run > erl -boot jboot > > This runs in 0.29 secs on my macbook > > (( for comparison erl -s init stop takes 1.6 seconds) > > 5) you also need the erl script: > > #!/bin/sh > ROOTDIR=`pwd` > BINDIR=$ROOTDIR > EMU=beam > PROGNAME=`echo $0 | sed 's/.*\///'` > export EMU > export ROOTDIR > export BINDIR > export PROGNAME > exec $BINDIR/erlexec ${1+"$@"} > > 6) copy erlexec and beam from the distribution to a local directory. > (these can be stripped to remove symbol table info) > > 7) the result is > > $ wc erl erlexec beam jboot.boot tiny.beam > > 10 20 172 erl > 58 277 22012 erlexec > 4247 35423 1097316 beam > 0 5 203 jboot.boot > 5 20 708 tiny.beam > 4320 35745 1120411 total > > 1.1 MB and 6 files - not *too* bad > > 8) for fun I packed stdlib/kernel/compiler in an archive using > boot_tools:mk_lib() which packs everything a single 1.14 meg archive > (boot_tools is in $DIST/otp_src_R11B-4/erts/boot/src > > This means we can pack the compiler and base otp system into half a dozen files > and under 2.5 Meg > > (( this was my old sae sysytem that never really made it to the main release)) > > 4 +++ compile the @spec definitions in comments into code that > *dynamically* checks types > who cares if it's slow and can't be checked statically - the > dynamic check is very useful > while developing > > 5 +++ bundle ejabberd (or yaws) in a standard configuration that ships > with Erlang. > I talked to Mickael R. about this - if we shipped ejabberd > with every Erlang > we could easily get tens of thousands of ejabberd servers up > and running in > the twinkling of an eye. > > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop winging > > 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie > dynamic type checking, > xref, cover, dialyzer *without* you having to do anything fancy > the defaults for compilation should be to throw all > checks possible into the compile > cycle > > 8 ++++ make an *erlang* packing mechanism (put the entire application > in a .dets file - and NOT > .tar.gz or zip file - then define a bundle structure (look at the MAC > for inspiration) add application icons > and a desktop interface. > > 9 ++++ interface to flash using flex 2. Solve the GUI problem once and > for all as follows > > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF > > > There are probably more things I could add - feel free to add you pet > annoyance that can be easily > fixed and we'll put it into service pack one. > > > > Cheers > > /Joe Armstrong > From erlang@REDACTED Tue Nov 13 22:57:17 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 13 Nov 2007 22:57:17 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <9b08084c0711131357n4f89ccban1f14df125b3c575b@mail.gmail.com> More ... The idea of SP2 is to provide a quicker release cycle than OTP. I want to a) add new stuff quickly to the exisiting OTP release. SP2 can add new features to the language. It is then up to the OTP people to decide if they like these features and add them to the main branch. b) encourage community development /Joe On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > Hi everybody, > > I got fired up with enthusiasm at the Erlang conference - it seems to > me that there are a lot of *simple* things we > can do that we should have done years ago. The reason was that even > though many aspects of the system > suck and can be *easily* improved we have learnt to live with the > system (warts and all). > > Now that the book is done my thoughts returned to the Erlang system. > > Erlang is becoming popular and now needs to address the problems that > our new users encounter. > > To do this I propose a project called "service pack one" (( its an > add-on that can be bolted on top of OTP)) > > (( I don't want to change anything in OTP - just add a free-standing > set of scripts that modify the behavior > of the system )) > > Here's a few very simple things to do: > > (each of the things starting +++ is a little project --- now I'd like > volunteers for each project - most of these are pretty easy > to hack together a quick and dirty prototype - but needs a little care > in getting all the details right) > > > 1 +++ fix nicer error messages (Done - Kenneth showed this) > > 2 +++ experiment with inheritance (Richard mentioned this) (( I hacked > this together today, together with > some code that checks for missing calls in imported libraries)) > - I can post a longer explanation if you like > > 3 +++ make Erlang start fast so that people stop winging about it > starting slowly. And fix a > *small* distribution - here's a minimal version. > > ((aside - who cares if Erlang starts slowly - it was designed to > start once and never stop - we have systems > that have run for 5 years - a two seconds start-up time amortized over > 5 years is not *too* bad)) > > (( If you want to make it fast redo the boot scripts - it's all in > the documentation ! )) > > (I tried this yesterday) it's really easy > > > 1) make a boot file (jboot.erl) > > {script, {"tiny","1.1"}, > [{preLoaded,[erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]}, > {primLoad, [tiny]}, > {kernel_load_completed}, > {apply, {tiny, start, []}}]}. > > 2) write a minimal erlang program > tiny.erl > start() -> erlang:display'hello world'), erlang:halt(). > > 3) compile the boot file > systools:script2boot("jboot"). > > 4) run > erl -boot jboot > > This runs in 0.29 secs on my macbook > > (( for comparison erl -s init stop takes 1.6 seconds) > > 5) you also need the erl script: > > #!/bin/sh > ROOTDIR=`pwd` > BINDIR=$ROOTDIR > EMU=beam > PROGNAME=`echo $0 | sed 's/.*\///'` > export EMU > export ROOTDIR > export BINDIR > export PROGNAME > exec $BINDIR/erlexec ${1+"$@"} > > 6) copy erlexec and beam from the distribution to a local directory. > (these can be stripped to remove symbol table info) > > 7) the result is > > $ wc erl erlexec beam jboot.boot tiny.beam > > 10 20 172 erl > 58 277 22012 erlexec > 4247 35423 1097316 beam > 0 5 203 jboot.boot > 5 20 708 tiny.beam > 4320 35745 1120411 total > > 1.1 MB and 6 files - not *too* bad > > 8) for fun I packed stdlib/kernel/compiler in an archive using > boot_tools:mk_lib() which packs everything a single 1.14 meg archive > (boot_tools is in $DIST/otp_src_R11B-4/erts/boot/src > > This means we can pack the compiler and base otp system into half a dozen files > and under 2.5 Meg > > (( this was my old sae sysytem that never really made it to the main release)) > > 4 +++ compile the @spec definitions in comments into code that > *dynamically* checks types > who cares if it's slow and can't be checked statically - the > dynamic check is very useful > while developing > > 5 +++ bundle ejabberd (or yaws) in a standard configuration that ships > with Erlang. > I talked to Mickael R. about this - if we shipped ejabberd > with every Erlang > we could easily get tens of thousands of ejabberd servers up > and running in > the twinkling of an eye. > > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop winging > > 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie > dynamic type checking, > xref, cover, dialyzer *without* you having to do anything fancy > the defaults for compilation should be to throw all > checks possible into the compile > cycle > > 8 ++++ make an *erlang* packing mechanism (put the entire application > in a .dets file - and NOT > .tar.gz or zip file - then define a bundle structure (look at the MAC > for inspiration) add application icons > and a desktop interface. > > 9 ++++ interface to flash using flex 2. Solve the GUI problem once and > for all as follows > > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF > > > There are probably more things I could add - feel free to add you pet > annoyance that can be easily > fixed and we'll put it into service pack one. > > > > Cheers > > /Joe Armstrong > From bjorn@REDACTED Tue Nov 13 22:58:58 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 13 Nov 2007 22:58:58 +0100 Subject: [erlang-questions] DTrace for Erlang In-Reply-To: References: Message-ID: G Bulmer writes: > Could I raise it as an EEP, or is it already on the TODO list? It is not on the TODO list, but it does sound interesting. An EEP would be interesting. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From per@REDACTED Tue Nov 13 23:00:14 2007 From: per@REDACTED (Per Hedeland) Date: Tue, 13 Nov 2007 23:00:14 +0100 (CET) Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <1194963201.19396.8.camel@metalman.lan> Message-ID: <200711132200.lADM0EWi024508@pluto.hedeland.org> mog wrote: [ I wrote: ] >> >> Hm, I'm afraid I still can't parse the "message received as address" >> part:-) - are you referring to the source address of the multicast >> packets you send out? If so, why would you expect it to be anything >> other than the unicast address of the sender? Sending packets with a >> multicast source address should be almost as bad as sending with a >> broadcast source address, and such packets will probably be dropped by >> most receiving stacks. [snip] >when I respond, so machine A sends message to machine B it looks like >this >+-------------------------------+ >| Source Address: 192.168.1.50 | >| Dest Address: 192.168.1.30 | >+-------------------------------+ This is correct behaviour. >which is not what i want. I want this > >+-------------------------------+ >| Source Address: 224.0.1.185 | >| Dest Address: 192.168.1.30 | >+-------------------------------+ OK, so it's not the source address of the multicast packets, but the source address of responses to multicast packets, that you want to be the multicast address. Why? It sounds like maybe you are trying to trick some application that expects to send to a unicast address (where getting a response with reversed src <-> dst addresses can be expected) to send to a multicast address instead - probably not a good idea if so. In any case, sending with a multicast source address is "wrong" and just won't work in general at least - e.g. here's a snippet from Linux kernel code, the ip_route_input_slow() function: if (MULTICAST(saddr) || BADCLASS(saddr) || LOOPBACK(saddr)) goto martian_source; I.e. such a packet will be dropped (possibly logged first) by the receiving kernel before it gets anywhere near the intended recipient application. Other stacks may have similar code, though from a quick browse FreeBSD seems to allow a multicast source address (there's a comment to the effect that maybe it shouldn't...). --Per From jao@REDACTED Tue Nov 13 23:00:17 2007 From: jao@REDACTED (Jack Orenstein) Date: Tue, 13 Nov 2007 17:00:17 -0500 (EST) Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <36345.207.190.221.98.1194991217.squirrel@geophile.com> On Tue, November 13, 2007 4:27 pm, Joe Armstrong wrote: > Erlang is becoming popular and now needs to address the problems that > our new users encounter. As someone on the learning curve right now, I think this is a great idea. > 1 +++ fix nicer error messages (Done - Kenneth showed this) This would be very useful. I've spent a lot of time puzzling over various occurrences of badarg, noproc, function_clause and others. Related to this: stacks with line numbers (at least for the topmost frame) would be a big improvement. > 4 +++ compile the @spec definitions in comments into code that > *dynamically* checks types > who cares if it's slow and can't be checked statically - the > dynamic check is very useful > while developing This would be nice, but it hasn't been as big an issue for me as error messages and line numbers. (Maybe type-checking will be more important to me once I develop a larger body of code.) One last suggestion: I have been debugging my code by logging. Each log line begins with a timestamp, node, module and line. I would like to print terms using ~p, but if I do that, then I can no longer sort properly, because the multiline ~p output omits the prefix values (timestamp, node, etc.) So I use ~w, which is not very readable for nested structures, but then sorting works. I think it would be very useful to have some way of using ~p but still including my own logging at the beginning of each line of output. It's entirely possible I'm going about logging all wrong, or maybe there's some neat language or library trick I don't know about. It would be nice if this service pack helped, either with a new BIF or with documentation. Jack Orenstein From codewalkerjoe@REDACTED Wed Nov 14 00:13:15 2007 From: codewalkerjoe@REDACTED (joe lee) Date: Tue, 13 Nov 2007 18:13:15 -0500 Subject: [erlang-questions] Maven install problem: erlang-plugin and erlang-archetype Message-ID: <50ec7a2e0711131513p4f6aa58cm34f433867ba35256@mail.gmail.com> Has anyone successfully installed maven erlang-plugin and maven erlang-archetype? I have checked out the svn version of maven erlang-plugin and maven erlang-archetype and I am trying to install. When I perform mvn -e install for both maven erlang packages,I get the the following error for both installation: [INFO] Scanning for projects... Downloading: http://people.apache.org/maven-snapshot-repository/org/erlang/maven /maven-erlang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom Downloading: http://snapshots.repository.codehaus.org/org/erlang/maven/maven-erl ang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Here is hte complete logs of mvn install of maven erlang-pluging and maven erlang-archetype: C:\erlang_stuff\erlang-plugin>mvn -e install + Error stacktraces are turned on. [INFO] Scanning for projects... Downloading: http://people.apache.org/maven-snapshot-repository/org/erlang/maven /maven-erlang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom Downloading: http://snapshots.repository.codehaus.org/org/erlang/maven/maven-erl ang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: org.erlang.maven:erlang-plugin:maven-plugin:1.0-SNAPSHOT Reason: Cannot find parent: org.erlang.maven:maven-erlang for project: org.erlan g.maven:erlang-plugin:maven-plugin:1.0-SNAPSHOT for project org.erlang.maven:erl ang-plugin:maven-plugin:1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.erlang .maven:maven-erlang for project: org.erlang.maven:erlang-plugin:maven-plugin:1.0 -SNAPSHOT for project org.erlang.maven:erlang-plugin:maven-plugin:1.0-SNAPSHOT at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:290) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:280) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent : org.erlang.maven:maven-erlang for project: org.erlang.maven:erlang-plugin:mave n-plugin:1.0-SNAPSHOT for project org.erlang.maven:erlang-plugin:maven-plugin:1. 0-SNAPSHOT at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1261) at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def aultMavenProjectBuilder.java:747) at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi leInternal(DefaultMavenProjectBuilder.java:479) at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave nProjectBuilder.java:200) at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:553) at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:467) at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:364) ... 11 more Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.erlang.ma ven:maven-erlang' not found in repository: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) for project org.erlang.maven:maven-erlang at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:573) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1257) ... 17 more Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:197) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:73) at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:526) ... 18 more Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to downl oad the artifact from any repository at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(Def aultWagonManager.java:324) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:185) ... 20 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Tue Nov 13 17:00:22 EST 2007 [INFO] Final Memory: 1M/4M [INFO] ------------------------------------------------------------------------ C:\erlang_stuff\erlang-plugin> ================================================================================================= C:\erlang_stuff\erlang-archetype>mvn -e install + Error stacktraces are turned on. [INFO] Scanning for projects... Downloading: http://people.apache.org/maven-snapshot-repository/org/erlang/maven /maven-erlang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom Downloading: http://snapshots.repository.codehaus.org/org/erlang/maven/maven-erl ang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: org.erlang.maven:erlang-archetype:maven-plugin:1.0-SNAPSHOT Reason: Cannot find parent: org.erlang.maven:maven-erlang for project: org.erlan g.maven:erlang-archetype:maven-plugin:1.0-SNAPSHOT for project org.erlang.maven: erlang-archetype:maven-plugin:1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.erlang .maven:maven-erlang for project: org.erlang.maven:erlang-archetype:maven-plugin: 1.0-SNAPSHOT for project org.erlang.maven:erlang-archetype:maven-plugin:1.0-SNAP SHOT at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:290) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:280) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent : org.erlang.maven:maven-erlang for project: org.erlang.maven:erlang-archetype:m aven-plugin:1.0-SNAPSHOT for project org.erlang.maven:erlang-archetype:maven-plu gin:1.0-SNAPSHOT at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1261) at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def aultMavenProjectBuilder.java:747) at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi leInternal(DefaultMavenProjectBuilder.java:479) at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave nProjectBuilder.java:200) at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:553) at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:467) at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:364) ... 11 more Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.erlang.ma ven:maven-erlang' not found in repository: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) for project org.erlang.maven:maven-erlang at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:573) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1257) ... 17 more Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:197) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:73) at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:526) ... 18 more Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to downl oad the artifact from any repository at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(Def aultWagonManager.java:324) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:185) ... 20 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Tue Nov 13 17:03:36 EST 2007 [INFO] Final Memory: 1M/4M [INFO] ------------------------------------------------------------------------ C:\erlang_stuff\erlang-archetype> From yerl@REDACTED Tue Nov 13 23:34:05 2007 From: yerl@REDACTED (Yerl) Date: Tue, 13 Nov 2007 23:34:05 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <473A265D.7030409@club-internet.fr> Hi ! > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF > > Cool slogan, but I prefer this one : Repeat after me : client = flash in the browser with OpenLaszlo*, server = erlang Intermediate protocol = UBF** * http://www.openlaszlo.org/ ** http://www.sics.se/~joe/ubf/site/home.html cheers Y. From kip.macy@REDACTED Wed Nov 14 00:36:29 2007 From: kip.macy@REDACTED (Kip Macy) Date: Tue, 13 Nov 2007 15:36:29 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: <473A265D.7030409@club-internet.fr> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> Message-ID: On Nov 13, 2007 2:34 PM, Yerl wrote: > Hi ! > > > repeat after me: client = flash in the browser, server = erlang. > > Intermediate protocol = flash AMF > > > > > Cool slogan, but I prefer this one : > Repeat after me : client = flash in the browser with OpenLaszlo*, server > = erlang > Intermediate protocol = UBF** > > * http://www.openlaszlo.org/ > ** http://www.sics.se/~joe/ubf/site/home.html > OpenLaszlo is very very cool, but a number of the video widgets simply don't work as intended. Ideally you would support both, but if there can be only one it should be Flex. I agree with Joe that a flash derived GUI is the right way to go for the front end. I'm currently using RoR for this, but would like to use erlang if others do the trailblazing. -Kip From bob@REDACTED Wed Nov 14 00:36:13 2007 From: bob@REDACTED (Bob Ippolito) Date: Tue, 13 Nov 2007 15:36:13 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: <473A265D.7030409@club-internet.fr> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> Message-ID: <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> On 11/13/07, Yerl wrote: > Hi ! > > > repeat after me: client = flash in the browser, server = erlang. > > Intermediate protocol = flash AMF > > > > > Cool slogan, but I prefer this one : > Repeat after me : client = flash in the browser with OpenLaszlo*, server > = erlang > Intermediate protocol = UBF** > > * http://www.openlaszlo.org/ > ** http://www.sics.se/~joe/ubf/site/home.html That's a nice dream, but OpenLaszlo doesn't support AS3 (SWF 9) so it can't talk arbitrary TCP (UBF) and it doesn't have the same speed or capabilities as you'd get from the Flex 2 SDK. If you were adamant about going with something non-Adobe I'd think more about haXe than OpenLaszlo. I don't really see the point in talking UBF when AMF is going to be more efficient for the client to deal with, and the code would be more generally useful since it's a (de facto) standard. -bob From rsaccon@REDACTED Wed Nov 14 00:54:12 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Tue, 13 Nov 2007 21:54:12 -0200 Subject: [erlang-questions] idea: service pack one In-Reply-To: <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> Message-ID: I really don't understand why you want flash for the GUI, unless it is a pure AIR project or a specialized video / audio application. But if it is in the browser, then I see only disadvantages: - flash is not part of the browser DOM - Flash is a usability and accessibility nightmare - flash requires Designer comfortable with the proprietary Adobe tools, if you want to customize the look and feel - Flex is like Java: because of its complexity you need specialized tools (Flex SDK, is eclipse + plugin, goodbye emacs) to handle it and I agree with Bob, if flash, and if as open source as possible, than haXe (it is also more performant than AS3 since yesterday, if you follow the haXe blog) On Nov 13, 2007 9:36 PM, Bob Ippolito wrote: > On 11/13/07, Yerl wrote: > > Hi ! > > > > > repeat after me: client = flash in the browser, server = erlang. > > > Intermediate protocol = flash AMF > > > > > > > > Cool slogan, but I prefer this one : > > Repeat after me : client = flash in the browser with OpenLaszlo*, server > > = erlang > > Intermediate protocol = UBF** > > > > * http://www.openlaszlo.org/ > > ** http://www.sics.se/~joe/ubf/site/home.html > > That's a nice dream, but OpenLaszlo doesn't support AS3 (SWF 9) so it > can't talk arbitrary TCP (UBF) and it doesn't have the same speed or > capabilities as you'd get from the Flex 2 SDK. If you were adamant > about going with something non-Adobe I'd think more about haXe than > OpenLaszlo. > > I don't really see the point in talking UBF when AMF is going to be > more efficient for the client to deal with, and the code would be more > generally useful since it's a (de facto) standard. > > -bob > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From jeffm@REDACTED Wed Nov 14 01:11:13 2007 From: jeffm@REDACTED (jm) Date: Wed, 14 Nov 2007 11:11:13 +1100 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> Message-ID: <473A3D21.4010306@ghostgun.com> Roberto Saccon wrote: > I really don't understand why you want flash for the GUI, unless it is > a pure AIR project or a specialized video / audio application. But if > it is in the browser, then I see only disadvantages: > What's the actual intent with this GUI, ie what's the under lying *requirement*. Is it to provide a cross platform gui? A web centric, in rowser, gui or something else? I'm yet to see a truly suitable solution to the idea of a cross platform gui that can be downloaded and just run on the client side. all the various solutions out there have various problem slow, limiting, proprietary, or something else. Someone please prove be wrong. Jeff. From yarivsadan@REDACTED Wed Nov 14 01:49:33 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Tue, 13 Nov 2007 16:49:33 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> Message-ID: <17244f480711131649g4d9bbb05i91a4b4d802a31188@mail.gmail.com> I agree with Roberto. Unless your UI needs to display audio/video/vector graphics/animation, you should avoid Flash/Flex/OpenLazlo and use plain old HTML + Javascript. HTML content is searchable, browsers are ubiquitous, and practically everyone knows HTML whereas relatively few programmers know Flash (which is also proprietary, btw). My (not-so-shocking) take is that, if your Erlang app needs a UI and you don't need front-end features that are can't be implemented in HTML/JS, you're better off using ErlyWeb :) Yariv On Nov 13, 2007 3:54 PM, Roberto Saccon wrote: > I really don't understand why you want flash for the GUI, unless it is > a pure AIR project or a specialized video / audio application. But if > it is in the browser, then I see only disadvantages: > > - flash is not part of the browser DOM > - Flash is a usability and accessibility nightmare > - flash requires Designer comfortable with the proprietary Adobe > tools, if you want to customize the look and feel > - Flex is like Java: because of its complexity you need specialized > tools (Flex SDK, is eclipse + plugin, goodbye emacs) to handle it > > and I agree with Bob, if flash, and if as open source as possible, > than haXe (it is also more performant than AS3 since yesterday, if you > follow the haXe blog) > > > On Nov 13, 2007 9:36 PM, Bob Ippolito wrote: > > On 11/13/07, Yerl wrote: > > > Hi ! > > > > > > > repeat after me: client = flash in the browser, server = erlang. > > > > Intermediate protocol = flash AMF > > > > > > > > > > > Cool slogan, but I prefer this one : > > > Repeat after me : client = flash in the browser with OpenLaszlo*, server > > > = erlang > > > Intermediate protocol = UBF** > > > > > > * http://www.openlaszlo.org/ > > > ** http://www.sics.se/~joe/ubf/site/home.html > > > > That's a nice dream, but OpenLaszlo doesn't support AS3 (SWF 9) so it > > can't talk arbitrary TCP (UBF) and it doesn't have the same speed or > > capabilities as you'd get from the Flex 2 SDK. If you were adamant > > about going with something non-Adobe I'd think more about haXe than > > OpenLaszlo. > > > > I don't really see the point in talking UBF when AMF is going to be > > more efficient for the client to deal with, and the code would be more > > generally useful since it's a (de facto) standard. > > > > -bob > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Roberto Saccon > http://rsaccon.com > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From eajam@REDACTED Wed Nov 14 01:23:07 2007 From: eajam@REDACTED (Alex Alvarez) Date: Wed, 14 Nov 2007 00:23:07 +0000 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> Message-ID: Regarding the gui part, this is kind of like a chicken and egg situation. There's really not a better solution. Each will have it's good and bad. There are several open implementations of amf (http://osflash.org/documentation/amf) around, and I believe that Flex 2 is already open-sourced, which are big pluses. I, for one, don't like Javascript much, but it's certainly the most open solution. Now, I've read that Microsoft is not sure if it wants to implement the latest/upcoming version of Javascript in favor of it's Silverlight platform, in which case Flex (and AIR) seem like a good solution. Again, there'll never be a perfect solution for this. Who knows, maybe JavaFX grows to be something worth the money...Cheers, Alex > Date: Tue, 13 Nov 2007 21:54:12 -0200> From: rsaccon@REDACTED> To: bob@REDACTED> CC: erlang-questions@REDACTED> Subject: Re: [erlang-questions] idea: service pack one> > I really don't understand why you want flash for the GUI, unless it is> a pure AIR project or a specialized video / audio application. But if> it is in the browser, then I see only disadvantages:> > - flash is not part of the browser DOM> - Flash is a usability and accessibility nightmare> - flash requires Designer comfortable with the proprietary Adobe> tools, if you want to customize the look and feel> - Flex is like Java: because of its complexity you need specialized> tools (Flex SDK, is eclipse + plugin, goodbye emacs) to handle it> > and I agree with Bob, if flash, and if as open source as possible,> than haXe (it is also more performant than AS3 since yesterday, if you> follow the haXe blog)> > On Nov 13, 2007 9:36 PM, Bob Ippolito wrote:> > On 11/13/07, Yerl wrote:> > > Hi !> > >> > > > repeat after me: client = flash in the browser, server = erlang.> > > > Intermediate protocol = flash AMF> > > >> > > >> > > Cool slogan, but I prefer this one :> > > Repeat after me : client = flash in the browser with OpenLaszlo*, server> > > = erlang> > > Intermediate protocol = UBF**> > >> > > * http://www.openlaszlo.org/> > > ** http://www.sics.se/~joe/ubf/site/home.html> >> > That's a nice dream, but OpenLaszlo doesn't support AS3 (SWF 9) so it> > can't talk arbitrary TCP (UBF) and it doesn't have the same speed or> > capabilities as you'd get from the Flex 2 SDK. If you were adamant> > about going with something non-Adobe I'd think more about haXe than> > OpenLaszlo.> >> > I don't really see the point in talking UBF when AMF is going to be> > more efficient for the client to deal with, and the code would be more> > generally useful since it's a (de facto) standard.> >> > -bob> >> > _______________________________________________> > erlang-questions mailing list> > erlang-questions@REDACTED> > http://www.erlang.org/mailman/listinfo/erlang-questions> >> > > > -- > Roberto Saccon> http://rsaccon.com> _______________________________________________> erlang-questions mailing list> erlang-questions@REDACTED> http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik.svahn@REDACTED Wed Nov 14 01:52:58 2007 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Wed, 14 Nov 2007 01:52:58 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop winging I guess I am one of the people whinging. :-) I have recently started writing an EEP on various operations on binaries that I would like to see added in a support library (e.g. searching for patterns/multipatterns, splitting by pattern, regex, some of them might be suitable to implement as BIFs, but that is a later question). Is there someone else out there already working on this? If not, please let me know what opertaions you would like to be able to do on binaries. Are there any design patterns or operations on binaries that you keep writing over and over again? Any code involving binaries which could be written in a more elegant way with a support function? Any operations which you feel would be suitable to implement as BIFs? BR /Fredrik From yinso.chen@REDACTED Wed Nov 14 02:28:18 2007 From: yinso.chen@REDACTED (YC) Date: Tue, 13 Nov 2007 17:28:18 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: <17244f480711131649g4d9bbb05i91a4b4d802a31188@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> <17244f480711131649g4d9bbb05i91a4b4d802a31188@mail.gmail.com> Message-ID: <779bf2730711131728p4327116fga24c2702dbe34d66@mail.gmail.com> Whether it's flash or ajax or other platforms, it simply lives outside of erlang. I think it makes sense for erlang to focus on its strength in server development and interfaces, rather than trying to dictate a particular UI solution of which it's not a part of, thus allows developers to make their own decisions. But certainly supporting the necessary protocols will help with that regard :) But if we are talking about tackling protocols, then IMO some other ones are more important (for new comers such as myself) - - better ODBI support (specifically prepared statements) - official native database connectivity support for various databases - including prepared statements as well - official support for other inet protocols such as smtp, imap, etc. And I'm also interested to see leex being included in official distribution sometime in the future ;) My 2 cents, yc On Nov 13, 2007 4:49 PM, Yariv Sadan wrote: > I agree with Roberto. Unless your UI needs to display > audio/video/vector graphics/animation, you should avoid > Flash/Flex/OpenLazlo and use plain old HTML + Javascript. HTML content > is searchable, browsers are ubiquitous, and practically everyone knows > HTML whereas relatively few programmers know Flash (which is also > proprietary, btw). > > My (not-so-shocking) take is that, if your Erlang app needs a UI and > you don't need front-end features that are can't be implemented in > HTML/JS, you're better off using ErlyWeb :) > > Yariv > > On Nov 13, 2007 3:54 PM, Roberto Saccon wrote: > > I really don't understand why you want flash for the GUI, unless it is > > a pure AIR project or a specialized video / audio application. But if > > it is in the browser, then I see only disadvantages: > > > > - flash is not part of the browser DOM > > - Flash is a usability and accessibility nightmare > > - flash requires Designer comfortable with the proprietary Adobe > > tools, if you want to customize the look and feel > > - Flex is like Java: because of its complexity you need specialized > > tools (Flex SDK, is eclipse + plugin, goodbye emacs) to handle it > > > > and I agree with Bob, if flash, and if as open source as possible, > > than haXe (it is also more performant than AS3 since yesterday, if you > > follow the haXe blog) > > > > > > On Nov 13, 2007 9:36 PM, Bob Ippolito wrote: > > > On 11/13/07, Yerl wrote: > > > > Hi ! > > > > > > > > > repeat after me: client = flash in the browser, server = > erlang. > > > > > Intermediate protocol = flash AMF > > > > > > > > > > > > > > Cool slogan, but I prefer this one : > > > > Repeat after me : client = flash in the browser with OpenLaszlo*, > server > > > > = erlang > > > > Intermediate protocol = UBF** > > > > > > > > * http://www.openlaszlo.org/ > > > > ** http://www.sics.se/~joe/ubf/site/home.html > > > > > > That's a nice dream, but OpenLaszlo doesn't support AS3 (SWF 9) so it > > > can't talk arbitrary TCP (UBF) and it doesn't have the same speed or > > > capabilities as you'd get from the Flex 2 SDK. If you were adamant > > > about going with something non-Adobe I'd think more about haXe than > > > OpenLaszlo. > > > > > > I don't really see the point in talking UBF when AMF is going to be > > > more efficient for the client to deal with, and the code would be more > > > generally useful since it's a (de facto) standard. > > > > > > -bob > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > -- > > Roberto Saccon > > http://rsaccon.com > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcaoyuan@REDACTED Wed Nov 14 02:49:48 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Wed, 14 Nov 2007 09:49:48 +0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: On 11/14/07, Fredrik Svahn wrote: > On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop winging > > I guess I am one of the people whinging. :-) > > I have recently started writing an EEP on various operations on > binaries that I would like to see added in a support library (e.g. > searching for patterns/multipatterns, splitting by pattern, regex, > some of them might be suitable to implement as BIFs, but that is a > later question). Is there someone else out there already working on > this? I'd like to see something like: <_:S/binary,'[a-z]','[^abc]','var[0-9]',$x,$/,d,d,d,d,$/,d,d,$/,d,d,$/,_/binary>> where we can wrap any regexp in atom > > If not, please let me know what opertaions you would like to be able > to do on binaries. Are there any design patterns or operations on > binaries that you keep writing over and over again? Any code involving > binaries which could be written in a more elegant way with a support > function? Any operations which you feel would be suitable to implement > as BIFs? > > BR /Fredrik > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- - Caoyuan From harveyd@REDACTED Wed Nov 14 06:37:49 2007 From: harveyd@REDACTED (Dale Harvey) Date: Wed, 14 Nov 2007 05:37:49 +0000 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: >- flash is not part of the browser DOM >- Flash is a usability and accessibility nightmare >- flash requires Designer comfortable with the proprietary Adobe >tools, if you want to customize the look and feel >- Flex is like Java: because of its complexity you need specialized >tools (Flex SDK, is eclipse + plugin, goodbye emacs) to handle it not being part of the dom isnt a problem, it just preceeds the 2nd one, flash isnt a usability nightmare, it is an accessibility nightmare I dont understand why requiring a designer to be reasonably familiar with the designs tools is a problems and yes, you can code flex in emacs, we will be releasing some example client applications that rely on remoting / amf as well as traditional web services / xml / json, probably both flex and xhtml / js. reasonably soon -------------- next part -------------- An HTML attachment was scrubbed... URL: From casper2000a@REDACTED Wed Nov 14 06:40:19 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Wed, 14 Nov 2007 11:10:19 +0530 Subject: [erlang-questions] SCTP status In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <003501c82680$d7afa120$870ee360$@com> Hi, Some time ago, active = true wasn't supported in gen_sctp. Does it support now? Also, when some SCTP User Data sent to far end from this node, even though a SCTP SACK was pending for the previous incoming messages, the SACK doesn't go with this User Data. SACK goes with a delay about 120 ms. 1. How do I configure SACK delay time? Can I use sctp_peer_addr_params or sctp_delayed_ack_time params? Do they provided in the SCTP socket opening times? 2. How can I made the SACK to immediately go, when there're User Data is going, but delay only when there're no User Data. BRgds, - Eranga From mogorman@REDACTED Wed Nov 14 07:12:49 2007 From: mogorman@REDACTED (mog) Date: Wed, 14 Nov 2007 00:12:49 -0600 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <200711132200.lADM0EWi024508@pluto.hedeland.org> References: <200711132200.lADM0EWi024508@pluto.hedeland.org> Message-ID: <1195020769.25864.4.camel@metalman.lan> It seems you are correct, which sucks, multicast seems to be a one way street. You are correct my goal was to have a cloud of machines hidden behind multicast ip, i found a nifty program called packeth that allowed me to forge the packets and all my linux boxes do drop packets that come from a multicast ip although ethereal can see them. Is there anyway to achieve my goal of having a cloud of machines hidden behind one ip? I wanted to be able to have cluster of machines all dealing with this data, i guess i can fall back to my second idea having a fast failover system like carp, but then im back to a 1-1 failover model instead of a cluster. Is anyone doing anything like this Mog -------------- 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 valentin@REDACTED Mon Nov 12 23:01:53 2007 From: valentin@REDACTED (Valentin Micic) Date: Tue, 13 Nov 2007 00:01:53 +0200 Subject: [erlang-questions] Lets build a stock exchange! References: <88E5F692-02C0-4C67-84F5-CB9548903A0F@gmail.com><24162acd0711110254q6c334b2crf9855c743ee5c345@mail.gmail.com><9b08084c0711111345ibfd493eo5453db287a7964ac@mail.gmail.com><00b001c8253f$db70f6c0$6401a8c0@moneymaker2> <007b01c82551$77832040$891ea8c0@SSI.CORP> Message-ID: <00ca01c82577$a43fa6f0$6401a8c0@moneymaker2> Well... it's your time after all. V. Well just wishing to do it is not going to teach you any of these things you've mentioned. ----- Original Message ----- From: "David Mercer" To: "'Erlang Questions'" Sent: Monday, November 12, 2007 7:28 PM Subject: Re: [erlang-questions] Lets build a stock exchange! > Sure, I may not ever build a stock exchange, but I may be building an > e-commerce engine, or a hospital information system, or something else > that > may have very similar reliability, scalability, security, and audit > requirements. > > For that matter, if I plan to build a poker server, I could probably apply > much of what is learned from building a stock exchange. The opposite is > not > necessarily true. I'd much rather see an application that hits more the > sweet spot of Erlang (massive soft-real-time systems) than a toy > application > conjured up to illustrate the same. > > Cheers, > > David > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Valentin Micic > Sent: Monday, November 12, 2007 09:23 > To: Joe Armstrong; Torben Hoffmann > Cc: Erlang Questions > Subject: Re: [erlang-questions] Lets build a stock exchange! > > Would not like to sound negative, but how many people would actually have > a > chance to do something similar (i.e. build a stock exchange system) in > their > > careers? To me, this sounds like teaching someone to build affordable > housing by explaining how to build a pyramid. If the main goal of writing > a > book is to popularize a specific subject, the stock exchange system, IMHO, > would not cut. If you want a popular support, write a book about popular > subject. For example, I think that erlang's implementation of jabber > protocol (XMPP, etc), did a great deal to erlang's popularity...But then > again, how many books do we need? > > V. > > ----- Original Message ----- > From: "Joe Armstrong" > To: "Torben Hoffmann" > Cc: "Erlang Questions" > Sent: Sunday, November 11, 2007 11:45 PM > Subject: Re: [erlang-questions] Lets build a stock exchange! > > >> This sounds like a great idea. >> >> I have no idea whether it would succeed or fail - if it succeeds then >> (gulp) >> >> If it fails the interesting thing is not that it failed but WHY it >> failed. >> >> If things fail and we know why we can do research and fix things. It >> is the existence of things >> that don't work that stimulates software research and development. >> >> Interesting problems are very difficult to think up - asking the right >> question is >> often the really difficult bit - once asked lots of brains can try and >> find the solution. >> >> Joels suggesting poses a difficult question - great - let's try and >> answer > >> it. >> >> If Joel can in any way structure the problem then there are loads of >> us that can try and >> write the individual bits. >> >> Breaking the system is great - a program that breaks the compiler is >> far better than 100 that work. >> >> A program that breaks mnesia is far better than 1000 that work. >> >> If this breaks Erlang great - we can fix it and make an even better >> system. >> >> Breaking stuff is easy - the interesting point is *where* does the system >> break! >> >> /Joe Armstrong >> >> >> >> On Nov 11, 2007 10:10 PM, Torben Hoffmann >> wrote: >>> >>> >>> >>> On Nov 11, 2007 9:43 PM, Christian S wrote: >>> > Anyone know a book on technical requirements that brokers put on stock >>> > exchanges? Order matching procedures, what information do tax offices >>> > want, typical features as in stop-loss rules... >>> > >>> > Oh, and yes. A stock exchange is cooler than poker. >>> >>> It may very well be the case that a stock exchange is cooler than poker, >>> but >>> I think that the poker server has some interesting aspects that could >>> inspire others. E.g., the dynamic allocation of a server to run a new >>> table >>> as well as the handling of the messages between the players is similar >>> in >>> nature to some of the challenges there is in telecom with regards to >>> group >>> calls and where to "host" the call. >>> >>> Furthermore, I would rather see a well-written book on hard-core Erlang >>> hit >>> its window of opportunity than see the whole thing turn into "let's make >>> the >>> coolest application that will never run in real life just in order to >>> spice >>> up a programming book"-kind of projects. >>> >>> A well written book with a clear example of usage including discussions >>> about where the general ideas can be applied is what I would bet my >>> money >>> on. If a potential buyer of the hard-core Erlang book cannot abstract >>> from >>> the specific case study used to teach the principles then it is time to >>> utter "Joe, We have a problem!" ;-) >>> >>> Cheers, >>> Torben >>> >>> P.S. My first reaction to the stock exchange idea was "Wow!! Cool!!!", >>> but >>> then my analytical side issued a kill to that process for the reason >>> listed >>> above. >>> >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://www.erlang.org/mailman/listinfo/erlang-questions >>> > >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From KONGA@REDACTED Wed Nov 14 07:07:42 2007 From: KONGA@REDACTED (Anthony Kong) Date: Wed, 14 Nov 2007 17:07:42 +1100 Subject: [erlang-questions] Maven install problem: erlang-plugin and erlang-archetype In-Reply-To: <50ec7a2e0711131513p4f6aa58cm34f433867ba35256@mail.gmail.com> References: <50ec7a2e0711131513p4f6aa58cm34f433867ba35256@mail.gmail.com> Message-ID: <473B2B5B.664A.00DD.0@stgeorge.com.au> Seem to me maven was unable to download the pom of the snapshot version. (If it is able to download, you will see the size of the download after the 'Downloading:...' line) So, may be you have to find out the repository that houses the artifacts and then add it to your $HOME/.m2/settings.xml. I also don't think the erlang gurus here can help you much with this very maven specific problem. :-) Did you try the plugin's mailing list? Cheers,Anthony >>> "joe lee" 14/11/2007 10:13 am >>> Has anyone successfully installed maven erlang-plugin and maven erlang-archetype? I have checked out the svn version of maven erlang-plugin and maven erlang-archetype and I am trying to install. When I perform mvn -e install for both maven erlang packages,I get the the following error for both installation: [INFO] Scanning for projects... Downloading: http://people.apache.org/maven-snapshot-repository/org/erlang/maven /maven-erlang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom Downloading: http://snapshots.repository.codehaus.org/org/erlang/maven/maven-erl ang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Here is hte complete logs of mvn install of maven erlang-pluging and maven erlang-archetype: C:\erlang_stuff\erlang-plugin>mvn -e install + Error stacktraces are turned on. [INFO] Scanning for projects... Downloading: http://people.apache.org/maven-snapshot-repository/org/erlang/maven /maven-erlang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom Downloading: http://snapshots.repository.codehaus.org/org/erlang/maven/maven-erl ang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: org.erlang.maven:erlang-plugin:maven-plugin:1.0-SNAPSHOT Reason: Cannot find parent: org.erlang.maven:maven-erlang for project: org.erlan g.maven:erlang-plugin:maven-plugin:1.0-SNAPSHOT for project org.erlang.maven:erl ang-plugin:maven-plugin:1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.erlang .maven:maven-erlang for project: org.erlang.maven:erlang-plugin:maven-plugin:1.0 -SNAPSHOT for project org.erlang.maven:erlang-plugin:maven-plugin:1.0-SNAPSHOT at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:290) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:280) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent : org.erlang.maven:maven-erlang for project: org.erlang.maven:erlang-plugin:mave n-plugin:1.0-SNAPSHOT for project org.erlang.maven:erlang-plugin:maven-plugin:1. 0-SNAPSHOT at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1261) at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def aultMavenProjectBuilder.java:747) at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi leInternal(DefaultMavenProjectBuilder.java:479) at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave nProjectBuilder.java:200) at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:553) at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:467) at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:364) ... 11 more Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.erlang.ma ven:maven-erlang' not found in repository: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) for project org.erlang.maven:maven-erlang at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:573) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1257) ... 17 more Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:197) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:73) at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:526) ... 18 more Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to downl oad the artifact from any repository at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(Def aultWagonManager.java:324) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:185) ... 20 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Tue Nov 13 17:00:22 EST 2007 [INFO] Final Memory: 1M/4M [INFO] ------------------------------------------------------------------------ C:\erlang_stuff\erlang-plugin> ================================================================================================= C:\erlang_stuff\erlang-archetype>mvn -e install + Error stacktraces are turned on. [INFO] Scanning for projects... Downloading: http://people.apache.org/maven-snapshot-repository/org/erlang/maven /maven-erlang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom Downloading: http://snapshots.repository.codehaus.org/org/erlang/maven/maven-erl ang/1.0-SNAPSHOT/maven-erlang-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: org.erlang.maven:erlang-archetype:maven-plugin:1.0-SNAPSHOT Reason: Cannot find parent: org.erlang.maven:maven-erlang for project: org.erlan g.maven:erlang-archetype:maven-plugin:1.0-SNAPSHOT for project org.erlang.maven: erlang-archetype:maven-plugin:1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.erlang .maven:maven-erlang for project: org.erlang.maven:erlang-archetype:maven-plugin: 1.0-SNAPSHOT for project org.erlang.maven:erlang-archetype:maven-plugin:1.0-SNAP SHOT at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:290) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:280) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent : org.erlang.maven:maven-erlang for project: org.erlang.maven:erlang-archetype:m aven-plugin:1.0-SNAPSHOT for project org.erlang.maven:erlang-archetype:maven-plu gin:1.0-SNAPSHOT at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1261) at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def aultMavenProjectBuilder.java:747) at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi leInternal(DefaultMavenProjectBuilder.java:479) at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave nProjectBuilder.java:200) at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:553) at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:467) at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:364) ... 11 more Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.erlang.ma ven:maven-erlang' not found in repository: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) for project org.erlang.maven:maven-erlang at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:573) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1257) ... 17 more Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository org.erlang.maven:maven-erlang:pom:1.0-SNAPSHOT from the specified remote repositories: codehaus.org (http://snapshots.repository.codehaus.org), central (http://repo1.maven.org/maven2), apache.org (http://people.apache.org/maven-snapshot-repository) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:197) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:73) at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:526) ... 18 more Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to downl oad the artifact from any repository at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(Def aultWagonManager.java:324) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:185) ... 20 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Tue Nov 13 17:03:36 EST 2007 [INFO] Final Memory: 1M/4M [INFO] ------------------------------------------------------------------------ C:\erlang_stuff\erlang-archetype> _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions ********************************************************************** ***** IMPORTANT INFORMATION ***** This document should be read only by those persons to whom it is addressed and its content is not intended for use by any other persons. If you have received this message in error, please notify us immediately. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. St George Bank Limited AFSL 240997, Advance Asset Management Limited AFSL 240902, St George Life Limited AFSL 240900, ASGARD Capital Management Limited AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. ********************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed Nov 14 08:19:59 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Nov 2007 08:19:59 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <95be1d3b0711132319s5a4cb027y4fa6acc84b3dd0c5@mail.gmail.com> Hi, On Nov 14, 2007 2:49 AM, Caoyuan wrote: > I'd like to see something like: > <_:S/binary,'[a-z]','[^abc]','var[0-9]',$x,$/,d,d,d,d,$/,d,d,$/,d,d,$/,_/binary>> > where we can wrap any regexp in atom a little off-topic: Maybe not _any_ regexp, but a subset -- how would you handle 'a[b-y]+[0-9][^a-z]*u' in a straightforward way? It can't be transformed into a binary with many variables and a lot of guards, it needs a state machine. best regards, Vlad From mats.westin@REDACTED Wed Nov 14 08:35:30 2007 From: mats.westin@REDACTED (Mats Westin) Date: Wed, 14 Nov 2007 08:35:30 +0100 Subject: [erlang-questions] DTrace for Erlang In-Reply-To: References: Message-ID: I agree, DTrace it's a great tool. From an engineers point of view, it's saves huge amount of risk and time. It saves you from guessing. DTrace triggered my switch to mac. I think DTrace is going to make low latency GUI apps possible, on old hardware in the future. :) google: DTrace Scripts http://www.brendangregg.com/dtrace.html http://prefetch.net/articles/solaris.dtracetopten.html /Mats Westin On Nov 13, 2007 7:09 PM, G Bulmer wrote: > Is anyone working on building an Erlang DTrace provider? > > I realise DTrace isn't available on all Erlang platforms, but now > that DTrace is available Mac OS X (Leopard), as well as Solaris (and > FeeeBSD), I feel it might be worth doing. > > About DTrace > ------------------- > For those of you unfamiliar with DTrace, it is, basically, magic. > > DTrace provides facilities to trace any program, and many aspects of > the OS kernel. It has several critical properties: > 1. A program does not need any changes (no need to compile for debug, > or anything like that). All existing programs work (to some extent). > 2. When not DTrace'ing, the cost of being DTrace-able is almost zero > (claimed < 0.5%) and this cost is already included (on Solaris & OS X). > 3. It is 'secure', it honours the access control mechanisms of the > host OS. > 4. DTrace can cross process boundaries, and trace the kernel itself > (if you have the appropriate security privileges) > These features allow DTrace to be used in *PRODUCTION*. > > Put another way: it is straightforward to trace through a program in > a user process, back out through the kernel, then into other > processes. Tracing can be activated *after* a program has been > deployed and started *without* changing the program or restarting it. > DTrace overhead, when not tracing a program is (claimed to be) > essentially zero, and DTrace costs when activated are (claimed to be) > low. > > DTrace is programmable, with a scripting language a bit like awk but > without loops; instead of awk text patterns, DTrace probes are > pattern matched to trigger script actions. Scripting lets you > correlate events across processes and the kernel, and scripts can > process the data so that 'noise' can be filtered out. For example, it > is feasible to trace from an incoming HTTP request through a web > server, through the kernel, to an application server, and back again > and correlate many concurrent flows. You might want to time that end- > to-end flow, or gather intermediate timing, or watch for a particular > access to a specific file, or ..., and the scripting language and > functions are powerful enough to do that. > > If you are interested look at http://www.sun.com/bigadmin/content/ > dtrace/ > There is an outline about how to add probes to an application here: > http://docs.sun.com/app/docs/doc/817-6223/chp-usdt > Here is a little bit about providers and naming the probes: http:// > www.solarisinternals.com/wiki/index.php/DTrace_Topics_Providers > Here's an article: http://www.devx.com/Java/Article/33943 (trying > google "DTrace Java examples") > Here's more DTrace bloggyness at the 'Dtrace Three': http:// > blogs.sun.com/ahl/ http://blogs.sun.com/bmc/ http://blogs.sun.com/mws/ > > I believe there is work on Ruby, Perl and Python DTrace providers too. > > > Why an Erlang DTrace provider? > --------------------------------------- > So I hear you ask, why build a DTrace provider for erl when DTrace > already works (on Solaris and Leopard) with erl? > > Well, DTrace will show which functions are called in the erl program > (and which file descriptors and sockets are used, etc.), but will > *not* show you the Erlang program events directly. > > Java 6 implement a DTrace provider, which surfaces Java method calls, > class loading/unloading, the garbage collector, concurrency monitors > etc. (rather than the details of the JVM, which are available anyway). > > So, I am suggesting an erl DTrace provider would show similar things, > specifically: > - module loading/unloading, > - function calls (and maybe exits), > - garbage collection events, > - Erlang-process state/context-switching, > - message send/receive. > This would likely be sufficient for most purposes when combined with > the existing DTrace support for tracing TCP and UDP sockets, file > access etc from the erl process. Mac OS X 'Leopard' comes with a > fancy GUI to show DTrace events, so that would give something like > the new Percept but for many different types of event, not just > process state. > > If I were building a large, complex system, availability of DTrace > would be an important consideration. I believe several companies > claim they moved to Solaris to get DTrace, and having used it for > simple debugging and tuning, I can believe that. > > DTrace is so useful, that the erl developers and maintainers may find > it extremely useful for debugging, testing, and tuning Erlang itself. > > > Could I raise it as an EEP, or is it already on the TODO list? > > Garry > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf.wiger@REDACTED Wed Nov 14 08:38:31 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 14 Nov 2007 08:38:31 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <95be1d3b0711131131oe38b40cjceaf325a0df3f42a@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <95be1d3b0711131131oe38b40cjceaf325a0df3f42a@mail.gmail.com> Message-ID: <473AA5F7.4060809@ericsson.com> Vlad Dumitrescu wrote: > > From where I am standing I don't see a huge difference between > what you propose here and what I suggested in my (almost just > as uncommented) eep draft about metaprogramming. Besides the > syntax which is debatable anyway, I envisioned to use this > in regular code, not in the shell. The metaprogramming suggestion seemed well thought out. I will take the time to study it more carefully, but for this particular problem, I thought that the syntax didn't quite fit. Otherwise, I agree that much is similar. BR, Ulf W From matthew@REDACTED Wed Nov 14 08:35:41 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 13 Nov 2007 23:35:41 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> Message-ID: On 11/13/07, Alex Alvarez wrote: > There are several open implementations of amf > (http://osflash.org/documentation/amf) around, eswf has code for transforming to and from AMF0 and AMF3: http://eswf.googlecode.com/svn/trunk/src/eswf_amf.erl http://eswf.googlecode.com/svn/trunk/src/eswf_amf3.erl (However, we don't use this particular code in any production services yet, so beware there may be dragons.) > and I believe that Flex 2 is already open-sourced, which are big pluses. Adobe announced that they will have an open source Flex SDK by early 2008, but it's not there yet. The Flex 2 SDK includes the source code for the MX libraries. The Tamarin project is working on a self-hosting ECMAScript 4 (aka ActionScript 3) compiler, but last I read it's not ready for general use yet. Also, I don't think it handles anything but generating ES4 bytecode. I haven't heard of anything about open sourcing the remaining functionality of mxmlc (e.g., embedding assets, handling MXML, generating SWF tags), though those are comparatively minor tasks. From sh@REDACTED Wed Nov 14 08:15:37 2007 From: sh@REDACTED (=?iso-8859-1?Q?S=F8ren_Hilmer?=) Date: Wed, 14 Nov 2007 08:15:37 +0100 (CET) Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131348o6caa4825vb967326c85479c29@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <9b08084c0711131348o6caa4825vb967326c85479c29@mail.gmail.com> Message-ID: <35700.193.3.142.121.1195024537.squirrel@www.widetrail.dk> Well inside the browser Flash has severe limitations, there are usecases where you want the GUI side of the application to access local resources (like get to the filesystem), digital signatures spring to mind. This should be possible using Air, but then you move outside the browser, and that is often a prohibiting factor. Try implementing a digital signature based login for a netbank in Flash, as far as I can tell, that is not doable (love to be proven wrong though), AFAIK the only cross browser technology which will support this scenario is Java Applets (or the new JavaFx). --S?ren -- S?ren Hilmer, M.Sc., M.Crypt. wideTrail Phone: +45 25481225 Pilev?nget 41 Email: sh@REDACTED DK-8961 Alling?bro Web: www.widetrail.dk On Tue, November 13, 2007 22:48, Joe Armstrong wrote: > Re: flex 2 - has anybody got a *simple* example of a flex 2 > application that can communicate with > erlang (through AMF) - I'm just reading up on flex 2/air it seems to > be a perfect (client side) fit to Erlang > > /Joe > > > On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: >> Hi everybody, >> >> I got fired up with enthusiasm at the Erlang conference - it seems to >> me that there are a lot of *simple* things we >> can do that we should have done years ago. The reason was that even >> though many aspects of the system >> suck and can be *easily* improved we have learnt to live with the >> system (warts and all). >> >> Now that the book is done my thoughts returned to the Erlang system. >> >> Erlang is becoming popular and now needs to address the problems that >> our new users encounter. >> >> To do this I propose a project called "service pack one" (( its an >> add-on that can be bolted on top of OTP)) >> >> (( I don't want to change anything in OTP - just add a free-standing >> set of scripts that modify the behavior >> of the system )) >> >> Here's a few very simple things to do: >> >> (each of the things starting +++ is a little project --- now I'd like >> volunteers for each project - most of these are pretty easy >> to hack together a quick and dirty prototype - but needs a little care >> in getting all the details right) >> >> >> 1 +++ fix nicer error messages (Done - Kenneth showed this) >> >> 2 +++ experiment with inheritance (Richard mentioned this) (( I hacked >> this together today, together with >> some code that checks for missing calls in imported libraries)) >> - I can post a longer explanation if you like >> >> 3 +++ make Erlang start fast so that people stop winging about it >> starting slowly. And fix a >> *small* distribution - here's a minimal version. >> >> ((aside - who cares if Erlang starts slowly - it was designed to >> start once and never stop - we have systems >> that have run for 5 years - a two seconds start-up time amortized over >> 5 years is not *too* bad)) >> >> (( If you want to make it fast redo the boot scripts - it's all in >> the documentation ! )) >> >> (I tried this yesterday) it's really easy >> >> >> 1) make a boot file (jboot.erl) >> >> {script, {"tiny","1.1"}, >> [{preLoaded,[erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]}, >> {primLoad, [tiny]}, >> {kernel_load_completed}, >> {apply, {tiny, start, []}}]}. >> >> 2) write a minimal erlang program >> tiny.erl >> start() -> erlang:display'hello world'), erlang:halt(). >> >> 3) compile the boot file >> systools:script2boot("jboot"). >> >> 4) run >> erl -boot jboot >> >> This runs in 0.29 secs on my macbook >> >> (( for comparison erl -s init stop takes 1.6 seconds) >> >> 5) you also need the erl script: >> >> #!/bin/sh >> ROOTDIR=`pwd` >> BINDIR=$ROOTDIR >> EMU=beam >> PROGNAME=`echo $0 | sed 's/.*\///'` >> export EMU >> export ROOTDIR >> export BINDIR >> export PROGNAME >> exec $BINDIR/erlexec ${1+"$@"} >> >> 6) copy erlexec and beam from the distribution to a local directory. >> (these can be stripped to remove symbol table info) >> >> 7) the result is >> >> $ wc erl erlexec beam jboot.boot tiny.beam >> >> 10 20 172 erl >> 58 277 22012 erlexec >> 4247 35423 1097316 beam >> 0 5 203 jboot.boot >> 5 20 708 tiny.beam >> 4320 35745 1120411 total >> >> 1.1 MB and 6 files - not *too* bad >> >> 8) for fun I packed stdlib/kernel/compiler in an archive using >> boot_tools:mk_lib() which packs everything a single 1.14 meg archive >> (boot_tools is in $DIST/otp_src_R11B-4/erts/boot/src >> >> This means we can pack the compiler and base otp system into half a >> dozen files >> and under 2.5 Meg >> >> (( this was my old sae sysytem that never really made it to the main >> release)) >> >> 4 +++ compile the @spec definitions in comments into code that >> *dynamically* checks types >> who cares if it's slow and can't be checked statically - the >> dynamic check is very useful >> while developing >> >> 5 +++ bundle ejabberd (or yaws) in a standard configuration that ships >> with Erlang. >> I talked to Mickael R. about this - if we shipped ejabberd >> with every Erlang >> we could easily get tens of thousands of ejabberd servers up >> and running in >> the twinkling of an eye. >> >> 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop >> winging >> >> 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie >> dynamic type checking, >> xref, cover, dialyzer *without* you having to do anything >> fancy >> the defaults for compilation should be to throw all >> checks possible into the compile >> cycle >> >> 8 ++++ make an *erlang* packing mechanism (put the entire application >> in a .dets file - and NOT >> .tar.gz or zip file - then define a bundle structure (look at the MAC >> for inspiration) add application icons >> and a desktop interface. >> >> 9 ++++ interface to flash using flex 2. Solve the GUI problem once and >> for all as follows >> >> repeat after me: client = flash in the browser, server = erlang. >> Intermediate protocol = flash AMF >> >> >> There are probably more things I could add - feel free to add you pet >> annoyance that can be easily >> fixed and we'll put it into service pack one. >> >> >> >> Cheers >> >> /Joe Armstrong >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vladdu55@REDACTED Wed Nov 14 09:15:06 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Nov 2007 09:15:06 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <473AA5F7.4060809@ericsson.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <95be1d3b0711131131oe38b40cjceaf325a0df3f42a@mail.gmail.com> <473AA5F7.4060809@ericsson.com> Message-ID: <95be1d3b0711140015w63ea00b7leadddca1c3bec4c4@mail.gmail.com> Hi, On Nov 14, 2007 8:38 AM, Ulf Wiger (TN/EAB) wrote: > The metaprogramming suggestion seemed well thought out. > I will take the time to study it more carefully, but > for this particular problem, I thought that the syntax > didn't quite fit. Otherwise, I agree that much is similar. Syntax is almost as much a religion as the choice of programming language or development environment. :-) I still had to choose something in order to be able to show some examples. My only requirement is that syntax for the most used cases should be almost invisible. best regards, Vlad From tobias.lindahl@REDACTED Wed Nov 14 09:20:21 2007 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Wed, 14 Nov 2007 09:20:21 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <473AAFC5.40407@it.uu.se> Joe Armstrong wrote: > 4 +++ compile the @spec definitions in comments into code that > *dynamically* checks types > who cares if it's slow and can't be checked statically - the > dynamic check is very useful > while developing This is on the way through a phd-project by Daniel Luna. It doesn't use the @spec declarations, but the new (and experimental) -spec compiler attributes. However, it should be reasonably easy to make a tool to make the translation. > 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie > dynamic type checking, > xref, cover, dialyzer *without* you having to do anything fancy > the defaults for compilation should be to throw all > checks possible into the compile > cycle Dialyzer could be used with a reduced analysis while compiling. It would only be a complement to using Dialyzer on your application, though. To get the full power of the analysis Dialyzer needs access to all your files at the same time. It seems to me that the same goes for xref. Also, cover and dynamic type checking doesn't become meaningful unless you have a type check, right? I totally agree to the general statement, that you should have to do as little as possible to access the different safety checks and analyses. Tobias > > 8 ++++ make an *erlang* packing mechanism (put the entire application > in a .dets file - and NOT > .tar.gz or zip file - then define a bundle structure (look at the MAC > for inspiration) add application icons > and a desktop interface. > > 9 ++++ interface to flash using flex 2. Solve the GUI problem once and > for all as follows > > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF > > > There are probably more things I could add - feel free to add you pet > annoyance that can be easily > fixed and we'll put it into service pack one. > > > > Cheers > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ft@REDACTED Wed Nov 14 09:19:03 2007 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 14 Nov 2007 09:19:03 +0100 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <1195020769.25864.4.camel@metalman.lan> References: <200711132200.lADM0EWi024508@pluto.hedeland.org> <1195020769.25864.4.camel@metalman.lan> Message-ID: <473AAF77.2090606@it.su.se> mog wrote: > It seems you are correct, which sucks, multicast seems to be a one way > street. You are correct my goal was to have a cloud of machines hidden > behind multicast ip, i found a nifty program called packeth that allowed > me to forge the packets and all my linux boxes do drop packets that come > from a multicast ip although ethereal can see them. Is there anyway to > achieve my goal of having a cloud of machines hidden behind one ip? I > wanted to be able to have cluster of machines all dealing with this > data, i guess i can fall back to my second idea having a fast failover > system like carp, but then im back to a 1-1 failover model instead of a > cluster. Is anyone doing anything like this To jump right into this thread without reading back through it... Other alternatives is using DNS for load sharing (won't help much with failing nodes though), using a load balancer or use some kind of anycast setup (heavily used for example by the DNS root servers). The last one is where you use routing to get traffic destined for a certain IP address to end up at different destination hosts based on for example the region the traffic is sourced from, but discussing that would be quite off topic for this mailing list - use google to search for example "dns anycast" to learn more. /Fredrik From ulf.wiger@REDACTED Wed Nov 14 09:27:28 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 14 Nov 2007 09:27:28 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <95be1d3b0711140015w63ea00b7leadddca1c3bec4c4@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <95be1d3b0711131131oe38b40cjceaf325a0df3f42a@mail.gmail.com> <473AA5F7.4060809@ericsson.com> <95be1d3b0711140015w63ea00b7leadddca1c3bec4c4@mail.gmail.com> Message-ID: <473AB170.4010008@ericsson.com> Vlad Dumitrescu wrote: > Hi, > > On Nov 14, 2007 8:38 AM, Ulf Wiger (TN/EAB) wrote: >> The metaprogramming suggestion seemed well thought out. >> I will take the time to study it more carefully, but >> for this particular problem, I thought that the syntax >> didn't quite fit. Otherwise, I agree that much is similar. > > Syntax is almost as much a religion as the choice of programming > language or development environment. :-) I still had to choose > something in order to be able to show some examples. My only > requirement is that syntax for the most used cases should be almost > invisible. Oh, I feel the need to clarify my previous post: I meant that for *my* particular problem (extending the shell), the syntax didn't quite fit. I do think it fits well when embedded in code, and, as you may have noticed, I used pretty much the same syntax for my output filters. (: BR, Ulf W From thomasl_erlang@REDACTED Wed Nov 14 09:29:50 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 14 Nov 2007 00:29:50 -0800 (PST) Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <466904.91180.qm@web38805.mail.mud.yahoo.com> --- Joe Armstrong wrote: > 4 +++ compile the @spec definitions in comments into > code that > *dynamically* checks types > who cares if it's slow and can't be checked > statically - the > dynamic check is very useful > while developing I have some local code that does this, though the @spec syntax is more like the man pages than edoc, but I assume that the Hipe tools will do (dynamic?) contract checking in the near future? There have been some strong hints about this, at least. Best, Thomas ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs From alexander.lamb@REDACTED Wed Nov 14 09:30:32 2007 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 14 Nov 2007 09:30:32 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131348o6caa4825vb967326c85479c29@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <9b08084c0711131348o6caa4825vb967326c85479c29@mail.gmail.com> Message-ID: The big point here is: - exchanging data to and from the client instead of generating a client layout on the server. (although, you can sometimes do both at the same time) I totally agree the road to follow is RIA. Now, there are several ways of doing this but the first thing to decide on is: - what data format for the data exchange. You suggest AMF which has the advantage of being usable "out of the box" on the Flex side. It has the disadvantage if I am not mistaken to be a proprietary format, not documented (Lazlo, RED5 and others reverse engineered it). Then, there is the protocole. In pur Web world, you are mostly all the time fetching data (or HTML) from the server in HTTP. In trading apps, you are pushing data to the client and there is no need for HTTP. Other data formats could be JSON, Hessian, etc... Transport protocole could be HTTP or AMQP (and there is even an Erlang server for this). Then, there is the mismatch (I think) between the way the client will handle the data (and object graph most of the time) and the way the server sees the data (records being acted upon through functions). Any how, count me in to explore... we are currently begginners here in Erlang but want to migrate part of our business to it (currently on Cayenne / Tapestry / MySQL). In a previous life, I developped a clinical system where the server pushed data to a client written in Flash8. Alex -- Alexander Lamb Founding Associate RODANOTECH S?rl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch Le 13 nov. 07 ? 22:48, Joe Armstrong a ?crit : > Re: flex 2 - has anybody got a *simple* example of a flex 2 > application that can communicate with > erlang (through AMF) - I'm just reading up on flex 2/air it seems to > be a perfect (client side) fit to Erlang > > /Joe > > > On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: >> Hi everybody, >> >> I got fired up with enthusiasm at the Erlang conference - it seems to >> me that there are a lot of *simple* things we >> can do that we should have done years ago. The reason was that even >> though many aspects of the system >> suck and can be *easily* improved we have learnt to live with the >> system (warts and all). >> >> Now that the book is done my thoughts returned to the Erlang system. >> >> Erlang is becoming popular and now needs to address the problems that >> our new users encounter. >> >> To do this I propose a project called "service pack one" (( its an >> add-on that can be bolted on top of OTP)) >> >> (( I don't want to change anything in OTP - just add a free-standing >> set of scripts that modify the behavior >> of the system )) >> >> Here's a few very simple things to do: >> >> (each of the things starting +++ is a little project --- now I'd like >> volunteers for each project - most of these are pretty easy >> to hack together a quick and dirty prototype - but needs a little >> care >> in getting all the details right) >> >> >> 1 +++ fix nicer error messages (Done - Kenneth showed this) >> >> 2 +++ experiment with inheritance (Richard mentioned this) (( I >> hacked >> this together today, together with >> some code that checks for missing calls in imported libraries)) >> - I can post a longer explanation if you like >> >> 3 +++ make Erlang start fast so that people stop winging about it >> starting slowly. And fix a >> *small* distribution - here's a minimal version. >> >> ((aside - who cares if Erlang starts slowly - it was designed to >> start once and never stop - we have systems >> that have run for 5 years - a two seconds start-up time amortized >> over >> 5 years is not *too* bad)) >> >> (( If you want to make it fast redo the boot scripts - it's all in >> the documentation ! )) >> >> (I tried this yesterday) it's really easy >> >> >> 1) make a boot file (jboot.erl) >> >> {script, {"tiny","1.1"}, >> [{preLoaded, >> [erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]}, >> {primLoad, [tiny]}, >> {kernel_load_completed}, >> {apply, {tiny, start, []}}]}. >> >> 2) write a minimal erlang program >> tiny.erl >> start() -> erlang:display'hello world'), erlang:halt(). >> >> 3) compile the boot file >> systools:script2boot("jboot"). >> >> 4) run >> erl -boot jboot >> >> This runs in 0.29 secs on my macbook >> >> (( for comparison erl -s init stop takes 1.6 seconds) >> >> 5) you also need the erl script: >> >> #!/bin/sh >> ROOTDIR=`pwd` >> BINDIR=$ROOTDIR >> EMU=beam >> PROGNAME=`echo $0 | sed 's/.*\///'` >> export EMU >> export ROOTDIR >> export BINDIR >> export PROGNAME >> exec $BINDIR/erlexec ${1+"$@"} >> >> 6) copy erlexec and beam from the distribution to a local directory. >> (these can be stripped to remove symbol table info) >> >> 7) the result is >> >> $ wc erl erlexec beam jboot.boot tiny.beam >> >> 10 20 172 erl >> 58 277 22012 erlexec >> 4247 35423 1097316 beam >> 0 5 203 jboot.boot >> 5 20 708 tiny.beam >> 4320 35745 1120411 total >> >> 1.1 MB and 6 files - not *too* bad >> >> 8) for fun I packed stdlib/kernel/compiler in an archive using >> boot_tools:mk_lib() which packs everything a single 1.14 meg >> archive >> (boot_tools is in $DIST/otp_src_R11B-4/erts/boot/src >> >> This means we can pack the compiler and base otp system into half a >> dozen files >> and under 2.5 Meg >> >> (( this was my old sae sysytem that never really made it to the >> main release)) >> >> 4 +++ compile the @spec definitions in comments into code that >> *dynamically* checks types >> who cares if it's slow and can't be checked statically - the >> dynamic check is very useful >> while developing >> >> 5 +++ bundle ejabberd (or yaws) in a standard configuration that >> ships >> with Erlang. >> I talked to Mickael R. about this - if we shipped ejabberd >> with every Erlang >> we could easily get tens of thousands of ejabberd servers up >> and running in >> the twinkling of an eye. >> >> 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop >> winging >> >> 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie >> dynamic type checking, >> xref, cover, dialyzer *without* you having to do >> anything fancy >> the defaults for compilation should be to throw all >> checks possible into the compile >> cycle >> >> 8 ++++ make an *erlang* packing mechanism (put the entire application >> in a .dets file - and NOT >> .tar.gz or zip file - then define a bundle structure (look at the MAC >> for inspiration) add application icons >> and a desktop interface. >> >> 9 ++++ interface to flash using flex 2. Solve the GUI problem once >> and >> for all as follows >> >> repeat after me: client = flash in the browser, server = erlang. >> Intermediate protocol = flash AMF >> >> >> There are probably more things I could add - feel free to add you pet >> annoyance that can be easily >> fixed and we'll put it into service pack one. >> >> >> >> Cheers >> >> /Joe Armstrong >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vladdu55@REDACTED Wed Nov 14 09:35:05 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Nov 2007 09:35:05 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <95be1d3b0711140034q701ff3d1vb243a4d1552f71bd@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <95be1d3b0711131131oe38b40cjceaf325a0df3f42a@mail.gmail.com> <473AA5F7.4060809@ericsson.com> <95be1d3b0711140015w63ea00b7leadddca1c3bec4c4@mail.gmail.com> <473AB170.4010008@ericsson.com> <95be1d3b0711140034q701ff3d1vb243a4d1552f71bd@mail.gmail.com> Message-ID: <95be1d3b0711140035x5fea9b35pa688202ae4f4cdec@mail.gmail.com> On Nov 14, 2007 9:27 AM, Ulf Wiger (TN/EAB) wrote: > and, as you may have noticed, I used pretty much the same > syntax for my output filters. (: Yes, I did, but didn't want to appear as grudgy so I didn't say anything :-) BTW, you said that this notation would help for multi-line shell expressions. It would be even cooler if the shell could have true multi-line input, meaning that the history would be able to handle that kind of input and even edit it. But I suppose that wouldn't work through telnet to a remote system anyway... best regards, Vlad From thomasl_erlang@REDACTED Wed Nov 14 09:40:07 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 14 Nov 2007 00:40:07 -0800 (PST) Subject: [erlang-questions] idea: service pack one In-Reply-To: <36345.207.190.221.98.1194991217.squirrel@geophile.com> Message-ID: <572946.32522.qm@web38809.mail.mud.yahoo.com> --- Jack Orenstein wrote: > Related to this: stacks with line numbers (at least > for the topmost > frame) would be a big improvement. The smart_exceptions parse transform does a bit of this, but that approach is limited for various technical reasons. I'd also like: - function names associated with raised exceptions - line numbers for undef calls, bad funs, etc - line numbers and variable info for the stack (even if tail recursion makes this incomplete) - line numbers etc. for exceptions when building binaries In short, enriched context information should be available wherever exceptions can be raised. This info should be present in, or accessible from, the 'exception object' or exception reason itself. Best, Thomas ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From tobias.lindahl@REDACTED Wed Nov 14 09:42:01 2007 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Wed, 14 Nov 2007 09:42:01 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <473AAFC5.40407@it.uu.se> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473AAFC5.40407@it.uu.se> Message-ID: <473AB4D9.6070205@it.uu.se> Tobias Lindahl wrote: > Also, cover and dynamic type checking doesn't become meaningful unless > you have a type check, right? Woops, I meant testsuite. Tobias From vladdu55@REDACTED Wed Nov 14 09:50:26 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Nov 2007 09:50:26 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <95be1d3b0711140050q278482cib375bc921810996e@mail.gmail.com> Hi! On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > 9 ++++ interface to flash using flex 2. Solve the GUI problem once and > for all as follows > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF I am not sure if it's the best idea to be locked to a specific protocol and toolkit. An Erlang application can be build completely ui agnostic, a "perfect" business layer that only handles business data and messages. The clients can be various: command-line or gui, desktop or browser based. Now of course, we would like to be able to work with the ui from Erlang too, instead of switching to a different environment. I feel the proper way would be to have a generic library with pluggable backends (X11, gtknode, gtk-server, wxwidgets or whatever). The question is how to fit a generic API on these wildly different backends, preferably without sacrificing anything important and possibly even being able to switch backends more or less seamlessly. I think something in the lines of ex11 could work. We will have inheritance soon ;-) so widgets can be written much more easily. But there's still a lot of work to do. best regards, Vlad From thomasl_erlang@REDACTED Wed Nov 14 09:26:08 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 14 Nov 2007 00:26:08 -0800 (PST) Subject: [erlang-questions] idea: service pack one In-Reply-To: <95be1d3b0711132319s5a4cb027y4fa6acc84b3dd0c5@mail.gmail.com> Message-ID: <908705.56104.qm@web38802.mail.mud.yahoo.com> --- Vlad Dumitrescu wrote: > a little off-topic: Maybe not _any_ regexp, but a > subset -- how would > you handle 'a[b-y]+[0-9][^a-z]*u' in a > straightforward way? It can't > be transformed into a binary with many variables and > a lot of guards, > it needs a state machine. Either that or some compiler magic. An Erlang-level implementation would be fairly straightforward if we had deep guards. Best, Thomas ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From ulf@REDACTED Wed Nov 14 10:59:59 2007 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 14 Nov 2007 10:59:59 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <95be1d3b0711140035x5fea9b35pa688202ae4f4cdec@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <95be1d3b0711131131oe38b40cjceaf325a0df3f42a@mail.gmail.com> <473AA5F7.4060809@ericsson.com> <95be1d3b0711140015w63ea00b7leadddca1c3bec4c4@mail.gmail.com> <473AB170.4010008@ericsson.com> <95be1d3b0711140034q701ff3d1vb243a4d1552f71bd@mail.gmail.com> <95be1d3b0711140035x5fea9b35pa688202ae4f4cdec@mail.gmail.com> Message-ID: <8209f740711140159u42395120w5d5a681d3e602f73@mail.gmail.com> 2007/11/14, Vlad Dumitrescu : > > BTW, you said that this notation would help for multi-line shell > expressions. It would be even cooler if the shell could have true > multi-line input, meaning that the history would be able to handle > that kind of input and even edit it. But I suppose that wouldn't work > through telnet to a remote system anyway... I agree. I've decided to defer that problem, as it is separate from what I'm currently messing with (as in: the code that handles the line editing is in an entirely different module.) So far, I think it helps by just providing a clean, prompt-free area that you can copy/paste to and from e.g. the emacs *scratch* buffer. Here's a progress report - what currently works: Eshell V5.5.4 (abort with ^G) 1> X = x. x The sections delimited by @ have local scope, so we can freely redefine variables. The semantics is like file:script(F), by default. We can control the parsing and semantics through options. 2> @. X = foo. @ foo 3> X. x We can import variables, and also declare/redefine variables on the '@' line: 4> Y=x,Z=z. z 5> @ import(X,Y), Z=zzz. {X,Y,Z}. @ {x,x,zzz} By default, the shell_exp module is called to handle the block. This module does pre-processing, so we can define and use macros: 6> @. -define(X, 17). ?X+?X. @ 34 We can also declare some variables to export out of the local scope. 7> @ export(Res). Res = result. @ result 8> Res. result The callback is shell_exp:parse(Text, Bindings, Env), where Env is an opaque variable, which can be queried through some accessor functions in the shell module: env_get_options(Env) env_get_export(Env) env_get_define(Name, Env) env_get_record(Name, Env) The last two haven't been tested, but I kindof imagined a way to have the shell memorize a macro, much like it can memorize record definitions. The callback function should return {erl_eval, ExprSeq} | {error, Reason} where ExprSeq = [Exprs] Exprs = [Expr] Other return types can be added, for example if parsed forms are returned, which should be compiled into a module. I searched a few minutes for a core erlang evaluator (as I heard rumours of a Haskell- to-core-erlang compiler), but couldn't find one. The handling of options at the @ line is a bit weird. I can document it, but basically, things like P(A1 .. An) would get expanded to the property {P, [A1 .. An]}, P(A) into {P,A}. This is just shorthand for specifying options. History expansion (i.e. e(N) and v(N)) works. You can also write @ mode = exprs. which would mean the same thing as @ {mode, exprs}. (This is just experimental, and easy to change. Yell if it offends you.) If anyone wants to play with some other callback (e.g. parsing some other grammar), let me know, and I'll put up my hack in a subversion repository. BR, Ulf W From vladdu55@REDACTED Wed Nov 14 11:09:26 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Nov 2007 11:09:26 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <908705.56104.qm@web38802.mail.mud.yahoo.com> References: <95be1d3b0711132319s5a4cb027y4fa6acc84b3dd0c5@mail.gmail.com> <908705.56104.qm@web38802.mail.mud.yahoo.com> Message-ID: <95be1d3b0711140209ia821659v707eac400e35373@mail.gmail.com> On Nov 14, 2007 9:26 AM, Thomas Lindgren wrote: > > a little off-topic: Maybe not _any_ regexp, but a > > subset -- how would > > you handle 'a[b-y]+[0-9][^a-z]*u' in a > > straightforward way? It can't > > be transformed into a binary with many variables and > > a lot of guards, > > it needs a state machine. > > Either that or some compiler magic. An Erlang-level > implementation would be fairly straightforward if we > had deep guards. Actually, if there's going to be some magic behind the scenes, why restrict this extended pattern matching to binaries? I would very much like to be able to write something like for example [_*, term1, _+, term2+, _*] = L in order to find out if there is a term1 preceding a series of term2 in the list, with at least one list element between them. In other words, full regexp matching on erlang terms instead of on characters. I suppose this would have to be marked somehow so that it's visible that it isn't the same thing as a normal match (in the same way as deep guards might need to be distinguished from regular ones). best regards, Vlad From azhukov@REDACTED Wed Nov 14 11:43:38 2007 From: azhukov@REDACTED (Alexander Zhukov) Date: Wed, 14 Nov 2007 13:43:38 +0300 Subject: [erlang-questions] Run external program with arguments Message-ID: <87bq9xds4l.fsf@unison.org> Hi! Is there a way to run an external program from Erlang program with arguments? I like to be able to write something like this: Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", "file", "-d"]}]), but so far I can't find a way to run a program with arguments. Yes, I know I can write a wrapper script but I do not like such an approach. -- Alexander Zhukov From mickael.remond@REDACTED Wed Nov 14 12:17:17 2007 From: mickael.remond@REDACTED (=?UTF-8?Q?Micka=C3=ABl_R=C3=A9mond?=) Date: Wed, 14 Nov 2007 12:17:17 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <3DE5502F-39DC-4C08-8528-3F8C1DC239F0@process-one.net> Hello, Le 13 nov. 07 ? 22:27, Joe Armstrong a ?crit : > 9 ++++ interface to flash using flex 2. Solve the GUI problem once and > for all as follows > > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF This is early information, but just for information we have a very advanced Flash server developed in Erlang :) (I know you know Joe, as I made a demo ;) -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain@REDACTED Wed Nov 14 11:01:32 2007 From: sylvain@REDACTED (Sylvain Wallez) Date: Wed, 14 Nov 2007 11:01:32 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <36345.207.190.221.98.1194991217.squirrel@geophile.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <36345.207.190.221.98.1194991217.squirrel@geophile.com> Message-ID: <473AC77C.9070303@apache.org> Jack Orenstein wrote: > On Tue, November 13, 2007 4:27 pm, Joe Armstrong wrote: > > >> Erlang is becoming popular and now needs to address the problems that >> our new users encounter. >> > > As someone on the learning curve right now, I think this > is a great idea. > > >> 1 +++ fix nicer error messages (Done - Kenneth showed this) >> > > This would be very useful. I've spent a lot of time puzzling over > various occurrences of badarg, noproc, function_clause and others. > > Related to this: stacks with line numbers (at least for the topmost > frame) would be a big improvement. > Oh yes, line numbers! Warmly seconded ! Sylvain -- Sylvain Wallez - http://bluxte.net From joelr1@REDACTED Wed Nov 14 12:44:18 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 14 Nov 2007 11:44:18 +0000 Subject: [erlang-questions] Advanced Flash server in Erlang In-Reply-To: <3DE5502F-39DC-4C08-8528-3F8C1DC239F0@process-one.net> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <3DE5502F-39DC-4C08-8528-3F8C1DC239F0@process-one.net> Message-ID: Mikael, On Nov 14, 2007, at 11:17 AM, Micka?l R?mond wrote: > This is early information, but just for information we have a very > advanced Flash server developed in Erlang :) What exactly is a Flash server developed in Erlang and what makes it advanced? Thanks, Joel -- http://wagerlabs.com From yerl@REDACTED Wed Nov 14 12:51:16 2007 From: yerl@REDACTED (Yerl) Date: Wed, 14 Nov 2007 12:51:16 +0100 Subject: [erlang-questions] Run external program with arguments In-Reply-To: <87bq9xds4l.fsf@unison.org> References: <87bq9xds4l.fsf@unison.org> Message-ID: <473AE134.5050008@club-internet.fr> Hi ! Look here : http://easyerl.blogspot.com/search/label/execution http://easyerl.blogspot.com/search/label/process There's a lot of good stuffs like using "ibTRE" regular expression engin ... Good luck cheers Y. Alexander Zhukov a ?crit : > Hi! > > Is there a way to run an external program from Erlang program with > arguments? > > I like to be able to write something like this: > > Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", "file", "-d"]}]), > > but so far I can't find a way to run a program with arguments. > > Yes, I know I can write a wrapper script but I do not like such an > approach. > > From thomasl_erlang@REDACTED Wed Nov 14 12:52:07 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 14 Nov 2007 03:52:07 -0800 (PST) Subject: [erlang-questions] idea: service pack one In-Reply-To: <95be1d3b0711140209ia821659v707eac400e35373@mail.gmail.com> Message-ID: <693886.52749.qm@web38805.mail.mud.yahoo.com> --- Vlad Dumitrescu wrote: > On Nov 14, 2007 9:26 AM, Thomas Lindgren > wrote: > > > a little off-topic: Maybe not _any_ regexp, but > a > > > subset -- how would > > > you handle 'a[b-y]+[0-9][^a-z]*u' in a > > > straightforward way? It can't > > > be transformed into a binary with many variables > and > > > a lot of guards, > > > it needs a state machine. > > > > Either that or some compiler magic. An > Erlang-level > > implementation would be fairly straightforward if > we > > had deep guards. > > Actually, if there's going to be some magic behind > the scenes, why > restrict this extended pattern matching to binaries? Because implementing low-level regexps on strings is fairly well-known. Just because it's magic doesn't mean it includes a kitchen sink :-) > I would very much > like to be able to write something like for example > [_*, term1, _+, term2+, _*] = L > in order to find out if there is a term1 preceding a > series of term2 > in the list, with at least one list element between > them. In other > words, full regexp matching on erlang terms instead > of on characters. Well, that sort of thing is a bit outside the original question of conventional regexps on binaries/strings, but I don't see why you couldn't provide the desired functionality with a suitable parse transform (for instance) and running the code inside a deep guard. (Binary regexps could be done the same way.) Note to those who wonder why I harp on about deep guards: they are basically a convenience to avoid messing around with generating nested case-expressions and code duplication to express the same thing. As an alternative, a 'cond'-expression might serve the same purpose equally well. Cond is closer to reality than deep guards but no, it's not there yet either :-) Best, Thomas ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From mickael.remond@REDACTED Wed Nov 14 12:27:43 2007 From: mickael.remond@REDACTED (=?UTF-8?Q?Micka=C3=ABl_R=C3=A9mond?=) Date: Wed, 14 Nov 2007 12:27:43 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <05F4F687-3465-481F-AF97-7E7B8747E697@process-one.net> Hello, Le 13 nov. 07 ? 22:27, Joe Armstrong a ?crit : > 5 +++ bundle ejabberd (or yaws) in a standard configuration that ships > with Erlang. > I talked to Mickael R. about this - if we shipped ejabberd > with every Erlang > we could easily get tens of thousands of ejabberd servers up > and running in > the twinkling of an eye. Yes. I am still thinking about this one. Another approach might be to provide a central ejabberd for those Erlang nodes to coordinate. We would integrate only an EXMPP library in Erlang. > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop > winging I agree with this one too. > There are probably more things I could add - feel free to add you pet > annoyance that can be easily > fixed and we'll put it into service pack one. One thing that might be usefull too might be a movable garbage collector like the Eiffel one. As there been some experimentation on this one ? The rational behind this is: - Erlang is a long running process. - If the Erlang application has large variation in memory consumption over time (both increase and decrease), it can generate memory fragmentation, that is increased by the fact that Erlang are long running process. - Defragmenting the memory would help for this long running application. -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed Nov 14 13:10:27 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Nov 2007 13:10:27 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <693886.52749.qm@web38805.mail.mud.yahoo.com> References: <95be1d3b0711140209ia821659v707eac400e35373@mail.gmail.com> <693886.52749.qm@web38805.mail.mud.yahoo.com> Message-ID: <95be1d3b0711140410n582ee016k72aa80c0b20deab8@mail.gmail.com> On Nov 14, 2007 12:52 PM, Thomas Lindgren wrote: > Just because it's magic doesn't > mean it includes a kitchen sink :-) Doesn't it?!? *shocked gasp* :-) Yes, this could be addressed by a parse transform, with the small problem that we're limited to Erlang syntax and we would need to either overload existing notation (which works up to a limit) or make the notation verboser than needed. best regards, Vlad From erik.stenman@REDACTED Wed Nov 14 13:42:02 2007 From: erik.stenman@REDACTED (Erik Stenman) Date: Wed, 14 Nov 2007 13:42:02 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <05F4F687-3465-481F-AF97-7E7B8747E697@process-one.net> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <05F4F687-3465-481F-AF97-7E7B8747E697@process-one.net> Message-ID: <20DF5BD9-F0EE-4BA6-819A-026B8609DE99@kreditor.se> On 14 nov 2007, at 12.27, Micka?l R?mond wrote: > > One thing that might be usefull too might be a movable garbage > collector like the Eiffel one. > As there been some experimentation on this one ? > The rational behind this is: > - Erlang is a long running process. > - If the Erlang application has large variation in memory > consumption over time (both increase and decrease), it can generate > memory fragmentation, that is increased by the fact that Erlang are > long running process. > - Defragmenting the memory would help for this long running > application. I am not familiar with the term "movable" GC. Erlang uses a copying collector, i.e. it moves all the data from old space to new space during a GC. This way you get defragmentation for free. /Erik From azhukov@REDACTED Wed Nov 14 15:37:14 2007 From: azhukov@REDACTED (Alexander Zhukov) Date: Wed, 14 Nov 2007 17:37:14 +0300 Subject: [erlang-questions] Run external program with arguments In-Reply-To: <473AE134.5050008@club-internet.fr> (yerl@club-internet.fr's message of "Wed\, 14 Nov 2007 12\:51\:16 +0100") References: <87bq9xds4l.fsf@unison.org> <473AE134.5050008@club-internet.fr> Message-ID: <87ve84dhb9.fsf@unison.org> Sorry, I forget how to write to mailing lists and sent two private replies ;) In summary, os:cmd does not allow to communicate with called program, and open_port does not allow to specify arguments to run program with. As a more general approach than script I decided to write simple C++ program which will read from cin program name and arguments and then will execv. I do like this approach more than script. >>>>> Yerl (Y) writes: Y> Hi ! Look here : Y> http://easyerl.blogspot.com/search/label/execution Y> http://easyerl.blogspot.com/search/label/process Y> There's a lot of good stuffs like using "ibTRE" regular expression Y> engin ... Good luck Y> cheers Y. Y> Alexander Zhukov a ?crit : >> Hi! >> >> Is there a way to run an external program from Erlang program with >> arguments? >> >> I like to be able to write something like this: >> >> Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", >> "file", "-d"]}]), >> >> but so far I can't find a way to run a program with arguments. >> >> Yes, I know I can write a wrapper script but I do not like such an >> approach. >> >> -- Alexander Zhukov From bjorn@REDACTED Wed Nov 14 15:50:26 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Nov 2007 15:50:26 +0100 Subject: [erlang-questions] Run external program with arguments In-Reply-To: <87ve84dhb9.fsf@unison.org> References: <87bq9xds4l.fsf@unison.org> <473AE134.5050008@club-internet.fr> <87ve84dhb9.fsf@unison.org> Message-ID: Alexander Zhukov writes: > In summary, os:cmd does not allow to communicate with called program, > and open_port does not allow to specify arguments to run program with. open_port({spawn,"ls -l"}, []). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From mogorman@REDACTED Wed Nov 14 15:52:16 2007 From: mogorman@REDACTED (mog) Date: Wed, 14 Nov 2007 08:52:16 -0600 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <473AAF77.2090606@it.su.se> References: <200711132200.lADM0EWi024508@pluto.hedeland.org> <1195020769.25864.4.camel@metalman.lan> <473AAF77.2090606@it.su.se> Message-ID: <1195051936.10228.3.camel@metalman.lan> Thanks for all the advice, however, clustering is secondary to fault tolerance to me. I really am trying to build a system with 9 9s of reliability. So I really need a way to have a cloud of computers running under one ip. I imagine i could use a mirrored switch and then forge the udp packets, but I was trying to do this without any custom hardware. Has anyone developed a system like this? and If not how did you reach such high levels of reliability. Mog On Wed, 2007-11-14 at 09:19 +0100, Fredrik Thulin wrote: > mog wrote: > > It seems you are correct, which sucks, multicast seems to be a one way > > street. You are correct my goal was to have a cloud of machines hidden > > behind multicast ip, i found a nifty program called packeth that allowed > > me to forge the packets and all my linux boxes do drop packets that come > > from a multicast ip although ethereal can see them. Is there anyway to > > achieve my goal of having a cloud of machines hidden behind one ip? I > > wanted to be able to have cluster of machines all dealing with this > > data, i guess i can fall back to my second idea having a fast failover > > system like carp, but then im back to a 1-1 failover model instead of a > > cluster. Is anyone doing anything like this > > To jump right into this thread without reading back through it... > > Other alternatives is using DNS for load sharing (won't help much with > failing nodes though), using a load balancer or use some kind of anycast > setup (heavily used for example by the DNS root servers). > > The last one is where you use routing to get traffic destined for a > certain IP address to end up at different destination hosts based on for > example the region the traffic is sourced from, but discussing that > would be quite off topic for this mailing list - use google to search > for example "dns anycast" to learn more. > > /Fredrik > -------------- 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 bob@REDACTED Wed Nov 14 16:16:14 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 14 Nov 2007 07:16:14 -0800 Subject: [erlang-questions] Run external program with arguments In-Reply-To: <87bq9xds4l.fsf@unison.org> References: <87bq9xds4l.fsf@unison.org> Message-ID: <6a36e7290711140716o4f0bbb73y52d1a35f14cb7b0d@mail.gmail.com> The easiest way is to perform shell quoting over the command you want... take a look at mochiweb_util:cmd_port/2. http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl -bob On 11/14/07, Alexander Zhukov wrote: > Hi! > > Is there a way to run an external program from Erlang program with > arguments? > > I like to be able to write something like this: > > Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", "file", "-d"]}]), > > but so far I can't find a way to run a program with arguments. > > Yes, I know I can write a wrapper script but I do not like such an > approach. > > -- > Alexander Zhukov > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tobbe@REDACTED Wed Nov 14 16:37:07 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 14 Nov 2007 16:37:07 +0100 Subject: [erlang-questions] Run external program with arguments In-Reply-To: <6a36e7290711140716o4f0bbb73y52d1a35f14cb7b0d@mail.gmail.com> References: <87bq9xds4l.fsf@unison.org> <6a36e7290711140716o4f0bbb73y52d1a35f14cb7b0d@mail.gmail.com> Message-ID: Bob Ippolito wrote: > The easiest way is to perform shell quoting over the command you > want... take a look at mochiweb_util:cmd_port/2. > > http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl Hm...that join function. Couldn't it be written like: %%----------------------------------------------------------------------------- %% @spec implode(Str::string(), Sep::string()) -> string() %% %% @doc split text at first occurence of Char (Char is not include in Before %% or After parts) %% %% Example: implode(["a","b","c"], ".") => "a.b.c" %% %% @end------------------------------------------------------------------------ implode(Data, Seperator) when is_list(Data) andalso is_list(Seperator) -> lists:foldr(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). Cheers, Tobbe > > -bob > > On 11/14/07, Alexander Zhukov wrote: >> Hi! >> >> Is there a way to run an external program from Erlang program with >> arguments? >> >> I like to be able to write something like this: >> >> Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", "file", "-d"]}]), >> >> but so far I can't find a way to run a program with arguments. >> >> Yes, I know I can write a wrapper script but I do not like such an >> approach. >> >> -- >> Alexander Zhukov >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From blblack@REDACTED Wed Nov 14 16:48:37 2007 From: blblack@REDACTED (Brandon Black) Date: Wed, 14 Nov 2007 09:48:37 -0600 Subject: [erlang-questions] idea: service pack one In-Reply-To: <779bf2730711131728p4327116fga24c2702dbe34d66@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> <17244f480711131649g4d9bbb05i91a4b4d802a31188@mail.gmail.com> <779bf2730711131728p4327116fga24c2702dbe34d66@mail.gmail.com> Message-ID: <84621a60711140748u23b6d8adm9c79c7703f977046@mail.gmail.com> [oops, I sent this directly to YC earlier, can we get a Reply-To header on the list?] On Nov 13, 2007 7:28 PM, YC wrote: > Whether it's flash or ajax or other platforms, it simply lives outside of > erlang. I think it makes sense for erlang to focus on its strength in > server development and interfaces, rather than trying to dictate a > particular UI solution of which it's not a part of, thus allows developers > to make their own decisions. But certainly supporting the necessary > protocols will help with that regard :) > > But if we are talking about tackling protocols, then IMO some other ones are > more important (for new comers such as myself) - > > - better ODBI support (specifically prepared statements) > - official native database connectivity support for various databases - > including prepared statements as well > - official support for other inet protocols such as smtp, imap, etc. > > And I'm also interested to see leex being included in official distribution > sometime in the future ;) > > My 2 cents, > yc > I view things like database and mail protocols similarly to how you (and I) view UIs - these are things that belong in extension libraries, not as some core part of a language distribution. The popular protocols will change over time, and the popular implementations of those protocols will change as well. Old implementations will naturally be replaced with increasingly superior abstractions if you let the more external stuff evolve in a darwinian fashion somewhere like CEAN. Even really good implementations will get replaced by newer ones that follow newer and better best practices that evolve over the years. Embedding early implementations of what's popular today into the main distro is counterproductive if anything. Once you bundle something with the core, your stuck with it as legacy baggage for a very long time for fear of breaking upgraders, and people tend to use it "because it's there" long after it's a very unrecommended practice to still be using it. Keep the core as minimal as possible, IMHO. Here's my personal shortlist of the most important usability improvements. These are the ones I think are the real "high value targets" for making Erlang more accessible and giving it a brighter future: 1) Explicit versioned compile/run-time module dependency and autoloading. Basically, the equivalent of the Perl idiom where if the package "HTTP" needs to make use of the package "TCP", it can have a single statement near the top that says "use TCP v0.02", and the TCP module will be loaded/compiled/whatever if it isn't already, and checked for minimum version requirements. 2) Hierarchical module namespace. Flat namespace (or random conventions for hierarchy with random local policies about separators) is not conducive to having a well-organized CEAN. [Can you tell yet that all of my suggestions boil down to stealing the best things from Perl?] 3) Integrate CEAN with the main distribution, in the same way that a stock Perl install comes with a CPAN module and a "cpan" commandline program, which together with the bundled build/make tools can be used to automatically fetch CPAN modules and automatically resolve their dependencies on other CPAN modules. This probably means coming up with distribution-level (where a distribution is a collection of related modules published by an author to CEAN as a unit in a single archive of some kind) and module-level metadata standards. I"m sure that given that CEAN exists, some work has been done on this front already, but I haven't looked at it in detail. 4) Simple code inheritance for the simple sake of easy reuse by importing functions from other modules (some of which might be "abstract" in the sense that they are useless other than to provide said shared common code to child modules). No need to get into OO modeling crap here, this is just about typing less to get the same job done. Sometimes the idea of abstracting things as generalized functions with function reference arguments and/or return values makes the most sense, but at other times, code inheritance really makes more sense. I would recommend that we study other language's models here and do it right from the start, instead of trying to hackishly alter this as we go down the road. The big decisions, and how I feel about them (feel free to disagree): A) Single Inheritance vs Multiple Inheritance vs Roles/Traits - Roles/Traits is arguably superior, but MI is sometimes easier for people who haven't grasped the necessary level of meta-ness. There's no good reason a language can't support both of course. Having neither (meaning that one can only have simple singular inheritance) is very limiting, so if you don't put them in the core, someone will hack them on later and do it with less care for correctness. I would highly recommend C3 as the algorithm for MI if implemented, it fixes the diamond-shaped problems, etc. http://en.wikipedia.org/wiki/C3_linearization . The wiki entry is a little out of date, in that it doesn't mention that C3 will also be available (but not the default) in the next major release of Perl 5 (I did that work, so I've got some level of experience to contribute here on implementing this stuff). B) Compiletime vs Runtime. Runtime-modifiable inheritance (and I don't mean during Erlang-style code upgrades, I mean at actual runtime in a single version of the code) is a lot trickier to implement, and I think it's probably a very poor fit for Erlang anyways. Compile-time-only inheritance (specified in some module-level metadata fields) would be simpler and a good fit. -- Brandon From richardc@REDACTED Wed Nov 14 16:20:09 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 14 Nov 2007 16:20:09 +0100 Subject: [erlang-questions] Run external program with arguments In-Reply-To: <87ve84dhb9.fsf@unison.org> References: <87bq9xds4l.fsf@unison.org> <473AE134.5050008@club-internet.fr> <87ve84dhb9.fsf@unison.org> Message-ID: <473B1229.2060308@it.uu.se> Alexander Zhukov wrote: > In summary, os:cmd does not allow to communicate with called program, > and open_port does not allow to specify arguments to run program with. Really? As far as I know, os:cmd is implemented through open_port. /Richard From anders@REDACTED Wed Nov 14 17:26:14 2007 From: anders@REDACTED (Anders Dahlin) Date: Wed, 14 Nov 2007 17:26:14 +0100 Subject: [erlang-questions] Run external program with arguments In-Reply-To: References: <87bq9xds4l.fsf@unison.org> <6a36e7290711140716o4f0bbb73y52d1a35f14cb7b0d@mail.gmail.com> Message-ID: <473B21A6.4050808@dahlinenergy.se> Except foldr will produce a reversed result, so foldl is a better choice. Brgds, /A Torbjorn Tornkvist wrote: > Bob Ippolito wrote: >> The easiest way is to perform shell quoting over the command you >> want... take a look at mochiweb_util:cmd_port/2. >> >> http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl > > Hm...that join function. Couldn't it be written like: > > %%----------------------------------------------------------------------------- > %% @spec implode(Str::string(), Sep::string()) -> string() > %% > %% @doc split text at first occurence of Char (Char is not include in > Before > %% or After parts) > %% > %% Example: implode(["a","b","c"], ".") => "a.b.c" > %% > %% > @end------------------------------------------------------------------------ > implode(Data, Seperator) when is_list(Data) andalso is_list(Seperator) -> > lists:foldr(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). > > > Cheers, Tobbe > >> -bob >> >> On 11/14/07, Alexander Zhukov wrote: >>> Hi! >>> >>> Is there a way to run an external program from Erlang program with >>> arguments? >>> >>> I like to be able to write something like this: >>> >>> Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", "file", "-d"]}]), >>> >>> but so far I can't find a way to run a program with arguments. >>> >>> Yes, I know I can write a wrapper script but I do not like such an >>> approach. >>> >>> -- >>> Alexander Zhukov >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From azhukov@REDACTED Wed Nov 14 18:05:49 2007 From: azhukov@REDACTED (Alexander Zhukov) Date: Wed, 14 Nov 2007 20:05:49 +0300 Subject: [erlang-questions] Run external program with arguments In-Reply-To: (Bjorn Gustavsson's message of "14 Nov 2007 15\:50\:26 +0100") References: <87bq9xds4l.fsf@unison.org> <473AE134.5050008@club-internet.fr> <87ve84dhb9.fsf@unison.org> Message-ID: <87mytgdafm.fsf@unison.org> >>>>> Bjorn Gustavsson (BG) writes: BG> Alexander Zhukov writes: >> In summary, os:cmd does not allow to communicate with called >> program, and open_port does not allow to specify arguments to run >> program with. BG> open_port({spawn,"ls -l"}, []). Great! I had thought about such a possibility but forget to make an expirement ;( Now I've made a test. It really works. Thank you very much. BG> /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB BG> _______________________________________________ erlang-questions BG> mailing list erlang-questions@REDACTED BG> http://www.erlang.org/mailman/listinfo/erlang-questions -- Alexander Zhukov From bob@REDACTED Wed Nov 14 17:51:54 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 14 Nov 2007 08:51:54 -0800 Subject: [erlang-questions] Run external program with arguments In-Reply-To: References: <87bq9xds4l.fsf@unison.org> <6a36e7290711140716o4f0bbb73y52d1a35f14cb7b0d@mail.gmail.com> Message-ID: <6a36e7290711140851i25e56f36m852dafe50cdd697b@mail.gmail.com> On 11/14/07, Torbjorn Tornkvist wrote: > Bob Ippolito wrote: > > The easiest way is to perform shell quoting over the command you > > want... take a look at mochiweb_util:cmd_port/2. > > > > http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl > > Hm...that join function. Couldn't it be written like: > > %%----------------------------------------------------------------------------- > %% @spec implode(Str::string(), Sep::string()) -> string() > %% > %% @doc split text at first occurence of Char (Char is not include in > Before > %% or After parts) > %% > %% Example: implode(["a","b","c"], ".") => "a.b.c" > %% > %% > @end------------------------------------------------------------------------ > implode(Data, Seperator) when is_list(Data) andalso is_list(Seperator) -> > lists:foldr(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). > Probably, but what's there works and it's not a bottleneck in anything we do. -bob From n.decker@REDACTED Wed Nov 14 18:46:14 2007 From: n.decker@REDACTED (Decker, Nils) Date: Wed, 14 Nov 2007 18:46:14 +0100 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address References: <200711132200.lADM0EWi024508@pluto.hedeland.org><1195020769.25864.4.camel@metalman.lan> <473AAF77.2090606@it.su.se> <1195051936.10228.3.camel@metalman.lan> Message-ID: <8981957283CC0F49A8E35A51B03CEECE01F7DBA3@s-mci-hh-02-nt.extern.studio-hamburg.de> Hello > Von: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] Im Auftrag von mog > [...] > reliability. So I really need a way to have a cloud of computers > running under one ip. I imagine i could use a mirrored > switch and then > forge the udp packets, but I was trying to do this without any custom > hardware. Has anyone developed a system like this? and If not how did > you reach such high levels of reliability. I did some research into this. There is a CLUSTERIP target in the linux iptables firewall that gives all nodes in a cluster the same MAC address and accepts connections based on a hash of ip/srcport/dstport. You can change dynamically which node serves which hash numbers. So if a node leaves the cluster some other node can pick up its hash value. This will invalidate all open tcp sessions but the cluster is still reachable without delay. You need to have all nodes on a single hub. (you could configure a redundant switch to act as a hub...) Because i dont have control over the switch, i implemented something else. I have one distributed application that owns the cluster ip address. It will bring up/down the ip on its node. The drawback is that i have to wait for the router refresh its arp cache. Greetings Nils Decker -- - MCI alles aus einer Hand - _____________________________ Nils Decker Projektierung Studio Hamburg Media Consult International (MCI) GmbH Jenfelder Allee 80 22039 Hamburg phone: +49 (0)40 66 88 34 37 fax: +49 (0)40 66 88 52 22 E-mail: n.decker@REDACTED Web: www.mci-broadcast.com Gesch?ftsf?hrung: Ralf Schimmel Prokuristen: J?rn Denneborg, J?rg Pankow Amtsgericht Hamburg, HRB 70454 From tobbe@REDACTED Wed Nov 14 19:06:26 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 14 Nov 2007 19:06:26 +0100 Subject: [erlang-questions] Run external program with arguments In-Reply-To: <473B21A6.4050808@dahlinenergy.se> References: <87bq9xds4l.fsf@unison.org> <6a36e7290711140716o4f0bbb73y52d1a35f14cb7b0d@mail.gmail.com> <473B21A6.4050808@dahlinenergy.se> Message-ID: Anders Dahlin wrote: > Except foldr will produce a reversed result, so foldl is a better choice. Sorry, but you are wrong! ---------------------------- -module(aaa). -compile(export_all). r(Data,Seperator) -> lists:foldr(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). l(Data,Seperator) -> lists:foldl(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). --------------------------------- 1> aaa:r(["a","b","c"], "."). "a.b.c" 2> aaa:l(["a","b","c"], "."). "c.b.a" ------------------------------------ To make use of foldl you need to write l/2 like this: l2(Data,Seperator) -> lists:foldl(fun(X,[]) -> X; (X,Acc) -> Acc++Seperator++X end, "", Data). 3> aaa:l2(["a","b","c"], "."). "a.b.c" --------------------------------------- But this is actually worse, since append usually recurse on its left argument which in this case is Acc which will grow for each iteration. I guess there is a reason why Haskell define fold as a synonym for foldr. Cheers, Tobbe > > Brgds, > /A > > Torbjorn Tornkvist wrote: >> Bob Ippolito wrote: >>> The easiest way is to perform shell quoting over the command you >>> want... take a look at mochiweb_util:cmd_port/2. >>> >>> http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl >> Hm...that join function. Couldn't it be written like: >> >> %%----------------------------------------------------------------------------- >> %% @spec implode(Str::string(), Sep::string()) -> string() >> %% >> %% @doc split text at first occurence of Char (Char is not include in >> Before >> %% or After parts) >> %% >> %% Example: implode(["a","b","c"], ".") => "a.b.c" >> %% >> %% >> @end------------------------------------------------------------------------ >> implode(Data, Seperator) when is_list(Data) andalso is_list(Seperator) -> >> lists:foldr(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). >> >> >> Cheers, Tobbe >> >>> -bob >>> >>> On 11/14/07, Alexander Zhukov wrote: >>>> Hi! >>>> >>>> Is there a way to run an external program from Erlang program with >>>> arguments? >>>> >>>> I like to be able to write something like this: >>>> >>>> Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", "file", "-d"]}]), >>>> >>>> but so far I can't find a way to run a program with arguments. >>>> >>>> Yes, I know I can write a wrapper script but I do not like such an >>>> approach. >>>> >>>> -- >>>> Alexander Zhukov >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions From aaron.feng@REDACTED Wed Nov 14 19:18:23 2007 From: aaron.feng@REDACTED (Aaron Feng) Date: Wed, 14 Nov 2007 13:18:23 -0500 Subject: [erlang-questions] financial systems in erlang Message-ID: <4e3934860711141018j4f4b0709tc6a0dfde0516f140@mail.gmail.com> I'm interested in finding out companies in the financial sector that uses erlang. So far I only know of Kreditor (http://kreditor.se/en/2.html). Any input would be appreciated. Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: From cwarden@REDACTED Wed Nov 14 19:36:42 2007 From: cwarden@REDACTED (Christian G. Warden) Date: Wed, 14 Nov 2007 10:36:42 -0800 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <8981957283CC0F49A8E35A51B03CEECE01F7DBA3@s-mci-hh-02-nt.extern.studio-hamburg.de> References: <473AAF77.2090606@it.su.se> <1195051936.10228.3.camel@metalman.lan> <8981957283CC0F49A8E35A51B03CEECE01F7DBA3@s-mci-hh-02-nt.extern.studio-hamburg.de> Message-ID: <20071114183642.GE11730@xerus.org> On Wed, Nov 14, 2007 at 06:46:14PM +0100, Decker, Nils wrote: > Hello > > > Von: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] Im Auftrag von mog > > [...] > > reliability. So I really need a way to have a cloud of computers > > running under one ip. I imagine i could use a mirrored > > switch and then > > forge the udp packets, but I was trying to do this without any custom > > hardware. Has anyone developed a system like this? and If not how did > > you reach such high levels of reliability. > > I did some research into this. There is a CLUSTERIP target in the > linux iptables firewall that gives all nodes in a cluster the same MAC > address and accepts connections based on a hash of ip/srcport/dstport. > You can change dynamically which node serves which hash numbers. So if > a node leaves the cluster some other node can pick up its hash value. > This will invalidate all open tcp sessions but the cluster is still > reachable without delay. You need to have all nodes on a single hub. > (you could configure a redundant switch to act as a hub...) > > Because i dont have control over the switch, i implemented something > else. I have one distributed application that owns the cluster ip > address. It will bring up/down the ip on its node. The drawback is > that i have to wait for the router refresh its arp cache. You can usually send a gratuitous arp to update the router's arp cache: `arping -A -c 10 ` You can get high availability and load-balancing on the cheap using round-robin dns where each IP in the pool is active on a single machine, but can be brought up automatically on a failover machine using something like heartbeat or ucarp. Christian From kverma@REDACTED Wed Nov 14 19:57:13 2007 From: kverma@REDACTED (Krish Verma) Date: Wed, 14 Nov 2007 10:57:13 -0800 (PST) Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <1195051936.10228.3.camel@metalman.lan> References: <1194854462.13208.18.camel@metalman.lan> <47391D3A.1030702@gmail.com> <1194927265.10778.5.camel@metalman.lan> <200711130751.lAD7pqOu007371@pluto.hedeland.org> <1194963201.19396.8.camel@metalman.lan> <200711132200.lADM0EWi024508@pluto.hedeland.org> <1195020769.25864.4.camel@metalman.lan> <473AAF77.2090606@it.su.se> <1195051936.10228.3.camel@metalman.lan> Message-ID: <13753996.post@talk.nabble.com> Have a look at Wackamole, it might just be what you are looking for. Joost uses it for HA. http://www.backhand.org/wackamole/ http://www.highscalability.com/product-wackamole http://www.backhand.org/wackamole/course_notes_2002LV.pdf http://www.layer3media.com/joost/joost-network.pdf It appears to have solved the ARP refresh issue as well. -k r i s h Matthew O'Gorman wrote: > > Thanks for all the advice, however, clustering is secondary to fault > tolerance to me. I really am trying to build a system with 9 9s of > reliability. So I really need a way to have a cloud of computers > running under one ip. I imagine i could use a mirrored switch and then > forge the udp packets, but I was trying to do this without any custom > hardware. Has anyone developed a system like this? and If not how did > you reach such high levels of reliability. > > Mog > [nipped] > -- View this message in context: http://www.nabble.com/clarify%3A-gen_udp-Set-outbound-ip-address-tf4789611.html#a13753996 Sent from the Erlang Questions mailing list archive at Nabble.com. From bhatti_shahzad@REDACTED Wed Nov 14 19:01:37 2007 From: bhatti_shahzad@REDACTED (shahzad bhatti) Date: Wed, 14 Nov 2007 10:01:37 -0800 (PST) Subject: [erlang-questions] idea: service pack one Message-ID: <690693.51870.qm@web81115.mail.mud.yahoo.com> How about adding unit test library like eunit to the distribution. I would also like to see more mocking support (similar to jmock/mockeasy/flexmock) especially for OTP. > On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: >> Hi everybody, >> >> I got fired up with enthusiasm at the Erlang conference - it seems to >> me that there are a lot of *simple* things we >> can do that we should have done years ago. The reason was that even >> though many aspects of the system >> suck and can be *easily* improved we have learnt to live with the >> system (warts and all). >> >> Now that the book is done my thoughts returned to the Erlang system. >> >> Erlang is becoming popular and now needs to address the problems that >> our new users encounter. >> >> To do this I propose a project called "service pack one" (( its an >> add-on that can be bolted on top of OTP)) >> >> (( I don't want to change anything in OTP - just add a free-standing >> set of scripts that modify the behavior >> of the system )) >> >> Here's a few very simple things to do: >> >> (each of the things starting +++ is a little project --- now I'd like >> volunteers for each project - most of these are pretty easy >> to hack together a quick and dirty prototype - but needs a little care >> in getting all the details right) >> >> >> 1 +++ fix nicer error messages (Done - Kenneth showed this) >> >> 2 +++ experiment with inheritance (Richard mentioned this) (( I hacked >> this together today, together with >> some code that checks for missing calls in imported libraries)) >> - I can post a longer explanation if you like >> >> 3 +++ make Erlang start fast so that people stop winging about it >> starting slowly. And fix a >> *small* distribution - here's a minimal version. >> >> ((aside - who cares if Erlang starts slowly - it was designed to >> start once and never stop - we have systems >> that have run for 5 years - a two seconds start-up time amortized over >> 5 years is not *too* bad)) >> >> (( If you want to make it fast redo the boot scripts - it's all in >> the documentation ! )) >> >> (I tried this yesterday) it's really easy >> >> >> 1) make a boot file (jboot.erl) >> >> {script, {"tiny","1.1"}, >> [{preLoaded,[erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]}, >> {primLoad, [tiny]}, >> {kernel_load_completed}, >> {apply, {tiny, start, []}}]}. >> >> 2) write a minimal erlang program >> tiny.erl >> start() -> erlang:display'hello world'), erlang:halt(). >> >> 3) compile the boot file >> systools:script2boot("jboot"). >> >> 4) run >> erl -boot jboot >> >> This runs in 0.29 secs on my macbook >> >> (( for comparison erl -s init stop takes 1.6 seconds) >> >> 5) you also need the erl script: >> >> #!/bin/sh >> ROOTDIR=`pwd` >> BINDIR=$ROOTDIR >> EMU=beam >> PROGNAME=`echo $0 | sed 's/.*\///'` >> export EMU >> export ROOTDIR >> export BINDIR >> export PROGNAME >> exec $BINDIR/erlexec ${1+"$@"} >> >> 6) copy erlexec and beam from the distribution to a local directory. >> (these can be stripped to remove symbol table info) >> >> 7) the result is >> >> $ wc erl erlexec beam jboot.boot tiny.beam >> >> 10 20 172 erl >> 58 277 22012 erlexec >> 4247 35423 1097316 beam >> 0 5 203 jboot.boot >> 5 20 708 tiny.beam >> 4320 35745 1120411 total >> >> 1.1 MB and 6 files - not *too* bad >> >> 8) for fun I packed stdlib/kernel/compiler in an archive using >> boot_tools:mk_lib() which packs everything a single 1.14 meg archive >> (boot_tools is in $DIST/otp_src_R11B-4/erts/boot/src >> >> This means we can pack the compiler and base otp system into half a >> dozen files >> and under 2.5 Meg >> >> (( this was my old sae sysytem that never really made it to the main >> release)) >> >> 4 +++ compile the @spec definitions in comments into code that >> *dynamically* checks types >> who cares if it's slow and can't be checked statically - the >> dynamic check is very useful >> while developing >> >> 5 +++ bundle ejabberd (or yaws) in a standard configuration that ships >> with Erlang. >> I talked to Mickael R. about this - if we shipped ejabberd >> with every Erlang >> we could easily get tens of thousands of ejabberd servers up >> and running in >> the twinkling of an eye. >> >> 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop >> winging >> >> 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie >> dynamic type checking, >> xref, cover, dialyzer *without* you having to do anything >> fancy >> the defaults for compilation should be to throw all >> checks possible into the compile >> cycle >> >> 8 ++++ make an *erlang* packing mechanism (put the entire application >> in a .dets file - and NOT >> .tar.gz or zip file - then define a bundle structure (look at the MAC >> for inspiration) add application icons >> and a desktop interface. >> >> 9 ++++ interface to flash using flex 2. Solve the GUI problem once and >> for all as follows >> >> repeat after me: client = flash in the browser, server = erlang. >> Intermediate protocol = flash AMF >> >> >> There are probably more things I could add - feel free to add you pet >> annoyance that can be easily >> fixed and we'll put it into service pack one. >> >> >> >> Cheers >> >> /Joe Armstrong >> --------------------------------- Get easy, one-click access to your favorites. Make Yahoo! your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarivsadan@REDACTED Wed Nov 14 20:51:18 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Wed, 14 Nov 2007 11:51:18 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: <84621a60711140748u23b6d8adm9c79c7703f977046@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> <17244f480711131649g4d9bbb05i91a4b4d802a31188@mail.gmail.com> <779bf2730711131728p4327116fga24c2702dbe34d66@mail.gmail.com> <84621a60711140748u23b6d8adm9c79c7703f977046@mail.gmail.com> Message-ID: <17244f480711141151m378936e9sefc69e91b69cd78c@mail.gmail.com> > 4) Simple code inheritance for the simple sake of easy reuse by > importing functions from other modules (some of which might be > "abstract" in the sense that they are useless other than to provide > said shared common code to child modules). No need to get into OO > modeling crap here, this is just about typing less to get the same job > done. Sometimes the idea of abstracting things as generalized > functions with function reference arguments and/or return values makes > the most sense, but at other times, code inheritance really makes more > sense. I would recommend that we study other language's models here > and do it right from the start, instead of trying to hackishly alter > this as we go down the road. The big decisions, and how I feel about > them (feel free to disagree): > Until inheritence is implemented into the language, you can use smerl:extend() to get the same result. (Smerl comes with ErlyWeb, which uses smerl:extend() to enable "inheritence" from erlydb_base and to enable the erlyweb_magic feature). Yariv From thomasl_erlang@REDACTED Wed Nov 14 21:03:29 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 14 Nov 2007 12:03:29 -0800 (PST) Subject: [erlang-questions] financial systems in erlang In-Reply-To: <4e3934860711141018j4f4b0709tc6a0dfde0516f140@mail.gmail.com> Message-ID: <504855.85866.qm@web38814.mail.mud.yahoo.com> --- Aaron Feng wrote: > I'm interested in finding out companies in the > financial sector that uses > erlang. So far I only know of Kreditor > (http://kreditor.se/en/2.html). Any > input would be appreciated. There's also the work of Dani Schutte et al for TEBA Bank in South Africa. He had a presentation at EUC a few years back; the slides are online, I think. Best, Thomas ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From valentin@REDACTED Wed Nov 14 17:25:55 2007 From: valentin@REDACTED (Valentin Micic) Date: Wed, 14 Nov 2007 18:25:55 +0200 Subject: [erlang-questions] idea: service pack one References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <3DE5502F-39DC-4C08-8528-3F8C1DC239F0@process-one.net> Message-ID: <006a01c826dc$d4463290$6401a8c0@moneymaker2> client = flash in the browser server = whatever (can be erlang) and why not: protocol = xml rpc Been working for us for the last... close to two years. V. ----- Original Message ----- From: Micka?l R?mond To: Joe Armstrong Cc: Erlang Questions Sent: Wednesday, November 14, 2007 1:17 PM Subject: Re: [erlang-questions] idea: service pack one Hello, Le 13 nov. 07 ? 22:27, Joe Armstrong a ?crit : 9 ++++ interface to flash using flex 2. Solve the GUI problem once and for all as follows repeat after me: client = flash in the browser, server = erlang. Intermediate protocol = flash AMF This is early information, but just for information we have a very advanced Flash server developed in Erlang :) (I know you know Joe, as I made a demo ;) -- Micka?l R?mond http://www.process-one.net/ ------------------------------------------------------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Wed Nov 14 22:57:18 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 14 Nov 2007 22:57:18 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: Hi, As responsible for the Erlang Open Source Distribution and the Erlang/OTP development at Ericsson I have to comment Joes idea. I am just as Joe filled with entusiasm after the Erlang conference but still don't agree with everything that Joe suggests. On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > Hi everybody, > > I got fired up with enthusiasm at the Erlang conference - it seems to > me that there are a lot of *simple* things we > can do that we should have done years ago. The reason was that even > though many aspects of the system > suck and can be *easily* improved we have learnt to live with the > system (warts and all). The general goal that I think many of us in the Erlang community agree upon it to broaden the use and knowledge about Erlang so that it can get the attention it deserves. It is not necessarily changes and additions in the product, the language etc. that will make this happen, I think the distribution is good enough to get more attention even as it is today. But of course we need improvements as well but since we can't implement everything in zero time it is important to take the steps in the right order. > > Now that the book is done my thoughts returned to the Erlang system. > > Erlang is becoming popular and now needs to address the problems that > our new users encounter. > > To do this I propose a project called "service pack one" (( its an > add-on that can be bolted on top of OTP)) "Service Pack" gets me thinking about Microsoft and packages with bugfixes more than new features. So not a very good name in my opinion. > > (( I don't want to change anything in OTP - just add a free-standing > set of scripts that modify the behavior > of the system )) Hmm? First you say "don't want to change anything", then you say "modify the behavior of the system" I thought modify was almost synonymous with change? I think there is need to have many different "AddedValue Packs" with additional features and functions relative a Basic distribution. The distribution of today should then be divided into Basic and a number of Additional packages. And this is in our plans during 2008. > Here's a few very simple things to do: > > (each of the things starting +++ is a little project --- now I'd like > volunteers for each project - most of these are pretty easy > to hack together a quick and dirty prototype - but needs a little care > in getting all the details right) > > > 1 +++ fix nicer error messages (Done - Kenneth showed this) > > 2 +++ experiment with inheritance (Richard mentioned this) (( I hacked > this together today, together with > some code that checks for missing calls in imported libraries)) > - I can post a longer explanation if you like I don't think this one of the most important things to do. To support inheritance properly you need support in the VM and in the Compiler so this does not fit very well in an AddedValue pack. We as Erlang developers are interested in this as well and may very well include it as an experientnal feature in the Basic package. > > 3 +++ make Erlang start fast so that people stop winging about it > starting slowly. And fix a > *small* distribution - here's a minimal version. > I am not aware of many complaints about Erlangs slow start. From where do they come? > ((aside - who cares if Erlang starts slowly - it was designed to > start once and never stop - we have systems > that have run for 5 years - a two seconds start-up time amortized over > 5 years is not *too* bad)) > > (( If you want to make it fast redo the boot scripts - it's all in > the documentation ! )) The Erlang/OTP distribution should be viewed as a Development System. As a development system the current boot scripts are ok I think. There is a faster boot script used when "erlc" is used. When a user develops a program thas is to be deployed and distributed it might sometimes be important to have a quick startup and because of that it is documented how to make your own boot scripts. This need of course to be improved especially when it comes to changes regarding modules and processes in kernel and stdlib. > > (I tried this yesterday) it's really easy > > > 1) make a boot file (jboot.erl) > > {script, {"tiny","1.1"}, > [{preLoaded,[erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]}, > {primLoad, [tiny]}, > {kernel_load_completed}, > {apply, {tiny, start, []}}]}. > > 2) write a minimal erlang program > tiny.erl > start() -> erlang:display'hello world'), erlang:halt(). > > 3) compile the boot file > systools:script2boot("jboot"). > > 4) run > erl -boot jboot > > This runs in 0.29 secs on my macbook > > (( for comparison erl -s init stop takes 1.6 seconds) > > 5) you also need the erl script: > > #!/bin/sh > ROOTDIR=`pwd` > BINDIR=$ROOTDIR > EMU=beam > PROGNAME=`echo $0 | sed 's/.*\///'` > export EMU > export ROOTDIR > export BINDIR > export PROGNAME > exec $BINDIR/erlexec ${1+"$@"} > > 6) copy erlexec and beam from the distribution to a local directory. > (these can be stripped to remove symbol table info) > > 7) the result is > > $ wc erl erlexec beam jboot.boot tiny.beam > > 10 20 172 erl > 58 277 22012 erlexec > 4247 35423 1097316 beam > 0 5 203 jboot.boot > 5 20 708 tiny.beam > 4320 35745 1120411 total > > 1.1 MB and 6 files - not *too* bad > > 8) for fun I packed stdlib/kernel/compiler in an archive using > boot_tools:mk_lib() which packs everything a single 1.14 meg archive > (boot_tools is in $DIST/otp_src_R11B-4/erts/boot/src > > This means we can pack the compiler and base otp system into half a dozen files > and under 2.5 Meg > 11> (( this was my old sae sysytem that never really made it to the main release)) > > 4 +++ compile the @spec definitions in comments into code that > *dynamically* checks types > who cares if it's slow and can't be checked statically - the > dynamic check is very useful > while developing Now we have the "-spec(foo/1:..." syntax for contracts we should use that one for this purpose. Dialyzer can find much more errors "statically" with help of these. The @spec syntax in edoc will be made the same as the -spec syntax as soon as possible. Don't forget that one of the strengths with Erlang is the productivity advantage compared with C++, Java etc. In Erlang we can concentrate on solving the problem without need to write tons of declarations before we can write and test executable statements. Contracts will always be optional and should be used with care i.e not everywhere. The most important use in my opinion is in the exported functions intended to form a public API. > 5 +++ bundle ejabberd (or yaws) in a standard configuration that ships > with Erlang. > I talked to Mickael R. about this - if we shipped ejabberd > with every Erlang > we could easily get tens of thousands of ejabberd servers up > and running in > the twinkling of an eye. Agree that is would be nice to have both Ejabberd and Yaws as part of some official distribution so that it gets easier to get all the good applications from one wellknown place. > > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop winging I can almost promise that we will add this to the basic distribution during 2008 > > 7 ++++ fix c(Mod) and erlc so that they throw *everything* at them ie > dynamic type checking, > xref, cover, dialyzer *without* you having to do anything fancy > the defaults for compilation should be to throw all > checks possible into the compile > cycle Since not all of these things are well suited to be done at the same phase and with the same parameters I don't agree completely with this. Dialyzer and xref should not be applied to each module, they should be applied over all modules intended to be part of a product. There is no reason to apply code coverage until test case execution. Earlier you suggested that we must speed up the startup of an Erlang system. here your suggestions will (if taken literally) lead to very long compile and build times. > > 8 ++++ make an *erlang* packing mechanism (put the entire application > in a .dets file - and NOT > .tar.gz or zip file - then define a bundle structure (look at the MAC > for inspiration) add application icons > and a desktop interface. > I think packaging vs. icons and desktop interface are two very separate things. Maybe you are referring to installation packages such as self extracting exe files on Windows using MSI for installations? This is OS dependant. I think the basic distribution should have tools for making this packaging but maybe not the final OS dependant part which might be better done with OS specific tools. > 9 ++++ interface to flash using flex 2. Solve the GUI problem once and > for all as follows > > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF Flash looks interesting to interface but I don't think is is the once and for all solution to the GUI problem. Take a look at WxWidgets and the Erlang binding hosted on sourceforge under the name wxerlang, it has potential to be a very good solution. > > > There are probably more things I could add - feel free to add you pet > annoyance that can be easily > fixed and we'll put it into service pack one. > Lets take the items one by one I don't think all of what's mentioned above is suitable to put in the same package. > > > Cheers > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > /Kenneth Erlang/OTP team at Ericsson From yinso.chen@REDACTED Wed Nov 14 22:58:25 2007 From: yinso.chen@REDACTED (YC) Date: Wed, 14 Nov 2007 13:58:25 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: <84621a60711140748u23b6d8adm9c79c7703f977046@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> <17244f480711131649g4d9bbb05i91a4b4d802a31188@mail.gmail.com> <779bf2730711131728p4327116fga24c2702dbe34d66@mail.gmail.com> <84621a60711140748u23b6d8adm9c79c7703f977046@mail.gmail.com> Message-ID: <779bf2730711141358k6933f419wc7120d08bd06f401@mail.gmail.com> On Nov 14, 2007 7:48 AM, Brandon Black wrote: > > I view things like database and mail protocols similarly to how you > > (and I) view UIs - these are things that belong in extension > > libraries, not as some core part of a language distribution. The > > popular protocols will change over time, and the popular > > implementations of those protocols will change as well. Old > > implementations will naturally be replaced with increasingly superior > > abstractions if you let the more external stuff evolve in a darwinian > > fashion somewhere like CEAN. Even really good implementations will > > get replaced by newer ones that follow newer and better best practices > > that evolve over the years. Embedding early implementations of what's > > popular today into the main distro is counterproductive if anything. > > Once you bundle something with the core, your stuck with it as legacy > > baggage for a very long time for fear of breaking upgraders, and > > people tend to use it "because it's there" long after it's a very > > unrecommended practice to still be using it. Keep the core as minimal > > as possible, IMHO. > Agreed that libraries should be separated from core. My point wasn't that they should be a part of core language or even distribution, but rather erlang can improve its adoption with the new comers with better support for conventional databases and other standard protocols than it has now. Mnesia is great and all, but it doesn't fully replace rdbms and few newcomers will start learning erlang by writing a full blown database client (or smtp client) that they've taken for granted (and never have to intimately know of the protocols) in other language platforms, even though erlang makes it easier to do so. But while we are on the extension point, I also agree with you that the extension distribution mechanism should be standard (besides tarballs + make). While organic evolution has its merits, IMO extension distribution is one problem where standardization helps more than it hurts, just witness CPAN and other variants. My personal favorite is PLT Scheme's Planet, which allows you to completely skip the install step by directly requiring the remote module as if it's local. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Wed Nov 14 21:33:42 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 14 Nov 2007 21:33:42 +0100 Subject: [erlang-questions] financial systems in erlang In-Reply-To: <504855.85866.qm@web38814.mail.mud.yahoo.com> References: <4e3934860711141018j4f4b0709tc6a0dfde0516f140@mail.gmail.com> <504855.85866.qm@web38814.mail.mud.yahoo.com> Message-ID: On Nov 14, 2007 9:03 PM, Thomas Lindgren wrote: > > > --- Aaron Feng wrote: > > > I'm interested in finding out companies in the > > financial sector that uses > > erlang. So far I only know of Kreditor > > (http://kreditor.se/en/2.html). Any > > input would be appreciated. > > There's also the work of Dani Schutte et al for TEBA > Bank in South Africa. He had a presentation at EUC a > few years back; the slides are online, I think. > Dani as mentioned above is now involved in a company named Erlfinsys Website www.erlfinsys.net Email daniel@REDACTED Phone +27844683138 The company develops financial systems with Erlang. Based in SouthAfrica as far as I know. Their web-site seems down today. /Kenneth > > ____________________________________________________________________________________ > Be a better sports nut! Let your teams follow you > with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From juanjo@REDACTED Wed Nov 14 23:13:41 2007 From: juanjo@REDACTED (Juan Jose Comellas) Date: Wed, 14 Nov 2007 19:13:41 -0300 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: <1c3be50f0711141413m397c2a0btfafc2dfa6b67d159@mail.gmail.com> I have only been using Erlang for about 2 months now, but for the project I'm working on we decided to use binaries as a replacement for strings, mainly to avoid the bloat caused by Erlang's standard strings. I ended up writing a module for string operations on binaries, which I'm including attached in case someone is interested on it (the unit tests require EUnit from SVN). One thing that I was always doing when iterating over binaries is doing matches like the following one: <> and the annoying thing is that I could never use pattern matching at the function level because the argument representing the offset could not be used within the pattern. The functions look like this: fun(Bin, Offset) -> [...] I don't see a way out of this with Erlang's current argument evaluation rules, but I thought I should mention it. I'd definitely like to be able to match binaries against regular expressions. Another thing I'd like to see is the inclusion of the binary_to_atom/1 function to avoid having to go through a list to convert an atom to a binary. On 11/13/07, Fredrik Svahn wrote: > > On Nov 13, 2007 10:27 PM, Joe Armstrong wrote: > > 6 ++++ fix BIFs for regexp, searching binaries etc - so people stop > winging > > I guess I am one of the people whinging. :-) > > I have recently started writing an EEP on various operations on > binaries that I would like to see added in a support library (e.g. > searching for patterns/multipatterns, splitting by pattern, regex, > some of them might be suitable to implement as BIFs, but that is a > later question). Is there someone else out there already working on > this? > > If not, please let me know what opertaions you would like to be able > to do on binaries. Are there any design patterns or operations on > binaries that you keep writing over and over again? Any code involving > binaries which could be written in a more elegant way with a support > function? Any operations which you feel would be suitable to implement > as BIFs? > > BR /Fredrik > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bstr.zip Type: application/zip Size: 9287 bytes Desc: not available URL: From juanjo@REDACTED Wed Nov 14 23:42:00 2007 From: juanjo@REDACTED (Juan Jose Comellas) Date: Wed, 14 Nov 2007 19:42:00 -0300 Subject: [erlang-questions] how: Removing atoms from the atom table Message-ID: <1c3be50f0711141442r4704a6b4p10686058da317212@mail.gmail.com> In my current project I'm finding that using atoms for certain IDs in the system is very comfortable, but they introduce a potential security problem. Right now, we receive some messages from (possibly hostile) external sources with fields that we store internally as atoms. The problem is that to check whether the fields in the message are valid we must convert them to atoms, and by doing this we consume entries from the global atom table even if the values of the fields were bogus. Thus, this mechanism could be used to exploit the system and exhaust the atom supply. My question is the following: would it be possible to add a BIF to explicitly remove an atom from the global atom table? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Wed Nov 14 23:47:47 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Wed, 14 Nov 2007 16:47:47 -0600 Subject: [erlang-questions] how: Removing atoms from the atom table In-Reply-To: <1c3be50f0711141442r4704a6b4p10686058da317212@mail.gmail.com> References: <1c3be50f0711141442r4704a6b4p10686058da317212@mail.gmail.com> Message-ID: On Nov 14, 2007 4:42 PM, Juan Jose Comellas wrote: > In my current project I'm finding that using atoms for certain IDs in the > system is very comfortable, but they introduce a potential security problem. > Right now, we receive some messages from (possibly hostile) external sources > with fields that we store internally as atoms. The problem is that to check > whether the fields in the message are valid we must convert them to atoms, > and by doing this we consume entries from the global atom table even if the > values of the fields were bogus. Thus, this mechanism could be used to > exploit the system and exhaust the atom supply. > > My question is the following: would it be possible to add a BIF to > explicitly remove an atom from the global atom table? > Isn't list_to_existing_atom/1 enough for this? /Anders From bjorn@REDACTED Thu Nov 15 07:53:26 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 15 Nov 2007 07:53:26 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <1c3be50f0711141413m397c2a0btfafc2dfa6b67d159@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <1c3be50f0711141413m397c2a0btfafc2dfa6b67d159@mail.gmail.com> Message-ID: "Juan Jose Comellas" writes: > One thing that I was always doing when iterating over binaries is doing > matches like the following one: > > <> You don't have to do that anymore in R12B. Take for instance your index/2 function: index(Str, Char) when is_binary(Str), is_integer(Char) -> index(Str, Char, 0). index(Str, _Char, N) when N > size(Str) -> 0; index(Str, Char, N) -> case Str of <<_Head:N/binary, Char, _Tail/binary>> -> N + 1; <<>> -> 0; _ -> index(Str, Char, N + 1) end. In R12B, you can write it simply like: index(Str, Char) when is_binary(Str), is_integer(Char) -> index(Str, Char, 1). index(<>, Char, N) -> N; index(<<_,T/binary>>, Char, N) -> index(T, Char, N+1); index(<<>>, _, _) -> 0. On my Sparc workstation this simpler program is more than twice as fast in R12B. Note: Your index function can be written speeded a bit. index(Str, Char) when is_binary(Str), is_integer(Char) -> index(Str, Char, 0). %% index(Str, _Char, N) when N > size(Str) -> %% 0; index(Str, Char, N) -> case Str of <<_Head:N/binary, Char, _Tail/binary>> -> N + 1; <<_Head:N/binary>> -> 0; _ -> index(Str, Char, N + 1) end. Still, even after this improvement, in R12B the simpler version is about twice as fast. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From luke@REDACTED Thu Nov 15 08:18:49 2007 From: luke@REDACTED (LUKE) Date: Thu, 15 Nov 2007 15:18:49 +0800 Subject: [erlang-questions] Why the code will make erlang crash? Message-ID: <99564A45FCC64AE6B73DD078724BCFDE@lukeserver> -module(libstr). -export([exists/2]). exists(String,MString)-> case regexp:match(String,"(^" ++ MString ++ "*)") of {match,_,_}->true; nomatch->false; {error,Why}->Why end. ============================================= 4> libstr:exists("hello","hel"). true 5> libstr:exists("hello","lo"). false 6> libstr:exists("hello","lo*"). false 7> libstr:exists("hello","*lo"). Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 1140328500 bytes of memory (of type "heap"). This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Thu Nov 15 09:06:38 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 15 Nov 2007 09:06:38 +0100 Subject: [erlang-questions] how: Removing atoms from the atom table In-Reply-To: <1c3be50f0711141442r4704a6b4p10686058da317212@mail.gmail.com> References: <1c3be50f0711141442r4704a6b4p10686058da317212@mail.gmail.com> Message-ID: <20071115080638.GA26268@erix.ericsson.se> On Wed, Nov 14, 2007 at 07:42:00PM -0300, Juan Jose Comellas wrote: > In my current project I'm finding that using atoms for certain IDs in the > system is very comfortable, but they introduce a potential security problem. > Right now, we receive some messages from (possibly hostile) external sources > with fields that we store internally as atoms. The problem is that to check > whether the fields in the message are valid we must convert them to atoms, > and by doing this we consume entries from the global atom table even if the > values of the fields were bogus. Thus, this mechanism could be used to > exploit the system and exhaust the atom supply. > > My question is the following: would it be possible to add a BIF to > explicitly remove an atom from the global atom table? > Nothing is impossible, but this is very close. The whole emulator is structures around the fact that atoms can not disappear. To make this happen atoms would have to be reference counted and represented quite differently internally, or, a global atom garbage collect would have to be implemented, and it would have to stop all processes while garbage collecting, or be very complicated and tag supcious atoms, make several incremental passes, and when very sure remove the atom. In other words not lightweight and not efficient (much work and small gain). But not entirely impossible. > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Thu Nov 15 09:18:39 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 15 Nov 2007 09:18:39 +0100 Subject: [erlang-questions] Why the code will make erlang crash? In-Reply-To: <99564A45FCC64AE6B73DD078724BCFDE@lukeserver> References: <99564A45FCC64AE6B73DD078724BCFDE@lukeserver> Message-ID: <20071115081839.GB26268@erix.ericsson.se> Must be a bug in the regexp module. The regexp code seems to go into an infinite loop and eats all memory: $ erl Erlang (BEAM) emulator version 5.5.5.5 [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5.5 (abort with ^G) 1> regexp:match("hello", "*lo*"). {error,{illegal,"*"}} 2> regexp:match("hello", "^*lo*"). BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution "*lo*" is regarded as an illegal pattern, but "^*lo*", the same left anchored spins forever. I think what you ment was: regexp:match("hello", "^.*lo.*"). The ^* does not make sense; zero or more beginning of string. On Thu, Nov 15, 2007 at 03:18:49PM +0800, LUKE wrote: > -module(libstr). > -export([exists/2]). > > exists(String,MString)-> > case regexp:match(String,"(^" ++ MString ++ "*)") of > {match,_,_}->true; > nomatch->false; > {error,Why}->Why > end. > > ============================================= > 4> libstr:exists("hello","hel"). > true > > 5> libstr:exists("hello","lo"). > false > > 6> libstr:exists("hello","lo*"). > false > > 7> libstr:exists("hello","*lo"). > > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 1140328500 bytes of memory (of type "heap"). > > This application has requested the Runtime to terminate it in an unusual way. > Please contact the application's support team for more information. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ft@REDACTED Thu Nov 15 09:22:59 2007 From: ft@REDACTED (Fredrik Thulin) Date: Thu, 15 Nov 2007 09:22:59 +0100 Subject: [erlang-questions] clarify: gen_udp Set outbound ip address In-Reply-To: <1195051936.10228.3.camel@metalman.lan> References: <200711132200.lADM0EWi024508@pluto.hedeland.org> <1195020769.25864.4.camel@metalman.lan> <473AAF77.2090606@it.su.se> <1195051936.10228.3.camel@metalman.lan> Message-ID: <473C01E3.7050302@it.su.se> mog wrote: > Thanks for all the advice, however, clustering is secondary to fault > tolerance to me. I really am trying to build a system with 9 9s of > reliability. So I really need a way to have a cloud of computers > running under one ip. I imagine i could use a mirrored switch and then > forge the udp packets, but I was trying to do this without any custom > hardware. Has anyone developed a system like this? and If not how did > you reach such high levels of reliability. Is it easier to achieve 99.999 with a single server cluster at one place (well, one L2 domain) or with the same number of servers spread out over the globe? I guess that depends on whether your clients are all located in roughly the same place or not. I never stick all my important servers in the same L2 domain. /Fredrik From anders@REDACTED Thu Nov 15 09:54:05 2007 From: anders@REDACTED (Anders Dahlin) Date: Thu, 15 Nov 2007 09:54:05 +0100 Subject: [erlang-questions] Run external program with arguments In-Reply-To: References: <87bq9xds4l.fsf@unison.org> <6a36e7290711140716o4f0bbb73y52d1a35f14cb7b0d@mail.gmail.com> <473B21A6.4050808@dahlinenergy.se> Message-ID: <473C092D.3070707@dahlinenergy.se> Ooops, sorry! Should have read the construction part better. /A Torbjorn Tornkvist wrote: > Anders Dahlin wrote: >> Except foldr will produce a reversed result, so foldl is a better choice. > > Sorry, but you are wrong! > ---------------------------- > -module(aaa). > -compile(export_all). > > r(Data,Seperator) -> > lists:foldr(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). > > l(Data,Seperator) -> > lists:foldl(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). > --------------------------------- > 1> aaa:r(["a","b","c"], "."). > "a.b.c" > 2> aaa:l(["a","b","c"], "."). > "c.b.a" > ------------------------------------ > To make use of foldl you need to write l/2 like this: > > l2(Data,Seperator) -> > lists:foldl(fun(X,[]) -> X; (X,Acc) -> Acc++Seperator++X end, "", Data). > > 3> aaa:l2(["a","b","c"], "."). > "a.b.c" > --------------------------------------- > But this is actually worse, since append usually recurse on its left > argument which in this case is Acc which will grow for each iteration. > > I guess there is a reason why Haskell define fold as a synonym for foldr. > > Cheers, Tobbe > >> Brgds, >> /A >> >> Torbjorn Tornkvist wrote: >>> Bob Ippolito wrote: >>>> The easiest way is to perform shell quoting over the command you >>>> want... take a look at mochiweb_util:cmd_port/2. >>>> >>>> http://mochiweb.googlecode.com/svn/trunk/src/mochiweb_util.erl >>> Hm...that join function. Couldn't it be written like: >>> >>> %%----------------------------------------------------------------------------- >>> %% @spec implode(Str::string(), Sep::string()) -> string() >>> %% >>> %% @doc split text at first occurence of Char (Char is not include in >>> Before >>> %% or After parts) >>> %% >>> %% Example: implode(["a","b","c"], ".") => "a.b.c" >>> %% >>> %% >>> @end------------------------------------------------------------------------ >>> implode(Data, Seperator) when is_list(Data) andalso is_list(Seperator) -> >>> lists:foldr(fun(X,[]) -> X; (X,Acc) -> X++Seperator++Acc end, "", Data). >>> >>> >>> Cheers, Tobbe >>> >>>> -bob >>>> >>>> On 11/14/07, Alexander Zhukov wrote: >>>>> Hi! >>>>> >>>>> Is there a way to run an external program from Erlang program with >>>>> arguments? >>>>> >>>>> I like to be able to write something like this: >>>>> >>>>> Port = open_port({spawn, Ext_prog_name}, [stream, {args, ["-c", "file", "-d"]}]), >>>>> >>>>> but so far I can't find a way to run a program with arguments. >>>>> >>>>> Yes, I know I can write a wrapper script but I do not like such an >>>>> approach. >>>>> >>>>> -- >>>>> Alexander Zhukov >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf@REDACTED Thu Nov 15 10:03:48 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 15 Nov 2007 10:03:48 +0100 Subject: [erlang-questions] core erlang evaluator? Message-ID: <8209f740711150103y44421662ra07ba203f9159bf8@mail.gmail.com> Is there a core erlang evaluator somewhere, and I just couldn't find it? I am looking for a way to plug in the Haskerl compiler into my hacked shell. The Haskerl compiler is written in Haskell, and it compiles to core erlang. Perhaps the compiler isn't complete enough to compile itself? For now, I've made a simple lersp plugin (lersp interprets "an approximation of scheme"): 2> @ mod(lersp_exp). (+ 1 3) @ 4 (I added options to inspect the resulting parse tree: 3> @ mod(lersp_exp), return(parsed). (+ 1 3) @ [[{call,1, {remote,1,{atom,1,lersp_exp},{atom,1,eval}}, [{cons,0,{cons,0,{atom,0,'+'},{string,0,[1,3]}},{nil,0}}]}]] (...as well as pretty-printing the parsed code - might be handy e.g. if the block contains weird macro expansion) 4> @ mod(lersp_exp), return(pretty). (+ 1 3) @ "lersp_exp:eval([['+'|\"\\001\\003\"]]).\n" The callback module that makes this happen: -module(lersp_exp). -export([shell_parse/3, eval/1]). shell_parse(Str, Bs, Env) -> Exprs = lersp_parse:parse_all(Str), {erl_eval, [[{call,1,{remote,1,{atom,1,?MODULE},{atom,1,shell_eval}}, [erl_parse:abstract(Exprs)]}]]}. shell_eval(Exprs) -> {Value, _} = lersp_eval:eval_exprs(Exprs), Value. BR, Ulf W From richardc@REDACTED Thu Nov 15 10:33:24 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 15 Nov 2007 10:33:24 +0100 Subject: [erlang-questions] core erlang evaluator? In-Reply-To: <8209f740711150103y44421662ra07ba203f9159bf8@mail.gmail.com> References: <8209f740711150103y44421662ra07ba203f9159bf8@mail.gmail.com> Message-ID: <473C1264.7050007@it.uu.se> Ulf Wiger wrote: > Is there a core erlang evaluator somewhere, and I just couldn't find it? Not that I know of. It's a thing I just never got around to doing, but it could be handy to have if anybody feels up to the excercise. /Richard From tobbe@REDACTED Thu Nov 15 10:36:03 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 15 Nov 2007 10:36:03 +0100 Subject: [erlang-questions] core erlang evaluator? In-Reply-To: <8209f740711150103y44421662ra07ba203f9159bf8@mail.gmail.com> References: <8209f740711150103y44421662ra07ba203f9159bf8@mail.gmail.com> Message-ID: Ulf Wiger wrote: > Is there a core erlang evaluator somewhere, and I just couldn't find it? > > I am looking for a way to plug in the Haskerl compiler into > my hacked shell. The Haskerl compiler is written in Haskell, > and it compiles to core erlang. Perhaps the compiler isn't > complete enough to compile itself? No, it can't (at the moment :-) Couldn't you just compile it to beam and load it? > > For now, I've made a simple lersp plugin > (lersp interprets "an approximation of scheme"): > > 2> @ mod(lersp_exp). > (+ 1 3) > @ > 4 Cool! --Tobbe > > (I added options to inspect the resulting parse tree: > > 3> @ mod(lersp_exp), return(parsed). > (+ 1 3) > @ > [[{call,1, > {remote,1,{atom,1,lersp_exp},{atom,1,eval}}, > [{cons,0,{cons,0,{atom,0,'+'},{string,0,[1,3]}},{nil,0}}]}]] > > (...as well as pretty-printing the parsed code - might be handy e.g. if > the block contains weird macro expansion) > > 4> @ mod(lersp_exp), return(pretty). > (+ 1 3) > @ > "lersp_exp:eval([['+'|\"\\001\\003\"]]).\n" > > > The callback module that makes this happen: > > -module(lersp_exp). > > -export([shell_parse/3, > eval/1]). > > shell_parse(Str, Bs, Env) -> > Exprs = lersp_parse:parse_all(Str), > {erl_eval, > [[{call,1,{remote,1,{atom,1,?MODULE},{atom,1,shell_eval}}, > [erl_parse:abstract(Exprs)]}]]}. > > shell_eval(Exprs) -> > {Value, _} = lersp_eval:eval_exprs(Exprs), > Value. > > > > BR, > Ulf W From kenneth.lundin@REDACTED Thu Nov 15 10:33:15 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 15 Nov 2007 10:33:15 +0100 Subject: [erlang-questions] EUC '07 papers and slides In-Reply-To: <000001c8250e$37bfddb0$ba2369d4@Dell> References: <03C88F30-7508-4354-8A6B-4CB06A0CAE4F@gmail.com> <4737FFAD.3060405@ericsson.com> <24162acd0711112351t1dd54d1cw85df87e3b5c3fc50@mail.gmail.com> <000001c8250e$37bfddb0$ba2369d4@Dell> Message-ID: The EUC papers and presentations are now available at http://www.erlang.se/euc/07 There are still some presentations missing that we will update soon but there is something to read for every item on the agenda. /Regards Kenneth and Bjarne On 11/12/07, Bjarne D?cker wrote: > > We will set up a final EUC'07 website with all the papers and slides in a > couple of days. Just hang on. > > Bjarne > > ----- Original Message ----- > From: Francis Norton > To: Ulf Wiger (TN/EAB) > Cc: Erlang Questions > Sent: Monday, November 12, 2007 8:51 AM > Subject: Re: [erlang-questions] EUC '07 papers and slides > > Actually the papers *are* at the first location > (http://www.erlang.se/workshop/2007/) - I've just been > browsing them! > > Francis. > > On 12/11/2007, Ulf Wiger (TN/EAB) wrote: > > > > Actually, for the EUC '07, the link would be: > > > > http://www.erlang.se/euc/07/ > > > > ...but the papers are still not there. > > > > BR, > > Ulf W > > > > > > shiwei xu wrote: > > > http://www.erlang.se/workshop/2007/ > > > > > > On 11/10/07, *Joel Reymont* joelr1@REDACTED>> > > > wrote: > > > > > > Are they available yet? > > > > > > I'm particularly interested in the non-destructive array updates. > > > > > > Thanks, Joel > > > > > > -- > > > http://wagerlabs.com > > > > > > > > > > > > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > ________________________________ > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bjarne@REDACTED Thu Nov 15 11:08:16 2007 From: bjarne@REDACTED (=?UTF-8?Q?Bjarne_D=C3=A4cker?=) Date: Thu, 15 Nov 2007 11:08:16 +0100 Subject: [erlang-questions] Erlang User Conference 2007 - Proceedings available References: <20470.83.40.172.193.1194351815.squirrel@lordzealon.com><473074F8.80307@ericsson.com> <20071112141540.GA18962@lambdastream.com> Message-ID: <003001c8276f$71887300$031469d4@Dell> Hello Please enjoy the proceedings from the 13th International Erlang/OTP User Conference http://www.erlang.se/euc/07/ See you next year Bjarne From erlang@REDACTED Thu Nov 15 11:48:51 2007 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 15 Nov 2007 11:48:51 +0100 Subject: [erlang-questions] idea: function meta data Message-ID: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> Module have metadata Mod:module_info(export) etc. But functions do not. idea - attach function meta data with a new attribute. -meta(doc, "the factorial function"). -meta(type, "int -> int"). -meta(keywords, [math]). fac(0) -> 1; fac(N) -> N*fac(N-1) The meta data gets *attached* to the Next function in the module -meta(process, true). foo() -> spawn(fun() -> ... end) After compilation meta data can be access as follows: Mod:meta_data(fac, 1, doc) => "the factorial function" ... Mod:meta_data(fac, 1, glurk) => '$nothing' if we then *standardise* the meta data it will be easy to make loads of nice tools for type checking, documentation etc. I'm off on a trip today - so can somebody hack the preprocess and parser to do this? (( this needs a small change attributes have a different syntax and must be at *before* all functions)) This adds introspection to the language ! /Joe Armstrong From gbulmer@REDACTED Thu Nov 15 11:51:01 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 15 Nov 2007 10:51:01 +0000 Subject: [erlang-questions] DTrace for Erlang In-Reply-To: <4739EB08.9010206@erlang-consulting.com> References: <4739EB08.9010206@erlang-consulting.com> Message-ID: <80DDFD79-CA96-49E5-AC85-8281B93193F5@gmail.com> Henry > You should probably have a look at the trace > functionality built in in Erlang(the trace bif with > the dbg library). That extended with a few bits and > bobs would probably provide you with most of you need. Thanks for the reply. Would you please help me? What are the "few bits and bobs"? I can see that the facilities of erlang:trace work within Erlang (but I have some questions to come), but I have been unable to understand how I get an end-to-end flow (e.g. user-oriented use-case) which passes through e.g. non-Erlang web servers, through Erlang and my Erlang-based services into none-Erlang services like databases via the OS kernel. Specifically, how would I trace between Erlang applications, none- Erlang applications, and the kernel using those "few bits and bobs" so that I get a low-impact on the production system? (I am assuming I will need to filter-down the information so that I don't impact the production system too much). Detail -------- I can understand people here may feel that I am under-constraining the problem, but I expect projects to encompass a mixed set of technologies. I expect to have to deal with end-to-end use-cases for *all* parts of a system. I expect those use-cases will not be replaced with end-to-end Erlang in a single change-over event. At the Erlang User Conference, several examples were described like the Travel Angel, which will implement this mixed technology pattern, and they are non-trivial and so I think they'd benefit from tool support. I do expect many of those change over events to come with some problems. To increase the chances of success, I would like tools which will help customers (and me!) deal with those mixed-technology environments after deployment, in production. I would go a bit further, and suggest in many cases, co-existance of Erlang and legacy technology is critical to enable transition and uptake of Erlang to be practical. DTrace is a tool which can be made to work across those other technologies. I am willing to invest the effort to learn about other comparable, alternatives for a *mixed* technology environment which includes Erlang, but I don't see how that works right now. Summary: I feel strongly that Enterprise-class technologies (which I believe Erlang is) need to co-exist with 'legacy' technologies to increase the opportunities to introduce the improved (Erlang) technologies at tolerable levels of risk in a wide range of situations. I think supporting production tooling (like DTrace), for end-to-end production analysis, debugging and tuning is a facet of co-existance. Garry >> Is anyone working on building an Erlang DTrace provider? >> I realise DTrace isn't available on all Erlang platforms, but now >> that DTrace is available Mac OS X (Leopard), as well as Solaris >> (and FeeeBSD), I feel it might be worth doing. >> About DTrace >> ------------------- >> For those of you unfamiliar with DTrace, it is, basically, magic. >> DTrace provides facilities to trace any program, and many aspects >> of the OS kernel. It has several critical properties: >> 1. A program does not need any changes (no need to compile for >> debug, or anything like that). All existing programs work (to >> some extent). >> 2. When not DTrace'ing, the cost of being DTrace-able is almost >> zero (claimed < 0.5%) and this cost is already included (on >> Solaris & OS X). >> 3. It is 'secure', it honours the access control mechanisms of >> the host OS. >> 4. DTrace can cross process boundaries, and trace the kernel >> itself (if you have the appropriate security privileges) >> These features allow DTrace to be used in *PRODUCTION*. >> Put another way: it is straightforward to trace through a program >> in a user process, back out through the kernel, then into other >> processes. Tracing can be activated *after* a program has been >> deployed and started *without* changing the program or restarting >> it. DTrace overhead, when not tracing a program is (claimed to >> be) essentially zero, and DTrace costs when activated are >> (claimed to be) low. >> DTrace is programmable, with a scripting language a bit like awk >> but without loops; instead of awk text patterns, DTrace probes >> are pattern matched to trigger script actions. Scripting lets >> you correlate events across processes and the kernel, and scripts >> can process the data so that 'noise' can be filtered out. For >> example, it is feasible to trace from an incoming HTTP request >> through a web server, through the kernel, to an application >> server, and back again and correlate many concurrent flows. You >> might want to time that end- to-end flow, or gather intermediate >> timing, or watch for a particular access to a specific file, >> or ..., and the scripting language and functions are powerful >> enough to do that.... >> Why an Erlang DTrace provider? >> --------------------------------------- >> So I hear you ask, why build a DTrace provider for erl when >> DTrace already works (on Solaris and Leopard) with erl? >> Well, DTrace will show which functions are called in the erl >> program (and which file descriptors and sockets are used, etc.), >> but will *not* show you the Erlang program events directly. >> ... >> If I were building a large, complex system, availability of >> DTrace would be an important consideration. I believe several >> companies claim they moved to Solaris to get DTrace, and having >> used it for simple debugging and tuning, I can believe that. >> DTrace is so useful, that the erl developers and maintainers may >> find it extremely useful for debugging, testing, and tuning >> Erlang itself. >> Could I raise it as an EEP, or is it already on the TODO list? From vlm@REDACTED Thu Nov 15 11:56:34 2007 From: vlm@REDACTED (Lev Walkin) Date: Thu, 15 Nov 2007 02:56:34 -0800 Subject: [erlang-questions] performance numbers Message-ID: <473C25E2.8050509@lionet.info> Recently I went out to hunt for a best machine to run Erlang code. I did some prototyping and created a performance testing suite which loosely simulates the load I'll be giving it. Here are the numbers: http://lionet.info/ljimg/erlang-perf-smp-2.png (Unfortunately, the numbers are in tabular form not really suitable for email. Click on the link above to have a picture). In short, I am surprized to see that my 650 MHz Sun machine is TPS-competitive with four-cores (2x2) AMD 2.3 GHz. I am also surprized to see that the best mode of compilation is non-smp, non-hipe, non-native, single threaded code, unless the code involves going out of VM to other systems (e.g., via TCP). Some words about the testing. The "Lock" test executes the lock/unlock code, which is basically a gen_server doing something similar to what you can read in any Erlang book: the resource locking code. Sequential version of it does lock/unlock in sequence, and Parallel version just runs a bunch of processes (2, 4, 8, 10, 100), which generate a series of lock/unlock requests. TCP I/O is essentially stress-testing an Erlang library to memcached, which is running on the same machine. Distinction between Sequential and Parallel modes of execution are essentially the same as with Lock code: Parallel is N processes doing a number of requests to library which communicates to memcached, whereas Sequential is Parallel with N=1. There were thousands of tests for each table cell and the best numbers are retained for the table. Is there anything specific you'd generally recommend to skew these numbers in favor of AMD system? Or Xeon is really the best choice if it comes to running Erlang code? -- Lev Walkin vlm@REDACTED From joelr1@REDACTED Thu Nov 15 11:57:24 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 15 Nov 2007 10:57:24 +0000 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <1c3be50f0711141413m397c2a0btfafc2dfa6b67d159@mail.gmail.com> Message-ID: The difference seems to be in matching an empty binary vs <<_Head:N/ binary>>. Why exactly is the 2nd pattern so much faster? Thanks, Joel On Nov 15, 2007, at 6:53 AM, Bjorn Gustavsson wrote: > index(Str, Char, N) -> > case Str of > <<_Head:N/binary, Char, _Tail/binary>> -> > N + 1; > <<>> -> > 0; > _ -> > index(Str, Char, N + 1) > end. > ... > Note: Your index function can be written speeded a bit. > ... > index(Str, Char, N) -> > case Str of > <<_Head:N/binary, Char, _Tail/binary>> -> > N + 1; > <<_Head:N/binary>> -> > 0; > _ -> > index(Str, Char, N + 1) > end. -- http://wagerlabs.com From joelr1@REDACTED Thu Nov 15 12:16:35 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 15 Nov 2007 11:16:35 +0000 Subject: [erlang-questions] Faxien vs CEAN Message-ID: Shouldn't CEAN and Faxien be integrated somehow? -- http://wagerlabs.com From joelr1@REDACTED Thu Nov 15 12:28:39 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 15 Nov 2007 11:28:39 +0000 Subject: [erlang-questions] LambdaStream's home-made memory management for high-rate binary data Message-ID: <11C2F810-8EB2-4120-B75A-684D50F26209@gmail.com> Samuel, For those of us unable to attend your presentation, would you kindly elaborate on why you needed a home-made C++ memory management solution for high-rate binary data? Thanks, Joel -- http://wagerlabs.com From dmitriid@REDACTED Thu Nov 15 12:19:14 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Thu, 15 Nov 2007 13:19:14 +0200 Subject: [erlang-questions] idea: service pack one In-Reply-To: <006a01c826dc$d4463290$6401a8c0@moneymaker2> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <3DE5502F-39DC-4C08-8528-3F8C1DC239F0@process-one.net> <006a01c826dc$d4463290$6401a8c0@moneymaker2> Message-ID: <473C2B32.4010804@gmail.com> Valentin Micic wrote: > client = flash in the browser > server = whatever (can be erlang) > > and why not: > > protocol = xml rpc > Why not JSON RPC ;) -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Thu Nov 15 12:23:05 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 15 Nov 2007 11:23:05 +0000 Subject: [erlang-questions] idea: function meta data In-Reply-To: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> Message-ID: On 15/11/2007, Joe Armstrong wrote: > Module have metadata Mod:module_info(export) etc. > > But functions do not. > > idea - attach function meta data with a new attribute. > > -meta(doc, "the factorial function"). > -meta(type, "int -> int"). > -meta(keywords, [math]). > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > The meta data gets *attached* to the Next function in the module > > -meta(process, true). > foo() -> spawn(fun() -> ... end) > > After compilation meta data can be access as follows: > > Mod:meta_data(fac, 1, doc) => "the factorial function" I think this will be really useful. I've always wanted a way to provide help for functions but that usually involves either writing a function such as _usage()/0 or _help() and hard to standardise upon. cheers Chandru From bjorn@REDACTED Thu Nov 15 13:41:00 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 15 Nov 2007 13:41:00 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <1c3be50f0711141413m397c2a0btfafc2dfa6b67d159@mail.gmail.com> Message-ID: Joel Reymont writes: > The difference seems to be in matching an empty binary vs <<_Head:N/ > binary>>. > > Why exactly is the 2nd pattern so much faster? The first pattern (<<>>) does not match. That was worked around (by the original author) by adding the following clause: index(Str, _Char, N) when N > size(Str) -> 0; What I did what to make sure that the pattern could match (<<_Head:N/binary>>), and comment out the now redundant second clause. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From gbulmer@REDACTED Thu Nov 15 13:55:22 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 15 Nov 2007 12:55:22 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <6ce0ac130711130848u167f2bf8n36fa07edd8126723@mail.gmail.com> References: <6ce0ac130711130848u167f2bf8n36fa07edd8126723@mail.gmail.com> Message-ID: <666CCB1D-9CBF-4257-9591-CCC61CA13131@gmail.com> >> How about a replacement for eBay auctions (or is Erlang what the e >> mans now?-)? eBay has fault-tolerance, scale, distribution >> challenges. >> ... >> A good solution would support 'live auctions', and keep the bids in >> sequence. >> >> It'd have some of the challenges of a stock market, but you'd avoid >> having to provide liquidity to make it useable (I realise your focus >> is a book, but wouldn't you like millions of people to use the >> software?). > > These problem domains lack one thing that makes a stock exchange such > an interesting problem - the need for low latency! Building a large > scale, distributed, fault-tolerant system is one thing - doing it > while maintaining low latency is a whole different ball game. Showing > that Erlang is well matched to these problems is a huge thing. I agree that a good stock exchange solution implies low latency, but I think a 'live auction' may need this too. Further, I am not sure how low the latency will be; I can't ping amazon, but when I ping google I get round-trip averages over 50 mSec Revisiting the original post: > I want you to start an Amazon EC2 instance and join the "Hardcore > Erlang" cluster. > > I want to build the biggest Erlang cluster in the world and push > Erlang to its limits. My problem is I don't see why *I* would run a stock exchange application, so I don't see why *I* would run Amazon EC2 instances. On the other hand, I do see why I and others might want to run EC2 instances for auctions. A plausible explanation for why I'd run the stock exchange application would help me a lot. Adjusting resources by starting and stopping EC2 instances also seems to be a reasonable fit to auctions. Having a 'hub' which contains the product catalogue would seem to be an enabler for the whole system, and separate EC2 instances would be used for auctions (with some 'low- rent' instances for low-activity auctions). I am not 'wedded' to any particular application. I *would* like to see Erlang running well on EC2, because that seems to be great complementary technology. I would also like to see something which would actually get run at scale, and exploit the EC2 model, so that Erlang+EC2 gets proven. G Bulmer From samuelrivas@REDACTED Thu Nov 15 14:16:21 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Thu, 15 Nov 2007 14:16:21 +0100 Subject: [erlang-questions] LambdaStream's home-made memory management for high-rate binary data In-Reply-To: <11C2F810-8EB2-4120-B75A-684D50F26209@gmail.com> References: <11C2F810-8EB2-4120-B75A-684D50F26209@gmail.com> Message-ID: <20071115131621.GA19035@lambdastream.com> Joel Reymont wrote: > For those of us unable to attend your presentation, would you kindly > elaborate on why you needed a home-made C++ memory management solution for > high-rate binary data? It is more C than C++, I tend to avoid the latter as much as possible (do not start a war with this please :). The thing is that for low-level stream processing, I could not make bitsyntax based code fast enough. In fact, the result was much slower than real-time. The problem is that automatic memory handling devices (such as GC) used by high-level languages fail for that kind of applications. At the end, we had to choose C and handle memory by hand (that comes for free with it). For example, a Spanish TDT transport stream usually carries 4 TV channels. The whole stream bit-rate is 20 mbit/s. We managed to extract meta-information in the stream that show up around each 0.1 second. That is, Erlang is able to read the 20 mbit/s with bitsyntax, throwing away most of the bytes and parsing only relevant data, with rate of hundreds of bits/s only. Also, that kind of data are relatively easy to parse, because they come in fixed-size chunks of 188 bytes. In that case bitsyntax and automatic memory handling is fast enough, and saves us to write tons of code. But, if you try to parse the elementary video streams, which have data fields that are not byte-aligned, performance drops quickly. I have experimented several times with that, but I was not able to get acceptable results, by far. For that kind of things we had to develop a C library, where much of the effort is not only keep a reasonable performance (which is relatively easy), but also avoiding memory leaks, memory faults, and other stuff that you get for free when you get closer the hardware (which is not easy). Of course, the fact that I did not succeed on that does not mean that it is impossible, so I will be happy if someone says that it is possible. Also, Per Gustafsson advanced the new bitsyntax including bitstreams for R12. Part of the burden of parsing unaligned data is that you need extra code to handle padding chunks. I am not sure if that may be a performance penalty too (apart for being really boring :). I have to experiment with that to check whether we can get code fast enough. Another alternative is waiting until a suitable hardware evolution :) In short. When we are not able to use Erlang to handle input data, we have to do by hand all the cool stuff that a garbage collector and a nice virtual machine do for you. Regards -- Samuel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From saleyn@REDACTED Thu Nov 15 14:20:38 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 15 Nov 2007 08:20:38 -0500 Subject: [erlang-questions] idea: function meta data In-Reply-To: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> Message-ID: <473C47A6.8050109@gmail.com> It would be very useful indeed. Especially it the shell offered an extended version of help that would display available metadata: 1> help(Module, Function). Joe Armstrong wrote: > Module have metadata Mod:module_info(export) etc. > > But functions do not. > > idea - attach function meta data with a new attribute. > > -meta(doc, "the factorial function"). > -meta(type, "int -> int"). > -meta(keywords, [math]). > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > The meta data gets *attached* to the Next function in the module > > -meta(process, true). > foo() -> spawn(fun() -> ... end) > > After compilation meta data can be access as follows: > > Mod:meta_data(fac, 1, doc) => "the factorial function" > ... > Mod:meta_data(fac, 1, glurk) => '$nothing' > > if we then *standardise* the meta data it will be easy to make loads > of nice tools for type checking, documentation etc. > > I'm off on a trip today - so can somebody hack the preprocess and > parser to do this? (( this needs a small change > attributes have a different syntax and must be at *before* all functions)) > > This adds introspection to the language ! > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From juhani@REDACTED Thu Nov 15 14:21:22 2007 From: juhani@REDACTED (=?ISO-8859-1?Q?Juhani_R=E4nkimies?=) Date: Thu, 15 Nov 2007 15:21:22 +0200 Subject: [erlang-questions] idea: service pack one In-Reply-To: <3DE5502F-39DC-4C08-8528-3F8C1DC239F0@process-one.net> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <3DE5502F-39DC-4C08-8528-3F8C1DC239F0@process-one.net> Message-ID: Hi, Interesting. Does your server implement RTMP? Too bad it's 'just for information' :) -juhani 2007/11/14, Micka?l R?mond : > Hello, > > > Le 13 nov. 07 ? 22:27, Joe Armstrong a ?crit : > 9 ++++ interface to flash using flex 2. Solve the GUI problem once and > for all as follows > > repeat after me: client = flash in the browser, server = erlang. > Intermediate protocol = flash AMF > > This is early information, but just for information we have a very advanced > Flash server developed in Erlang :) > (I know you know Joe, as I made a demo ;) > > -- > Micka?l R?mond > http://www.process-one.net/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Juhani R?nkimies From joelr1@REDACTED Thu Nov 15 14:34:48 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 15 Nov 2007 13:34:48 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <666CCB1D-9CBF-4257-9591-CCC61CA13131@gmail.com> References: <6ce0ac130711130848u167f2bf8n36fa07edd8126723@mail.gmail.com> <666CCB1D-9CBF-4257-9591-CCC61CA13131@gmail.com> Message-ID: On Nov 15, 2007, at 12:55 PM, G Bulmer wrote: >>> (I realise your focus >>> is a book, but wouldn't you like millions of people to use the >>> software?). No, I wouldn't. The software I will create for the book is just educational software. I will use this software to demonstrate Erlang features and to try to build a huge EC2 cluster. I will likely develop the software for millions of people to use after I write the book. It will be a commercial effort based on the concepts described in the book. I don't think it's possible or viable to develop production software and write a book about this software at the same time. There's not enough time or pages in the book to accomplish such a feat. >> Further, I am not sure how low the latency will be; I can't ping >> amazon, but when I ping google I get round-trip averages over 50 mSec I think latency here is the delay introduced by the software itself, not the delay introduced by the internet. > My problem is I don't see why *I* would run a stock exchange > application, so I don't see why *I* would run Amazon EC2 instances. You don't need to run a stock exchange application. You may want to add your instance to the cluster to take part in the Erlang scalability test. > On the other hand, I do see why I and others might want to run EC2 > instances for auctions. > A plausible explanation for why I'd run the stock exchange > application would help me a lot. Writing a book is a marketing venture with an element of teaching. It helps to be passionate about the subject one is writing about. I'm not passionate about auctions but I am passionate about all things trading. I don't want to sell books or have a need to. I do, on the other hand, want to show that Erlang is a good fit for high- availability financial apps. This is my focus. > Adjusting resources by starting and stopping EC2 instances also > seems to be a reasonable fit to auctions. Having a 'hub' which > contains the product catalogue would seem to be an enabler for the > whole system, and separate EC2 instances would be used for auctions > (with some 'low-rent' instances for low-activity auctions). I'm putting together all the feedback that I received so far and trying to organize it into a table of contents. The book is turning out to be quite thick. May I suggest that you take up a parallel effort and describe how to build auctions on EC2 in a series of blog posts? The software you develop will be commercially viable and useful to you. It will serve as additional proof of viability of Erlang on EC2. Thanks, Joel -- http://wagerlabs.com From ulf@REDACTED Thu Nov 15 15:04:08 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 15 Nov 2007 15:04:08 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> Message-ID: <8209f740711150604w42a6fff7o3f2330884ba8fcd5@mail.gmail.com> 2007/11/13, Ulf Wiger : > >> Here's a more outlandish idea: > > Allow for arbitrary syntax to be inserted in the shell, by > catching lines starting with '@' (only because this is what > Joe used in his ML9). Now for the ultimate display of usefulness: 6> @ type(module). -module(xXx). -author('mats cronqvist'). -export([x/1]). -define(x,x(. -define(Xx,X. -define(X,X) ->. ?x?X?Xx. @ {module,xXx} (So, we successfully defined, compiled and loaded a module from the shell, but what does it do? The subtle macros have me confused. Let's type it in again, with an added option. Luckily, copy/paste is easy since the prompt isn't repeated for each line.) 7> @ type(module), return(pretty). -module(xXx). -author('mats cronqvist'). -export([x/1]). -define(x,x(. -define(Xx,X. -define(X,X) ->. ?x?X?Xx. @ "-module(xXx).\n-author('mats cronqvist').\n-export([x/1]).\nx(X) ->\n X.\n" 8> io:fwrite("~s~n", [v(7)]). -module(xXx). -author('mats cronqvist'). -export([x/1]). x(X) -> X. ok (Ah, now even I can understand it!) 9> xXx:x(17). 17 For this to work, I had to replace Mats's macro parser with epp, and used my ram_file_io_server module and a slightly hacked epp (to be able to hand it a descriptor to an already opened file.) BR, Ulf W From ulf@REDACTED Thu Nov 15 15:08:35 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 15 Nov 2007 15:08:35 +0100 Subject: [erlang-questions] how: string stream? In-Reply-To: <47284C16.8010008@ericsson.com> References: <779bf2730710301846o1f9fd82dqe2f596f84ccb82d5@mail.gmail.com> <47283B13.4030404@ericsson.com> <47284C16.8010008@ericsson.com> Message-ID: <8209f740711150608p17258fc2i86b7810db03b2160@mail.gmail.com> I finally figured out that my use of the ram_file_io_server was buggy. The function ram_file:open/2 doesn't take a file name as a first argument, but rather the data that's supposed to go into the file. A more correct call would be: erlhive_ram_file_io_server:start(self(), Str, [read]). As I had done it, the file was first created with the file name as its content, which was then (hopefully completely) overwritten by Str. I had some great fun debugging when I tried this on code that was shorter than the file name I had invented. (: BR, Ulf W 2007/10/31, Ulf Wiger (TN/EAB) : > Bengt Kleberg wrote: > > greetings, > > > > there are at least two string streams that i know of. Ulf Wiger has one > > and I have one (string_io). his should be better. > > I assume you mean this: > > http://erlhive.svn.sourceforge.net/viewvc/erlhive/trunk/lib/erlhive/src/erlhive_ram_file_io_server.erl?revision=57&view=markup > > used in this fasion: > > http://erlhive.svn.sourceforge.net/viewvc/erlhive/trunk/lib/erlhive/src/erlhive_rewrite.erl?revision=64&view=markup > > 121 parse_string(Str, Fname) -> > 122 {ok, Fd} = open_ram_file(Fname), > 123 file:write(Fd, Str), > 124 file:position(Fd, 0), > 125 case epp_dodger:parse(Fd) of > 126 {ok, Tree} -> > 127 close_ram_file(Fd), > 128 Tree; > 129 Error -> > 130 close_ram_file(Fd), > 131 erlang:error(Error) > 132 end. > 133 > 134 > 135 open_ram_file(Fname) -> > 136 erlhive_ram_file_io_server:start(self(), Fname, [read,write]). > 137 > 138 close_ram_file(Fd) -> > 139 file:close(Fd). > > It's not exactly a string stream, though. > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From alceste@REDACTED Thu Nov 15 15:15:20 2007 From: alceste@REDACTED (Alceste Scalas) Date: Thu, 15 Nov 2007 15:15:20 +0100 Subject: [erlang-questions] idea: Erlang FFI: new draft EEP and patches Message-ID: <1195136120.6436.87.camel@gnatziu.crs4.it> Hello, after some developers' feedback (special thanks to Serge Aleynikov!), I've updated the Erlang FFI draft EEP and patches. Everything is available at the usual place: http://muvara.org/crs4/erlang/ffi The previous Erlang FFI report is available in [1]. Here's a quick list of changes in the new release: 1. EEP: some notes about type contracts, libffi dependency, vararg functions; 2. patches: moved the FFI high-level API in a brand-new ffi library (it was inside the kernel library before). It should be a cleaner approach, and allows the Erlang build procedure to warn if the FFI support could not be enabled for some reason. I think that this version of the EEP can replace the old EEP 7 that is currently available on erlang.org [2]. As usual, your feedback is welcome --- and encouraged! There are a few aspects that should be improved: 1. the high-level, type-tagged FFI API may overlap in functionality with type contracts (see "Notes on type-tagged values" [3]); 2. floating-point checking functions should be improved, e.g. to return FLT_EPSILON for the current platform (some changes to ffi.erl should be enough, without touching the emulator C sources). This is partially related to the previous point; 3. when the emulator is compiled without FFI support, the FFI BIFs should throw a more descriptive error (they now cause a not-very-helpful 'badarg'...); 4. the patches are untested on bigendian platforms (I expect them to require several fixes --- beta testers needed!) "1" and "2" can be solved in different ways, depending on type contracts capabilities and Erlang developers' feedback. "3" may require the introduction of a new BIF error, so Erlang core developers' opinion would be more than welcome. "4" just needs someone with a bigendian machine at hand... I think that including the FFI as an experimental feature in OTP R12B could help solving all these issues. On bigendian machines, it could be disabled by default. The current reference implementation is based on OTP R11B-5 --- but if there is some possibility to include the FFI in R12B, then I could adapt the patches to the R12B snapshots (it *seems* to be quite easy, but the snapshots are a moving target...). Regards, alceste References: [1] Previous report about the FFI extension for Erlang/OTP: http://erlang.org/pipermail/erlang-questions/2007-September/029586.html [2] Current version of the EEP 7 (Foreign Function Interface): http://www.erlang.org/svn/projects/eeps/trunk/eep-0007.txt?revision=19&view=markup [3] FFI EEP: Notes on type-tagged values http://muvara.org/crs4/erlang/ffi/eep-ffi.html#notes-on-type-tagged-values -- Alceste Scalas CRS4 - http://www.crs4.it/ From andreas.hillqvist@REDACTED Thu Nov 15 15:31:31 2007 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Thu, 15 Nov 2007 15:31:31 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> Message-ID: <8268eea30711150631q45d1e422j2def141c62020544@mail.gmail.com> I like the Idea of function meta data. But it might be better/simpler/easier/harder to use an alternativ prefix, like double -- (Similar to %, %% and %%%). Why not use the name atom instead of meta? To me meta dose not contribute with value to the syntax. Would look like: -module(test). -export([fac/1]. --doc("the factorial function"). --type("int -> int"). --keywords([math]). fac(0) -> 1; fac(N) -> N*fac(N-1) Or some other prefix like "+"(Just an example, Do not like + myself. To much alike the udiff format. ;-)? -module(test). -export([fac/1]. +doc("the factorial function"). +type("int -> int"). +keywords([math]). fac(0) -> 1; fac(N) -> N*fac(N-1) Regards Andreas Hillqvist 2007/11/15, Joe Armstrong : > Module have metadata Mod:module_info(export) etc. > > But functions do not. > > idea - attach function meta data with a new attribute. > > -meta(doc, "the factorial function"). > -meta(type, "int -> int"). > -meta(keywords, [math]). > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > The meta data gets *attached* to the Next function in the module > > -meta(process, true). > foo() -> spawn(fun() -> ... end) > > After compilation meta data can be access as follows: > > Mod:meta_data(fac, 1, doc) => "the factorial function" > ... > Mod:meta_data(fac, 1, glurk) => '$nothing' > > if we then *standardise* the meta data it will be easy to make loads > of nice tools for type checking, documentation etc. > > I'm off on a trip today - so can somebody hack the preprocess and > parser to do this? (( this needs a small change > attributes have a different syntax and must be at *before* all functions)) > > This adds introspection to the language ! > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From juanjo@REDACTED Thu Nov 15 15:20:38 2007 From: juanjo@REDACTED (Juan Jose Comellas) Date: Thu, 15 Nov 2007 11:20:38 -0300 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <1c3be50f0711141413m397c2a0btfafc2dfa6b67d159@mail.gmail.com> Message-ID: <1c3be50f0711150620l11d1b91eoec03a8793ee44150@mail.gmail.com> Thanks for the tips. I'm going to start using this idiom now. BTW, is the Erlang VM capable of expanding a binary without copying data if there is a contiguous block of memory available? If a feature like this one could be added, it would be possible to efficiently append data to a binary without resorting to using a list as an intermediate value. Another option could be to make the binaries preallocate memory. Just a thought... On 15 Nov 2007 07:53:26 +0100, Bjorn Gustavsson wrote: > > "Juan Jose Comellas" writes: > > > One thing that I was always doing when iterating over binaries is doing > > matches like the following one: > > > > <> > > You don't have to do that anymore in R12B. > > Take for instance your index/2 function: > > index(Str, Char) when is_binary(Str), is_integer(Char) -> > index(Str, Char, 0). > index(Str, _Char, N) when N > size(Str) -> > 0; > index(Str, Char, N) -> > case Str of > <<_Head:N/binary, Char, _Tail/binary>> -> > N + 1; > <<>> -> > 0; > _ -> > index(Str, Char, N + 1) > end. > > In R12B, you can write it simply like: > > index(Str, Char) when is_binary(Str), is_integer(Char) -> > index(Str, Char, 1). > > index(<>, Char, N) -> > N; > index(<<_,T/binary>>, Char, N) -> > index(T, Char, N+1); > index(<<>>, _, _) -> 0. > > On my Sparc workstation this simpler program is more than twice as fast > in R12B. > > Note: Your index function can be written speeded a bit. > > index(Str, Char) when is_binary(Str), is_integer(Char) -> > index(Str, Char, 0). > %% index(Str, _Char, N) when N > size(Str) -> > %% 0; > index(Str, Char, N) -> > case Str of > <<_Head:N/binary, Char, _Tail/binary>> -> > N + 1; > <<_Head:N/binary>> -> > 0; > _ -> > index(Str, Char, N + 1) > end. > > Still, even after this improvement, in R12B the simpler version is about > twice > as fast. > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbulmer@REDACTED Thu Nov 15 15:57:13 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 15 Nov 2007 14:57:13 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: References: <6ce0ac130711130848u167f2bf8n36fa07edd8126723@mail.gmail.com> <666CCB1D-9CBF-4257-9591-CCC61CA13131@gmail.com> Message-ID: Oh, okay. I am sorry to seem a bit slow. Summary: - You want something interesting enough to induce a bunch of us to run EC2 instances in order to test a humongous Erlang+EC2 cluster. - It has to be interesting to you so that you get it done. - It does *not* need to be production quality. > On Nov 15, 2007, at 12:55 PM, G Bulmer wrote: >>>> (I realise your focus >>>> is a book, but wouldn't you like millions of people to use the >>>> software?). > > No, I wouldn't. The software I will create for the book is just > educational software. I will use this software to demonstrate > Erlang features and to try to build a huge EC2 cluster. ... > I will likely develop the software for millions of people to use > after I write the book. .... There's not enough time or pages in > the book to accomplish such a feat. Okay, I understand, and can agree that designing and building a usable stock exchange, at the same time as writing a book, may be too much work in the time window available. >>> Further, I am not sure how low the latency will be; I can't ping >>> amazon, but when I ping google I get round-trip averages over 50 >>> mSec > > I think latency here is the delay introduced by the software > itself, not the delay introduced by the internet. Well, Amdahl's law says the largest component of performance dominates optimisations ... So, is your plan to run the whole thing within EC2? > >> My problem is I don't see why *I* would run a stock exchange >> application, so I don't see why *I* would run Amazon EC2 instances. > > You don't need to run a stock exchange application. You may want to > add your instance to the cluster to take part in the Erlang > scalability test. Ah, ha! I think I've got it! >> ... > .... May I suggest that you take up a parallel effort and describe > how to build auctions on EC2 in a series of blog posts? The > software you develop will be commercially viable and useful to you. > It will serve as additional proof of viability of Erlang on EC2. I am not passionate about auctions, it just seemed more likely that people would use it, and hence it'd get a large number of instances being 'thrashed' by live traffic. I now understand that is a 'non- goal'. You only need something big for a 'cluster-fest'. Maybe I will wait for the extremely-large-scale Erlang+EC2 cluster issues to be solved. That I am interested in! Good luck G Bulmer From vlm@REDACTED Thu Nov 15 16:03:07 2007 From: vlm@REDACTED (Lev Walkin) Date: Thu, 15 Nov 2007 07:03:07 -0800 Subject: [erlang-questions] idea: function meta data In-Reply-To: <8268eea30711150631q45d1e422j2def141c62020544@mail.gmail.com> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> <8268eea30711150631q45d1e422j2def141c62020544@mail.gmail.com> Message-ID: <473C5FAB.8030706@lionet.info> One of the most peculiar problems people have with certain languages (Objective-C) is that punctuation and non-alphabetical characters are overloaded beyond all reason. +module, -interface, @end, etc. We risk ending up with something like -module(test). +module(test). @module(test). where module is a keyword in one place and atom in another. Having more or less uniform "-()." is arguably more self-consistent and removes unnecessary learning curve. Just 2c. Andreas Hillqvist wrote: > I like the Idea of function meta data. > > But it might be better/simpler/easier/harder to use an alternativ > prefix, like double -- (Similar to %, %% and %%%). > > Why not use the name atom instead of meta? > To me meta dose not contribute with value to the syntax. > > Would look like: > > -module(test). > -export([fac/1]. > > --doc("the factorial function"). > --type("int -> int"). > --keywords([math]). > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > Or some other prefix like "+"(Just an example, Do not like + myself. > To much alike the udiff format. ;-)? > -module(test). > -export([fac/1]. > > +doc("the factorial function"). > +type("int -> int"). > +keywords([math]). > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > > Regards > Andreas Hillqvist > > 2007/11/15, Joe Armstrong : >> Module have metadata Mod:module_info(export) etc. >> >> But functions do not. >> >> idea - attach function meta data with a new attribute. >> >> -meta(doc, "the factorial function"). >> -meta(type, "int -> int"). >> -meta(keywords, [math]). >> >> fac(0) -> 1; >> fac(N) -> N*fac(N-1) >> >> The meta data gets *attached* to the Next function in the module >> >> -meta(process, true). >> foo() -> spawn(fun() -> ... end) >> >> After compilation meta data can be access as follows: >> >> Mod:meta_data(fac, 1, doc) => "the factorial function" >> ... >> Mod:meta_data(fac, 1, glurk) => '$nothing' >> >> if we then *standardise* the meta data it will be easy to make loads >> of nice tools for type checking, documentation etc. >> >> I'm off on a trip today - so can somebody hack the preprocess and >> parser to do this? (( this needs a small change >> attributes have a different syntax and must be at *before* all functions)) >> >> This adds introspection to the language ! >> >> /Joe Armstrong >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From james.hague@REDACTED Thu Nov 15 16:19:31 2007 From: james.hague@REDACTED (James Hague) Date: Thu, 15 Nov 2007 09:19:31 -0600 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: > There are probably more things I could add - feel free to add you pet > annoyance that can be easily fixed and we'll put it into service pack one. 1. Make lists:reverse/1 be auto-imported so the "lists:" prefix can be dropped. 2. From the shell, have c() recompile the last module compiled from the shell: c(test). <--- compiles test c(). <--- also compiles test James From james.hague@REDACTED Thu Nov 15 16:16:11 2007 From: james.hague@REDACTED (James Hague) Date: Thu, 15 Nov 2007 09:16:11 -0600 Subject: [erlang-questions] idea: service pack one In-Reply-To: References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: On Nov 13, 2007 6:52 PM, Fredrik Svahn wrote: > > If not, please let me know what opertaions you would like to be able > to do on binaries. Are there any design patterns or operations on > binaries that you keep writing over and over again? Any code involving > binaries which could be written in a more elegant way with a support > function? Any operations which you feel would be suitable to implement > as BIFs? Stuff I have wished for: 1. Convert a reversed list to a binary. That is, a single function to replace list_to_binary(lists:reverse(List)). Directly reversing a binary would be helpful, too. 2. Scanning for a specific value or a value in a set. James From bjorn@REDACTED Thu Nov 15 16:44:22 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 15 Nov 2007 16:44:22 +0100 Subject: [erlang-questions] idea: service pack one In-Reply-To: <1c3be50f0711150620l11d1b91eoec03a8793ee44150@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <1c3be50f0711141413m397c2a0btfafc2dfa6b67d159@mail.gmail.com> <1c3be50f0711150620l11d1b91eoec03a8793ee44150@mail.gmail.com> Message-ID: "Juan Jose Comellas" writes: > BTW, is the Erlang VM capable of expanding a binary without copying data if > there is a contiguous block of memory available? If a feature like this one > could be added, it would be possible to efficiently append data to a binary > without resorting to using a list as an intermediate value. Another option > could be to make the binaries preallocate memory. In R12B, when you append to a binary the first time memory will be preallocated so that the next append operation can be done without copying. There will be a new chapter in the Efficiency Guide about binaries and the new optimizations. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From juanjo@REDACTED Thu Nov 15 16:56:17 2007 From: juanjo@REDACTED (Juan Jose Comellas) Date: Thu, 15 Nov 2007 12:56:17 -0300 Subject: [erlang-questions] how: Matching empty binaries at the beginning Message-ID: <1c3be50f0711150756n606bad0dn9923f95ae3eaa6f8@mail.gmail.com> Why is this expression not matching? A = <<"ABC">>, Empty = <<>>, <> = A. I was expecting that this would result in 'Tail' being bound to <<"ABC">>, but instead I'm getting a badmatch error. However, if I specify the length of the 'Empty' variable, it works: <> = A. And if I put 'Empty' as the last part of the pattern it also works: <> = A. Is matching for binaries supposed to work like this or is it a bug? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbulmer@REDACTED Thu Nov 15 17:51:04 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 15 Nov 2007 16:51:04 +0000 Subject: [erlang-questions] idea: function meta data Message-ID: <094C1931-3957-4EE7-843E-00BBF96FBB9E@gmail.com> Lovely idea. I had imagined that type part of this was already done by the Erlang type contract syntax checker (in Erlang Workshop paper "A Language for Specifying Type Contracts in Erlang and its Interaction with Success Typings", and mentioned in "I want documentation of Erlang in EDoc format" on this list). Specifically, there is/will be a parser for the type contract, and tooling which checks the type contract specification matches the actual function (in some useful sense). Storing the parsed type contracts in the compiled file seems to solve potential problems. So, the idea here is to connect together even more function metadata too, and store it in the code file? So, I don't understand the need for "int -> int". How about using the type contract syntax: -meta(type, function_name/N, type_contract). %% where type_contract uses the proposed type contract syntax This would interpolate the function name and a type contract representation into the metadata stream. Then follow it with something slightly different, e.g. meta_attr(...) which adds attributes to the most recent meta(...). The idea is to use the function name and type contract as a consistent, unique, key within the module, and hence across a running system. Then the standard for the unique key is 'done', and everything else becomes name value pairs. If this were the path followed, we would need to have the type contract available at run time. This would also provide a handle which could be used to check type compatibility of functions within modules without needing external infrastructure. I've read some papers (at: http://groups.csail.mit.edu/pag/reading- group/, maybe in 2005) about tooling which uses related techniques to support global program analysis to enable analysis to scale to enormous systems (where complete source analysis might not scale, or where source code may not be available). G Bulmer PS - I'd seperated the type contract from the function name so that I could use macro replacement for type contracts if I had a family of functions, and maybe the key would be a tuple, so I could get all meta data for the same function name, irrespective of arrity or type contract. but that may be making it too complicated. > From: "Joe Armstrong" > Subject: [erlang-questions] idea: function meta data > > Module have metadata Mod:module_info(export) etc. > > But functions do not. > > idea - attach function meta data with a new attribute. > > -meta(doc, "the factorial function"). > -meta(type, "int -> int"). > -meta(keywords, [math]). > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > The meta data gets *attached* to the Next function in the module > > -meta(process, true). > foo() -> spawn(fun() -> ... end) > > After compilation meta data can be access as follows: > > Mod:meta_data(fac, 1, doc) => "the factorial function" > ... > Mod:meta_data(fac, 1, glurk) => '$nothing' > > if we then *standardise* the meta data it will be easy to make loads > of nice tools for type checking, documentation etc. > > I'm off on a trip today - so can somebody hack the preprocess and > parser to do this? (( this needs a small change > attributes have a different syntax and must be at *before* all > functions)) > > This adds introspection to the language ! > From jim.mccoy@REDACTED Thu Nov 15 18:45:41 2007 From: jim.mccoy@REDACTED (Jim McCoy) Date: Thu, 15 Nov 2007 09:45:41 -0800 Subject: [erlang-questions] idea: service pack one In-Reply-To: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> Message-ID: > There are probably more things I could add - feel free to add you pet > annoyance that can be easily fixed and we'll put it into service pack one. Make refs and pids be real random numbers that are large enough to be considered cryptographically secure. -jim From moltonel@REDACTED Thu Nov 15 18:55:23 2007 From: moltonel@REDACTED (Vincent de Phily) Date: Thu, 15 Nov 2007 17:55:23 +0000 (UTC) Subject: [erlang-questions] =?utf-8?b?b2RiYzoge3BvcnRfZXhpdCwJY29sbGVjdGlu?= =?utf-8?q?g=5Fof=5Fdriver=5Finformation=5Ffailed=7D?= References: <779bf2730710092339p578306d9pd4479766942987a8@mail.gmail.com> Message-ID: YC gmail.com> writes: > > Hi all -I'm running into the following error when using odbc to connect > against postgresql.? I'm able to do the same with mysql, and I verified the > odbc connection working through isql & DataManager. > It seems that the connection was opened but then closed again, but I'm not > sure on how to proceed as my ODBC connection is working.? Any one else seen > this issue before? Any pointers are appreciated, thanks. > yc(emacs aiel)102> {ok, Ref4} = odbc:connect("DSN=test3", []). [...] > {port_exit,collecting_of_driver_information_faild} I'm facing the same problem (up to collecting_of_driver_information_faild) and haven't solved it yet. Using postgres and unixODBC on linux. Connecting via the GUI works. Using the postgres driver bundled with unixODBC (I also tried the driver from http://pgfoundry.org/projects/psqlodbc/, but it didn't work at all). If somebody, or even the original author now has a solution... You know where to post :) For completenes's sake, I'll mention the native driver from http://www.erlang-consulting.com/aboutus/opensource.html does work, but seriously lack features :( From cyberlync@REDACTED Thu Nov 15 20:17:47 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 15 Nov 2007 11:17:47 -0800 Subject: [erlang-questions] Faxien vs CEAN In-Reply-To: References: Message-ID: You mean the repositories I assume? The answer is 'maybe'. When we started the faxien erlware project we talked about doing just that with the CEAN guys. In the end hitching faxien up to vanilla CEAN didn't prove tenable for various reasons. The topic came up again at the recent EUC as well and we are kicking off a conversion with the the Process One folks again. Whether the two repositories formats will merge or not is still an open question, we will see what happens. On Nov 15, 2007 3:16 AM, Joel Reymont wrote: > Shouldn't CEAN and Faxien be integrated somehow? > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ellisonbg.net@REDACTED Thu Nov 15 20:23:47 2007 From: ellisonbg.net@REDACTED (Brian Granger) Date: Thu, 15 Nov 2007 12:23:47 -0700 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <666CCB1D-9CBF-4257-9591-CCC61CA13131@gmail.com> References: <6ce0ac130711130848u167f2bf8n36fa07edd8126723@mail.gmail.com> <666CCB1D-9CBF-4257-9591-CCC61CA13131@gmail.com> Message-ID: <6ce0ac130711151123y4549620ci3469e8385a2b5d76@mail.gmail.com> > > My problem is I don't see why *I* would run a stock exchange > application, so I don't see why *I* would run Amazon EC2 instances. > On the other hand, I do see why I and others might want to run EC2 > instances for auctions. > A plausible explanation for why I'd run the stock exchange > application would help me a lot. I don't imagine that many people would want to run a stock exchange or auction software themselves. But, I think that is not the point. The point is that _many_ of us (potential readers of the book) might want/need to build systems that have similar properties (distributed, fault tolerant, low-latency, etc.) to these systems. At that level, I also don't care what the book uses as an example - as long as the example demonstrates the relevant ideas. To me low-latency is really important. From daniel.caune@REDACTED Thu Nov 15 20:35:26 2007 From: daniel.caune@REDACTED (Daniel Caune) Date: Thu, 15 Nov 2007 14:35:26 -0500 Subject: [erlang-questions] Erlang & PostgreSQL native driver Message-ID: <1E293D3FF63A3740B10AD5AAD88535D2067519D0@UBIMAIL1.ubisoft.org> Hi, I did a small patch on the file pgsql_util.erl to support PostgreSQL function that returns void. I'm contacting Christian Sunesson to ask him whether he would like to integrate this patch in CVS. *************** *** 233,238 **** --- 233,239 ---- 1560 -> bit; 1562 -> varbit; 1700 -> numeric; + 2278 -> void; Oid -> throw({unknown_oid, Oid}) end. Regards, -- Daniel > -----Message d'origine----- > De?: Daniel Caune > Envoy??: jeudi, novembre 15, 2007 14:06 > ??: erlang-questions@REDACTED; pgsql-sql@REDACTED > Objet?: Erlang & PostgreSQL native driver > > Hi, > > We are using Erlang, PostgreSQL 8.2.5, and the Erlang library pgsql > developed by Christian Sunesson > (http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/pgsql/). > > > The Erlang library pgsql is easy to use and does the job so far, at least > for our prototyping phase. However, this library has a problem with > stored function that returns nothing such as: > > CREATE OR REPLACE FUNCTION foo() > RETURNS void > AS $$ > ... > > The problem seems to happen when the Erlang library pgsql tries to decode > the result value return by the stored function, which is void. The > transaction has been successfully committed in database. > > (u@REDACTED)3> pgsql:squery(Connection, "SELECT foo()"). > =ERROR REPORT==== 15-Nov-2007::11:40:25 === > Error in process <0.38.0> on node 'u@REDACTED' with exit value: > {{nocatch,{unknown_oid,2278}},[{pgsql_util,decode_oid,1},{pgsql_util,decod > e_descs,1},{pgsql_proto,process_squery,1},{pgsql_proto,idle,2}]} > > ** exited: {{nocatch,{unknown_oid,2278}}, > [{pgsql_util,decode_oid,1}, > {pgsql_util,decode_descs,1}, > {pgsql_proto,process_squery,1}, > {pgsql_proto,idle,2}]} ** > > I don't think this is a big issue. According to the error (unknown_oid), > I suppose that the pgsql library doesn't support void type yet. We should > be able to fix easily the library. > > However, because our prototyping phase is close to the end, we are > thinking to use another library that would perhaps better fit production > constraints (pool, etc.). We have tested the PostgreSQL ODBC driver but > we have faced some issues on Windows (Unicode, PostgreSQL data type > support). > > We are interesting in having some feedback from people who use both Erlang > and PostgreSQL. Which PostgreSQL driver do you use? Does someone use the > PostgreSQL driver from Erlang Consulting? Are there other native > PostgreSQL driver? > > Thanks, > > -- > Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: pgsql_util.erl Type: application/octet-stream Size: 9803 bytes Desc: pgsql_util.erl URL: From juanjo@REDACTED Thu Nov 15 20:35:24 2007 From: juanjo@REDACTED (Juan Jose Comellas) Date: Thu, 15 Nov 2007 16:35:24 -0300 Subject: [erlang-questions] how: Matching empty binaries at the beginning In-Reply-To: <69d143cd0711151122t5f21aed6if124b1a78fd7a5cd@mail.gmail.com> References: <1c3be50f0711150756n606bad0dn9923f95ae3eaa6f8@mail.gmail.com> <69d143cd0711151122t5f21aed6if124b1a78fd7a5cd@mail.gmail.com> Message-ID: <1c3be50f0711151135o206f9c57wef63b44f6592d7c5@mail.gmail.com> I don't think that is the cause, because it doesn't work for non-empty binaries either. Look at this: > ABC = <<"ABC">>. <<"ABC">> > A = <<"A">>. <<"A">> > <> = ABC. ** exited: {{badmatch,<<"ABC">>},[{erl_eval,expr,3}]} ** And if I add the size of the binary it now works: > <> = ABC. <<"ABC">> On 11/15/07, Jeremy Wall wrote: > > > > On 11/15/07, Juan Jose Comellas wrote: > > > > Why is this expression not matching? > > > > A = <<"ABC">>, > > Empty = <<>>, > > <> = A. > > I was expecting that this would result in 'Tail' being bound to <<"ABC">>, > > but instead I'm getting a badmatch error. However, if I specify the length > > of the 'Empty' variable, it works: > > > > <> = A. > > And if I put 'Empty' as the last part of the pattern it also works: > > > > I suspect this is because empty binaries don't have a size so erlang can't > determine the size for you meaning you have to explicitly specify a size of > 0 for erlang to figure out how to match it. Might be nice if it could figure > out the 0 part itself but not neccessarily a bug. Maybe a Core developer > could shed more light? > > <> = A. > > > > Since /binary on the end just means the rest of the binary I would expect > this to work exactly as it does without specifying a size. > > Is matching for binaries supposed to work like this or is it a bug? > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Jeremy Wall > http://jeremy.marzhillstudios.com > Jeremy@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.caune@REDACTED Thu Nov 15 20:06:28 2007 From: daniel.caune@REDACTED (Daniel Caune) Date: Thu, 15 Nov 2007 14:06:28 -0500 Subject: [erlang-questions] Erlang & PostgreSQL native driver Message-ID: <1E293D3FF63A3740B10AD5AAD88535D20675195B@UBIMAIL1.ubisoft.org> Hi, We are using Erlang, PostgreSQL 8.2.5, and the Erlang library pgsql developed by Christian Sunesson (http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/pgsql/). The Erlang library pgsql is easy to use and does the job so far, at least for our prototyping phase. However, this library has a problem with stored function that returns nothing such as: CREATE OR REPLACE FUNCTION foo() RETURNS void AS $$ ... The problem seems to happen when the Erlang library pgsql tries to decode the result value return by the stored function, which is void. The transaction has been successfully committed in database. (u@REDACTED)3> pgsql:squery(Connection, "SELECT foo()"). =ERROR REPORT==== 15-Nov-2007::11:40:25 === Error in process <0.38.0> on node 'u@REDACTED' with exit value: {{nocatch,{unknown_oid,2278}},[{pgsql_util,decode_oid,1},{pgsql_util,dec ode_descs,1},{pgsql_proto,process_squery,1},{pgsql_proto,idle,2}]} ** exited: {{nocatch,{unknown_oid,2278}}, [{pgsql_util,decode_oid,1}, {pgsql_util,decode_descs,1}, {pgsql_proto,process_squery,1}, {pgsql_proto,idle,2}]} ** I don't think this is a big issue. According to the error (unknown_oid), I suppose that the pgsql library doesn't support void type yet. We should be able to fix easily the library. However, because our prototyping phase is close to the end, we are thinking to use another library that would perhaps better fit production constraints (pool, etc.). We have tested the PostgreSQL ODBC driver but we have faced some issues on Windows (Unicode, PostgreSQL data type support). We are interesting in having some feedback from people who use both Erlang and PostgreSQL. Which PostgreSQL driver do you use? Does someone use the PostgreSQL driver from Erlang Consulting? Are there other native PostgreSQL driver? Thanks, -- Daniel From bjorn@REDACTED Thu Nov 15 21:25:31 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 15 Nov 2007 21:25:31 +0100 Subject: [erlang-questions] how: Matching empty binaries at the beginning In-Reply-To: <1c3be50f0711151135o206f9c57wef63b44f6592d7c5@mail.gmail.com> References: <1c3be50f0711150756n606bad0dn9923f95ae3eaa6f8@mail.gmail.com> <69d143cd0711151122t5f21aed6if124b1a78fd7a5cd@mail.gmail.com> <1c3be50f0711151135o206f9c57wef63b44f6592d7c5@mail.gmail.com> Message-ID: A binary without a size will *always* match to the end of the binary even if the binary is not at the end: Eshell V5.5.5.5 (abort with ^G) 1> <> = <<"ABC">>. <<"ABC">> 2> Empty. <<"ABC">> 3> Tail. <<>> 4> This is probably not what is expected. Therefore, in R12B we only allow binaries without size at the end of a binary pattern: Eshell V5.6 (abort with ^G) 1> <> = <<"ABC">>. * 1: a binary field without size is only allowed at the end of a binary pattern 2> /Bjorn > > On 11/15/07, Juan Jose Comellas wrote: > > > > > > Why is this expression not matching? > > > > > > A = <<"ABC">>, > > > Empty = <<>>, > > > <> = A. > > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From dloutrein.lists@REDACTED Thu Nov 15 22:18:16 2007 From: dloutrein.lists@REDACTED (denis) Date: Thu, 15 Nov 2007 16:18:16 -0500 Subject: [erlang-questions] idea: function meta data In-Reply-To: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> Message-ID: <00ee01c827cd$0af22740$b029030a@mtl.ubisoft.org> This would be really useful! We had to do this on the project I'm working on and we used special tags in documentation. This kind of meta information per functions would have helped us a lot. We use it to do type checking. Denis > -----Message d'origine----- > De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] De la part de Joe Armstrong > Envoy??: jeudi 15 novembre 2007 05:49 > ??: Erlang Questions > Objet?: [erlang-questions] idea: function meta data > > Module have metadata Mod:module_info(export) etc. > > But functions do not. > > idea - attach function meta data with a new attribute. > > -meta(doc, "the factorial function"). > -meta(type, "int -> int"). > -meta(keywords, [math]). > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > The meta data gets *attached* to the Next function in the module > > -meta(process, true). > foo() -> spawn(fun() -> ... end) > > After compilation meta data can be access as follows: > > Mod:meta_data(fac, 1, doc) => "the factorial function" > ... > Mod:meta_data(fac, 1, glurk) => '$nothing' > > if we then *standardise* the meta data it will be easy to make loads > of nice tools for type checking, documentation etc. > > I'm off on a trip today - so can somebody hack the preprocess and > parser to do this? (( this needs a small change > attributes have a different syntax and must be at *before* all functions)) > > This adds introspection to the language ! > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Fri Nov 16 00:10:41 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 16 Nov 2007 00:10:41 +0100 Subject: [erlang-questions] Erlang & PostgreSQL native driver In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D2067519D0@UBIMAIL1.ubisoft.org> References: <1E293D3FF63A3740B10AD5AAD88535D2067519D0@UBIMAIL1.ubisoft.org> Message-ID: 2007/11/15, Daniel Caune : > Hi, > > I did a small patch on the file pgsql_util.erl to support PostgreSQL function that returns void. I'm contacting Christian Sunesson to ask him whether he would like to integrate this patch in CVS. Hi, I just committed the change you wanted. Thanks for making pgsql better. I would not be amazed if process one's native postgres driver is of higher quality, since I have put off writing tests to verify correctness in mine. Please write back to me if this is so, some insightful days I consider withdrawing my pgsql so it doesnt waste people's time. I just havent had much reason to use postgres from erlang to do that. From gbulmer@REDACTED Fri Nov 16 00:49:53 2007 From: gbulmer@REDACTED (G Bulmer) Date: Thu, 15 Nov 2007 23:49:53 +0000 Subject: [erlang-questions] Lets build a stock exchange! In-Reply-To: <6ce0ac130711151123y4549620ci3469e8385a2b5d76@mail.gmail.com> References: <6ce0ac130711130848u167f2bf8n36fa07edd8126723@mail.gmail.com> <666CCB1D-9CBF-4257-9591-CCC61CA13131@gmail.com> <6ce0ac130711151123y4549620ci3469e8385a2b5d76@mail.gmail.com> Message-ID: Brian Okay, so we are pretty much on the same page. >> My problem is I don't see why *I* would run a stock exchange >> application, so I don't see why *I* would run Amazon EC2 instances. >> ... > > I don't imagine that many people would want to run a stock exchange or > auction software themselves. Oh, I may be interested if I wanted to run a 'real-time' auction for my own stuff. Paying for an EC2 instance for a few hours to avoid eBay fees sounds interesting if it's easy. eBay and others demonstrate that there is lots of content, and liquidity in auctions, but who cares. I will stop flogging the horse now, it is deceased, and going mouldy. > But, I think that is not the point. The > point is that _many_ of us (potential readers of the book) might > want/need to build systems that have similar properties (distributed, > fault tolerant, low-latency, etc.) to these systems. Agreed. > At that level, I also don't care what the book uses as an example - > as long as the > example demonstrates the relevant ideas. To me low-latency is really > important. I am interested in low-latency too. In my simple machine-to-machine experiments, I observe approx. 1% of message round-trips to be more than an order of magnitude slower than the other 99%. G Bulmer PS - This is the sort of problem that I would attack using DTrace, if I could see the function call or message send/receive within each Erlang node. From saleyn@REDACTED Fri Nov 16 03:57:38 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 15 Nov 2007 21:57:38 -0500 Subject: [erlang-questions] idea: function meta data In-Reply-To: <9b08084c0711150622ja9d70e3t80714e35e6570ef3@mail.gmail.com> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> <473C47A6.8050109@gmail.com> <9b08084c0711150622ja9d70e3t80714e35e6570ef3@mail.gmail.com> Message-ID: <473D0722.7080403@gmail.com> What is the reason for leading "+" as opposed to original "-"? I agree with Lev Walkin's response that introducing semantics for meta information different from existing semantics of attributes may lead to confusion. Do you always remember when to use +option and when to use -option when calling erl? ;-) Serge Joe Armstrong wrote: > I did a quick implementation. It needs a one-line addition to the > parser and a parse transform > The files are attached. To run do the following > > $ erlc erl_parse.yrl > $ erlc erl_parse.erl > $ erlc lib_meta.erl > $ erl > 1> c(test1). > {ok,test1} > 2> test1:module_meta(). > [{fac,1}] > 3> test1:module_meta(fac,1). > [{doc,"hello"},{keywords,[math,factorial]},{type,"Int -> Int"}] > > > test1.erl is like this > > -compile(export_all). > > -compile({parse_transform, lib_meta}). > > start() -> > fac(10). > > +meta(doc, "hello"). > +meta(keywords, [math,factorial]). > +meta(type, "Int -> Int"). > > fac(0) -> 1; > fac(N) -> N * fac(N-1). > > Now all we need to do is standardise the keywords and the grammars of the values > > How about > > keywords = [kwd1, kwd2, ...] atoms > summary = one line summary string) > doc = many line summary (string) > spec = @spec declaration of types > obsolete = {Mod,Func,Arity} means this is obsolete - then new version is ... > > > /Joe > > > On Nov 15, 2007 2:20 PM, Serge Aleynikov wrote: >> It would be very useful indeed. Especially it the shell offered an >> extended version of help that would display available metadata: >> >> 1> help(Module, Function). >> >> >> Joe Armstrong wrote: >>> Module have metadata Mod:module_info(export) etc. >>> >>> But functions do not. >>> >>> idea - attach function meta data with a new attribute. >>> >>> -meta(doc, "the factorial function"). >>> -meta(type, "int -> int"). >>> -meta(keywords, [math]). >>> >>> fac(0) -> 1; >>> fac(N) -> N*fac(N-1) >>> >>> The meta data gets *attached* to the Next function in the module >>> >>> -meta(process, true). >>> foo() -> spawn(fun() -> ... end) >>> >>> After compilation meta data can be access as follows: >>> >>> Mod:meta_data(fac, 1, doc) => "the factorial function" >>> ... >>> Mod:meta_data(fac, 1, glurk) => '$nothing' >>> >>> if we then *standardise* the meta data it will be easy to make loads >>> of nice tools for type checking, documentation etc. >>> >>> I'm off on a trip today - so can somebody hack the preprocess and >>> parser to do this? (( this needs a small change >>> attributes have a different syntax and must be at *before* all functions)) >>> >>> This adds introspection to the language ! >>> >>> /Joe Armstrong >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> From machinshin2002@REDACTED Fri Nov 16 04:49:29 2007 From: machinshin2002@REDACTED (Vat Raghavan) Date: Thu, 15 Nov 2007 19:49:29 -0800 (PST) Subject: [erlang-questions] idea: function meta data Message-ID: <837721.47969.qm@web31507.mail.mud.yahoo.com> i REALLY REALLY like the idea of meta doc strings. one possibility for a syntax for it is like pythons', which is something like this -> def func( bar ) """ This is the docstring for this function """ and then as someone else said, in the string you can do : help(Module, func). and the shell emits -> "This is the docstring for this function" so maybe in erlang we could consider a special comment style? like %%% doc string for this function func(bar) -> then in the shell help(Module, func). One thing someone in #erlang mentioned, a compile flag to strip them out so maybe c(module, [no_docstring] ) or something like that :) --vat ----.signature---- Without the hope that things will get better, that our inheritors will know a world that is fuller and richer than our own, life is pointless, and evolution is vastly overrated -- Delenn ----- Original Message ---- From: Serge Aleynikov To: Joe Armstrong Cc: Erlang Questions Sent: Thursday, November 15, 2007 9:57:38 PM Subject: Re: [erlang-questions] idea: function meta data What is the reason for leading "+" as opposed to original "-"? I agree with Lev Walkin's response that introducing semantics for meta information different from existing semantics of attributes may lead to confusion. Do you always remember when to use +option and when to use -option when calling erl? ;-) Serge Joe Armstrong wrote: > I did a quick implementation. It needs a one-line addition to the > parser and a parse transform > The files are attached. To run do the following > > $ erlc erl_parse.yrl > $ erlc erl_parse.erl > $ erlc lib_meta.erl > $ erl > 1> c(test1). > {ok,test1} > 2> test1:module_meta(). > [{fac,1}] > 3> test1:module_meta(fac,1). > [{doc,"hello"},{keywords,[math,factorial]},{type,"Int -> Int"}] > > > test1.erl is like this > > -compile(export_all). > > -compile({parse_transform, lib_meta}). > > start() -> > fac(10). > > +meta(doc, "hello"). > +meta(keywords, [math,factorial]). > +meta(type, "Int -> Int"). > > fac(0) -> 1; > fac(N) -> N * fac(N-1). > > Now all we need to do is standardise the keywords and the grammars of the values > > How about > > keywords = [kwd1, kwd2, ...] atoms > summary = one line summary string) > doc = many line summary (string) > spec = @spec declaration of types > obsolete = {Mod,Func,Arity} means this is obsolete - then new version is ... > > > /Joe > > > On Nov 15, 2007 2:20 PM, Serge Aleynikov wrote: >> It would be very useful indeed. Especially it the shell offered an >> extended version of help that would display available metadata: >> >> 1> help(Module, Function). >> >> >> Joe Armstrong wrote: >>> Module have metadata Mod:module_info(export) etc. >>> >>> But functions do not. >>> >>> idea - attach function meta data with a new attribute. >>> >>> -meta(doc, "the factorial function"). >>> -meta(type, "int -> int"). >>> -meta(keywords, [math]). >>> >>> fac(0) -> 1; >>> fac(N) -> N*fac(N-1) >>> >>> The meta data gets *attached* to the Next function in the module >>> >>> -meta(process, true). >>> foo() -> spawn(fun() -> ... end) >>> >>> After compilation meta data can be access as follows: >>> >>> Mod:meta_data(fac, 1, doc) => "the factorial function" >>> ... >>> Mod:meta_data(fac, 1, glurk) => '$nothing' >>> >>> if we then *standardise* the meta data it will be easy to make loads >>> of nice tools for type checking, documentation etc. >>> >>> I'm off on a trip today - so can somebody hack the preprocess and >>> parser to do this? (( this needs a small change >>> attributes have a different syntax and must be at *before* all functions)) >>> >>> This adds introspection to the language ! >>> >>> /Joe Armstrong >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From esbjorn@REDACTED Fri Nov 16 09:29:32 2007 From: esbjorn@REDACTED (=?ISO-8859-1?Q?Esbj=F6rn_Dominique?=) Date: Fri, 16 Nov 2007 09:29:32 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: <837721.47969.qm@web31507.mail.mud.yahoo.com> References: <837721.47969.qm@web31507.mail.mud.yahoo.com> Message-ID: <7348e9970711160029p213783b6oe82b801e49d6b79e@mail.gmail.com> It is indeed a very nice idea! But what about using the (in many cases already existing) EDoc tags? Possibly with some form of meta header to enable/disable the information in a module. Otherwise, IMHO, most information would be duplicated. /esbj?rn On Nov 16, 2007 4:49 AM, Vat Raghavan wrote: > i REALLY REALLY like the idea of meta doc strings. > one possibility for a syntax for it is like pythons', which is something like this -> > > def func( bar ) > """ This is the docstring for this function > """ > and then as someone else said, in the string you can do : > > help(Module, func). and the shell emits -> > "This is the docstring for this function" > > > so maybe in erlang we could consider a special comment style? like > %%% doc string for this function > func(bar) -> > > then in the shell > help(Module, func). > > One thing someone in #erlang mentioned, a compile flag to strip them out > so maybe c(module, [no_docstring] ) > or something like that :) > > --vat > ----.signature---- > Without the hope that things will get better, that our inheritors will know a world that is fuller and richer than our own, > life is pointless, and evolution is vastly overrated > -- Delenn > > > ----- Original Message ---- > From: Serge Aleynikov > To: Joe Armstrong > Cc: Erlang Questions > Sent: Thursday, November 15, 2007 9:57:38 PM > Subject: Re: [erlang-questions] idea: function meta data > > > What is the reason for leading "+" as opposed to original "-"? I agree > > with Lev Walkin's response that introducing semantics for meta > information different from existing semantics of attributes may lead to > > confusion. > > Do you always remember when to use +option and when to use -option when > > calling erl? ;-) > > Serge > > Joe Armstrong wrote: > > I did a quick implementation. It needs a one-line addition to the > > parser and a parse transform > > The files are attached. To run do the following > > > > $ erlc erl_parse.yrl > > $ erlc erl_parse.erl > > $ erlc lib_meta.erl > > $ erl > > 1> c(test1). > > {ok,test1} > > 2> test1:module_meta(). > > [{fac,1}] > > 3> test1:module_meta(fac,1). > > [{doc,"hello"},{keywords,[math,factorial]},{type,"Int -> Int"}] > > > > > > test1.erl is like this > > > > -compile(export_all). > > > > -compile({parse_transform, lib_meta}). > > > > start() -> > > fac(10). > > > > +meta(doc, "hello"). > > +meta(keywords, [math,factorial]). > > +meta(type, "Int -> Int"). > > > > fac(0) -> 1; > > fac(N) -> N * fac(N-1). > > > > Now all we need to do is standardise the keywords and the grammars of > the values > > > > How about > > > > keywords = [kwd1, kwd2, ...] atoms > > summary = one line summary string) > > doc = many line summary (string) > > spec = @spec declaration of types > > obsolete = {Mod,Func,Arity} means this is obsolete - then new > version is ... > > > > > > /Joe > > > > > > On Nov 15, 2007 2:20 PM, Serge Aleynikov wrote: > >> It would be very useful indeed. Especially it the shell offered an > >> extended version of help that would display available metadata: > >> > >> 1> help(Module, Function). > >> > >> > >> Joe Armstrong wrote: > >>> Module have metadata Mod:module_info(export) etc. > >>> > >>> But functions do not. > >>> > >>> idea - attach function meta data with a new attribute. > >>> > >>> -meta(doc, "the factorial function"). > >>> -meta(type, "int -> int"). > >>> -meta(keywords, [math]). > >>> > >>> fac(0) -> 1; > >>> fac(N) -> N*fac(N-1) > >>> > >>> The meta data gets *attached* to the Next function in the module > >>> > >>> -meta(process, true). > >>> foo() -> spawn(fun() -> ... end) > >>> > >>> After compilation meta data can be access as follows: > >>> > >>> Mod:meta_data(fac, 1, doc) => "the factorial function" > >>> ... > >>> Mod:meta_data(fac, 1, glurk) => '$nothing' > >>> > >>> if we then *standardise* the meta data it will be easy to make > loads > >>> of nice tools for type checking, documentation etc. > >>> > >>> I'm off on a trip today - so can somebody hack the preprocess and > >>> parser to do this? (( this needs a small change > >>> attributes have a different syntax and must be at *before* all > functions)) > >>> > >>> This adds introspection to the language ! > >>> > >>> /Joe Armstrong > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://www.erlang.org/mailman/listinfo/erlang-questions > >>> > >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > ____________________________________________________________________________________ > Be a better sports nut! Let your teams follow you > with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Esbj?rn Dominique OptiMobile AB +46(0)706 - 305 590 +46(0)8 - 750 61 90 esbjorn@REDACTED From ft@REDACTED Fri Nov 16 09:28:37 2007 From: ft@REDACTED (Fredrik Thulin) Date: Fri, 16 Nov 2007 09:28:37 +0100 Subject: [erlang-questions] Why the code will make erlang crash? In-Reply-To: <20071115081839.GB26268@erix.ericsson.se> References: <99564A45FCC64AE6B73DD078724BCFDE@lukeserver> <20071115081839.GB26268@erix.ericsson.se> Message-ID: <473D54B5.3040502@it.su.se> Raimo Niskanen wrote: > Must be a bug in the regexp module. The regexp code seems to go > into an infinite loop and eats all memory: > > $ erl > Erlang (BEAM) emulator version 5.5.5.5 [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.5.5.5 (abort with ^G) > 1> regexp:match("hello", "*lo*"). > {error,{illegal,"*"}} > 2> regexp:match("hello", "^*lo*"). > > BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded > (v)ersion (k)ill (D)b-tables (d)istribution > Amusing, another variant of the bug I reported in 2004 (nudge nudge) ;) http://www.erlang.org/pipermail/erlang-questions/2004-April/012090.html /Fredrik From andreas.hillqvist@REDACTED Fri Nov 16 09:48:57 2007 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Fri, 16 Nov 2007 09:48:57 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: <473C5FAB.8030706@lionet.info> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> <8268eea30711150631q45d1e422j2def141c62020544@mail.gmail.com> <473C5FAB.8030706@lionet.info> Message-ID: <8268eea30711160048j26231259r432df52c6a8d6c2@mail.gmail.com> You make a good point. So would this look like: -module(test). -doc("Math module with some fancy math functions."). -keywords([math, fancy, factorial]). -export([fac/1]. -doc("The factorial function, for they day you will need it."). -keywords([math]). fac(0) -> 1; fac(N) -> N*fac(N-1) I believe Erlang supports multiple occurrences, example a hlr is expanded by the pre-parser to: -file("/xxx/yyy/zzz.hrl", 1). -hrl_id(aaa). -hrl_vsn(bbb). -hrl_date(ccc). -hrl_author(ddd). foo() -> bar. Where hlr headers seems to be prefixed with hlr. So to differentiate module level headers from function level we may use the "fun_" prefix on atoms: -module(test). -doc("Math module with some fancy math functions."). -keywords([math, fancy, factorial]). -export([fac/1]. -fun_doc("The factorial function, for they day you will need it."). -fun_keywords([math]). fac(0) -> 1; fac(N) -> N*fac(N-1) Just my ideas/suggestions, pleas feel free to criticize. ;-) Regards Andreas Hillqvist 2007/11/15, Lev Walkin : > > One of the most peculiar problems people have with certain languages > (Objective-C) is that punctuation and non-alphabetical characters > are overloaded beyond all reason. +module, -interface, @end, etc. > > We risk ending up with something like > > -module(test). > +module(test). > @module(test). > > where module is a keyword in one place and atom in another. Having > more or less uniform "-()." is arguably more > self-consistent and removes unnecessary learning curve. > > Just 2c. > > Andreas Hillqvist wrote: > > I like the Idea of function meta data. > > > > But it might be better/simpler/easier/harder to use an alternativ > > prefix, like double -- (Similar to %, %% and %%%). > > > > Why not use the name atom instead of meta? > > To me meta dose not contribute with value to the syntax. > > > > Would look like: > > > > -module(test). > > -export([fac/1]. > > > > --doc("the factorial function"). > > --type("int -> int"). > > --keywords([math]). > > fac(0) -> 1; > > fac(N) -> N*fac(N-1) > > > > Or some other prefix like "+"(Just an example, Do not like + myself. > > To much alike the udiff format. ;-)? > > -module(test). > > -export([fac/1]. > > > > +doc("the factorial function"). > > +type("int -> int"). > > +keywords([math]). > > > > fac(0) -> 1; > > fac(N) -> N*fac(N-1) > > > > > > Regards > > Andreas Hillqvist > > > > 2007/11/15, Joe Armstrong : > >> Module have metadata Mod:module_info(export) etc. > >> > >> But functions do not. > >> > >> idea - attach function meta data with a new attribute. > >> > >> -meta(doc, "the factorial function"). > >> -meta(type, "int -> int"). > >> -meta(keywords, [math]). > >> > >> fac(0) -> 1; > >> fac(N) -> N*fac(N-1) > >> > >> The meta data gets *attached* to the Next function in the module > >> > >> -meta(process, true). > >> foo() -> spawn(fun() -> ... end) > >> > >> After compilation meta data can be access as follows: > >> > >> Mod:meta_data(fac, 1, doc) => "the factorial function" > >> ... > >> Mod:meta_data(fac, 1, glurk) => '$nothing' > >> > >> if we then *standardise* the meta data it will be easy to make loads > >> of nice tools for type checking, documentation etc. > >> > >> I'm off on a trip today - so can somebody hack the preprocess and > >> parser to do this? (( this needs a small change > >> attributes have a different syntax and must be at *before* all functions)) > >> > >> This adds introspection to the language ! > >> > >> /Joe Armstrong > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > From christophe.romain@REDACTED Fri Nov 16 10:16:10 2007 From: christophe.romain@REDACTED (Christophe ROMAIN) Date: Fri, 16 Nov 2007 10:16:10 +0100 Subject: [erlang-questions] Faxien vs CEAN In-Reply-To: References: Message-ID: <587E00DA-781F-460A-AA47-D82BDE375B08@process-one.net> I'm working on the next version of CEAN and am finking about repository merging and external api for easier code push. Yes, this discussion is open :) I'll check what exactly does/needs Faxien and see what can be done. From chsu79@REDACTED Fri Nov 16 11:00:45 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 16 Nov 2007 11:00:45 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: <7348e9970711160029p213783b6oe82b801e49d6b79e@mail.gmail.com> References: <837721.47969.qm@web31507.mail.mud.yahoo.com> <7348e9970711160029p213783b6oe82b801e49d6b79e@mail.gmail.com> Message-ID: 2007/11/16, Esbj?rn Dominique : > It is indeed a very nice idea! > But what about using the (in many cases already existing) EDoc tags? > Possibly with some form of meta header to enable/disable the > information in a module. I like this, the only problem is that edoc is very complete as it should be, while one just want a short summary or mainly the order/names of arguments as help in the shell. Perhaps one can establish a norm to make the first sentence of edoc a good summary that should be useful on its own. How would one access the help texts from the shell? I guess it would be most intuitive if auto-completion would display them. 1> lists:la lists:last(List) :: [A] -> A - Returns the last item of a list 1> lists:la From mats.cronqvist@REDACTED Fri Nov 16 11:46:23 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Fri, 16 Nov 2007 11:46:23 +0100 Subject: [erlang-questions] autoconf and erlang In-Reply-To: <4732883B.3000909@ghostgun.com> References: <4732883B.3000909@ghostgun.com> Message-ID: <1195209983.7248.19.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Thu, 2007-11-08 at 14:53 +1100, jm wrote: > In attempting to package up my inotify port for erlang I'm using or > rather trying to use autoconf and automake. [...] > 3) Any good similar examples out there that can be used as a reference > for a starting point? http://gtknode.googlecode.com/svn/trunk/configure.ac From richardc@REDACTED Fri Nov 16 12:13:59 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 16 Nov 2007 12:13:59 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: References: <837721.47969.qm@web31507.mail.mud.yahoo.com> <7348e9970711160029p213783b6oe82b801e49d6b79e@mail.gmail.com> Message-ID: <473D7B77.60101@it.uu.se> Christian S wrote: > Perhaps one can > establish a norm to make the first sentence of edoc a good summary > that should be useful on its own. Well, that is precisely how edoc does right now, to get the short summary for use in the function index etc. What is missing is some way of making the description accessible at runtime. One way would be for edoc to insert documentation into a global dets table (similar to the persistent table used by dialyzer). Another would be to compile it into the module itself, but that would increase the compile times quite a lot. /Richard From erlang@REDACTED Thu Nov 15 15:22:36 2007 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 15 Nov 2007 15:22:36 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: <473C47A6.8050109@gmail.com> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> <473C47A6.8050109@gmail.com> Message-ID: <9b08084c0711150622ja9d70e3t80714e35e6570ef3@mail.gmail.com> I did a quick implementation. It needs a one-line addition to the parser and a parse transform The files are attached. To run do the following $ erlc erl_parse.yrl $ erlc erl_parse.erl $ erlc lib_meta.erl $ erl 1> c(test1). {ok,test1} 2> test1:module_meta(). [{fac,1}] 3> test1:module_meta(fac,1). [{doc,"hello"},{keywords,[math,factorial]},{type,"Int -> Int"}] test1.erl is like this -compile(export_all). -compile({parse_transform, lib_meta}). start() -> fac(10). +meta(doc, "hello"). +meta(keywords, [math,factorial]). +meta(type, "Int -> Int"). fac(0) -> 1; fac(N) -> N * fac(N-1). Now all we need to do is standardise the keywords and the grammars of the values How about keywords = [kwd1, kwd2, ...] atoms summary = one line summary string) doc = many line summary (string) spec = @spec declaration of types obsolete = {Mod,Func,Arity} means this is obsolete - then new version is ... /Joe On Nov 15, 2007 2:20 PM, Serge Aleynikov wrote: > It would be very useful indeed. Especially it the shell offered an > extended version of help that would display available metadata: > > 1> help(Module, Function). > > > Joe Armstrong wrote: > > Module have metadata Mod:module_info(export) etc. > > > > But functions do not. > > > > idea - attach function meta data with a new attribute. > > > > -meta(doc, "the factorial function"). > > -meta(type, "int -> int"). > > -meta(keywords, [math]). > > > > fac(0) -> 1; > > fac(N) -> N*fac(N-1) > > > > The meta data gets *attached* to the Next function in the module > > > > -meta(process, true). > > foo() -> spawn(fun() -> ... end) > > > > After compilation meta data can be access as follows: > > > > Mod:meta_data(fac, 1, doc) => "the factorial function" > > ... > > Mod:meta_data(fac, 1, glurk) => '$nothing' > > > > if we then *standardise* the meta data it will be easy to make loads > > of nice tools for type checking, documentation etc. > > > > I'm off on a trip today - so can somebody hack the preprocess and > > parser to do this? (( this needs a small change > > attributes have a different syntax and must be at *before* all functions)) > > > > This adds introspection to the language ! > > > > /Joe Armstrong > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_parse.yrl Type: application/octet-stream Size: 28866 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: lib_misc.erl Type: application/octet-stream Size: 17143 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test1.erl Type: application/octet-stream Size: 410 bytes Desc: not available URL: From chlorophil@REDACTED Fri Nov 16 13:01:14 2007 From: chlorophil@REDACTED (Philip Robinson) Date: Fri, 16 Nov 2007 22:01:14 +1000 Subject: [erlang-questions] Clarify: HiPE auto-spawning? Message-ID: Does HiPE automatically spread (spawn) a program across multiple cores? For example, if I have a function: test(A, B) -> {A + B, A * B}. Will HiPE convert it into something like the following? test(A, B) -> PidThis = self(), Pid1 = spawn(fun() -> PidThis ! {self(), A + B} end), Pid2 = spawn(fun() -> PidThis ! {self(), A * B} end), Tmp1 = receive {Pid1, Result1} -> Result1 end, Tmp2 = receive {Pid2, Result2} -> Result2 end, {Tmp1, Tmp2}. I suspect not, but I cannot find any confirmation. My Google-fu is very weak this evening. :-/ Thanks in advance, Philip From kostis@REDACTED Fri Nov 16 13:18:02 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 16 Nov 2007 13:18:02 +0100 Subject: [erlang-questions] Clarify: HiPE auto-spawning? In-Reply-To: References: Message-ID: <473D8A7A.9030807@cs.ntua.gr> Philip Robinson wrote: > Does HiPE automatically spread (spawn) a program across multiple cores? > > For example, if I have a function: > > test(A, B) -> > {A + B, A * B}. > > Will HiPE convert it into something like the following? > > test(A, B) -> > PidThis = self(), > Pid1 = spawn(fun() -> PidThis ! {self(), A + B} end), > Pid2 = spawn(fun() -> PidThis ! {self(), A * B} end), > Tmp1 = receive {Pid1, Result1} -> Result1 end, > Tmp2 = receive {Pid2, Result2} -> Result2 end, > {Tmp1, Tmp2}. > > I suspect not, but I cannot find any confirmation. Of course not. HiPE is a native code compiler, not a parallelizing compiler. (Not to mention the fact that the transformation is a pessimization rather than an optimization in the above program.) More generally, HiPE is not allowed to alter the observable behaviour of your program -- or at least it tries to. For example, suppose you have an observer process that counts the number of processes a program spawns. The result of that program would change based on whether HiPE compilation was used or not, if HiPE (automatically) did what you suggested and the BEAM compiler did not. Kostis From mikpe@REDACTED Fri Nov 16 13:53:22 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 16 Nov 2007 13:53:22 +0100 (MET) Subject: [erlang-questions] Clarify: HiPE auto-spawning? Message-ID: <200711161253.lAGCrMZt002720@harpo.it.uu.se> On Fri, 16 Nov 2007 22:01:14 +1000, Philip Robinson wrote: > Does HiPE automatically spread (spawn) a program across multiple cores? > > For example, if I have a function: > > test(A, B) -> > {A + B, A * B}. > > Will HiPE convert it into something like the following? > > test(A, B) -> > PidThis = self(), > Pid1 = spawn(fun() -> PidThis ! {self(), A + B} end), > Pid2 = spawn(fun() -> PidThis ! {self(), A * B} end), > Tmp1 = receive {Pid1, Result1} -> Result1 end, > Tmp2 = receive {Pid2, Result2} -> Result2 end, > {Tmp1, Tmp2}. HiPE will not perform this transformation. The transformation you suggest changes the semantics of the code (Erlang code can have side-effects), and may reduce its performance. So if you want it, you need to express it yourself. /Mikael From C.Grasl@REDACTED Fri Nov 16 14:29:01 2007 From: C.Grasl@REDACTED (Grasl Christoph) Date: Fri, 16 Nov 2007 14:29:01 +0100 Subject: [erlang-questions] hi ulf! i've seen u already answered some questions related to the gen_event behaviour and its functions. since i'm new to erlang i'd like to ask a question related to that topic and i'm grateful for any reply. currently i'm implementing a logging system using gen_event and the syslog-interface to log additional local facilities to the linux sysklog-daemon. 1.) should my event-manager have a supervised handler for each facility and/or for each severity to enforce concurrency or is it better to have all events handled after one another by only one handler and using clauses to match certain conditions? 2.) when 'notifying' i assume the event-manager propagates the event to all handlers belonging to that manager. shouldn't i use 'call' instead to already specificly adress the certain handler with my request/event in order to avoid passing-around-messages and matching against clauses in each handler and therefore conserve performance? i'm still not very sure which approach makes the most sense, maybe you can give me a hint or two on how this is realized. thanx a lot for your time, gen_event + syslog + sysklogd Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CC76@srvkeyx01.KEYTRONIX.local> hi there! i've seen some of u already answered some questions related to the gen_event behaviour and its functions. since i'm new to erlang i'd like to ask a question related to that topic and i'm grateful for any reply. currently i'm implementing a logging system using gen_event and the syslog-interface to log additional local facilities to the linux sysklog-daemon. 1.) should my event-manager have a supervised handler for each facility and/or for each severity to enforce concurrency or is it better to have all events handled after one another by only one handler and using clauses to match certain conditions? 2.) when 'notifying' i assume the event-manager propagates the event to all handlers belonging to that manager. shouldn't i use 'call' instead to already specificly adress the certain handler with my request/event in order to avoid passing-around-messages and matching against clauses in each handler and therefore conserve performance? i'm still not very sure which approach makes the most sense, maybe some of you can give me a hint or two on how this is realized. thanx a lot for your time, cheers, chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From C.Grasl@REDACTED Fri Nov 16 14:30:54 2007 From: C.Grasl@REDACTED (Grasl Christoph) Date: Fri, 16 Nov 2007 14:30:54 +0100 Subject: [erlang-questions] gen_event + syslog + sysklogd Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CC77@srvkeyx01.KEYTRONIX.local> hi there! i've seen some of u already answered some questions related to the gen_event behaviour and its functions. since i'm new to erlang i'd like to ask a question related to that topic and i'm grateful for any reply. currently i'm implementing a logging system using gen_event and the syslog-interface to log additional local facilities to the linux sysklog-daemon. 1.) should my event-manager have a supervised handler for each facility and/or for each severity to enforce concurrency or is it better to have all events handled after one another by only one handler and using clauses to match certain conditions? 2.) when 'notifying' i assume the event-manager propagates the event to all handlers belonging to that manager. shouldn't i use 'call' instead to already specificly adress the certain handler with my request/event in order to avoid passing-around-messages and matching against clauses in each handler and therefore conserve performance? i'm still not very sure which approach makes the most sense, maybe some of you can give me a hint or two on how this is realized. thanx a lot for your time, cheers, chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Fri Nov 16 14:39:58 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 16 Nov 2007 14:39:58 +0100 Subject: [erlang-questions] Clarify: HiPE auto-spawning? In-Reply-To: References: Message-ID: <473D9DAE.70009@it.uu.se> Philip Robinson wrote: > Does HiPE automatically spread (spawn) a program across multiple cores? Apart from the semantic differences, as explained by Kostis and Mikael, it is also a question of how to make the compiler realise when it will actually pay off to perform some tasks in parallel. Assuming that it has been able to figure out that the tasks *can* be run in parallel, i.e., it is sure that they do not interfere with each other and can be executed in any order (usually only possible for straightforward side effect free calculations), it still has to be *sure* that in any case, the program will *not behave worse* if these tasks are parallelized. Since this is typically very much dependent on the actual values of variables at run-time (numbers, lengths of lists, size of trees, etc.), it is rarely the case that you can do this at compile time. After all, spawning processes and collecting the results will always have some overhead (especially if data has to be copied between processes). Using data from profiling could help guide a compiler, though. But in general, this is not something you should expect any compiler to do for you except for limited problems like parallelizing number crunching in Fortran. For the forseeable future, you will have to profile your application and manually parallelize those parts where it will help, regardless of which language you are coding in. /Richard From yerl@REDACTED Thu Nov 15 12:18:29 2007 From: yerl@REDACTED (yerl@REDACTED) Date: Thu, 15 Nov 2007 12:18:29 +0100 Subject: [erlang-questions] =?iso-8859-1?q?Erlang_User_Conference_2007_-_P?= =?iso-8859-1?q?roceedings=09available?= Message-ID: Hi ! I'll be interested by the "The New Array Module" paper and source code from Richard Carlsson and Dan Gudmundsson. Are they available somewhere ? cheers Y. ----Message d'origine---- >De: Bjarne D?cker >A: erlang-questions@REDACTED > 20071112141540.GA18962@REDACTED >Date: Thu, 15 Nov 2007 11:08:16 +0100 >Sujet: [erlang-questions] Erlang User Conference 2007 - Proceedings > available > > > >Hello > >Please enjoy the proceedings from the 13th International Erlang/OTP User >Conference > >http://www.erlang.se/euc/07/ > >See you next year > >Bjarne > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > From mateuszb@REDACTED Fri Nov 16 15:31:19 2007 From: mateuszb@REDACTED (Mateusz Berezecki) Date: Fri, 16 Nov 2007 15:31:19 +0100 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: References: Message-ID: Hello, I have attached a benchmark at the end of this e-mail. It is a complete mystery to me why it performs so poorly. Could please anyone share some ideas what is the background behind this behavior? Example test results; 24.1486134 seconds / 100 Mb (extracting 1 byte) 12.8946602 seconds / 100 Mb (extracting 2 bytes) 6.37089217 seconds / 100 Mb (extracting 4 bytes) 3.19605309 seconds / 100 Mb (extracting 8 bytes) 1.57278535 seconds / 100 Mb (extracting 16 bytes) The code was compiled without +native flag. I don't understand why it performs so poorly . The C code can do 600mb in 24 seconds while performing IO from disk while erlang code needs 24 seconds for 100mb while reading it from memory. The million dollar questions is - Why ? regards, Mateusz Berezecki P.S. Benchmark code -module (benchmark). -export([bitsyntax/1, test1/1, test2/1, test4/1, test8/1, test16/1]). test1(<<>>) -> done; test1(Bin) when is_binary(Bin) -> <> = Bin, <<_A1:8>> = A, test1(Rest). test2(<<>>) -> done; test2(Bin) when is_binary(Bin) -> <> = Bin, <<_A1:8, _A2:8>> = A, test2(Rest). test4(<<>>) -> done; test4(Bin) when is_binary(Bin) -> <> = Bin, <<_A1:8,_A2:8,_A3:8,_A4:8>> = A, test4(Rest). test8(<<>>) -> done; test8(Bin) when is_binary(Bin) -> <> = Bin, <<_A1:8,_A2:8,_A3:8,_A4:8, _A5:8, _A6:8, _A7:8, _A8:8>> = A, test8(Rest). test16(<<>>) -> done; test16(Bin) when is_binary(Bin) -> <> = Bin, <<_A1:8,_A2:8,_A3:8,_A4:8, _A5:8, _A6:8, _A7:8, _A8:8, _A9:8, _A10:8, _A11:8,_A12:8, _A13:8, _A14:8, _A15:8, _A16:8>> = A, test16(Rest). bitsyntax(N) when is_integer(N), N > 0 -> K = lists:seq(1, N * 16), Bin = list_to_binary(lists:map(fun(X) -> <> end, K)), io:format("Running tests for N = ~p.~n", [N * 16]), {T1, _} = timer:tc(?MODULE, test1, [Bin]), {T2, _} = timer:tc(?MODULE, test2, [Bin]), {T3, _} = timer:tc(?MODULE, test4, [Bin]), {T4, _} = timer:tc(?MODULE, test8, [Bin]), {T5, _} = timer:tc(?MODULE, test16, [Bin]), io:format("T1 = ~p.~n", [T1]), io:format("T2 = ~p.~n", [T2]), io:format("T3 = ~p.~n", [T3]), io:format("T4 = ~p.~n", [T4]), io:format("T5 = ~p.~n", [T5]). -- Mateusz Berezecki http://www.meme.pl From richardc@REDACTED Fri Nov 16 15:44:44 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 16 Nov 2007 15:44:44 +0100 Subject: [erlang-questions] Erlang User Conference 2007 - Proceedings available In-Reply-To: References: Message-ID: <473DACDC.8030903@it.uu.se> yerl@REDACTED wrote: > I'll be interested by the "The New Array Module" paper and source code from Richard Carlsson and Dan Gudmundsson. > > Are they available somewhere ? All slides are now available at http://www.erlang.se/euc/07/ See also http://www.trapexit.org/forum/viewtopic.php?p=34157#34157 /Richard From anders.nygren@REDACTED Fri Nov 16 15:53:59 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 16 Nov 2007 08:53:59 -0600 Subject: [erlang-questions] Erlang User Conference 2007 - Proceedings available In-Reply-To: References: Message-ID: On Nov 15, 2007 5:18 AM, wrote: > Hi ! > > I'll be interested by the "The New Array Module" paper and source code from Richard Carlsson and Dan Gudmundsson. > > Are they available somewhere ? > If You are inpatient, like me, You can get the source in the R12 snapshots at http://erlang.org/download/snapshots/ /Anders > cheers > Y. > > ----Message d'origine---- > >De: Bjarne D?cker > >A: erlang-questions@REDACTED > > 20071112141540.GA18962@REDACTED > >Date: Thu, 15 Nov 2007 11:08:16 +0100 > >Sujet: [erlang-questions] Erlang User Conference 2007 - Proceedings > > available > > > > > > > > >Hello > > > >Please enjoy the proceedings from the 13th International Erlang/OTP User > >Conference > > > >http://www.erlang.se/euc/07/ > > > >See you next year > > > >Bjarne > > > >_______________________________________________ > >erlang-questions mailing list > >erlang-questions@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ft@REDACTED Fri Nov 16 15:52:51 2007 From: ft@REDACTED (Fredrik Thulin) Date: Fri, 16 Nov 2007 15:52:51 +0100 Subject: [erlang-questions] erlang time in vmware Message-ID: <473DAEC3.2060602@it.su.se> Hi I was just bit by a strange problem - I have an Erlang node running on a VMware ESX 3 guest operating system (Linux 2.6) with VMware tools installed. Apparently, vmware tools makes sure the system clock is correct, even though the guests CPU frequency varies greatly based on actual need. This is why NTP is not used. My Erlang VM however, ended up ~270 seconds into the future after running for about a week. The system time as reported by 'date' showed correct time. Can someone explain this, and hopefully also tell me how to avoid it in the future? Thanks /Fredrik From per.gustafsson@REDACTED Fri Nov 16 16:09:35 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Fri, 16 Nov 2007 16:09:35 +0100 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: References: Message-ID: <473DB2AF.4040204@it.uu.se> Mateusz Berezecki wrote: > Hello, > > I have attached a benchmark at the end of this e-mail. > It is a complete mystery to me why it performs so poorly. > > Could please anyone share some ideas what is the > background behind this behavior? > > Example test results; > > 24.1486134 seconds / 100 Mb (extracting 1 byte) > 12.8946602 seconds / 100 Mb (extracting 2 bytes) > 6.37089217 seconds / 100 Mb (extracting 4 bytes) > 3.19605309 seconds / 100 Mb (extracting 8 bytes) > 1.57278535 seconds / 100 Mb (extracting 16 bytes) > > The code was compiled without +native flag. > I don't understand why it performs so poorly . > > The C code can do 600mb in 24 seconds while performing IO from disk > while erlang code needs 24 seconds for 100mb while reading it from memory. > > The million dollar questions is - Why ? > > > regards, > Mateusz Berezecki > It is slow because for each iteration a two sub-binary structure (about 5 words) is allocated. This will be optimized in the next release of Erlang/OTP, but your code is sub optimal anyway, if you want good performance you should write: test1(<<>>) -> done; test1(<<_A, Rest/binary>>) -> test1(Rest). That is, you should not first pattern match and create a sub-binary and then match against that one. Per > P.S. > Benchmark code > > -module (benchmark). > -export([bitsyntax/1, test1/1, test2/1, test4/1, test8/1, test16/1]). > > test1(<<>>) -> done; > test1(Bin) when is_binary(Bin) -> > <> = Bin, > <<_A1:8>> = A, > test1(Rest). > > test2(<<>>) -> done; > test2(Bin) when is_binary(Bin) -> > <> = Bin, > <<_A1:8, _A2:8>> = A, > test2(Rest). > > test4(<<>>) -> done; > test4(Bin) when is_binary(Bin) -> > <> = Bin, > <<_A1:8,_A2:8,_A3:8,_A4:8>> = A, > test4(Rest). > > test8(<<>>) -> done; > test8(Bin) when is_binary(Bin) -> > <> = Bin, > <<_A1:8,_A2:8,_A3:8,_A4:8, _A5:8, _A6:8, _A7:8, _A8:8>> = A, > test8(Rest). > > test16(<<>>) -> done; > test16(Bin) when is_binary(Bin) -> > <> = Bin, > <<_A1:8,_A2:8,_A3:8,_A4:8, _A5:8, _A6:8, _A7:8, _A8:8, _A9:8, _A10:8, > _A11:8,_A12:8, _A13:8, _A14:8, _A15:8, _A16:8>> = A, > test16(Rest). > > bitsyntax(N) when is_integer(N), N > 0 -> > K = lists:seq(1, N * 16), > Bin = list_to_binary(lists:map(fun(X) -> <> end, K)), > > io:format("Running tests for N = ~p.~n", [N * 16]), > {T1, _} = timer:tc(?MODULE, test1, [Bin]), > {T2, _} = timer:tc(?MODULE, test2, [Bin]), > {T3, _} = timer:tc(?MODULE, test4, [Bin]), > {T4, _} = timer:tc(?MODULE, test8, [Bin]), > {T5, _} = timer:tc(?MODULE, test16, [Bin]), > > io:format("T1 = ~p.~n", [T1]), > io:format("T2 = ~p.~n", [T2]), > io:format("T3 = ~p.~n", [T3]), > io:format("T4 = ~p.~n", [T4]), > io:format("T5 = ~p.~n", [T5]). > > From gbulmer@REDACTED Fri Nov 16 17:27:03 2007 From: gbulmer@REDACTED (G Bulmer) Date: Fri, 16 Nov 2007 16:27:03 +0000 Subject: [erlang-questions] idea: function meta data Message-ID: IMHO, there seems to be two different things being described, and hence they may have different requirements and solutions. When I think of introspection, I think of mechanisms which enable code to manipulate other code at run time. I want introspection to assist with developing tooling. For example test tools that will automatically find a bunch of functions and test them, or a tool that will autogenerate web service interfaces to a bunch of functions, etc. I'd like these tools to work even when source code is unavailable. I would expect to have functions to get a list of function names + type signatures from a module at run time. I would expect to be able to call any of the functions identified using that list. I would expect to be able to construct a (type) valid parameter list for any of the functions from that same function meta data. I do not expect the source code to be available. In order for these types tools to be reasonably robust, the information they use needs to conform to a very well specified syntax, or type. I would like those guarantees to be provided by the compiler, as much as practical. I would like the information to *always* be parsed and checked, and the compilation to fail if they do not conform to specification. I would like the information embedded into the compiled file (e.g. .erl), so that I can be confident that it is in synch. with the source at the time of compilation, and to reduce the hassles of packaging and distributing code. I am willing to have a small number of conventions layered on top, but only a few, please, I would like the information in code modules to be well defined and stable for the next 5+ years. On the other hand, adding stuff for human beings, like helpful comments, seems to me to be different. I would like human-readable information to be spell checked, but I wouldn't want compilation (by default) to fail if there were a spelling mistake, or a word that is simply not in the dictionary, e.g. autogenerate. I expect human-readable content to have the same quality as documentation. I also don't feel that I need human-readable content in the compiled code because I am happy having it in the documentation! I think that it makes sense for the documentation to follow a different process to the compiled code, especially if there are multiple Human languages supported. I can see there is a lot of value in having some helpful comment conventions, but I don't see that these need to be as strictly managed as language syntax because they are intended to be consumed by humans, and not programs. Put another way, I am happy for documentation to be extracted from source code and injected into the documentation process, but I don't feel the documentation process *needs* to depend on compiled code. Nor do I expect all documentation to come from source code files. So, IMHO, there seems to be two different sets of requirements, and they don't need to have a single solution. In my mind, machine-readable information being extracted from parsed source and being embedded the code is tidy, and logical. Human- readable documentation being extracted from comments is fine, but embedding it in compiled code seems to be optional. I don't feel it should be necessary to issue a new version of code modules just because there is documentation available in a new Human language. I think that the function name (and type signature) tie tmachine readable and Human-readable information together, and ideally should not be repeated, and should be parsed at the highest level of quality, i.e. by the compiler. So, putting issues of how to implement aside for a second, I would like the function type-signatures to become part of the source code (I'm okay using pre-processor syntax to delimit it), hence the type signature must follow Erlang syntax (or an extended Erlang syntax, I suppose); the type signature should not be hidden in a text string or comment. The type signature should be embedded in the compiled code. I am happy if human-readable stuff stays in comments with some helpful conventions, and it may or may not end up in the compiled code, and I would like to choose. Just my $0.02 worth G Bulmer From tsuraan@REDACTED Fri Nov 16 17:21:34 2007 From: tsuraan@REDACTED (tsuraan) Date: Fri, 16 Nov 2007 10:21:34 -0600 Subject: [erlang-questions] idea: service pack one In-Reply-To: <84621a60711140748u23b6d8adm9c79c7703f977046@mail.gmail.com> References: <9b08084c0711131327m3a9fa3c7sb018adfb704cabca@mail.gmail.com> <473A265D.7030409@club-internet.fr> <6a36e7290711131536s4bc3011cpc6a8b2a98555c732@mail.gmail.com> <17244f480711131649g4d9bbb05i91a4b4d802a31188@mail.gmail.com> <779bf2730711131728p4327116fga24c2702dbe34d66@mail.gmail.com> <84621a60711140748u23b6d8adm9c79c7703f977046@mail.gmail.com> Message-ID: <84fb38e30711160821t6004d79fra3ce6afe5001855e@mail.gmail.com> > > 2) Hierarchical module namespace. Flat namespace (or random > conventions for hierarchy with random local policies about separators) > is not conducive to having a well-organized CEAN. > > [Can you tell yet that all of my suggestions boil down to stealing the > best things from Perl?] > +1 from me; this isn't just perl either; I think the only language I've ever used that doesn't have namespace nesting is C, and that doesn't have namespaces at all. How do you write a huge program with a flat namespace? Do you start prefixing your module names with their scope, like mycomponent_mysubpart:myfn, write really huge files, or what? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mickael.remond@REDACTED Fri Nov 16 18:10:33 2007 From: mickael.remond@REDACTED (=?UTF-8?Q?Micka=C3=ABl_R=C3=A9mond?=) Date: Fri, 16 Nov 2007 18:10:33 +0100 Subject: [erlang-questions] Version of beam Message-ID: Hello, Is there any function (or description of the beam format) allowing to know which version of beam bytecode we are dealing with ? The idea would be, given a beam file, to know if it is targetting Erlang R10 or R11 for example. Thank you ! -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From yerl@REDACTED Fri Nov 16 18:14:48 2007 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 16 Nov 2007 18:14:48 +0100 Subject: [erlang-questions] Erlang User Conference 2007 - Proceedings available Message-ID: Thanks for the pointers guys. cheers Y. ----Message d'origine---- >Date: Fri, 16 Nov 2007 08:53:59 -0600 >De: "Anders Nygren" >A: yerl@REDACTED >Sujet: Re: [erlang-questions] Erlang User Conference 2007 - Proceedings available >Copie ?: erlang-questions@REDACTED > >On Nov 15, 2007 5:18 AM, wrote: >> Hi ! >> >> I'll be interested by the "The New Array Module" paper and source code from Richard Carlsson and Dan Gudmundsson. >> >> Are they available somewhere ? >> > >If You are inpatient, like me, You can get the source in the R12 snapshots at >http://erlang.org/download/snapshots/ > >/Anders > >> cheers >> Y. >> >> ----Message d'origine---- >> >De: Bjarne D?cker >> >A: erlang-questions@REDACTED >> > 20071112141540.GA18962@REDACTED >> >Date: Thu, 15 Nov 2007 11:08:16 +0100 >> >Sujet: [erlang-questions] Erlang User Conference 2007 - Proceedings >> > available >> > >> > >> >> > >> >Hello >> > >> >Please enjoy the proceedings from the 13th International Erlang/OTP User >> >Conference >> > >> >http://www.erlang.se/euc/07/ >> > >> >See you next year >> > >> >Bjarne >> > >> >_______________________________________________ >> >erlang-questions mailing list >> >erlang-questions@REDACTED >> >http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From sgolovan@REDACTED Fri Nov 16 20:03:20 2007 From: sgolovan@REDACTED (Sergei Golovan) Date: Fri, 16 Nov 2007 22:03:20 +0300 Subject: [erlang-questions] HiPE on powerpc Message-ID: Hi! When building Erlang/OTP (R11B-5) with HiPE enabled on powerpc64 machine (but compiler generated 32-bit code) there is the following error: beam/erl_bif_info.c: In function 'system_info_1': beam/erl_bif_info.c:1221: error: 'am_powerpc' undeclared (first use in this function) which usually appears if HiPE arcitecture is incorrect. Shouldn't HiPE architecture be adjusted in this case? Is the following patch correct? ----------------- --- erlang.orig/erts/configure.in +++ erlang/erts/configure.in @@ -372,6 +372,10 @@ AC_MSG_RESULT(yes: adjusting ARCH=sparc64 to ARCH=ultrasparc) ARCH=ultrasparc ;; +ppc64-4) + AC_MSG_RESULT(yes: adjusting ARCH=ppc64 to ARCH=ppc) + ARCH=ppc + ;; *) AC_MSG_RESULT(no) ;; ----------------- The build was on Debian GNU/Linux (unstable branch). The full build log is available at http://experimental.debian.net/build.php?arch=powerpc&pkg=erlang&ver=1:11.b.5dfsg-9 -- Sergei Golovan From vlm@REDACTED Fri Nov 16 20:26:22 2007 From: vlm@REDACTED (Lev Walkin) Date: Fri, 16 Nov 2007 11:26:22 -0800 Subject: [erlang-questions] idea: function meta data In-Reply-To: <8268eea30711160048j26231259r432df52c6a8d6c2@mail.gmail.com> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> <8268eea30711150631q45d1e422j2def141c62020544@mail.gmail.com> <473C5FAB.8030706@lionet.info> <8268eea30711160048j26231259r432df52c6a8d6c2@mail.gmail.com> Message-ID: <473DEEDE.1030409@lionet.info> I think there's is a problem with attributing metadata to module or to function. In your example, consider the first -doc() to be absent. What makes the second -doc() be bound to function? The extra line directly above it certainly makes it so for humans, but it shouldn't be relied upon formally. Perhaps (I live motivation outside this email), something like this? -module(test). -doc("Math module with some fancy math functions."). -keywords([math, fancy, factorial]). -export([fac/1]. -fun(doc, "The factorial function."). -fun(keywords, [math]). fac(0) -> 1; fac(N) -> N*fac(N-1) Andreas Hillqvist wrote: > You make a good point. > > So would this look like: > -module(test). > -doc("Math module with some fancy math functions."). > -keywords([math, fancy, factorial]). > -export([fac/1]. > > -doc("The factorial function, for they day you will need it."). > -keywords([math]). > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > I believe Erlang supports multiple occurrences, example a hlr is > expanded by the pre-parser to: > -file("/xxx/yyy/zzz.hrl", 1). > -hrl_id(aaa). > -hrl_vsn(bbb). > -hrl_date(ccc). > -hrl_author(ddd). > > foo() -> bar. > > Where hlr headers seems to be prefixed with hlr. So to differentiate > module level headers from function level we may use the "fun_" prefix > on atoms: > -module(test). > -doc("Math module with some fancy math functions."). > -keywords([math, fancy, factorial]). > -export([fac/1]. > > -fun_doc("The factorial function, for they day you will need it."). > -fun_keywords([math]). > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > > Just my ideas/suggestions, pleas feel free to criticize. > ;-) > > > Regards > Andreas Hillqvist > > 2007/11/15, Lev Walkin : >> One of the most peculiar problems people have with certain languages >> (Objective-C) is that punctuation and non-alphabetical characters >> are overloaded beyond all reason. +module, -interface, @end, etc. >> >> We risk ending up with something like >> >> -module(test). >> +module(test). >> @module(test). >> >> where module is a keyword in one place and atom in another. Having >> more or less uniform "-()." is arguably more >> self-consistent and removes unnecessary learning curve. >> >> Just 2c. >> >> Andreas Hillqvist wrote: >>> I like the Idea of function meta data. >>> >>> But it might be better/simpler/easier/harder to use an alternativ >>> prefix, like double -- (Similar to %, %% and %%%). >>> >>> Why not use the name atom instead of meta? >>> To me meta dose not contribute with value to the syntax. >>> >>> Would look like: >>> >>> -module(test). >>> -export([fac/1]. >>> >>> --doc("the factorial function"). >>> --type("int -> int"). >>> --keywords([math]). >>> fac(0) -> 1; >>> fac(N) -> N*fac(N-1) >>> >>> Or some other prefix like "+"(Just an example, Do not like + myself. >>> To much alike the udiff format. ;-)? >>> -module(test). >>> -export([fac/1]. >>> >>> +doc("the factorial function"). >>> +type("int -> int"). >>> +keywords([math]). >>> >>> fac(0) -> 1; >>> fac(N) -> N*fac(N-1) >>> >>> >>> Regards >>> Andreas Hillqvist >>> >>> 2007/11/15, Joe Armstrong : >>>> Module have metadata Mod:module_info(export) etc. >>>> >>>> But functions do not. >>>> >>>> idea - attach function meta data with a new attribute. >>>> >>>> -meta(doc, "the factorial function"). >>>> -meta(type, "int -> int"). >>>> -meta(keywords, [math]). >>>> >>>> fac(0) -> 1; >>>> fac(N) -> N*fac(N-1) >>>> >>>> The meta data gets *attached* to the Next function in the module >>>> >>>> -meta(process, true). >>>> foo() -> spawn(fun() -> ... end) >>>> >>>> After compilation meta data can be access as follows: >>>> >>>> Mod:meta_data(fac, 1, doc) => "the factorial function" >>>> ... >>>> Mod:meta_data(fac, 1, glurk) => '$nothing' >>>> >>>> if we then *standardise* the meta data it will be easy to make loads >>>> of nice tools for type checking, documentation etc. >>>> >>>> I'm off on a trip today - so can somebody hack the preprocess and >>>> parser to do this? (( this needs a small change >>>> attributes have a different syntax and must be at *before* all functions)) >>>> >>>> This adds introspection to the language ! >>>> >>>> /Joe Armstrong >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> From kostis@REDACTED Fri Nov 16 21:03:51 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 16 Nov 2007 22:03:51 +0200 Subject: [erlang-questions] HiPE on powerpc In-Reply-To: References: Message-ID: <473DF7A7.8060502@cs.ntua.gr> Sergei Golovan wrote: > Hi! > > When building Erlang/OTP (R11B-5) with HiPE enabled on powerpc64 > machine (but compiler generated 32-bit code) there is the following > error: > > beam/erl_bif_info.c: In function 'system_info_1': > beam/erl_bif_info.c:1221: error: 'am_powerpc' undeclared (first use in > this function) Once upon a time (more than 2.5 years now, when G5s were coming out) we had a plan to develop a compiler back-end for powerpc64 and started the preparation for its development. Then the following things happened: 1. We had no powerpc64 machine available to test the port 2. The financial support for the HiPE project run out 3. Apple announced that its Macs would use Intel processors in the future Their combination had a disastrous effect to our powerpc64 plans :-( > Shouldn't HiPE architecture be adjusted in this case? Is the following > patch correct? > > ----------------- > --- erlang.orig/erts/configure.in > +++ erlang/erts/configure.in > @@ -372,6 +372,10 @@ > AC_MSG_RESULT(yes: adjusting ARCH=sparc64 to ARCH=ultrasparc) > ARCH=ultrasparc > ;; > +ppc64-4) > + AC_MSG_RESULT(yes: adjusting ARCH=ppc64 to ARCH=ppc) > + ARCH=ppc > + ;; > *) > AC_MSG_RESULT(no) > ;; > ----------------- Most probably yes, but we have no way of testing this -- consequently, we cannot possibly guarantee anything. If the machine truly runs in 32-bit mode, then it will most probably work, but this is just an (educated) guess. Cheers, Kostis (for the HiPE group) From bekesa@REDACTED Fri Nov 16 21:07:05 2007 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Fri, 16 Nov 2007 21:07:05 +0100 Subject: [erlang-questions] pattern match test operator Message-ID: <200711162107.06534.bekesa@sch.bme.hu> Hi, I'm missing a pattern match test operator from Erlang. What I mean? I think there should be a built-in operator, which requires a pattern on the left-side and a value on the right side, and returns true or false, depending on the success of the match. The semantics of the operator could be the same as this macro: -define(MATCH(Pattern,Value), case Value of Pattern -> true; _ -> false end). I think this is very useful in some situations, for example, this expression: case Value1 of PATTERN1 -> case Value2 of PATTERN2 -> this; _ -> that end; _-> that end could be rewritten as case ?MATCH(PATTERN1,Value1) andalso ?MATCH(PATTERN2,Value2) of true -> this; _ -> that end Using an 'if' instead of 'case' would be better, but it won't work because the 'case' expression -- the result of ?MATCH/2 -- is not guard-expression :-( In this case you can use the 'case' construct, but if you want to have a function like fun(Arg) when ?MATCH(PATTERN1,Arg) or ?MATCH(PATTERN2,Arg) -> you can't do anything. So having a built-in operator (that can be used in guards) would be useful, I think. Such built-in stuff could probably be more efficient than the above macro. Of course, this operator would never bind variables (just like the macro above). Maybe it should not accept patterns containing variables other than _ . Besides this, there should be a similar built-in function-like construct that's argument is a pattern and returns a function that returns true if its argument matches its pattern, false otherwise. This can be achieved by the following macro: -define(MATCHFUN(Pattern), fun(X)-> case X of Pattern -> true; _ -> false end end). I can imagine many uses of such functions (lists:filter-ing, filtering ets and mnesia tables with such fun's instead of match patterns or match specifications, etc). If such a function is not generated by the above macro but some more clever way, it could be at least as efficient as match patterns, maybe similar to match specifications. I'm writing this mail to start a discussion. I think these two language constructs would be very useful, but maybe I'm wrong. So tell me any reason why these constructs are not viable or not needed in Erlang. If we don't find such reasons and we consider these useful, I'm eager to propose an enhancement. Georgy From vladdu55@REDACTED Fri Nov 16 22:00:26 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 16 Nov 2007 21:00:26 +0000 Subject: [erlang-questions] pattern match test operator In-Reply-To: <200711162107.06534.bekesa@sch.bme.hu> References: <200711162107.06534.bekesa@sch.bme.hu> Message-ID: <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> Hi! On Nov 16, 2007 8:07 PM, Andras Georgy Bekes wrote: > I'm missing a pattern match test operator from Erlang. What I mean? > I think there should be a built-in operator, which requires a pattern on > the left-side and a value on the right side, and returns true or false, > depending on the success of the match. Unless there is some use case I can't see right now, the constructs you are suggesting are not really needed. More precisely, I can't see when I would want to do a match against a pattern containing only '_'s and if that is true I wouldn't need to match again to retrieve some of the internal terms later on. In this case, it's better to match even the internal structure from the start. * In list comprehensions, the filtering is done automagically: [ X || {X, _} <- L] will simply ignore elements in L that aren't of the form {_, _}. * One could rewrite case Value1 of PATTERN1 -> case Value2 of PATTERN2 -> this; _ -> that end; _-> that end as case {Value1, Value2} of {PATTERN1, PATTERN2} -> this; _-> that end * Regarding fun(Arg) when ?MATCH(PATTERN1,Arg) or ?MATCH(PATTERN2,Arg) -> I'm not sure why you want to match Arg against two patterns. If you meant fun(Arg1, Arg2) when ?MATCH(PATTERN1,Arg1) or ?MATCH(PATTERN2,Arg2) -> then the usual way to do that is fun(PATTERN1, PATTERN2) -> So I personally don't need a match operator, it is already omnipresent in the language. best regards, Vlad From dave.rafkind@REDACTED Fri Nov 16 22:25:30 2007 From: dave.rafkind@REDACTED (Dave Rafkind) Date: Fri, 16 Nov 2007 16:25:30 -0500 Subject: [erlang-questions] jinterface for java port? Message-ID: <2ae2b2da0711161325ha998294q6adb6dc62afd0bd9@mail.gmail.com> Hi list, is it possible to use the Jinterface ilbraries to write an external port program in Java? JInterface is very socket-based, but it seems like I can almost use OtpInputStream/OtpOutputStream to do what I want except that OtpInputStream only reads from byte arrays and not an InputStream. Is there an easy remedy? Thanks! Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From istarex@REDACTED Fri Nov 16 22:36:34 2007 From: istarex@REDACTED (istarex) Date: Fri, 16 Nov 2007 16:36:34 -0500 Subject: [erlang-questions] Erlang and mutable state Message-ID: Hi all, I had a question about Erlang and mutable state. I understand that Erlang avoids the concurrency nightmare of other languages by avoiding mutable state shared between processes. But why Erlang doesn't allow mutable state isolated within a process (such that no other process could directly access or change that state)? I'm wondering what in Erlang's programming model prevents this. If anybody could point me to a good link or paper that describes the reason, I'd really appreciate it. -Istarex From dking@REDACTED Fri Nov 16 22:47:13 2007 From: dking@REDACTED (David King) Date: Fri, 16 Nov 2007 13:47:13 -0800 Subject: [erlang-questions] Erlang and mutable state In-Reply-To: References: Message-ID: <394695C3-5792-4EF6-93C7-E093DE8D8DAD@ketralnis.com> > [...] But why Erlang doesn't allow mutable state isolated within a > process (such that no other process > could directly access or change that state)? [...] It does, in the form of the process dictionary. Generally speaking, its usage is frown upon, but it does offer mutable state. From me@REDACTED Fri Nov 16 22:52:22 2007 From: me@REDACTED (KatolaZ) Date: Fri, 16 Nov 2007 22:52:22 +0100 Subject: [erlang-questions] Erlang and mutable state In-Reply-To: References: Message-ID: <20071116215221.GH6959@katolaz.homeunix.net> On Fri, Nov 16, 2007 at 04:36:34PM -0500, istarex wrote: > Hi all, > > I had a question about Erlang and mutable state. I understand that > Erlang avoids the concurrency nightmare of other languages by avoiding > mutable state shared between processes. But why Erlang doesn't allow > mutable state isolated within a process (such that no other process > could directly access or change that state)? I'm wondering what in > Erlang's programming model prevents this. If anybody could point me > to a good link or paper that describes the reason, I'd really > appreciate it. > I think the main reason is the functional origin of Erlang, aside with the fact that native support for concurrency and message passing among processes lead to a rather different way of seeing at "mutable states": you just have a state of processes (such as the usually-called LoopData or the state of a behaviour), and there is no difference among mutable and immutable states. All states are mutable in Erlang, and you're sure that a state does not ever survive after the end of the corresponding process. I understand this could be hard to deal with for those who come from an imperative language, but as soon as you get acquainted with this new way of looking at "variables", you'll probably find that "the functional way" is much more simple and intuitive than the imperative abstraction. :-) HND Enzo -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] From bob@REDACTED Fri Nov 16 23:04:24 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 16 Nov 2007 14:04:24 -0800 Subject: [erlang-questions] Erlang and mutable state In-Reply-To: References: Message-ID: <6a36e7290711161404x2d9fe713i479dce2f99e52434@mail.gmail.com> Erlang style pattern matching and mutable variables are sorta mutually exclusive. There is mutable state in the process dictionary though, see erlang:get, erlang:set. There's also ets. You can also of course emulate mutable state by encapsulating the state in another process. On 11/16/07, istarex wrote: > Hi all, > > I had a question about Erlang and mutable state. I understand that > Erlang avoids the concurrency nightmare of other languages by avoiding > mutable state shared between processes. But why Erlang doesn't allow > mutable state isolated within a process (such that no other process > could directly access or change that state)? I'm wondering what in > Erlang's programming model prevents this. If anybody could point me > to a good link or paper that describes the reason, I'd really > appreciate it. > > -Istarex > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mikpe@REDACTED Fri Nov 16 23:15:00 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 16 Nov 2007 23:15:00 +0100 (MET) Subject: [erlang-questions] HiPE on powerpc Message-ID: <200711162215.lAGMF0aE007599@harpo.it.uu.se> On Fri, 16 Nov 2007 22:03:20 +0300, Sergei Golovan wrote: > When building Erlang/OTP (R11B-5) with HiPE enabled on powerpc64 > machine (but compiler generated 32-bit code) there is the following > error: > > beam/erl_bif_info.c: In function 'system_info_1': > beam/erl_bif_info.c:1221: error: 'am_powerpc' undeclared (first use in > this function) > > which usually appears if HiPE arcitecture is incorrect. > > Shouldn't HiPE architecture be adjusted in this case? Is the following > patch correct? > > ----------------- > --- erlang.orig/erts/configure.in > +++ erlang/erts/configure.in > @@ -372,6 +372,10 @@ > AC_MSG_RESULT(yes: adjusting ARCH=sparc64 to ARCH=ultrasparc) > ARCH=ultrasparc > ;; > +ppc64-4) > + AC_MSG_RESULT(yes: adjusting ARCH=ppc64 to ARCH=ppc) > + ARCH=ppc > + ;; > *) > AC_MSG_RESULT(no) > ;; > ----------------- Yes, this change looks correct. If you can confirm that it fixes your build failure on ppc64 kernels with gcc -m32 in userland, then I'll be happy to check it into HiPE CVS. Alas we cannot test this ourselves since we don't have any ppc64 hardware. /Mikael From vladdu55@REDACTED Fri Nov 16 23:18:12 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 16 Nov 2007 22:18:12 +0000 Subject: [erlang-questions] jinterface for java port? In-Reply-To: <2ae2b2da0711161325ha998294q6adb6dc62afd0bd9@mail.gmail.com> References: <2ae2b2da0711161325ha998294q6adb6dc62afd0bd9@mail.gmail.com> Message-ID: <95be1d3b0711161418r69ec708dkbbf0f068e0cc9795@mail.gmail.com> Hi, On Nov 16, 2007 9:25 PM, Dave Rafkind wrote: > Hi list, is it possible to use the Jinterface ilbraries to write an external > port program in Java? Of course it's possible. If you really want to make it a port, you will have to adapt an OtpInputStream to a "normal" stream. But you can also implement a java node and communicate via messages and you get all this for free. best regards, Vlad From mateuszb@REDACTED Fri Nov 16 23:20:15 2007 From: mateuszb@REDACTED (Mateusz Berezecki) Date: Fri, 16 Nov 2007 23:20:15 +0100 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: <473DB2AF.4040204@it.uu.se> References: <473DB2AF.4040204@it.uu.se> Message-ID: <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> On Nov 16, 2007, at 4:09 PM, Per Gustafsson wrote: >> > > It is slow because for each iteration a two sub-binary structure > (about 5 words) is allocated. This will be optimized in the next > release of Erlang/OTP, but your code is sub optimal anyway, if you > want good performance you should write: > > test1(<<>>) -> done; > test1(<<_A, Rest/binary>>) -> > test1(Rest). > > That is, you should not first pattern match and create a sub-binary > and then match against that one. It was written that way to show that some calculations are done on that matched value later. Generally speaking I'm having a trouble parsing a stream of data where each control frame is single byte and I have no knowledge of the stream unless I parse that single byte (i.e. and ~3-4 bytes after it - they vary depending on that first single byte). I'm curious, can erlang achieve good performance with that kind of stream data filtering? Mateusz Berezecki From bekesa@REDACTED Fri Nov 16 23:44:08 2007 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Fri, 16 Nov 2007 23:44:08 +0100 Subject: [erlang-questions] pattern match test operator In-Reply-To: <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> Message-ID: <200711162344.08813.bekesa@sch.bme.hu> Hi, > Unless there is some use case I can't see right now, the constructs > you are suggesting are not really needed. Not needed: everything can be programmed without them, but sometimes in an ugly way. > More precisely, I can't see when I would want to do a match against a > pattern containing only '_'s and if that is true I wouldn't need to > match again to retrieve some of the internal terms later on. In this > case, it's better to match even the internal structure from the > start. For example, today I've seen a piece of code (in AXD301 sources) that looked like: case Expr1 of PATTERN1 -> case Expr_with_side_effects of [[{_,0,_,_,}]] -> do_something1(); _ -> do_something2() end; _ -> do_something2() end The strange pattern above is real, other parts are changed of course. Actually this was the reason I wrote this mail: we coudn't find any elegant solution. My suggested (elegant) solution is: case ?MATCH(PATTERN1,Expr1) andalso ?MATCH([[{_,0,_,_,}]],Expr_with_side_effects) of true -> do_something1(); _ -> do_something2() end Other example: The whole ets:match is about matching against a pattern containing only '_'s. But yes, you got the point: The patterns should be allowed to contain any variables, because having a variable more than once in a pattern is useful (this is why patterns for ets:match can contain '$1','$2'... stuff, but that's ugly). > * One could rewrite > > case Value1 of > PATTERN1 -> > case Value2 of > PATTERN2 -> > this; > _ -> > that > end; > _-> > that > end > > as > > case {Value1, Value2} of > {PATTERN1, PATTERN2} -> > this; > _-> > that > end Not acceptable. This evaluates Value2 unconditionally. The original evaluates it only if Value1 matches PATTERN1 (think about side effects and runtime). The names Value1 and Value2 were misleading. Think about Expr1, Expr2. > * Regarding > fun(Arg) when ?MATCH(PATTERN1,Arg) or ?MATCH(PATTERN2,Arg) -> > I'm not sure why you want to match Arg against two patterns. I've seen a code fragment (in AXD301) several weeks ago, so I can't remember correctly, but: The function was supposed to select the first case if one argument looked like "R7A..." or "R12C...". This could be done with my construct: function(X) when ?MATCH("R7A"++_,X) or ?MATCH("R12C"++_,X) -> complicated_function_body(). As far as I remember the function supposed to crash if there's no match. All the solutions we've found were ugly in some way. > If you > meant fun(Arg1, Arg2) when ?MATCH(PATTERN1,Arg1) or > ?MATCH(PATTERN2,Arg2) -> then the usual way to do that is > fun(PATTERN1, PATTERN2) -> I didn't mean this. I meant a function head that matches if an argument matches (at least) one of several patterns. Georgy From matthew@REDACTED Fri Nov 16 23:48:21 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 16 Nov 2007 14:48:21 -0800 Subject: [erlang-questions] Weird function match semantics Message-ID: I expect the following three expressions to evaluate to 'ok': (fun("X" ++ _) -> ok end)("X"). (fun([$X | _]) -> ok end)("X"). (fun([$X] ++ _) -> ok end)("X"). The first two meet my expectations, but the third exits with an illegal_pattern exception. Is this intentional or a bug? Thanks. From mateuszb@REDACTED Fri Nov 16 23:20:15 2007 From: mateuszb@REDACTED (Mateusz Berezecki) Date: Fri, 16 Nov 2007 23:20:15 +0100 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: <473DB2AF.4040204@it.uu.se> References: <473DB2AF.4040204@it.uu.se> Message-ID: <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> On Nov 16, 2007, at 4:09 PM, Per Gustafsson wrote: >> > > It is slow because for each iteration a two sub-binary structure > (about 5 words) is allocated. This will be optimized in the next > release of Erlang/OTP, but your code is sub optimal anyway, if you > want good performance you should write: > > test1(<<>>) -> done; > test1(<<_A, Rest/binary>>) -> > test1(Rest). > > That is, you should not first pattern match and create a sub-binary > and then match against that one. It was written that way to show that some calculations are done on that matched value later. Generally speaking I'm having a trouble parsing a stream of data where each control frame is single byte and I have no knowledge of the stream unless I parse that single byte (i.e. and ~3-4 bytes after it - they vary depending on that first single byte). I'm curious, can erlang achieve good performance with that kind of stream data filtering? Mateusz Berezecki From bbmaj7@REDACTED Sat Nov 17 00:26:05 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Sat, 17 Nov 2007 10:26:05 +1100 (EST) Subject: [erlang-questions] erlang time in vmware In-Reply-To: <473DAEC3.2060602@it.su.se> Message-ID: <421859.49098.qm@web52011.mail.re2.yahoo.com> > My Erlang VM however, ended up ~270 seconds into the future after > running for about a week. The system time as reported by 'date' showed > correct time. Can someone explain this, and hopefully also tell me how > to avoid it in the future? >From my observations of erlang under Linux via strace I see that it makes extensive use of clock_gettime( CLOCK_MONOTONIC ). CLOCK_MONOTONIC combined with vmware modifying kernel clock ticks might lead to this effect. If vmware inserts additional timing ticks to try and acount for time periods in which the guest kernel is not running, then erlang might see the time as in the future if it measures wall time as (StartTime + Ticks). Just guessing though. I don't see an obvious way to avoid it, except to use a vmware supported OS-specific mechanism to get wall-clock time. Make the switch to the world's best email. Get the new Yahoo!7 Mail now. http://au.yahoo.com/worldsbestmail/viagra/index.html From dbyrne@REDACTED Sat Nov 17 02:09:16 2007 From: dbyrne@REDACTED (Dennis Byrne) Date: Fri, 16 Nov 2007 19:09:16 -0600 Subject: [erlang-questions] Erlang and mutable state In-Reply-To: Message-ID: Here is a little information in addition to some of the other responses on this thread. http://notdennisbyrne.blogspot.com/2007/10/psst-erlang-has-mutable-state.html ____________________________________________ Dennis Byrne ThoughtWorks - Chicago 312-505-7965 erlang-questions-bounces@REDACTED wrote on 11/16/2007 03:36:34 PM: > Hi all, > > I had a question about Erlang and mutable state. I understand that > Erlang avoids the concurrency nightmare of other languages by avoiding > mutable state shared between processes. But why Erlang doesn't allow > mutable state isolated within a process (such that no other process > could directly access or change that state)? I'm wondering what in > Erlang's programming model prevents this. If anybody could point me > to a good link or paper that describes the reason, I'd really > appreciate it. > > -Istarex > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul-trapexit@REDACTED Sat Nov 17 03:03:02 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Fri, 16 Nov 2007 18:03:02 -0800 (PST) Subject: [erlang-questions] clarify: mnesia:first on fragmented table Message-ID: hi. in my version of erlang, i can't invoke mnesia:first/1 under mnesia:activity/4 using mnesia_frag access module because mnesia_frag:first/3 is not implemented, i.e., i can't iterate on a fragmented table using first and next. also i notice that -behaviour (mnesia_access) lines are commented out in mnesia.erl and mnesia_frag.erl and furthermore i cannot find a definition of the mnesia_access behaviour anywhere (there is of course the implicit definition via the usage in mnesia.erl). is this expected? -- p Optimism is an essential ingredient of innovation. How else can the individual favor change over security? -- Robert Noyce From saleyn@REDACTED Sat Nov 17 04:41:55 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 16 Nov 2007 22:41:55 -0500 Subject: [erlang-questions] hi ulf! i've seen u already answered some questions related to the gen_event behaviour and its functions. since i'm new to erlang i'd like to ask a question related to that topic and i'm grateful for any reply. currently i'm implementing a logging system using gen_event and the syslog-interface to log additional local facilities to the linux sysklog-daemon. 1.) should my event-manager have a supervised handler for each facility and/or for each severity to enforce concurrency or is it better to have all events handled after one another by only one handler and using clauses to match certain conditions? 2.) when 'notifying' i assume the event-manager propagates the event to all handlers belonging to that manager. shouldn't i use 'call' instead to already specificly adress the certain handler with my request/event in order to avoid passing-around-messages and matching against clauses in each handler and therefore conserve performance? i'm still not very sure which approach makes the most sense, maybe you can give me a hint or two on how this is realized. thanx a lot for your time, gen_event + syslog + sysklogd In-Reply-To: <94C5430AA547F24AA801BA5706F29D2E25CC76@srvkeyx01.KEYTRONIX.local> References: <94C5430AA547F24AA801BA5706F29D2E25CC76@srvkeyx01.KEYTRONIX.local> Message-ID: <473E6303.9080106@gmail.com> You can look at the LAMA contrib at jungerl: http://jungerl.sourceforge.net Among other things it includes syslog logging based on error_logger event manager. Serge Grasl Christoph wrote: > hi there! > > i've seen some of u already answered some questions related > to the gen_event behaviour and its functions. since i'm new > to erlang i'd like to ask a question related to that topic > and i'm grateful for any reply. > > currently i'm implementing a logging system using gen_event > and the syslog-interface to log additional local facilities > to the linux sysklog-daemon. > > 1.) > should my event-manager have a > supervised handler for each facility and/or for each severity > to enforce concurrency or is it better to have all events handled > after one another by only one handler and using clauses to match > certain conditions? > > 2.) > when 'notifying' i assume the event-manager propagates the event to > all handlers belonging to that manager. shouldn't i use > 'call' instead to already specificly adress the certain handler with my > request/event in order to avoid passing-around-messages and matching > against clauses in each handler and therefore conserve performance? > > i'm still not very sure which approach makes the most sense, maybe > some of you can give me a hint or two on how this is realized. > > thanx a lot for your time, > > cheers, chris > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From md@REDACTED Sat Nov 17 06:45:40 2007 From: md@REDACTED (Maximillian Dornseif) Date: Fri, 16 Nov 2007 21:45:40 -0800 (PST) Subject: [erlang-questions] beginner: Binaries in tv Message-ID: <13806407.post@talk.nabble.com> I love using the table viewer (tv) for debugging my database code. Unfortunately tv gets very unhelpful when dealing with Character Data encoded as Binary (see http://static.23.nu/md/Pictures/ZZ271508DF.png for an example): tv displays only "#Bin". Is there a way to make tv display binaries like the erlang shell does? E.g. <<"some text">> instead of just #Bin? Regards Maximillian -- View this message in context: http://www.nabble.com/beginner%3A-Binaries-in-tv-tf4825523.html#a13806407 Sent from the Erlang Questions mailing list archive at Nabble.com. From bjorn@REDACTED Sat Nov 17 10:27:30 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 Nov 2007 10:27:30 +0100 Subject: [erlang-questions] Version of beam In-Reply-To: References: Message-ID: Micka?l R?mond writes: > Hello, > > Is there any function (or description of the beam format) allowing to > know which version of beam bytecode we are dealing with ? > The idea would be, given a beam file, to know if it is targetting > Erlang R10 or R11 for example. Unless the beam-file has been stripped, the easiest way is to look at the compiler version number in the informatin returned by: Mod:module_info(comile). The same information can be obtained by beam_lib like this if you don't want to load the module to check its version: beam_lib:chunks(PathToBeamFile, [compile_info]). If you must be able to deal with beam-files that have been stripped, you could extract the "Code" chunk from the beam-file, and look at the field called "opcode_max" in the header for the code. (See http://www.erlang.se/~bjorn/beam_file_format.html.) /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Sat Nov 17 10:48:14 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 Nov 2007 10:48:14 +0100 Subject: [erlang-questions] Weird function match semantics In-Reply-To: References: Message-ID: "Matthew Dempsky" writes: > I expect the following three expressions to evaluate to 'ok': > > (fun("X" ++ _) -> ok end)("X"). > (fun([$X | _]) -> ok end)("X"). > (fun([$X] ++ _) -> ok end)("X"). > > The first two meet my expectations, but the third exits with an > illegal_pattern exception. Is this intentional or a bug? It does seems to be a bug in the evaluator. It works fine in compiled code. If time permits we will fix it in R12B-0. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Sat Nov 17 10:53:26 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 17 Nov 2007 01:53:26 -0800 (PST) Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> Message-ID: <443295.20671.qm@web38807.mail.mud.yahoo.com> --- Mateusz Berezecki wrote: > > On Nov 16, 2007, at 4:09 PM, Per Gustafsson wrote: > > >> > > > > It is slow because for each iteration a two > sub-binary structure > > (about 5 words) is allocated. This will be > optimized in the next > > release of Erlang/OTP, but your code is sub > optimal anyway, if you > > want good performance you should write: > > > > test1(<<>>) -> done; > > test1(<<_A, Rest/binary>>) -> > > test1(Rest). > > > > That is, you should not first pattern match and > create a sub-binary > > and then match against that one. > > It was written that way to show that some > calculations are done on that > matched value later. Well, you did ask why the sample code was slow. If your calculation is big enough, it won't matter. Otherwise, use Per's reasoning as inspiration for your future code. > Generally speaking > I'm having a trouble parsing a stream of data > where each control frame is single byte and I have > no knowledge of > the stream unless I parse that single byte (i.e. and > ~3-4 bytes after > it - they vary depending > on that first single byte). One scheme to extract such data is this: -define(ARG1, 36). ... f(<>) -> ...; f(<>) -> ...; f(<>) -> ...; f(<>) -> ...; f(<>) -> ...; ... and so on. In R11, this method is suboptimal since it still builds Rest in every iteration, but that should improve in R12. > I'm curious, can erlang achieve good performance > with that kind of stream data filtering? Since we just had a long discussion on the topic, why not have a look at the widefinder mail threads from a couple of weeks back? The mailing list archives can be found at erlang.org. Best, Thomas ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From per.gustafsson@REDACTED Sat Nov 17 11:22:57 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Sat, 17 Nov 2007 11:22:57 +0100 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> References: <473DB2AF.4040204@it.uu.se> <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> Message-ID: <473EC101.9000603@it.uu.se> Mateusz Berezecki wrote: > > On Nov 16, 2007, at 4:09 PM, Per Gustafsson wrote: > >>> >> >> It is slow because for each iteration a two sub-binary structure >> (about 5 words) is allocated. This will be optimized in the next >> release of Erlang/OTP, but your code is sub optimal anyway, if you >> want good performance you should write: >> >> test1(<<>>) -> done; >> test1(<<_A, Rest/binary>>) -> >> test1(Rest). >> >> That is, you should not first pattern match and create a sub-binary >> and then match against that one. > > It was written that way to show that some calculations are done on that > matched value later. Generally speaking > I'm having a trouble parsing a stream of data > where each control frame is single byte and I have no knowledge of > the stream unless I parse that single byte (i.e. and ~3-4 bytes after > it - they vary depending > on that first single byte). > > I'm curious, can erlang achieve good performance with that kind of > stream data filtering? > > > Mateusz Berezecki > The way to write that would be: parse_stream(<<1,some parsing pattern,Rest/binary>>) -> ... parse_stream(Rest); parse_stream(<<2,some other parsing pattern,Rest/binary>>) -> ... parse_stream(Rest); ... parse_stream(<<>>) -> ok. This will minimize he construction of unnecessary sub-binaries and in R12B you should be able to get good performance for this kind of approach (It still wouldn't be as fast as C, but a lot closer). If you want some more information about the implementation of the bit syntax you should read the paper I presented at this years EUC: http://www.erlang.se/euc/07/papers/1700Gustafsson.pdf Per From per@REDACTED Sat Nov 17 11:24:40 2007 From: per@REDACTED (Per Hedeland) Date: Sat, 17 Nov 2007 11:24:40 +0100 (CET) Subject: [erlang-questions] erlang time in vmware In-Reply-To: <421859.49098.qm@web52011.mail.re2.yahoo.com> Message-ID: <200711171024.lAHAOe1h026639@pluto.hedeland.org> Richard Andrews wrote: > >[ Fredrik Thulin wrote: ] >> My Erlang VM however, ended up ~270 seconds into the future after >> running for about a week. The system time as reported by 'date' showed >> correct time. Can someone explain this, and hopefully also tell me how >> to avoid it in the future? > >From my observations of erlang under Linux via strace I see that it makes >extensive use of clock_gettime( CLOCK_MONOTONIC ). CLOCK_MONOTONIC combined >with vmware modifying kernel clock ticks might lead to this effect. If vmware >inserts additional timing ticks to try and acount for time periods in which the >guest kernel is not running, then erlang might see the time as in the future if >it measures wall time as (StartTime + Ticks). It doesn't, but it does "compensate" for sudden changes in wall clock time (i.e. due to the clock having been stepped) by using ticks on OSes where this is possible (e.g. Linux). See the +c flag in the erl(1) man page (and/or erts/emulator/beam/erl_time_sup.c if you're *really* curious:-). This might still have the described result if vmware does what you think it does - i.e. the ticks marching on while wall clock time doesn't would be interpreted as wall clock time being stepped back. However I can't really see how vmware could literally "insert ticks" in an unmodified guest kernel - what it can and must do is of course to generate timer interrupts, but those should be turned into both ticks and wall clock advancement by the guest kernel, i.e. they should keep in sync. Maybe if it keeps generating too many interrupts, and keeps "compensating" by setting wall clock time back - I guess the vmware tools stuff that Fredrik mentions will do the latter if it needs to. It may possibly help to tell the guest Linux to use a lower "Hz" (kernel compile-time thing unfortunately if I remember right). Or try to use NTP againast vmware's recommendations, it has worked fine for me - I've never run Linux 2.6 in vmware though, but for 2.4 in (old) vmware or 2.6 in qemu NTP has been OK for keeping system time. It would surely require disabling the part of vmware tools that "keeps time" though, don't know if that is possible. --Per Hedeland From mateuszb@REDACTED Sat Nov 17 12:08:23 2007 From: mateuszb@REDACTED (Mateusz Berezecki) Date: Sat, 17 Nov 2007 12:08:23 +0100 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: <473EC101.9000603@it.uu.se> References: <473DB2AF.4040204@it.uu.se> <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> <473EC101.9000603@it.uu.se> Message-ID: On Nov 17, 2007, at 11:22 AM, Per Gustafsson wrote: > The way to write that would be: > > > parse_stream(<<1,some parsing pattern,Rest/binary>>) -> > ... > parse_stream(Rest); > parse_stream(<<2,some other parsing pattern,Rest/binary>>) -> > ... > parse_stream(Rest); > ... > parse_stream(<<>>) -> ok. > > This will minimize he construction of unnecessary sub-binaries and > in R12B you should be able to get good performance for this kind of > approach (It still wouldn't be as fast as C, but a lot closer). > > If you want some more information about the implementation of the > bit syntax you should read the paper I presented at this years EUC: > > http://www.erlang.se/euc/07/papers/1700Gustafsson.pdf Per thanks for the URL. I will read it this weekend. Thomas I've read the widefinder discussion and it is completely not applicable to this kind of problem I am having. widefinder is for disk IO, log related files. I'm talking variable length control structures extracted on the fly from the huge volume network stream. I can't "parallelize" the stream of which I know nothing of except I know the first byte describes some small excerpt of it. In explicit I'm talking this kind of stuff <> = Bin, LenLen1 = LenLen * 8, NameLen1 = NameLen + 1, << LengthPay:LenLen1/unsigned-integer, NameBin:NameLen1/binary, Payload:LengthPay/binary, Rest2/binary >> = Rest, Is there any way to put this in one line and preferably in the function header so as to avoid allocating stuff? Why arithmetic expressions are not allowed in bit syntax? The function returns {NameBin, Payload, Rest} but it is recursive, doing extract(Stream)->extract(Rest)- >extract(RestOfRest) until it parses out a complete excerpt which is usually less than 300 bytes. After parsing it, it then it proceeds to extracting another fragment of data from the stream. Is this kind of problem suitable for doing in erlang or should I go with linked-in C driver? regards, Mateusz Berezecki From yerl@REDACTED Fri Nov 16 10:19:55 2007 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 16 Nov 2007 10:19:55 +0100 Subject: [erlang-questions] EUC '07 papers and slides Message-ID: Hi ! I'll be interested by the "The New Array Module" paper and source code from Richard Carlsson and Dan Gudmundsson. Are they available somewhere ? cheers Y. >> ----- Original Message ----- >> From: Francis Norton >> To: Ulf Wiger (TN/EAB) >> Cc: Erlang Questions >> Sent: Monday, November 12, 2007 8:51 AM >> Subject: Re: [erlang-questions] EUC '07 papers and slides >> >> Actually the papers *are* at the first location >> (http://www.erlang.se/workshop/2007/) - I've just been >> browsing them! >> >> Francis. >> >> On 12/11/2007, Ulf Wiger (TN/EAB) wrote: >> > >> > Actually, for the EUC '07, the link would be: >> > >> > http://www.erlang.se/euc/07/ >> > >> > ...but the papers are still not there. >> > >> > BR, >> > Ulf W >> > >> > >> > shiwei xu wrote: >> > > http://www.erlang.se/workshop/2007/ >> > > >> > > On 11/10/07, *Joel Reymont* > joelr1@REDACTED>> >> > > wrote: >> > > >> > > Are they available yet? >> > > >> > > I'm particularly interested in the non-destructive array updates. >> > > >> > > Thanks, Joel >> > > >> > > -- >> > > http://wagerlabs.com >> > > >> > > >> > > >> > > >> > > >> > > _______________________________________________ >> > > erlang-questions mailing list >> > > erlang-questions@REDACTED >> > > >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > >> > > >> > > >> > > >> ------------------------------------------------------------------------ >> > > >> > > _______________________________________________ >> > > erlang-questions mailing list >> > > erlang-questions@REDACTED >> > > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> >> >> >> ________________________________ >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > From chlorophil@REDACTED Sat Nov 17 13:22:57 2007 From: chlorophil@REDACTED (Philip Robinson) Date: Sat, 17 Nov 2007 22:22:57 +1000 Subject: [erlang-questions] Clarify: HiPE auto-spawning? In-Reply-To: References: Message-ID: Thank you all. Your explanations are greatly appreciated. Cheers, Philip From ahmed.nawras@REDACTED Sat Nov 17 14:47:38 2007 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Sat, 17 Nov 2007 17:47:38 +0400 Subject: [erlang-questions] Book: Hardcore Erlang In-Reply-To: References: Message-ID: Hi Joel, How about the following topics? Not all of them are applicable for OpenPoker but I think they should be present in any "Hardcore Erlang" book. * Interoperability with other languages (java, c...etc) including ports * Detailed discussion of OTP and behaviours. I've been looking at current documentation but I know there are lots that are not there * Future direction of Erlang like web (Erlyweb?) Ajax...etc Thanks for your contribution. Best regards, Ahmed On Nov 9, 2007 2:54 PM, Joel Reymont wrote: > I signed up with Pragmatic Programmers to write a new Erlang book. > > Working title is Hardcore Erlang and it will be built around > OpenPoker. The emphasis of the book will be more on showing how to > write scalable Erlang servers and less on how to write a poker server. > > Apart from the following topics, are there any other topics you would > like me to cover? > > Thanks, Joel > > ---- > > - The architecture of a poker server from far above > > - Thinking processes instead of objects > > - Game logic > - Stacking state machines > - Swapping logic > > - Storing data in Mnesia > > - State machines (gen_fsm) > > - OTP behaviours > > - Poker bots > - Simulating players > - Scripting > > - Designing a network protocol > - Binary parsing > - Pickler combinators > > - Automatic clustering > > - Fault tolerance and fail-over > > - Load balancing > > - Testing a network server > > - Debugging Erlang software > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From anders.nygren@REDACTED Sat Nov 17 15:45:57 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Sat, 17 Nov 2007 08:45:57 -0600 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: References: <473DB2AF.4040204@it.uu.se> <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> <473EC101.9000603@it.uu.se> Message-ID: On Nov 17, 2007 5:08 AM, Mateusz Berezecki wrote: > On Nov 17, 2007, at 11:22 AM, Per Gustafsson wrote: > > > The way to write that would be: > > > > > > parse_stream(<<1,some parsing pattern,Rest/binary>>) -> > > ... > > parse_stream(Rest); > > parse_stream(<<2,some other parsing pattern,Rest/binary>>) -> > > ... > > parse_stream(Rest); > > ... > > parse_stream(<<>>) -> ok. > > > > This will minimize he construction of unnecessary sub-binaries and > > in R12B you should be able to get good performance for this kind of > > approach (It still wouldn't be as fast as C, but a lot closer). > > > > If you want some more information about the implementation of the > > bit syntax you should read the paper I presented at this years EUC: > > > > http://www.erlang.se/euc/07/papers/1700Gustafsson.pdf > > Per thanks for the URL. I will read it this weekend. > > Thomas I've read the widefinder discussion and it is completely > not applicable to this kind of problem I am having. > > widefinder is for disk IO, log related files. I'm talking > variable length control structures extracted on the fly > from the huge volume network stream. I can't "parallelize" > the stream of which I know nothing of except I know > the first byte describes some small excerpt of it. > True, but there were also a lot of discussions about how to handle binaries efficiently. For a good summary see, Caoyuan's blog http://blogtrader.net/page/dcaoyuan/entry/learning_coding_binary_was_tim That applies to R11. Things will change in R12, as described in Per Gustafsson's document. To get some more hints on efficient use of binaries in R12, see the efficiency guide in the R12 documentation, preliminary versions can be found in http://erlang.org/download/snapshots/ /Anders > In explicit I'm talking this kind of stuff > > < Rest/binary>> = Bin, > > LenLen1 = LenLen * 8, > NameLen1 = NameLen + 1, > > << LengthPay:LenLen1/unsigned-integer, > NameBin:NameLen1/binary, > Payload:LengthPay/binary, > Rest2/binary >> = Rest, > > > Is there any way to put this in one line and preferably > in the function header so as to avoid allocating stuff? > Why arithmetic expressions are not allowed in bit syntax? > > The function returns > > {NameBin, Payload, Rest} > > but it is recursive, doing extract(Stream)->extract(Rest)- > >extract(RestOfRest) > until it parses out a complete excerpt which is usually less than 300 > bytes. > > After parsing it, it then it proceeds to extracting another fragment > of data from the stream. > > Is this kind of problem suitable for doing in erlang or should I go > with linked-in C driver? > > > regards, > Mateusz Berezecki > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From per.gustafsson@REDACTED Sat Nov 17 17:19:14 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Sat, 17 Nov 2007 17:19:14 +0100 Subject: [erlang-questions] clarify: why bit syntax so slow + benchmark code In-Reply-To: References: <473DB2AF.4040204@it.uu.se> <21576AFD-1ED9-4B33-A31A-3E27DB81F2EF@gmail.com> <473EC101.9000603@it.uu.se> Message-ID: <473F1482.5080504@it.uu.se> Mateusz Berezecki wrote: > On Nov 17, 2007, at 11:22 AM, Per Gustafsson wrote: > >> The way to write that would be: >> >> >> parse_stream(<<1,some parsing pattern,Rest/binary>>) -> >> ... >> parse_stream(Rest); >> parse_stream(<<2,some other parsing pattern,Rest/binary>>) -> >> ... >> parse_stream(Rest); >> ... >> parse_stream(<<>>) -> ok. >> >> This will minimize he construction of unnecessary sub-binaries and in >> R12B you should be able to get good performance for this kind of >> approach (It still wouldn't be as fast as C, but a lot closer). >> >> If you want some more information about the implementation of the bit >> syntax you should read the paper I presented at this years EUC: >> >> http://www.erlang.se/euc/07/papers/1700Gustafsson.pdf > > Per thanks for the URL. I will read it this weekend. > > Thomas I've read the widefinder discussion and it is completely > not applicable to this kind of problem I am having. > > widefinder is for disk IO, log related files. I'm talking > variable length control structures extracted on the fly > from the huge volume network stream. I can't "parallelize" > the stream of which I know nothing of except I know > the first byte describes some small excerpt of it. > > In explicit I'm talking this kind of stuff > > < Rest/binary>> = Bin, > > LenLen1 = LenLen * 8, > NameLen1 = NameLen + 1, > > << LengthPay:LenLen1/unsigned-integer, > NameBin:NameLen1/binary, > Payload:LengthPay/binary, > Rest2/binary >> = Rest, > > > Is there any way to put this in one line and preferably > in the function header so as to avoid allocating stuff? > Why arithmetic expressions are not allowed in bit syntax? > > The function returns > > {NameBin, Payload, Rest} > > but it is recursive, doing > extract(Stream)->extract(Rest)->extract(RestOfRest) > until it parses out a complete excerpt which is usually less than 300 > bytes. > > After parsing it, it then it proceeds to extracting another fragment > of data from the stream. > > Is this kind of problem suitable for doing in erlang or should I go > with linked-in C driver? > > > regards, > Mateusz Berezecki I think it will be suitable, a function that looks like this: run(<>, Acc) -> NL = NameLen+1, <> = Rest, run(Rest2, [{NameBin,Payload}|Acc]); run(<<>>, Acc) -> Acc. will generate reasonable code, which does not allocate sub-binaries unnecessarily. The reason that expressions are not allowed in sizes for binary patterns is because that expression must be evaluated in the middle of pattern matching and the compiler is not really ready to allow that, hopefully it will be in the future or it should at least be possible to specify an offset in the same way as the unit is specified. I ran some tests on this function and my old P4 2.4 GHz handles about 800000 entries per second in R11b (1 600 000 with the native flag) for R12b it can handle 1 600 000 (3 000 000 with the native flag) . The results might get a little better before the release of R12 but if this is far too slow for your application you need to write a linked in driver. Per From vychodil.hynek@REDACTED Sat Nov 17 17:24:35 2007 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sat, 17 Nov 2007 17:24:35 +0100 Subject: [erlang-questions] erlang and Kara In-Reply-To: <47319272.2000301@ericsson.com> References: <47319272.2000301@ericsson.com> Message-ID: <4d08db370711170824q15bdeac0qfbe30efd001bfc29@mail.gmail.com> In Czech: chyba, chybka = it's female gender naturally, there is not male bug in czech. On 11/7/07, Ulf Wiger (TN/EAB) wrote: > > I subscribe to press releases from the Swedish Government > (that's a lot of press releases), and one of the most > recent ones was a non-committal promise to work extra > hard to increase the number of women in the IT sector. > The simple reasoning being that, since there's a shortage > of IT expertise, it doesn't make sense to recruit from > (mainly) only half the population. > > Naturally, I thought about the excellent presentation > at the Erlang workshop in Freiburg, where Frank Huch > talked about using Kara and Ladybugs to teach high-school > girls programming. > > Here are the slides, and a paper, which are perhaps not as > fun as the interactive session in Freiburg was: > > http://www.erlang.se/workshop/2007/proceedings/12huch.pdf > http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 > > Quote: > "After three days programming with Kara, we introduce Erlang's > features for concurrent and distributed programming to the pupils, > which usually results in an 'Oh, what a pity!', when telling them > that we do not program with Kara anymore." > > Then, the students go on to implement a chat system. > Recall that these are high-school students with no > previous programming experience. > > > There was a lot of interest at the workshop in seeing > Kara released as an Open Source project. Has anything > happened with that? > > Maybe one could even get a research grant for adopting > Kara to Swedish education...? > > > > I guess we should start learning to say "ladybug" in lots > of different languages: (: > > German : Marienk?fer > Swedish : nyckelpiga > Spanish : mariquita > French : coccinelle > Italian : coccinella > Dutch : Het lieveheersbeestje > Japanese: tentoumushi (*) > > Corrections are welcome (probably also necessary). > > (*) "ladybug" translated on-line to Kanji, then transliterated > on-line to Romanji. At least, this translates back to "ladybug" > in a romanji-to-English on-line translation." > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil From thomasl_erlang@REDACTED Sat Nov 17 20:46:52 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 17 Nov 2007 11:46:52 -0800 (PST) Subject: [erlang-questions] how: Removing atoms from the atom table In-Reply-To: <20071115080638.GA26268@erix.ericsson.se> Message-ID: <876315.97271.qm@web38815.mail.mud.yahoo.com> --- Raimo Niskanen wrote: > To make this happen atoms would have to be reference > counted > and represented quite differently internally, or, > a global atom garbage collect would have to be > implemented, > and it would have to stop all processes while > garbage collecting, or be very complicated and tag > supcious atoms, make several incremental passes, and > when > very sure remove the atom. In other words not > lightweight > and not efficient (much work and small gain). > > But not entirely impossible. I think the lack of garbage collection of atoms makes writing some systems a bit unnatural. In addition to not using list_to_atom/1 with abandon, you also have to avoid certain library functions, be careful about what code you load, etc. (All of these can introduce more of the permanent space leaks we call atoms.) But it should be said that in practice we still seem to be doing okay without such a memory manager. For a proposal somewhat different from what Raimo mentions above, see my workshop paper 'Atom Garbage Collection' at EW 2005. (One should however note that it hasn't been implemented, much less implemented in OTP.) Slides can be found at http://www.erlang.se/workshop/2005/ew05_lindgren_talk.pdf Best, Thomas ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs From anthony.hw.kong@REDACTED Sun Nov 18 07:38:43 2007 From: anthony.hw.kong@REDACTED (Anthony Kong) Date: Sun, 18 Nov 2007 17:38:43 +1100 Subject: [erlang-questions] erlang and Kara In-Reply-To: <4d08db370711170824q15bdeac0qfbe30efd001bfc29@mail.gmail.com> References: <47319272.2000301@ericsson.com> <4d08db370711170824q15bdeac0qfbe30efd001bfc29@mail.gmail.com> Message-ID: In traditional Chinese (Taiwan, Hong Kong): ?? or simply ?? * *(Hope you can read these characters :-) ) Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Sun Nov 18 08:14:07 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Sat, 17 Nov 2007 23:14:07 -0800 Subject: [erlang-questions] Weird function match semantics In-Reply-To: References: Message-ID: On 17 Nov 2007 10:48:14 +0100, Bjorn Gustavsson wrote: > It does seems to be a bug in the evaluator. It works fine in > compiled code. If time permits we will fix it in R12B-0. The problem I discerned is that $X parses to {char,_,88}, while erl_eval only expects lists to have integers; this evaluates fine: (fun([88] ++ _) -> ok end)("X") The patch below fixes this for me, and generalizes handling of ++ in match operations in general. --- lib/stdlib/src/erl_eval.erl.orig 2007-11-17 23:08:50.000000000 -0800 +++ lib/stdlib/src/erl_eval.erl 2007-11-17 23:09:42.000000000 -0800 @@ -980,8 +980,8 @@ throw(nomatch); match1({op,_,'++',{nil,_},R}, Term, Bs, BBs) -> match1(R, Term, Bs, BBs); -match1({op,_,'++',{cons,Li,{integer,L2,I},T},R}, Term, Bs, BBs) -> - match1({cons,Li,{integer,L2,I},{op,Li,'++',T,R}}, Term, Bs, BBs); +match1({op,_,'++',{cons,Li,H,T},R}, Term, Bs, BBs) -> + match1({cons,Li,H,{op,Li,'++',T,R}}, Term, Bs, BBs); match1({op,_,'++',{string,Li,L},R}, Term, Bs, BBs) -> match1(string_to_conses(L, Li, R), Term, Bs, BBs); match1({op,Line,Op,A}, Term, Bs, BBs) -> From ulf@REDACTED Sun Nov 18 10:49:09 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 18 Nov 2007 10:49:09 +0100 Subject: [erlang-questions] erlang and Kara In-Reply-To: References: <47319272.2000301@ericsson.com> <4d08db370711170824q15bdeac0qfbe30efd001bfc29@mail.gmail.com> Message-ID: <8209f740711180149m58f208fah4f26cb2655b81cb9@mail.gmail.com> Well, I can read, but not understand them. (: I found this: ?? = piao2 = dipper / ladle / ?x = chong2 = an animal / an invertebrate / a worm / an insect / ???x = jia3 chong2 = beetle (http://dictionary.kaide.net) I couldn't figure out the trailing numbers, so I found another page where they were spelled out as pi??o, ch??ng, ji??, and http://www.newconceptmandarin.com/support/Intro_Pinyin.asp helped me practice the pronounciation. Pew! BR, Ulf W 2007/11/18, Anthony Kong : > In traditional Chinese (Taiwan, Hong Kong): ???x or simply ???x > > (Hope you can read these characters :-) ) > > Cheers > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kosik@REDACTED Sun Nov 18 11:28:14 2007 From: kosik@REDACTED (Matej Kosik) Date: Sun, 18 Nov 2007 11:28:14 +0100 Subject: [erlang-questions] clarify: order of messages Message-ID: <474013BE.70201@fiit.stuba.sk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, When one process sequentially sends two messages of the same "shape" (for example `Msg1' and `Msg2'), is there some rule enforced concerning the order in which (via same receive pattern) will they be received? Suppose a situation when `Msg2' was delivered before `Msg1' was processed. Can I assume that `Msg1' will be received always before `Msg2' (if I use the same message pattern)? Thank you in advance. - -- Matej Kosik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD4DBQFHQBO9L+CaXfJI/hgRAk3TAJdbdfTwvZWOSI9cNXWYuUX1kn1CAJ0YxNPE fRlrMa828ibfUsbpnFPeiA== =V3nQ -----END PGP SIGNATURE----- From luke@REDACTED Sun Nov 18 12:16:02 2007 From: luke@REDACTED (LUKE) Date: Sun, 18 Nov 2007 19:16:02 +0800 Subject: [erlang-questions] erlang and Kara References: <47319272.2000301@ericsson.com><4d08db370711170824q15bdeac0qfbe30efd001bfc29@mail.gmail.com> <8209f740711180149m58f208fah4f26cb2655b81cb9@mail.gmail.com> Message-ID: <96D206E2557C49E99A4830DCF009573B@lukeserver> meaning: Kara = ???x pronounciation: ??:piao ?x:chong ----- Original Message ----- From: "Ulf Wiger" To: "Anthony Kong" Cc: "EQ" Sent: Sunday, November 18, 2007 5:49 PM Subject: Re: [erlang-questions] erlang and Kara > Well, I can read, but not understand them. (: > > I found this: > > ?? = piao2 = dipper / ladle / > ?x = chong2 = an animal / an invertebrate / a worm / an insect / > ???x = jia3 chong2 = beetle > > (http://dictionary.kaide.net) > > I couldn't figure out the trailing numbers, so I found another > page where they were spelled out as pi??o, ch??ng, ji??, > and http://www.newconceptmandarin.com/support/Intro_Pinyin.asp > helped me practice the pronounciation. > > Pew! > > BR, > Ulf W > > 2007/11/18, Anthony Kong : >> In traditional Chinese (Taiwan, Hong Kong): ???x or simply ???x >> >> (Hope you can read these characters :-) ) >> >> Cheers >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > -------------------------------------------------------------------------------- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > __________ NOD32 2665 (20071117) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.nod32.com.hk > > From headspin@REDACTED Sun Nov 18 12:16:55 2007 From: headspin@REDACTED (dda) Date: Sun, 18 Nov 2007 19:16:55 +0800 Subject: [erlang-questions] erlang and Kara In-Reply-To: <8209f740711180149m58f208fah4f26cb2655b81cb9@mail.gmail.com> References: <47319272.2000301@ericsson.com> <4d08db370711170824q15bdeac0qfbe30efd001bfc29@mail.gmail.com> <8209f740711180149m58f208fah4f26cb2655b81cb9@mail.gmail.com> Message-ID: And, since Anthony is most probably from Hong Kong, for him it'd rather be Cantonese: ? = piu4 ? = cung4 ? = gaap3 -- Didier On Nov 18, 2007 5:49 PM, Ulf Wiger wrote: > Well, I can read, but not understand them. (: > > I found this: > > ? = piao2 = dipper / ladle / > ? = chong2 = an animal / an invertebrate / a worm / an insect / > ?? = jia3 chong2 = beetle > > (http://dictionary.kaide.net) > > I couldn't figure out the trailing numbers, so I found another > page where they were spelled out as pi?o, ch?ng, ji?, > and http://www.newconceptmandarin.com/support/Intro_Pinyin.asp > helped me practice the pronounciation. > > Pew! > > BR, > Ulf W > > 2007/11/18, Anthony Kong : > > In traditional Chinese (Taiwan, Hong Kong): ?? or simply ?? > > > > (Hope you can read these characters :-) ) > > > > Cheers > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From me@REDACTED Sun Nov 18 12:24:13 2007 From: me@REDACTED (KatolaZ) Date: Sun, 18 Nov 2007 12:24:13 +0100 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <474013BE.70201@fiit.stuba.sk> References: <474013BE.70201@fiit.stuba.sk> Message-ID: <20071118112412.GK16989@katolaz.homeunix.net> On Sun, Nov 18, 2007 at 11:28:14AM +0100, Matej Kosik wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello, > > When one process sequentially sends two messages of the same "shape" (for example `Msg1' and > `Msg2'), is there some rule enforced concerning the order in which (via same receive pattern) will > they be received? > > Suppose a situation when `Msg2' was delivered before `Msg1' was processed. > > Can I assume that `Msg1' will be received always before `Msg2' (if I use the same message pattern)? > If both Msg1 and Msg2 are sent (in this order) from the same process to the same process (shape), then you are sure that Msg1 will be "processed" (i.e. extracted from the message queue) before Msg2. HND Enzo -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] From cthulahoops@REDACTED Sun Nov 18 12:36:17 2007 From: cthulahoops@REDACTED (Adam Kelly) Date: Sun, 18 Nov 2007 11:36:17 +0000 Subject: [erlang-questions] erlang and Kara In-Reply-To: References: <47319272.2000301@ericsson.com> Message-ID: <8d1798e90711180336s42436433jc84daba7726d2910@mail.gmail.com> On Nov 7, 2007 5:32 PM, Kip Macy wrote: > On 11/7/07, Sean Hinde wrote: > > > German : Marienk?fer > > > Swedish : nyckelpiga > > > Spanish : mariquita > > > French : coccinelle > > > Italian : coccinella > > > Dutch : Het lieveheersbeestje > > > Japanese: tentoumushi (*) > > In English: Ladybird In Irish: b?in D? (this also looks like it's God's little cow (hence the capital D)) In Greek: ?????????? (paschalitsa) Adam. From harveyd@REDACTED Sun Nov 18 13:39:33 2007 From: harveyd@REDACTED (Dale Harvey) Date: Sun, 18 Nov 2007 12:39:33 +0000 Subject: [erlang-questions] erlounge: London, Hypernumbers (almost an erlounge) Message-ID: During the alpha developers release of hypernumbers we are looking for discussion with developers that are interested in the new platform. On tuesday the 20th(this week) we will be hosting a developers meetup at the erlang training and consulting offices (map here) at 6:30pm. We will do a quick presentation of the work so far, then it will be open discussion on what developers would expect from the platform, and applications they would like to write using it. Afterwards Im sure a few people will be along for a few drinks and more discussion. If you are interested in attending, give Gordon a quick email at gordon@REDACTED, and this is an open invitation so invite anyone who might be interested, its not erlang specific so if you are into any flavour of development come along. http://www.erlang.se/euc/07/ has more information on hypernumbers in the presentation Developing RESTful Platforms With Erlang And Adobe Flex. Thanks Dale P.S the erlounge tags seemed most appropriate, even though im not certain if this 'is' an erlounge -- * http://hypernumbers.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From oneone@REDACTED Sun Nov 18 17:21:42 2007 From: oneone@REDACTED (Andrew Arrow) Date: Sun, 18 Nov 2007 08:21:42 -0800 Subject: [erlang-questions] breadth first search Message-ID: Does anyone have an example of a distributed breadth-first-search algorithm in Erlang? If you had a large graph in ETS on 10 different machines and wanted to quickly find the path from one node on the graph to another. Thanks. From pfisher@REDACTED Sun Nov 18 17:41:10 2007 From: pfisher@REDACTED (Paul Fisher) Date: Sun, 18 Nov 2007 10:41:10 -0600 Subject: [erlang-questions] inet_drv.c and packet type extensibility Message-ID: <1195404070.5891.7.camel@pfisher-laptop> Currently it appears that adding new packet types, in the way HTTP is supported, involves adding code directly to tcp_reply_data()/tcp_reply_binary_data(). Is there any plan/desire to have a level of extensibility in order to facilitate additional packet driver implementations? (BTW, my interest is in adding BEEP support.) Or maybe at this point there is very little to gain in having this level of protocol handling in the driver, and new such implementations are just as well served implemented directly in erlang? Guidance would be appreciated. -- paul From dking@REDACTED Sun Nov 18 19:50:06 2007 From: dking@REDACTED (David King) Date: Sun, 18 Nov 2007 10:50:06 -0800 Subject: [erlang-questions] erlang and Kara In-Reply-To: <8209f740711180149m58f208fah4f26cb2655b81cb9@mail.gmail.com> References: <47319272.2000301@ericsson.com> <4d08db370711170824q15bdeac0qfbe30efd001bfc29@mail.gmail.com> <8209f740711180149m58f208fah4f26cb2655b81cb9@mail.gmail.com> Message-ID: <4C02D87A-35AE-453D-A23D-AE28EEA2FC41@ketralnis.com> > I couldn't figure out the trailing numbers, so I found another > page where they were spelled out as pi?o, ch?ng, ji?, > and http://www.newconceptmandarin.com/support/Intro_Pinyin.asp > helped me practice the pronounciation. They are tone numbers. http://www.wku.edu/~shizhen.gao/Chinese101/ pinyin/tones.htm On the site you link, "first tone" corresponds to a trailing 1 on the syllable. > > Pew! > > BR, > Ulf W > > 2007/11/18, Anthony Kong : >> In traditional Chinese (Taiwan, Hong Kong): ?? or simply ?? >> >> (Hope you can read these characters :-) ) >> >> Cheers >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From exta7@REDACTED Sun Nov 18 19:55:35 2007 From: exta7@REDACTED (Zvi) Date: Sun, 18 Nov 2007 10:55:35 -0800 (PST) Subject: [erlang-questions] clarify: order of messages In-Reply-To: <20071118112412.GK16989@katolaz.homeunix.net> References: <474013BE.70201@fiit.stuba.sk> <20071118112412.GK16989@katolaz.homeunix.net> Message-ID: <13822276.post@talk.nabble.com> Same processes on the same node? Will be this a case when processes are on different nodes? Zvi KatolaZ wrote: > > On Sun, Nov 18, 2007 at 11:28:14AM +0100, Matej Kosik wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Hello, >> >> When one process sequentially sends two messages of the same "shape" (for >> example `Msg1' and >> `Msg2'), is there some rule enforced concerning the order in which (via >> same receive pattern) will >> they be received? >> >> Suppose a situation when `Msg2' was delivered before `Msg1' was >> processed. >> >> Can I assume that `Msg1' will be received always before `Msg2' (if I use >> the same message pattern)? >> > > If both Msg1 and Msg2 are sent (in this order) from the same process > to the same process (shape), then you are sure that Msg1 will be > "processed" (i.e. extracted from the message queue) before Msg2. > > HND > > Enzo > > -- > [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] > [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] > [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] > [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/clarify%3A-order-of-messages-tf4829783.html#a13822276 Sent from the Erlang Questions mailing list archive at Nabble.com. From me@REDACTED Sun Nov 18 20:05:32 2007 From: me@REDACTED (KatolaZ) Date: Sun, 18 Nov 2007 20:05:32 +0100 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <13822276.post@talk.nabble.com> References: <474013BE.70201@fiit.stuba.sk> <20071118112412.GK16989@katolaz.homeunix.net> <13822276.post@talk.nabble.com> Message-ID: <20071118190532.GR16989@katolaz.homeunix.net> On Sun, Nov 18, 2007 at 10:55:35AM -0800, Zvi wrote: > > Same processes on the same node? > Will be this a case when processes are on different nodes? > If the same process (only one) sends two messages one after the other (Msg1 and Ms2, respectively) to another process, then those two messages are going to be received in the same order as they have been sent, i.e. Msg1 first and then Msg2. And this does not depend on the fact that the two processes are running on different nodes (since I'm quite sure that message passing among remote nodes is handled using TCP sockets, so the *order* of transmission should be preserved...) Or, at least, I hope it works so ;-) HND Enzo -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] From kosik@REDACTED Sun Nov 18 21:22:50 2007 From: kosik@REDACTED (Matej Kosik) Date: Sun, 18 Nov 2007 21:22:50 +0100 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <20071118190532.GR16989@katolaz.homeunix.net> References: <474013BE.70201@fiit.stuba.sk> <20071118112412.GK16989@katolaz.homeunix.net> <13822276.post@talk.nabble.com> <20071118190532.GR16989@katolaz.homeunix.net> Message-ID: <47409F1A.6040008@fiit.stuba.sk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 KatolaZ wrote: > On Sun, Nov 18, 2007 at 10:55:35AM -0800, Zvi wrote: >> Same processes on the same node? >> Will be this a case when processes are on different nodes? >> > > If the same process (only one) sends two messages one after the other > (Msg1 and Ms2, respectively) to another process, then those two > messages are going to be received in the same order as they have been > sent, i.e. Msg1 first and then Msg2. And this does not depend on the > fact that the two processes are running on different nodes (since I'm > quite sure that message passing among remote nodes is handled using > TCP sockets, so the *order* of transmission should be preserved...) > > Or, at least, I hope it works so ;-) I hope (but I am not sure) so too. My problems arise from the fact that I did not studied internals of Erlang VM (or I did not studied Erlang formal semantis---I am not sure if there is something like that). In a system I am in charge to write I have observed an anomaly. In this case, there were at least three processes. - - server S - - client C1 - - client C2 The client C1 sends messages to server S "intensively". The client C2 sends messages to server S occassionally. It is desirable that messages from C2 will be handled (in a finite time). But I have observed the opossite situation. As if the virtual machine did not guaranteed the fairness. Only messages from C1 were received by S. Is something like that possible? (to avoid this situation, I had to decrease the intensity by which client C1 sends messages to server S. Weird.). > > HND > > Enzo > - -- Matej Kosik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHQJ8aL+CaXfJI/hgRAuxdAJ9NBs/jCJDcrPB6pW6DEX+l7LUOQgCgg7u8 NAsPd9pNZ6OWMvCw9kufOjo= =Zuq+ -----END PGP SIGNATURE----- From gbulmer@REDACTED Sun Nov 18 21:42:19 2007 From: gbulmer@REDACTED (G Bulmer) Date: Sun, 18 Nov 2007 20:42:19 +0000 Subject: [erlang-questions] beginner: Help needed - Erts overview and map to subsystem to source Message-ID: Can someone point me at any documents which describes the internal architecture of erts? Ideally it would help me navigate the code too. For example is there a document which gives an overview of erts subsystems? (ideally also a "table of contents" mapping the subsystems to the files which contain the corresponding code, but if the names are consistent, I can use grep.) While I don't have time right now to work on Erlang DTrace, I think I'd like to do some preparation by familiarising myself with the erts source. I guess I need to find the code for the garbage collector, erts function tracing (which I would try to use for the DTrace function call probes), the scheduler, and the module loader/unloader. I'll also need to discover approximately how they work !-) I've dug around, and have only spotted: http://www.erlang.org/doc/pdf/system_architecture_intro.pdf and erts.pdf which don't seem to cover the the areas I think I need. A pointer would be appreciated. G Bulmer From francesco@REDACTED Sun Nov 18 22:15:33 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Sun, 18 Nov 2007 21:15:33 +0000 Subject: [erlang-questions] Erlang Trainer fluent in Japanese? Message-ID: <4740AB75.9070404@erlang-consulting.com> Hi All, If you or someone you know is capable of teaching Erlang/OTP courses in Japanese, please drop me a line. (12 nationalities are represented at ETC, but Japanese is not one of them....).We would prefer if the person had a few years practical experience, but as almost no one on the client site speaks English, any little helps. Many Thanks, Francesco -- http://www.erlang-consulting.com From igouy2@REDACTED Sun Nov 18 21:59:24 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Sun, 18 Nov 2007 12:59:24 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) Message-ID: <815249.27396.qm@web60513.mail.yahoo.com> On 2007-09-3 Bengt Kleberg wrote: > my main problem with the alioth shootout is that it has thrown away > one of the main ideas/insights from the paper(*) that was the > inspiration for the original shootout. namely that it is very > important to look at how the timeing changes with the size of the > input. the alioth shootout takes only 3 very similar size values. > to make things worse these 3 values must give results for the major > languages (no timeout, etc). > (*)Timing Trials, or, the Trials of Timing, > http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html) > > On 2007-08-31 20:54, Michael Campbell wrote: -snip- > > Be careful with that. Alioth's shootouts are for how quickly a > > language can run a particular *algorithm*, which can at times be > > VERY DIFFERENT from how you would normally do it in that language. > > > > So some of the code on that will be weirdly contorted to fit the > > particular algorithm, rather than what the prevailing idiom is for > > that language. > > > > A somewhat more harsh criticism can be found here: > > http://yarivsblog.com/articles/2006/07/11/erlang-yaws-vs-ruby-on-rails/#comment-70 My apologies for digging up this 2 month old comment, but sometimes I'm just taken-aback by criticism of the benchmarks game. I'm well aware of my limitations and value informed criticism - to a great extent we rely on others to notice our mistakes and suggest improvements and alternatives. Sometimes the criticism misleads - I never know if that's the intention. According to Bengt Kleberg "the alioth shootout takes only 3 very similar size values" which "has thrown away one of the main ideas/insights" of 'Timing Trials, or, the Trials of Timing'. Can you guess how many different input sizes were used for "Timing Trials, or, the Trials of Timing"? Do you guess 20? Do you guess 10? No. The comparisons in "Timing Trials, or, the Trials of Timing" were based on just 4 input values! The Benchmarks Game has slipped from the insightful 4 to the miserable 3 :-) As for "very similiar size values" the timing range for different input values is ~10x to ~100x, in comparison to mostly < 10x in "Timing Trials, or, the Trials of Timing". Michael Campbell points to Yariv's Blog, and I guess to Austin Ziegler's comment. The specific problem he raises - "... must be set at the user?s shell [ulimit]. They do not do this and report that the Ruby program doesn?t run" - was raised a year earlier on the Ruby mailing-list. That problem was fixed by November 2005, 9 months before Austin Ziegler ranted on Yariv's Blog - his repeated "harsh criticism" had been untrue for 9 months and by then the ackermann benchmark he complains about had been replaced. Rather than a general warning about wierdly contorted code, wouldn't it be more helpful to say which of the Erlang programs you think are wierdly contorted? ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs From bjorn@REDACTED Mon Nov 19 08:23:48 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 19 Nov 2007 08:23:48 +0100 Subject: [erlang-questions] beginner: Help needed - Erts overview and map to subsystem to source In-Reply-To: References: Message-ID: G Bulmer writes: > Can someone point me at any documents which describes the internal > architecture of erts? Ideally it would help me navigate the code too. > > For example is there a document which gives an overview of erts > subsystems? (ideally also a "table of contents" mapping the > subsystems to the files which contain the corresponding code, but if > the names are consistent, I can use grep.) As far as I know, there are no such documents. (Though some architectual overviews can be found in some the papers from the HiPE group.) > I guess I need to find the code for the garbage collector, erts > function tracing (which I would try to use for the DTrace function > call probes), the scheduler, and the module loader/unloader. I'll > also need to discover approximately how they work !-) Very brief overview: The garbage collector is in erl_gc.c in R12B (ggc.c in R11B; that file is gone in R12B). (Local) call trace works by replacing the first instruction in function with a breakpoint instruction. The breakpoint instruction is called "call_traced_function" in beam_emu.c. Most of the other code for tracing is in erl_trace.c and erl_bif_trace.c. (beam_emu.c contains the virtual machine for BEAM.) The scheduler is in the function schedule() in erl_process.c. The loader is in beam_bif_load.c (the loader BIFs) and beam_load.c (the bulk of the code). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From adam@REDACTED Mon Nov 19 09:07:33 2007 From: adam@REDACTED (Adam Lindberg) Date: Mon, 19 Nov 2007 09:07:33 +0100 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <47409F1A.6040008@fiit.stuba.sk> References: <474013BE.70201@fiit.stuba.sk> <20071118112412.GK16989@katolaz.homeunix.net> <13822276.post@talk.nabble.com> <20071118190532.GR16989@katolaz.homeunix.net> <47409F1A.6040008@fiit.stuba.sk> Message-ID: <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> A basic check to do is to look at your receive statement. If it for example looks like this: receive {c1, Msg} -> do_c1_stuff(); {c2, Msg} -> do_c2_stuff() end In this case if there are always some messages from C1 in the message queue they will be picked first, regardless of the order. This is called selective receive. If you want to take the messages as they come you should do something like this: receive {Sender, Msg} -> case Sender of c1 -> do_c1_stuff(); c2 -> do_c2_stuff() end end This way you will always pick a message, the first one to be in queue (which matches pattern {A, B} of course) and _then_ look at the sender. Hope that helps. Here are some useful slides: http://www.duomark.com/erlang/briefings/euc2006/index.html Cheers! Adam On Nov 18, 2007 9:22 PM, Matej Kosik wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > KatolaZ wrote: > > On Sun, Nov 18, 2007 at 10:55:35AM -0800, Zvi wrote: > >> Same processes on the same node? > >> Will be this a case when processes are on different nodes? > >> > > > > If the same process (only one) sends two messages one after the other > > (Msg1 and Ms2, respectively) to another process, then those two > > messages are going to be received in the same order as they have been > > sent, i.e. Msg1 first and then Msg2. And this does not depend on the > > fact that the two processes are running on different nodes (since I'm > > quite sure that message passing among remote nodes is handled using > > TCP sockets, so the *order* of transmission should be preserved...) > > > > Or, at least, I hope it works so ;-) > > I hope (but I am not sure) so too. My problems arise from the fact that I > did not studied internals > of Erlang VM (or I did not studied Erlang formal semantis---I am not sure > if there is something like > that). > > In a system I am in charge to write I have observed an anomaly. In this > case, there were at least > three processes. > - - server S > - - client C1 > - - client C2 > > The client C1 sends messages to server S "intensively". The client C2 > sends messages to server S > occassionally. It is desirable that messages from C2 will be handled (in a > finite time). But I have > observed the opossite situation. As if the virtual machine did not > guaranteed the fairness. Only > messages from C1 were received by S. Is something like that possible? > > (to avoid this situation, I had to decrease the intensity by which client > C1 sends messages to > server S. Weird.). > > > > > HND > > > > Enzo > > > > > - -- > Matej Kosik > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFHQJ8aL+CaXfJI/hgRAuxdAJ9NBs/jCJDcrPB6pW6DEX+l7LUOQgCgg7u8 > NAsPd9pNZ6OWMvCw9kufOjo= > =Zuq+ > -----END PGP SIGNATURE----- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger.larsson@REDACTED Mon Nov 19 09:32:28 2007 From: roger.larsson@REDACTED (Roger Larsson) Date: Mon, 19 Nov 2007 09:32:28 +0100 Subject: [erlang-questions] Semantic change of receive statement? (Re: clarify: order of messages) In-Reply-To: <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> References: <474013BE.70201@fiit.stuba.sk> <47409F1A.6040008@fiit.stuba.sk> <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> Message-ID: <200711190932.29287.roger.larsson@norran.net> Are you sure or are you guessing? Have there been a change in semantics? From "Concurrent Programming in ERLANG" Joe Armstrong, Robert Virding, Mike Williams page 16 "receive is selective, that is to say, it takes the first message which matches one of the message patterns from a queue of messages waiting for the attention of the receiving process" /RogerL On m?ndag 19 november 2007, Adam Lindberg wrote: > A basic check to do is to look at your receive statement. > > If it for example looks like this: > > receive > {c1, Msg} -> > do_c1_stuff(); > {c2, Msg} -> > do_c2_stuff() > end > > In this case if there are always some messages from C1 in the message queue > they will be picked first, regardless of the order. This is called > selective receive. If you want to take the messages as they come you should > do something like this: > > receive > {Sender, Msg} -> > case Sender of > c1 -> > do_c1_stuff(); > c2 -> > do_c2_stuff() > end > end > > This way you will always pick a message, the first one to be in queue > (which matches pattern {A, B} of course) and _then_ look at the sender. > > Hope that helps. Here are some useful slides: > http://www.duomark.com/erlang/briefings/euc2006/index.html > > Cheers! > Adam > > On Nov 18, 2007 9:22 PM, Matej Kosik wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > KatolaZ wrote: > > > On Sun, Nov 18, 2007 at 10:55:35AM -0800, Zvi wrote: > > >> Same processes on the same node? > > >> Will be this a case when processes are on different nodes? > > > > > > If the same process (only one) sends two messages one after the other > > > (Msg1 and Ms2, respectively) to another process, then those two > > > messages are going to be received in the same order as they have been > > > sent, i.e. Msg1 first and then Msg2. And this does not depend on the > > > fact that the two processes are running on different nodes (since I'm > > > quite sure that message passing among remote nodes is handled using > > > TCP sockets, so the *order* of transmission should be preserved...) > > > > > > Or, at least, I hope it works so ;-) > > > > I hope (but I am not sure) so too. My problems arise from the fact that I > > did not studied internals > > of Erlang VM (or I did not studied Erlang formal semantis---I am not sure > > if there is something like > > that). > > > > In a system I am in charge to write I have observed an anomaly. In this > > case, there were at least > > three processes. > > - - server S > > - - client C1 > > - - client C2 > > > > The client C1 sends messages to server S "intensively". The client C2 > > sends messages to server S > > occassionally. It is desirable that messages from C2 will be handled (in > > a finite time). But I have > > observed the opossite situation. As if the virtual machine did not > > guaranteed the fairness. Only > > messages from C1 were received by S. Is something like that possible? > > > > (to avoid this situation, I had to decrease the intensity by which client > > C1 sends messages to > > server S. Weird.). > > > > > HND > > > > > > Enzo > > > > - -- > > Matej Kosik > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.6 (GNU/Linux) > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > iD8DBQFHQJ8aL+CaXfJI/hgRAuxdAJ9NBs/jCJDcrPB6pW6DEX+l7LUOQgCgg7u8 > > NAsPd9pNZ6OWMvCw9kufOjo= > > =Zuq+ > > -----END PGP SIGNATURE----- > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions From andreas.hillqvist@REDACTED Mon Nov 19 09:50:00 2007 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Mon, 19 Nov 2007 09:50:00 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: <473DEEDE.1030409@lionet.info> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> <8268eea30711150631q45d1e422j2def141c62020544@mail.gmail.com> <473C5FAB.8030706@lionet.info> <8268eea30711160048j26231259r432df52c6a8d6c2@mail.gmail.com> <473DEEDE.1030409@lionet.info> Message-ID: <8268eea30711190050jb4221d7i5ccfdc55b69e24a6@mail.gmail.com> So the shortest step from the syntax in todays Erlang, would be to separate by convention instead of syntax. I.e. doc() and fun_doc() or doc_fun(). Is a proposed in my answer. I tried to address this problem was in my first answer by proposing an new prefix. With another prefix we get clear distinction between module- and function-level meta data. But this raised the question: Should the meta data syntax be consistent, independent of level? An alternativ would be to use the module meta declaration: -doc("Math module with some fancy math functions."). -keywords([math, fancy, factorial]). -export([fac/1]. -module(test). -fun(doc, "The factorial function."). -fun(keywords, [math]). fac(0) -> 1; fac(N) -> N*fac(N-1) But with this behaviour, I do not consider the module meta declaration to be meta anymore. Module is now part of the syntax. Should we introduce a module declaration to the Erlang syntax? So the "real" question is: how do we separate module-level meta data from function-level meta data? * By convention: % Module-level: -doc("text"). %Function-level: -fun_doc("text"). %or -doc_fun("text"). * By prefix: % Module-level: -doc("text"). % Function-level: --fun_doc("text"). % or +doc_fun("text"). % or something else * By module declaration: % Module-level: -doc("text"). -module(my_module). % or module{my_module}. % or something else % Function-level: -doc("text"). To illustrate some of the possibilities to separate. I believe the most likely to be implemented is "By convention". Because it dose not affect old code and dose not introduce anything new to the syntax. A new module declaration is the least likely to be implemented. New prefix simplifies the implementation of function-level meta, my guess to why Joe choose the +prefix to illustrate an implementation. Pleas feel free to suggest other ways to address this issue. Regards Andreas Hillqvist 2007/11/16, Lev Walkin : > > > I think there's is a problem with attributing metadata to > module or to function. In your example, consider the > first -doc() to be absent. What makes the second -doc() > be bound to function? The extra line directly above it > certainly makes it so for humans, but it shouldn't be > relied upon formally. > > Perhaps (I live motivation outside this email), something like this? > > -module(test). > -doc("Math module with some fancy math functions."). > -keywords([math, fancy, factorial]). > -export([fac/1]. > > -fun(doc, "The factorial function."). > -fun(keywords, [math]). > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > > Andreas Hillqvist wrote: > > You make a good point. > > > > So would this look like: > > -module(test). > > -doc("Math module with some fancy math functions."). > > -keywords([math, fancy, factorial]). > > -export([fac/1]. > > > > -doc("The factorial function, for they day you will need it."). > > -keywords([math]). > > fac(0) -> 1; > > fac(N) -> N*fac(N-1) > > > > I believe Erlang supports multiple occurrences, example a hlr is > > expanded by the pre-parser to: > > -file("/xxx/yyy/zzz.hrl", 1). > > -hrl_id(aaa). > > -hrl_vsn(bbb). > > -hrl_date(ccc). > > -hrl_author(ddd). > > > > foo() -> bar. > > > > Where hlr headers seems to be prefixed with hlr. So to differentiate > > module level headers from function level we may use the "fun_" prefix > > on atoms: > > -module(test). > > -doc("Math module with some fancy math functions."). > > -keywords([math, fancy, factorial]). > > -export([fac/1]. > > > > -fun_doc("The factorial function, for they day you will need it."). > > -fun_keywords([math]). > > fac(0) -> 1; > > fac(N) -> N*fac(N-1) > > > > > > Just my ideas/suggestions, pleas feel free to criticize. > > ;-) > > > > > > Regards > > Andreas Hillqvist > > > > 2007/11/15, Lev Walkin : > >> One of the most peculiar problems people have with certain languages > >> (Objective-C) is that punctuation and non-alphabetical characters > >> are overloaded beyond all reason. +module, -interface, @end, etc. > >> > >> We risk ending up with something like > >> > >> -module(test). > >> +module(test). > >> @module(test). > >> > >> where module is a keyword in one place and atom in another. Having > >> more or less uniform "-()." is arguably more > >> self-consistent and removes unnecessary learning curve. > >> > >> Just 2c. > >> > >> Andreas Hillqvist wrote: > >>> I like the Idea of function meta data. > >>> > >>> But it might be better/simpler/easier/harder to use an alternativ > >>> prefix, like double -- (Similar to %, %% and %%%). > >>> > >>> Why not use the name atom instead of meta? > >>> To me meta dose not contribute with value to the syntax. > >>> > >>> Would look like: > >>> > >>> -module(test). > >>> -export([fac/1]. > >>> > >>> --doc("the factorial function"). > >>> --type("int -> int"). > >>> --keywords([math]). > >>> fac(0) -> 1; > >>> fac(N) -> N*fac(N-1) > >>> > >>> Or some other prefix like "+"(Just an example, Do not like + myself. > >>> To much alike the udiff format. ;-)? > >>> -module(test). > >>> -export([fac/1]. > >>> > >>> +doc("the factorial function"). > >>> +type("int -> int"). > >>> +keywords([math]). > >>> > >>> fac(0) -> 1; > >>> fac(N) -> N*fac(N-1) > >>> > >>> > >>> Regards > >>> Andreas Hillqvist > >>> > >>> 2007/11/15, Joe Armstrong : > >>>> Module have metadata Mod:module_info(export) etc. > >>>> > >>>> But functions do not. > >>>> > >>>> idea - attach function meta data with a new attribute. > >>>> > >>>> -meta(doc, "the factorial function"). > >>>> -meta(type, "int -> int"). > >>>> -meta(keywords, [math]). > >>>> > >>>> fac(0) -> 1; > >>>> fac(N) -> N*fac(N-1) > >>>> > >>>> The meta data gets *attached* to the Next function in the module > >>>> > >>>> -meta(process, true). > >>>> foo() -> spawn(fun() -> ... end) > >>>> > >>>> After compilation meta data can be access as follows: > >>>> > >>>> Mod:meta_data(fac, 1, doc) => "the factorial function" > >>>> ... > >>>> Mod:meta_data(fac, 1, glurk) => '$nothing' > >>>> > >>>> if we then *standardise* the meta data it will be easy to make loads > >>>> of nice tools for type checking, documentation etc. > >>>> > >>>> I'm off on a trip today - so can somebody hack the preprocess and > >>>> parser to do this? (( this needs a small change > >>>> attributes have a different syntax and must be at *before* all functions)) > >>>> > >>>> This adds introspection to the language ! > >>>> > >>>> /Joe Armstrong > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://www.erlang.org/mailman/listinfo/erlang-questions > >>>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > From erlang@REDACTED Mon Nov 19 09:50:39 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 19 Nov 2007 09:50:39 +0100 Subject: [erlang-questions] idea: function meta data In-Reply-To: <473DEEDE.1030409@lionet.info> References: <9b08084c0711150248m66af78cftda65ba6acdd7af22@mail.gmail.com> <8268eea30711150631q45d1e422j2def141c62020544@mail.gmail.com> <473C5FAB.8030706@lionet.info> <8268eea30711160048j26231259r432df52c6a8d6c2@mail.gmail.com> <473DEEDE.1030409@lionet.info> Message-ID: <9b08084c0711190050sb78c744i1e7f6a48f57e54a3@mail.gmail.com> -doc(...) => a module attribute +doc(...) a function attribute :-) /Joe On Nov 16, 2007 8:26 PM, Lev Walkin wrote: > > > I think there's is a problem with attributing metadata to > module or to function. In your example, consider the > first -doc() to be absent. What makes the second -doc() > be bound to function? The extra line directly above it > certainly makes it so for humans, but it shouldn't be > relied upon formally. > > Perhaps (I live motivation outside this email), something like this? > > -module(test). > -doc("Math module with some fancy math functions."). > -keywords([math, fancy, factorial]). > -export([fac/1]. > > -fun(doc, "The factorial function."). > -fun(keywords, [math]). > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > > > Andreas Hillqvist wrote: > > You make a good point. > > > > So would this look like: > > -module(test). > > -doc("Math module with some fancy math functions."). > > -keywords([math, fancy, factorial]). > > -export([fac/1]. > > > > -doc("The factorial function, for they day you will need it."). > > -keywords([math]). > > fac(0) -> 1; > > fac(N) -> N*fac(N-1) > > > > I believe Erlang supports multiple occurrences, example a hlr is > > expanded by the pre-parser to: > > -file("/xxx/yyy/zzz.hrl", 1). > > -hrl_id(aaa). > > -hrl_vsn(bbb). > > -hrl_date(ccc). > > -hrl_author(ddd). > > > > foo() -> bar. > > > > Where hlr headers seems to be prefixed with hlr. So to differentiate > > module level headers from function level we may use the "fun_" prefix > > on atoms: > > -module(test). > > -doc("Math module with some fancy math functions."). > > -keywords([math, fancy, factorial]). > > -export([fac/1]. > > > > -fun_doc("The factorial function, for they day you will need it."). > > -fun_keywords([math]). > > fac(0) -> 1; > > fac(N) -> N*fac(N-1) > > > > > > Just my ideas/suggestions, pleas feel free to criticize. > > ;-) > > > > > > Regards > > Andreas Hillqvist > > > > 2007/11/15, Lev Walkin : > >> One of the most peculiar problems people have with certain languages > >> (Objective-C) is that punctuation and non-alphabetical characters > >> are overloaded beyond all reason. +module, -interface, @end, etc. > >> > >> We risk ending up with something like > >> > >> -module(test). > >> +module(test). > >> @module(test). > >> > >> where module is a keyword in one place and atom in another. Having > >> more or less uniform "-()." is arguably more > >> self-consistent and removes unnecessary learning curve. > >> > >> Just 2c. > >> > >> Andreas Hillqvist wrote: > >>> I like the Idea of function meta data. > >>> > >>> But it might be better/simpler/easier/harder to use an alternativ > >>> prefix, like double -- (Similar to %, %% and %%%). > >>> > >>> Why not use the name atom instead of meta? > >>> To me meta dose not contribute with value to the syntax. > >>> > >>> Would look like: > >>> > >>> -module(test). > >>> -export([fac/1]. > >>> > >>> --doc("the factorial function"). > >>> --type("int -> int"). > >>> --keywords([math]). > >>> fac(0) -> 1; > >>> fac(N) -> N*fac(N-1) > >>> > >>> Or some other prefix like "+"(Just an example, Do not like + myself. > >>> To much alike the udiff format. ;-)? > >>> -module(test). > >>> -export([fac/1]. > >>> > >>> +doc("the factorial function"). > >>> +type("int -> int"). > >>> +keywords([math]). > >>> > >>> fac(0) -> 1; > >>> fac(N) -> N*fac(N-1) > >>> > >>> > >>> Regards > >>> Andreas Hillqvist > >>> > >>> 2007/11/15, Joe Armstrong : > >>>> Module have metadata Mod:module_info(export) etc. > >>>> > >>>> But functions do not. > >>>> > >>>> idea - attach function meta data with a new attribute. > >>>> > >>>> -meta(doc, "the factorial function"). > >>>> -meta(type, "int -> int"). > >>>> -meta(keywords, [math]). > >>>> > >>>> fac(0) -> 1; > >>>> fac(N) -> N*fac(N-1) > >>>> > >>>> The meta data gets *attached* to the Next function in the module > >>>> > >>>> -meta(process, true). > >>>> foo() -> spawn(fun() -> ... end) > >>>> > >>>> After compilation meta data can be access as follows: > >>>> > >>>> Mod:meta_data(fac, 1, doc) => "the factorial function" > >>>> ... > >>>> Mod:meta_data(fac, 1, glurk) => '$nothing' > >>>> > >>>> if we then *standardise* the meta data it will be easy to make loads > >>>> of nice tools for type checking, documentation etc. > >>>> > >>>> I'm off on a trip today - so can somebody hack the preprocess and > >>>> parser to do this? (( this needs a small change > >>>> attributes have a different syntax and must be at *before* all functions)) > >>>> > >>>> This adds introspection to the language ! > >>>> > >>>> /Joe Armstrong > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://www.erlang.org/mailman/listinfo/erlang-questions > >>>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > From andreas.hillqvist@REDACTED Mon Nov 19 10:55:34 2007 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Mon, 19 Nov 2007 10:55:34 +0100 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> References: <474013BE.70201@fiit.stuba.sk> <20071118112412.GK16989@katolaz.homeunix.net> <13822276.post@talk.nabble.com> <20071118190532.GR16989@katolaz.homeunix.net> <47409F1A.6040008@fiit.stuba.sk> <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> Message-ID: <8268eea30711190155u162dcbb3xb8bf70b8d0dbf411@mail.gmail.com> If you want to accomplish what you describe, Adam. You would have to write it like: loop() -> receive {c1, Msg} -> do_c1_stuff() after 0 -> receive {c2, Msg} -> do_c2_stuff(); {c1, Msg} -> do_c1_stuff(); _ -> ok end, loop(). First receive statement will check the whole process message-box, if necessary, to find a message from c1. If there are no messages from c1 or the process message-box is empty. The next receive statement will look for any c2 messages. If there are no messages from c1, c2 or the message-box is empty it will now block until a message is received. So this loop will prioritize messages received from c1. But with out warranty. If the message-box is flooded you will get a performance penalty. So you will probably need some sort of flood control. Regards Andreas Hillqvist 2007/11/19, Adam Lindberg : > A basic check to do is to look at your receive statement. > > If it for example looks like this: > > receive > {c1, Msg} -> > do_c1_stuff(); > {c2, Msg} -> > do_c2_stuff() > end > > In this case if there are always some messages from C1 in the message queue > they will be picked first, regardless of the order. This is called selective > receive. If you want to take the messages as they come you should do > something like this: > > receive > {Sender, Msg} -> > case Sender of > c1 -> > do_c1_stuff(); > c2 -> > do_c2_stuff() > end > end > > This way you will always pick a message, the first one to be in queue (which > matches pattern {A, B} of course) and _then_ look at the sender. > > Hope that helps. Here are some useful slides: > http://www.duomark.com/erlang/briefings/euc2006/index.html > > Cheers! > Adam > > > On Nov 18, 2007 9:22 PM, Matej Kosik wrote: > > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > > > KatolaZ wrote: > > > On Sun, Nov 18, 2007 at 10:55:35AM -0800, Zvi wrote: > > >> Same processes on the same node? > > >> Will be this a case when processes are on different nodes? > > >> > > > > > > If the same process (only one) sends two messages one after the other > > > (Msg1 and Ms2, respectively) to another process, then those two > > > messages are going to be received in the same order as they have been > > > sent, i.e. Msg1 first and then Msg2. And this does not depend on the > > > fact that the two processes are running on different nodes (since I'm > > > quite sure that message passing among remote nodes is handled using > > > TCP sockets, so the *order* of transmission should be preserved...) > > > > > > Or, at least, I hope it works so ;-) > > > > I hope (but I am not sure) so too. My problems arise from the fact that I > did not studied internals > > of Erlang VM (or I did not studied Erlang formal semantis---I am not sure > if there is something like > > that). > > > > In a system I am in charge to write I have observed an anomaly. In this > case, there were at least > > three processes. > > - - server S > > - - client C1 > > - - client C2 > > > > The client C1 sends messages to server S "intensively". The client C2 > sends messages to server S > > occassionally. It is desirable that messages from C2 will be handled (in a > finite time). But I have > > observed the opossite situation. As if the virtual machine did not > guaranteed the fairness. Only > > messages from C1 were received by S. Is something like that possible? > > > > (to avoid this situation, I had to decrease the intensity by which client > C1 sends messages to > > server S. Weird.). > > > > > > > > HND > > > > > > Enzo > > > > > > > > > > > - -- > > Matej Kosik > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.6 (GNU/Linux) > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > > iD8DBQFHQJ8aL+CaXfJI/hgRAuxdAJ9NBs/jCJDcrPB6pW6DEX+l7LUOQgCgg7u8 > > NAsPd9pNZ6OWMvCw9kufOjo= > > =Zuq+ > > -----END PGP SIGNATURE----- > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From psa@REDACTED Mon Nov 19 11:10:33 2007 From: psa@REDACTED (=?UTF-8?B?UGF1bG8gU8OpcmdpbyBBbG1laWRh?=) Date: Mon, 19 Nov 2007 10:10:33 +0000 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> References: <474013BE.70201@fiit.stuba.sk><20071118112412.GK16989@katolaz.ho meunix.net><13822276.post@talk.nabble.com><20071118190532.GR16989@katolaz.h omeunix.net><47409F1A.6040008@fiit.stuba.sk> <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> Message-ID: <47416119.5080405@di.uminho.pt> Hi, Adam Lindberg wrote: > A basic check to do is to look at your receive statement. > > If it for example looks like this: > > receive > {c1, Msg} -> > do_c1_stuff(); > {c2, Msg} -> > do_c2_stuff() > end > > In this case if there are always some messages from C1 in the message > queue they will be picked first, regardless of the order. This is called This is not true. Messages are looked at in arrival order, and for each message the guards are matched in program order. If the only messages in the mailbox are either {c1, Msg} or {c2, Msg} the above behaves the same as the code below. > selective receive. If you want to take the messages as they come you > should do something like this: > > receive > {Sender, Msg} -> > case Sender of > c1 -> > do_c1_stuff(); > c2 -> > do_c2_stuff() > end > end > > This way you will always pick a message, the first one to be in queue > (which matches pattern {A, B} of course) and _then_ look at the sender. Regards, /psa From adam@REDACTED Mon Nov 19 13:25:09 2007 From: adam@REDACTED (Adam Lindberg) Date: Mon, 19 Nov 2007 13:25:09 +0100 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <47416119.5080405@di.uminho.pt> References: <474013BE.70201@fiit.stuba.sk> <13822276.post@talk.nabble.com> <47409F1A.6040008@fiit.stuba.sk> <6344005f0711190007j35f9fb57w53f21ea6d3aeaa93@mail.gmail.com> <47416119.5080405@di.uminho.pt> Message-ID: <6344005f0711190425s373df12eo22b5e1dce849710e@mail.gmail.com> Ah, I had it for the other order, i.e. clauses first and message queue last, my bad. The following question would then be, why are there ever issues with one process spamming the message queue making another process' messages not appear? Matej's problem should not exist then, or am I missing something here? Logically the receive statement should catch C2's messages at exactly the ratio they are sent? Cheers! Adam On Nov 19, 2007 11:10 AM, Paulo S?rgio Almeida wrote: > Hi, > > Adam Lindberg wrote: > > A basic check to do is to look at your receive statement. > > > > If it for example looks like this: > > > > receive > > {c1, Msg} -> > > do_c1_stuff(); > > {c2, Msg} -> > > do_c2_stuff() > > end > > > > In this case if there are always some messages from C1 in the message > > queue they will be picked first, regardless of the order. This is called > > This is not true. Messages are looked at in arrival order, and for each > message the guards are matched in program order. If the only messages in > the mailbox are either {c1, Msg} or {c2, Msg} the above behaves the same > as the code below. > > > selective receive. If you want to take the messages as they come you > > should do something like this: > > > > receive > > {Sender, Msg} -> > > case Sender of > > c1 -> > > do_c1_stuff(); > > c2 -> > > do_c2_stuff() > > end > > end > > > > This way you will always pick a message, the first one to be in queue > > (which matches pattern {A, B} of course) and _then_ look at the sender. > > Regards, > /psa > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fred@REDACTED Mon Nov 19 13:56:27 2007 From: fred@REDACTED (=?ISO-8859-1?Q?Lars-=C5ke_Fredlund?=) Date: Mon, 19 Nov 2007 13:56:27 +0100 Subject: [erlang-questions] clarify: order of messages In-Reply-To: <20071118190532.GR16989@katolaz.homeunix.net> References: <474013BE.70201@fiit.stuba.sk> <20071118112412.GK16989@katolaz.homeunix.net> <13822276.post@talk.nabble.com> <20071118190532.GR16989@katolaz.homeunix.net> Message-ID: <474187FB.5060705@babel.ls.fi.upm.es> KatolaZ wrote: > On Sun, Nov 18, 2007 at 10:55:35AM -0800, Zvi wrote: > >> Same processes on the same node? >> Will be this a case when processes are on different nodes? >> >> > > If the same process (only one) sends two messages one after the other > (Msg1 and Ms2, respectively) to another process, then those two > messages are going to be received in the same order as they have been > sent, i.e. Msg1 first and then Msg2. And this does not depend on the > fact that the two processes are running on different nodes (since I'm > quite sure that message passing among remote nodes is handled using > TCP sockets, so the *order* of transmission should be preserved...) > > Or, at least, I hope it works so ;-) > > HND > > Enzo > > With the current Erlang distribution mechanism messages in transit may be dropped when two nodes are disconnected (e.g., if the sending and receiving processes are on different nodes). Later, if the nodes are reconnected, communication may flow normally again but the dropped messages may not have been resent. Thus in the example the receiving process may actually only receive the second message (Msg2) in its queue, and never see Msg1. It is guaranteed (we hope!) that Msg1 can never be added to the message queue of the receiving process after Msg2 has been added. For clarification see for instance Hans Svensson's slides at the Erlang Workshop (http://www.erlang.se/workshop/2007/proceedings/06svenss.ppt) or the paper (http://www.cs.chalmers.se/~hanssv/doc/ew07-dist.pdf). In general communication is order preserving, but messages may be dropped. Use monitors or links to guard against this possibility if your protocol cannot cope with dropped messages. /Lars-Ake From bekesa@REDACTED Mon Nov 19 14:45:47 2007 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Mon, 19 Nov 2007 14:45:47 +0100 Subject: [erlang-questions] pattern match test operator In-Reply-To: <200711162344.08813.bekesa@sch.bme.hu> References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> Message-ID: <200711191445.47538.bekesa@sch.bme.hu> > > I can't see when I would want to do a match against > > a pattern containing only '_'s and if that is true I wouldn't need > > to match again to retrieve some of the internal terms later on. In > > this case, it's better to match even the internal structure from > > the start. What if you want to filter a list or query a database with two patterns? You don't (yet) want to retreive the internal terms, just want to have the elements matching certain patterns. Instead of writing [ X || X <- ListOrQLCTable case X of PATTERN1 -> true; PATTERN2 -> true; _ -> false end] You could write this (assume ~= the pattern-match-test operator): [ X || X <- ListOrQLCTable, PATTERN1 ~= X orelse PATTERN2 ~= X] Isn't it nicer? Georgy From ghazan@REDACTED Mon Nov 19 15:26:35 2007 From: ghazan@REDACTED (George B Hazan) Date: Mon, 19 Nov 2007 17:26:35 +0300 Subject: [erlang-questions] kqueue support Message-ID: <000201c82ab8$34b55ff0$e600000a@users.rbc.ru> Hello. Is it possible to enable the kqueue support in erlang under FreeBSD 6.2-STABLE #13? Note says that 5.2 & 5.3 have some problems with kqueue, but maybe new versions are more stable? At least a lot of software uses it under FreeBSD without problems... The problem is that ejabberd uses 60% of cpu under 1000 http-bind connections, and kqueue is known to be a great CPU saver. Right now I got the following error: ============== 8< ============== >8 ============== checking for working poll()... ok checking whether kqueue() is known to be broken... yes; FreeBSD implementation checking whether kernel poll support should be enabled... configure: error: no; kernel poll support requested but not found configure: error: /bin/sh '/usr/local/ports/work/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/configure' failed for erts ============== 8< ============== >8 ============== -- WMBR, George Hazan (ghazan@REDACTED) From vances@REDACTED Mon Nov 19 15:38:13 2007 From: vances@REDACTED (Vance Shipley) Date: Mon, 19 Nov 2007 10:38:13 -0400 Subject: [erlang-questions] Distributed Supervision Strategies Message-ID: <20071119143812.GC5604@little-black-book.motivity.ca> Has anyone contributed anything which assists in building distributed supervsision trees? What seems to be needed is a supervisor which handles node connection issues and candidate node selection for spawning children. -Vance Previous discussion: http://www.erlang.org/pipermail/erlang-questions/2004-June/012534.html From vlm@REDACTED Mon Nov 19 16:47:03 2007 From: vlm@REDACTED (Lev Walkin) Date: Mon, 19 Nov 2007 07:47:03 -0800 Subject: [erlang-questions] kqueue support In-Reply-To: <000201c82ab8$34b55ff0$e600000a@users.rbc.ru> References: <000201c82ab8$34b55ff0$e600000a@users.rbc.ru> Message-ID: <4741AFF7.7040300@lionet.info> From the looks of it, someone's looking into this list: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html === cut === Mon Nov 19 15:05:20 2007 UTC (36 minutes, 42 seconds ago) by dumbbell This should fix issues with Erlang (lang/erlang) and kqueue. Reported by: Rickard Green (Erlang) === cut === George B Hazan wrote: > Hello. > > Is it possible to enable the kqueue support in erlang under FreeBSD > 6.2-STABLE #13? Note says that 5.2 & 5.3 have some problems with kqueue, but > maybe new versions are more stable? At least a lot of software uses it under > FreeBSD without problems... The problem is that ejabberd uses 60% of cpu > under 1000 http-bind connections, and kqueue is known to be a great CPU > saver. > > Right now I got the following error: > ============== 8< ============== >8 ============== > checking for working poll()... ok > checking whether kqueue() is known to be broken... yes; FreeBSD > implementation > checking whether kernel poll support should be enabled... configure: error: > no; kernel poll support requested but not found > configure: error: /bin/sh > '/usr/local/ports/work/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/configure' > failed for erts > ============== 8< ============== >8 ============== > From nm@REDACTED Mon Nov 19 18:05:43 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Mon, 19 Nov 2007 21:05:43 +0400 Subject: [erlang-questions] [BUG] nasty, nasty bug in ssl module :) Message-ID: <4741C267.1030901@web.am> Dear OTP Team, I've found !@#*!&(@#& nasty bug in ssl module :)))) It took me nearly one week to localize this in large setup and find the reason why this code fails with strangest errors. I'm using R11B-5 release. What you need to test this 1. Generate certificate authority using openssl (put CA root certificate in ca-cert.crt) 2. Generate server certificate and key (xxx-server.*) and sign using that authority. 3. Generate client certificate and key and name them zzzz.* I've not tested if it fails with another set of certificates, but I have one, which makes this error happen. If it's mostly ssl bug and not options processing bug -- drop me a mail with certificate request. Now start ssl server executing following commands: # works ssl:start(), {ok, Serv} = ssl:listen(8555,[ {certfile,"../ssl/xxx-server.cert"}, {keyfile,"../ssl/xxx-server.key"}, {cacertfile,"../ssl/ca-cert.crt"}, {verify,2}, {password,[]}, {depth, 2} ]), {ok, Cli} = ssl:accept(Serv), erlang:display(ssl:peercert(Cli,[pkix])). Connect to this server using client certificate in another erlang shell ssl:start(), {ok, S} = ssl:connect("IP.IP.IP.IP", 8555, [{certfile, "zzzz.pem"}, {keyfile, "zzzz.key"}, {password, "asdasdasd"}]), erlang:display(S). You will see on server console client certificate dumped -- which is expected behaviour (we analyze client certificate later in our case). Now one more case: # fails with {{badmatch,{error,enoservercert}},[{erl_eval,expr,3}]} ssl:start(), {ok, Serv} = ssl:listen(8555,[ {password,[]}, {certfile,"../ssl/xxx-server.cert"}, {verify,2}, {keyfile,"../ssl/xxx-server.key"}, {cacertfile,"../ssl/ca-cert.crt"}, {depth, 2} ]), {ok, Cli} = ssl:accept(Serv), erlang:display(ssl:peercert(Cli,[pkix])). This ever will not start ssl server. # fails with eagain ssl:start(), {ok, Serv} = ssl:listen(8555,[ {certfile,"../ssl/xxx-server.cert"}, {password,[]}, {verify,2}, {keyfile,"../ssl/xxx-server.key"}, {cacertfile,"../ssl/ca-cert.crt"}, {depth, 2} ]), {ok, Cli} = ssl:accept(Serv), erlang:display(ssl:peercert(Cli,[pkix])). This is *the most* strangest error -- it starts the ssl server, accepts connection, but fails on ssl:peercert call. It's interesting -- does anyone had _same_ experience and strange errors as described here? /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From kip.macy@REDACTED Mon Nov 19 19:10:43 2007 From: kip.macy@REDACTED (Kip Macy) Date: Mon, 19 Nov 2007 10:10:43 -0800 Subject: [erlang-questions] kqueue support In-Reply-To: <4741AFF7.7040300@lionet.info> References: <000201c82ab8$34b55ff0$e600000a@users.rbc.ru> <4741AFF7.7040300@lionet.info> Message-ID: On Nov 19, 2007 7:47 AM, Lev Walkin wrote: > > From the looks of it, someone's looking into this list: > > http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c > http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html > Thanks for that information - Bob mentioned switching to Linux because of this issue but when I tried to follow up with the list about a month ago I got absolutely no responses. Bear in mind that this patch has only gone into HEAD, in order to be useful it needs to be MFC'd to RELENG_6 and RELENG_7. Assuming that happens, it will be fixed in 6.3 and 7.0. -Kip > > === cut === > Mon Nov 19 15:05:20 2007 UTC (36 minutes, 42 seconds ago) by dumbbell > > This should fix issues with Erlang (lang/erlang) and kqueue. > Reported by: Rickard Green (Erlang) > === cut === > > > George B Hazan wrote: > > Hello. > > > > Is it possible to enable the kqueue support in erlang under FreeBSD > > 6.2-STABLE #13? Note says that 5.2 & 5.3 have some problems with kqueue, but > > maybe new versions are more stable? At least a lot of software uses it under > > FreeBSD without problems... The problem is that ejabberd uses 60% of cpu > > under 1000 http-bind connections, and kqueue is known to be a great CPU > > saver. > > > > Right now I got the following error: > > ============== 8< ============== >8 ============== > > checking for working poll()... ok > > checking whether kqueue() is known to be broken... yes; FreeBSD > > implementation > > checking whether kernel poll support should be enabled... configure: error: > > no; kernel poll support requested but not found > > configure: error: /bin/sh > > '/usr/local/ports/work/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/configure' > > failed for erts > > ============== 8< ============== >8 ============== > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vlm@REDACTED Mon Nov 19 19:28:02 2007 From: vlm@REDACTED (Lev Walkin) Date: Mon, 19 Nov 2007 10:28:02 -0800 Subject: [erlang-questions] kqueue support In-Reply-To: References: <000201c82ab8$34b55ff0$e600000a@users.rbc.ru> <4741AFF7.7040300@lionet.info> Message-ID: <4741D5B2.5030701@lionet.info> The patch applies cleanly to RELENG_6_1, at least. Kip Macy wrote: > On Nov 19, 2007 7:47 AM, Lev Walkin wrote: >> From the looks of it, someone's looking into this list: >> >> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c >> http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html >> > > > Thanks for that information - Bob mentioned switching to Linux because > of this issue but when I tried to follow up with the list about a > month ago I got absolutely no responses. Bear in mind that this patch > has only gone into HEAD, in order to be useful it needs to be MFC'd to > RELENG_6 and RELENG_7. Assuming that happens, it will be fixed in 6.3 > and 7.0. > > -Kip > > >> === cut === >> Mon Nov 19 15:05:20 2007 UTC (36 minutes, 42 seconds ago) by dumbbell >> >> This should fix issues with Erlang (lang/erlang) and kqueue. >> Reported by: Rickard Green (Erlang) >> === cut === >> >> >> George B Hazan wrote: >>> Hello. >>> >>> Is it possible to enable the kqueue support in erlang under FreeBSD >>> 6.2-STABLE #13? Note says that 5.2 & 5.3 have some problems with kqueue, but >>> maybe new versions are more stable? At least a lot of software uses it under >>> FreeBSD without problems... The problem is that ejabberd uses 60% of cpu >>> under 1000 http-bind connections, and kqueue is known to be a great CPU >>> saver. >>> >>> Right now I got the following error: >>> ============== 8< ============== >8 ============== >>> checking for working poll()... ok >>> checking whether kqueue() is known to be broken... yes; FreeBSD >>> implementation >>> checking whether kernel poll support should be enabled... configure: error: >>> no; kernel poll support requested but not found >>> configure: error: /bin/sh >>> '/usr/local/ports/work/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/configure' >>> failed for erts >>> ============== 8< ============== >8 ============== >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From bob@REDACTED Mon Nov 19 19:44:28 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 19 Nov 2007 10:44:28 -0800 Subject: [erlang-questions] kqueue support In-Reply-To: References: <000201c82ab8$34b55ff0$e600000a@users.rbc.ru> <4741AFF7.7040300@lionet.info> Message-ID: <6a36e7290711191044i2aac7e8cma3de07d8a626004d@mail.gmail.com> On 11/19/07, Kip Macy wrote: > On Nov 19, 2007 7:47 AM, Lev Walkin wrote: > > > > From the looks of it, someone's looking into this list: > > > > http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c > > http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html > > > > > Thanks for that information - Bob mentioned switching to Linux because > of this issue but when I tried to follow up with the list about a > month ago I got absolutely no responses. Bear in mind that this patch > has only gone into HEAD, in order to be useful it needs to be MFC'd to > RELENG_6 and RELENG_7. Assuming that happens, it will be fixed in 6.3 > and 7.0. > Yeah, this is exactly why we switched to Linux. Good to hear it's getting fixed now, maybe we'll simply upgrade some of our legacy 32-bit boxes instead of switching them to a 32-bit linux. -bob From vladdu55@REDACTED Mon Nov 19 22:02:03 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 19 Nov 2007 21:02:03 +0000 Subject: [erlang-questions] pattern match test operator In-Reply-To: <200711191445.47538.bekesa@sch.bme.hu> References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> <200711191445.47538.bekesa@sch.bme.hu> Message-ID: <95be1d3b0711191302g61250fdbk2bedacbf9107e2b4@mail.gmail.com> Hi! On Nov 19, 2007 1:45 PM, Andras Georgy Bekes wrote: > What if you want to filter a list or query a database with two patterns? > You don't (yet) want to retreive the internal terms, just want to have > the elements matching certain patterns. > > Instead of writing > > [ X || X <- ListOrQLCTable > case X of > PATTERN1 -> > true; > PATTERN2 -> > true; > _ -> > false > end] > > You could write this (assume ~= the pattern-match-test operator): > > > [ X || X <- ListOrQLCTable, > PATTERN1 ~= X orelse PATTERN2 ~= X] > > Isn't it nicer? Absolutely nicer! What I feel is that such a notation isn't bringing enough to the language so that it's worth it. If pattern1 and pattern2 above are wildly different, then I'm not sure what the meaning would be for the resulting list. If they are similar, but some sub-terms are different, then I would better like to see a regexp-like syntax for terms matching. Of course, for that it is much more difficult to find an appropriate syntax... regards, Vlad From vladdu55@REDACTED Mon Nov 19 22:15:18 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 19 Nov 2007 21:15:18 +0000 Subject: [erlang-questions] pattern match test operator In-Reply-To: <200711162344.08813.bekesa@sch.bme.hu> References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> Message-ID: <95be1d3b0711191315xddddd5cr44a67bd2b29302a1@mail.gmail.com> Hi, On Nov 16, 2007 10:44 PM, Andras Georgy Bekes wrote: > case Expr1 of > PATTERN1 -> > case Expr_with_side_effects of >... Yes, when there are side-effects, then my suggestion doesn't work. But I wonder if it's a ggod idea to put side effects in a match... I prefer to put them in well lit and guarded places, so that they can't sneak on my when I'm looking somewhere else :-) > I've seen a code fragment (in AXD301) several weeks ago, so I can't > remember correctly, but: The function was supposed to select the first > case if one argument looked like "R7A..." or "R12C...". > This could be done with my construct: > > function(X) when ?MATCH("R7A"++_,X) or ?MATCH("R12C"++_,X) -> > complicated_function_body(). > > All the solutions we've found were ugly in some way. function("R7A"++_) -> function_aux(); function("R12C"++_) -> function_aux(). function_aux() -> complicated_function_body(). is not really ugly, just a little more verbose. I see your point, I guess that it's a matter of being used with a style and not being as sensitive to such ugliness. best regards, Vlad From rvirding@REDACTED Mon Nov 19 22:24:17 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 19 Nov 2007 22:24:17 +0100 Subject: [erlang-questions] Erlang Book 1996 vs. 2007 In-Reply-To: <46F11028.7060206@gmail.com> References: <46F0BB78.7030601@gmail.com> <876ef97a0709190431k2a3ca2e0rba149c6e79f23656@mail.gmail.com> <46F11028.7060206@gmail.com> Message-ID: <3dbc6d1c0711191324i48d134a5l7ecd4ee70b5d4030@mail.gmail.com> On 19/09/2007, Dmitrii 'Mamut' Dimandt wrote: > > Toby DiPasquale wrote: > > This would be in conflict with Joe's statements about Erlang not being > object-oriented, right > > >From the TOC: http://erlang.org/erlang_book_toc.html > 17 Object-Oriented Programming > 17.1 Basic Concepts > 17.2 Mapping to Erlang > 17.3 An Object-Oriented Interface > 17.4 Object-Oriented Programming > 17.5 Object-Oriented Design > > I mostly interested in the "Mapping to Erlang" chapter as it could be > quite useful when trying to port certain libraries to Erlang > Did you ever get a reply to this? The method described was rather basic but it would have worked. In many ways it is similar to a gen_server but specialised in a different direction. - A class is a module which needs to export at least two functions superclass() -> SuperClassName. method(Message) -> {result,MethodResult} | no_method. Inheritance is handles by the superclass/0 function. - There is a dispatch function: dispatch(Method, Class) -> case Class:method(Method) of {result,Result} -> {result,Result}; no_method -> Superclass = Class:superclass(), dispatch(Method, SuperClass) end. - For a system with multiple inheritance superclass/0 returns a list of classes. - You would need some top superclass to properly handle the case of no method being found. It was all very basic and never expanded into full implementation. For concurrent objects you would wrap dispatch in a process otherwise call it directly. A lot of things are missing, for example you would need a state argument as in gen_server. The rest of the chapter was a discussion of why we thought that OO *design* might be acceptable but why OO *languages* are not. Interestingly enough this is probably how dynamic OO languages handle it internally, here it was explicit. This would be slower but allow for complete control of the flavour of OO. Today you could wrap it very neatly in a fun for non-concurrent objects and wrap the fun in a process for concurrent ones. It is perfectly feasible to do this way. There have been a number of attempts at building a "proper" OO package for Erlang but none has really found acceptance and been seriously used. One thing you must realise is that we were *not* more favourably disposed towards OO then than we are now so you must not take that chapter too seriously. We were right then and we are right now. COP forever. :-) Robert (who wrote the chapter) -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Mon Nov 19 22:43:25 2007 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 19 Nov 2007 22:43:25 +0100 Subject: [erlang-questions] how: instatiate a parameterized ASN.1 type Message-ID: The cross-posting from the trapexit forum does not seem to work, so I apologise for the duplication... I have managed to implement my own instance (called tetraIsiMessage) of the operation type from X.880 and would like to use this to instantiate the ROSE type, but I cannot figure out how to do this. The ROS type from Remote-Operations-Generic-ROS-PDUs has to be instantiated before one can use it for something and I have tried numerous variations over the following to no avail: myInvokeIdSet InvokeId ::= present:2 tetraIsiROS ::= ROS{myInvokeIdSet, tetraIsiMessage, tetraIsiMessage} As soon as I add the 'tetraIsi ::= ...' line the compiler starts complaining about the definition of myInvokeIdSet which works just fine without the last line. For your reference... ROSE is defined in X.880 and the ASN.1 files for it can be downloaded from the ITU web site: http://www.itu.int/ITU-T/asn1/database/itu-t/x/x880/1994-TC1/index.html I am very close to throwing the whole auto-generation from ASN.1 definitions away and start implementing my encoder and decoder by hand, but... I would really like to avoid messing with BER encoding/decoding and let the asn1ct compiler take care of that for me!! Cheers, Torben -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Mon Nov 19 23:38:39 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Mon, 19 Nov 2007 14:38:39 -0800 Subject: [erlang-questions] pattern match test operator In-Reply-To: <200711191445.47538.bekesa@sch.bme.hu> References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> <200711191445.47538.bekesa@sch.bme.hu> Message-ID: On 11/19/07, Andras Georgy Bekes wrote: > [ X || X <- ListOrQLCTable, > PATTERN1 ~= X orelse PATTERN2 ~= X] Below you'll find a module that adds a parse transform so you can write expressions like '~'(Pattern = X) or match(Pattern = X). A quick example: -module(test). -compile({parse_transform, {match, '~'}}). -export([foo/1]). foo(X) -> '~'({burlap, _} = X). While writing this module, I discovered that the Erlang compiler does not allow parameterized modules and submitted a patch for it here: http://article.gmane.org/gmane.comp.lang.erlang.patches/192 If you don't want to patch compile.erl (or can't), change the compile line above to -compile({parse_transform, match}), the module line below to -module(match), and change Name in the case clause to '~'. -module(match, [Name]). -export([parse_transform/2]). parse_transform(Forms, _Options) -> erl_syntax:revert_forms( [erl_syntax_lib:map(fun doit/1, Form) || Form <- Forms]). doit(Form) -> %% Want to transform Name(Pattern = Body) to case Body of Pattern %% -> true; _ -> false end. case erl_syntax:type(Form) of application -> Operator = erl_syntax:application_operator(Form), case erl_syntax:type(Operator) of atom -> case erl_syntax:atom_value(Operator) of Name -> [Args] = erl_syntax:application_arguments(Form), match_expr = erl_syntax:type(Args), Pattern = erl_syntax:match_expr_pattern(Args), Body = erl_syntax:match_expr_body(Args), erl_syntax:case_expr( Body, [erl_syntax:clause([Pattern], none, [erl_syntax:atom(true)]), erl_syntax:clause([erl_syntax:underscore()], none, [erl_syntax:atom(false)])]); _ -> Form end; _ -> Form end; _ -> Form end. From matthew@REDACTED Mon Nov 19 23:40:34 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Mon, 19 Nov 2007 14:40:34 -0800 Subject: [erlang-questions] pattern match test operator In-Reply-To: References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> <200711191445.47538.bekesa@sch.bme.hu> Message-ID: On 11/19/07, Matthew Dempsky wrote: > While writing this module, I discovered that the Erlang compiler does > not allow parameterized modules and submitted a patch for it here: > http://article.gmane.org/gmane.comp.lang.erlang.patches/192 Sorry, that should have read "the Erlang compiler does not allow parameterized modules for parse transforms." From matthew@REDACTED Tue Nov 20 00:49:57 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Mon, 19 Nov 2007 15:49:57 -0800 Subject: [erlang-questions] pattern match test operator In-Reply-To: References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> <200711191445.47538.bekesa@sch.bme.hu> Message-ID: On 11/19/07, Matthew Dempsky wrote: > If you don't want to patch compile.erl (or can't), change the compile > line above to -compile({parse_transform, match}), the module line > below to -module(match), and change Name in the case clause to '~'. Just one more message from me (hopefully :-)... the module below takes advantage of implementation details in how parameterized modules work, so you can write -compile({parse_transform, match}). to use the default syntax of '~'(Pattern = Expr). Alternatively, if you've patched compile.erl to allow parameterized modules, you can write (e.g.) -compile({parse_transform, {match, is_match}}). to change the syntax to is_match(Pattern = Expr). To be explicit: this version only requires patching if you don't like the default syntax using '~'. (I suppose if you were really interested, the parse transform could look for an -match_name(Name) attribute or something, but this works and was less effort. ;-) -module(match). -export([parse_transform/2, parse_transform/3]). parse_transform(Forms, _Options) -> Fun = fun(Form) -> doit(Form, '~') end, erl_syntax:revert_forms( [erl_syntax_lib:map(Fun, Form) || Form <- Forms]). parse_transform(Forms, _Options, {match, Name}) -> Fun = fun(Form) -> doit(Form, Name) end, erl_syntax:revert_forms( [erl_syntax_lib:map(Fun, Form) || Form <- Forms]). doit(Form, Name) -> %% Want to transform Name(Pattern = Body) to case Body of Pattern %% -> true; _ -> false end. case erl_syntax:type(Form) of application -> Operator = erl_syntax:application_operator(Form), case erl_syntax:type(Operator) of atom -> case erl_syntax:atom_value(Operator) of Name -> [Args] = erl_syntax:application_arguments(Form), match_expr = erl_syntax:type(Args), Pattern = erl_syntax:match_expr_pattern(Args), Body = erl_syntax:match_expr_body(Args), erl_syntax:case_expr( Body, [erl_syntax:clause([Pattern], none, [erl_syntax:atom(true)]), erl_syntax:clause([erl_syntax:underscore()], none, [erl_syntax:atom(false)])]); _ -> Form end; _ -> Form end; _ -> Form end. From tsuraan@REDACTED Tue Nov 20 06:28:22 2007 From: tsuraan@REDACTED (tsuraan) Date: Mon, 19 Nov 2007 23:28:22 -0600 Subject: [erlang-questions] jinterface cannot connect to epmd Message-ID: <84fb38e30711192128l60680c1ape623ed4d9f71c561@mail.gmail.com> I'm attempting to get some of my code running on a JVM to connect to my erlang cluster using the jinterface package. On a single computer, I have the following two erlang sessions running happily in different terminals: ========= erl -setcookie foo -sname real Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) (real@REDACTED)1> ========== rl -setcookie foo -sname test Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) (test@REDACTED)2> node(). test@REDACTED (test@REDACTED)10> net_adm:ping('test@REDACTED'). pong (test@REDACTED)11> net_adm:ping('real@REDACTED'). pong (test@REDACTED)12> net_adm:ping('blah@REDACTED'). pang ========== So, the erlang nodes seem happy to talk to each other (at least ping works). So, in my JVM I'm trying to create a connection to the same cluster (using JRuby for an interactive session): =========== CLASSPATH=/usr/lib/erlang/lib/jinterface-1.3/priv/OtpErlang.jar:$CLASSPATH jirb irb(main):001:0> require 'java' => true irb(main):003:0> import 'com.ericsson.otp.erlang.OtpNode' => ["com.ericsson.otp.erlang.OtpNode"] irb(main):004:0> OtpNode.new('blah', 'foo') NativeException: java.io.IOException: Nameserver not responding on localhost when publishing blah from OtpEpmd.java:327:in `com.ericsson.otp.erlang.OtpEpmd.r3_publish' from OtpEpmd.java:119:in `com.ericsson.otp.erlang.OtpEpmd.publishPort' from OtpNode.java:645:in `com.ericsson.otp.erlang.OtpNode$Acceptor.publishPort' from OtpNode.java:638:in `com.ericsson.otp.erlang.OtpNode$Acceptor.' from OtpNode.java:136:in `com.ericsson.otp.erlang.OtpNode.init' ... ========= So, it seems to think epmd isn't there. Erlang processes have no trouble connecting, so I'm wondering if I need to set some environmental variable to tell the JVM where epmd is listening, or what. Any ideas? My java -version is: java version "1.5.0_12" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04) Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode) And I'm running under Gentoo Linux kernel 2.6.21. From bjorn@REDACTED Tue Nov 20 07:07:40 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Nov 2007 07:07:40 +0100 Subject: [erlang-questions] pattern match test operator In-Reply-To: References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> <200711191445.47538.bekesa@sch.bme.hu> Message-ID: "Matthew Dempsky" writes: > On 11/19/07, Andras Georgy Bekes wrote: > > [ X || X <- ListOrQLCTable, > > PATTERN1 ~= X orelse PATTERN2 ~= X] > > Below you'll find a module that adds a parse transform so you can > write expressions like '~'(Pattern = X) or match(Pattern = X). > > A quick example: > > -module(test). > -compile({parse_transform, {match, '~'}}). > -export([foo/1]). I don't recommend depending on the current implementation of parameterized modules. A tuple was use for easy of prototyping, with the intention of changing it to an opaque term to later. Actually, we might make that change in one of the services releases of R12B. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vladdu55@REDACTED Tue Nov 20 08:47:35 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 Nov 2007 08:47:35 +0100 Subject: [erlang-questions] jinterface cannot connect to epmd In-Reply-To: <84fb38e30711192128l60680c1ape623ed4d9f71c561@mail.gmail.com> References: <84fb38e30711192128l60680c1ape623ed4d9f71c561@mail.gmail.com> Message-ID: <95be1d3b0711192347g105b8977wea9ad7b1025d3ea3@mail.gmail.com> Hi! On Nov 20, 2007 6:28 AM, tsuraan wrote: > (real@REDACTED)1> ... > NativeException: java.io.IOException: Nameserver not responding on > localhost when publishing blah Maybe this is the issue? The Java node looks on localhost and the others on macbeth? Check your .hosts file and the network interfaces setup. You can debug the jinterface side by defining -DOtpConnection.trace=4 and epmd by starting it manually (after killing the existing one) with "epmd -d -d -d" in another console. best regards, Vlad From vladdu55@REDACTED Tue Nov 20 08:54:22 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 Nov 2007 08:54:22 +0100 Subject: [erlang-questions] pattern match test operator In-Reply-To: References: <200711162107.06534.bekesa@sch.bme.hu> <95be1d3b0711161300v246827d5o446296fa4c9604cf@mail.gmail.com> <200711162344.08813.bekesa@sch.bme.hu> <200711191445.47538.bekesa@sch.bme.hu> Message-ID: <95be1d3b0711192354o7216b2e2w2bff719265496b77@mail.gmail.com> Hi! On Nov 19, 2007 11:38 PM, Matthew Dempsky wrote: > On 11/19/07, Andras Georgy Bekes wrote: > > [ X || X <- ListOrQLCTable, > > PATTERN1 ~= X orelse PATTERN2 ~= X] > > Below you'll find a module that adds a parse transform so you can > write expressions like '~'(Pattern = X) or match(Pattern = X). ... > %% Want to transform Name(Pattern = Body) to case Body of Pattern > %% -> true; _ -> false end. Cool! Just a note of warning: this implementation "leaks" variables in the surrounding environment. If you only match against constants, this is no issue, but if variables are present and subsequently reused, there may be some unwanted effects. best regards, Vlad From bertil.karlsson@REDACTED Tue Nov 20 09:14:40 2007 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Tue, 20 Nov 2007 09:14:40 +0100 Subject: [erlang-questions] how: instatiate a parameterized ASN.1 type In-Reply-To: References: Message-ID: <47429770.8010209@ericsson.com> Hi, The first parameter of the ROS type must be an ASN1-valueset, the second and third must be ASN1-objectset parameters. The asn1- compiler lacks some features in the area of Parameterized Types and Information Objects that we may extend in a future release. /Bertil Karlsson Torben Hoffmann wrote: > The cross-posting from the trapexit forum does not seem to work, so I > apologise for the duplication... > > I have managed to implement my own instance (called tetraIsiMessage) > of the operation type from X.880 and would like to use this to > instantiate the ROSE type, but I cannot figure out how to do this. > > The ROS type from Remote-Operations-Generic-ROS-PDUs has to be > instantiated before one can use it for something and I have tried > numerous variations over the following to no avail: > > > myInvokeIdSet InvokeId ::= present:2 > > tetraIsiROS ::= ROS{myInvokeIdSet, tetraIsiMessage, tetraIsiMessage} > > > As soon as I add the 'tetraIsi ::= ...' line the compiler starts > complaining about the definition of myInvokeIdSet which works just > fine without the last line. > > For your reference... > ROSE is defined in X.880 and the ASN.1 files for it can be downloaded > from the ITU web site: > http://www.itu.int/ITU-T/asn1/database/itu-t/x/x880/1994-TC1/index.html > > > I am very close to throwing the whole auto-generation from ASN.1 > definitions away and start implementing my encoder and decoder by > hand, but... I would really like to avoid messing with BER > encoding/decoding and let the asn1ct compiler take care of that for me!! > > Cheers, > Torben > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rjmh@REDACTED Tue Nov 20 12:13:31 2007 From: rjmh@REDACTED (John Hughes) Date: Tue, 20 Nov 2007 12:13:31 +0100 Subject: [erlang-questions] Recruiting functional programmers In-Reply-To: References: Message-ID: <014701c82b66$630e28b0$292a7a10$@chalmers.se> Interested in recruiting skilled Haskell or Erlang programmers from Chalmers and Gothenburg University? As an experiment, I'm planning an event here in December. See www.jobs-in-fp.org for details and how to take part. John Hughes From tsuraan@REDACTED Tue Nov 20 16:34:23 2007 From: tsuraan@REDACTED (tsuraan) Date: Tue, 20 Nov 2007 09:34:23 -0600 Subject: [erlang-questions] jinterface cannot connect to epmd In-Reply-To: <95be1d3b0711192347g105b8977wea9ad7b1025d3ea3@mail.gmail.com> References: <84fb38e30711192128l60680c1ape623ed4d9f71c561@mail.gmail.com> <95be1d3b0711192347g105b8977wea9ad7b1025d3ea3@mail.gmail.com> Message-ID: <84fb38e30711200734l53d2d012i7bfff45a10a2766f@mail.gmail.com> > Maybe this is the issue? The Java node looks on localhost and the > others on macbeth? Check your .hosts file and the network interfaces > setup. Yup, hosts it was; I used to have functional DNS here, but my firewall's under construction so I don't anymore; I forgot that erlang liked having names be useful :) > > You can debug the jinterface side by defining -DOtpConnection.trace=4 > and epmd by starting it manually (after killing the existing one) with > "epmd -d -d -d" in another console. Thanks for the advice! From joelr1@REDACTED Tue Nov 20 18:05:55 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 17:05:55 +0000 Subject: [erlang-questions] Problem parsing Erlang code Message-ID: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> I'm trying to generate Erlang code based on some data in a file. I thought I would try to type up the code I want to get to figure out what the core should be. I tried the following at the Erlang prompt but got an error. Any suggestions? Ultimately, I would want to generate the abstract forms by hand, filling in values from a file, and pretty-print them. Yes, I can generate the Erlang code by concatenating strings but I'd rather not. / Lisp macros, oh, how I miss you!/ Thanks, Joel --- S = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, \"bicycling, <10\");". {ok, Toks, _} = erl_scan:string(S). {ok, AbsForm} = erl_parse:parse(Toks). =ERROR REPORT==== 20-Nov-2007::17:00:03 === Error in process <0.31.0> with exit value: {{badmatch,{error, {999999,erl_parse,["syntax error before: ",[]]}}},[{erl_eval,expr,3}]} ** exited: {{badmatch,{error,{999999,erl_parse,["syntax error before: ",[]]}}}, [{erl_eval,expr,3}]} ** -- http://wagerlabs.com From tonyg@REDACTED Tue Nov 20 18:17:40 2007 From: tonyg@REDACTED (Tony Garnock-Jones) Date: Tue, 20 Nov 2007 17:17:40 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> Message-ID: <474316B4.1030805@lshift.net> Joel Reymont wrote: > S = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, > \"bicycling, <10\");". Did you want a "." instead of a ";" at the end of the string? Tony -- [][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211 [][] LShift Ltd | Tel: +44 (0)20 7729 7060 [] [] http://www.lshift.net/ | Email: tonyg@REDACTED From sean.hinde@REDACTED Tue Nov 20 18:23:29 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 20 Nov 2007 17:23:29 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> Message-ID: You need a full stop at the end not a semicolon. Sean On 20 Nov 2007, at 17:05, Joel Reymont wrote: > I'm trying to generate Erlang code based on some data in a file. I > thought I would try to type up the code I want to get to figure out > what the core should be. > > I tried the following at the Erlang prompt but got an error. Any > suggestions? > > Ultimately, I would want to generate the abstract forms by hand, > filling in values from a file, and pretty-print them. Yes, I can > generate the Erlang code by concatenating strings but I'd rather > not. / > Lisp macros, oh, how I miss you!/ > > Thanks, Joel > > --- > > S = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, > \"bicycling, <10\");". > {ok, Toks, _} = erl_scan:string(S). > {ok, AbsForm} = erl_parse:parse(Toks). > > =ERROR REPORT==== 20-Nov-2007::17:00:03 === > Error in process <0.31.0> with exit value: {{badmatch,{error, > {999999,erl_parse,["syntax error before: ",[]]}}},[{erl_eval,expr,3}]} > > ** exited: {{badmatch,{error,{999999,erl_parse,["syntax error before: > ",[]]}}}, > [{erl_eval,expr,3}]} ** > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From kostis@REDACTED Tue Nov 20 18:27:21 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 20 Nov 2007 19:27:21 +0200 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> Message-ID: <474318F9.6010305@cs.ntua.gr> Joel Reymont wrote: > > I tried the following at the Erlang prompt but got an error. Any > suggestions? You've not understood that Erlang clauses cannot be parsed on their own (i.e. without being part of a function definition) because the parser needs to read until it finds a "." Change the ";" to "." and it will work. Kostis > --- > > S = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, > \"bicycling, <10\");". > {ok, Toks, _} = erl_scan:string(S). > {ok, AbsForm} = erl_parse:parse(Toks). > > =ERROR REPORT==== 20-Nov-2007::17:00:03 === > Error in process <0.31.0> with exit value: {{badmatch,{error, > {999999,erl_parse,["syntax error before: ",[]]}}},[{erl_eval,expr,3}]} From joelr1@REDACTED Tue Nov 20 18:28:48 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 17:28:48 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <474316B4.1030805@lshift.net> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <474316B4.1030805@lshift.net> Message-ID: On Nov 20, 2007, at 5:17 PM, Tony Garnock-Jones wrote: > Did you want a "." instead of a ";" at the end of the string? That's what I thought before sending the message. It doesn't help, though. 5> S1 = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, \"bicycling, <10\").". "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, \"bicycling, <10\")." 6> {ok, Toks1, _} = erl_scan:string(S). {ok,[{atom,1,show}, {'(',1}, {'{',1}, {atom,1,bicycling}, {'=',1}, {var,1,'A'}, {',',1}, {integer,1,1010}, {'=',1}, {var,1,'B'}, {'}',1}, {')',1}, {'->',1}, {atom,1,show_activity}, {'(',1}, {var,1,'A'}, {',',1}, {var,1,'B'}, {',',1}, {integer,1,4}, {',',1}, {string,1,"bicycling, <10"}, {')',1}, {';',1}], 1} 7> {ok, AbsForm} = erl_parse:parse(Toks1). =ERROR REPORT==== 20-Nov-2007::17:05:35 === Error in process <0.37.0> with exit value: {{badmatch,{error, {999999,erl_parse,["syntax error before: ",[]]}}},[{erl_eval,expr,3}]} ** exited: {{badmatch,{error,{999999,erl_parse,["syntax error before: ",[]]}}}, [{erl_eval,expr,3}]} ** -- http://wagerlabs.com From joelr1@REDACTED Tue Nov 20 18:33:32 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 17:33:32 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <474316B4.1030805@lshift.net> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <474316B4.1030805@lshift.net> Message-ID: <48DD977F-4C1F-4938-86A8-226453BC8233@gmail.com> Foot in mouth! Thank you Sean and Tony, it works with the dot! Now, suppose I wanted to pretty print the code with the semicolon at the end. How would I do that? Thanks, Joel -- http://wagerlabs.com From joelr1@REDACTED Tue Nov 20 18:41:52 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 17:41:52 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <48DD977F-4C1F-4938-86A8-226453BC8233@gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <474316B4.1030805@lshift.net> <48DD977F-4C1F-4938-86A8-226453BC8233@gmail.com> Message-ID: On Nov 20, 2007, at 5:33 PM, Joel Reymont wrote: > Now, suppose I wanted to pretty print the code with the semicolon at > the end. > > How would I do that? By creating the AST with two function clauses! {ok,{function,1, show, 2, [{clause,1,[{integer,1,1},{integer,1,2}],[],[{integer, 1,1}]}, {clause,1,[{integer,1,3},{integer,1,4}],[],[{integer, 1,2}]}]}} Thanks, Joel -- http://wagerlabs.com From sean.hinde@REDACTED Tue Nov 20 18:46:51 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 20 Nov 2007 17:46:51 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <474316B4.1030805@lshift.net> Message-ID: <89767270-C6E4-4193-84F9-4107EC0BB9DF@gmail.com> Works for me: 12> S = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4,\"bicycling, <10\").". "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4,\"bicycling, <10\")." 13> {ok, Toks, _} = erl_scan:string(S). {ok,[{atom,1,show}, {'(',1}, {'{',1}, {atom,1,bicycling}, {'=',1}, {var,1,'A'}, {',',1}, {integer,1,1010}, {'=',1}, {var,1,'B'}, {'}',1}, {')',1}, {'->',1}, {atom,1,show_activity}, {'(',1}, {var,1,'A'}, {',',1}, {var,1,'B'}, {',',1}, {integer,1,4}, {',',1}, {string,1,"bicycling, <10"}, {')',1}, {dot,1}], 1} 14> erl_parse:parse(Toks). {ok,{function,1, show, 1, [{clause,1, [{tuple,1, [{match,1,{atom,1,bicycling},{var, 1,'A'}}, {match,1,{integer,1,1010},{var, 1,'B'}}]}], [], [{call,1, {atom,1,show_activity}, [{var,1,'A'}, {var,1,'B'}, {integer,1,4}, {string,1,"bicycling, <10"}]}]}]}} On 20 Nov 2007, at 17:28, Joel Reymont wrote: > > On Nov 20, 2007, at 5:17 PM, Tony Garnock-Jones wrote: > >> Did you want a "." instead of a ";" at the end of the string? > > > That's what I thought before sending the message. It doesn't help, > though. > > 5> S1 = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, > \"bicycling, <10\").". > "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4, > \"bicycling, <10\")." > 6> {ok, Toks1, _} = erl_scan:string(S). > {ok,[{atom,1,show}, > {'(',1}, > {'{',1}, > {atom,1,bicycling}, > {'=',1}, > {var,1,'A'}, > {',',1}, > {integer,1,1010}, > {'=',1}, > {var,1,'B'}, > {'}',1}, > {')',1}, > {'->',1}, > {atom,1,show_activity}, > {'(',1}, > {var,1,'A'}, > {',',1}, > {var,1,'B'}, > {',',1}, > {integer,1,4}, > {',',1}, > {string,1,"bicycling, <10"}, > {')',1}, > {';',1}], > 1} > 7> {ok, AbsForm} = erl_parse:parse(Toks1). > =ERROR REPORT==== 20-Nov-2007::17:05:35 === > Error in process <0.37.0> with exit value: {{badmatch,{error, > {999999,erl_parse,["syntax error before: ",[]]}}},[{erl_eval,expr,3}]} > > ** exited: {{badmatch,{error,{999999,erl_parse,["syntax error before: > ",[]]}}}, > [{erl_eval,expr,3}]} ** > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Tue Nov 20 18:48:40 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 17:48:40 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <89767270-C6E4-4193-84F9-4107EC0BB9DF@gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <474316B4.1030805@lshift.net> <89767270-C6E4-4193-84F9-4107EC0BB9DF@gmail.com> Message-ID: <34003C77-9737-4318-BC6B-A3C15B665EEB@gmail.com> On Nov 20, 2007, at 5:46 PM, Sean Hinde wrote: > Works for me: > > 12> S = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, > 4,\"bicycling, <10\").". > "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, > 4,\"bicycling, <10\")." > 13> {ok, Toks, _} = erl_scan:string(S). I had a typo where I was still parsing S after tokenizing S1. My apologies! -- http://wagerlabs.com From joelr1@REDACTED Tue Nov 20 18:36:14 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 17:36:14 +0000 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <474318F9.6010305@cs.ntua.gr> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <474318F9.6010305@cs.ntua.gr> Message-ID: On Nov 20, 2007, at 5:27 PM, Kostis Sagonas wrote: > You've not understood that Erlang clauses cannot be parsed on their > own (i.e. without being part of a function definition) because the > parser needs to read until it finds a "." Indeed. Mea culpa. I thought I checked with the dot but there was a typo in my code. Thanks, Joel -- http://wagerlabs.com From gbulmer@REDACTED Tue Nov 20 19:27:15 2007 From: gbulmer@REDACTED (G Bulmer) Date: Wed, 21 Nov 2007 01:27:15 +0700 Subject: [erlang-questions] beginner: Help needed - Erts overview and map to subsystem to source Message-ID: <8684BBB2-8A22-4772-BE3D-4365BE3E2202@gmail.com> Bjorn Thank you very much for the pointers, especially the tip on R11B -> R12B garbage collector change. Are the HiPE papers you suggest at: http://www.it.uu.se/research/group/hipe/publications.shtml and http://www.it.uu.se/research/group/hipe/documentation.shtml Do you know, is the HiPE memory management system the same as/similar to the 'normal' Erlang run-time, making "Efficient Memory Management for Message-Passing Concurrency" a good place to start? Garry > G Bulmer writes: >> Can someone point me at any documents which describes the internal >> architecture of erts? Ideally it would help me navigate the code too. >> >> For example is there a document which gives an overview of erts >> subsystems? (ideally also a "table of contents" mapping the >> subsystems to the files which contain the corresponding code, but if >> the names are consistent, I can use grep.) >> > > As far as I know, there are no such documents. (Though some > architectual > overviews can be found in some the papers from the HiPE group.) >> I guess I need to find the code for the garbage collector, erts >> function tracing (which I would try to use for the DTrace function >> call probes), the scheduler, and the module loader/unloader. I'll >> also need to discover approximately how they work !-) >> > > Very brief overview: > > The garbage collector is in erl_gc.c in R12B (ggc.c in R11B; that file > is gone in R12B). > > (Local) call trace works by replacing the first instruction in > function > with a breakpoint instruction. The breakpoint instruction is called > "call_traced_function" in beam_emu.c. Most of the other code for > tracing > is in erl_trace.c and erl_bif_trace.c. (beam_emu.c contains the > virtual machine for BEAM.) > > The scheduler is in the function schedule() in erl_process.c. > > The loader is in beam_bif_load.c (the loader BIFs) and beam_load.c > (the bulk of the code). > From bjorn@REDACTED Tue Nov 20 21:16:39 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Nov 2007 21:16:39 +0100 Subject: [erlang-questions] beginner: Help needed - Erts overview and map to subsystem to source In-Reply-To: <8684BBB2-8A22-4772-BE3D-4365BE3E2202@gmail.com> References: <8684BBB2-8A22-4772-BE3D-4365BE3E2202@gmail.com> Message-ID: G Bulmer writes: > Bjorn > > Thank you very much for the pointers, especially the tip on R11B -> > R12B garbage collector change. > > Are the HiPE papers you suggest at: > http://www.it.uu.se/research/group/hipe/publications.shtml and > http://www.it.uu.se/research/group/hipe/documentation.shtml Yes. > Do you know, is the HiPE memory management system the same as/similar > to the 'normal' Erlang run-time, making "Efficient Memory Management > for Message-Passing Concurrency" a good place to start? HiPE's code is integrated into Erlang/OTP. The private-heap architecture (or process-centric architecture) is in the standard Erlang run-time. The hybrid heap archicture run-time is also included in R11B ("erl -hybrid"), and the shared heap architecture was in included in earlier releases of Erlang/OTP. I think that the beginning of Paper A (especially pages 28-31) are the most interesting. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rvirding@REDACTED Tue Nov 20 23:11:09 2007 From: rvirding@REDACTED (Robert Virding) Date: Tue, 20 Nov 2007 23:11:09 +0100 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> Message-ID: <3dbc6d1c0711201411g7df3e4d5yb38d5a906f71f1ef@mail.gmail.com> On 20/11/2007, Joel Reymont wrote: > > > Lisp macros, oh, how I miss you!/ > > Thanks, Joel Actually I'm seriously thinking about this. :-) Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Tue Nov 20 23:19:19 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 22:19:19 +0000 Subject: [erlang-questions] Quasiquotations or Lisp-style Erlang macros In-Reply-To: <3dbc6d1c0711201411g7df3e4d5yb38d5a906f71f1ef@mail.gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <3dbc6d1c0711201411g7df3e4d5yb38d5a906f71f1ef@mail.gmail.com> Message-ID: I don't think there's a way to introduce quasiquotations into Erlang without hacking the parser, is there? On Nov 20, 2007, at 10:11 PM, Robert Virding wrote: > On 20/11/2007, Joel Reymont wrote: >> >> >> Lisp macros, oh, how I miss you!/ >> >> Thanks, Joel > > > Actually I'm seriously thinking about this. :-) > > Robert -- http://wagerlabs.com From rvirding@REDACTED Wed Nov 21 00:11:27 2007 From: rvirding@REDACTED (Robert Virding) Date: Wed, 21 Nov 2007 00:11:27 +0100 Subject: [erlang-questions] Quasiquotations or Lisp-style Erlang macros In-Reply-To: References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <3dbc6d1c0711201411g7df3e4d5yb38d5a906f71f1ef@mail.gmail.com> Message-ID: <3dbc6d1c0711201511t61928f88o83d48ef9723779ce@mail.gmail.com> No, I was thinking more along the lines of having a proper lisp syntax. Really only two questions that need resolving: - base it on Common Lisp or Scheme - how to write intermodule calls without infix operators ( ':' is an operator in normal Erlang) N.B. It wouldn't BE a CL or Scheme but Erlang with lisp syntax! Robert On 20/11/2007, Joel Reymont wrote: > > I don't think there's a way to introduce quasiquotations into Erlang > without hacking the parser, is there? > > On Nov 20, 2007, at 10:11 PM, Robert Virding wrote: > > > On 20/11/2007, Joel Reymont wrote: > >> > >> > >> Lisp macros, oh, how I miss you!/ > >> > >> Thanks, Joel > > > > > > Actually I'm seriously thinking about this. :-) > > > > Robert > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Wed Nov 21 00:36:06 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Nov 2007 23:36:06 +0000 Subject: [erlang-questions] Quasiquotations or Lisp-style Erlang macros In-Reply-To: <3dbc6d1c0711201511t61928f88o83d48ef9723779ce@mail.gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <3dbc6d1c0711201411g7df3e4d5yb38d5a906f71f1ef@mail.gmail.com> <3dbc6d1c0711201511t61928f88o83d48ef9723779ce@mail.gmail.com> Message-ID: <87E5D5BC-116F-47EA-A83A-CC1C7E027202@gmail.com> On Nov 20, 2007, at 11:11 PM, Robert Virding wrote: > - base it on Common Lisp or Scheme Scheme of course. > - how to write intermodule calls without infix operators ( ':' is an > operator in normal Erlang) > > N.B. It wouldn't BE a CL or Scheme but Erlang with lisp syntax! So what would factorial or some small concurrent program look like? Thanks, Joel -- http://wagerlabs.com From bengt.kleberg@REDACTED Wed Nov 21 09:30:36 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Nov 2007 09:30:36 +0100 Subject: [erlang-questions] Problem parsing Erlang code In-Reply-To: <48DD977F-4C1F-4938-86A8-226453BC8233@gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <474316B4.1030805@lshift.net> <48DD977F-4C1F-4938-86A8-226453BC8233@gmail.com> Message-ID: <4743ECAC.9030109@ericsson.com> greetings, i have a pretty printer built on top of erl_pp that can handle partial functions. interested? bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/20/07 18:33, Joel Reymont wrote: > Foot in mouth! Thank you Sean and Tony, it works with the dot! > > Now, suppose I wanted to pretty print the code with the semicolon at > the end. > > How would I do that? > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From mickael.remond@REDACTED Wed Nov 21 11:27:08 2007 From: mickael.remond@REDACTED (=?UTF-8?Q?Micka=C3=ABl_R=C3=A9mond?=) Date: Wed, 21 Nov 2007 11:27:08 +0100 Subject: [erlang-questions] Ejabberd and Erlang users meeting in New York City Message-ID: <8E2878EE-9BFD-4D0C-AC51-FC01081BA189@process-one.net> Hello, I will be in New York City (USA) next week and I though it will be a good opportunity to meet ejabberd users and Erlang developers in the area. We can meet in a pub in Manhattan on monday 26th of november 2007 for example. If you are interested to join, please drop me a private mail. If you know a good place in New -York to hold this meeting, please let me know. I hope to see numerous passionate ejabberd and Erlang users there and to share thoughts, idea on your development, projects or questions about the language or the instant messaging platform. Cheers, -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Wed Nov 21 15:37:08 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 21 Nov 2007 14:37:08 +0000 Subject: [erlang-questions] Bug? Pretty-printing floating point values Message-ID: <14D5E0E9-34AD-49CA-8262-F0952A8D2393@gmail.com> I see {float,1,6.30000} in the AST but 6.29999999999999982236 is pretty-printed. Is this a bug? Is there a workaround? Thanks, Joel -- http://wagerlabs.com From ulf@REDACTED Wed Nov 21 16:08:46 2007 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 21 Nov 2007 16:08:46 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> Message-ID: <8209f740711210708q79561da9g108c6a7a4d57bfe2@mail.gmail.com> I've now written two blog articles on the subject. http://ulf.wiger.net/weblog/?p=8 http://ulf.wiger.net/weblog/?p=9 The code is also available at http://svn.ulf.wiger.net/ext_shell/trunk BR, Ulf W From chsu79@REDACTED Wed Nov 21 16:12:45 2007 From: chsu79@REDACTED (Christian S) Date: Wed, 21 Nov 2007 16:12:45 +0100 Subject: [erlang-questions] Bug? Pretty-printing floating point values In-Reply-To: <14D5E0E9-34AD-49CA-8262-F0952A8D2393@gmail.com> References: <14D5E0E9-34AD-49CA-8262-F0952A8D2393@gmail.com> Message-ID: Doesn't look like the number of significant digits when read are stored. I wouldn't call it a bug. It is how floating point numbers work. They're very exact with fractions that are a sum of limited numbers of negative powers of two though. 2007/11/21, Joel Reymont : > I see {float,1,6.30000} in the AST but 6.29999999999999982236 is > pretty-printed. > > Is this a bug? Is there a workaround? From per@REDACTED Wed Nov 21 17:59:19 2007 From: per@REDACTED (Per Hedeland) Date: Wed, 21 Nov 2007 17:59:19 +0100 (CET) Subject: [erlang-questions] Bug? Pretty-printing floating point values In-Reply-To: Message-ID: <200711211659.lALGxJNW050591@pluto.hedeland.org> "Christian S" wrote: > >Doesn't look like the number of significant digits when read are stored. Undoubtedly true, but not necessarily relevant. >I wouldn't call it a bug. It is how floating point numbers work. >They're very exact with fractions that are a sum of limited numbers of >negative powers of two though. A reasonable question could be why float_to_list/1 generates 20 digits when a 64-bit float (a.k.a. C double), which is what is used internally, only can hold 15-16 worth of them - I don't know off-hand what a 128-bit float would have, but presumably significantly more than 20, so it's not that either. I guess way back in the dark ages, someone thought that 20 was a nice and even number (I hope it wasn't me:-). The 6.30000 form is of course just the ~p/~w formatting. --Per Hedeland Eshell V5.5.5 (abort with ^G) 1> F=6.30000000000000000000000000000. 6.30000 2> float_to_list(F). "6.29999999999999982236e+00" 3> io:format("~p~n",[F]). 6.30000 ok 4> io:format("~.16g~n",[F]). 6.300000000000000 ok 5> io:format("~.17g~n",[F]). 6.2999999999999998 ok From mateuszb@REDACTED Wed Nov 21 18:05:15 2007 From: mateuszb@REDACTED (Mateusz Berezecki) Date: Wed, 21 Nov 2007 18:05:15 +0100 Subject: [erlang-questions] how: ssh_sftpd/ssh_sftp question Message-ID: <9754AA0E-DDFF-4513-9192-EB31E3CDFAB5@gmail.com> Hello list readers, I have a problem with ssh_sftpd/ssh_sftp pair. The following code does not work as expected... 1> crypto:start(). ok 2> ssh:start(). ok 3> ssh_sftpd:listen(1234). {ok,<0.46.0>} 4> ssh_sftp:connect("127.0.0.1", 1234, []). {error,{error,{error,closed}}} =ERROR REPORT==== 21-Nov-2007::18:04:27 === ** Generic server <0.54.0> terminating ** Last message in was {'EXIT',<0.47.0>,{error,enoent}} ** When Server state == {state,server,<0.47.0>,19,[], [{<0.56.0>,#Ref<0.0.0.127>}], 0,[],[],undefined} ** Reason for termination == ** {error,enoent} 5> Can somebody explain to me how to properly establish a working connection ? regards, Mateusz Berezecki From dfeustel@REDACTED Wed Nov 21 19:58:56 2007 From: dfeustel@REDACTED (dfeustel@REDACTED) Date: Wed, 21 Nov 2007 19:58:56 +0100 (CET) Subject: [erlang-questions] Erlang for GPUs Message-ID: <200711211858.lALIwuMG018748@morgoth.cslab.ericsson.net> Are there any Erlang Compilers that generate code for upcoming GPUs from Nvidia and ATI? Thanks, Dave Feustel From mogorman@REDACTED Wed Nov 21 20:10:31 2007 From: mogorman@REDACTED (mog) Date: Wed, 21 Nov 2007 13:10:31 -0600 Subject: [erlang-questions] Erlang for GPUs In-Reply-To: <200711211858.lALIwuMG018748@morgoth.cslab.ericsson.net> References: <200711211858.lALIwuMG018748@morgoth.cslab.ericsson.net> Message-ID: <1195672232.4764.4.camel@metalman.lan> On Wed, 2007-11-21 at 19:58 +0100, dfeustel@REDACTED wrote: > Are there any Erlang Compilers that generate code for > upcoming GPUs from Nvidia and ATI? No. however there was ecomp, http://www.erlang.se/euc/00/processor.ppt , which was a erlang vm for an fpga, however, it was never released to the public :(, i think we should continue to poll ericcson and erlang team to release it. Please!!! Mog -------------- 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 exta7@REDACTED Wed Nov 21 20:29:11 2007 From: exta7@REDACTED (Zvi) Date: Wed, 21 Nov 2007 11:29:11 -0800 (PST) Subject: [erlang-questions] Bug? Pretty-printing floating point values In-Reply-To: <200711211659.lALGxJNW050591@pluto.hedeland.org> References: <14D5E0E9-34AD-49CA-8262-F0952A8D2393@gmail.com> <200711211659.lALGxJNW050591@pluto.hedeland.org> Message-ID: <13884355.post@talk.nabble.com> Hi, at least my C++ compiler (MSVC++) has thease 2 defines in #include #define DBL_DIG 15 /* # of decimal digits of precision */ #define FLT_DIG 6 /* # of decimal digits of precision */ Zvi Per Hedeland wrote: > > "Christian S" wrote: >> >>Doesn't look like the number of significant digits when read are stored. > > Undoubtedly true, but not necessarily relevant. > >>I wouldn't call it a bug. It is how floating point numbers work. >>They're very exact with fractions that are a sum of limited numbers of >>negative powers of two though. > > A reasonable question could be why float_to_list/1 generates 20 digits > when a 64-bit float (a.k.a. C double), which is what is used internally, > only can hold 15-16 worth of them - I don't know off-hand what a 128-bit > float would have, but presumably significantly more than 20, so it's not > that either. I guess way back in the dark ages, someone thought that 20 > was a nice and even number (I hope it wasn't me:-). The 6.30000 form is > of course just the ~p/~w formatting. > > --Per Hedeland > > Eshell V5.5.5 (abort with ^G) > 1> F=6.30000000000000000000000000000. > 6.30000 > 2> float_to_list(F). > "6.29999999999999982236e+00" > 3> io:format("~p~n",[F]). > 6.30000 > ok > 4> io:format("~.16g~n",[F]). > 6.300000000000000 > ok > 5> io:format("~.17g~n",[F]). > 6.2999999999999998 > ok > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/Bug--Pretty-printing-floating-point-values-tf4850658.html#a13884355 Sent from the Erlang Questions mailing list archive at Nabble.com. From doug.currie@REDACTED Wed Nov 21 21:37:51 2007 From: doug.currie@REDACTED (Doug Currie) Date: Wed, 21 Nov 2007 15:37:51 -0500 Subject: [erlang-questions] Bug? Pretty-printing floating point values In-Reply-To: <200711211659.lALGxJNW050591@pluto.hedeland.org> References: <200711211659.lALGxJNW050591@pluto.hedeland.org> Message-ID: <1501003071.20071121153751@gmail.com> On Wednesday, November 21, 2007 Per Hedeland wrote: > that either. I guess way back in the dark ages, someone thought that 20 > was a nice and even number (I hope it wasn't me:-). The 6.30000 form is > of course just the ~p/~w formatting. Have you considered using some form of the dragon algorithm? See: http://portal.acm.org/citation.cfm?id=989431 http://portal.acm.org/citation.cfm?id=93557 implementations: http://www.cs.indiana.edu/~burger/fp/ http://netlib.bell-labs.com/netlib/fp/ e -- Doug Currie Londonderry, NH, USA From matthew@REDACTED Thu Nov 22 00:11:11 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 21 Nov 2007 15:11:11 -0800 Subject: [erlang-questions] clarify: Erlang syntax, unbound variables, and parse transforms Message-ID: According to section 6.2 of the Erlang Reference Manual, ``[u]nbound variables are only allowed in patterns.'' Whether this restriction is part of Erlang's syntax or its semantics is unclear to me; in particular, I would like to know how it interacts with parse transforms. Right now, the Erlang compiler accepts .erl files with unbound or universal variables in non-pattern contexts, as long as they are removed by applying parse transforms. Is it safe to rely on this behavior? For example, I posted a module that transforms '~'(Pattern = Expr) to case Expr of Pattern -> true; _ -> false end. I chose the '~'(Pattern = Expr) syntax after reading section 4 of the ERTS User's Guide and finding that an abstract format for universal variables is only defined in pattern contexts (such as the left-hand side of a match expression). Later, I rewrote the module to allow '~'(Expr, Pattern1, Pattern2, ..., PatternN), but I am unsure whether this is valid. Another example (motivated by [1] and [2]), the module below transforms cut(ExprList) to fun(X_1, X_2, ..., X_N) -> ExprList end where each universal variable in ExprList in a non-pattern context is replaced with X_i; e.g., cut(_ + 3 * _) transforms to fun(X_1, X_2) -> X_1 + 3 * X_2 end. Thanks. [1] http://debasishg.blogspot.com/2007/11/erlang-string-lambdas.html [2] http://srfi.schemers.org/srfi-26/srfi-26.html %% @copyright 2007 Mochi Media, Inc. %% @author Matthew Dempsky %% %% @doc Module implementing a parse transform adding support for a %% cut(ExprList) syntax. -module(cut_pt). -author(matthew@REDACTED). -export([parse_transform/2]). -define(KEY, 'cut_pt:gensym'). parse_transform(Forms, _Options) -> NewForms = erl_syntax:revert_forms( [erl_syntax_lib:map(fun transform/1, F) || F <- Forms]), erase(?KEY), NewForms. transform(Form) -> case erl_syntax:type(Form) of application -> Operator = erl_syntax:application_operator(Form), case erl_syntax:type(Operator) of atom -> case erl_syntax:atom_value(Operator) of cut -> ExprList = erl_syntax:application_arguments(Form), doit(ExprList); _ -> Form end; _ -> Form end; _ -> Form end. doit(ExprList) -> {NewExprList, Acc} = lists:mapfoldl(fun doit_1/2, [], ExprList), erl_syntax:fun_expr( [erl_syntax:clause(lists:reverse(Acc), none, NewExprList)]). doit_1(Expr, Acc) -> case erl_syntax:type(Expr) of underscore -> Variable = erl_syntax:variable(gensym()), {Variable, [Variable | Acc]}; match_expr -> Pattern = erl_syntax:match_expr_pattern(Expr), Body = erl_syntax:match_expr_body(Expr), {NewBody, NewAcc} = erl_syntax_lib:mapfold_subtrees(fun doit_1/2, Acc, Body), {erl_syntax:match_expr(Pattern, NewBody), NewAcc}; clause -> Patterns = erl_syntax:clause_patterns(Expr), Guard = erl_syntax:clause_guard(Expr), Body = erl_syntax:clause_body(Expr), {NewGuard, NewAcc1} = doit_1(Guard, Acc), {NewBody, NewAcc2} = lists:mapfoldl(fun doit_1/2, NewAcc1, Body), {erl_syntax:clause(Patterns, NewGuard, NewBody), NewAcc2}; _ -> erl_syntax_lib:mapfold_subtrees(fun doit_1/2, Acc, Expr) end. gensym() -> N = case get(?KEY) of undefined -> 1; V -> V end, put(?KEY, N + 1), "cut_pt:var_" ++ integer_to_list(N). From michael.regen@REDACTED Thu Nov 22 04:43:35 2007 From: michael.regen@REDACTED (Michael Regen) Date: Thu, 22 Nov 2007 04:43:35 +0100 Subject: [erlang-questions] how: ssh_sftpd/ssh_sftp question In-Reply-To: <9754AA0E-DDFF-4513-9192-EB31E3CDFAB5@gmail.com> References: <9754AA0E-DDFF-4513-9192-EB31E3CDFAB5@gmail.com> Message-ID: <9b59d0270711211943y2fb896fn92d51b25a75aba9d@mail.gmail.com> On Nov 21, 2007 6:05 PM, Mateusz Berezecki wrote: > Hello list readers, > > > I have a problem with ssh_sftpd/ssh_sftp pair. > The following code does not work as expected... > > > 1> crypto:start(). > ok > 2> ssh:start(). > ok > 3> ssh_sftpd:listen(1234). > {ok,<0.46.0>} > 4> ssh_sftp:connect("127.0.0.1", 1234, []). > {error,{error,{error,closed}}} > > =ERROR REPORT==== 21-Nov-2007::18:04:27 === > ** Generic server <0.54.0> terminating > ** Last message in was {'EXIT',<0.47.0>,{error,enoent}} > ** When Server state == {state,server,<0.47.0>,19,[], > [{<0.56.0>,#Ref<0.0.0.127>}], > 0,[],[],undefined} > ** Reason for termination == > ** {error,enoent} > 5> > > > Can somebody explain to me how to properly establish a working > connection ? I never tried with ssh_sftpd only with ssh_sshd. But sftpd will need access to certificate files as sshd needs them and should work very similar to sshd. Therefore the following post might bring you a bit closer to a solution: http://forum.trapexit.org/mailinglists/viewtopic.php?t=10439 In addition you will probably need to set the cwd option. Cheers, Michael From jeffm@REDACTED Thu Nov 22 05:09:04 2007 From: jeffm@REDACTED (jm) Date: Thu, 22 Nov 2007 15:09:04 +1100 Subject: [erlang-questions] how: destination address of receiving connection Message-ID: <474500E0.7090409@ghostgun.com> In order to do a proof of concept to see if an idea is feasable using an unmodified client I need to, preferably using one machine, 1) redirect outgoing connections from the unmodified client program to a local port without changing the destination address (some how in iptables?). 2) terminate the tcp connection so that the packets can be inspected, 3) connect to the originally intended destination (cannot be determined ahead of time and is not it the data/payload sent by the client). 4) pass data back and forth through this proxied connection 5) not interfer with (pass through) any other packets. the platform this is being done on is (debian) Linux. Originally I thought step 1 could be done with iptables redirect target, but this changes the destination address of the packet. This is in the man pages and has been confirmed with a quick experiment with tcpdump and iptables. Can anyone suggest how I might accomplish this with out having to go nuts with your own tcp/ip stack? For step 2, I was thinking of using a simple tcp server based on http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles then somehow determine the orginal destination (step 3) with some form of call to the socket. Is the following from http://www.erlang.org/doc/man/inet.html sockname(Socket) -> {ok, {Address, Port}} | {error, posix()} Types: Socket = socket() Address = ip_address() Port = int() Returns the local address and port number for a socket. extracted from the packet or elsewhere? Once this is done the "remainder is easy". I could probable confirm most of what I'm talking about if I wasn't stuck at step 1. Jeff. From billrobertson42@REDACTED Thu Nov 22 04:31:14 2007 From: billrobertson42@REDACTED (Bill Robertson) Date: Wed, 21 Nov 2007 19:31:14 -0800 (PST) Subject: [erlang-questions] DTrace Redux Message-ID: <219688.45068.qm@web51903.mail.re2.yahoo.com> I ran across the recent discussion on dtrace here (nabble archive: http://www.nabble.com/DTrace-for-Erlang-t4799640.html). I think it would be an excellent idea because it lets you track from your erlang down into the code of the VM and then even into the kernel. I recently attended a Sun seminar on DTrace and they claimed that using DTrace they were able to get a 50% performance improvement between the Java 5 and Java 6 VM's. Although I don't honestly know if that required dtrace instrumentation at the Jave language level. There is a Google Tech Talk on DTrace. The speaker is the creator of DTrace, and he states that they are willing to help other groups integrate DTrace into other virtual machines. So you ought to take them up on that offer if you're interested. The video is here if you have not seen it. http://video.google.com/videoplay?docid=-8002801113289007228&q=dtrace&total=8&start=0&num=10&so=0&type=search&plindex=0 Thanks for reading. ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs -------------- next part -------------- An HTML attachment was scrubbed... URL: From luke@REDACTED Thu Nov 22 07:42:05 2007 From: luke@REDACTED (LUKE) Date: Thu, 22 Nov 2007 14:42:05 +0800 Subject: [erlang-questions] programming with sockets Message-ID: <23D48A4D21CF40108924ADB7AAA1FD6A@lukeserver> The first version will stop to receive data. 30> redir:start(8001,www.program.com.tw,80). <0.27388.1> When i connect to 127.0.0.1 8001. 31> 3.closed But the next code can work correctly. ============================================================ -module(redir). -export([start/3,accept/3,doLocalRecv/2,doRemoteRecv/2,disPatch/3]). -define(TCP_OPTIONS,[list, {packet, 0}, {active, false}, {reuseaddr, true}]). start(LPort,RHost,RPort)-> case gen_tcp:listen(LPort,?TCP_OPTIONS) of {ok, ListenSocket}->spawn(redir,accept,[ListenSocket,RHost,RPort]); {error,Why}->io:format("socket error0:~p~n",[Why]) end. accept(ListenSocket,RHost,RPort) -> case gen_tcp:accept(ListenSocket) of {ok, AcceptSocket}->spawn(redir,disPatch,[AcceptSocket,RHost,RPort]); {error,Why}->io:format("socket error1:~p~n",[Why]) end, accept(ListenSocket,RHost,RPort). disPatch(AcceptSocket,RHost,RPort)-> case gen_tcp:connect(RHost,RPort,?TCP_OPTIONS) of %% ConnectSocket:server to remote ;AcceptSocket:client to server {ok,ConnectSocket}-> spawn(redir,doRemoteRecv,[ConnectSocket,AcceptSocket]), spawn(redir,doLocalRecv,[AcceptSocket,ConnectSocket]); {error,Reason}->io:format("1.~p~n",[Reason]) end. doLocalRecv(AcceptSocket,ConnectSocket) -> case gen_tcp:recv(AcceptSocket,0) of {ok,Packet} ->gen_tcp:send(ConnectSocket,Packet),doLocalRecv(AcceptSocket,ConnectSocket); {error,Reason}->io:format("2.~p~n",[Reason]) end. doRemoteRecv(ConnectSocket,AcceptSocket)-> case gen_tcp:recv(ConnectSocket,0) of {ok,Packet} ->gen_tcp:send(AcceptSocket,Packet),doRemoteRecv(ConnectSocket,AcceptSocket); {error,Reason}->io:format("3.~p~n",[Reason]) end. ============================================================ -module(redir). -export([start/3,accept/3,doLocalRecv/2,doRemoteRecv/2]). -define(TCP_OPTIONS,[list, {packet, 0}, {active, false}, {reuseaddr, true}]). start(LPort,RHost,RPort)-> case gen_tcp:listen(LPort,?TCP_OPTIONS) of {ok, ListenSocket}-> case gen_tcp:connect(RHost,RPort,?TCP_OPTIONS) of %% ConnectSocket:server to remote ;AcceptSocket:client to server {ok,ConnectSocket}-> spawn(redir,doRemoteRecv,[ConnectSocket,AcceptSocket]), spawn(redir,doLocalRecv,[AcceptSocket,ConnectSocket]); {error,Reason}->io:format("1.~p~n",[Reason]) end; {error,Why}->io:format("socket error0:~p~n",[Why]) end. accept(ListenSocket,RHost,RPort) -> case gen_tcp:accept(ListenSocket) of {ok, AcceptSocket}->spawn(redir,disPatch,[AcceptSocket,RHost,RPort]); {error,Why}->io:format("socket error1:~p~n",[Why]) end, accept(ListenSocket,RHost,RPort). doLocalRecv(AcceptSocket,ConnectSocket) -> case gen_tcp:recv(AcceptSocket,0) of {ok,Packet} ->gen_tcp:send(ConnectSocket,Packet),doLocalRecv(AcceptSocket,ConnectSocket); {error,Reason}->io:format("2.~p~n",[Reason]) end. doRemoteRecv(ConnectSocket,AcceptSocket)-> case gen_tcp:recv(ConnectSocket,0) of {ok,Packet} ->gen_tcp:send(AcceptSocket,Packet),doRemoteRecv(ConnectSocket,AcceptSocket); {error,Reason}->io:format("3.~p~n",[Reason]) end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Thu Nov 22 08:32:23 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 22 Nov 2007 08:32:23 +0100 Subject: [erlang-questions] clarify: Erlang syntax, unbound variables, and parse transforms In-Reply-To: References: Message-ID: <95be1d3b0711212332t2c8d2083wa17c50192810c66b@mail.gmail.com> Hi! On Nov 22, 2007 12:11 AM, Matthew Dempsky wrote: > According to section 6.2 of the Erlang Reference Manual, ``[u]nbound > variables are only allowed in patterns.'' Whether this restriction is > part of Erlang's syntax or its semantics is unclear to me; in > particular, I would like to know how it interacts with parse > transforms. The Erlang compiler is only aware of the code's structure *after* the parse transforms are applied, so the only restriction for "before parse transforms" is the syntax. best regards, Vlad From raimo+erlang-questions@REDACTED Thu Nov 22 09:05:52 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 22 Nov 2007 09:05:52 +0100 Subject: [erlang-questions] : Bug? Pretty-printing floating point values In-Reply-To: <200711211659.lALGxJNW050591@pluto.hedeland.org> References: <200711211659.lALGxJNW050591@pluto.hedeland.org> Message-ID: <20071122080552.GA25535@erix.ericsson.se> I guess float_to_list/1 produces 20 digits because previously the external term format for floats was that kind of printout - 20 decimal digits with exponent. Nowdays it is the IEEE format. And I guess it was chosen so you kind of could guarantee to be able to recreated exactly the right number after a roundtrip to external format. Therefore significantly more than 16 digits was needed. I do not know if 20 digits can be proved to be always enough, though... On Wed, Nov 21, 2007 at 05:59:19PM +0100, Per Hedeland wrote: > "Christian S" wrote: > > > >Doesn't look like the number of significant digits when read are stored. > > Undoubtedly true, but not necessarily relevant. > > >I wouldn't call it a bug. It is how floating point numbers work. > >They're very exact with fractions that are a sum of limited numbers of > >negative powers of two though. > > A reasonable question could be why float_to_list/1 generates 20 digits > when a 64-bit float (a.k.a. C double), which is what is used internally, > only can hold 15-16 worth of them - I don't know off-hand what a 128-bit > float would have, but presumably significantly more than 20, so it's not > that either. I guess way back in the dark ages, someone thought that 20 > was a nice and even number (I hope it wasn't me:-). The 6.30000 form is > of course just the ~p/~w formatting. > > --Per Hedeland > > Eshell V5.5.5 (abort with ^G) > 1> F=6.30000000000000000000000000000. > 6.30000 > 2> float_to_list(F). > "6.29999999999999982236e+00" > 3> io:format("~p~n",[F]). > 6.30000 > ok > 4> io:format("~.16g~n",[F]). > 6.300000000000000 > ok > 5> io:format("~.17g~n",[F]). > 6.2999999999999998 > ok > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From olopierpa@REDACTED Thu Nov 22 12:19:29 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Thu, 22 Nov 2007 12:19:29 +0100 Subject: [erlang-questions] : Bug? Pretty-printing floating point values In-Reply-To: <20071122080552.GA25535@erix.ericsson.se> References: <200711211659.lALGxJNW050591@pluto.hedeland.org> <20071122080552.GA25535@erix.ericsson.se> Message-ID: <7352e43a0711220319u27c60514x57d3e00044ab8ea0@mail.gmail.com> On Nov 22, 2007 9:05 AM, Raimo Niskanen wrote: > I guess float_to_list/1 produces 20 digits because previously the > external term format for floats was that kind of printout - > 20 decimal digits with exponent. Nowdays it is the IEEE format. > > And I guess it was chosen so you kind of could guarantee to be able to > recreated exactly the right number after a roundtrip to external format. > Therefore significantly more than 16 digits was needed. > > I do not know if 20 digits can be proved to be always enough, though... The problem of printing and reading floating point numbers with the minimal number of digits to guarantee round trip invariance has been investigated and solved. See the papers and the public domain code already posted by Doug Currie. These algorithms are used in all serious common lisp and scheme implementations. It would be very smart for the Erlang implementors to borrow this public domain code. Cheers P. From alex.arnon@REDACTED Thu Nov 22 17:35:10 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Thu, 22 Nov 2007 18:35:10 +0200 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711210708q79561da9g108c6a7a4d57bfe2@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <8209f740711210708q79561da9g108c6a7a4d57bfe2@mail.gmail.com> Message-ID: <944da41d0711220835x5e22f475pf6916c31b624b465@mail.gmail.com> Hi Ulf, This looks like fantastic stuff! Can you provide the code as a patch to the standard distribution? (R11B5 or R12's snapshot?) On Nov 21, 2007 5:08 PM, Ulf Wiger wrote: > I've now written two blog articles on the subject. > > http://ulf.wiger.net/weblog/?p=8 > http://ulf.wiger.net/weblog/?p=9 > > The code is also available at http://svn.ulf.wiger.net/ext_shell/trunk > > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From luke@REDACTED Thu Nov 22 19:14:59 2007 From: luke@REDACTED (LUKE) Date: Fri, 23 Nov 2007 02:14:59 +0800 Subject: [erlang-questions] programming with sockets References: <23D48A4D21CF40108924ADB7AAA1FD6A@lukeserver> Message-ID: <4D3462451B354115A1A48966AC1122CB@lukeserver> <> The first version will stop to receive data. 30> redir:start(8001,www.program.com.tw,80). <0.27388.1> When i connect to 127.0.0.1 8001. 31> 3.closed Why? But the next code can work correctly. ============================================================ -module(redir). -export([start/3,accept/3,doLocalRecv/2,doRemoteRecv/2,disPatch/3]). -define(TCP_OPTIONS,[list, {packet, 0}, {active, false}, {reuseaddr, true}]). start(LPort,RHost,RPort)-> case gen_tcp:listen(LPort,?TCP_OPTIONS) of {ok, ListenSocket}->spawn(redir,accept,[ListenSocket,RHost,RPort]); {error,Why}->io:format("socket error0:~p~n",[Why]) end. accept(ListenSocket,RHost,RPort) -> case gen_tcp:accept(ListenSocket) of {ok, AcceptSocket}->spawn(redir,disPatch,[AcceptSocket,RHost,RPort]); {error,Why}->io:format("socket error1:~p~n",[Why]) end, accept(ListenSocket,RHost,RPort). disPatch(AcceptSocket,RHost,RPort)-> case gen_tcp:connect(RHost,RPort,?TCP_OPTIONS) of %% ConnectSocket:server to remote ;AcceptSocket:client to server {ok,ConnectSocket}-> spawn(redir,doRemoteRecv,[ConnectSocket,AcceptSocket]), spawn(redir,doLocalRecv,[AcceptSocket,ConnectSocket]); {error,Reason}->io:format("1.~p~n",[Reason]) end. doLocalRecv(AcceptSocket,ConnectSocket) -> case gen_tcp:recv(AcceptSocket,0) of {ok,Packet} ->gen_tcp:send(ConnectSocket,Packet),doLocalRecv(AcceptSocket,ConnectSocket); {error,Reason}->io:format("2.~p~n",[Reason]) end. doRemoteRecv(ConnectSocket,AcceptSocket)-> case gen_tcp:recv(ConnectSocket,0) of {ok,Packet} ->gen_tcp:send(AcceptSocket,Packet),doRemoteRecv(ConnectSocket,AcceptSocket); {error,Reason}->io:format("3.~p~n",[Reason]) end. ========================================================================= -module(redir). -export([start/3,accept/3,doLocalRecv/2,doRemoteRecv/2]). -define(TCP_OPTIONS,[list, {packet, 0}, {active, false}, {reuseaddr, true}]). start(LPort,RHost,RPort)-> case gen_tcp:listen(LPort,?TCP_OPTIONS) of {ok, ListenSocket}->spawn(redir,accept,[ListenSocket,RHost,RPort]); {error,Why}->io:format("socket error0:~p~n",[Why]) end. accept(ListenSocket,RHost,RPort) -> case gen_tcp:accept(ListenSocket) of {ok, AcceptSocket}-> case gen_tcp:connect(RHost,RPort,?TCP_OPTIONS) of %% ConnectSocket:server to remote ;AcceptSocket:client to server {ok,ConnectSocket}-> spawn(redir,doRemoteRecv,[ConnectSocket,AcceptSocket]), spawn(redir,doLocalRecv,[AcceptSocket,ConnectSocket]); {error,Reason}->io:format("1.~p~n",[Reason]) end; {error,Why}->io:format("socket error1:~p~n",[Why]) end, accept(ListenSocket,RHost,RPort). doLocalRecv(AcceptSocket,ConnectSocket) -> case gen_tcp:recv(AcceptSocket,0) of {ok,Packet} ->gen_tcp:send(ConnectSocket,Packet),doLocalRecv(AcceptSocket,ConnectSocket); {error,Reason}->io:format("2.~p~n",[Reason]) end. doRemoteRecv(ConnectSocket,AcceptSocket)-> case gen_tcp:recv(ConnectSocket,0) of {ok,Packet} ->gen_tcp:send(AcceptSocket,Packet),doRemoteRecv(ConnectSocket,AcceptSocket); {error,Reason}->io:format("3.~p~n",[Reason]) end. ----- Original Message ----- From: LUKE To: erlang-questions@REDACTED Sent: Thursday, November 22, 2007 2:42 PM Subject: [erlang-questions] programming with sockets The first version will stop to receive data. 30> redir:start(8001,www.program.com.tw,80). <0.27388.1> When i connect to 127.0.0.1 8001. 31> 3.closed But the next code can work correctly. ============================================================ -module(redir). -export([start/3,accept/3,doLocalRecv/2,doRemoteRecv/2,disPatch/3]). -define(TCP_OPTIONS,[list, {packet, 0}, {active, false}, {reuseaddr, true}]). start(LPort,RHost,RPort)-> case gen_tcp:listen(LPort,?TCP_OPTIONS) of {ok, ListenSocket}->spawn(redir,accept,[ListenSocket,RHost,RPort]); {error,Why}->io:format("socket error0:~p~n",[Why]) end. accept(ListenSocket,RHost,RPort) -> case gen_tcp:accept(ListenSocket) of {ok, AcceptSocket}->spawn(redir,disPatch,[AcceptSocket,RHost,RPort]); {error,Why}->io:format("socket error1:~p~n",[Why]) end, accept(ListenSocket,RHost,RPort). disPatch(AcceptSocket,RHost,RPort)-> case gen_tcp:connect(RHost,RPort,?TCP_OPTIONS) of %% ConnectSocket:server to remote ;AcceptSocket:client to server {ok,ConnectSocket}-> spawn(redir,doRemoteRecv,[ConnectSocket,AcceptSocket]), spawn(redir,doLocalRecv,[AcceptSocket,ConnectSocket]); {error,Reason}->io:format("1.~p~n",[Reason]) end. doLocalRecv(AcceptSocket,ConnectSocket) -> case gen_tcp:recv(AcceptSocket,0) of {ok,Packet} ->gen_tcp:send(ConnectSocket,Packet),doLocalRecv(AcceptSocket,ConnectSocket); {error,Reason}->io:format("2.~p~n",[Reason]) end. doRemoteRecv(ConnectSocket,AcceptSocket)-> case gen_tcp:recv(ConnectSocket,0) of {ok,Packet} ->gen_tcp:send(AcceptSocket,Packet),doRemoteRecv(ConnectSocket,AcceptSocket); {error,Reason}->io:format("3.~p~n",[Reason]) end. ============================================================ -module(redir). -export([start/3,accept/3,doLocalRecv/2,doRemoteRecv/2]). -define(TCP_OPTIONS,[list, {packet, 0}, {active, false}, {reuseaddr, true}]). start(LPort,RHost,RPort)-> case gen_tcp:listen(LPort,?TCP_OPTIONS) of {ok, ListenSocket}-> case gen_tcp:connect(RHost,RPort,?TCP_OPTIONS) of %% ConnectSocket:server to remote ;AcceptSocket:client to server {ok,ConnectSocket}-> spawn(redir,doRemoteRecv,[ConnectSocket,AcceptSocket]), spawn(redir,doLocalRecv,[AcceptSocket,ConnectSocket]); {error,Reason}->io:format("1.~p~n",[Reason]) end; {error,Why}->io:format("socket error0:~p~n",[Why]) end. accept(ListenSocket,RHost,RPort) -> case gen_tcp:accept(ListenSocket) of {ok, AcceptSocket}->spawn(redir,disPatch,[AcceptSocket,RHost,RPort]); {error,Why}->io:format("socket error1:~p~n",[Why]) end, accept(ListenSocket,RHost,RPort). doLocalRecv(AcceptSocket,ConnectSocket) -> case gen_tcp:recv(AcceptSocket,0) of {ok,Packet} ->gen_tcp:send(ConnectSocket,Packet),doLocalRecv(AcceptSocket,ConnectSocket); {error,Reason}->io:format("2.~p~n",[Reason]) end. doRemoteRecv(ConnectSocket,AcceptSocket)-> case gen_tcp:recv(ConnectSocket,0) of {ok,Packet} ->gen_tcp:send(AcceptSocket,Packet),doRemoteRecv(ConnectSocket,AcceptSocket); {error,Reason}->io:format("3.~p~n",[Reason]) end. __________ NOD32 2677 (20071122) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk ------------------------------------------------------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions __________ NOD32 2677 (20071122) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk -------------- next part -------------- An HTML attachment was scrubbed... URL: From 0x6e6562@REDACTED Thu Nov 22 21:55:39 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Thu, 22 Nov 2007 20:55:39 +0000 Subject: [erlang-questions] Offset calculation in bit syntax Message-ID: <00549F02-0244-4EB0-B95C-D9C1E21F05C5@gmail.com> Hi, I have to parse the following byte sequence where the first byte indicates the payload length if the payload length in 15 bytes or less, e.g. the 3 byte payload x01 x02 x03 will be encoded as 0x23 x01 x02 x03 with 0x23 - 0x20 = 3, the length of the payload. So when I parse it, I'd like to use a bit syntax similar to following: decode(<< Len:8/unsigned, Rest:(Len - 16#20)/unsigned>>) -> <>. But this is an illegal bit size. Is there an elegant way around this? Thx, Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From csanto@REDACTED Thu Nov 22 22:23:16 2007 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 22 Nov 2007 22:23:16 +0100 Subject: [erlang-questions] program: ANN: ROSEN, an Erlang 3D engine Message-ID: <4745F344.90902@diit.unict.it> Dear all, We would like to announce a new Erlang software that we are developing at the University of Catania. It is called ROSEN and the acronym means "RObotic Simulation Erlang eNgine". It is an erlang application/library to build 3D environments populated by simple or complex 3D objects that can also autonomously move, rotate, etc.. The final objective is to build a complete system for designing, emulating and testing mobile robotic applications. It has been briefly presented by Enzo Nicosia at EUC'07 and now the pre-alpha version is available at: http://rosen.sourceforge.net It is based on OpenGL, so don't forget to install first ESDL (http://esdl.sourceforge.net/). You may find some useful examples in the "examples" dir of the tarball. The software is at the pre-alpha stage, so please feel free to contact us for any bug and even suggestion. Enjoy! --Corrado Santoro and Enzo Nicosia -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From per@REDACTED Thu Nov 22 22:24:19 2007 From: per@REDACTED (Per Hedeland) Date: Thu, 22 Nov 2007 22:24:19 +0100 (CET) Subject: [erlang-questions] how: destination address of receiving connection In-Reply-To: <474500E0.7090409@ghostgun.com> Message-ID: <200711222124.lAMLOJXY084342@pluto.hedeland.org> jm wrote: > >Originally I thought step 1 could be done with iptables redirect target, >but this changes the destination address of the packet. This is in the >man pages and has been confirmed with a quick experiment with tcpdump >and iptables. Can anyone suggest how I might accomplish this with out >having to go nuts with your own tcp/ip stack? REDIRECT (or DNAT, but that's no advantage in this case) is surely the way to go - and changing the destination address is what it does by definition, and you won't get the packet through the ("incoming") TCP/IP stack otherwise. >For step 2, I was thinking of using a simple tcp server based on >http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles >then somehow determine the orginal destination (step 3) with some form >of call to the socket. Is the following from >http://www.erlang.org/doc/man/inet.html > > sockname(Socket) -> {ok, {Address, Port}} | {error, posix()} > > Types: > > Socket = socket() > Address = ip_address() > Port = int() > > Returns the local address and port number for a socket. > >extracted from the packet or elsewhere? For TCP, it's effectively from the packet - i.e. it's actually from the socket data structures, but you can be assured that it is the same as the destination address in the packet(s). The original destination address after REDIRECT/DNAT is not in the packet or in the receiving socket's data, but you can get it from iptables *on the host where the DNAT happened* (which is OK in your case) by using getsockopt() with SO_ORIGINAL_DST (it's in ) - don't know if it's documented anywhere, but there's always Google... I.e. an opportunity to use the RawOptReq functionality of inet:getopts/2!:-) --Per Hedeland From ulf@REDACTED Thu Nov 22 23:04:58 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 22 Nov 2007 23:04:58 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <944da41d0711220835x5e22f475pf6916c31b624b465@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <8209f740711210708q79561da9g108c6a7a4d57bfe2@mail.gmail.com> <944da41d0711220835x5e22f475pf6916c31b624b465@mail.gmail.com> Message-ID: <8209f740711221404h4cb4a4f6ye957a18fcee4dd55@mail.gmail.com> Hmm, at least not tonight, but the full modules are available at svn co http://svn.ulf.wiger.net/ext_shell/trunk/ext_shell/src/ (You can fetch them using any browser if you don't have subversion) They are based on R11B. BR, Ulf W 2007/11/22, Alex Arnon : > Hi Ulf, > > This looks like fantastic stuff! > Can you provide the code as a patch to the standard distribution? > (R11B5 or R12's snapshot?) > > > On Nov 21, 2007 5:08 PM, Ulf Wiger wrote: > > I've now written two blog articles on the subject. > > > > http://ulf.wiger.net/weblog/?p=8 > > http://ulf.wiger.net/weblog/?p=9 > > > > The code is also available at http://svn.ulf.wiger.net/ext_shell/trunk > > > > > > BR, > > Ulf W > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From ulf@REDACTED Thu Nov 22 23:14:36 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 22 Nov 2007 23:14:36 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711221404h4cb4a4f6ye957a18fcee4dd55@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <8209f740711210708q79561da9g108c6a7a4d57bfe2@mail.gmail.com> <944da41d0711220835x5e22f475pf6916c31b624b465@mail.gmail.com> <8209f740711221404h4cb4a4f6ye957a18fcee4dd55@mail.gmail.com> Message-ID: <8209f740711221414q72bb3e46y5728dca5da0603b6@mail.gmail.com> Oh, I should also mention that I've tried to make the changes as safe as possible. The extended shell handling is actually triggered as an evaluated command, like this: {[{call,_,{atom,_,raw_exprs}, [AbstEnv, AbstText]}],_V,_CommandN} The raw_exprs/2 function is then evaluated (and can be blocked in the restricted shell), so if there are bugs in the code that follows, it's similar to a normal crash in evaluated code. It doesn't kill the whole shell. The error handling for the output filters can and should be improved. Right now, a badly written filter can cause the shell to terminate. It should be a rather easy fix, once one decides what /should/ happen when an output filter crashes. BR, Ulf W 2007/11/22, Ulf Wiger : > Hmm, at least not tonight, but the full modules are available at > svn co http://svn.ulf.wiger.net/ext_shell/trunk/ext_shell/src/ > > (You can fetch them using any browser if you don't have subversion) > > They are based on R11B. > > BR, > Ulf W > > 2007/11/22, Alex Arnon : > > Hi Ulf, > > > > This looks like fantastic stuff! > > Can you provide the code as a patch to the standard distribution? > > (R11B5 or R12's snapshot?) > > > > > > On Nov 21, 2007 5:08 PM, Ulf Wiger wrote: > > > I've now written two blog articles on the subject. > > > > > > http://ulf.wiger.net/weblog/?p=8 > > > http://ulf.wiger.net/weblog/?p=9 > > > > > > The code is also available at http://svn.ulf.wiger.net/ext_shell/trunk > > > > > > > > > BR, > > > Ulf W > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > From robi123@REDACTED Thu Nov 22 23:48:39 2007 From: robi123@REDACTED (Robin Bhattacharyya) Date: Thu, 22 Nov 2007 14:48:39 -0800 Subject: [erlang-questions] Erlang vs Clojure Message-ID: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> This is a quick qualitative comparison of Erlang and Clojure: http://groups.google.com/group/clojure/browse_thread/thread/2a2b24ffef5d1631 Does anyone see the benefit of a Lispy version of Erlang on the JVM? Robin From roger.larsson@REDACTED Fri Nov 23 02:01:04 2007 From: roger.larsson@REDACTED (Roger Larsson) Date: Fri, 23 Nov 2007 02:01:04 +0100 Subject: [erlang-questions] program: ANN: ROSEN, an Erlang 3D engine In-Reply-To: <4745F344.90902@diit.unict.it> References: <4745F344.90902@diit.unict.it> Message-ID: <200711230201.04930.roger.larsson@norran.net> Installation worked as described in README.txt. But IMHO you should use 1> test:robot(). as an example instead of 1> test:objects(). /RogerL On torsdag 22 november 2007, Corrado Santoro wrote: > Dear all, > > We would like to announce a new Erlang software that we are developing > at the University of Catania. > > It is called ROSEN and the acronym means "RObotic Simulation Erlang > eNgine". It is an erlang application/library to build 3D environments > populated by simple or complex 3D objects that can also autonomously > move, rotate, etc.. The final objective is to build a complete system > for designing, emulating and testing mobile robotic applications. > > It has been briefly presented by Enzo Nicosia at EUC'07 and now the > pre-alpha version is available at: > > http://rosen.sourceforge.net > > It is based on OpenGL, so don't forget to install first ESDL > (http://esdl.sourceforge.net/). > > You may find some useful examples in the "examples" dir of the tarball. > > The software is at the pre-alpha stage, so please feel free to contact > us for any bug and even suggestion. > > Enjoy! > --Corrado Santoro and Enzo Nicosia From va3pip@REDACTED Fri Nov 23 03:16:23 2007 From: va3pip@REDACTED (Adam King) Date: Thu, 22 Nov 2007 21:16:23 -0500 Subject: [erlang-questions] program: ANN: ROSEN, an Erlang 3D engine In-Reply-To: <4745F344.90902@diit.unict.it> References: <4745F344.90902@diit.unict.it> Message-ID: <630340e00711221816j1e92a8ear5d5b2d44da4806b1@mail.gmail.com> Looks nice! One thing you might want to add to your readme file is a note that the user might want to add "-smp disable" to the start line. ESDL sometimes has 'issues' with smp/thread compiled erlang (at least it does for me - I get a seg fault otherwise). There's also a small note in the esdl readme about it. Cheers, Adam From bbmaj7@REDACTED Fri Nov 23 06:37:15 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Fri, 23 Nov 2007 16:37:15 +1100 (EST) Subject: [erlang-questions] String to proplist Message-ID: <540276.77351.qm@web52012.mail.re2.yahoo.com> I have a free-form options string that I want to covert to a proplist. eg. I want to convert "abc=12343, someThing=value" -> [{abc,12343}, {someThing,value}] Is there an existing mechanism to perform this conversion? If not, what would be the best way to go about it. Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail From jeffm@REDACTED Fri Nov 23 06:38:49 2007 From: jeffm@REDACTED (jm) Date: Fri, 23 Nov 2007 16:38:49 +1100 Subject: [erlang-questions] how: destination address of receiving connection In-Reply-To: <200711222124.lAMLOJXY084342@pluto.hedeland.org> References: <200711222124.lAMLOJXY084342@pluto.hedeland.org> Message-ID: <47466769.9050201@ghostgun.com> Per Hedeland wrote: > For TCP, it's effectively from the packet - i.e. it's actually from the > socket data structures, but you can be assured that it is the same as > the destination address in the packet(s). > > The original destination address after REDIRECT/DNAT is not in the > packet or in the receiving socket's data, but you can get it from > iptables *on the host where the DNAT happened* (which is OK in your > case) by using getsockopt() with SO_ORIGINAL_DST (it's in > ) - don't know if it's documented anywhere, but > there's always Google... I.e. an opportunity to use the RawOptReq > functionality of inet:getopts/2!:-) Thanks Per. Your a fountain of information on this stuff and Erlang. I was going nuts trying to workout how to avoid using libpcap and libnet or raw sockets in promiscuous for a proof of concept. I'd spent the last couple of days reading doco on all three, RFCs, and going mad. Looking at this it may be good enough to do a prototype to test with real traffic. For anyone who has a similar problem this is what I've ended up with, original_destination(Socket) -> %% /usr/include/linux/socket.h SOL_IP = 0, %% /usr/include/linux/netfilter_ipv4.h SO_ORIGINAL_DST = 80, %% sizeof(struct sockaddr_in) = 16 bytes {ok,[{raw, _, _, Info}]} = inet:getopts(Socket, [{raw, 0, 80, 16}]), <<_J:16, DPort:16/big, A:8, B:8, C:8, D:8, _Rest/binary>> = Info, DAddr = {A, B, C, D}, error_logger:info_msg("getopts return ~p ~p ~p~n", [Info, DAddr, DPort]), {DAddr, DPort}. For the one machine test I was talking about: The machine is set up with two ip adrresses eth0 192.168.1.66 eth0:0 192.168.1.67 and added these two iptable rule iptables -t nat -A OUTPUT -s 192.168.1.66 -j ACCEPT iptables -t nat -A OUTPUT -p tcp -m multiport --source-ports 30000:60000 -j REDIRECT --to-port 5002 where port 5002 is the port this program is listening on. These rules aren't great but should be good enough with a little tuning. This seems to work at least with telnet -b 192.168.1.67 someserver 80 so all that needs to be done is to bind the client to 192.168.1.67, luckily the client being used supports this. Testing a simple pass through proxy I managed to sustain about 240 connection using 3% or less of the cpu on a 2.66GHz P4. Still not a proof of concept but looking good so far. Jeff. From dgud@REDACTED Fri Nov 23 08:16:36 2007 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 23 Nov 2007 08:16:36 +0100 Subject: [erlang-questions] program: ANN: ROSEN, an Erlang 3D engine In-Reply-To: <630340e00711221816j1e92a8ear5d5b2d44da4806b1@mail.gmail.com> References: <4745F344.90902@diit.unict.it> <630340e00711221816j1e92a8ear5d5b2d44da4806b1@mail.gmail.com> Message-ID: <47467E54.408@erix.ericsson.se> Adam King wrote: > Looks nice! One thing you might want to add to your readme file is a > note that the user might want to add "-smp disable" to the start line. > ESDL sometimes has 'issues' with smp/thread compiled erlang (at least > it does for me - I get a seg fault otherwise). There's also a small > note in the esdl readme about it. Cheers, Wow, cool another esdl user now I got 4 :-) That is correct, esdl requires a single scheduler. Opengl requires all calls to be be called from the same thread that created the opengl-context, which I can't control in erlang, e.g. processes jumps around between threads. Thats changed in wxwidgets it creates it's own thread, and every call is called from that thread. It requires smp erlang (and R12) instead :-) /Dan (dgud) PS: I'm re-writing large parts of the wxWidgets port (again), adding a pointer <=> handle layer between erlang and driver so we can clean memory when processes dies or windows closes, but hopefully I'll make a new release before Christmas. The status will be the same though, needs testers and user feedback (and devs if someone have spare time and ideas). Windows, Solaris-10, Linux and Mac is up and running, at least the 4 tests I've got :-) From bengt.kleberg@REDACTED Fri Nov 23 08:22:28 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 23 Nov 2007 08:22:28 +0100 Subject: [erlang-questions] String to proplist In-Reply-To: <540276.77351.qm@web52012.mail.re2.yahoo.com> References: <540276.77351.qm@web52012.mail.re2.yahoo.com> Message-ID: <47467FB4.70204@ericsson.com> greetings, a naive version (to get you started :-) is: proplist_from_options( Options ) -> Props = string:tokens( Options, ", " ), % should give you ["abc=12343", "someThing=value"] Fun = fun (Prop) -> [Name,Value] = string:tokens( Prop, "=" ), {erlang:list_to_atom( Name ),Value} end, lists:map( Fun, Props ). expand on this by considering erlang:list_to_existing_atom/1 and if Props might contain empty ("") strings, too. Etc, etc bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/23/07 06:37, Richard Andrews wrote: > I have a free-form options string that I want to covert to a proplist. > > eg. I want to convert > > "abc=12343, someThing=value" -> [{abc,12343}, {someThing,value}] > > Is there an existing mechanism to perform this conversion? > If not, what would be the best way to go about it. > > > > > Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From csanto@REDACTED Fri Nov 23 08:38:19 2007 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 23 Nov 2007 08:38:19 +0100 Subject: [erlang-questions] program: ANN: ROSEN, an Erlang 3D engine In-Reply-To: <200711230201.04930.roger.larsson@norran.net> References: <4745F344.90902@diit.unict.it> <200711230201.04930.roger.larsson@norran.net> Message-ID: <4746836B.9000706@diit.unict.it> Roger Larsson wrote: > Installation worked as described in README.txt. > > But IMHO you should use > 1> test:robot(). > as an example instead of > 1> test:objects(). You can have more fun with 1> robot:go(). :-) Cheers, --C. -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From yarivsadan@REDACTED Fri Nov 23 08:41:08 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Thu, 22 Nov 2007 23:41:08 -0800 Subject: [erlang-questions] Quasiquotations or Lisp-style Erlang macros In-Reply-To: <3dbc6d1c0711201511t61928f88o83d48ef9723779ce@mail.gmail.com> References: <9C3B91A4-7270-45F0-B444-8B54701976C8@gmail.com> <3dbc6d1c0711201411g7df3e4d5yb38d5a906f71f1ef@mail.gmail.com> <3dbc6d1c0711201511t61928f88o83d48ef9723779ce@mail.gmail.com> Message-ID: <17244f480711222341j7dea3d72p178b1217b04bae76@mail.gmail.com> I had actually started once working on a Lispy dialect of Erlang but never got around to finishing it. It borrowed a couple of syntax features from CL but stayed very close to Erlang. The way I dealt with remote function calls is by just keeping the ':' syntax. So, to call a function you would write (file:open "foo.txt") which would be transformed by the parser to (remote-call foo open ($f $o $o $. $t $x $t)) I'm not sure if this is the best way of doing it, but seemed to work well enough with the simple parser I created. Yariv On Nov 20, 2007 3:11 PM, Robert Virding wrote: > No, I was thinking more along the lines of having a proper lisp syntax. > Really only two questions that need resolving: > > - base it on Common Lisp or Scheme > - how to write intermodule calls without infix operators ( ':' is an > operator in normal Erlang) > > N.B. It wouldn't BE a CL or Scheme but Erlang with lisp syntax! > > Robert > > > > On 20/11/2007, Joel Reymont wrote: > > I don't think there's a way to introduce quasiquotations into Erlang > > without hacking the parser, is there? > > > > On Nov 20, 2007, at 10:11 PM, Robert Virding wrote: > > > > > On 20/11/2007, Joel Reymont wrote: > > >> > > >> > > >> Lisp macros, oh, how I miss you!/ > > >> > > >> Thanks, Joel > > > > > > > > > Actually I'm seriously thinking about this. :-) > > > > > > Robert > > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vychodil.hynek@REDACTED Fri Nov 23 08:57:39 2007 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 23 Nov 2007 08:57:39 +0100 Subject: [erlang-questions] performance numbers In-Reply-To: <473C25E2.8050509@lionet.info> References: <473C25E2.8050509@lionet.info> Message-ID: <4d08db370711222357h5f27cee8j1ffcade8843aef8e@mail.gmail.com> I think, your test is wrong. You test single bottle neck code! There isn't any supprise, when smp code haven't any positive effect. Everythink what you measured is, that for single bottle neck thread code is smp enabling useless and in this task is 2.66 GHz Xeon CPU core faster than 1.5 GHz G4 and this is faster than 2.2 GHz AMD core and it is faster than sparc 650 MHz. You measured how fast one gen_server thread can lock and unlock it's internal state, that's all. I don't trust you that this is really typical load for your task. -- --Hynek (Pichi) Vychodil On 11/15/07, Lev Walkin wrote: > > Recently I went out to hunt for a best machine to run Erlang > code. I did some prototyping and created a performance testing > suite which loosely simulates the load I'll be giving it. > > Here are the numbers: > > http://lionet.info/ljimg/erlang-perf-smp-2.png > > (Unfortunately, the numbers are in tabular form not really suitable > for email. Click on the link above to have a picture). > > In short, I am surprized to see that my 650 MHz Sun machine > is TPS-competitive with four-cores (2x2) AMD 2.3 GHz. I am also > surprized to see that the best mode of compilation is non-smp, > non-hipe, non-native, single threaded code, unless the code involves > going out of VM to other systems (e.g., via TCP). > > Some words about the testing. The "Lock" test executes the > lock/unlock code, which is basically a gen_server doing something > similar to what you can read in any Erlang book: the resource > locking code. Sequential version of it does lock/unlock in sequence, > and Parallel version just runs a bunch of processes (2, 4, 8, 10, 100), > which generate a series of lock/unlock requests. > TCP I/O is essentially stress-testing an Erlang library to memcached, > which is running on the same machine. Distinction between > Sequential and Parallel modes of execution are essentially the same > as with Lock code: Parallel is N processes doing a number of > requests to library which communicates to memcached, whereas > Sequential is Parallel with N=1. There were thousands of tests > for each table cell and the best numbers are retained for the table. > > Is there anything specific you'd generally recommend to skew > these numbers in favor of AMD system? Or Xeon is really the > best choice if it comes to running Erlang code? > > -- > Lev Walkin > vlm@REDACTED > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ciprian.craciun@REDACTED Fri Nov 23 10:24:38 2007 From: ciprian.craciun@REDACTED (Ciprian Dorin Craciun) Date: Fri, 23 Nov 2007 11:24:38 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> Message-ID: <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> I would see the benefit of a Lisp-syntax-based Erlang version -- but compiled to beam... Just see the recent posts on macros and other Lisp functionalities. Ciprian. P.S.: When I say Lisp I mean the whole Lisp family, but I would incline to Scheme. On Nov 23, 2007 12:48 AM, Robin Bhattacharyya wrote: > This is a quick qualitative comparison of Erlang and Clojure: > > http://groups.google.com/group/clojure/browse_thread/thread/2a2b24ffef5d1631 > > Does anyone see the benefit of a Lispy version of Erlang on the JVM? > > Robin From joelr1@REDACTED Fri Nov 23 11:36:26 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 23 Nov 2007 10:36:26 +0000 Subject: [erlang-questions] XML parser that works on binaries Message-ID: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> Has anyone extracted the expat driver code from ejabberd? Is there another XML parser that works on binaries? Would hacking XMERL to work on binaries be a good idea? Thanks, Joel -- http://wagerlabs.com From kverma@REDACTED Fri Nov 23 12:22:33 2007 From: kverma@REDACTED (Krish Verma) Date: Fri, 23 Nov 2007 03:22:33 -0800 (PST) Subject: [erlang-questions] sinan not working In-Reply-To: <697074A35ED91748882E3850BDCE295E06C580@leenu.akumiitti.net> References: <697074A35ED91748882E3850BDCE295E06C580@leenu.akumiitti.net> Message-ID: <13910668.post@talk.nabble.com> Anyone got sinan working yet? Got faxien installed & was able to install sinan, but running sinan gives the error message as seen by Dmitri. Thanks, -k r i s h Dmitri Girenko wrote: > > Hi all, > > I've just tried to set up faxien and sinan. Faxien was ok, but sinan does > not work. > > Both installed by root into /usr/local/erlware/bin > > I get the following error: > > ~$ sinan gen > {error_logger,{{2007,11,11},{11,31,40}},"No build config found!!~n",[]} > {error_logger,{{2007,11,11},{11,31,40}},"unexpected error ~p: > ~p~n",[no_build_config,[{sin_engine,handle_build_config,2},{sin_engine,start_run,3},{sin_engine,run_engine,3},{sin_engine,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]]} > {error_logger,{{2007,11,11},{11,31,40}},"run complete~n",[]} > > looks like it's missing _build.cfg file, but I just want to create a new > OTP project from scratch.. > What did I do wrong? > > BR > Dmitri > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/sinan-not-working-tf4785350.html#a13910668 Sent from the Erlang Questions mailing list archive at Nabble.com. From bengt.kleberg@REDACTED Fri Nov 23 13:26:33 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 23 Nov 2007 13:26:33 +0100 Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <815249.27396.qm@web60513.mail.yahoo.com> References: <815249.27396.qm@web60513.mail.yahoo.com> Message-ID: <4746C6F9.4020100@ericsson.com> greetings, this is seriously off topic for erlang-questions, so i would recommend each and every one of you to stop reading now. kvw(*) is not a benchmark report. it is a paper about experiments on how to do benchmarks. they tested some ideas and reached a few general principles. the one pertinent to this discussion says "Memory-related issues and the effects of memory hierarchies are pervasive: how memory is managed, from hardware caches to garbage collection, can change runtimes dramatically". to see this it is necessary to vary the input to such an extent as to find the dramatic runtime changes. the shootout does not do this. isaac gouy has previously stated that the shootout is not, and shall not be, about the kind of wide spectrum of inputs that kvw recommends investigating. now he is instead saying that the shootout is better than what kvw recommends for this kind of investigations. this time he is wrong. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/18/07 21:59, Isaac Gouy wrote: > On 2007-09-3 Bengt Kleberg wrote: >> my main problem with the alioth shootout is that it has thrown away >> one of the main ideas/insights from the paper(*) that was the >> inspiration for the original shootout. namely that it is very >> important to look at how the timeing changes with the size of the >> input. the alioth shootout takes only 3 very similar size values. >> to make things worse these 3 values must give results for the major >> languages (no timeout, etc). > >> (*)Timing Trials, or, the Trials of Timing, >> http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html) > > >>> On 2007-08-31 20:54, Michael Campbell wrote: > -snip- >>> Be careful with that. Alioth's shootouts are for how quickly a >>> language can run a particular *algorithm*, which can at times be >>> VERY DIFFERENT from how you would normally do it in that language. >>> >>> So some of the code on that will be weirdly contorted to fit the >>> particular algorithm, rather than what the prevailing idiom is for >>> that language. >>> >>> A somewhat more harsh criticism can be found here: >>> > http://yarivsblog.com/articles/2006/07/11/erlang-yaws-vs-ruby-on-rails/#comment-70 > > > > My apologies for digging up this 2 month old comment, but sometimes I'm > just taken-aback by criticism of the benchmarks game. I'm well aware of > my limitations and value informed criticism - to a great extent we rely > on others to notice our mistakes and suggest improvements and > alternatives. > > Sometimes the criticism misleads - I never know if that's the > intention. > > > According to Bengt Kleberg "the alioth shootout takes only 3 very > similar size values" which "has thrown away one of the main > ideas/insights" of 'Timing Trials, or, the Trials of Timing'. > > Can you guess how many different input sizes were used for "Timing > Trials, or, the Trials of Timing"? Do you guess 20? Do you guess 10? > > No. The comparisons in "Timing Trials, or, the Trials of Timing" were > based on just 4 input values! The Benchmarks Game has slipped from the > insightful 4 to the miserable 3 :-) > > As for "very similiar size values" the timing range for different input > values is ~10x to ~100x, in comparison to mostly < 10x in "Timing > Trials, or, the Trials of Timing". > > > > Michael Campbell points to Yariv's Blog, and I guess to Austin > Ziegler's comment. The specific problem he raises - "... must be set > at the user?s shell [ulimit]. They do not do this and report that the > Ruby program doesn?t run" - was raised a year earlier on the Ruby > mailing-list. > > That problem was fixed by November 2005, 9 months before Austin Ziegler > ranted on Yariv's Blog - his repeated "harsh criticism" had been untrue > for 9 months and by then the ackermann benchmark he complains about had > been replaced. > > > > Rather than a general warning about wierdly contorted code, wouldn't it > be more helpful to say which of the Erlang programs you think are > wierdly contorted? > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From Dmitri.Girenko@REDACTED Fri Nov 23 14:31:14 2007 From: Dmitri.Girenko@REDACTED (Dmitri Girenko) Date: Fri, 23 Nov 2007 15:31:14 +0200 Subject: [erlang-questions] sinan not working In-Reply-To: <13910668.post@talk.nabble.com> References: <697074A35ED91748882E3850BDCE295E06C580@leenu.akumiitti.net> <13910668.post@talk.nabble.com> Message-ID: <697074A35ED91748882E3850BDCE295EC8E837@leenu.akumiitti.net> AFAIK, singen is still broken... should be fixed soon. > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Krish Verma > Sent: 23. marraskuuta 2007 13:23 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] sinan not working > > > Anyone got sinan working yet? > > Got faxien installed & was able to install sinan, but running sinan gives > the error message as seen by Dmitri. > > Thanks, > -k r i s h > > > Dmitri Girenko wrote: > > > > Hi all, > > > > I've just tried to set up faxien and sinan. Faxien was ok, but sinan > does > > not work. > > > > Both installed by root into /usr/local/erlware/bin > > > > I get the following error: > > > > ~$ sinan gen > > {error_logger,{{2007,11,11},{11,31,40}},"No build config found!!~n",[]} > > {error_logger,{{2007,11,11},{11,31,40}},"unexpected error ~p: > > > ~p~n",[no_build_config,[{sin_engine,handle_build_config,2},{sin_engine,s ta > rt_run,3},{sin_engine,run_engine,3},{sin_engine,init,1},{gen_server,init _i > t,6},{proc_lib,init_p,5}]]} > > {error_logger,{{2007,11,11},{11,31,40}},"run complete~n",[]} > > > > looks like it's missing _build.cfg file, but I just want to create a new > > OTP project from scratch.. > > What did I do wrong? > > > > BR > > Dmitri > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > View this message in context: http://www.nabble.com/sinan-not-working- > tf4785350.html#a13910668 > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf.wiger@REDACTED Fri Nov 23 14:41:14 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 23 Nov 2007 14:41:14 +0100 Subject: [erlang-questions] XML parser that works on binaries In-Reply-To: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> References: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> Message-ID: <4746D87A.2090704@ericsson.com> Joel Reymont skrev: > Has anyone extracted the expat driver code from ejabberd? > > Is there another XML parser that works on binaries? > > Would hacking XMERL to work on binaries be a good idea? > > Thanks, Joel Yes and no. The Xmerl parser is not easily hacked to work on binaries, and I think it would be a waste of time to do so. It would require touching most of the code. The right approach would be to redesign it with a proper tokenizer. It would then be fairly easy to either support two different tokenizers, or one that supports both string and binary input. Of course, this would mean a complete redesign of xmerl_scan, but that would have its advantages. I think the API can be kept and improved upon (e.g. offering a lightweight parser API that uses the same tokenizer and parser.) The quick way to do this would be e.g. to buy Joe a beer and convince him to share his xml parser code. Neither xmerl nor erlsom use a tokenizer approach, and having looked at Joe's stuff, I'm convinced that's the way to go. Meanwhile, xmerl_eventp.erl can be used to see how an xmerl wrapper can deal with binaries and hook into xmerl_scan. The trick is to use the xmerl 'fetch' hook, which is called each time xmerl needs more data. The fetch function needs to buffer input until it finds some whitespace - see xmerl_eventp:find_good_split/6. This has to do with entity expansion, if I recall correctly, so if you don't have that in your XML, it shouldn't matter... (don't take my word for it, though. It's been a few years since I last dabbled with it.) BR, Ulf W From erlang@REDACTED Fri Nov 23 15:57:37 2007 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 23 Nov 2007 15:57:37 +0100 Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <4746C6F9.4020100@ericsson.com> References: <815249.27396.qm@web60513.mail.yahoo.com> <4746C6F9.4020100@ericsson.com> Message-ID: <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> I've been following various discussions about benchmarks, and must say that I am not impressed. The general arguments seems to go like this: language A is good at X language B is good at Y language B is bad at X Therefore hack language B so that it is good at X This argument has appeared many times with different values of A B X and Y - usually by a proponent of A who because A solves X better than B assumes that A is in some sense better than B. The problem is that this argument is just plain daft. If A is good at solving X then use it to solve X. If B is good at solving Y then use it to solve Y. Suppose we change B to make it good at solving X, what have we done? - make yet another variant of A. In changing B to be good at solving X it might no longer be good at solving Y. So sure we could make Erlang a lot faster - for example to make regexps really fast all we have to do is link the C code for regexps into the Erlang kernel - but it would no longer be safe. We could make all function calls go a lot faster, but we could no longer change code on-the-fly. Anything can be speeded up - but at the cost of some other system property - I think its nonsense to assume that a single language will be good at everything. An essential part of systems analysis is knowing what languages are good for solving specific problems. Benchmarks are useful here - but they hardly tell me something I don't know already. Languages that deliberately abstract away from memory will be necessarily less efficient than languages that expose the structure of memory - but at the cost of being more difficulty to program if you need to dynamically relocate the memory or change the code ... At the end of the day you have to ask does the whole system work in a satisfactory manner, and not get hung up over the details of this little part or thing being efficient or inefficient. Scanning log files efficiently (for example) would be very important If it has to be done every few seconds - but if it is done one a year the performance is totally irrelevant. Making systems involves a lot more than making the individual bits run fast - it involves gluing the bits together in a way that is understandable - staring at the individual compensate and not seeing their relationship to the whole is a waste of time. Timing individual code is also irrelevant - the only interesting question is "is this time within my time budget" Remember what the old masters said - get it right first. Then make it fast (if you need to) - Some of our Erlang systems have become market leading and have achieved amazing figures for reliability - despite the fact that they boot slowly, have appalling performance at matching regular expressions and can't analyse giga bytes of disk logs efficiently. These latter three points are irrelevant for the types of system we build. /Joe Armstrong On Nov 23, 2007 1:26 PM, Bengt Kleberg wrote: > greetings, > > this is seriously off topic for erlang-questions, so i would recommend > each and every one of you to stop reading now. > > > kvw(*) is not a benchmark report. it is a paper about experiments on how > to do benchmarks. they tested some ideas and reached a few general > principles. the one pertinent to this discussion says "Memory-related > issues and the effects of memory hierarchies are pervasive: how memory > is managed, from hardware caches to garbage collection, can change > runtimes dramatically". to see this it is necessary to vary the input to > such an extent as to find the dramatic runtime changes. the shootout > does not do this. > > isaac gouy has previously stated that the shootout is not, and shall not > be, about the kind of wide spectrum of inputs that kvw recommends > investigating. now he is instead saying that the shootout is better than > what kvw recommends for this kind of investigations. > this time he is wrong. > > > bengt > Those were the days... > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > > > > On 11/18/07 21:59, Isaac Gouy wrote: > > On 2007-09-3 Bengt Kleberg wrote: > >> my main problem with the alioth shootout is that it has thrown away > >> one of the main ideas/insights from the paper(*) that was the > >> inspiration for the original shootout. namely that it is very > >> important to look at how the timeing changes with the size of the > >> input. the alioth shootout takes only 3 very similar size values. > >> to make things worse these 3 values must give results for the major > >> languages (no timeout, etc). > > > >> (*)Timing Trials, or, the Trials of Timing, > >> http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html) > > > > > >>> On 2007-08-31 20:54, Michael Campbell wrote: > > -snip- > >>> Be careful with that. Alioth's shootouts are for how quickly a > >>> language can run a particular *algorithm*, which can at times be > >>> VERY DIFFERENT from how you would normally do it in that language. > >>> > >>> So some of the code on that will be weirdly contorted to fit the > >>> particular algorithm, rather than what the prevailing idiom is for > >>> that language. > >>> > >>> A somewhat more harsh criticism can be found here: > >>> > > http://yarivsblog.com/articles/2006/07/11/erlang-yaws-vs-ruby-on-rails/#comment-70 > > > > > > > > My apologies for digging up this 2 month old comment, but sometimes I'm > > just taken-aback by criticism of the benchmarks game. I'm well aware of > > my limitations and value informed criticism - to a great extent we rely > > on others to notice our mistakes and suggest improvements and > > alternatives. > > > > Sometimes the criticism misleads - I never know if that's the > > intention. > > > > > > According to Bengt Kleberg "the alioth shootout takes only 3 very > > similar size values" which "has thrown away one of the main > > ideas/insights" of 'Timing Trials, or, the Trials of Timing'. > > > > Can you guess how many different input sizes were used for "Timing > > Trials, or, the Trials of Timing"? Do you guess 20? Do you guess 10? > > > > No. The comparisons in "Timing Trials, or, the Trials of Timing" were > > based on just 4 input values! The Benchmarks Game has slipped from the > > insightful 4 to the miserable 3 :-) > > > > As for "very similiar size values" the timing range for different input > > values is ~10x to ~100x, in comparison to mostly < 10x in "Timing > > Trials, or, the Trials of Timing". > > > > > > > > Michael Campbell points to Yariv's Blog, and I guess to Austin > > Ziegler's comment. The specific problem he raises - "... must be set > > at the user's shell [ulimit]. They do not do this and report that the > > Ruby program doesn't run" - was raised a year earlier on the Ruby > > mailing-list. > > > > That problem was fixed by November 2005, 9 months before Austin Ziegler > > ranted on Yariv's Blog - his repeated "harsh criticism" had been untrue > > for 9 months and by then the ackermann benchmark he complains about had > > been replaced. > > > > > > > > Rather than a general warning about wierdly contorted code, wouldn't it > > be more helpful to say which of the Erlang programs you think are > > wierdly contorted? > > > > > > ____________________________________________________________________________________ > > Never miss a thing. Make Yahoo your home page. > > http://www.yahoo.com/r/hs > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bengt.kleberg@REDACTED Fri Nov 23 16:16:32 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 23 Nov 2007 16:16:32 +0100 Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> References: <815249.27396.qm@web60513.mail.yahoo.com> <4746C6F9.4020100@ericsson.com> <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> Message-ID: <4746EED0.7020108@ericsson.com> well actually i have been trying to say that it would be nice to use the really large infrastructure of the shootout to see where different languages, relative to each other, leave the straight and narrow. speed is just a indication (ie when the speed stops being linear (or whatever it used to be) and starts being chaotic) of these limits. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/23/07 15:57, Joe Armstrong wrote: > I've been following various discussions about benchmarks, and must say > that I am not impressed. > > The general arguments seems to go like this: > > language A is good at X > language B is good at Y > language B is bad at X > > Therefore hack language B so that it is good at X > > This argument has appeared many times with different values of A B > X and Y - usually by a proponent of > A who because A solves X better than B assumes that A is in some sense > better than B. > > The problem is that this argument is just plain daft. > > If A is good at solving X then use it to solve X. If B is good at > solving Y then use it to solve Y. > > Suppose we change B to make it good at solving X, what have we done? - make > yet another variant of A. > > In changing B to be good at solving X it might no longer be good > at solving Y. > > So sure we could make Erlang a lot faster - for example to make > regexps really fast all we have to do > is link the C code for regexps into the Erlang kernel - but it would > no longer be safe. We could make all > function calls go a lot faster, but we could no longer change code on-the-fly. > > Anything can be speeded up - but at the cost of some other system > property - I think its nonsense to assume that > a single language will be good at everything. An essential part of > systems analysis is knowing what languages > are good for solving specific problems. Benchmarks are useful here - > but they hardly tell me something I don't know > already. Languages that deliberately abstract away from memory will be > necessarily less efficient than languages > that expose the structure of memory - but at the cost of being more > difficulty to program if you need to dynamically > relocate the memory or change the code ... > > At the end of the day you have to ask does the whole system work in a > satisfactory manner, and not get hung up > over the details of this little part or thing being efficient or > inefficient. Scanning log files efficiently (for example) would > be very important If it has to be done every few seconds - but if it > is done one a year the performance is totally irrelevant. > > Making systems involves a lot more than making the individual bits run > fast - it involves gluing the bits > together in a way that is understandable - staring at the individual > compensate and not seeing their relationship to the whole > is a waste of time. Timing individual code is also irrelevant - the > only interesting question is "is this time within my time budget" > > Remember what the old masters said - get it right first. Then make it > fast (if you need to) - Some of our Erlang systems have > become market leading and have achieved amazing figures for > reliability - despite the fact that they boot slowly, > have appalling performance at matching regular expressions and can't > analyse giga bytes of disk logs efficiently. > These latter three points are irrelevant for the types of system we build. > > /Joe Armstrong > > > > > > > > On Nov 23, 2007 1:26 PM, Bengt Kleberg wrote: >> greetings, >> >> this is seriously off topic for erlang-questions, so i would recommend >> each and every one of you to stop reading now. >> >> >> kvw(*) is not a benchmark report. it is a paper about experiments on how >> to do benchmarks. they tested some ideas and reached a few general >> principles. the one pertinent to this discussion says "Memory-related >> issues and the effects of memory hierarchies are pervasive: how memory >> is managed, from hardware caches to garbage collection, can change >> runtimes dramatically". to see this it is necessary to vary the input to >> such an extent as to find the dramatic runtime changes. the shootout >> does not do this. >> >> isaac gouy has previously stated that the shootout is not, and shall not >> be, about the kind of wide spectrum of inputs that kvw recommends >> investigating. now he is instead saying that the shootout is better than >> what kvw recommends for this kind of investigations. >> this time he is wrong. >> >> >> bengt >> Those were the days... >> EPO guidelines 1978: "If the contribution to the known art resides >> solely in a computer program then the subject matter is not >> patentable in whatever manner it may be presented in the claims." >> >> >> >> On 11/18/07 21:59, Isaac Gouy wrote: >>> On 2007-09-3 Bengt Kleberg wrote: >>>> my main problem with the alioth shootout is that it has thrown away >>>> one of the main ideas/insights from the paper(*) that was the >>>> inspiration for the original shootout. namely that it is very >>>> important to look at how the timeing changes with the size of the >>>> input. the alioth shootout takes only 3 very similar size values. >>>> to make things worse these 3 values must give results for the major >>>> languages (no timeout, etc). >>>> (*)Timing Trials, or, the Trials of Timing, >>>> http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html) >>> >>>>> On 2007-08-31 20:54, Michael Campbell wrote: >>> -snip- >>>>> Be careful with that. Alioth's shootouts are for how quickly a >>>>> language can run a particular *algorithm*, which can at times be >>>>> VERY DIFFERENT from how you would normally do it in that language. >>>>> >>>>> So some of the code on that will be weirdly contorted to fit the >>>>> particular algorithm, rather than what the prevailing idiom is for >>>>> that language. >>>>> >>>>> A somewhat more harsh criticism can be found here: >>>>> >>> http://yarivsblog.com/articles/2006/07/11/erlang-yaws-vs-ruby-on-rails/#comment-70 >>> >>> >>> >>> My apologies for digging up this 2 month old comment, but sometimes I'm >>> just taken-aback by criticism of the benchmarks game. I'm well aware of >>> my limitations and value informed criticism - to a great extent we rely >>> on others to notice our mistakes and suggest improvements and >>> alternatives. >>> >>> Sometimes the criticism misleads - I never know if that's the >>> intention. >>> >>> >>> According to Bengt Kleberg "the alioth shootout takes only 3 very >>> similar size values" which "has thrown away one of the main >>> ideas/insights" of 'Timing Trials, or, the Trials of Timing'. >>> >>> Can you guess how many different input sizes were used for "Timing >>> Trials, or, the Trials of Timing"? Do you guess 20? Do you guess 10? >>> >>> No. The comparisons in "Timing Trials, or, the Trials of Timing" were >>> based on just 4 input values! The Benchmarks Game has slipped from the >>> insightful 4 to the miserable 3 :-) >>> >>> As for "very similiar size values" the timing range for different input >>> values is ~10x to ~100x, in comparison to mostly < 10x in "Timing >>> Trials, or, the Trials of Timing". >>> >>> >>> >>> Michael Campbell points to Yariv's Blog, and I guess to Austin >>> Ziegler's comment. The specific problem he raises - "... must be set >>> at the user's shell [ulimit]. They do not do this and report that the >>> Ruby program doesn't run" - was raised a year earlier on the Ruby >>> mailing-list. >>> >>> That problem was fixed by November 2005, 9 months before Austin Ziegler >>> ranted on Yariv's Blog - his repeated "harsh criticism" had been untrue >>> for 9 months and by then the ackermann benchmark he complains about had >>> been replaced. >>> >>> >>> >>> Rather than a general warning about wierdly contorted code, wouldn't it >>> be more helpful to say which of the Erlang programs you think are >>> wierdly contorted? >>> >>> >>> ____________________________________________________________________________________ >>> Never miss a thing. Make Yahoo your home page. >>> http://www.yahoo.com/r/hs >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From tobbe@REDACTED Fri Nov 23 17:19:39 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 23 Nov 2007 17:19:39 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> Message-ID: Ciprian Dorin Craciun wrote: > I would see the benefit of a Lisp-syntax-based Erlang version -- > but compiled to beam... Just see the recent posts on macros and other > Lisp functionalities. Why not implement a Scheme to Erlang-Core compiler then? Just focus on the sequential parts and let concurrency hide inside modules written in Erlang. I did some experiments like this with a Haskell syntax: http://blog.tornkvist.org/blog.yaws?id=1190846785574003 Cheers, Tobbe > > Ciprian. > > P.S.: When I say Lisp I mean the whole Lisp family, but I would > incline to Scheme. > > > On Nov 23, 2007 12:48 AM, Robin Bhattacharyya wrote: >> This is a quick qualitative comparison of Erlang and Clojure: >> >> http://groups.google.com/group/clojure/browse_thread/thread/2a2b24ffef5d1631 >> >> Does anyone see the benefit of a Lispy version of Erlang on the JVM? >> >> Robin From w.a.de.jong@REDACTED Fri Nov 23 17:44:19 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Fri, 23 Nov 2007 17:44:19 +0100 Subject: [erlang-questions] XML parser that works on binaries In-Reply-To: <4746D87A.2090704@ericsson.com> References: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> <4746D87A.2090704@ericsson.com> Message-ID: <407d9ef80711230844t194992e9uac0a42bebe04ee51@mail.gmail.com> I have a version of erlsom that works on binaries. I made it because I thought it would be faster, but it turned out that this was not the case. I guess that this will change with release 12, and I am planning to revive it. The current version works only on UTF-8 encoded binaries. I remember that I hadn't quite figured out how I could make a version for UTF-16 without copying the entire SAX parser (and slightly modifiying it in many places, obviously). Actually, one for UTF-16 be and one for le. Not that that would be such a big issue, but it is just not very nice. Why do you want a parser that works on binaries? Regards, Willem On 11/23/07, Ulf Wiger (TN/EAB) wrote: > > Joel Reymont skrev: > > Has anyone extracted the expat driver code from ejabberd? > > > > Is there another XML parser that works on binaries? > > > > Would hacking XMERL to work on binaries be a good idea? > > > > Thanks, Joel > > Yes and no. The Xmerl parser is not easily hacked to work > on binaries, and I think it would be a waste of time to > do so. It would require touching most of the code. > > The right approach would be to redesign it with a proper > tokenizer. It would then be fairly easy to either support > two different tokenizers, or one that supports both string > and binary input. > > Of course, this would mean a complete redesign of xmerl_scan, > but that would have its advantages. I think the API can be kept > and improved upon (e.g. offering a lightweight parser API > that uses the same tokenizer and parser.) > > The quick way to do this would be e.g. to buy Joe a beer > and convince him to share his xml parser code. Neither > xmerl nor erlsom use a tokenizer approach, and having looked > at Joe's stuff, I'm convinced that's the way to go. > > Meanwhile, xmerl_eventp.erl can be used to see how an xmerl > wrapper can deal with binaries and hook into xmerl_scan. > The trick is to use the xmerl 'fetch' hook, which is called > each time xmerl needs more data. The fetch function needs to > buffer input until it finds some whitespace - see > xmerl_eventp:find_good_split/6. This has to do with entity > expansion, if I recall correctly, so if you don't have that > in your XML, it shouldn't matter... (don't take my word for > it, though. It's been a few years since I last dabbled with it.) > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Nov 23 18:09:17 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 23 Nov 2007 17:09:17 +0000 Subject: [erlang-questions] XML parser that works on binaries In-Reply-To: <407d9ef80711230844t194992e9uac0a42bebe04ee51@mail.gmail.com> References: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> <4746D87A.2090704@ericsson.com> <407d9ef80711230844t194992e9uac0a42bebe04ee51@mail.gmail.com> Message-ID: On Nov 23, 2007, at 4:44 PM, Willem de Jong wrote: > Why do you want a parser that works on binaries? To minimize the memory footprint of an application, for example. ejabberd was a huge memory hog a year and a half ago since XML binaries received from the socket were converted to lists for processing. I was an even bigger memory hog on a x64 system for obvious reasons. I noticed that even then they were using an expat driver that could operate on binaries so they may have completed that conversion now. -- http://wagerlabs.com From w.a.de.jong@REDACTED Fri Nov 23 19:41:08 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Fri, 23 Nov 2007 19:41:08 +0100 Subject: [erlang-questions] XML parser that works on binaries In-Reply-To: References: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> <4746D87A.2090704@ericsson.com> <407d9ef80711230844t194992e9uac0a42bebe04ee51@mail.gmail.com> Message-ID: <407d9ef80711231041t12892e9ak704334b94f26b02f@mail.gmail.com> The new version of erlsom (released a couple of days ago on sourceforge) can parse input in chunks, one chunk at a time. That way the problem with the memory footprint can be solved. Files of arbitrary size or a stream of data can be parsed. The approach is similar to the approach that xmerl uses, with a 'fetch' hook, as Ulf calls it. An example how to do this for big files is included with the erlsom distribution. It should be fairly straightforward (even for UTF-8 or UTF-16 encoded data). Regards, Willem On Nov 23, 2007 6:09 PM, Joel Reymont wrote: > > On Nov 23, 2007, at 4:44 PM, Willem de Jong wrote: > > > Why do you want a parser that works on binaries? > > > To minimize the memory footprint of an application, for example. > ejabberd was a huge memory hog a year and a half ago since XML > binaries received from the socket were converted to lists for > processing. I was an even bigger memory hog on a x64 system for > obvious reasons. I noticed that even then they were using an expat > driver that could operate on binaries so they may have completed that > conversion now. > > > -- > http://wagerlabs.com > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Fri Nov 23 19:50:42 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 23 Nov 2007 10:50:42 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> Message-ID: <123309.5356.qm@web38807.mail.mud.yahoo.com> --- Joe Armstrong wrote: > I've been following various discussions about > benchmarks, and must say > that I am not impressed. > > The general arguments seems to go like this: > > language A is good at X > language B is good at Y > language B is bad at X > > Therefore hack language B so that it is good at X > > This argument has appeared many times with > different values of A B > X and Y - usually by a proponent of > A who because A solves X better than B assumes that > A is in some sense > better than B. > > The problem is that this argument is just plain > daft. > > If A is good at solving X then use it to solve > X. If B is good at > solving Y then use it to solve Y. On the other hand, we could also look at it from the point of the language community. If A is useless for doing the jobs we need to do, we can't use A. (It can be worse than that; if A is perceived to be useless in one area, it runs the risk of being perceived to be a toy, not suitable for serious use, etc. Possibly quite unfairly, but there you are.) Likewise, if A does not solve problems relevant to a larger community of users, then A will be restricted to use in its niche of competence. > Suppose we change B to make it good at solving > X, what have we done? - make > yet another variant of A. Not if B solves X in a better way than does A. > Scanning log files efficiently (for > example) would > be very important If it has to be done every few > seconds - but if it > is done one a year the performance is totally > irrelevant. Actually, that single run can still be time critical. > - the > only interesting question is "is this time within my > time budget" It can indeed be quite sufficient to be good enough. And your other points about systems thinking, which I have deleted, are well taken. Best, Thomas ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From justin.piper@REDACTED Fri Nov 23 20:45:58 2007 From: justin.piper@REDACTED (Justin Piper) Date: Fri, 23 Nov 2007 13:45:58 -0600 Subject: [erlang-questions] Pattern Matching Question Message-ID: I'm working through an introductory tutorial on Erlang, and one of the exercises asked for a function that returns the number of days in a given month, which I implemented this way: days_in(jan, _ ) -> 31 ; days_in(feb, common) -> 28 ; days_in(feb, leap ) -> 29 ; days_in(mar, _ ) -> 31 ; days_in(apr, _ ) -> 30 ; days_in(may, _ ) -> 31 ; days_in(jun, _ ) -> 30 ; days_in(jul, _ ) -> 31 ; days_in(aug, _ ) -> 31 ; days_in(sep, _ ) -> 30 ; days_in(oct, _ ) -> 31 ; days_in(nov, _ ) -> 30 ; days_in(dec, _ ) -> 31 ; days_in(Month, Year) -> days_in(Month, leap(Year)) . leap(Year) when Year rem 400 == 0 -> leap ; leap(Year) when Year rem 100 == 0 -> common ; leap(Year) when Year rem 4 == 0 -> leap ; leap(Year) when integer(Year) -> common . You can either explicitly tell days_in/2 if it is a leap year using 'common' and 'leap', or you can give it an integer and it will determine whether it is a leap year. This works, but as you can see, since February is the only month that is actually different during a leap year, it's the only one that cares what you pass in the second argument. Since passing something other than 'leap', 'common' or an integer is surely an error, it'd be nice if this were indicated for all of the months. Does Erlang provide an elegant way to do this? I know I could just have two clauses for each month: days_in(jan, common) -> 31 ; days_in(jan, leap ) -> 31 ; But that seems like needless duplication. I also know I could rewrite days_in/2 to have just one clause for all twelve months and just use case to select the correct number of days: days_in(Month, Year) when Year == common; Year == leap -> case { Month, Year } of { jan, _ } -> 31 ; { feb, common} -> 28 ; { feb, leap } -> 29 ; { mar, _ } -> 31 ; { apr, _ } -> 30 ; { may, _ } -> 31 ; { jun, _ } -> 30 ; { jul, _ } -> 31 ; { aug, _ } -> 31 ; { sep, _ } -> 30 ; { oct, _ } -> 31 ; { nov, _ } -> 30 ; { dec, _ } -> 31 end; But I think that the version that uses a clause per month is a little easier to read, particularly if you're just scanning the code. I was hoping Erlang would have an easy way to say that the second argument has to be either 'leap', 'common' or an integer, and that anything else is an error. From esbjorn.dominique@REDACTED Fri Nov 23 21:47:00 2007 From: esbjorn.dominique@REDACTED (=?ISO-8859-1?Q?Esbj=F6rn_Dominique?=) Date: Fri, 23 Nov 2007 21:47:00 +0100 Subject: [erlang-questions] Pattern Matching Question In-Reply-To: References: Message-ID: <7348e9970711231247n20bd71b5jabcd3845d8b52288@mail.gmail.com> hi Justin, My advice would be to turn your days_in to a helper function, e.g. days_in1, something like: days_in1(jan, _) -> 31; days_in1(feb, common) -> 28; days_in1(feb, leap) -> 29; days_in1(mar, _) -> 31; days_in1(apr, _) -> 30; days_in1(may, _) -> 31; days_in1(jun, _) -> 30; days_in1(jul, _) -> 31; days_in1(aug, _) -> 31; days_in1(sep, _) -> 30; days_in1(oct, _) -> 31; days_in1(nov, _) -> 30; days_in1(dec, _) -> 31. days_in(Month, common) -> days_in1(Month, common); days_in(Month, leap) -> days_in1(Month, leap); days_in(Month, Year) when is_integer(Year) -> days_in1(Month, leap(Year)). leap(Year) when Year rem 400 == 0 -> leap ; leap(Year) when Year rem 100 == 0 -> common ; leap(Year) when Year rem 4 == 0 -> leap ; leap(Year) when integer(Year) -> common . And only export days_in/2, ofcourse. What do you think? /esbj?rn On Nov 23, 2007 8:45 PM, Justin Piper wrote: > I'm working through an introductory tutorial on Erlang, and one of the > exercises asked for a function that returns the number of days in a > given month, which I implemented this way: > > days_in(jan, _ ) -> 31 ; > days_in(feb, common) -> 28 ; > days_in(feb, leap ) -> 29 ; > days_in(mar, _ ) -> 31 ; > days_in(apr, _ ) -> 30 ; > days_in(may, _ ) -> 31 ; > days_in(jun, _ ) -> 30 ; > days_in(jul, _ ) -> 31 ; > days_in(aug, _ ) -> 31 ; > days_in(sep, _ ) -> 30 ; > days_in(oct, _ ) -> 31 ; > days_in(nov, _ ) -> 30 ; > days_in(dec, _ ) -> 31 ; > > days_in(Month, Year) > -> days_in(Month, leap(Year)) . > > leap(Year) when Year rem 400 == 0 -> leap ; > leap(Year) when Year rem 100 == 0 -> common ; > leap(Year) when Year rem 4 == 0 -> leap ; > leap(Year) when integer(Year) -> common . > > You can either explicitly tell days_in/2 if it is a leap year using > 'common' and 'leap', or you can give it an integer and it will > determine whether it is a leap year. > > This works, but as you can see, since February is the only month that > is actually different during a leap year, it's the only one that cares > what you pass in the second argument. Since passing something other > than 'leap', 'common' or an integer is surely an error, it'd be nice > if this were indicated for all of the months. Does Erlang provide an > elegant way to do this? I know I could just have two clauses for each > month: > > days_in(jan, common) -> 31 ; > days_in(jan, leap ) -> 31 ; > > But that seems like needless duplication. I also know I could rewrite > days_in/2 to have just one clause for all twelve months and just use > case to select the correct number of days: > > days_in(Month, Year) > when Year == common; Year == leap > -> case { Month, Year } > of { jan, _ } -> 31 ; > { feb, common} -> 28 ; > { feb, leap } -> 29 ; > { mar, _ } -> 31 ; > { apr, _ } -> 30 ; > { may, _ } -> 31 ; > { jun, _ } -> 30 ; > { jul, _ } -> 31 ; > { aug, _ } -> 31 ; > { sep, _ } -> 30 ; > { oct, _ } -> 31 ; > { nov, _ } -> 30 ; > { dec, _ } -> 31 > end; > > But I think that the version that uses a clause per month is a little > easier to read, particularly if you're just scanning the code. I was > hoping Erlang would have an easy way to say that the second argument > has to be either 'leap', 'common' or an integer, and that anything > else is an error. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Esbj?rn Dominique OptiMobile AB +46(0)706 - 305 590 +46(0)8 - 750 61 90 esbjorn@REDACTED From mogorman@REDACTED Fri Nov 23 21:05:09 2007 From: mogorman@REDACTED (mog) Date: Fri, 23 Nov 2007 14:05:09 -0600 Subject: [erlang-questions] Pattern Matching Question In-Reply-To: References: Message-ID: <1195848309.4433.0.camel@metalman.lan> you could do days_in(jan, _all) -> 31 ; as anything _whatever isnt used so you could label anything you want. mog -------------- 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 hokan.stenholm@REDACTED Fri Nov 23 23:13:59 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Fri, 23 Nov 2007 23:13:59 +0100 Subject: [erlang-questions] Pattern Matching Question In-Reply-To: <7348e9970711231247n20bd71b5jabcd3845d8b52288@mail.gmail.com> References: <7348e9970711231247n20bd71b5jabcd3845d8b52288@mail.gmail.com> Message-ID: <474750A7.6040406@bredband.net> Esbj?rn Dominique wrote: > hi Justin, > > My advice would be to turn your days_in to a helper function, e.g. > days_in1, something like: This could be simplified to the following, especially if we can trust the input values to be valid: -module(date). -export([days_in_month/2]). %% feb is the only/special case that needs to check for leap year days_in_month(feb, Y) -> case is_leap(Y) of true -> 29; false -> 28 end; days_in_month(M, _) -> %% use of case - reduces code boilderplate case M of jan -> 31; mar -> 31; may -> 31; jul -> 31; aug -> 31; oct -> 31; dec -> 31; _ -> 30 % apr, jun, sep, nov end. is_leap(Year) -> % if reduces need for boilderplate if %% implicit is_integer/1 test, rem assumes a int() (Year rem 400) == 0 -> true; (Year rem 100) == 0 -> false; (Year rem 4) == 0 -> true; %% wont get here if Year isn't a int() true -> false end. > > days_in1(jan, _) -> 31; > days_in1(feb, common) -> 28; > days_in1(feb, leap) -> 29; > days_in1(mar, _) -> 31; > days_in1(apr, _) -> 30; > days_in1(may, _) -> 31; > days_in1(jun, _) -> 30; > days_in1(jul, _) -> 31; > days_in1(aug, _) -> 31; > days_in1(sep, _) -> 30; > days_in1(oct, _) -> 31; > days_in1(nov, _) -> 30; > days_in1(dec, _) -> 31. > > days_in(Month, common) -> > days_in1(Month, common); > days_in(Month, leap) -> > days_in1(Month, leap); > days_in(Month, Year) when is_integer(Year) -> > days_in1(Month, leap(Year)). > > leap(Year) when Year rem 400 == 0 -> leap ; > leap(Year) when Year rem 100 == 0 -> common ; > leap(Year) when Year rem 4 == 0 -> leap ; > leap(Year) when integer(Year) -> common . > > And only export days_in/2, ofcourse. > > What do you think? > /esbj?rn > > > On Nov 23, 2007 8:45 PM, Justin Piper wrote: >> I'm working through an introductory tutorial on Erlang, and one of the >> exercises asked for a function that returns the number of days in a >> given month, which I implemented this way: >> >> days_in(jan, _ ) -> 31 ; >> days_in(feb, common) -> 28 ; >> days_in(feb, leap ) -> 29 ; >> days_in(mar, _ ) -> 31 ; >> days_in(apr, _ ) -> 30 ; >> days_in(may, _ ) -> 31 ; >> days_in(jun, _ ) -> 30 ; >> days_in(jul, _ ) -> 31 ; >> days_in(aug, _ ) -> 31 ; >> days_in(sep, _ ) -> 30 ; >> days_in(oct, _ ) -> 31 ; >> days_in(nov, _ ) -> 30 ; >> days_in(dec, _ ) -> 31 ; >> >> days_in(Month, Year) >> -> days_in(Month, leap(Year)) . >> >> leap(Year) when Year rem 400 == 0 -> leap ; >> leap(Year) when Year rem 100 == 0 -> common ; >> leap(Year) when Year rem 4 == 0 -> leap ; >> leap(Year) when integer(Year) -> common . >> >> You can either explicitly tell days_in/2 if it is a leap year using >> 'common' and 'leap', or you can give it an integer and it will >> determine whether it is a leap year. >> >> This works, but as you can see, since February is the only month that >> is actually different during a leap year, it's the only one that cares >> what you pass in the second argument. Since passing something other >> than 'leap', 'common' or an integer is surely an error, it'd be nice >> if this were indicated for all of the months. Does Erlang provide an >> elegant way to do this? I know I could just have two clauses for each >> month: >> >> days_in(jan, common) -> 31 ; >> days_in(jan, leap ) -> 31 ; >> >> But that seems like needless duplication. I also know I could rewrite >> days_in/2 to have just one clause for all twelve months and just use >> case to select the correct number of days: >> >> days_in(Month, Year) >> when Year == common; Year == leap >> -> case { Month, Year } >> of { jan, _ } -> 31 ; >> { feb, common} -> 28 ; >> { feb, leap } -> 29 ; >> { mar, _ } -> 31 ; >> { apr, _ } -> 30 ; >> { may, _ } -> 31 ; >> { jun, _ } -> 30 ; >> { jul, _ } -> 31 ; >> { aug, _ } -> 31 ; >> { sep, _ } -> 30 ; >> { oct, _ } -> 31 ; >> { nov, _ } -> 30 ; >> { dec, _ } -> 31 >> end; >> >> But I think that the version that uses a clause per month is a little >> easier to read, particularly if you're just scanning the code. I was >> hoping Erlang would have an easy way to say that the second argument >> has to be either 'leap', 'common' or an integer, and that anything >> else is an error. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > From kenneth.lundin@REDACTED Sat Nov 24 00:07:54 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sat, 24 Nov 2007 00:07:54 +0100 Subject: [erlang-questions] XML parser that works on binaries In-Reply-To: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> References: <74B0E109-B8F5-4585-85F0-61422EC0D31A@gmail.com> Message-ID: Hi Joel, It depends on what you mean with binaries and what you want to achieve. It is easy and already today possible to read the input as binary chunks convert each chunk to a list and then parse that list with XMERL. This way you will reduce the footprint compared with reading the complete input convert to list and then parse. Another thing is if you want the parsed text content to be kept as binaries or as lists. If you want to keep the text as binaries it would require quite a lot of changes to xmerl. The reason for wanting to keep the text as binaries would again be memory footprint. What use case do you have where the XML data is so big so thhe memory footprint makes a significant difference between binaries and lists. Of course I am aware of that a byte in a binary occupies 4 bytes when converted to a lists in a 32 bit Erlang VM and 8 bytes in an 64 bit Erlang VM but if parsing is done in chunks the memory footprint can be controlled anyway. And note that you have little or no reason to run a 64-bit Erlang VM even if the OS is running in 64 bit mode. Only if you need to address more than 2 Gbyte of ram in the Erlang VM you need to run a 64 bit VM. I think we need to provide a faster XML parser in the standard distribution and also more compact output formats than the XMERL default. This will hopefully and very probably happen during 2008 and very possibly as improvements and extensions to the XMERL application. /Kenneth Erlang/OTP team at Ericsson On 11/23/07, Joel Reymont wrote: > Has anyone extracted the expat driver code from ejabberd? > > Is there another XML parser that works on binaries? > > Would hacking XMERL to work on binaries be a good idea? > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kazuya-erlang-questions@REDACTED Sat Nov 24 00:09:58 2007 From: kazuya-erlang-questions@REDACTED (Kazuya Sakakihara) Date: Sat, 24 Nov 2007 08:09:58 +0900 Subject: [erlang-questions] Erlang Trainer fluent in Japanese? Message-ID: <47475DC6.3020608@violentlyhappy.org> Hi, % I am resending this message as my prior post seems to have gone into vacuum... % Sorry if you got duplicate. Francesco Cesarini wrote: > If you or someone you know is capable of teaching Erlang/OTP courses in > Japanese, please drop me a line. (12 nationalities are represented at > ETC, but Japanese is not one of them....).We would prefer if the person > had a few years practical experience, but as almost no one on the client > site speaks English, any little helps. I am also interested in such a figure. I am now translating Joe's book into Japanese. It's almost done and currently being reviewed by several persons. Current reviewers are all good at functional programming and have strong mathematical background, but lack practical experience on Erlang/OTP (as they have just begun learning Erlang). Thus that kind of personnel would be very helpful to us to make the translation better. -- Kazuya Sakakihara http://www.violentlyhappy.org/kazuya From oneone@REDACTED Sat Nov 24 00:03:31 2007 From: oneone@REDACTED (Andrew Arrow) Date: Fri, 23 Nov 2007 15:03:31 -0800 Subject: [erlang-questions] reset all bound variables Message-ID: is there a way to reset all bound variables and make the erlang shell go back to the 1> prompt? If I exit out and type erl again it takes 20 seconds to get back to the shell. Is there a quicker way? Thanks. From igouy2@REDACTED Sat Nov 24 00:12:18 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Fri, 23 Nov 2007 15:12:18 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) Message-ID: <402133.48073.qm@web60518.mail.yahoo.com> On 11/23/07 15:57, Joe Armstrong wrote: -snip- > An essential part of systems analysis is knowing what languages > are good for solving specific problems. Benchmarks are useful here - > but they hardly tell me something I don't know already. There seems to be an endless supply of people who do not already know and in fact find the differences surprising ;-) -snip- > Some of our Erlang systems have > become market leading and have achieved amazing figures for > reliability - despite the fact that they boot slowly, > have appalling performance at matching regular expressions and can't > analyse giga bytes of disk logs efficiently. > These latter three points are irrelevant for the types of system we build. Slide 8 Objection: Erlang isn?t fast enough ? No competing product outperforms Ericsson?s ENGINE solution for Telephony over packet-based networks. ? No competing product outperforms Ericsson?s Erlang based GPRS Signalling Support Node (SGSN). ? No competing product outperforms Nortel?s Erlang-based SSL Offload Accelerator. ? Lesson learned: it?s nearly impossible to predict system performance based on low-level ?micro? benchmarks. ? Failure to manage complexity often kills performance. http://www.erlang.se/workshop/2004/ulfwiger.pdf ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From bob@REDACTED Sat Nov 24 00:21:43 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 23 Nov 2007 15:21:43 -0800 Subject: [erlang-questions] reset all bound variables In-Reply-To: References: Message-ID: <6a36e7290711231521kd7be0a6yfc66a350a75d0c37@mail.gmail.com> 1> Bound = 1. 1 2> f(). ok 3> Bound = 2. 2 You can also use f(Bound) to forget just that one variable. -bob On 11/23/07, Andrew Arrow wrote: > is there a way to reset all bound variables and make the erlang shell > go back to the 1> prompt? If I exit out and type erl again it takes > 20 seconds to get back to the shell. Is there a quicker way? Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From klacke@REDACTED Sat Nov 24 00:23:56 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Sat, 24 Nov 2007 00:23:56 +0100 Subject: [erlang-questions] DTrace for Erlang In-Reply-To: References: Message-ID: <4747610C.3070007@hyber.org> Mats Westin wrote: > I think DTrace is going to make low > latency GUI apps possible, on old hardware in the future. :) > > I can't wait. /klacke From ulf@REDACTED Sat Nov 24 00:41:40 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 24 Nov 2007 00:41:40 +0100 Subject: [erlang-questions] reset all bound variables In-Reply-To: <6a36e7290711231521kd7be0a6yfc66a350a75d0c37@mail.gmail.com> References: <6a36e7290711231521kd7be0a6yfc66a350a75d0c37@mail.gmail.com> Message-ID: <8209f740711231541g4ee7dc4eg7811b97c8221e24@mail.gmail.com> And if you want to get a fresh shell, without killing your old bound variables, you can hit Ctrl-G, then 's' to start another shell, and 'c' to connect to it. You can then switch back and forth between different shells in the same erlang node through Ctrl-G. BR, Ulf W 2007/11/24, Bob Ippolito : > 1> Bound = 1. > 1 > 2> f(). > ok > 3> Bound = 2. > 2 > > You can also use f(Bound) to forget just that one variable. > > -bob > > On 11/23/07, Andrew Arrow wrote: > > is there a way to reset all bound variables and make the erlang shell > > go back to the 1> prompt? If I exit out and type erl again it takes > > 20 seconds to get back to the shell. Is there a quicker way? Thanks. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From igouy2@REDACTED Fri Nov 23 23:44:42 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Fri, 23 Nov 2007 14:44:42 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) Message-ID: <646623.26744.qm@web60517.mail.yahoo.com> On Nov 23, 2007 1:26 PM, Bengt Kleberg wrote: > this is seriously off topic for erlang-questions, so i would recommend > each and every one of you to stop reading now. Was it off topic when you chose to air your criticism on erlang-questions back in September, or is it only the reply to your criticism that is off topic? :-) > kvw(*) is not a benchmark report. it is a paper about experiments > on how to do benchmarks. Maybe you misread ? - "This paper describes some basic /experiments to see how fast/ various popular scripting and user-interface languages run on a spectrum of representative tasks." - "This paper describes /experiments to compare the performance/ of scripting languages ... on a set of representative computational tasks." -snip- > to see this it is necessary to vary the input to such an extent as > to find the dramatic runtime changes. the shootout does not do this. There's no intention to increase input values until each program exhausts resources and fails - that much is true. Despite that, we do include programs that exhaust stack or heap, and fail, at larger input values. > isaac gouy has previously stated that the shootout is not, and shall > not be, about the kind of wide spectrum of inputs that kvw recommends > investigating. now he is instead saying that the shootout is better > than what kvw recommends for this kind of investigations. You suggest that "kvw recommends" something about a wide spectrum of inputs _ I've searched in vain for that recommendation - please quote their exact words. Kernighan and Van Wyk did write "Varying the problem size helped us to detect unusual runtime effects ..." and we can see that they varied the problem size by < ~10x imo You are distorting Kernighan and Van Wyk to lend authority to your own viewpoint. ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From ulf.wiger@REDACTED Fri Nov 23 17:12:27 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 23 Nov 2007 17:12:27 +0100 Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> References: <815249.27396.qm@web60513.mail.yahoo.com> <4746C6F9.4020100@ericsson.com> <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> Message-ID: <4746FBEB.5010906@ericsson.com> Joe Armstrong skrev: > > If A is good at solving X then use it to solve X. If B is > good at solving Y then use it to solve Y. > > Suppose we change B to make it good at solving X, what have > we done? - make yet another variant of A. To quote Todd Proebsting: "Languages (or language technologies) that solve real problems can succeed - Even if slow - Even with simple types - Even without academic significance - Even without rocket science - If useful" (http://research.microsoft.com/~toddpro/papers/disruptive.ppt) > So sure we could make Erlang a lot faster - for example to > make regexps really fast all we have to do is link the C code > for regexps into the Erlang kernel - but it would no longer be > safe. Yes, but efficient string processing - esp efficient string processing based using binaries - is very important. As I understand it, regexps can be used as long as it's a safe subset. > I think its nonsense to assume that > a single language will be good at everything. Agreed. > Benchmarks are useful here - > but they hardly tell me something I don't know already. Still, the benchmarks game can be used (coupled with common sense) to identify problems that may not be that obvious in existing products, but would be in other interesting ones. One example is the infamous line-oriented file input problem. This is not a problem in /our/ systems, because if we read data from disk, it is seldom, and when it happens, it's usually mnesia using disk_log chunking. Disk_log /is/ fast, notably so. When playing with the benchmark dealing with line-oriented input, I experimented with the line-oriented socket option. It was fast - so fast, in fact, that the Erlang program couldn't keep up, even though it ran in the tightest loop possible. To solve this, we wouldn't have to make the system unsafe. We'd need to implement flow control on port input, much like that which already exists in the inet driver. Erlang would be better for it - not worse. I think this is a good finding. BR, Ulf W From esbjorn@REDACTED Sat Nov 24 08:47:40 2007 From: esbjorn@REDACTED (=?ISO-8859-1?Q?Esbj=F6rn_Dominique?=) Date: Sat, 24 Nov 2007 08:47:40 +0100 Subject: [erlang-questions] Pattern Matching Question In-Reply-To: <474750A7.6040406@bredband.net> References: <7348e9970711231247n20bd71b5jabcd3845d8b52288@mail.gmail.com> <474750A7.6040406@bredband.net> Message-ID: <7348e9970711232347w7c6c7cdandc3b2ec5994b074b@mail.gmail.com> This reminds me of something that have bothered me some times (well, not that much): the lack of fall-through ? la C switch/case. What I would like is something like: days_in(jan, _); days_in(mar, _); days_in(may, _); days_in(jul, _); days_in(aug, _); days_in(oct, _) -> 31; days_in(dec, _); days_in(apr, _); days_in(jun, _); days_in(sep, _); days_in(nov, _) -> 30; days_in(feb, common) -> 28; days_in(feb, leap) -> 29. The motivation is simply to reduce duplication. It would just be a syntacic sugar - I guess the compiler should treat it as if the function body is duplicated in all fall-through cases. No doubt this could be mis-used and messy, but I think it could be useful. It could also apply to e.g. case: days_in_month(M, _) -> case M of jan; mar; may; jul; aug; oct; dec -> 31; _ -> 30 % apr, jun, sep, nov end. Any opinions? /esbj?rn On Nov 23, 2007 11:13 PM, H?kan Stenholm wrote: > Esbj?rn Dominique wrote: > > hi Justin, > > > > My advice would be to turn your days_in to a helper function, e.g. > > days_in1, something like: > This could be simplified to the following, especially if we can trust > the input values to be valid: > > > -module(date). > > -export([days_in_month/2]). > > %% feb is the only/special case that needs to check for leap year > days_in_month(feb, Y) -> > case is_leap(Y) of > true -> 29; > false -> 28 > end; > > days_in_month(M, _) -> > %% use of case - reduces code boilderplate > case M of > jan -> 31; > mar -> 31; > may -> 31; > jul -> 31; > aug -> 31; > oct -> 31; > dec -> 31; > _ -> 30 % apr, jun, sep, nov > end. > > is_leap(Year) -> % if reduces need for boilderplate > if > > %% implicit is_integer/1 test, rem assumes a int() > (Year rem 400) == 0 -> true; > (Year rem 100) == 0 -> false; > (Year rem 4) == 0 -> true; > > %% wont get here if Year isn't a int() > true -> false > end. > > > > > > > > days_in1(jan, _) -> 31; > > days_in1(feb, common) -> 28; > > days_in1(feb, leap) -> 29; > > days_in1(mar, _) -> 31; > > days_in1(apr, _) -> 30; > > days_in1(may, _) -> 31; > > days_in1(jun, _) -> 30; > > days_in1(jul, _) -> 31; > > days_in1(aug, _) -> 31; > > days_in1(sep, _) -> 30; > > days_in1(oct, _) -> 31; > > days_in1(nov, _) -> 30; > > days_in1(dec, _) -> 31. > > > > days_in(Month, common) -> > > days_in1(Month, common); > > days_in(Month, leap) -> > > days_in1(Month, leap); > > days_in(Month, Year) when is_integer(Year) -> > > days_in1(Month, leap(Year)). > > > > leap(Year) when Year rem 400 == 0 -> leap ; > > leap(Year) when Year rem 100 == 0 -> common ; > > leap(Year) when Year rem 4 == 0 -> leap ; > > leap(Year) when integer(Year) -> common . > > > > And only export days_in/2, ofcourse. > > > > What do you think? > > /esbj?rn > > > > > > On Nov 23, 2007 8:45 PM, Justin Piper wrote: > >> I'm working through an introductory tutorial on Erlang, and one of the > >> exercises asked for a function that returns the number of days in a > >> given month, which I implemented this way: > >> > >> days_in(jan, _ ) -> 31 ; > >> days_in(feb, common) -> 28 ; > >> days_in(feb, leap ) -> 29 ; > >> days_in(mar, _ ) -> 31 ; > >> days_in(apr, _ ) -> 30 ; > >> days_in(may, _ ) -> 31 ; > >> days_in(jun, _ ) -> 30 ; > >> days_in(jul, _ ) -> 31 ; > >> days_in(aug, _ ) -> 31 ; > >> days_in(sep, _ ) -> 30 ; > >> days_in(oct, _ ) -> 31 ; > >> days_in(nov, _ ) -> 30 ; > >> days_in(dec, _ ) -> 31 ; > >> > >> days_in(Month, Year) > >> -> days_in(Month, leap(Year)) . > >> > >> leap(Year) when Year rem 400 == 0 -> leap ; > >> leap(Year) when Year rem 100 == 0 -> common ; > >> leap(Year) when Year rem 4 == 0 -> leap ; > >> leap(Year) when integer(Year) -> common . > >> > >> You can either explicitly tell days_in/2 if it is a leap year using > >> 'common' and 'leap', or you can give it an integer and it will > >> determine whether it is a leap year. > >> > >> This works, but as you can see, since February is the only month that > >> is actually different during a leap year, it's the only one that cares > >> what you pass in the second argument. Since passing something other > >> than 'leap', 'common' or an integer is surely an error, it'd be nice > >> if this were indicated for all of the months. Does Erlang provide an > >> elegant way to do this? I know I could just have two clauses for each > >> month: > >> > >> days_in(jan, common) -> 31 ; > >> days_in(jan, leap ) -> 31 ; > >> > >> But that seems like needless duplication. I also know I could rewrite > >> days_in/2 to have just one clause for all twelve months and just use > >> case to select the correct number of days: > >> > >> days_in(Month, Year) > >> when Year == common; Year == leap > >> -> case { Month, Year } > >> of { jan, _ } -> 31 ; > >> { feb, common} -> 28 ; > >> { feb, leap } -> 29 ; > >> { mar, _ } -> 31 ; > >> { apr, _ } -> 30 ; > >> { may, _ } -> 31 ; > >> { jun, _ } -> 30 ; > >> { jul, _ } -> 31 ; > >> { aug, _ } -> 31 ; > >> { sep, _ } -> 30 ; > >> { oct, _ } -> 31 ; > >> { nov, _ } -> 30 ; > >> { dec, _ } -> 31 > >> end; > >> > >> But I think that the version that uses a clause per month is a little > >> easier to read, particularly if you're just scanning the code. I was > >> hoping Erlang would have an easy way to say that the second argument > >> has to be either 'leap', 'common' or an integer, and that anything > >> else is an error. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Sat Nov 24 09:28:59 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 24 Nov 2007 00:28:59 -0800 (PST) Subject: [erlang-questions] Pattern Matching Question In-Reply-To: <7348e9970711232347w7c6c7cdandc3b2ec5994b074b@mail.gmail.com> Message-ID: <591365.39137.qm@web38805.mail.mud.yahoo.com> --- Esbj?rn Dominique wrote: > This reminds me of something that have bothered me > some times (well, > not that much): the lack of fall-through ? la C > switch/case. What I > would like is something like: > > days_in(jan, _); > days_in(mar, _); > days_in(may, _); > days_in(jul, _); > days_in(aug, _); > days_in(oct, _) -> 31; > days_in(dec, _); > days_in(apr, _); > days_in(jun, _); > days_in(sep, _); > days_in(nov, _) -> 30; > days_in(feb, common) -> 28; > days_in(feb, leap) -> 29. > > The motivation is simply to reduce duplication. You can do it like this: days_in(Mon, Leap) -> if Mon == jan ; Mon == .. ; ... -> 31; Mon == nov ; ... -> 30; Mon == feb, Leap == leap -> 29; Mon == feb, Leap == normal -> 28 end. (or use other guard operators). You can't do this for general patterns, of course, because you can't bind variables in guards. Another way to reduce duplication is to factor the common clause bodies into a new function. In this case, probably not worth it. Best, Thomas ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From per@REDACTED Sat Nov 24 12:56:43 2007 From: per@REDACTED (Per Hedeland) Date: Sat, 24 Nov 2007 12:56:43 +0100 (CET) Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <4746FBEB.5010906@ericsson.com> Message-ID: <200711241156.lAOBuhYs032039@pluto.hedeland.org> "Ulf Wiger (TN/EAB)" wrote: > >When playing with the benchmark dealing with line-oriented >input, I experimented with the line-oriented socket option. I think you mean port option. >It was fast - so fast, in fact, that the Erlang program couldn't >keep up, even though it ran in the tightest loop possible. >To solve this, we wouldn't have to make the system unsafe. We'd >need to implement flow control on port input, much like that >which already exists in the inet driver. Erlang would be better >for it - not worse. > >I think this is a good finding. I'm afraid I'll have to challenge it though (I think I already did so, but I guess I didn't make my point very well). It says nothing at all about how fast the port I/O is, only that design choices in the VM when it comes to the relative frequency of polling for I/O vs scheduling processes are such that if input is always available, you really can't get much done in your Erlang code. I.e. it's only about the relative amount of processing allocated to doing I/O and running Erlang, not about absolute speed. And using a "raw" port a.k.a. one of the builtin fd/spawn drivers for reading from a disk file is rather "silly" - it's nice because it allows (or can allow) for the "everything is a file" concept, and work indpendent of whether the I/O channel refers to an actual file or to a pipe/FIFO/socket, but it means that you keep calling poll() to get an answer that will always be the same when the input actually is a file - surely not optimal. I think what is needed to get good file I/O performance in Erlang is something very like C stdio, *and* having things arranged such that using this functionality is obvious/transparent to the user. I.e. file:open() followed by (e.g.) io:get_line() should just result in "passively" reading data via buffering, and not involve intermediary Erlang processes and protocols designed for interactive use. And the Erlang VM can do this better than C stdio via read-ahead, i.e. get more data "in parallell" before the buffer is empty and forces the application process to block waiting for the file system. Flow control on fd/spawn ports could still be very useful (e.g. when running Erlang in a Unix pipeline, or having a third-party port program that just spews data at you as fast as it can) - but it's not relevant for actual file I/O - at least not file *input*. --Per Hedeland From ulf.wiger@REDACTED Sat Nov 24 14:22:29 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sat, 24 Nov 2007 14:22:29 +0100 Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <200711241156.lAOBuhYs032039@pluto.hedeland.org> References: <200711241156.lAOBuhYs032039@pluto.hedeland.org> Message-ID: <47482595.5020401@ericsson.com> Per Hedeland skrev: > "Ulf Wiger (TN/EAB)" wrote: >> When playing with the benchmark dealing with line-oriented >> input, I experimented with the line-oriented socket option. > > I think you mean port option. Yes, of course. Thanks. > >> It was fast - so fast, in fact, that the Erlang program couldn't >> keep up, even though it ran in the tightest loop possible. >> To solve this, we wouldn't have to make the system unsafe. We'd >> need to implement flow control on port input, much like that >> which already exists in the inet driver. Erlang would be better >> for it - not worse. >> >> I think this is a good finding. > > I'm afraid I'll have to challenge it though (I think I already did so, > but I guess I didn't make my point very well). It says nothing at all > about how fast the port I/O is, only that design choices in the VM when > it comes to the relative frequency of polling for I/O vs scheduling > processes are such that if input is always available, you really can't > get much done in your Erlang code. I.e. it's only about the relative > amount of processing allocated to doing I/O and running Erlang, not > about absolute speed. > > And using a "raw" port a.k.a. one of the builtin fd/spawn drivers for > reading from a disk file is rather "silly" - it's nice because it > allows > (or can allow) for the "everything is a file" concept, and work > indpendent of whether the I/O channel refers to an actual file or to a > pipe/FIFO/socket, but it means that you keep calling poll() to get an > answer that will always be the same when the input actually is a file > - surely not optimal. This is true. It was quite fast when I measured it on my workstation, but I learned later that it only worked because the disk was slow enough that my Erlang code could keep up. With a faster disk, the system was overrun. If one knows that it's a plain file, it should be possible to do even better. It should also be said, perhaps, that this hasn't been a problem in our products, since we usually use either inet ports or custom linked-in drivers, and don't allow the outside world to flood our systems. Obviously, using plain pipes is dangerous without any way of stemming the flow. > Flow control on fd/spawn ports could still be very useful (e.g. when > running Erlang in a Unix pipeline, or having a third-party port program > that just spews data at you as fast as it can) - but it's not relevant > for actual file I/O - at least not file *input*. Not only would it be useful - I'd even say it's necessary. (: And in lieu of a more logical and optimal way of achieving file input, it would also be a huge improvement over the current implementation of io:get_line(). BR, Ulf W From ciprian.craciun@REDACTED Sat Nov 24 15:22:43 2007 From: ciprian.craciun@REDACTED (Ciprian Dorin Craciun) Date: Sat, 24 Nov 2007 16:22:43 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> Message-ID: <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> On Nov 23, 2007 6:19 PM, Torbjorn Tornkvist wrote: > Ciprian Dorin Craciun wrote: > > I would see the benefit of a Lisp-syntax-based Erlang version -- > > but compiled to beam... Just see the recent posts on macros and other > > Lisp functionalities. > > Why not implement a Scheme to Erlang-Core compiler then? > > Just focus on the sequential parts and let concurrency > hide inside modules written in Erlang. I did some > experiments like this with a Haskell syntax: > > http://blog.tornkvist.org/blog.yaws?id=1190846785574003 > > Cheers, Tobbe > > > > > > Ciprian. > > > > P.S.: When I say Lisp I mean the whole Lisp family, but I would > > incline to Scheme. > > > > > > On Nov 23, 2007 12:48 AM, Robin Bhattacharyya wrote: > >> This is a quick qualitative comparison of Erlang and Clojure: > >> > >> http://groups.google.com/group/clojure/browse_thread/thread/2a2b24ffef5d1631 > >> > >> Does anyone see the benefit of a Lispy version of Erlang on the JVM? > >> > >> Robin This would be the basic idea... But for now I lack the time to do it... (And I would also have to study the bytecode specification.) Just a some minor complaints (so they can be ignored :) I would gladly use Erlang for most projects I am working on -- which usually reside on server side -- if: -- I would have a nice macro system that blends into the normal syntax -- for example in Common Lisp 'or' is implemented as a macro, but you don't notice it... -- I would have proper support for strings, for example an object that resembles binary but which is specially built for string processing. -- I would have proper / mature / stable / feature-full libraries for all kind of activities (database access, XML processing, etc.) But as I have seen from this group Erlang still has problems in this areas... Ciprian. From mickael.remond@REDACTED Sat Nov 24 14:37:14 2007 From: mickael.remond@REDACTED (=?UTF-8?Q?Micka=C3=ABl_R=C3=A9mond?=) Date: Sat, 24 Nov 2007 14:37:14 +0100 Subject: [erlang-questions] Coming type checking in records :) Message-ID: <2F5C2582-30CE-4EF0-9987-239A0DA2F1F7@process-one.net> Hello, It seems that type checking in Erlang record is coming soon :) In Erlang R12B snapshot (file.hrl): -type(date() :: {pos_integer(), pos_integer(), pos_integer()}). -type(time() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}). -type(date_time() :: {date(), time()}). % %-------------------------------------------------------------------------- -record(file_info, {size :: non_neg_integer(), % Size of file in bytes. type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink', ... I guess the intend is to use this new information in dialyzer. Anyway, it looks nice :) -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Sat Nov 24 19:08:34 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 24 Nov 2007 20:08:34 +0200 Subject: [erlang-questions] Coming type checking in records :) In-Reply-To: <2F5C2582-30CE-4EF0-9987-239A0DA2F1F7@process-one.net> References: <2F5C2582-30CE-4EF0-9987-239A0DA2F1F7@process-one.net> Message-ID: <474868A2.9050309@cs.ntua.gr> Micka?l R?mond wrote: > Hello, > > It seems that type checking in Erlang record is coming soon :) Not only in records, but also for functions. Take a look at the -spec() declarations in kernel/src/file.erl too. > In Erlang R12B snapshot (file.hrl): > > -type(date() :: {pos_integer(), pos_integer(), pos_integer()}). > -type(time() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}). > -type(date_time() :: {date(), time()}). > > %%-------------------------------------------------------------------------- > > -record(file_info, > {size :: non_neg_integer(), % Size of file in bytes. > type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink', > ... > > > I guess the intend is to use this new information in dialyzer. Well, that's not just intention -- it's reality in R12. > Anyway, it looks nice :) Merci beaucoup! Kostis From rsaccon@REDACTED Sat Nov 24 19:31:20 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Sat, 24 Nov 2007 16:31:20 -0200 Subject: [erlang-questions] Clarify: how to reduce startup time for escript ? Message-ID: I am working on a better integration of Erlang and TextMate (Mac text editor), basically adding the stuff which emacs / distel already provides out-of-the-box. My current approach is based on escripts, which get called for specific actions such as compiling. For details see: http://www.rsaccon.com/2007/11/easy-erlang-compiling-with-textmate.html One problem with escripts is that their startup time is within a range, which a user perceives as (short) delay. It's about 0.15 sec on my system. Does there exist a trick to reduce this startup time ? Other approches such as connecting to a runnig node give a response time perceived as "immediate", but are significantly more difficult to implement and to integrate into TextMate. regards -- Roberto Saccon http://rsaccon.com From tobbe@REDACTED Mon Nov 12 18:35:18 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 12 Nov 2007 18:35:18 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> Message-ID: Ciprian Dorin Craciun wrote: > On Nov 23, 2007 6:19 PM, Torbjorn Tornkvist wrote: >> Ciprian Dorin Craciun wrote: >>> I would see the benefit of a Lisp-syntax-based Erlang version -- >>> but compiled to beam... Just see the recent posts on macros and other >>> Lisp functionalities. >> Why not implement a Scheme to Erlang-Core compiler then? >> >> Just focus on the sequential parts and let concurrency >> hide inside modules written in Erlang. I did some >> experiments like this with a Haskell syntax: >> >> http://blog.tornkvist.org/blog.yaws?id=1190846785574003 >> >> Cheers, Tobbe >> >> >>> Ciprian. >>> >>> P.S.: When I say Lisp I mean the whole Lisp family, but I would >>> incline to Scheme. >>> >>> >>> On Nov 23, 2007 12:48 AM, Robin Bhattacharyya wrote: >>>> This is a quick qualitative comparison of Erlang and Clojure: >>>> >>>> http://groups.google.com/group/clojure/browse_thread/thread/2a2b24ffef5d1631 >>>> >>>> Does anyone see the benefit of a Lispy version of Erlang on the JVM? >>>> >>>> Robin > > This would be the basic idea... But for now I lack the time to do > it... (And I would also have to study the bytecode specification.) No you don't have to look into the bytecode! Erlang Core is nothing more/less than an enriched lambda calculus. This means that it should be pretty easy to translate a Scheme syntax into Erlang Core (see the paper by Richard Carlsson that describes the Erlang Core). > > Just a some minor complaints (so they can be ignored :) I would > gladly use Erlang for most projects I am working on -- which usually > reside on server side -- if: > -- I would have a nice macro system that blends into the normal > syntax -- for example in Common Lisp 'or' is implemented as a macro, > but you don't notice it... > -- I would have proper support for strings, for example an object > that resembles binary but which is specially built for string > processing. > -- I would have proper / mature / stable / feature-full libraries > for all kind of activities (database access, XML processing, etc.) > But as I have seen from this group Erlang still has problems in > this areas... I don't think Erlang has got (big) 'problems' in these areas. We have (and are) doing amazing stuff in Erlang since a long time now. And frankly, I don't care if the world don't realize the power of Erlang. I'm just happy as long as I can use it as my 'secret weapon'... Cheers, Tobbe From ciprian.craciun@REDACTED Sat Nov 24 20:30:08 2007 From: ciprian.craciun@REDACTED (Ciprian Dorin Craciun) Date: Sat, 24 Nov 2007 21:30:08 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> Message-ID: <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> On Nov 12, 2007 7:35 PM, Torbjorn Tornkvist wrote: > Ciprian Dorin Craciun wrote: > > On Nov 23, 2007 6:19 PM, Torbjorn Tornkvist wrote: > >> Ciprian Dorin Craciun wrote: > >>> I would see the benefit of a Lisp-syntax-based Erlang version -- > >>> but compiled to beam... Just see the recent posts on macros and other > >>> Lisp functionalities. > >> Why not implement a Scheme to Erlang-Core compiler then? > >> > >> Just focus on the sequential parts and let concurrency > >> hide inside modules written in Erlang. I did some > >> experiments like this with a Haskell syntax: > >> > >> http://blog.tornkvist.org/blog.yaws?id=1190846785574003 > >> > >> Cheers, Tobbe > >> > >> > >>> Ciprian. > >>> > >>> P.S.: When I say Lisp I mean the whole Lisp family, but I would > >>> incline to Scheme. > >>> > >>> > >>> On Nov 23, 2007 12:48 AM, Robin Bhattacharyya wrote: > >>>> This is a quick qualitative comparison of Erlang and Clojure: > >>>> > >>>> http://groups.google.com/group/clojure/browse_thread/thread/2a2b24ffef5d1631 > >>>> > >>>> Does anyone see the benefit of a Lispy version of Erlang on the JVM? > >>>> > >>>> Robin > > > > This would be the basic idea... But for now I lack the time to do > > it... (And I would also have to study the bytecode specification.) > > No you don't have to look into the bytecode! > Erlang Core is nothing more/less than an enriched > lambda calculus. This means that it should be pretty easy to > translate a Scheme syntax into Erlang Core (see the paper by > Richard Carlsson that describes the Erlang Core). > > > > > Just a some minor complaints (so they can be ignored :) I would > > gladly use Erlang for most projects I am working on -- which usually > > reside on server side -- if: > > -- I would have a nice macro system that blends into the normal > > syntax -- for example in Common Lisp 'or' is implemented as a macro, > > but you don't notice it... > > -- I would have proper support for strings, for example an object > > that resembles binary but which is specially built for string > > processing. > > -- I would have proper / mature / stable / feature-full libraries > > for all kind of activities (database access, XML processing, etc.) > > But as I have seen from this group Erlang still has problems in > > this areas... > > I don't think Erlang has got (big) 'problems' in these areas. > We have (and are) doing amazing stuff in Erlang since a long time now. > And frankly, I don't care if the world don't realize the power of > Erlang. I'm just happy as long as I can use it as my 'secret weapon'... > > Cheers, Tobbe Please don't understand me wrong. I am not overlooking the power of Erlang, and also I am not minimizing the importance of all the systems built in Erlang. I am just pointing some areas where some improvements would make a difference -- at least for me. I am perfectly aware that Erlang was not built with these targets, but as it is evolving it could also look in this direction. Because if Erlang wants to be an important player in the Web 2.0 / 3.0 movement -- at least on the server side -- it will need serious / native support for string (+ regex) and XML handling. Ciprian. From kostis@REDACTED Sat Nov 24 22:28:18 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 24 Nov 2007 23:28:18 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> Message-ID: <47489772.2010009@cs.ntua.gr> Ciprian Dorin Craciun wrote: > On Nov 12, 2007 7:35 PM, Torbjorn Tornkvist wrote: >> Ciprian Dorin Craciun wrote: >> >>> Just a some minor complaints (so they can be ignored :) I would >>> gladly use Erlang for most projects I am working on -- which usually >>> reside on server side -- if: >>> -- I would have a nice macro system that blends into the normal >>> syntax -- for example in Common Lisp 'or' is implemented as a macro, >>> but you don't notice it... >> >> I don't think Erlang has got (big) 'problems' in these areas. > > Please don't understand me wrong. I am not overlooking the power > of Erlang, and also I am not minimizing the importance of all the > systems built in Erlang. I am just pointing some areas where some > improvements would make a difference -- at least for me. Can you please elaborate on what you want to see? Are you claiming that because Erlang does not have a nice macro system, it really hinders your application development? In what areas/applications the macro system is not doing what you want it to? Some examples would help (at least me). Kostis (Btw, there are people in this list that claim - often with very good arguments - that the Erlang preprocessor should be taken out and/or replaced and that macros are the sort of all evil.) From ciprian.craciun@REDACTED Sat Nov 24 22:53:47 2007 From: ciprian.craciun@REDACTED (Ciprian Dorin Craciun) Date: Sat, 24 Nov 2007 23:53:47 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <47489772.2010009@cs.ntua.gr> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> <47489772.2010009@cs.ntua.gr> Message-ID: <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> On Nov 24, 2007 11:28 PM, Kostis Sagonas wrote: > Ciprian Dorin Craciun wrote: > > On Nov 12, 2007 7:35 PM, Torbjorn Tornkvist wrote: > >> Ciprian Dorin Craciun wrote: > >> > >>> Just a some minor complaints (so they can be ignored :) I would > >>> gladly use Erlang for most projects I am working on -- which usually > >>> reside on server side -- if: > >>> -- I would have a nice macro system that blends into the normal > >>> syntax -- for example in Common Lisp 'or' is implemented as a macro, > >>> but you don't notice it... > >> > >> I don't think Erlang has got (big) 'problems' in these areas. > > > > Please don't understand me wrong. I am not overlooking the power > > of Erlang, and also I am not minimizing the importance of all the > > systems built in Erlang. I am just pointing some areas where some > > improvements would make a difference -- at least for me. > > > Can you please elaborate on what you want to see? Are you claiming that > because Erlang does not have a nice macro system, it really hinders your > application development? > > In what areas/applications the macro system is not doing what you want > it to? Some examples would help (at least me). > > Kostis > > (Btw, there are people in this list that claim - often with very good > arguments - that the Erlang preprocessor should be taken out and/or > replaced and that macros are the sort of all evil.) "It really hinders application development" is a little to much. Everything that could be achieved by using a macro system, can also be achieved by hand-writing the code... Not having macro system doesn't mean you find roadblocks in development. But having one could make your life easier. First of all please note that when I say macro system, I am reffering to that used by the Lisp family, and not to the one we can see in C/C++ or Erlang. So I am reffering to a macro system that allows me parse tree transformations instead of string manipulation. Also I would like to point out that in order to have a powerful and usable macro system there is a need to have a certain syntax... And therefore imagining new macro constructs in the current language syntax is a bit hard -- at least for me. A macro system is useful when you find yourself writing the same code again and again with only minor differences. In this case you could create a function, but there are times when the code pattern is closer to a new control structure. For example if I would like to execute a piece of code if a condition is true and do nothing otherwise I have to write: if guard -> {do something} true -> false end So instead of introducing a new control structure, I could define a macro that would be used like you can see bellow, but is expanded like the code above: if_ guard -> {do something} end I hope this is a good example even if it is a trivial one. Ciprian. From kostis@REDACTED Sat Nov 24 23:28:12 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Sun, 25 Nov 2007 00:28:12 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> <47489772.2010009@cs.ntua.gr> <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> Message-ID: <4748A57C.2050508@cs.ntua.gr> Ciprian Dorin Craciun wrote: > On Nov 24, 2007 11:28 PM, Kostis Sagonas wrote: >> >> In what areas/applications the macro system is not doing what you >> want it to? Some examples would help (at least me). > > For example if I would like to execute a piece of code if a > condition is true and do nothing otherwise I have to write: > if > guard -> {do something} > true -> false > end > > So instead of introducing a new control structure, I could define > a macro that would be used like you can see below, but is expanded > like the code above: > if_ guard -> {do something} end > > I hope this is a good example even if it is a trivial one. Yes, it's a good example alright, but this is something that can easily be done with the current macro system. For example, in the HiPE native code compiler for Erlang we need similar functionality: doing some pass when a compiler option is specified and doing nothing otherwise. So, we have the macro: -define(when_option(__Opt,__Opts,__Action), case proplists:get_bool(__Opt,__Opts) of true -> __Action; false -> ok end). and we use it all over the place as in e.g: ?when_option(verbose, Opts, ?debug_msg("Compiling ~w~n",[MFA])), Is there something else that you want to do and you can't? Kostis From ciprian.craciun@REDACTED Sat Nov 24 23:38:05 2007 From: ciprian.craciun@REDACTED (Ciprian Dorin Craciun) Date: Sun, 25 Nov 2007 00:38:05 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <4748A57C.2050508@cs.ntua.gr> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> <47489772.2010009@cs.ntua.gr> <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> <4748A57C.2050508@cs.ntua.gr> Message-ID: <8e04b5820711241438x140fb55exe5bb4c4a90673902@mail.gmail.com> On Nov 25, 2007 12:28 AM, Kostis Sagonas wrote: > > Ciprian Dorin Craciun wrote: > > On Nov 24, 2007 11:28 PM, Kostis Sagonas wrote: > >> > >> In what areas/applications the macro system is not doing what you > >> want it to? Some examples would help (at least me). > > > > For example if I would like to execute a piece of code if a > > condition is true and do nothing otherwise I have to write: > > if > > guard -> {do something} > > true -> false > > end > > > > So instead of introducing a new control structure, I could define > > a macro that would be used like you can see below, but is expanded > > like the code above: > > if_ guard -> {do something} end > > > > I hope this is a good example even if it is a trivial one. > > Yes, it's a good example alright, but this is something that can easily > be done with the current macro system. For example, in the HiPE native > code compiler for Erlang we need similar functionality: doing some pass > when a compiler option is specified and doing nothing otherwise. > So, we have the macro: > > -define(when_option(__Opt,__Opts,__Action), > case proplists:get_bool(__Opt,__Opts) of > true -> __Action; > false -> ok > end). > > and we use it all over the place as in e.g: > > ?when_option(verbose, Opts, ?debug_msg("Compiling ~w~n",[MFA])), > > Is there something else that you want to do and you can't? > > Kostis It's not only about something you can or can not. It's also about aesthetics. Compare the following two forms: ?if_(guard, {do something}) vs if_ guard -> {do something} end Which one looks more natural? What if I want to execute two operations? ?if_(guard, begin {operation-1}, {operation-2} end) vs if_ guard -> {operation-1}, {operation-2} end What if I decide there is an else case? In my this case it's a matter of removing a character '_' and adding the true case. In your case I would have to rewrite a good portion. The idea behind a good macro is to be able to "blend" inside the "built-in" syntax and not stand out. For example what if I want to create a special purpose receive that has a default pattern that just removes the unmatched messages, but allows me to have unlimited number of patterns? Can I achieve this with the current macro system? (In your case the macro system should allow me to declare a macro with variable number of arguments.) Ciprian. From kostis@REDACTED Sun Nov 25 00:29:02 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Sun, 25 Nov 2007 01:29:02 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <8e04b5820711241438x140fb55exe5bb4c4a90673902@mail.gmail.com> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> <47489772.2010009@cs.ntua.gr> <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> <4748A57C.2050508@cs.ntua.gr> <8e04b5820711241438x140fb55exe5bb4c4a90673902@mail.gmail.com> Message-ID: <4748B3BE.9030804@cs.ntua.gr> Ciprian Dorin Craciun wrote: > > It's not only about something you can or can not. It's also about > aesthetics. Yes. I very much agree on this. The only problem is that different people have different aesthetics. (Btw, I am not the one who designed the macro system and I am far from enamoured by it, so I am not certain why I am currently defending it. But here is a response to your mail in any case.) > Compare the following two forms: > ?if_(guard, {do something}) > vs > if_ guard -> {do something} end > > Which one looks more natural? Well, in Erlang, I would say it's definitely the first that looks more natural for the following two reasons: 1. It looks like a function call, and function calls are very natural in a functional language. 2. Erlang's if construct has totally different semantics than the ones you want there; it fails if the guard does not evaluate to true. > What if I want to execute two operations? > ?if_(guard, begin {operation-1}, {operation-2} end) > vs > if_ guard -> {operation-1}, {operation-2} end You are making a good argument, but I'd say the best thing to do is to factor the two operations out in a function in such a case. (Actually, the only reason why you need the begin+end is that the ',' symbol is overloaded in Erlang). > What if I decide there is an else case? In my this case it's a > matter of removing a character '_' and adding the true case. In your > case I would have to rewrite a good portion. Well, not really. Your case would be something like: if guard -> {do something}; true -> {do something else} end and in my case it would be a macro: ?if_else(guard, {do something}, {do something else}). (and writing the new macro -- the ?if_ macro would be a special case where the true part is just the above macro with the else part 'ok') > The idea behind a good macro is to be able to "blend" inside the > "built-in" syntax and not stand out. I can give you many reasons why macros in Erlang suck but the "macros stand out in the language" argument comes pretty low on that list. I am not so convinced that Lisp-like macros is what Erlang desperately needs. But then again, disagreements such as these are exactly the reason we have so many different and diverse programming languages... Cheers, Kostis From ciprian.craciun@REDACTED Sun Nov 25 00:43:07 2007 From: ciprian.craciun@REDACTED (Ciprian Dorin Craciun) Date: Sun, 25 Nov 2007 01:43:07 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <4748B3BE.9030804@cs.ntua.gr> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> <47489772.2010009@cs.ntua.gr> <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> <4748A57C.2050508@cs.ntua.gr> <8e04b5820711241438x140fb55exe5bb4c4a90673902@mail.gmail.com> <4748B3BE.9030804@cs.ntua.gr> Message-ID: <8e04b5820711241543i4712114dr92bdc81b1fa7fe41@mail.gmail.com> On Nov 25, 2007 1:29 AM, Kostis Sagonas wrote: > Ciprian Dorin Craciun wrote: > > > > It's not only about something you can or can not. It's also about > > aesthetics. > > Yes. I very much agree on this. The only problem is that different > people have different aesthetics. > > (Btw, I am not the one who designed the macro system and I am far from > enamoured by it, so I am not certain why I am currently defending it. > But here is a response to your mail in any case.) > > > Compare the following two forms: > > ?if_(guard, {do something}) > > vs > > if_ guard -> {do something} end > > > > Which one looks more natural? > > Well, in Erlang, I would say it's definitely the first that looks more > natural for the following two reasons: > > 1. It looks like a function call, and function calls are very natural > in a functional language. > > 2. Erlang's if construct has totally different semantics than the ones > you want there; it fails if the guard does not evaluate to true. > > > What if I want to execute two operations? > > ?if_(guard, begin {operation-1}, {operation-2} end) > > vs > > if_ guard -> {operation-1}, {operation-2} end > > You are making a good argument, but I'd say the best thing to do is to > factor the two operations out in a function in such a case. (Actually, > the only reason why you need the begin+end is that the ',' symbol is > overloaded in Erlang). > > > What if I decide there is an else case? In my this case it's a > > matter of removing a character '_' and adding the true case. In your > > case I would have to rewrite a good portion. > > Well, not really. Your case would be something like: > > if guard -> {do something}; true -> {do something else} end > > and in my case it would be a macro: > > ?if_else(guard, {do something}, {do something else}). > > (and writing the new macro -- the ?if_ macro would be a special case > where the true part is just the above macro with the else part 'ok') > > > The idea behind a good macro is to be able to "blend" inside the > > "built-in" syntax and not stand out. > > I can give you many reasons why macros in Erlang suck but the "macros > stand out in the language" argument comes pretty low on that list. I am > not so convinced that Lisp-like macros is what Erlang desperately needs. > But then again, disagreements such as these are exactly the reason we > have so many different and diverse programming languages... > > Cheers, > Kostis :) I think we have converged to a common conclusion: > [...] I am > not so convinced that Lisp-like macros is what Erlang desperately needs. > But then again, disagreements such as these are exactly the reason we > have so many different and diverse programming languages... Indeed a Lisp-like macro system would work only for a Lisp-like syntax, and this is why I agreed with the thread's starting post (the question if a Lisp syntax Erlang would be usefull.) Furthermore I agree that it would be almost impossible to design a macro system for the current syntax that would approach the flexibility I tried to simulate in the previous examples. But regarding: > > Compare the following two forms: > > ?if_(guard, {do something}) > > vs > > if_ guard -> {do something} end > > > > Which one looks more natural? > > Well, in Erlang, I would say it's definitely the first that looks more > natural for the following two reasons: > > 1. It looks like a function call, and function calls are very natural > in a functional language. I would disagree... normal if, case, receive, try, etc. don't look like function calls but as "special" control structures. So a new version of "if" would look more natural as another "special" control structure than a function call... But this -- again -- is only a mater of taste. Ciprian. From olopierpa@REDACTED Sun Nov 25 02:32:33 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Sun, 25 Nov 2007 02:32:33 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <4748B3BE.9030804@cs.ntua.gr> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> <47489772.2010009@cs.ntua.gr> <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> <4748A57C.2050508@cs.ntua.gr> <8e04b5820711241438x140fb55exe5bb4c4a90673902@mail.gmail.com> <4748B3BE.9030804@cs.ntua.gr> Message-ID: <7352e43a0711241732t5a75f52ey7b0b99a0e7825827@mail.gmail.com> On Nov 25, 2007 12:29 AM, Kostis Sagonas wrote: > Ciprian Dorin Craciun wrote: > I can give you many reasons why macros in Erlang suck but the "macros > stand out in the language" argument comes pretty low on that list. I am > not so convinced that Lisp-like macros is what Erlang desperately needs. > But then again, disagreements such as these are exactly the reason we > have so many different and diverse programming languages... IMHO, lisp-like macros were most useful in lisp at the times when lisp was not good at higher order functions. That is, in the pre common lisp era. Modern functional programming languages have real functions, which provide an expressive and clean way to express any sort of control structures. Macros, even the hygienic variants of scheme, are a source of unjustified complexity and obfuscation. They are dinosaurs from an ancient past. Just say no. Cheers Pierpaolo (mostly a Lisper and Schemer for the last 25 years) From rvirding@REDACTED Sun Nov 25 03:40:44 2007 From: rvirding@REDACTED (Robert Virding) Date: Sun, 25 Nov 2007 03:40:44 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <8e04b5820711241438x140fb55exe5bb4c4a90673902@mail.gmail.com> References: <4e6744df0711221448j275e7a78v59ac968134289b50@mail.gmail.com> <8e04b5820711230124h48b4652chd1c574a9c82d95bf@mail.gmail.com> <8e04b5820711240622q3a931e35i2ff89e2ff4dad71f@mail.gmail.com> <8e04b5820711241130l6b6fefebjf8b47fb179cf7ef4@mail.gmail.com> <47489772.2010009@cs.ntua.gr> <8e04b5820711241353j697addb1v4246c068384ea5be@mail.gmail.com> <4748A57C.2050508@cs.ntua.gr> <8e04b5820711241438x140fb55exe5bb4c4a90673902@mail.gmail.com> Message-ID: <3dbc6d1c0711241840g2ed9546axf05b412abd09caf0@mail.gmail.com> On 24/11/2007, Ciprian Dorin Craciun wrote: > > > For example what if I want to create a special purpose receive > that has a default pattern that just removes the unmatched messages, > but allows me to have unlimited number of patterns? Can I achieve this > with the current macro system? (In your case the macro system should > allow me to declare a macro with variable number of arguments.) > > Ciprian. You can't do this with the current macro package. But as you probably understand it based more on C-macros than lisp macros. It also allows you some cool things which lisp macros can't do, for example expand patterns and insert values anywhere. You would probably actually need something which is a combination of both. If you were doing it in Erlang syntax something with a parse transform would do the trick. But working on Erlang syntax code is messy. They are actually a terrible hack. :-) Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From oneone@REDACTED Sun Nov 25 03:41:42 2007 From: oneone@REDACTED (Andrew Arrow) Date: Sat, 24 Nov 2007 18:41:42 -0800 Subject: [erlang-questions] test driven development Message-ID: I've just finished the Joe Armstrong book (coming from a Java and Ruby background) and I noticed there was nothing in the book about test driven development. Is the idea that Erlang forces you to write such bug free code there are no need for tests? Or was this simply beyond the scope of the book? Do professional Erlang programmers create lots of unit and functional tests like Java and Ruby programmers do? If so, is there a way to run all the tests like there is with junit/testng or Test::Unit in ruby? From robi123@REDACTED Sun Nov 25 04:12:00 2007 From: robi123@REDACTED (Robin Bhattacharyya) Date: Sat, 24 Nov 2007 19:12:00 -0800 Subject: [erlang-questions] Erlang vs Clojure Message-ID: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Smerl manipulates erlang at the abstract form, so smerl is kinda like a lisp macro. A lispy erlang would make erlang easier to manipulate. Paul Graham makes the case in his book On Lisp that some special forms are only possible by using macros. Rich Hickey, the author of Clojure, makes the case that in the past lisps failed to catch on because they were off on an "island" with their own runtimes. The legacy of Java will be the JVM not the Java language, as there are currently ~300 languages targeting the JVM. I think a lispy syntax, with the concurrency principles of Erlang, running on the JVM runtime, could be a powerful combination. From hokan.stenholm@REDACTED Sun Nov 25 04:40:24 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 25 Nov 2007 04:40:24 +0100 Subject: [erlang-questions] test driven development In-Reply-To: References: Message-ID: <4748EEA8.4050205@bredband.net> Andrew Arrow wrote: > I've just finished the Joe Armstrong book (coming from a Java and Ruby > background) and I noticed there was nothing in the book about test > driven development. > > Is the idea that Erlang forces you to write such bug free code there > are no need for tests? Hardly, I certainly can't write bug free code in erlang - languages with strict type systems like Haskell might do somewhat better. Tools like the dialyzer can also be used to enforce type constraints better. The interavtice erlang shell may to some extent, reduce the incentive to write test modules as one can simply try out ones functions in the shell, instead of going to the trouble of creating another module. > Or was this simply beyond the scope of the > book? > Probably just beyond the scoop of the book. > Do professional Erlang programmers create lots of unit and functional > tests like Java and Ruby programmers do? It varies. At my current job at kreditor (www.kreditor.se) we use automated tests quite a bit, there was a presentation about our build/test system at the last Erlang User Conference (see http://www.erlang.se/euc/07/ "Quality Cruising -- Making Java Work for Erlang"). On the other hand, during the time I worked at Ericsson (1998-2002) it wasn't until around 2000, that we started to write automated tests for the AXD301 (there where lots of manual system and unit tests though) e.g. it took several years after the AXDs initial creation before automated testing was implemented. Another common way to deal with bugs especially on production systems, is to use lots of logging (there are OTP modules for this) which makes it possible to figure out the odd circumstances that resulted in bugs, that you forgot about in your test suites. > If so, is there a way to run > all the tests like there is with junit/testng or Test::Unit in ruby? > It's pretty trivial to roll your own test framework in erlang, partly due to erlangs pattern matching ability, which is very useful to define test conditions. For more advanced tools with fancy GUIs for success/error reporting etc there are the: * OTP test server (used to test erlang) * yatsy (similar to the OTP test server) * eunit (version 2 should be the current one - similar to junit/nunit/...) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From yarivsadan@REDACTED Sun Nov 25 10:13:29 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Sun, 25 Nov 2007 01:13:29 -0800 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: <17244f480711250113s7b9bde2eo3b8d79af6353559e@mail.gmail.com> Smerl makes certain manipulations of an Erlang AST easier than doing so manually, but it's not as powerful as Lisp macros. After doing Smerl, I started working on a Lispy dialect for Erlang as an experiment -- I wanted to see how advantageous it would be to have Lisp's code generation capabilities in Erlang. Whether the resulting language would be "better" than standard Erlang I can't say. I think it would make some things easier but the main disadvantage is that it would be less readable for programmers who haven't used Lisp much. I think it would be easier for Erlang programmers to adopt a Lispy dialect of Erlang than for Java programmers to adopt a Lisp that runs on the JVM. Although some of Erlang's concurrency principles could be adopted by JVM languages, I think it will be some time before any of them will provide the full capabilities of Erlang for building concurrent/distributed systems: per-process heaps and garbage collection, lightweight processes, preemptive scheduling, port-based native code interface, transparent distribution, immutable data, hot code swapping, fault tolerance, Mnesia, etc. If I were building a new app, I'd rather use Erlang to do the heavy lifting and occasionally outsource some tasks to Java using jinterface than a JVM language that isn't as powerful as Erlang is for building scalable fault tolerant systems just because it makes calling existing Java libraries a bit easier. Regards, Yariv On Nov 24, 2007 7:12 PM, Robin Bhattacharyya wrote: > Smerl manipulates erlang at the abstract form, so smerl is kinda like > a lisp macro. A lispy erlang would make erlang easier to manipulate. > > Paul Graham makes the case in his book On Lisp that some special forms > are only possible by using macros. > > Rich Hickey, the author of Clojure, makes the case that in the past > lisps failed to catch on because they were off on an "island" with > their own runtimes. The legacy of Java will be the JVM not the Java > language, as there are currently ~300 languages targeting the JVM. > > I think a lispy syntax, with the concurrency principles of Erlang, > running on the JVM runtime, could be a powerful combination. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Sun Nov 25 11:33:19 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 25 Nov 2007 02:33:19 -0800 (PST) Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: <415494.59322.qm@web38812.mail.mud.yahoo.com> --- Robin Bhattacharyya wrote: > Rich Hickey, the author of Clojure, makes the case > that in the past > lisps failed to catch on because they were off on an > "island" with > their own runtimes. The legacy of Java will be the > JVM not the Java > language, as there are currently ~300 languages > targeting the JVM. Were I to do something like that, I'd very seriously consider targeting the CLR. Or DLR. So if you do go down that road, don't bet on the wrong island. Best, Thomas ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From valentin@REDACTED Sun Nov 25 11:56:02 2007 From: valentin@REDACTED (Valentin Micic) Date: Sun, 25 Nov 2007 12:56:02 +0200 Subject: [erlang-questions] Erlang vs Clojure References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: <004a01c82f51$c9505280$6401a8c0@moneymaker2> Couldn't these ~300 languages you're mentioning serve as the best testimonial about magnitude of Java's failure? Running these language on top of JVM looks to me like having a headache and attempting to cure it by hitting ones kneecap with a big hammer. Hey, head is no longer hurting, but good that you're not asking about my knee... The cure is: have a healthier life-style. Erlang is one option, the other... I've been considering career in agriculture for quite some time now ;-). Power of Erlang, IMHO, is substantially embedded in a language itself, thus, assuming that Erlang is not suitable for everything, instead of "dot-netting" (*) the environment, one should just continue doing what we've been doing: integrate with the external environment, whilst preserving the identity -- if Erlang is to strive (and, my God, it worked so well for me during the last six years), one *must* evangelize the language, not the VM. V. (*) Java, IMHO, was never a step forward. It was a reaction to Microsoft's domination of the world... So, when Microsoft introduced dot-net, a (bit delayed) reaction was to introduce a bunch of new languages to run on top of JVM, to counter a new threat. Why should Erlang sing the same tune? Or am I too cynical? ----- Original Message ----- From: "Robin Bhattacharyya" To: Sent: Sunday, November 25, 2007 5:12 AM Subject: [erlang-questions] Erlang vs Clojure > Smerl manipulates erlang at the abstract form, so smerl is kinda like > a lisp macro. A lispy erlang would make erlang easier to manipulate. > > Paul Graham makes the case in his book On Lisp that some special forms > are only possible by using macros. > > Rich Hickey, the author of Clojure, makes the case that in the past > lisps failed to catch on because they were off on an "island" with > their own runtimes. The legacy of Java will be the JVM not the Java > language, as there are currently ~300 languages targeting the JVM. > > I think a lispy syntax, with the concurrency principles of Erlang, > running on the JVM runtime, could be a powerful combination. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf@REDACTED Sun Nov 25 12:10:32 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 25 Nov 2007 12:10:32 +0100 Subject: [erlang-questions] test driven development In-Reply-To: <4748EEA8.4050205@bredband.net> References: <4748EEA8.4050205@bredband.net> Message-ID: <8209f740711250310t386cbcf9m44daf3c1b9c846dd@mail.gmail.com> 2007/11/25, H?kan Stenholm : > > On the other hand, during the time I worked at Ericsson (1998-2002) it > wasn't until around 2000, that we started to write automated tests for > the AXD301 (there where lots of manual system and unit tests though) > e.g. it took several years after the AXDs initial creation before > automated testing was implemented. Not to disagree with this account, but I'd like to add, for the record, that when the AXD301 started in 1996, OTP didn't even exist, except mainly on the planning board. There was a predecessor, called BOS, which our designers had to learn and start experimenting with. When the first version of OTP came in 1997, they had to start studying the differences... Needless to say, there wasn't any well established automated testing framework for OTP at the time, and we had a product to build. We delivered the first version of AXD 301 late 1998. At that time, the OTP team had an internal framework for automated testing, and we started discussing the possibility of it becoming a supported component. I was happy to hear that it will be in the upcoming R12B release. (: We did start using the Erlang/OTP test framework in 1999, but based on the agreement that we received a snapshot of the code and didn't expect support. The Erlang/OTP team has been using automated testing for many years, in other words. Automated testing of products like the AXD 301 is more difficult, since there are lots of dependencies to hardware, network and operators. That's one reason why it took longer to build a considerable automated test suite. Nowadays, it /is/ considerable, with well over 10,000 test cases, most automated (as far as I know). BR, Ulf W From robi123@REDACTED Sun Nov 25 12:28:52 2007 From: robi123@REDACTED (Robin) Date: Sun, 25 Nov 2007 03:28:52 -0800 (PST) Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <004a01c82f51$c9505280$6401a8c0@moneymaker2> References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> <004a01c82f51$c9505280$6401a8c0@moneymaker2> Message-ID: <8cefe13d-fd59-44ce-8315-340961593363@d21g2000prf.googlegroups.com> That could be a testimonial of the failure of the Java Language, but it might be a success story for the Java Virtual Machine. The interesting thing about those 287 languages is that they work both ways. It is not only that you can call existing Java libraries, but you can embed those 287 languages within your application. It is like selecting any language for the task at hand rather than bending the language you have to fit every task. Projects like Jython and JRuby are really picking up steam. JRuby v1.1 now out performs the C Ruby interpreter. On Nov 25, 2:56 am, "Valentin Micic" wrote: > Couldn't these ~300 languages you're mentioning serve as the best > testimonial about magnitude of Java's failure? > Running these language on top of JVM looks to me like having a headache and > attempting to cure it by hitting ones kneecap with a big hammer. Hey, head > is no longer hurting, but good that you're not asking about my knee... > The cure is: have a healthier life-style. Erlang is one option, the other... > I've been considering career in agriculture for quite some time now ;-). > > Power of Erlang, IMHO, is substantially embedded in a language itself, thus, > assuming that Erlang is not suitable for everything, instead of > "dot-netting" (*) the environment, one should just continue doing what we've > been doing: integrate with the external environment, whilst preserving the > identity -- if Erlang is to strive (and, my God, it worked so well for me > during the last six years), one *must* evangelize the language, not the VM. > > V. > > (*) Java, IMHO, was never a step forward. It was a reaction to Microsoft's > domination of the world... So, when Microsoft introduced dot-net, a (bit > delayed) reaction was to introduce a bunch of new languages to run on top of > JVM, to counter a new threat. Why should Erlang sing the same tune? Or am I > too cynical? > > > > ----- Original Message ----- > From: "Robin Bhattacharyya" > To: > Sent: Sunday, November 25, 2007 5:12 AM > Subject: [erlang-questions] Erlang vs Clojure > > > Smerl manipulates erlang at the abstract form, so smerl is kinda like > > a lisp macro. A lispy erlang would make erlang easier to manipulate. > > > Paul Graham makes the case in his book On Lisp that some special forms > > are only possible by using macros. > > > Rich Hickey, the author of Clojure, makes the case that in the past > > lisps failed to catch on because they were off on an "island" with > > their own runtimes. The legacy of Java will be the JVM not the Java > > language, as there are currently ~300 languages targeting the JVM. > > > I think a lispy syntax, with the concurrency principles of Erlang, > > running on the JVM runtime, could be a powerful combination. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From valentin@REDACTED Sun Nov 25 13:46:22 2007 From: valentin@REDACTED (Valentin Micic) Date: Sun, 25 Nov 2007 14:46:22 +0200 Subject: [erlang-questions] Erlang vs Clojure References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> <004a01c82f51$c9505280$6401a8c0@moneymaker2> <8cefe13d-fd59-44ce-8315-340961593363@d21g2000prf.googlegroups.com> Message-ID: <005a01c82f61$324b2da0$6401a8c0@moneymaker2> I am against bending the language to fit the task, but I am not in favour of bending a specific reality (i.e. JVM) either. This is what I'm saying: don't treat the symptoms -- cure the disease. And further yet: one that sleeps with dogs, will, eventually, end up with flees. V. ----- Original Message ----- From: "Robin" To: Sent: Sunday, November 25, 2007 1:28 PM Subject: Re: [erlang-questions] Erlang vs Clojure > That could be a testimonial of the failure of the Java Language, but > it might be a success story for the Java Virtual Machine. > > The interesting thing about those 287 languages is that they work both > ways. It is not only that you can call existing Java libraries, but > you can embed those 287 languages within your application. It is like > selecting any language for the task at hand rather than bending the > language you have to fit every task. > > Projects like Jython and JRuby are really picking up steam. JRuby > v1.1 now out performs the C Ruby interpreter. > > On Nov 25, 2:56 am, "Valentin Micic" wrote: >> Couldn't these ~300 languages you're mentioning serve as the best >> testimonial about magnitude of Java's failure? >> Running these language on top of JVM looks to me like having a headache >> and >> attempting to cure it by hitting ones kneecap with a big hammer. Hey, >> head >> is no longer hurting, but good that you're not asking about my knee... >> The cure is: have a healthier life-style. Erlang is one option, the >> other... >> I've been considering career in agriculture for quite some time now ;-). >> >> Power of Erlang, IMHO, is substantially embedded in a language itself, >> thus, >> assuming that Erlang is not suitable for everything, instead of >> "dot-netting" (*) the environment, one should just continue doing what >> we've >> been doing: integrate with the external environment, whilst preserving >> the >> identity -- if Erlang is to strive (and, my God, it worked so well for me >> during the last six years), one *must* evangelize the language, not the >> VM. >> >> V. >> >> (*) Java, IMHO, was never a step forward. It was a reaction to >> Microsoft's >> domination of the world... So, when Microsoft introduced dot-net, a (bit >> delayed) reaction was to introduce a bunch of new languages to run on top >> of >> JVM, to counter a new threat. Why should Erlang sing the same tune? Or am >> I >> too cynical? >> >> >> >> ----- Original Message ----- >> From: "Robin Bhattacharyya" >> To: >> Sent: Sunday, November 25, 2007 5:12 AM >> Subject: [erlang-questions] Erlang vs Clojure >> >> > Smerl manipulates erlang at the abstract form, so smerl is kinda like >> > a lisp macro. A lispy erlang would make erlang easier to manipulate. >> >> > Paul Graham makes the case in his book On Lisp that some special forms >> > are only possible by using macros. >> >> > Rich Hickey, the author of Clojure, makes the case that in the past >> > lisps failed to catch on because they were off on an "island" with >> > their own runtimes. The legacy of Java will be the JVM not the Java >> > language, as there are currently ~300 languages targeting the JVM. >> >> > I think a lispy syntax, with the concurrency principles of Erlang, >> > running on the JVM runtime, could be a powerful combination. >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questi...@REDACTED >> >http://www.erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Sun Nov 25 13:51:25 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 25 Nov 2007 12:51:25 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: On Nov 25, 2007, at 3:12 AM, Robin Bhattacharyya wrote: > Smerl manipulates erlang at the abstract form, so smerl is kinda like > a lisp macro. A lispy erlang would make erlang easier to manipulate. My biggest beef with Erlang is that even with parse transforms I cannot make a !! b stand for funcall(a, b). If the Erlang implementation removed this restriction then surely all sorts of creative uses would be enabled. Thanks, Joel -- http://wagerlabs.com From erlang@REDACTED Sun Nov 25 13:58:01 2007 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 25 Nov 2007 13:58:01 +0100 Subject: [erlang-questions] test driven development In-Reply-To: References: Message-ID: <9b08084c0711250458l417f378auf8806b518c170653@mail.gmail.com> I think a lot of Erlang programmers have accidentally being using test driven development for a long time without knowing it. This is because the test mechanism is so lightweight that it goes unnoticed... There are actually two interpretations of a pattern: - a test - an unpacking operation If there is any possibility that an '=' can fail then the '=' can be viewed as a test. Suppose I want to start by writing unit tests before I write my code. I'll illustrate this by writing a function nth that returns the n'th element of a list. I can start by writing a test case: test()-> b = nth(2,[a,b,c]). Because = can fail here this serves as a test. This can be viewed as an extremely light-weight unit test Now I write my nth function and test it .. As I proceed I add more tests: test() -> b = nth(2,[a,b,c]), {'EXIT',_} = (catch, nth(-1, [a,b])), {'EXIT',_} = (catch nth(3,[a,b])), hooray. This is three unit test, but no big deal. I often write a function test/0 like this (that returns hooray) and build this into my edit-compile-test cycle - when all my module say hooray then I'm happy. Functions can be viewed as having in-build unit test code in many places: foo(...) -> ... {ok, Socket} = gen_tcp:connect(....) ... is a test AND an unpacking operation boiled into one. Suppose I write ... gen_tcp:send(Socket, Data) ... This involves no testing, but adding a test is easy ... ok = gen_tcp:send(Socket, Data) .... adds a test - this has the added benefit of causing the program to fail as soon as the error is detected. "fail early" is *always* a good idea since it minimizes the chance of causing additional errors. Even without equality the way functions are written provides a form of assertion checking. foo(a) -> 1; foo(b) -> 2. asserts that the argument to foo/1 is a or b. So ideas of assertions and "design by contract" are pretty much implicit in all Erlang code. It's only after the Erlang book was published that I realized that this way of interpreting code was not widespread - this is perhapses something further books and articles might like to emphasis. On Nov 25, 2007 3:41 AM, Andrew Arrow wrote: > I've just finished the Joe Armstrong book (coming from a Java and Ruby > background) and I noticed there was nothing in the book about test > driven development. > > Is the idea that Erlang forces you to write such bug free code there > are no need for tests? Or was this simply beyond the scope of the > book? > > Do professional Erlang programmers create lots of unit and functional > tests like Java and Ruby programmers do? If so, is there a way to run > all the tests like there is with junit/testng or Test::Unit in ruby? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Sun Nov 25 14:48:57 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 25 Nov 2007 05:48:57 -0800 (PST) Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: Message-ID: <149017.87260.qm@web38807.mail.mud.yahoo.com> --- Joel Reymont wrote: > > On Nov 25, 2007, at 3:12 AM, Robin Bhattacharyya > wrote: > > > Smerl manipulates erlang at the abstract form, so > smerl is kinda like > > a lisp macro. A lispy erlang would make erlang > easier to manipulate. > > > My biggest beef with Erlang is that even with parse > transforms I > cannot make a !! b stand for funcall(a, b). If the > Erlang > implementation removed this restriction then surely > all sorts of > creative uses would be enabled. In other words, you want user-defined infix operators. The easy way, Haskell-style, took a couple of hours to implement a few years ago (recipe: modify lexer to recognize infix-op tokens, then add an extra rule to parser to handle them), but got bogged down in the usual bureaucracy and kibbitzing. So this time, first write an EEP and you're set to go. The hard way would be something like ML or Prolog full infix syntax (and prefix, postfix, and different associativities for Prolog). I think that can safely be left for later. Best, Thomas ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs From ulf@REDACTED Sun Nov 25 15:37:25 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 25 Nov 2007 15:37:25 +0100 Subject: [erlang-questions] test driven development In-Reply-To: <8209f740711250310t386cbcf9m44daf3c1b9c846dd@mail.gmail.com> References: <4748EEA8.4050205@bredband.net> <8209f740711250310t386cbcf9m44daf3c1b9c846dd@mail.gmail.com> Message-ID: <8209f740711250637i86b4598q15d4dd211f8b5fd6@mail.gmail.com> 2007/11/25, Ulf Wiger : > > That's one reason why it took longer to build > a considerable automated test suite. Nowadays, it /is/ considerable, > with well over 10,000 test cases, most automated (as far as I know). One problem with having test suites this large is that they become a maintenance problem: whenever you consider changing an interface, you have to consider which parts of nearly a million lines of test code use that interface... To make matters worse, some test suites may even use undocumented functions (which of course has its advantages, but certainly not from a maintenance perspective). This is a very good reason to look at things like QuickCheck, IMHO. Essentially, you specify the rules and basic building blocks of the testing, and then let a tool come up with all possible combinations. This radically cuts down on the amount of test code that needs to be written, and thus also the maintenance cost of the test code. BR, Ulf W From oneone@REDACTED Sun Nov 25 15:39:35 2007 From: oneone@REDACTED (Andrew Arrow) Date: Sun, 25 Nov 2007 06:39:35 -0800 Subject: [erlang-questions] lists:member efficiency Message-ID: How efficient is the lists:member call? If I have a large list of integers where the order is important and I need to know if a specific integer is in the list, should I maintain two separate data structures? One normal list where I keep appending new items onto the head, and an ETS set with a key for each integer and the value "true" just to know that integer is in the list. So either I call ets:lookup on this separate hash, or lists:member on the normal list. If the list has over 100,000 items would lists:member keep up okay? Thanks. From michael.campbell@REDACTED Sun Nov 25 15:57:25 2007 From: michael.campbell@REDACTED (Michael Campbell) Date: Sun, 25 Nov 2007 09:57:25 -0500 Subject: [erlang-questions] test driven development In-Reply-To: <8209f740711250637i86b4598q15d4dd211f8b5fd6@mail.gmail.com> References: <4748EEA8.4050205@bredband.net> <8209f740711250310t386cbcf9m44daf3c1b9c846dd@mail.gmail.com> <8209f740711250637i86b4598q15d4dd211f8b5fd6@mail.gmail.com> Message-ID: <811f2f1c0711250657i4625afb6j25249670a354c431@mail.gmail.com> On Nov 25, 2007 9:37 AM, Ulf Wiger wrote: > 2007/11/25, Ulf Wiger : > > > > That's one reason why it took longer to build > > a considerable automated test suite. Nowadays, it /is/ considerable, > > with well over 10,000 test cases, most automated (as far as I know). > > One problem with having test suites this large is that they become > a maintenance problem: whenever you consider changing an interface, > you have to consider which parts of nearly a million lines of test code > use that interface... You say that like it's bad. Too, exhaustive tests will quickly tell you which of those 1e6 lines of code are actually affected. But point taken; yes, maintaining code is hard, and tests *are* code, so the more you have, the more maintenance is required. From daf@REDACTED Sun Nov 25 16:02:36 2007 From: daf@REDACTED (YANSWBVCG) Date: Sun, 25 Nov 2007 16:02:36 +0100 (CET) Subject: [erlang-questions] test driven development Message-ID: <200711251502.lAPF2aap025629@morgoth.cslab.ericsson.net> The Erlang graphics environment for debugging as described in the book _Programming Erlang_ appears not to work with the erl shell in the 64-bit AMD port of Erlang to OpenBSD 4.2. From mogorman@REDACTED Sun Nov 25 17:08:47 2007 From: mogorman@REDACTED (mog) Date: Sun, 25 Nov 2007 10:08:47 -0600 Subject: [erlang-questions] test driven development In-Reply-To: <200711251502.lAPF2aap025629@morgoth.cslab.ericsson.net> References: <200711251502.lAPF2aap025629@morgoth.cslab.ericsson.net> Message-ID: <1196006927.4533.1.camel@metalman.lan> On Sun, 2007-11-25 at 16:02 +0100, YANSWBVCG wrote: > The Erlang graphics environment for debugging as described in the book > _Programming Erlang_ appears not to work with the erl shell in the 64-bit > AMD port of Erlang to OpenBSD 4.2. i imagine openbsd built it without requiring the tcl dependencies needed for this. one trick is if they had installed the deps without the libraries just install tcl, otherwise you will have to install tcl and then build erlang from source mog -------------- 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 vladdu55@REDACTED Sun Nov 25 17:20:57 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 25 Nov 2007 16:20:57 +0000 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <17244f480711250113s7b9bde2eo3b8d79af6353559e@mail.gmail.com> References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> <17244f480711250113s7b9bde2eo3b8d79af6353559e@mail.gmail.com> Message-ID: <95be1d3b0711250820t2149564dscf2ac1cb6e8d92d8@mail.gmail.com> Hi, On Nov 25, 2007 9:13 AM, Yariv Sadan wrote: > I think it would be easier for Erlang programmers to adopt a Lispy > dialect of Erlang than for Java programmers to adopt a Lisp that runs > on the JVM. I can't really understand why it would be good to run Erlang on the JVM. It would become just one of the other 300 languages, losing at the same time its most important feature, namely its own VM. It is the runtime that brings in all the benefits of the super-light processes and their communication channels. On the JVM, I doubt one could do much better than Scala's actors. Just to give them an Erlangy syntax doesn't seem like a huge benefit to me... best regards, Vlad From ulf@REDACTED Sun Nov 25 17:55:02 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 25 Nov 2007 17:55:02 +0100 Subject: [erlang-questions] lists:member efficiency In-Reply-To: References: Message-ID: <8209f740711250855i421639e3x67dc6c3277f692a3@mail.gmail.com> 2007/11/25, Andrew Arrow : > > If the list has over 100,000 items would > lists:member keep up okay? This simple test can give you an idea: Eshell V5.5.4 (abort with ^G) 1> L = lists:seq(1,100000). [1, 2, ... 29|...] 2> timer:tc(lists,member,[100000,L]). {994,true} 3> timer:tc(lists,member,[100001,L]). {995,false} This is a crude measure of the worst-case performance of using lists:member/2 on a list of 100,000 elements - namely hitting the last object in the list (well, the worst case is actually when no object is found, but the difference falls within the margin of error.) Normally, you'd reckon that half this cost will be your average cost, but YMMV. BR, Ulf W From erlang@REDACTED Sun Nov 25 17:57:40 2007 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 25 Nov 2007 17:57:40 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <149017.87260.qm@web38807.mail.mud.yahoo.com> References: <149017.87260.qm@web38807.mail.mud.yahoo.com> Message-ID: <9b08084c0711250857j70b2f7besc8368c5cd7386279@mail.gmail.com> I think it would be easier to allow syntax transforms *before* parse_transform. We need character_transform that kicks in before tokenisation, and token_transform which kicks in after character_transform but before parse_transform. /Joe Armstrong On Nov 25, 2007 2:48 PM, Thomas Lindgren wrote: > > --- Joel Reymont wrote: > > > > > On Nov 25, 2007, at 3:12 AM, Robin Bhattacharyya > > wrote: > > > > > Smerl manipulates erlang at the abstract form, so > > smerl is kinda like > > > a lisp macro. A lispy erlang would make erlang > > easier to manipulate. > > > > > > My biggest beef with Erlang is that even with parse > > transforms I > > cannot make a !! b stand for funcall(a, b). If the > > Erlang > > implementation removed this restriction then surely > > all sorts of > > creative uses would be enabled. > > In other words, you want user-defined infix operators. > > > The easy way, Haskell-style, took a couple of hours to > implement a few years ago (recipe: modify lexer to > recognize infix-op tokens, then add an extra rule to > parser to handle them), but got bogged down in the > usual bureaucracy and kibbitzing. So this time, first > write an EEP and you're set to go. > > The hard way would be something like ML or Prolog full > infix syntax (and prefix, postfix, and different > associativities for Prolog). I think that can safely > be left for later. > > Best, > Thomas > > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From daf@REDACTED Sun Nov 25 18:49:56 2007 From: daf@REDACTED (YANSWBVCG) Date: Sun, 25 Nov 2007 18:49:56 +0100 (CET) Subject: [erlang-questions] test driven development In-Reply-To: <1196006927.4533.1.camel@metalman.lan> Message-ID: <200711251749.lAPHnuQw000248@morgoth.cslab.ericsson.net> On Sun, Nov 25, 2007 at 10:08:47AM -0600, mog wrote: > > On Sun, 2007-11-25 at 16:02 +0100, YANSWBVCG wrote: > > The Erlang graphics environment for debugging as described in the book > > _Programming Erlang_ appears not to work with the erl shell in the 64-bit > > AMD port of Erlang to OpenBSD 4.2. > > i imagine openbsd built it without requiring the tcl dependencies needed > for this. one trick is if they had installed the deps without the > libraries just install tcl, otherwise you will have to install tcl and > then build erlang from source > > mog OK. I have installed tk and tcl and also rebuilt the Erlang package. I get further but still get an error when doing the following: ------- cd Erlang/code erl c(lib_misc,[debug_info]). ii(). # I get an error report here ------- Is Java required for Erlang? I do not have Java capability on my system. Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dfeustel@REDACTED Sun Nov 25 19:18:08 2007 From: dfeustel@REDACTED (YANSWBVCG) Date: Sun, 25 Nov 2007 19:18:08 +0100 (CET) Subject: [erlang-questions] test driven development In-Reply-To: <1196006927.4533.1.camel@metalman.lan> Message-ID: <200711251818.lAPII8xI025919@morgoth.cslab.ericsson.net> On Sun, Nov 25, 2007 at 10:08:47AM -0600, mog wrote: > > On Sun, 2007-11-25 at 16:02 +0100, YANSWBVCG wrote: > > The Erlang graphics environment for debugging as described in the book > > _Programming Erlang_ appears not to work with the erl shell in the 64-bit > > AMD port of Erlang to OpenBSD 4.2. > > i imagine openbsd built it without requiring the tcl dependencies needed > for this. one trick is if they had installed the deps without the > libraries just install tcl, otherwise you will have to install tcl and > then build erlang from source > > mog I installed tcl/tk 4.84 and rebuilt the OpenBSD erlang package. I now get a little further, but still no joy. The error message follows: --------- 2/home/daf}cd Erl/code 2/home/daf/Erl/code}erl Erlang (BEAM) emulator version 5.5.5 [source] [64-bit] [async-threads:0] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) 1> ii(). ** exited: {undef,[{shell_default,ii,[]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** =ERROR REPORT==== 25-Nov-2007::13:02:35 === Error in process <0.32.0> with exit value: {undef,[{shell_default,ii,[]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} 2> --------- Is Java required to build/run Erlang? Thanks. From masterofquestions@REDACTED Sun Nov 25 19:32:36 2007 From: masterofquestions@REDACTED (Russell King) Date: Sun, 25 Nov 2007 13:32:36 -0500 Subject: [erlang-questions] newbie: Question on Pragmatic Erlang book example, in OTP Introduction Message-ID: <1218d6a50711251032t5e34f9b4n2900526134c7f80f@mail.gmail.com> I have a question about Pragmatic Erlang book example, in OTP Introduction-the road to the generic server, pg 295-296. What modules' functions and which order are these modules' functions are called, when you do name_server:add(joe, "at_home") ? do you call: name_server1::add and then rpc fuction in server3, what happens after this? when does name_server1:handle({add, Name, Place}, Dict) get called? Here is the code: 1> server3:start(name_server, name_server1). true 2> name_server:add(joe, "at home"). ok -module(server3). -export([start/2, rpc/2, swap_code/2]). start(Name, Mod) -> register(Name, spawn(fun() -> loop(Name,Mod,Mod:init()) end)). swap_code(Name, Mod) -> rpc(Name, {swap_code, Mod}). rpc(Name, Request) -> Name ! {self(), Request}, receive {Name, Response} -> Response end. loop(Name, Mod, OldState) -> receive {From, {swap_code, NewCallBackMod}} -> From ! {Name, ack}, loop(Name, NewCallBackMod, OldState); {From, Request} -> {Response, NewState} = Mod:handle(Request, OldState), From ! {Name, Response}, loop(Name, Mod, NewState) end. -module(name_server1). -export([init/0, add/2, whereis/1, handle/2]). -import(server3, [rpc/2]). %% client routines add(Name, Place) -> rpc(name_server, {add, Name, Place}). whereis(Name) -> rpc(name_server, {whereis, Name}). %% callback routines init() -> dict:new(). handle({add, Name, Place}, Dict) -> {ok, dict:store(Name, Place, Dict)}; handle({whereis, Name}, Dict) -> {dict:find(Name, Dict), Dict}. regards, Russ From toby@REDACTED Sun Nov 25 19:35:33 2007 From: toby@REDACTED (Toby Thain) Date: Sun, 25 Nov 2007 16:35:33 -0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <415494.59322.qm@web38812.mail.mud.yahoo.com> References: <415494.59322.qm@web38812.mail.mud.yahoo.com> Message-ID: On 25-Nov-07, at 8:33 AM, Thomas Lindgren wrote: > > --- Robin Bhattacharyya wrote: >> Rich Hickey, the author of Clojure, makes the case >> that in the past >> lisps failed to catch on because they were off on an >> "island" with >> their own runtimes. The legacy of Java will be the >> JVM not the Java >> language, as there are currently ~300 languages >> targeting the JVM. > > Were I to do something like that, I'd very seriously > consider targeting the CLR. Or DLR. So if you do go > down that road, don't bet on the wrong island. Some would opine that a closed, proprietary island is the one sure to sink. Or sink you. --T > > Best, > Thomas > > > > > ______________________________________________________________________ > ______________ > Be a better sports nut! Let your teams follow you > with Yahoo Mobile. Try it now. http://mobile.yahoo.com/ > sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Sun Nov 25 19:51:22 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 25 Nov 2007 18:51:22 +0000 Subject: [erlang-questions] test driven development In-Reply-To: <200711251818.lAPII8xI025919@morgoth.cslab.ericsson.net> References: <1196006927.4533.1.camel@metalman.lan> <200711251818.lAPII8xI025919@morgoth.cslab.ericsson.net> Message-ID: <95be1d3b0711251051o6343abebuf18fdfcfa196b11f@mail.gmail.com> Hi, On Nov 25, 2007 6:18 PM, YANSWBVCG wrote: > Eshell V5.5.5 (abort with ^G) > 1> ii(). > ** exited: {undef,[{shell_default,ii,[]}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** What's "ii()"? Maybe you meant i() or ii(some_module). > Is Java required to build/run Erlang? No, it's not at all required. regards, Vlad From kenneth.lundin@REDACTED Sun Nov 25 20:13:05 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sun, 25 Nov 2007 20:13:05 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: Hi Joel, If you like Erlang why do you then almost all the time ask for changes of the language? If you have a serious suggestion of some new feature I suggest that you write an EEP (Erlang Enhancement Porposal) and we can discuss the pros and cons of that and decide if it should make it into the distribution. /Kenneth Erlang/OTP team at Ericsson On Nov 25, 2007 1:51 PM, Joel Reymont wrote: > > On Nov 25, 2007, at 3:12 AM, Robin Bhattacharyya wrote: > > > Smerl manipulates erlang at the abstract form, so smerl is kinda like > > a lisp macro. A lispy erlang would make erlang easier to manipulate. > > > My biggest beef with Erlang is that even with parse transforms I > cannot make a !! b stand for funcall(a, b). If the Erlang > implementation removed this restriction then surely all sorts of > creative uses would be enabled. > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vladdu55@REDACTED Sun Nov 25 20:37:03 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 25 Nov 2007 19:37:03 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <9b08084c0711250857j70b2f7besc8368c5cd7386279@mail.gmail.com> References: <149017.87260.qm@web38807.mail.mud.yahoo.com> <9b08084c0711250857j70b2f7besc8368c5cd7386279@mail.gmail.com> Message-ID: <95be1d3b0711251137h37ab6b48p89d4b7171bde2b85@mail.gmail.com> Hi, On Nov 25, 2007 4:57 PM, Joe Armstrong wrote: > I think it would be easier to allow syntax transforms *before* > parse_transform. We need > character_transform that kicks in before tokenisation, and > token_transform which kicks in after character_transform but before > parse_transform. Cool idea! But I'm not sure what char_transform would do. I suppose it can select strings with regexps,and do what to them? What it would be meaningful would be to replace them with tokens, as a sort of pre-tokenizer, but then the scanner should accept a stream of characters mixed with tokens..... Maybe token_transform is enough: given that the tokenizer will return any unmatched characters as their own tokens, a token_transform phase could take a sequence of two {'!', Line} tokens and compress them into a {'!!', Line} one. Possible troublemakers would be whitespaces, as we might want to convert two consecutive '!'s, without any intervening spaces. best regards, Vlad From oneone@REDACTED Sun Nov 25 20:46:45 2007 From: oneone@REDACTED (Andrew Arrow) Date: Sun, 25 Nov 2007 11:46:45 -0800 Subject: [erlang-questions] ets gives badarg after recompile Message-ID: If I create a new ets with ets:new(myname, [set, named_table]). and do some inserts and lookups from it everything is fine. At the end of the program I call ets:delete(myname). I can re-run the program from the shell, no problems. But if I recompile it and then run I get: =ERROR REPORT==== 25-Nov-2007::11:38:26 === Error in process <0.3579.10> with exit value: {badarg,[{ets,lookup,[myname,53]},{ets_test,my_map,2}]} I have to hit control-G and kill the job and create a new shell. Then I can compile and run it fine again. But on the 2nd compile same thing happens. Why does c(my_module). make the ets no longer work and require a new shell? From erlang@REDACTED Sun Nov 25 21:32:45 2007 From: erlang@REDACTED (Joe Armstrong) Date: Sun, 25 Nov 2007 21:32:45 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <95be1d3b0711251137h37ab6b48p89d4b7171bde2b85@mail.gmail.com> References: <149017.87260.qm@web38807.mail.mud.yahoo.com> <9b08084c0711250857j70b2f7besc8368c5cd7386279@mail.gmail.com> <95be1d3b0711251137h37ab6b48p89d4b7171bde2b85@mail.gmail.com> Message-ID: <9b08084c0711251232s7731feeem116c8d1c95bb6462@mail.gmail.com> No this has nothing to do with regexps -compile({character_transform, Mod}). would (by analogy with parse_transform) call Mod:character_transform(Bin, Opts) when Bin was the content of the file being compiled it would return Bin' Then you could do anything you like. -compile({tokenezer, Mod}). could maybe call a custom tokeniser after character processing and prior to calling any parse transforms. /Joe On Nov 25, 2007 8:37 PM, Vlad Dumitrescu wrote: > Hi, > > On Nov 25, 2007 4:57 PM, Joe Armstrong wrote: > > I think it would be easier to allow syntax transforms *before* > > parse_transform. We need > > character_transform that kicks in before tokenisation, and > > token_transform which kicks in after character_transform but before > > parse_transform. > > Cool idea! > > But I'm not sure what char_transform would do. I suppose it can select > strings with regexps,and do what to them? What it would be meaningful > would be to replace them with tokens, as a sort of pre-tokenizer, but > then the scanner should accept a stream of characters mixed with > tokens..... > > Maybe token_transform is enough: given that the tokenizer will return > any unmatched characters as their own tokens, a token_transform phase > could take a sequence of two {'!', Line} tokens and compress them into > a {'!!', Line} one. Possible troublemakers would be whitespaces, as we > might want to convert two consecutive '!'s, without any intervening > spaces. > > best regards, > Vlad > From vladdu55@REDACTED Sun Nov 25 21:39:11 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 25 Nov 2007 20:39:11 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <9b08084c0711251232s7731feeem116c8d1c95bb6462@mail.gmail.com> References: <149017.87260.qm@web38807.mail.mud.yahoo.com> <9b08084c0711250857j70b2f7besc8368c5cd7386279@mail.gmail.com> <95be1d3b0711251137h37ab6b48p89d4b7171bde2b85@mail.gmail.com> <9b08084c0711251232s7731feeem116c8d1c95bb6462@mail.gmail.com> Message-ID: <95be1d3b0711251239i47ec2e0cj68f2e0d4b53af0ba@mail.gmail.com> On Nov 25, 2007 8:32 PM, Joe Armstrong wrote: > No this has nothing to do with regexps I was trying to get my head around it. > -compile({character_transform, Mod}). > > would (by analogy with parse_transform) > call Mod:character_transform(Bin, Opts) when Bin was the content of > the file being compiled > it would return Bin' > Then you could do anything you like. Yes, but in practice, I'm not sure what I'd like to do with a bunch of text -- there's no structure, so it's just a textual preprocessor... which we are trying to get rid of. Or am I missing something? regards, Vlad From joelr1@REDACTED Sun Nov 25 21:47:18 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 25 Nov 2007 20:47:18 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: Kenneth, On Nov 25, 2007, at 7:13 PM, Kenneth Lundin wrote: > If you like Erlang why do you then almost all the time ask for changes > of the language? There's no limit to perfection. I don't ask for changes to the language so much as I ask for bits and pieces to enable me to change things myself. Thanks, Joel -- http://wagerlabs.com From kenneth.lundin@REDACTED Sun Nov 25 23:30:06 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sun, 25 Nov 2007 23:30:06 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: Hi, I agree that there are many bits and pieces where Erlang can and need to be improved. There are so many that we have to prioritize among them. We have to focus on certain areas, the ones that makes most difference for making Erlang: - more used in product development where concurrency, fault tolerance, scalability, time to market, life cycle cost etc. are important. - continue to improve the SMP support and show how big advantage there is in using Erlang for making the most of multi core processors. - Components (OTP Applications) with better support for protocols used in strategic areas as multi media, E-shopping, Financial, Telecom-services etc. I actually think that we need much more and better support in the XML area, XML-webservices and similar. You don't have to like these techniques but you still have to support them. - easier to deploy products made with Erlang I don't think improvements in support for parse transforms and a broader use of parse transforms is one of the most important bits in this. I even think that it might be negative to broaden the use of parse transforms. Parse transforms is a way to let developers modify the language or even define their own new language, when you see a program you will have a hard time understanding what it means etc. It will be problems for syntax sensitive editors etc. A problem with parse transforms is that anything can be transformed, you never know what and how until you have understood the parse transform code it self (or get it explained to you). /Kenneth On 11/25/07, Joel Reymont wrote: > Kenneth, > > On Nov 25, 2007, at 7:13 PM, Kenneth Lundin wrote: > > > If you like Erlang why do you then almost all the time ask for changes > > of the language? > > There's no limit to perfection. I don't ask for changes to the > language so much as I ask for bits and pieces to enable me to change > things myself. > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > From masterofquestions@REDACTED Mon Nov 26 00:43:57 2007 From: masterofquestions@REDACTED (Russell King) Date: Sun, 25 Nov 2007 18:43:57 -0500 Subject: [erlang-questions] newbie: How to go about Implementing this problem Message-ID: <1218d6a50711251543j7d5cbcf1lc07fbc736c06d322@mail.gmail.com> Hi guys, I have looked at gen_server approach of client/server model. What I need to do is to have one application that can create gen_server (client/server model) type based on how the initial work chunk is divided. I have to pull data from mainframe. Basically a big feed file created by the mainframe. I need to break the file in 4 or 6 or whatever parts I want and be able to create 4 or 6 or as many servers as there are divided parts and dynamically distribute work to the servers on different nodes on different machines. Each server, would then create clients on the same machine, to further process their assigned part of the file. for example: 1 master(controlling machine1) , 2 servers (on machine2, machine3) get small chunk of the work they are responsible for and each servers create clients to process the work. 1) One, I need to be able to break large work into arbitrary number of parts and be able to dynamically create as many servers as there are parts (number of parts can be changed on erlang shell and hot code loaded). Also need to distribute the server on different machines. 2) Two, I need to process the mainframe file on repeated basis at specified time interval. Any other solutions to the problem (other than gen_server) are also appreciated. Russ From exta7@REDACTED Mon Nov 26 00:50:15 2007 From: exta7@REDACTED (Zvi) Date: Sun, 25 Nov 2007 15:50:15 -0800 (PST) Subject: [erlang-questions] how: distributed supervision tree Message-ID: <13941497.post@talk.nabble.com> The supervision strategy data structure is a list of tuples for each worker. The Worker specifications are tuples of the following form: {Tag, {Mod, Func, ArgList}, Restart, Shutdown, Type, [Mod1]} Where: {Mod, Func, ArgList} defines the function that the supervisor will use to start the worker. It is used as arguments to apply(Mod, Fun, ArgList). How do I define worker process, which should be started/restarted on remote node? Should I just write Mod:Fun function which calls spawn/2 ,i.e. spawn(Node,Fun) ? What happens if BEAM VM on node "Node" is down? Should Mod:Fun first call to some shell script to lanch VM on the remote node and only then spawn Worker's Erlang proces on it? Anybody has example? Thanks in Advance Zvi -- View this message in context: http://www.nabble.com/how%3A-distributed-supervision-tree-tf4872110.html#a13941497 Sent from the Erlang Questions mailing list archive at Nabble.com. From rvirding@REDACTED Mon Nov 26 03:03:55 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 26 Nov 2007 03:03:55 +0100 Subject: [erlang-questions] Lisp syntax for Erlang Message-ID: <3dbc6d1c0711251803j552680e5v4ab1f05116bd3938@mail.gmail.com> I have been giving some thought to the problem of adding a "proper" lisp syntax for Erlang. Most of it is pretty straight forward. As someone mentioned earlier you compile for core Erlang and then use the compiler from then on. Some examples of a syntax based on Scheme: (define (call pid request) (send pid #((self) 'request req)) (receive (#(pid1 'reply rep) (when (= pid pid1)) rep))) Using Scheme vector syntax for tuples. I suppose you could also use { ... }. Now a function from termite: (define (!? pid req) (let ((tag (make_ref))) (send pid #((self) tag req)) (receive ((tag1 rep) (when (= tag tag1)) rep)))) And how the days_in function discussed a few days ago could look: (define (days_in month leap?) ;; Match month and leap? (case #(month leap) ((1 l) 31) ((2 'true) 29) ((2 'false) 28) ... )) Some comments: - must use all conventions from the rest of Erlang so have true/false instead of #t/#f - proper variable scoping - re-use some Scheme forms but modified for Erlang - (case ...) extended to match against pattern not test value - use quotes in patterns ** - guards are (when ) directly after a pattern - use case for head matching, could add an extra form (match ...) which does the same thing but different error value - unpacking explicit #( ... ) build in case is not difficult - can use Scheme atom syntax as it will allow (almost) any Erlang atom, don't think you can quote an atom in Scheme The difficult bit I think is getting modules and inter-modules calls right. R6 Scheme has modules, or libraries as they call them, but they don't work the same as Erlang modules. They allow you to import libraries, but they must be known at compile time, and specify a prefix within an atom to refer to a library. But I don't see how they directly support a construction like Module:func(...) with out using an apply: (apply module 'func args) There is no problem for the compiler to detect when args is known at compile time and generate better code. If anyone knows how they mean this to be done tell me. Otherwise apply is not needed. Macros at this level are easy using (define-syntax ...). At this level the only major difference between using CL or Scheme as a base for Elisp is how functions are bound to symbols, as there value or in a special slot. Apart from that there would be very little difference. I actually prefer defun/defmacro instead of define/define-syntax but not enough to really mind. It is important to note that we are not implementing Scheme (or CL) but providing a lisp based syntax for Erlang. There are too many things in lisp which we can't do at all in Erlang, especially destructive operations (not set!, which is easy). N.B. Scheme in Haskell and Luke's Scheme in Erlang don't do this. :-) Anyway these are some thoughts on the subject, Robert ** This is strange. In all examples I have seen in lisp books where they develop a logic language in lisp they go the other way, they specially mark (logical) variables in some way, for example ?var. I mean why add an inconsistency by reversing it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dking@REDACTED Mon Nov 26 04:33:12 2007 From: dking@REDACTED (David King) Date: Sun, 25 Nov 2007 19:33:12 -0800 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: <416B08D8-9250-418F-A9AC-EDAC675B7408@ketralnis.com> > If you like Erlang why do you then almost all the time ask for changes > of the language? You don't have to hate something to be able to think of ways to improve it. > > If you have a serious suggestion of some new feature I suggest that > you write an EEP (Erlang Enhancement Porposal) and we can > discuss the pros and cons of that and decide if it should make it into > the distribution. > > > /Kenneth Erlang/OTP team at Ericsson > > On Nov 25, 2007 1:51 PM, Joel Reymont wrote: >> >> On Nov 25, 2007, at 3:12 AM, Robin Bhattacharyya wrote: >> >>> Smerl manipulates erlang at the abstract form, so smerl is kinda >>> like >>> a lisp macro. A lispy erlang would make erlang easier to >>> manipulate. >> >> >> My biggest beef with Erlang is that even with parse transforms I >> cannot make a !! b stand for funcall(a, b). If the Erlang >> implementation removed this restriction then surely all sorts of >> creative uses would be enabled. >> >> Thanks, Joel >> >> -- >> http://wagerlabs.com >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From yinso.chen@REDACTED Mon Nov 26 04:46:15 2007 From: yinso.chen@REDACTED (YC) Date: Sun, 25 Nov 2007 19:46:15 -0800 Subject: [erlang-questions] how: redirect trace output to a file Message-ID: <779bf2730711251946o6d493a25yff6ea361b94ecd77@mail.gmail.com> Hi all - how do I redirect trace output to a file? I played with dbg:trace_port, but I'm unclear on how it's used and whether it's the right function. Any pointer is appreciated, Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: From robi123@REDACTED Sun Nov 25 21:09:06 2007 From: robi123@REDACTED (Robin) Date: Sun, 25 Nov 2007 12:09:06 -0800 (PST) Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <95be1d3b0711250820t2149564dscf2ac1cb6e8d92d8@mail.gmail.com> References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> <17244f480711250113s7b9bde2eo3b8d79af6353559e@mail.gmail.com> <95be1d3b0711250820t2149564dscf2ac1cb6e8d92d8@mail.gmail.com> Message-ID: <9eb8df97-23aa-4bc5-8c52-3b2300bee37f@a39g2000pre.googlegroups.com> The thought of running on the JVM makes me feel both sick and bloated...but strangely I am warming up to the idea. The ErlangVM enables distributed concurrency, Closure on the JVM is optimizing for local concurrency. Granted that I am not building fault tolerant telecom switches, but in my case, massive local concurrency might be all that I need. With EC2, I could package an image optimized for local concurrency. If an instance goes down, launch another instance. If an instance reaches high load, launch another instance. Of course this glosses over the database entirely, which currently uses Erlang. On Nov 25, 8:20 am, "Vlad Dumitrescu" wrote: > Hi, > > On Nov 25, 2007 9:13 AM, Yariv Sadan wrote: > > > I think it would be easier for Erlang programmers to adopt a Lispy > > dialect of Erlang than for Java programmers to adopt a Lisp that runs > > on the JVM. > > I can't really understand why it would be good to run Erlang on the > JVM. It would become just one of the other 300 languages, losing at > the same time its most important feature, namely its own VM. It is the > runtime that brings in all the benefits of the super-light processes > and their communication channels. On the JVM, I doubt one could do > much better than Scala's actors. Just to give them an Erlangy syntax > doesn't seem like a huge benefit to me... > > best regards, > Vlad > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From iliakan@REDACTED Mon Nov 26 07:31:49 2007 From: iliakan@REDACTED (Ilia Kantor) Date: Mon, 26 Nov 2007 09:31:49 +0300 Subject: [erlang-questions] Mnesia -> RDBMS replication Message-ID: <474A6855.4080109@gmail.com> Hello, I'd like to work with Mnesia and use same data for queries in RDBMS. Is it possible(tool?) to replicate mnesia data into RDBMS ? P.S I'm not talking about replicating structure, cause I know mnesia is not relational. But I'd like to have mnesia data available in RDBMS for joins. From torben.lehoff@REDACTED Mon Nov 26 07:33:05 2007 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 26 Nov 2007 07:33:05 +0100 Subject: [erlang-questions] how: Problems with installation of Faxien Message-ID: I was just trying to install Faxien and this is what I got back: [root@REDACTED erlang]# ./faxien-bootstrap-i386-Linux-0.1.1.sh Extracting the erlware bootstrap Checking MD5 checksum to verify validity Creating target directory /usr/local/erlware Untaring into /usr/local/erlware Upgrading faxien replacing existing executable file at: /usr/local/erlware/bin/faxien {error,{package_not_found,"Package not found: faxien"}} Suggestions: - Package not found: faxien Please request that a package of this type be compiled for your local architecture be published to an accessible repository. - For error_logger information look at "/home/cyberlync/test5/log/faxien.err_log" - For sasl log information look at "/home/cyberlync/test5/log/faxien.sasl_log" - Remember that if you are trying to install a package that 'faxien install ' is for releases, while 'faxien install_app ' is for applications This does not look too well, but before I raise an issue on it I would like to know if it is me that is terribly off the mark or there is an issue with Faxien. I have downloaded the bootstrap installer and followed the instructions on the Faxien home page... I guess. Cheers, Torben -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Mon Nov 26 07:50:36 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 26 Nov 2007 07:50:36 +0100 Subject: [erlang-questions] Lisp syntax for Erlang In-Reply-To: <3dbc6d1c0711251803j552680e5v4ab1f05116bd3938@mail.gmail.com> References: <3dbc6d1c0711251803j552680e5v4ab1f05116bd3938@mail.gmail.com> Message-ID: <474A6CBC.6020806@ericsson.com> greetings, i think you mean Erlang lisp when you write ''Elisp'' below. most existing mentionings of Elisp seems to mean Emacs lisp. have you considered using Erlisp (something not already in use anyway) instead? bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/26/07 03:03, Robert Virding wrote: > I have been giving some thought to the problem of adding a "proper" lisp > syntax for Erlang. Most of it is pretty straight forward. As someone > mentioned earlier you compile for core Erlang and then use the compiler > from then on. > > Some examples of a syntax based on Scheme: > > (define (call pid request) > (send pid #((self) 'request req)) > (receive > (#(pid1 'reply rep) (when (= pid pid1)) rep))) > > Using Scheme vector syntax for tuples. I suppose you could also use { > ... }. Now a function from termite: > > (define (!? pid req) > (let ((tag (make_ref))) > (send pid #((self) tag req)) > (receive > ((tag1 rep) (when (= tag tag1)) rep)))) > > And how the days_in function discussed a few days ago could look: > > (define (days_in month leap?) > ;; Match month and leap? > (case #(month leap) > ((1 l) 31) > ((2 'true) 29) > ((2 'false) 28) > ... )) > > Some comments: > > - must use all conventions from the rest of Erlang so have true/false > instead of #t/#f > - proper variable scoping > - re-use some Scheme forms but modified for Erlang > - (case ...) extended to match against pattern not test value > - use quotes in patterns ** > - guards are (when ) directly after a pattern > - use case for head matching, could add an extra form (match ...) which > does the same thing but different error value > - unpacking explicit #( ... ) build in case is not difficult > - can use Scheme atom syntax as it will allow (almost) any Erlang atom, > don't think you can quote an atom in Scheme > > The difficult bit I think is getting modules and inter-modules calls > right. R6 Scheme has modules, or libraries as they call them, but they > don't work the same as Erlang modules. They allow you to import > libraries, but they must be known at compile time, and specify a prefix > within an atom to refer to a library. But I don't see how they directly > support a construction like Module:func(...) with out using an apply: > > (apply module 'func args) > > There is no problem for the compiler to detect when args is known at > compile time and generate better code. If anyone knows how they mean > this to be done tell me. Otherwise apply is not needed. > > Macros at this level are easy using (define-syntax ...). > > At this level the only major difference between using CL or Scheme as a > base for Elisp is how functions are bound to symbols, as there value or > in a special slot. Apart from that there would be very little > difference. I actually prefer defun/defmacro instead of > define/define-syntax but not enough to really mind. > > It is important to note that we are not implementing Scheme (or CL) but > providing a lisp based syntax for Erlang. There are too many things in > lisp which we can't do at all in Erlang, especially destructive > operations (not set!, which is easy). N.B. Scheme in Haskell and Luke's > Scheme in Erlang don't do this. :-) > > Anyway these are some thoughts on the subject, > > Robert > > ** This is strange. In all examples I have seen in lisp books where they > develop a logic language in lisp they go the other way, they specially > mark (logical) variables in some way, for example ?var. I mean why add > an inconsistency by reversing it? > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Mon Nov 26 08:00:15 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 26 Nov 2007 08:00:15 +0100 Subject: [erlang-questions] ets gives badarg after recompile In-Reply-To: References: Message-ID: <474A6EFF.3060607@ericsson.com> greetings, could you be a little more precise when describing the problem? given this file: -module(t). -export([t/0]). t()-> myname = ets:new(myname, [set, named_table]), true = ets:insert( myname, {a,1}), [{a,1}] = ets:lookup( myname, a ), true = ets:delete( myname ). i can do: 7> c(t). {ok,t} 8> t:t(). true 9> t:t(). true 10> c(t). {ok,t} 11> t:t(). true 12> bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/25/07 20:46, Andrew Arrow wrote: > If I create a new ets with > > ets:new(myname, [set, named_table]). > > and do some inserts and lookups from it everything is fine. At the > end of the program I call ets:delete(myname). > > I can re-run the program from the shell, no problems. But if I > recompile it and then run I get: > > =ERROR REPORT==== 25-Nov-2007::11:38:26 === > Error in process <0.3579.10> with exit value: > {badarg,[{ets,lookup,[myname,53]},{ets_test,my_map,2}]} > > I have to hit control-G and kill the job and create a new shell. Then > I can compile and run it fine again. But on the 2nd compile same > thing happens. > > Why does c(my_module). make the ets no longer work and require a new shell? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Mon Nov 26 08:12:22 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 26 Nov 2007 08:12:22 +0100 Subject: [erlang-questions] Clarify: how to reduce startup time for escript ? In-Reply-To: References: Message-ID: <474A71D6.9070001@ericsson.com> greetings, the trick to reduce start up time _was_ SAE (stand alone erlang, see http://www.sics.se/~joe/bluetail/sae_r7b/sae.html). it does not exist any more. the alternative (which i think you mention) is erlaunch (http://catseye.tc/projects/erlaunch/doc/design.html). bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/24/07 19:31, Roberto Saccon wrote: > I am working on a better integration of Erlang and TextMate (Mac text > editor), basically adding the stuff which emacs / distel already > provides out-of-the-box. > > My current approach is based on escripts, which get called for > specific actions such as compiling. For details see: > http://www.rsaccon.com/2007/11/easy-erlang-compiling-with-textmate.html > > One problem with escripts is that their startup time is within a > range, which a user perceives as (short) delay. > > It's about 0.15 sec on my system. > > Does there exist a trick to reduce this startup time ? > > Other approches such as connecting to a runnig node give a response > time perceived as "immediate", but are significantly more difficult to > implement and to integrate into TextMate. > > regards From bengt.kleberg@REDACTED Mon Nov 26 08:18:00 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 26 Nov 2007 08:18:00 +0100 Subject: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) In-Reply-To: <646623.26744.qm@web60517.mail.yahoo.com> References: <646623.26744.qm@web60517.mail.yahoo.com> Message-ID: <474A7328.1010107@ericsson.com> On 11/23/07 23:44, Isaac Gouy wrote: > On Nov 23, 2007 1:26 PM, Bengt Kleberg wrote: > >> this is seriously off topic for erlang-questions, so i would > recommend >> each and every one of you to stop reading now. > > Was it off topic when you chose to air your criticism on > erlang-questions back in September, or is it only the reply to your > criticism that is off topic? :-) what does this question have to do with the subject matter of this discussion? bengt From samuelrivas@REDACTED Mon Nov 26 09:43:15 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Mon, 26 Nov 2007 09:43:15 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <4e6744df0711241912v19b6ba83q5a44f4c5159e18c2@mail.gmail.com> Message-ID: <20071126084315.GA3152@lambdastream.com> Kenneth Lundin wrote: > I don't think improvements in support for parse transforms and a broader use of > parse transforms is one of the most important bits in this. > I even think that it might be negative to broaden the use of parse transforms. > Parse transforms is a way to let developers modify the language or even > define their own new language, when you see a program you will have a hard time > understanding what it means etc. It will be problems for syntax > sensitive editors > etc. I think that that is a crucial point. A good language should have a very small number of primitives and rules. Everything you add to it is a potential increase of complexity. It is true that some times a new primitive can reduce the cost of coding---and understanding the code---, so the addition pays off the extra complexity. But if you keep adding things that are not really needed you may end in something like perl: you can write your code almost in any form you like, but hardly read code written by others ... For me, user defined operators and bang-bang rpc operator are things to be discussed (I am not particularly fond of them), but there are other parts of the language, library, and tools that need much more critical improvements. For example, type checking adds more syntax, but to do something that cannot be done right now, bitstreams add new functionalities with almost no changes of the language, we need a _right_ solution for records, etc. Regards -- Samuel From forsyth@REDACTED Mon Nov 26 10:43:18 2007 From: forsyth@REDACTED (Charles Forsyth) Date: Mon, 26 Nov 2007 09:43:18 +0000 Subject: [erlang-questions] Erlang vs Clojure Message-ID: >The thought of running on the JVM makes me feel both sick and >bloated...but strangely I am warming up to the idea. >The ErlangVM enables distributed concurrency, Closure on the JVM is >optimizing for local concurrency. >Granted that I am not building fault tolerant telecom switches, but in >my case, massive local concurrency might be all that I need. With if you expect to get high-performance concurrency from a JVM i expect you to be disappointed. the Erlang implementation guarantees cheap processes everywhere it exists. by contrast, you get whatever your particular JVM gives you, which might not be much, and it will vary from platform to platform. if it works for you, though ... i'd be particularly interested if you find JVMs that offer ``massive local concurrency''. From robi123@REDACTED Mon Nov 26 10:53:30 2007 From: robi123@REDACTED (Robin Bhattacharyya) Date: Mon, 26 Nov 2007 01:53:30 -0800 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <84cf090fdc010688dd174b6dc27fbf10@terzarima.net> References: <84cf090fdc010688dd174b6dc27fbf10@terzarima.net> Message-ID: <4e6744df0711260153r106683b6ldd5784a0a2e534c9@mail.gmail.com> I would not expect high performance local concurrency out the the JVM either, but this Clojure project seems to take what I think is a novel approach to concurrency: Actors are just references to immutable data structures which can be mutated in a software transactional memory context. Messages are just methods that run in the STM processed on a conventional thread pool. You could have 10s of millions of these cheap actors, and have one or more threads per native core, and start grinding through the messages. It looks like a simple and elegant way to achieve massive local concurrency on a conventional JVM running on conventional hardware. Combined with lisp's code as data, this project could lead to some novel applications. Robin On Nov 26, 2007 1:43 AM, Charles Forsyth wrote: > >The thought of running on the JVM makes me feel both sick and > >bloated...but strangely I am warming up to the idea. > > >The ErlangVM enables distributed concurrency, Closure on the JVM is > >optimizing for local concurrency. > > >Granted that I am not building fault tolerant telecom switches, but in > >my case, massive local concurrency might be all that I need. With > > if you expect to get high-performance concurrency from a JVM > i expect you to be disappointed. the Erlang implementation > guarantees cheap processes everywhere it exists. by contrast, > you get whatever your particular JVM gives you, which might not > be much, and it will vary from platform to platform. > if it works for you, though ... > i'd be particularly interested if you find JVMs that > offer ``massive local concurrency''. > From kenneth.lundin@REDACTED Mon Nov 26 11:39:40 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 26 Nov 2007 11:39:40 +0100 Subject: [erlang-questions] how: redirect trace output to a file In-Reply-To: <779bf2730711251946o6d493a25yff6ea361b94ecd77@mail.gmail.com> References: <779bf2730711251946o6d493a25yff6ea361b94ecd77@mail.gmail.com> Message-ID: You can redirect trace output in various ways. dbg:tracer(Type,Data) % sets the tracer You can do like this to direct trace output to a file: dbg:tracer(port,dbg:trace_port(file,"MyFileName")). or dbg:tracer(port,dbg:trace_port(file,{"MyFileName",wrap,"MySuffix"})). /Kenneth Erlang/OTP team at Ericsson On 11/26/07, YC wrote: > Hi all - > > how do I redirect trace output to a file? I played with dbg:trace_port, but > I'm unclear on how it's used and whether it's the right function. Any > pointer is appreciated, > > Thanks, > yc > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rrerlang@REDACTED Mon Nov 26 12:08:33 2007 From: rrerlang@REDACTED (Robert Raschke) Date: Mon, 26 Nov 2007 11:08:33 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <9b08084c0711251232s7731feeem116c8d1c95bb6462@mail.gmail.com> Message-ID: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> > No this has nothing to do with regexps > > -compile({character_transform, Mod}). > > would (by analogy with parse_transform) > call Mod:character_transform(Bin, Opts) when Bin was the content of > the file being compiled > it would return Bin' > > Then you could do anything you like. > > -compile({tokenezer, Mod}). > > could maybe call a custom tokeniser after character processing and > prior to calling any > parse transforms. > > /Joe > Hmm, strange convergence of ideas in different mailing lists at the moment (the Lua community is discussing stuff like this as well). All of these ideas appear "neat". Because you can start inventing your own syntax for stuff. 'Tis what computer types love, after all (although, using the right indentation with the correct editor might even come before that :-). But, unless you are designing a domain specific language, you end up with programs that nobody else can understand. Even worse, almost everything (file extension, run-time system, standard documentation) makes it appear that you are dealing with Erlang. But when you look inside, it is _not_ Erlang, but someones idea of a "better" Erlang. Allowing the dynamic change of programming language syntax was a cool thing in the 70's. It didn't work then, and I seriously doubt it will today. If there are real merits to new operators and syntax, then these must be discussed with the keepers of the language. If the new features appear worthy, then they might get added. If they do not get added, and you still think that you must have them, then create yourself a new language. This may be extremely heavily based on Erlang, but it is not Erlang! And it mustn't be called Erlang either. Sorry for the rant, but this stuff is right up there with "coding standards" in my book. Robby From joelr1@REDACTED Mon Nov 26 12:30:06 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 26 Nov 2007 11:30:06 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> Message-ID: <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> On Nov 26, 2007, at 11:08 AM, Robert Raschke wrote: >> But, unless you are designing a domain specific language, you end up > with programs that nobody else can understand. This is missing the point somewhat. I could care less about what other people think of my programs. I'm writing them for myself and I'm looking to make _my_ job easier. If I need to train someone then I'll do so. Plus, Lisp folk have been dealing with custom languages forever now. Creating DSLs in Lisp is very much encouraged. What makes Erlang different? -- http://wagerlabs.com From kosik@REDACTED Mon Nov 26 12:37:17 2007 From: kosik@REDACTED (Matej Kosik) Date: Mon, 26 Nov 2007 12:37:17 +0100 Subject: [erlang-questions] how to trace gen_servers? Message-ID: <474AAFED.6070709@fiit.stuba.sk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, Is there a way how to customize information that gets logged into file when I turn on the `log_to_file' option for my gen_servers? At present, it automatically records the following information: - - which calls given gen_server has got - - which casts given gen_server has got - - what did it reply back to the clients It looks somehow this way: *DBG* qd_frontend got call {handle_get,[{82,205,224,84},7008,3,get_ebno]} from <0.167.0> *DBG* qd_frontend sent 9.00000 to <0.167.0>, new state {dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}} *DBG* qd_frontend got {#Port<0.271>,{data,{eol,"DD2048>"}}} *DBG* qd_frontend new state {dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}} *DBG* qd_frontend got call {handle_get,[{82,205,224,84},7008,3,get_ebno]} from <0.167.0> *DBG* qd_frontend sent 8.90000 to <0.167.0>, new state {dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}} *DBG* qd_frontend got {#Port<0.271>,{data,{eol,"DD2048>"}}} *DBG* qd_frontend new state {dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[[{{82,205,224,84},7008},#Port<0.271>]],[],[],[],[],[],[],[]}}} Not very nice but partially useful. The state (dictionary) is serialized in unusable way but this is not the primary problem. Is there some hook I can use that I can ensure that also timestamps of these calls and casts get printed? Because when I later observe that something bad was happening I would like to know when those events happened. Thanks in advance - -- Matej Kosik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHSq/tL+CaXfJI/hgRAtKqAJ9hnjA1WWkLopFGglFdJ2KWTo97WgCgramA iCTRY+bZg0dF3rm2uEdTITE= =jARA -----END PGP SIGNATURE----- From luke@REDACTED Mon Nov 26 13:07:51 2007 From: luke@REDACTED (Luke Hubbard) Date: Mon, 26 Nov 2007 19:07:51 +0700 Subject: [erlang-questions] Sending binaries between nodes. Message-ID: <4c74d13d0711260407s791db1afg3e2c3943ed772bbd@mail.gmail.com> Hi All, This is my first post to the list, so a big hello from Thailand to kick things off. My question is about passing large binaries between nodes. I have read that if you pass a binary around the same node then there is only one copy which is ref counted and stored on a separate stack. This is great, but what happens when you send the same binary to another node in separate messages. Does Erlang know its sent the binary before and after the first time send some form of reference or will it send the same binary data multiple times. The use case for this is broadcasting a binary message to multiple processes on each node. Thanks, Luke -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Mon Nov 26 13:35:47 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 26 Nov 2007 13:35:47 +0100 Subject: [erlang-questions] Sending binaries between nodes. In-Reply-To: <4c74d13d0711260407s791db1afg3e2c3943ed772bbd@mail.gmail.com> References: <4c74d13d0711260407s791db1afg3e2c3943ed772bbd@mail.gmail.com> Message-ID: "Luke Hubbard" writes: > Hi All, > > This is my first post to the list, so a big hello from Thailand to kick > things off. Welcome! > My question is about passing large binaries between nodes. I have read that > if you pass a binary around the same node then there is only one copy which > is ref counted and stored on a separate stack. This is great, but what > happens when you send the same binary to another node in separate messages. > Does Erlang know its sent the binary before and after the first time send > some form of reference or will it send the same binary data multiple times. > The use case for this is broadcasting a binary message to multiple processes > on each node. It will copy the binary each time. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From chsu79@REDACTED Mon Nov 26 13:42:48 2007 From: chsu79@REDACTED (Christian S) Date: Mon, 26 Nov 2007 13:42:48 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> Message-ID: 2007/11/26, Joel Reymont : > Plus, Lisp folk have been dealing with custom languages forever now. > Creating DSLs in Lisp is very much encouraged. > > What makes Erlang different? The difference is in the programmer, if the programmer is used to macros or not. For a programmer that is used to macros, seeing code with macros is no more confusing than seeing code that calls new user-defined functions (they too are a mechanism to extend the language, but syntactically limited). A sexpr-syntax for erlang would be really nice. I believe torbj?rn t?rnkvist found the right path, by writing a compiler that targets core erlang (as he does for his haskell to beam compiler). (But I'm not really qualified to guess :) I call it a sexpr-syntax because I believe it would be wrong to implement common lisp or scheme. I want everything to still feel like Erlang, immutable values, pattern matching and single assignment, capitalized variables & unquoted atoms, ..., but all in sexprs. As for remote procedure-calls my current feeling is that this would look quite okay: "Mod:Fun(Arg1, Arg2,...)" as "(:(Mod Fun) Arg1 Arg2 ...)" a local call would be just (Fun Arg1 Arg2 ...) and that's the common case. Does well with hierarchical module names too. It follows common lisp syntax for arrays "#(1 2 3)" and for quoting literals "'(a b c)" . From chsu79@REDACTED Mon Nov 26 13:53:04 2007 From: chsu79@REDACTED (Christian S) Date: Mon, 26 Nov 2007 13:53:04 +0100 Subject: [erlang-questions] Sending binaries between nodes. In-Reply-To: References: <4c74d13d0711260407s791db1afg3e2c3943ed772bbd@mail.gmail.com> Message-ID: A little braindump: I overheard that, with the client-font-rendering as introduced in X11 with XRENDER, they solve the problem with duplicate bitmaps (since apps typically use the same fonts) by hashing the bitmap to quickly search for duplicate bitmap candidates among existing bitmaps and then just increase the ref-count on the matching one. Of course, this is only useful if binaries are sent back and forth across nodes or in-and-out of ets. And if... well, the cost of searching duplicates every time is economically lower than duplications of binaries. 26 Nov 2007 13:35:47 +0100, Bjorn Gustavsson : > It will copy the binary each time. From luke@REDACTED Mon Nov 26 13:58:51 2007 From: luke@REDACTED (Luke Hubbard) Date: Mon, 26 Nov 2007 19:58:51 +0700 Subject: [erlang-questions] Sending binaries between nodes. In-Reply-To: References: <4c74d13d0711260407s791db1afg3e2c3943ed772bbd@mail.gmail.com> Message-ID: <4c74d13d0711260458p44f8c36dxe360c7ec2d8b765a@mail.gmail.com> It will copy the binary each time. Thanks for the quick answer, that's what I figured, but wanted to check just in case I was over complicating things. - Luke -- Luke Hubbard codegent | coding for the people http://www.codegent.com NMA Top 100 Interactive Agencies - Ones to watch! http://www.codegent.com/top100/ want to know more? http://www.codegent.com/showreel/ This e-mail may contain information which is privileged, confidential and protected from disclosure. If you are not the intended recipient of this e-mail, or any part of it, please delete this email and any attachments immediately on receipt. You should not disclose the contents to any other person or take copies. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of codegent limited. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Mon Nov 26 14:08:39 2007 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 26 Nov 2007 14:08:39 +0100 Subject: [erlang-questions] Offset calculation in bit syntax In-Reply-To: <00549F02-0244-4EB0-B95C-D9C1E21F05C5@gmail.com> References: <00549F02-0244-4EB0-B95C-D9C1E21F05C5@gmail.com> Message-ID: <4d08db370711260508j44b9569bu474fab4b55ef58c@mail.gmail.com> There is bug in your code I think. Correct code should be: decode(<>) -> Len = (L - 16#20)*8, <> = R, Rest. -- --Hynek (Pichi) Vychodil On 11/22/07, Ben Hood <0x6e6562@REDACTED> wrote: > > > Hi, > > I have to parse the following byte sequence where the first byte indicates > the payload length if the > payload length in 15 bytes or less, e.g. the 3 byte payload > > x01 x02 x03 > > will be encoded as > > 0x23 x01 x02 x03 > > with 0x23 - 0x20 = 3, the length of the payload. > > So when I parse it, I'd like to use a bit syntax similar to following: > > > decode(<< Len:8/unsigned, Rest:(Len - 16#20)/unsigned>>) -> > <>. > > But this is an illegal bit size. > > Is there an elegant way around this? > > Thx, > > Ben > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rsaccon@REDACTED Mon Nov 26 14:15:31 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Mon, 26 Nov 2007 11:15:31 -0200 Subject: [erlang-questions] Clarify: how to reduce startup time for escript ? In-Reply-To: <474A71D6.9070001@ericsson.com> References: <474A71D6.9070001@ericsson.com> Message-ID: Bengt, thanks. Thats seems to solve my problem (if I get it working). Unfortunately I get an "Connection refused" error, see below: roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ bin/erlaunch start erlaunch v2004.0309 - execute selected Erlang functions from command line Copyright (c)2003-2004 Cat's Eye Technologies. All rights reserved. Emulator started, starting erlaunch subshell. Type ^D to exit. roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ bin/erlaunch ls erlaunch: connect: Connection refused roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ exit exit Stopping emulator. Thank you for using erlaunch! erlaunch: connect: Connection refused roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ anything I am doing wrong ? Anything missing ? I just compiled erlaunch in MacOSX 1..4.11. and with Erlang R11B, followed the tutorial and keep getting the error above. regards On Nov 26, 2007 5:12 AM, Bengt Kleberg wrote: > greetings, > > the trick to reduce start up time _was_ SAE (stand alone erlang, see > http://www.sics.se/~joe/bluetail/sae_r7b/sae.html). it does not exist > any more. > > the alternative (which i think you mention) is erlaunch > (http://catseye.tc/projects/erlaunch/doc/design.html). > > > bengt > Those were the days... > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > > > > On 11/24/07 19:31, Roberto Saccon wrote: > > I am working on a better integration of Erlang and TextMate (Mac text > > editor), basically adding the stuff which emacs / distel already > > provides out-of-the-box. > > > > My current approach is based on escripts, which get called for > > specific actions such as compiling. For details see: > > http://www.rsaccon.com/2007/11/easy-erlang-compiling-with-textmate.html > > > > One problem with escripts is that their startup time is within a > > range, which a user perceives as (short) delay. > > > > It's about 0.15 sec on my system. > > > > Does there exist a trick to reduce this startup time ? > > > > Other approches such as connecting to a runnig node give a response > > time perceived as "immediate", but are significantly more difficult to > > implement and to integrate into TextMate. > > > > regards > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon http://rsaccon.com From 0x6e6562@REDACTED Mon Nov 26 14:35:46 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Mon, 26 Nov 2007 13:35:46 +0000 Subject: [erlang-questions] Offset calculation in bit syntax Message-ID: <2BB8AA48-A71E-47F5-9C9A-BA9870CD8961@gmail.com> > There is bug in your code I think. > > Correct code should be: > > decode(<>) -> > Len = (L - 16#20)*8, > <> = R, > Rest. That's how I ended solving it, but there was also a bug in the way I specified the problem, what I was attempting to ask was whether something this was possible: decode(<>) -> Bin. So decode(<<16#23,"abcdefg">>) would return <<"abc">>. Essentially this is the same thing as your solution, only expressed in a more compact format. However, it doesn't appear to be a legal operation in Erlang bit syntax. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Mon Nov 26 16:33:16 2007 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 26 Nov 2007 16:33:16 +0100 Subject: [erlang-questions] Offset calculation in bit syntax In-Reply-To: <2BB8AA48-A71E-47F5-9C9A-BA9870CD8961@gmail.com> References: <2BB8AA48-A71E-47F5-9C9A-BA9870CD8961@gmail.com> Message-ID: <4d08db370711260733tc4b1c54k2290407c12f45dc7@mail.gmail.com> No, it's not allowed in R11B, but in R12B may be. On 11/26/07, Ben Hood <0x6e6562@REDACTED> wrote: > > There is bug in your code I think. > > > > Correct code should be: > > > > decode(<>) -> > > Len = (L - 16#20)*8, > > <> = R, > > Rest. > > That's how I ended solving it, but there was also a bug in the way I > specified the problem, what I was attempting to ask was whether something > this was possible: > > > decode(<>) -> Bin. > > So decode(<<16#23,"abcdefg">>) would return <<"abc">>. > > Essentially this is the same thing as your solution, only expressed in a > more compact format. However, it doesn't appear to be a legal operation in > Erlang bit syntax. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil From bengt.kleberg@REDACTED Mon Nov 26 16:36:08 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 26 Nov 2007 16:36:08 +0100 Subject: [erlang-questions] Clarify: how to reduce startup time for escript ? In-Reply-To: References: <474A71D6.9070001@ericsson.com> Message-ID: <474AE7E8.6040803@ericsson.com> greetings, it is unfortunate that you have problems. i have looked at the program and it seems to be using a C program as interface. the C code does not compile (out of the box) on my sparcstation. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/26/07 14:15, Roberto Saccon wrote: > Bengt, thanks. Thats seems to solve my problem (if I get it working). > Unfortunately I get an "Connection refused" error, see below: > > > roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ bin/erlaunch start > erlaunch v2004.0309 - execute selected Erlang functions from command line > Copyright (c)2003-2004 Cat's Eye Technologies. All rights reserved. > Emulator started, starting erlaunch subshell. Type ^D to exit. > roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ bin/erlaunch ls > erlaunch: connect: Connection refused > roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ exit > exit > Stopping emulator. Thank you for using erlaunch! > erlaunch: connect: Connection refused > roberto-saccons-computer:~/tmp/erlaunch-2004.0309 rsaccon$ > > > > anything I am doing wrong ? Anything missing ? I just compiled > erlaunch in MacOSX 1..4.11. and with Erlang R11B, followed the > tutorial and keep getting the error above. > > regards > > > On Nov 26, 2007 5:12 AM, Bengt Kleberg wrote: >> greetings, >> >> the trick to reduce start up time _was_ SAE (stand alone erlang, see >> http://www.sics.se/~joe/bluetail/sae_r7b/sae.html). it does not exist >> any more. >> >> the alternative (which i think you mention) is erlaunch >> (http://catseye.tc/projects/erlaunch/doc/design.html). >> >> >> bengt >> Those were the days... >> EPO guidelines 1978: "If the contribution to the known art resides >> solely in a computer program then the subject matter is not >> patentable in whatever manner it may be presented in the claims." >> >> >> >> On 11/24/07 19:31, Roberto Saccon wrote: >>> I am working on a better integration of Erlang and TextMate (Mac text >>> editor), basically adding the stuff which emacs / distel already >>> provides out-of-the-box. >>> >>> My current approach is based on escripts, which get called for >>> specific actions such as compiling. For details see: >>> http://www.rsaccon.com/2007/11/easy-erlang-compiling-with-textmate.html >>> >>> One problem with escripts is that their startup time is within a >>> range, which a user perceives as (short) delay. >>> >>> It's about 0.15 sec on my system. >>> >>> Does there exist a trick to reduce this startup time ? >>> >>> Other approches such as connecting to a runnig node give a response >>> time perceived as "immediate", but are significantly more difficult to >>> implement and to integrate into TextMate. >>> >>> regards >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > From masterofquestions@REDACTED Mon Nov 26 17:50:53 2007 From: masterofquestions@REDACTED (Russell King) Date: Mon, 26 Nov 2007 11:50:53 -0500 Subject: [erlang-questions] Erlang Coach via IM, Skype Message-ID: <1218d6a50711260850g3dfaea1bl1b2999e5a51e1dd5@mail.gmail.com> I am looking for someone to help me get going on Erlang. I have finished reading the Pragmatic Erlang Book. Now I have to dive in to a project. Session would be anywhere between 30 minutes to max 2 hours, 1-3 times a week. Payment can be made via PayPal, eGold or other payment methods that we agree on. I am available 24/7 and you can pick whatever time. Fees are not my major concern. That doesn't mean $1000/hr, but reasonable. If you are interested please send me a private email. Also include your time zone and location. thanks, Russ From david.hopwood@REDACTED Mon Nov 26 18:25:22 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Mon, 26 Nov 2007 17:25:22 +0000 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> References: <815249.27396.qm@web60513.mail.yahoo.com> <4746C6F9.4020100@ericsson.com> <9b08084c0711230657o614f66deoab35c1d9fa13cc90@mail.gmail.com> Message-ID: <474B0182.6030907@industrial-designers.co.uk> Joe Armstrong wrote: > I've been following various discussions about benchmarks, and must say > that I am not impressed. > > The general arguments seems to go like this: > > language A is good at X > language B is good at Y > language B is bad at X > > Therefore hack language B so that it is good at X > > This argument has appeared many times with different values of A B > X and Y - usually by a proponent of A who because A solves X better than > B assumes that A is in some sense better than B. > > The problem is that this argument is just plain daft. No it's not, in general. It has to be considered on a case-by-case basis, depending on: - *how* bad at X language B actually is; - how difficult it is to hack language B to be good at X; - whether anyone cares enough to do the required work; - whether changing language B to do X would introduce too much complexity or other disadvantages that would affect its use in other areas. As for the 'shootout', most of the criticisms of it in this thread have been valid; it's not a very good basis for comparison of language performance. -- David Hopwood From kenneth.lundin@REDACTED Mon Nov 26 19:39:50 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 26 Nov 2007 19:39:50 +0100 Subject: [erlang-questions] Offset calculation in bit syntax In-Reply-To: <4d08db370711260733tc4b1c54k2290407c12f45dc7@mail.gmail.com> References: <2BB8AA48-A71E-47F5-9C9A-BA9870CD8961@gmail.com> <4d08db370711260733tc4b1c54k2290407c12f45dc7@mail.gmail.com> Message-ID: > No, it's not allowed in R11B, but in R12B may be. It will not be allowed to have an embedded expression for size in a binary matching in R12B either. I agree that it would be nice to allow size expressions, but I can not promise when we will have it. /Kenneth Erlang/OTP team at Ericsson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From igouy2@REDACTED Mon Nov 26 20:05:32 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Mon, 26 Nov 2007 11:05:32 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474B0182.6030907@industrial-designers.co.uk> Message-ID: <310035.59131.qm@web60520.mail.yahoo.com> --- David Hopwood wrote: -snip- > As for the 'shootout', most of the criticisms of it in this thread > have been valid; it's not a very good basis for comparison of language > performance. Puzzled. afaict most of the comments in this thread have been about benchmarks in general and not about the benchmarks game in particular, so the way you state your opinion is uninformative. And Bengt Kleberg's "criticism" is more of a complaint that we should do more. ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From erlang@REDACTED Mon Nov 26 20:38:03 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 26 Nov 2007 20:38:03 +0100 Subject: [erlang-questions] newbie: How to go about Implementing this problem In-Reply-To: <1218d6a50711251543j7d5cbcf1lc07fbc736c06d322@mail.gmail.com> References: <1218d6a50711251543j7d5cbcf1lc07fbc736c06d322@mail.gmail.com> Message-ID: <9b08084c0711261138q6e0b1ec3r7fdcdf8f96e78d33@mail.gmail.com> Some questions: - what is the criteria for breaking up the large file? - equal sized chunks? something else??? - how did the "big" file get onto the machine - big files don't just appear by magic - it occurs to me that splitting the file as is created might be better - why bother to create a big file if all you do is then split it into smaller chunks. (if the big file was in an nfs file system you could probably make some kind of virtual file that did the splitting as is was created, if the big file came through an FTP transfer you could write an FTP server that split the file as it arrived, and so on) - rather than creating a big file and THEN doing something it would be better to stream the contents into a splitter and send the fragments to the worker machine ... You never mentioned it but I assume efficiency and/or fault tolerance is involved, is this correct? /Joe Armstrong On Nov 26, 2007 12:43 AM, Russell King wrote: > Hi guys, > > I have looked at gen_server approach of client/server model. What I > need to do is to have one application that can create gen_server > (client/server model) type based on how the initial work chunk is > divided. I have to pull data from mainframe. Basically a big feed > file created by the mainframe. I need to break the file in 4 or 6 or > whatever parts I want and be able to create 4 or 6 or as many servers > as there are divided parts and dynamically distribute work to the > servers on different nodes on different machines. Each server, would > then create clients on the same machine, to further process their > assigned part of the file. > > for example: > 1 master(controlling machine1) , 2 servers (on machine2, machine3) > get small chunk of the work they are responsible for and each servers > create clients to process the work. > > 1) One, I need to be able to break large work into arbitrary number of > parts and be able to dynamically create as many servers as there are > parts (number of parts can be changed on erlang shell and hot code > loaded). Also need to distribute the server on different machines. > > 2) Two, I need to process the mainframe file on repeated basis at > specified time interval. > > Any other solutions to the problem (other than gen_server) are also appreciated. > > Russ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Mon Nov 26 21:01:31 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 26 Nov 2007 21:01:31 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> References: <9b08084c0711251232s7731feeem116c8d1c95bb6462@mail.gmail.com> <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> Message-ID: <9b08084c0711261201q7c439cc9ie8918503e53aafac@mail.gmail.com> On Nov 26, 2007 12:08 PM, Robert Raschke wrote: > > No this has nothing to do with regexps > > > > -compile({character_transform, Mod}). > > > > would (by analogy with parse_transform) > > call Mod:character_transform(Bin, Opts) when Bin was the content of > > the file being compiled > > it would return Bin' > > > > Then you could do anything you like. > > > > -compile({tokenezer, Mod}). > > > > could maybe call a custom tokeniser after character processing and > > prior to calling any > > parse transforms. > > > > /Joe > > > > Hmm, strange convergence of ideas in different mailing lists at the > moment (the Lua community is discussing stuff like this as well). Great minds think alike :-) > > All of these ideas appear "neat". Because you can start inventing your > own syntax for stuff. 'Tis what computer types love, after all Absolutely, that's how Erlang started - tinkering around with Prolog :-) > (although, using the right indentation with the correct editor might > even come before that :-). > > But, unless you are designing a domain specific language, you end up > with programs that nobody else can understand. Even worse, almost > everything (file extension, run-time system, standard documentation) > makes it appear that you are dealing with Erlang. But when you look > inside, it is _not_ Erlang, but someones idea of a "better" Erlang. I think of these as language extensions rather than a completely new language. > > Allowing the dynamic change of programming language syntax was a cool > thing in the 70's. It didn't work then, and I seriously doubt it will > today. > > If there are real merits to new operators and syntax, then these must > be discussed with the keepers of the language. If the new features > appear worthy, then they might get added. If they do not get added, > and you still think that you must have them, then create yourself a > new language. This may be extremely heavily based on Erlang, but it > is not Erlang! And it mustn't be called Erlang either. Absolutely - I think the path to approval of a new feature is 1) implement as a parse transform 2) circulate to people who are interested 3) write an eep 4) discuss the eep 5) adopt into language or reject The reason I suggested and improvements to parse transforms is because parse transforms can only transform valid Erlang forms - which severely limits their usefulness. Now one of the criteria for acceptance 5) in the above is that the ideas are not just vaporware and has actually been tried out by a number of people who can express some sensible opinion as to whether or not the new feature is useful. Thus we have a chicken and egg situation - the main implementors do not want to add untested features (for very good reasons of stability) and only do so after a feature is well tested - but users cannot test something until it is implemented. Parse transforms offer a light-weight mechanism for testing new language features without breaking everything else, thus avoiding the chicken and egg situation. They should - like any program - be well written and documented. I have read totally incomprehensible Erlang programs using no parse transforms - the use of parse transformation neither improves nor degrades the understandability of the program - this entirely depends upon how the program is written. /Joe > > Sorry for the rant, but this stuff is right up there with "coding > standards" in my book. > > Robby > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vances@REDACTED Mon Nov 26 17:53:05 2007 From: vances@REDACTED (Vance Shipley) Date: Mon, 26 Nov 2007 12:53:05 -0400 Subject: [erlang-questions] OS X gs windows display only after selecting Message-ID: <20071126165233.GA226@little-black-book.motivity.ca> Is anyone else using gs applications such as the debugger or et on OS X (native not X11) and do you notice that certain windows do not display until you select them? It's becoming annoying enough that I'm going to have to track down what is wrong but I thought I'd ask first in case anyone else has tried. I ran a number of the gs demo applications and they worked fine. Running toolbar the "Erlang Tools" window displays fine. When the appmon icon is selected the "APPMON: Overview on.." window comes up but only the title menu bar is visible. You must click on the title bar to get the main window to redraw and display. -Vance From rvirding@REDACTED Mon Nov 26 22:36:48 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 26 Nov 2007 22:36:48 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> Message-ID: <3dbc6d1c0711261336p63f8c173o5f5bb71d8a20b4a0@mail.gmail.com> On 26/11/2007, Robert Virding wrote: > > Scheme allows defining a prefix within the a symbol which means it refers > to another module (library for them) so you would write: > > (mod:func ... ) > > when you know where to go at compiletime. At least that's how I > interpreted the spec. Then for the general case you could use: > > (apply mod 'func ( ... )) > > or how about: > > (: mod func arg1 arg2 ... ) > > for all cases? > Equivalent to funcall in CL, this would be a remote funcall. Again a bit heavy for the standard case. Of course some mailers might see that as a smiley. :-) Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Mon Nov 26 22:32:42 2007 From: rvirding@REDACTED (Robert Virding) Date: Mon, 26 Nov 2007 22:32:42 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> Message-ID: <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> On 26/11/2007, Christian S wrote: > > As for remote procedure-calls my current feeling is that this would > look quite okay: "Mod:Fun(Arg1, Arg2,...)" as "(:(Mod Fun) Arg1 Arg2 > ...)" a local call would be just (Fun Arg1 Arg2 ...) and that's the > common case. Does well with hierarchical module names too. > > It follows common lisp syntax for arrays "#(1 2 3)" and for quoting > literals "'(a b c)" . That would work ok and not be too unlispy. The question is how would you handle the different cases where parts are either atoms or variables: mod:func( ... ) Mod:func( ... ) Mod:Func( ... ) You would then have to start using quotes inside the :( ... ) construct and it would look strange for the common case: (:('mod 'func) ... ) Scheme allows defining a prefix within the a symbol which means it refers to another module (library for them) so you would write: (mod:func ... ) when you know where to go at compiletime. At least that's how I interpreted the spec. Then for the general case you could use: (apply mod 'func ( ... )) or how about: (: mod func arg1 arg2 ... ) for all cases? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From maarten@REDACTED Mon Nov 26 23:47:44 2007 From: maarten@REDACTED (Maarten Engelen) Date: Mon, 26 Nov 2007 23:47:44 +0100 Subject: [erlang-questions] Mnesia record count Message-ID: Hi, Currently I'm building an application that needs to do a lot of record checking by counting the number of records in a mnesia table based on some condition. Mnesia has been a live saver in the development of this application, but I can't find a decent solution to the mnesia equivalent of COUNT(*) in SQL. I haven't been able to check the number of records a certain query would return without reading the complete set of results into a list and getting the length of the list. I have been looking into the dirty_update_counter function, but this doesn't guarantee anything when I have multiple mnesia nodes. Any ideas? Regards, Maarten From chsu79@REDACTED Tue Nov 27 00:06:44 2007 From: chsu79@REDACTED (Christian S) Date: Tue, 27 Nov 2007 00:06:44 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> Message-ID: 2007/11/26, Robert Virding : > or how about: > (: mod func arg1 arg2 ... ) > for all cases? It seems like (? ...) and (! ...) are the chosen ways for receive and send, and (: M F A...) has a nice symmetry with that. That's a thumbs up. (However, I find that too many one-character symbols to make code be a bit "naked", I'm a fast enough typist that I dont mind spelling out full words and I think it makes code more readable in the end.) My initial feeling was that ':' would only be a reader macro, that there would be a full form for remote calls, just like how '(a b c) is shorthand for (quote (a b c)). As far as I understand, lisp started out being a theoretical model used to describe/reason about programs, until someone figured out it would be easy to make a computer evaluate them. It would probably be a sensible route to start erlang in sexprs too: write some programs, discover the needed features, then try to build an evaluator for it. From rpettit@REDACTED Tue Nov 27 00:34:24 2007 From: rpettit@REDACTED (Rick Pettit) Date: Mon, 26 Nov 2007 17:34:24 -0600 Subject: [erlang-questions] Mnesia record count In-Reply-To: References: Message-ID: <20071126233424.GA15983@vailsys.com> On Mon, Nov 26, 2007 at 11:47:44PM +0100, Maarten Engelen wrote: > Hi, > > Currently I'm building an application that needs to do a lot of record > checking by counting the number of records in a mnesia table based on > some condition. Mnesia has been a live saver in the development of > this application, but I can't find a decent solution to the mnesia > equivalent of COUNT(*) in SQL. I haven't been able to check the number > of records a certain query would return without reading the complete > set of results into a list and getting the length of the list. > > I have been looking into the dirty_update_counter function, but this > doesn't guarantee anything when I have multiple mnesia nodes. > > Any ideas? How about mnesia:table_info(Table,size) ? -Rick From sean.hinde@REDACTED Tue Nov 27 00:41:05 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 26 Nov 2007 23:41:05 +0000 Subject: [erlang-questions] Mnesia record count In-Reply-To: References: Message-ID: There is some support for this style of query built into ets via ets:select_count(Tab, MatchSpec). New features in ets have traditionally taken a while to get into mnesia, but if your table is disc_copies (or ram_only) then you could use this call directly onto the ets backing store of the mnesia table. This assumes of course that your query can be expressed as a match spec. Also it would be worth badgering the OTP guys to bring this very useful feature up to the mnesia API Sean On 26 Nov 2007, at 22:47, Maarten Engelen wrote: > Hi, > > Currently I'm building an application that needs to do a lot of record > checking by counting the number of records in a mnesia table based on > some condition. Mnesia has been a live saver in the development of > this application, but I can't find a decent solution to the mnesia > equivalent of COUNT(*) in SQL. I haven't been able to check the number > of records a certain query would return without reading the complete > set of results into a list and getting the length of the list. > > I have been looking into the dirty_update_counter function, but this > doesn't guarantee anything when I have multiple mnesia nodes. > > Any ideas? > > Regards, > > Maarten > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rpettit@REDACTED Tue Nov 27 01:07:18 2007 From: rpettit@REDACTED (Rick Pettit) Date: Mon, 26 Nov 2007 18:07:18 -0600 Subject: [erlang-questions] Mnesia record count In-Reply-To: <20071126233424.GA15983@vailsys.com> References: <20071126233424.GA15983@vailsys.com> Message-ID: <20071127000718.GA872@vailsys.com> On Mon, Nov 26, 2007 at 05:34:24PM -0600, Rick Pettit wrote: > On Mon, Nov 26, 2007 at 11:47:44PM +0100, Maarten Engelen wrote: > > Hi, > > > > Currently I'm building an application that needs to do a lot of record > > checking by counting the number of records in a mnesia table based on > > some condition. Mnesia has been a live saver in the development of > > this application, but I can't find a decent solution to the mnesia > > equivalent of COUNT(*) in SQL. I haven't been able to check the number > > of records a certain query would return without reading the complete > > set of results into a list and getting the length of the list. > > > > I have been looking into the dirty_update_counter function, but this > > doesn't guarantee anything when I have multiple mnesia nodes. > > > > Any ideas? > > How about mnesia:table_info(Table,size) ? Duh, should have paid closer attention to the question before replying. Come to think of it, I have never needed to know the size of a result set ahead of time. I would be interested in the answer if you find one. Sorry about that, -Rick From david.hopwood@REDACTED Tue Nov 27 02:05:24 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Tue, 27 Nov 2007 01:05:24 +0000 Subject: [erlang-questions] Early history of Lisp In-Reply-To: References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> Message-ID: <474B6D54.1070106@industrial-designers.co.uk> Christian S wrote: > As far as I understand, lisp started out being a theoretical model > used to describe/reason about programs, until someone figured out it > would be easy to make a computer evaluate them. That's widely believed, but apparently someone (Mark Miller or Alan Karp, I think) put this to John McCarthy, in the context of asking why the original Lisp used dynamic scoping rather than, as the lambda calculus does, lexical scoping. McCarthy said (paraphrased) that Lisp was designed as a practical programming language from the start; it was based loosely on the lambda calculus, but deviated from it in ways that were specifically intended to make the language easier to implement and more useful for programming, including mutable state and dynamic scoping. This is consistent with well-informed histories of Lisp such as . It's true that some of the early papers on Lisp, such as AI memo 8 (see ) argue for the suitability of S-functions as a model of computation, but note that these came after the initial design of Lisp as a programming language, not before. -- David Hopwood From yinso.chen@REDACTED Tue Nov 27 02:32:15 2007 From: yinso.chen@REDACTED (YC) Date: Mon, 26 Nov 2007 17:32:15 -0800 Subject: [erlang-questions] how: redirect trace output to a file In-Reply-To: References: <779bf2730711251946o6d493a25yff6ea361b94ecd77@mail.gmail.com> Message-ID: <779bf2730711261732x17b1f96fg6efd04e3c2ac6c37@mail.gmail.com> Thanks ;) yc On Nov 26, 2007 2:39 AM, Kenneth Lundin wrote: > You can redirect trace output in various ways. > > dbg:tracer(Type,Data) % sets the tracer > > You can do like this to direct trace output to a file: > > dbg:tracer(port,dbg:trace_port(file,"MyFileName")). > > or > > dbg:tracer(port,dbg:trace_port(file,{"MyFileName",wrap,"MySuffix"})). > > > /Kenneth Erlang/OTP team at Ericsson > > On 11/26/07, YC wrote: > > Hi all - > > > > how do I redirect trace output to a file? I played with dbg:trace_port, > but > > I'm unclear on how it's used and whether it's the right function. Any > > pointer is appreciated, > > > > Thanks, > > yc > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shehan@REDACTED Tue Nov 27 05:27:55 2007 From: shehan@REDACTED (shehan) Date: Tue, 27 Nov 2007 09:57:55 +0530 Subject: [erlang-questions] disable the runtime warnings Message-ID: <000201c830ad$e1c022c0$b9d72b7c@wavenet.lk> Hi all, I compile erlang code with following options. ERLCFLAGS = +native -smp Ex: /usr/local/lib/erlang/bin/erlc +native -smp -I ../include -I ../src ../src/test.erl Code was compiled, but when running following warning is display in ERL shell. Warning: not loading native code for module test: it was compiled for an incompatible runtime system; please regenerate native code for this runtime system Can somebody say how to eliminate this?? BR, Shehan -------------- next part -------------- An HTML attachment was scrubbed... URL: From oneone@REDACTED Tue Nov 27 05:38:48 2007 From: oneone@REDACTED (Andrew Arrow) Date: Mon, 26 Nov 2007 20:38:48 -0800 Subject: [erlang-questions] ets gives badarg after recompile Message-ID: Well I tried to modify your example program to show what I'm seeing but I can't reproduce the problem in a small example program. I'm doing something just like this: -module(t). -export([t/0]). t()-> process_flag(trap_exit, true), myname = ets:new(myname, [set, named_table]), true = ets:insert( myname, {a,1}), [{a,1}] = ets:lookup( myname, a ), Pid = self(), spawn_link(fun() -> another_func(Pid) end), receive {data} -> io:format("got it") end, true = ets:delete( myname ). another_func(Pid) -> ets:lookup(myname, a), Pid ! {data}. And for some reason I'll get a Error in process <0.81.0> with exit value: {badarg,[{ets,lookup,[myname,a]},{t,another_func,0}]} after the 2nd compile. It must mean that another_func is being run AFTER the ets:delete( myname) already ran, but I don't see why this could happen. --------- Date: Mon, 26 Nov 2007 08:00:15 +0100 From: Bengt Kleberg Subject: Re: [erlang-questions] ets gives badarg after recompile To: erlang-questions@REDACTED Message-ID: <474A6EFF.3060607@REDACTED> Content-Type: text/plain; charset=ISO-8859-1; format=flowed greetings, could you be a little more precise when describing the problem? given this file: -module(t). -export([t/0]). t()-> myname = ets:new(myname, [set, named_table]), true = ets:insert( myname, {a,1}), [{a,1}] = ets:lookup( myname, a ), true = ets:delete( myname ). i can do: 7> c(t). {ok,t} 8> t:t(). true 9> t:t(). true 10> c(t). {ok,t} 11> t:t(). true 12> From shehan@REDACTED Tue Nov 27 05:40:00 2007 From: shehan@REDACTED (shehan) Date: Tue, 27 Nov 2007 10:10:00 +0530 Subject: [erlang-questions] disable the runtime warnings Message-ID: <001501c830af$92c25b00$b9d72b7c@wavenet.lk> Hi all, I compile erlang code with following options. ERLCFLAGS = +native -smp Ex: /usr/local/lib/erlang/bin/erlc +native -smp -I ../include -I ../src ../src/test.erl Code was compiled, but when running, following warning is display in ERL shell. Warning: not loading native code for module test: it was compiled for an incompatible runtime system; please regenerate native code for this runtime system Can somebody say how to eliminate this?? BR, Shehan -------------- next part -------------- An HTML attachment was scrubbed... URL: From oneone@REDACTED Tue Nov 27 05:43:50 2007 From: oneone@REDACTED (Andrew Arrow) Date: Mon, 26 Nov 2007 20:43:50 -0800 Subject: [erlang-questions] erl REALLY slow to startup Message-ID: I've been typing erl at the prompt and waiting about 20 seconds before I get into the Erlang shell on my MacBook 1.83 GHz Intel Core 2 Duo machine. I thought this was normal because it's the only place I have ever used Erlang. But today I tried it from a MacBook Pro 2.85 GHz Intel Core 2 Duo machine and it started up immediately! Is there anything I can do to get it to work like that on the MacBook? From vlm@REDACTED Tue Nov 27 05:55:37 2007 From: vlm@REDACTED (Lev Walkin) Date: Mon, 26 Nov 2007 20:55:37 -0800 Subject: [erlang-questions] disable the runtime warnings In-Reply-To: <000201c830ad$e1c022c0$b9d72b7c@wavenet.lk> References: <000201c830ad$e1c022c0$b9d72b7c@wavenet.lk> Message-ID: <474BA349.4060201@lionet.info> shehan wrote: > > > Hi all, > > I compile erlang code with following options. > > ERLCFLAGS = +native ?smp > > Ex: /usr/local/lib/erlang/bin/erlc +native -smp -I ../include -I ../src > ../src/test.erl > > > > > > Code was compiled, but when running following warning is display in ERL > shell. > > > > Warning: not loading native code for module test: it > was compiled for an incompatible runtime system; please regenerate > native code for this runtime system > > > > Can somebody say how to eliminate this?? Use -smp enable flag to erl when running the beam. From vlm@REDACTED Tue Nov 27 05:58:21 2007 From: vlm@REDACTED (Lev Walkin) Date: Mon, 26 Nov 2007 20:58:21 -0800 Subject: [erlang-questions] erl REALLY slow to startup In-Reply-To: References: Message-ID: <474BA3ED.1030906@lionet.info> Andrew Arrow wrote: > I've been typing erl at the prompt and waiting about 20 seconds before > I get into the Erlang shell on my MacBook 1.83 GHz Intel Core 2 Duo > machine. I thought this was normal because it's the only place I have > ever used Erlang. But today I tried it from a MacBook Pro 2.85 GHz > Intel Core 2 Duo machine and it started up immediately! Is there > anything I can do to get it to work like that on the MacBook? You might have a failing hard drive. Check the SMART status using Onyx. -- vlm From shehan@REDACTED Tue Nov 27 06:17:59 2007 From: shehan@REDACTED (shehan) Date: Tue, 27 Nov 2007 10:47:59 +0530 Subject: [erlang-questions] disable the runtime warnings In-Reply-To: <474BA349.4060201@lionet.info> Message-ID: <000001c830b4$e0dc4e40$b9d72b7c@wavenet.lk> Tx a lot. It is working now. -----Original Message----- From: Lev Walkin [mailto:vlm@REDACTED] Sent: Tuesday, November 27, 2007 10:26 AM To: shehan Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] disable the runtime warnings shehan wrote: > > > Hi all, > > I compile erlang code with following options. > > ERLCFLAGS = +native -smp > > Ex: /usr/local/lib/erlang/bin/erlc +native -smp -I ../include -I ../src > ../src/test.erl > > > > > > Code was compiled, but when running following warning is display in ERL > shell. > > > > Warning: not loading native code for module test: it > was compiled for an incompatible runtime system; please regenerate > native code for this runtime system > > > > Can somebody say how to eliminate this?? Use -smp enable flag to erl when running the beam. From oneone@REDACTED Tue Nov 27 06:21:38 2007 From: oneone@REDACTED (Andrew Arrow) Date: Mon, 26 Nov 2007 21:21:38 -0800 Subject: [erlang-questions] erl REALLY slow to startup In-Reply-To: <474BA3ED.1030906@lionet.info> References: <474BA3ED.1030906@lionet.info> Message-ID: "S.M.A.R.T. status verified. This disk seems to be working correctly" On Nov 26, 2007 8:58 PM, Lev Walkin wrote: > > Andrew Arrow wrote: > > I've been typing erl at the prompt and waiting about 20 seconds before > > I get into the Erlang shell on my MacBook 1.83 GHz Intel Core 2 Duo > > machine. I thought this was normal because it's the only place I have > > ever used Erlang. But today I tried it from a MacBook Pro 2.85 GHz > > Intel Core 2 Duo machine and it started up immediately! Is there > > anything I can do to get it to work like that on the MacBook? > > You might have a failing hard drive. Check the SMART status using Onyx. > > -- > vlm > From luke@REDACTED Tue Nov 27 07:50:45 2007 From: luke@REDACTED (LUKE) Date: Tue, 27 Nov 2007 14:50:45 +0800 Subject: [erlang-questions] What is the function be defined as BIF? Message-ID: <2CF08E211377437D921AD02780010E2B@lukeserver> -module(genserver). -export([start/2,rpc/2]). start(Name,Mod)->register(spawn(fun()->loop(Name,Mod,Mod:init()) end)). .... Eshell V5.5.5 (abort with ^G) ... 9>c(genserver). ./genserver.erl:4: function register/1 undefined -- modify the register to erlang:register start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) end)). -- 10> c(genserver). {ok,genserver} The register function is BIF ? And the spawn function is BIF? All of erlang:* is BIF? When we need specify a prefix erlang:* ? Why the most of example does not using erlang:register? -------------- next part -------------- An HTML attachment was scrubbed... URL: From luke@REDACTED Tue Nov 27 08:17:49 2007 From: luke@REDACTED (LUKE) Date: Tue, 27 Nov 2007 15:17:49 +0800 Subject: [erlang-questions] What is the function be defined as BIF? Message-ID: <75E94CA5D5FC46EAA3BE73AD10A4D815@lukeserver> I found that i lose some word in the code. start(Name,Mod)->register(Name,spawn(fun()->loop(Name,Mod,Mod:init()) end)). But Why the code can be compile? start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) end)). ----- Original Message ----- From: LUKE To: erlang-questions@REDACTED Sent: Tuesday, November 27, 2007 2:50 PM Subject: What is the function be defined as BIF? -module(genserver). -export([start/2,rpc/2]). start(Name,Mod)->register(spawn(fun()->loop(Name,Mod,Mod:init()) end)). .... Eshell V5.5.5 (abort with ^G) ... 9>c(genserver). ./genserver.erl:4: function register/1 undefined -- modify the register to erlang:register start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) end)). -- 10> c(genserver). {ok,genserver} The register function is BIF ? And the spawn function is BIF? All of erlang:* is BIF? When we need specify a prefix erlang:* ? Why the most of example does not using erlang:register? -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuelrivas@REDACTED Tue Nov 27 08:32:26 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Tue, 27 Nov 2007 08:32:26 +0100 Subject: [erlang-questions] erl REALLY slow to startup In-Reply-To: References: Message-ID: <20071127073226.GC13512@lambdastream.com> It might be a network problem. Check whether "host " returns immediately or lasts those 20 seconds ... Regards -- Samuel From bengt.kleberg@REDACTED Tue Nov 27 08:35:35 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 27 Nov 2007 08:35:35 +0100 Subject: [erlang-questions] What is the function be defined as BIF? In-Reply-To: <75E94CA5D5FC46EAA3BE73AD10A4D815@lukeserver> References: <75E94CA5D5FC46EAA3BE73AD10A4D815@lukeserver> Message-ID: <474BC8C7.2030109@ericsson.com> greetings, i interpret your question to be: Q: why can register/2 be replaced with erlang:register/2 ? is that correct? A: a function without a module prefix can either be a function local to the module, or it can be a function found in the module ''erlang''. it helps subsequent readings of the code, and it avoids scooping problems, if you always explicitly add the erlang module in front of those functions. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/27/07 08:17, LUKE wrote: > I found that i lose some word in the code. > > start(Name,Mod)->register(Name,spawn(fun()->loop(Name,Mod,Mod:init()) end)). > But > > Why the code can be compile? > start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) > end)). > > > ----- Original Message ----- > *From:* LUKE > *To:* erlang-questions@REDACTED > *Sent:* Tuesday, November 27, 2007 2:50 PM > *Subject:* What is the function be defined as BIF? > > -module(genserver). > -export([start/2,rpc/2]). > > start(Name,Mod)->register(spawn(fun()->loop(Name,Mod,Mod:init()) end)). > .... > > Eshell V5.5.5 (abort with ^G) > ... > 9>c(genserver). > ./genserver.erl:4: function register/1 undefined > > -- > modify the register to erlang:register > start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) > end)). > -- > > 10> c(genserver). > {ok,genserver} > > The register function is BIF ? > And the spawn function is BIF? > All of erlang:* is BIF? > When we need specify a prefix erlang:* ? > Why the most of example does not using erlang:register? > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Tue Nov 27 09:44:35 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 Nov 2007 09:44:35 +0100 Subject: [erlang-questions] erl REALLY slow to startup In-Reply-To: References: Message-ID: <9b08084c0711270044i508c517td0b109ed07844d79@mail.gmail.com> I hade a similar problem with ubuntu (long startup time) - use something like strace or truss (I think on a mac you must use ktrace and kdump) to dump all system calls in a file. Then you can stare at these to see which call took a long time (on ubuntu it was a symbolic link that was broken which caused the font cache to be rebuilt every time I created a new window) - nothing to do with Erlang at all - just a broken system that happens to bite you when you start Erlang. /Joe On Nov 27, 2007 5:43 AM, Andrew Arrow wrote: > I've been typing erl at the prompt and waiting about 20 seconds before > I get into the Erlang shell on my MacBook 1.83 GHz Intel Core 2 Duo > machine. I thought this was normal because it's the only place I have > ever used Erlang. But today I tried it from a MacBook Pro 2.85 GHz > Intel Core 2 Duo machine and it started up immediately! Is there > anything I can do to get it to work like that on the MacBook? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Tue Nov 27 09:52:01 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 Nov 2007 09:52:01 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> Message-ID: <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> Now you mentioned receive it occurred to me that it would be rather nice to receive a fun in Erlang. Unfortunately receive has only one syntactic form receive pattern1 -> action1; ... end. In the spirit of funs it would be very nice to say: F = fun(Pattern1) -> Actions1 (Pattern2) -> Actions2 after Time -> Actions end, ... receive(Fun) This would make writing an erlang meta interpreter much easier and allow all kinds of mischief /Joe Armstrong On Nov 27, 2007 12:06 AM, Christian S wrote: > 2007/11/26, Robert Virding : > > or how about: > > (: mod func arg1 arg2 ... ) > > for all cases? > > It seems like (? ...) and (! ...) are the chosen ways for receive and > send, and (: M F A...) has a nice symmetry with that. That's a thumbs > up. (However, I find that too many one-character symbols to make code > be a bit "naked", I'm a fast enough typist that I dont mind spelling > out full words and I think it makes code more readable in the end.) > > My initial feeling was that ':' would only be a reader macro, that > there would be a full form for remote calls, just like how '(a b c) is > shorthand for (quote (a b c)). > > As far as I understand, lisp started out being a theoretical model > used to describe/reason about programs, until someone figured out it > would be easy to make a computer evaluate them. It would probably be a > sensible route to start erlang in sexprs too: write some programs, > discover the needed features, then try to build an evaluator for it. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From vlm@REDACTED Tue Nov 27 10:40:04 2007 From: vlm@REDACTED (Lev Walkin) Date: Tue, 27 Nov 2007 01:40:04 -0800 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> Message-ID: <474BE5F4.4090705@lionet.info> This can be achieved using a combinator, if only there were a possibility to not to extract the current message, e.g., "retain": receiveFun(F) -> % Discover the timeout using F {Timeout, Default} = try F(timeout) of T -> T; catch _:_ -> {infinity, _} end, % Receive something and validate against F. receive Something -> try F(Something) of Result -> Result catch _:_ -> retain Something end after Timeout -> Default end. ... F = fun(Pattern1) -> Actions1; (Pattern2) -> Actions2 end; (timeout) -> {15000, Actions}; ... receiveFun(F) Such "retain" thingie could be reused in more interesting contexts. However, one drawback is that retain would be useful only for the nearest enclosing "receive" context. Joe Armstrong wrote: > Now you mentioned receive it occurred to me that it would be rather nice to > receive a fun in Erlang. Unfortunately receive has only one syntactic form > > receive > pattern1 -> action1; > ... > end. > > In the spirit of funs it would be very nice to say: > > F = fun(Pattern1) -> Actions1 > (Pattern2) -> Actions2 > after Time -> Actions > end, > ... > receive(Fun) > > This would make writing an erlang meta interpreter much easier > and allow all kinds of mischief > > /Joe Armstrong > > > > On Nov 27, 2007 12:06 AM, Christian S wrote: >> 2007/11/26, Robert Virding : >>> or how about: >>> (: mod func arg1 arg2 ... ) >>> for all cases? >> It seems like (? ...) and (! ...) are the chosen ways for receive and >> send, and (: M F A...) has a nice symmetry with that. That's a thumbs >> up. (However, I find that too many one-character symbols to make code >> be a bit "naked", I'm a fast enough typist that I dont mind spelling >> out full words and I think it makes code more readable in the end.) >> >> My initial feeling was that ':' would only be a reader macro, that >> there would be a full form for remote calls, just like how '(a b c) is >> shorthand for (quote (a b c)). >> >> As far as I understand, lisp started out being a theoretical model >> used to describe/reason about programs, until someone figured out it >> would be easy to make a computer evaluate them. It would probably be a >> sensible route to start erlang in sexprs too: write some programs, >> discover the needed features, then try to build an evaluator for it. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From maarten@REDACTED Tue Nov 27 11:20:42 2007 From: maarten@REDACTED (Maarten Engelen) Date: Tue, 27 Nov 2007 11:20:42 +0100 Subject: [erlang-questions] Mnesia record count In-Reply-To: References: <20071126233424.GA15983@vailsys.com> Message-ID: 2007/11/27, Paul Mineiro : > If the issue is memory consumption, you can use mnesia:select/4 to get the > results in (small) chunks. > > -- p It is not so much memory consumption as a speed consideration. The scale of the application is that it needs to handle about 5000 concurrent connections that do around 1000 requests per second on the system. Each of these requests needs to check the size of a subset of a table with about 50000 rows. If mnesia is fast enough to handle it by reading in the complete subset of a few thousand rows and checking it's length every time, I'm fine with that. Nevertheless, counting the amount of rows in a defined subset of a table looks like a basic operation to me. In essence it's a query without returning results. That made me wonder if I missed anything in the documentation. Maarten. From maarten@REDACTED Tue Nov 27 11:19:55 2007 From: maarten@REDACTED (Maarten Engelen) Date: Tue, 27 Nov 2007 11:19:55 +0100 Subject: [erlang-questions] Mnesia record count In-Reply-To: References: Message-ID: 2007/11/27, Sean Hinde : > There is some support for this style of query built into ets via > ets:select_count(Tab, MatchSpec). > > New features in ets have traditionally taken a while to get into > mnesia, but if your table is disc_copies (or ram_only) then you could > use this call directly onto the ets backing store of the mnesia table. > This assumes of course that your query can be expressed as a match spec. > > Also it would be worth badgering the OTP guys to bring this very > useful feature up to the mnesia API > > Sean > I would have to look into the match specification documentation to see if that's a possibility. I agree it would be a very nice feature to have in the mnesia API. I actually couldn't really believe at first there wasn't anything in mnesia that would allow me to do that. Maarten. From lcoquelle@REDACTED Tue Nov 27 11:51:55 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Tue, 27 Nov 2007 18:51:55 +0800 Subject: [erlang-questions] Mnesia record count In-Reply-To: References: <20071126233424.GA15983@vailsys.com> Message-ID: On 11/27/07, Maarten Engelen wrote: > > [...] > It is not so much memory consumption as a speed consideration. The > scale of the application is that it needs to handle about 5000 > concurrent connections that do around 1000 requests per second on the > system. Each of these requests needs to check the size of a subset of > a table with about 50000 rows. If mnesia is fast enough to handle it > by reading in the complete subset of a few thousand rows and checking > it's length every time, I'm fine with that. 1000 requests coming from 5000 concurrent connections ... that's nice! In order to have an idea of what kind of load mnesia can support, could you give some precision about the kind of requests (proportion of read/write, complexity of the request), and also how many erlang nodes are used? ... no need for statistic measures or benchmark, just enough to satisfy the curiosity of the readers :). Thanks. [...] > Maarten. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Tue Nov 27 12:04:59 2007 From: rvirding@REDACTED (Robert Virding) Date: Tue, 27 Nov 2007 12:04:59 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <474BE5F4.4090705@lionet.info> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> <474BE5F4.4090705@lionet.info> Message-ID: <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> Termite has a recieve function ?? defined as (?? pred [timeout [default]]) which retrieves the first message in the mailbox which satisfies pred. This is basically impossible to implement today in Erlang but would be possible to add. I would however probably oppose it as you could get into really weird situations if pred had side effects. It is actually just like allowing user defined functions in guards. receive X when user_function(X) -> X end I actually defy anyone to come up with a safe, consistent and *understandable* definition of guards which allow user defined functions. It would also be nice if they were relatively easy to implement. Joe, remember our ideas with pipes? Robert On 27/11/2007, Lev Walkin wrote: > > > This can be achieved using a combinator, if only there > were a possibility to not to extract the current message, > e.g., "retain": > > > receiveFun(F) -> > % Discover the timeout using F > {Timeout, Default} = try F(timeout) of > T -> T; > catch > _:_ -> {infinity, _} > end, > % Receive something and validate against F. > receive Something -> > try F(Something) of > Result -> Result > catch > _:_ -> retain Something > end > after Timeout -> Default end. > > ... > F = fun(Pattern1) -> Actions1; > (Pattern2) -> Actions2 end; > (timeout) -> {15000, Actions}; > ... > receiveFun(F) > > > Such "retain" thingie could be reused in more interesting contexts. > However, one drawback is that retain would be useful only for the > nearest enclosing "receive" context. > > > Joe Armstrong wrote: > > Now you mentioned receive it occurred to me that it would be rather nice > to > > receive a fun in Erlang. Unfortunately receive has only one syntactic > form > > > > receive > > pattern1 -> action1; > > ... > > end. > > > > In the spirit of funs it would be very nice to say: > > > > F = fun(Pattern1) -> Actions1 > > (Pattern2) -> Actions2 > > after Time -> Actions > > end, > > ... > > receive(Fun) > > > > This would make writing an erlang meta interpreter much easier > > and allow all kinds of mischief > > > > /Joe Armstrong > > > > > > > > On Nov 27, 2007 12:06 AM, Christian S wrote: > >> 2007/11/26, Robert Virding : > >>> or how about: > >>> (: mod func arg1 arg2 ... ) > >>> for all cases? > >> It seems like (? ...) and (! ...) are the chosen ways for receive and > >> send, and (: M F A...) has a nice symmetry with that. That's a thumbs > >> up. (However, I find that too many one-character symbols to make code > >> be a bit "naked", I'm a fast enough typist that I dont mind spelling > >> out full words and I think it makes code more readable in the end.) > >> > >> My initial feeling was that ':' would only be a reader macro, that > >> there would be a full form for remote calls, just like how '(a b c) is > >> shorthand for (quote (a b c)). > >> > >> As far as I understand, lisp started out being a theoretical model > >> used to describe/reason about programs, until someone figured out it > >> would be easy to make a computer evaluate them. It would probably be a > >> sensible route to start erlang in sexprs too: write some programs, > >> discover the needed features, then try to build an evaluator for it. > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maarten@REDACTED Tue Nov 27 12:10:28 2007 From: maarten@REDACTED (Maarten Engelen) Date: Tue, 27 Nov 2007 12:10:28 +0100 Subject: [erlang-questions] Mnesia record count In-Reply-To: References: <20071126233424.GA15983@vailsys.com> Message-ID: 2007/11/27, Ludovic Coquelle : > > > On 11/27/07, Maarten Engelen wrote: > > [...] > > It is not so much memory consumption as a speed consideration. The > > scale of the application is that it needs to handle about 5000 > > concurrent connections that do around 1000 requests per second on the > > system. Each of these requests needs to check the size of a subset of > > a table with about 50000 rows. If mnesia is fast enough to handle it > > by reading in the complete subset of a few thousand rows and checking > > it's length every time, I'm fine with that. > > 1000 requests coming from 5000 concurrent connections ... that's nice! > In order to have an idea of what kind of load mnesia can support, could you > give some precision about the kind of requests (proportion of read/write, > complexity of the request), and also how many erlang nodes are used? ... no > need for statistic measures or benchmark, just enough to satisfy the > curiosity of the readers :). Thanks. Just to be on the safe side: The total is 1000 requests coming from 5000 connections. Not 1000 requests per second on each of the 5000 connections. ;) Currently I'm in a rewrite of the software to Erlang. This started as a proof of concept and is on its way to become the new software used in production. The current system is written in c, but introducing new features is very difficult next to the fact that it doesn't scale very well. It is used to support the authentication and monitoring of about 25000 concurrent users. It has to support about 40 frontend systems in the near future with around 1000-2000 connections per system. Each user connection generates 2-3 requests per minute on the backend system we're writing. We haven't been testing it on the production load yet, but it looks like this system can be supported with two multicore systems each running one erlang node and a distributed mnesia database which handles all configuration and session data. The requests are pretty simple. Just boundary checking and updating usage counters in the mnesia database. The proportion between reads/writes will be around 3/1. Nevertheless, this sytem still has to prove itself. I'm using mnesia based on the reading I did through the archives where I saw mnesia setups mentioned with a lot more data and comparable load. Maarten. From launoja@REDACTED Tue Nov 27 12:16:19 2007 From: launoja@REDACTED (Jani Launonen) Date: Tue, 27 Nov 2007 13:16:19 +0200 Subject: [erlang-questions] erl REALLY slow to startup In-Reply-To: References: <474BA3ED.1030906@lionet.info> Message-ID: Hello, Andrew Arrow kirjoitti 27.11.2007 kello 7.21: > > "S.M.A.R.T. status verified. > This disk seems to be working correctly" It didn't stop my system (Mac Mini Core Duo @1.66GHz) having badly corrupted disk. If you have Disk Warrior 4 (or similar), I'd suggest to check the disk properly. I lost my system as I believed to S.M.A.R.T. that everything was ok... :( I hope that would not be the case for you. Jani L > > On Nov 26, 2007 8:58 PM, Lev Walkin wrote: >> >> Andrew Arrow wrote: >>> I've been typing erl at the prompt and waiting about 20 seconds >>> before >>> I get into the Erlang shell on my MacBook 1.83 GHz Intel Core 2 Duo >>> machine. I thought this was normal because it's the only place I >>> have >>> ever used Erlang. But today I tried it from a MacBook Pro 2.85 GHz >>> Intel Core 2 Duo machine and it started up immediately! Is there >>> anything I can do to get it to work like that on the MacBook? >> >> You might have a failing hard drive. Check the SMART status using >> Onyx. >> >> -- >> vlm >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From alex.arnon@REDACTED Tue Nov 27 12:19:35 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Tue, 27 Nov 2007 13:19:35 +0200 Subject: [erlang-questions] CRC-32. Message-ID: <944da41d0711270319g7a379d6ase99bb2fd1dd56dca@mail.gmail.com> Hi List, I'm building a simple protocol over TCP, which requires a 32 bit CRC/hash in one of the message fields. I have decided on CRC-32. Now, there are several types of CRC-32, where the polynomial changes. I would _like_ to use the IEEE 802.3 variant. So, questions: - Is the CRC32 in zlib the IEEE 802.3 variant? - If not, is there a commonly available port driver? Thanks in advance, Alex. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mateuszb@REDACTED Tue Nov 27 12:34:17 2007 From: mateuszb@REDACTED (Mateusz Berezecki) Date: Tue, 27 Nov 2007 12:34:17 +0100 Subject: [erlang-questions] how: running erlans as daemon... Message-ID: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> Hello list, Is it possible to run erlang as deamon (aka unix service) without spawning shell ? Mateusz Berezecki From dgud@REDACTED Tue Nov 27 13:11:05 2007 From: dgud@REDACTED (Dan Gudmundsson) Date: Tue, 27 Nov 2007 13:11:05 +0100 Subject: [erlang-questions] CRC-32. In-Reply-To: <944da41d0711270319g7a379d6ase99bb2fd1dd56dca@mail.gmail.com> References: <944da41d0711270319g7a379d6ase99bb2fd1dd56dca@mail.gmail.com> Message-ID: <474C0959.4080604@erix.ericsson.se> It's the crc32 from zlib, don't know if it's 802.3, guess you can find more info in the doc at http://www.zlib.net/ /Dan Alex Arnon wrote: > Hi List, > > I'm building a simple protocol over TCP, which requires a 32 bit > CRC/hash in one of the message fields. I have decided on CRC-32. > Now, there are several types of CRC-32, where the polynomial changes. I > would _like_ to use the IEEE 802.3 variant. So, questions: > - Is the CRC32 in zlib the IEEE 802.3 variant? > - If not, is there a commonly available port driver? > > Thanks in advance, > Alex. > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Tue Nov 27 13:06:43 2007 From: chsu79@REDACTED (Christian S) Date: Tue, 27 Nov 2007 13:06:43 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> <474BE5F4.4090705@lionet.info> <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> Message-ID: 2007/11/27, Robert Virding : > I actually defy anyone to come up with a safe, consistent and > *understandable* definition of guards which allow user defined functions. It > would also be nice if they were relatively easy to implement. Joe, remember > our ideas with pipes? Are not monads the proven way to constraint what side-effects a function is allowed to have? I'm not particularly excited about Erlang requiring Monads, but they do seem to be the way to help the compiler with static analysis of side-effects. Loadable code makes the problem more difficult for Erlang though. From chsu79@REDACTED Tue Nov 27 13:16:38 2007 From: chsu79@REDACTED (Christian S) Date: Tue, 27 Nov 2007 13:16:38 +0100 Subject: [erlang-questions] Mnesia record count In-Reply-To: References: Message-ID: 2007/11/26, Maarten Engelen : > Hi, > > Currently I'm building an application that needs to do a lot of record > checking by counting the number of records in a mnesia table based on > some condition. Mnesia has been a live saver in the development of Sounds like you want to maintain these counts as you insert records. A kind of manual indexing, to save on otherwise costly queries. Encapsulate this maintenance in wrapper functions for adding, removing and modifying your records and use these in all your mnesia transactions. Of course, this doesn't work if your conditions are not manageably finite. From tobbe@REDACTED Tue Nov 27 13:31:50 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Tue, 27 Nov 2007 13:31:50 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> <474BE5F4.4090705@lionet.info> <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> Message-ID: Christian S wrote: > 2007/11/27, Robert Virding : >> I actually defy anyone to come up with a safe, consistent and >> *understandable* definition of guards which allow user defined functions. It >> would also be nice if they were relatively easy to implement. Joe, remember >> our ideas with pipes? > > Are not monads the proven way to constraint what side-effects a > function is allowed to have? I'm not particularly excited about Erlang > requiring Monads, but they do seem to be the way to help the compiler > with static analysis of side-effects. Loadable code makes the problem > more difficult for Erlang though. He he, I recently wrote this little function: %%% %%% Example: monad([in(Key1,Val1), in(Key2,Val2)], empty()) %%% monad([], Data) -> Data; monad([H|T], Data) -> monad(T, H(Data)). in(Key, Value) -> fun(Data) -> in(Key, Value, Data) end. in(Key, Value, Data) -> gb_trees:enter(Key, Value, Data). This way you can 'thread' the 'environment/DB' through a number of access functions in a compact manner. --Tobbe From david_holz@REDACTED Tue Nov 27 13:36:24 2007 From: david_holz@REDACTED (David Holz) Date: Tue, 27 Nov 2007 12:36:24 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> <474BE5F4.4090705@lionet.info> <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> Message-ID: From: rvirding@REDACTED > I actually defy anyone to come up with a safe, consistent and *understandable* definition of > guards which allow user defined functions. It would also be nice if they were relatively easy > to implement. Joe, remember our ideas with pipes? Hmm, how hard is it really to define? It seems to me to be exactly like C++ const propagation. There are a few things which can mutate state (process dict, message send/receive, ets et al, etc): - If a function calls built-in state mutators anywhere in its body, it's not pure functional. - If a function calls any other function that isn't pure functional, it's not pure functional. - If a function calls any M:F via variables instead of explicitly, tag it as not pure functional. (to make it easy to implement for an initial revision) - Only pure functional functions can be called in guards. The only challenging part is the dynamic code loading, which has similar issues to the M:F variable situation. Inside a guard context, M:F call syntax would have to check the purity of the function it's calling, which can be cached between code loads. This is really a linking issue, though, and could be theoretically designed not to have any per-call overhead for explicitly stated m:f's. I'm not saying it's dirt simple to implement, but the idea of contagiously propagating "non-functionalness" shouldn't be difficult to define. I, however, would like to see a setting or switch somewhere to just remove the "is_guard_bif" checking completely, leaving it up to me to not do anything stupid, without inflicting any extra load doing runtime guard checks. I think it should be straightforward to recompile the compiler myself with "is_guard_bif(_,_) -> true." but I haven't bothered with that yet. _________________________________________________________________ Share life as it happens with the new Windows Live.Download today it's FREE! http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007 From michael.regen@REDACTED Tue Nov 27 13:57:24 2007 From: michael.regen@REDACTED (Michael Regen) Date: Tue, 27 Nov 2007 13:57:24 +0100 Subject: [erlang-questions] how: running erlans as daemon... In-Reply-To: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> References: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> Message-ID: <9b59d0270711270457y1738d99ft6b822d25f1c03ecd@mail.gmail.com> On Nov 27, 2007 12:34 PM, Mateusz Berezecki wrote: > Hello list, > > Is it possible to run erlang as deamon (aka unix service) without > spawning shell ? Have a look at the erl command line switches. I guess -detached is what you are looking for. Of course you need to start something with -s or similar. Cheers, Michael From vlm@REDACTED Tue Nov 27 14:10:43 2007 From: vlm@REDACTED (Lev Walkin) Date: Tue, 27 Nov 2007 05:10:43 -0800 Subject: [erlang-questions] how: running erlans as daemon... In-Reply-To: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> References: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> Message-ID: <474C1753.40701@lionet.info> Mateusz Berezecki wrote: > Hello list, > > Is it possible to run erlang as deamon (aka unix service) without > spawning shell ? yes. erl -noshell -- vlm From zerthurd@REDACTED Tue Nov 27 14:25:01 2007 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 27 Nov 2007 19:25:01 +0600 Subject: [erlang-questions] how: running erlans as daemon... In-Reply-To: <474C1753.40701@lionet.info> References: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> <474C1753.40701@lionet.info> Message-ID: -noshell makes it possible to have the Erlang runtime system as a component in a series of UNIX pipes. For daemons use -detach On 27/11/2007, Lev Walkin wrote: > > Mateusz Berezecki wrote: > > Hello list, > > > > Is it possible to run erlang as deamon (aka unix service) without > > spawning shell ? > > yes. erl -noshell > > > -- > vlm > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Nov 27 14:25:59 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 Nov 2007 14:25:59 +0100 Subject: [erlang-questions] how: running erlans as daemon... In-Reply-To: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> References: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> Message-ID: <9b08084c0711270525j1af16bb7qa44a6d8e9dcf6626@mail.gmail.com> There are many ways to do this One way is described in: http://www.sics.se/~joe/tutorials/web_server/web_server.html#m2 This shows how to setup a sytem daemon using -heart and -detached together with the necessary stuff in /etc/rc.d/rc.local Hope this helps /Joe Armstrong On Nov 27, 2007 12:34 PM, Mateusz Berezecki wrote: > Hello list, > > Is it possible to run erlang as deamon (aka unix service) without > spawning shell ? > > > Mateusz Berezecki > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Tue Nov 27 14:37:57 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 Nov 2007 14:37:57 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> <474BE5F4.4090705@lionet.info> <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> Message-ID: <9b08084c0711270537n4d4a3449m742f5d57485b4045@mail.gmail.com> As you say it's pretty easy to analyse a function for side effects - we did this years ago. The problem is rather that we want guards to be viewed as an extension of pattern matching so we can guarantee that we can produce efficient code for pattern matching. Suppose we have a nice set of guards foo(...) when G1 -> ... foo(...) when G2 -> ... ... foo(...) when Gn -> ... and we allow only a user defined guard (Ug) somewhere in the middle of all of this foo(...) when G1 -> ... foo(...) when G2 -> ... ... foo(...) when Gn; Ug -> ... foo(...) when Gn -> ... This would complete destroy all our well thought out pattern matching optimisations that take place when compiling foo. The point of having a limited set of fixed guard tests is we can analyse these at compile time and generate an efficient matching tree. If you want to extend the control structures with your own guards and roll your own syntactic constructs use funs and simulate monads or whatever - that's what funs are for. /Joe Armstrong On Nov 27, 2007 1:36 PM, David Holz wrote: > > From: rvirding@REDACTED > > I actually defy anyone to come up with a safe, consistent and *understandable* definition of > > guards which allow user defined functions. It would also be nice if they were relatively easy > > to implement. Joe, remember our ideas with pipes? > > Hmm, how hard is it really to define? It seems to me to be exactly like C++ const propagation. There are a few things which can mutate state (process dict, message send/receive, ets et al, etc): > > - If a function calls built-in state mutators anywhere in its body, it's not pure functional. > - If a function calls any other function that isn't pure functional, it's not pure functional. > - If a function calls any M:F via variables instead of explicitly, tag it as not pure functional. (to make it easy to implement for an initial revision) > - Only pure functional functions can be called in guards. > > The only challenging part is the dynamic code loading, which has similar issues to the M:F variable situation. Inside a guard context, M:F call syntax would have to check the purity of the function it's calling, which can be cached between code loads. This is really a linking issue, though, and could be theoretically designed not to have any per-call overhead for explicitly stated m:f's. I'm not saying it's dirt simple to implement, but the idea of contagiously propagating "non-functionalness" shouldn't be difficult to define. > > I, however, would like to see a setting or switch somewhere to just remove the "is_guard_bif" checking completely, leaving it up to me to not do anything stupid, without inflicting any extra load doing runtime guard checks. I think it should be straightforward to recompile the compiler myself with "is_guard_bif(_,_) -> true." but I haven't bothered with that yet. > > _________________________________________________________________ > Share life as it happens with the new Windows Live.Download today it's FREE! > http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From oneone@REDACTED Tue Nov 27 15:10:51 2007 From: oneone@REDACTED (Andrew Arrow) Date: Tue, 27 Nov 2007 06:10:51 -0800 Subject: [erlang-questions] erl REALLY slow to startup In-Reply-To: References: <474BA3ED.1030906@lionet.info> <009701c830c2$ca6f0040$fc00a8c0@nemesis> Message-ID: that was it! thanks. I had a bad hostname in /etc/hostconfig. I changed it to localhost and now erl starts up quick. On Nov 26, 2007 10:57 PM > This reminds me of problems I used to have with (non erlang) software that > would perform dns queries at start. > sometimes connecting to a machine would cause big delays, because it would > wait for dnd replies that never came. > Ive had it with misconfigured hostnames, and misconfigured dns. > > if you take your net interface down (or remove your dns servers) does it > still take a long time to start? From psa@REDACTED Tue Nov 27 15:46:06 2007 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Tue, 27 Nov 2007 14:46:06 +0000 Subject: [erlang-questions] valid gen_fsm timeout values In-Reply-To: <20071109165631.GT21717@delora.autosys.us> References: <20071109165631.GT21717@delora.autosys.us> Message-ID: <474C2DAE.3030504@di.uminho.pt> Hi all, I noticed all over the gen_fsm documentation that timeouts must be greater than 0. E.g. Return = {ok,StateName,StateData} | {ok,StateName,StateData,Timeout} Timeout = int()>0 | infinity Considering that a timeout results in a receive ... after Timeout ... end is there any reason for 0 being an invalid timeout or is it just an error in the documentation that should be corrected? A 0 timeout can be useful to express "continue doing something unless some event has occurred". Regards, psa From zubac@REDACTED Mon Nov 26 12:55:46 2007 From: zubac@REDACTED (Dragan Zubac) Date: Mon, 26 Nov 2007 12:55:46 +0100 Subject: [erlang-questions] PostgreSQL driver Message-ID: <474AB442.4020802@vlayko.tv> Hello Anybody have some experience with using any PostgreSQL driver for Erlang in production environment ? As far as I know,there's one from process-net and second from Jungerl project. Did anybody used any of them or some other (ODBC ?) for any production Erlang application ? Basically,I'd like to know it's stability in production enviroment. There's no need for some special SQL commands or whatsoever,just plain 'select','update',insert' and stuff like that,all returning known kind of OIDs to driver itself. Sincerely Dragan Zubac From alex.arnon@REDACTED Tue Nov 27 16:33:50 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Tue, 27 Nov 2007 17:33:50 +0200 Subject: [erlang-questions] CRC-32. In-Reply-To: <474C0959.4080604@erix.ericsson.se> References: <944da41d0711270319g7a379d6ase99bb2fd1dd56dca@mail.gmail.com> <474C0959.4080604@erix.ericsson.se> Message-ID: <944da41d0711270733r4ba9277p38c6c7b397e55060@mail.gmail.com> By the docs' references and looking at the source code in R12, it seems that it is indeed the 802.3 CRC-32. Excellent :) On Nov 27, 2007 2:11 PM, Dan Gudmundsson wrote: > It's the crc32 from zlib, don't know if it's 802.3, guess you can find > more info in the doc at http://www.zlib.net/ > > /Dan > > Alex Arnon wrote: > > Hi List, > > > > I'm building a simple protocol over TCP, which requires a 32 bit > > CRC/hash in one of the message fields. I have decided on CRC-32. > > Now, there are several types of CRC-32, where the polynomial changes. I > > would _like_ to use the IEEE 802.3 variant. So, questions: > > - Is the CRC32 in zlib the IEEE 802.3 variant? > > - If not, is there a commonly available port driver? > > > > Thanks in advance, > > Alex. > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zerthurd@REDACTED Tue Nov 27 17:31:57 2007 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 27 Nov 2007 22:31:57 +0600 Subject: [erlang-questions] megaco_user pattern definition Message-ID: Hello I have see megaco library in OTP, and found -behaviour(megaco_user) in some modules. Where I can find definition of this pattern? There is no such file megaco_user.erl with -module(megaco_user). From chsu79@REDACTED Tue Nov 27 17:23:33 2007 From: chsu79@REDACTED (Christian S) Date: Tue, 27 Nov 2007 17:23:33 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <474AB442.4020802@vlayko.tv> References: <474AB442.4020802@vlayko.tv> Message-ID: The postgres driver in jungerl has no test suite that one use to verify how good it is. I think process one uses their postgres driver as an optional db backend in jabberd so it should have some more widespread production use, but im guessing. The best you can do is to write a testsuite and contribute. It increases the chance that future development does not break your usage patterns. 2007/11/26, Dragan Zubac : > Hello > > Anybody have some experience with using any PostgreSQL driver for Erlang > in production environment ? As far as I know,there's one from > process-net and second from Jungerl project. Did anybody used any of > them or some other (ODBC ?) for any production Erlang application ? > > Basically,I'd like to know it's stability in production enviroment. > There's no need for some special SQL commands or whatsoever,just plain > 'select','update',insert' and stuff like that,all returning known kind > of OIDs to driver itself. > > Sincerely > > Dragan Zubac > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From david.hopwood@REDACTED Tue Nov 27 17:50:17 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Tue, 27 Nov 2007 16:50:17 +0000 Subject: [erlang-questions] Message queue reflection (was: My biggest beef with Erlang) In-Reply-To: <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> Message-ID: <474C4AC9.6030304@industrial-designers.co.uk> Joe Armstrong wrote: > Now you mentioned receive it occurred to me that it would be rather nice to > receive a fun in Erlang. Unfortunately receive has only one syntactic form > > receive > pattern1 -> action1; > ... > end. > > In the spirit of funs it would be very nice to say: > > F = fun(Pattern1) -> Actions1 > (Pattern2) -> Actions2 > after Time -> Actions > end, > ... > receive(Fun) > > This would make writing an erlang meta interpreter much easier > and allow all kinds of mischief The missing feature that is needed to implement this (and lots of other useful things) is the ability to reflect on a process' message queue. That is, to iterate through messages in a process' queue without removing them, and then to remove a given message (rather than just the first message that matches a statically determined pattern). -- David Hopwood From lcastro@REDACTED Tue Nov 27 17:58:51 2007 From: lcastro@REDACTED (Laura M. Castro Souto) Date: Tue, 27 Nov 2007 17:58:51 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <474AB442.4020802@vlayko.tv> References: <474AB442.4020802@vlayko.tv> Message-ID: <200711271758.52038.lcastro@udc.es> Hello, > Anybody have some experience with using any PostgreSQL driver for Erlang > in production environment ? We have been using Erlang + ODBC + PostgreSQL in production environment for almost three years now. Our application is quite database-intensive. To give you an idea, a gzipped dump database file is 18MB right now, 180MB uncompressed, almost 3 million rows. We had some efficiency and performance issues at the beginning, and had to un-normalize some of the tables. We do have complex relationships between entities that force us to work with joins and subselects rather often, though. Still, after taking care of that, the application has been working perfectly ever since (at least with regard to the database :-D). Regards, -- Laura M. Castro From huss01@REDACTED Tue Nov 27 20:30:47 2007 From: huss01@REDACTED (=?ISO-8859-1?Q?H=E5kan_Huss?=) Date: Tue, 27 Nov 2007 20:30:47 +0100 Subject: [erlang-questions] What is the function be defined as BIF? In-Reply-To: <75E94CA5D5FC46EAA3BE73AD10A4D815@lukeserver> References: <75E94CA5D5FC46EAA3BE73AD10A4D815@lukeserver> Message-ID: On Nov 27, 2007 8:17 AM, LUKE wrote: > > > I found that i lose some word in the code. > > start(Name,Mod)->register(Name,spawn(fun()->loop(Name,Mod,Mod:init()) end)). > > But > > Why the code can be compile? > > start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) > end)). > It can be compiled, but it will cause an undef-exception when run. The reason is that in the first case, the compiler catches the error since register must either be a local function or a BIF. Since there is no local function register/1, and no BIF register/1, the compiler complains. In the second case, the compiler cannot know what functions are exported from the erlang module. Thus, the call to erlang:register/1 is accepted, and it is only when it is performed that we can know whether it actually exists. Regards, /H?kan > > > > ----- Original Message ----- > From: LUKE > To: erlang-questions@REDACTED > Sent: Tuesday, November 27, 2007 2:50 PM > Subject: What is the function be defined as BIF? > > > -module(genserver). > -export([start/2,rpc/2]). > > start(Name,Mod)->register(spawn(fun()->loop(Name,Mod,Mod:init()) end)). > .... > > Eshell V5.5.5 (abort with ^G) > ... > 9>c(genserver). > ./genserver.erl:4: function register/1 undefined > > -- > modify the register to erlang:register > start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) > end)). > -- > > 10> c(genserver). > {ok,genserver} > > The register function is BIF ? > And the spawn function is BIF? > All of erlang:* is BIF? > When we need specify a prefix erlang:* ? > Why the most of example does not using erlang:register? > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mateuszb@REDACTED Tue Nov 27 21:27:49 2007 From: mateuszb@REDACTED (Mateusz Berezecki) Date: Tue, 27 Nov 2007 21:27:49 +0100 Subject: [erlang-questions] how: running erlans as daemon... In-Reply-To: <9b08084c0711270525j1af16bb7qa44a6d8e9dcf6626@mail.gmail.com> References: <0CEECA2E-E364-4BC3-BB9B-7D946978B464@gmail.com> <9b08084c0711270525j1af16bb7qa44a6d8e9dcf6626@mail.gmail.com> Message-ID: <8C60086E-E307-4648-9478-64531D848260@gmail.com> On Nov 27, 2007, at 2:25 PM, Joe Armstrong wrote: > There are many ways to do this > > One way is described in: > > http://www.sics.se/~joe/tutorials/web_server/web_server.html#m2 > > This shows how to setup a sytem daemon using -heart and -detached > together with the necessary > stuff in /etc/rc.d/rc.local > > Hope this helps It was precisely what I was looking for. Thank you very much! I'd also like to thank everyone sharing their answers. Mateusz From lemenkov@REDACTED Tue Nov 27 22:40:26 2007 From: lemenkov@REDACTED (Peter Lemenkov) Date: Wed, 28 Nov 2007 00:40:26 +0300 Subject: [erlang-questions] ODBC, PL/SQL and variable bindings Message-ID: Hello All! We use odbc interface with unixODBC driver for Oracle in production for about 18 months w/o complains but only for very easy queries (select something from sometable where someparams etc). Not so long ago we faced one problem - executing of PL/SQL blocks with binding variables for input and output. During quick googling via mail list archive I found that this feature still unimplemented (still?) for some architectural reasons. Ok, can someone help me - are any ways to bind variables in odbc? Or maybe there are some recommended way to walk around of such issues. Just for example - one of my troublemakers, PL/SQL block. ==================== begin :result :=ipport.pack_sys.PReport(:p_error_type, :p_error_code, :p_error_object, :p_error_text, :p_error_mail_it); end; ==================== I need to bind all variables (Result, ErrorType, ErrorCode, ErrorObject, ErrorText, ErrorMailIt) to respective variables. Although in this example it's very easy to rework to avoid using PL/SQL completely, there are others there we shouldn't do that because of possible SQL injections and so on. So I'm stuck with this difficulty. Any ideas? -- With best regards! From ulf@REDACTED Tue Nov 27 23:00:38 2007 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 27 Nov 2007 23:00:38 +0100 Subject: [erlang-questions] how: distributed supervision tree In-Reply-To: <13941497.post@talk.nabble.com> References: <13941497.post@talk.nabble.com> Message-ID: <8209f740711271400m6c9ad4bfn531a6ab6fadc54c8@mail.gmail.com> I would guess that what you're attempting to do is rather unusual. While the supervisor behaviour doesn't stop you from spawning a remote process, and it's quite possible to monitor a remote pid. The problems occur, as you note, when the process is to be restarted. It's not certain that the supervisor can do what it takes to start the process (e.g. if the remote node is down), and the supervisor is not designed to take these problems into account. It is more commonplace to use the distributed application controller for redundancy logic, keeping the supervision trees together on each node. BR, Ulf W 2007/11/26, Zvi : > > The supervision strategy data structure is a list of tuples for each worker. > The Worker specifications are tuples of the following form: > > {Tag, {Mod, Func, ArgList}, > Restart, > Shutdown, > Type, > [Mod1]} > > Where: > {Mod, Func, ArgList} > defines the function that the supervisor will use to start the worker. It is > used as arguments to apply(Mod, Fun, ArgList). > > How do I define worker process, which should be started/restarted on remote > node? > Should I just write Mod:Fun function which calls spawn/2 ,i.e. > spawn(Node,Fun) ? > What happens if BEAM VM on node "Node" is down? Should Mod:Fun first call to > some shell script to lanch VM on the remote node and only then spawn > Worker's Erlang proces on it? > > Anybody has example? > > Thanks in Advance > Zvi > > > > > > -- > View this message in context: http://www.nabble.com/how%3A-distributed-supervision-tree-tf4872110.html#a13941497 > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jeffm@REDACTED Tue Nov 27 23:20:59 2007 From: jeffm@REDACTED (jm) Date: Wed, 28 Nov 2007 09:20:59 +1100 Subject: [erlang-questions] how: cascading events in gen_fsm Message-ID: <474C984B.7010602@ghostgun.com> The problem: I'm using gen_fsm to model a network protocol based on messages. For the most part the messages are <>, except for a few special cases in the initial handshake. The messages are sent over TCP, but there is no guarantee that a complete message or only one message will arrive in a packet. To get around this a queue is mantained as part of the state record, -record(state, { queue .... }). which is used to hold the bytes recieved but are yet to be processed. When there are bytes remaining after processing the current state the remainder is placed on the queue and gen_fsm:send_event(self(), {msg, <<>>}), {next_state, new_state, State#{queue = Remainder}}. is executed to cause the gen_fsm process to jump to the next state and continue processing. Two questions, 1) Can anyone see a problem doing it this way (race conditions, etc)? 2) Is there a better way to cascade states with gen_fsm? Jeff. From vlm@REDACTED Tue Nov 27 23:52:53 2007 From: vlm@REDACTED (Lev Walkin) Date: Tue, 27 Nov 2007 14:52:53 -0800 Subject: [erlang-questions] how: cascading events in gen_fsm In-Reply-To: <474C984B.7010602@ghostgun.com> References: <474C984B.7010602@ghostgun.com> Message-ID: <474C9FC5.9030006@lionet.info> Hate special cases... Can you switch to a known-length-size-header processing after dealing with a header? From `erl -man inet`: {packet, PacketType} (TCP/IP sockets): Defines the type of packets to use for a socket. The fol- lowing values are valid: 1 | 2 | 4: Packets consist of a header specifying the number of bytes in the packet, followed by that number of bytes. The length of header can be one, two, or four bytes; the order of the bytes is big-endian. Each send operation will generate the header, and the header will be stripped off on each receive opera- tion. jm wrote: > The problem: I'm using gen_fsm to model a network protocol based on > messages. For the most part the messages are < message:runlength/binary>>, except for a few special cases in the > initial handshake. The messages are sent over TCP, but there is no > guarantee that a complete message or only one message will arrive in a > packet. To get around this a queue is mantained as part of the state record, > > -record(state, { > queue > .... > }). > > > which is used to hold the bytes recieved but are yet to be processed. > When there are bytes remaining after processing the current state the > remainder is placed on the queue and > > gen_fsm:send_event(self(), {msg, <<>>}), > {next_state, new_state, State#{queue = Remainder}}. > > is executed to cause the gen_fsm process to jump to the next state and > continue processing. Two questions, > > 1) Can anyone see a problem doing it this way (race conditions, etc)? > 2) Is there a better way to cascade states with gen_fsm? > > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf@REDACTED Tue Nov 27 23:54:38 2007 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 27 Nov 2007 23:54:38 +0100 Subject: [erlang-questions] idea: ml9 (sort of) in the erlang shell In-Reply-To: <8209f740711231450r3485484byb98c6d4ab87872ad@mail.gmail.com> References: <8209f740711130752w4c69ff99xe11b82926657a9d8@mail.gmail.com> <8209f740711210708q79561da9g108c6a7a4d57bfe2@mail.gmail.com> <944da41d0711220835x5e22f475pf6916c31b624b465@mail.gmail.com> <8209f740711221404h4cb4a4f6ye957a18fcee4dd55@mail.gmail.com> <8209f740711221414q72bb3e46y5728dca5da0603b6@mail.gmail.com> <944da41d0711231322w53bd8da7i4a26213fadcd859d@mail.gmail.com> <8209f740711231450r3485484byb98c6d4ab87872ad@mail.gmail.com> Message-ID: <8209f740711271454h3ef1170bye0b8162d968d1eba@mail.gmail.com> I've committed some R12B for the extended shell: svn co http://svn.ulf.wiger.net/ext_shell/branches/r12b My testing has been limited, and if the code fails, it probably won't live up to the new error reporting standards set by R12. (: But, please, give it a whirl and let me know what you find. BR, Ulf W 2007/11/23, Ulf Wiger : > I took a quick look at the R12B versions of shell.erl, epp.erl and > io_lib_pretty.erl, and they have all been changed quite a lot, so > patching may take some time... > > BR, > Ulf W > > 2007/11/23, Alex Arnon : > > Thanks. This is very interesting. > > I'll try this out, and try to find time to make a patch and apply it > > to an R12 snapshot. > > > > On Nov 23, 2007 12:14 AM, Ulf Wiger wrote: > > > Oh, I should also mention that I've tried to make the changes as > > > safe as possible. The extended shell handling is actually triggered > > > as an evaluated command, like this: > > > > > > {[{call,_,{atom,_,raw_exprs}, > > > [AbstEnv, AbstText]}],_V,_CommandN} > > > > > > The raw_exprs/2 function is then evaluated (and can be blocked in the > > > restricted shell), so if there are bugs in the code that follows, it's > > > similar to a normal crash in evaluated code. It doesn't kill the whole > > > shell. > > > > > > The error handling for the output filters can and should be improved. > > > Right now, a badly written filter can cause the shell to terminate. > > > It should be a rather easy fix, once one decides what /should/ happen > > > when an output filter crashes. > > > > > > BR, > > > Ulf W > > > > > > 2007/11/22, Ulf Wiger : > > > > > > > Hmm, at least not tonight, but the full modules are available at > > > > svn co http://svn.ulf.wiger.net/ext_shell/trunk/ext_shell/src/ > > > > > > > > (You can fetch them using any browser if you don't have subversion) > > > > > > > > They are based on R11B. > > > > > > > > BR, > > > > Ulf W > > > > > > > > 2007/11/22, Alex Arnon : > > > > > Hi Ulf, > > > > > > > > > > This looks like fantastic stuff! > > > > > Can you provide the code as a patch to the standard distribution? > > > > > (R11B5 or R12's snapshot?) > > > > > > > > > > > > > > > On Nov 21, 2007 5:08 PM, Ulf Wiger wrote: > > > > > > I've now written two blog articles on the subject. > > > > > > > > > > > > http://ulf.wiger.net/weblog/?p=8 > > > > > > http://ulf.wiger.net/weblog/?p=9 > > > > > > > > > > > > The code is also available at http://svn.ulf.wiger.net/ext_shell/trunk > > > > > > > > > > > > > > > > > > BR, > > > > > > Ulf W > > > > > > _______________________________________________ > > > > > > erlang-questions mailing list > > > > > > erlang-questions@REDACTED > > > > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > > > > > > > > > From eajam@REDACTED Mon Nov 26 22:55:41 2007 From: eajam@REDACTED (Alex Alvarez) Date: Mon, 26 Nov 2007 21:55:41 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <3dbc6d1c0711261336p63f8c173o5f5bb71d8a20b4a0@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <3dbc6d1c0711261336p63f8c173o5f5bb71d8a20b4a0@mail.gmail.com> Message-ID: Maybe I'm missing something here, but isn't this exactly like Erlang? (mod:func ... ) == mod:func(...) (apply mod 'func ( ... )) == apply(mod, func, ...)Obviously, the syntax changes a little bit, but all the functionality is there already. Actually, Erlang looks a lot cleaner from my view...Cheers, Alex Date: Mon, 26 Nov 2007 22:36:48 +0100From: rvirding@REDACTED: chsu79@REDACTED: erlang-questions@REDACTED: Re: [erlang-questions] My biggest beef with ErlangOn 26/11/2007, Robert Virding wrote: Scheme allows defining a prefix within the a symbol which means it refers to another module (library for them) so you would write:(mod:func ... )when you know where to go at compiletime. At least that's how I interpreted the spec. Then for the general case you could use: (apply mod 'func ( ... ))or how about:(: mod func arg1 arg2 ... )for all cases? Equivalent to funcall in CL, this would be a remote funcall. Again a bit heavy for the standard case. Of course some mailers might see that as a smiley. :-)Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Wed Nov 28 00:35:01 2007 From: jeffm@REDACTED (jm) Date: Wed, 28 Nov 2007 10:35:01 +1100 Subject: [erlang-questions] how: cascading events in gen_fsm In-Reply-To: <474C9FC5.9030006@lionet.info> References: <474C984B.7010602@ghostgun.com> <474C9FC5.9030006@lionet.info> Message-ID: <474CA9A5.5090500@ghostgun.com> Lev Walkin wrote: > > Hate special cases... > > Can you switch to a known-length-size-header processing after > dealing with a header? > > From `erl -man inet`: > > {packet, PacketType} (TCP/IP sockets): > Defines the type of packets to use for a socket. The fol- > lowing values are valid: > > 1 | 2 | 4: > Packets consist of a header specifying the number of > bytes in the packet, followed by that number of > bytes. The length of header can be one, two, or four > bytes; the order of the bytes is big-endian. Each > send operation will generate the header, and the > header will be stripped off on each receive opera- > tion. > Nice idea hadn't thought of that and I hate to throw a spanner in the works but one of the messages I've witnessed was 16KB length. Because I'm snooping on the traffic as part of a proxy this could result in large amounts of jitter and the timing out of sockets. thanks anyway, Jeff. From vlm@REDACTED Wed Nov 28 01:45:59 2007 From: vlm@REDACTED (Lev Walkin) Date: Tue, 27 Nov 2007 16:45:59 -0800 Subject: [erlang-questions] how: cascading events in gen_fsm In-Reply-To: <474CA9A5.5090500@ghostgun.com> References: <474C984B.7010602@ghostgun.com> <474C9FC5.9030006@lionet.info> <474CA9A5.5090500@ghostgun.com> Message-ID: <474CBA47.6080403@lionet.info> jm wrote: > Lev Walkin wrote: >> Hate special cases... >> >> Can you switch to a known-length-size-header processing after >> dealing with a header? >> >> From `erl -man inet`: >> >> {packet, PacketType} (TCP/IP sockets): >> Defines the type of packets to use for a socket. The fol- >> lowing values are valid: >> >> 1 | 2 | 4: >> Packets consist of a header specifying the number of >> bytes in the packet, followed by that number of >> bytes. The length of header can be one, two, or four >> bytes; the order of the bytes is big-endian. Each >> send operation will generate the header, and the >> header will be stripped off on each receive opera- >> tion. >> > > Nice idea hadn't thought of that and I hate to throw a spanner in the > works but one of the messages I've witnessed was 16KB length. Because > I'm snooping on the traffic as part of a proxy this could result in > large amounts of jitter and the timing out of sockets. What's the problem with 16KB message? From exta7@REDACTED Wed Nov 28 02:29:52 2007 From: exta7@REDACTED (Zvi) Date: Tue, 27 Nov 2007 17:29:52 -0800 (PST) Subject: [erlang-questions] how: distributed supervision tree In-Reply-To: <8209f740711271400m6c9ad4bfn531a6ab6fadc54c8@mail.gmail.com> References: <13941497.post@talk.nabble.com> <8209f740711271400m6c9ad4bfn531a6ab6fadc54c8@mail.gmail.com> Message-ID: <13983949.post@talk.nabble.com> Ulf, So what you suggesting, is to use "forest" of the single-node supervision "trees". Then the "forester" or "woodward" will monitor, and start/restart/shut the top-level supervisor in each "tree". Such a "forester" can't use Erlang's built-in trap-exit/process linking mechanism and should reimplement distributed version of it. Thanks, Zvi Ulf Wiger wrote: > > I would guess that what you're attempting to do is rather unusual. > While the supervisor behaviour doesn't stop you from spawning > a remote process, and it's quite possible to monitor a remote pid. > > The problems occur, as you note, when the process is to be > restarted. It's not certain that the supervisor can do what it takes > to start the process (e.g. if the remote node is down), and the > supervisor is not designed to take these problems into account. > > It is more commonplace to use the distributed application controller > for redundancy logic, keeping the supervision trees together on each > node. > > BR, > Ulf W > > > 2007/11/26, Zvi : >> >> The supervision strategy data structure is a list of tuples for each >> worker. >> The Worker specifications are tuples of the following form: >> >> {Tag, {Mod, Func, ArgList}, >> Restart, >> Shutdown, >> Type, >> [Mod1]} >> >> Where: >> {Mod, Func, ArgList} >> defines the function that the supervisor will use to start the worker. It >> is >> used as arguments to apply(Mod, Fun, ArgList). >> >> How do I define worker process, which should be started/restarted on >> remote >> node? >> Should I just write Mod:Fun function which calls spawn/2 ,i.e. >> spawn(Node,Fun) ? >> What happens if BEAM VM on node "Node" is down? Should Mod:Fun first call >> to >> some shell script to lanch VM on the remote node and only then spawn >> Worker's Erlang proces on it? >> >> Anybody has example? >> >> Thanks in Advance >> Zvi >> >> >> >> >> >> -- >> View this message in context: >> http://www.nabble.com/how%3A-distributed-supervision-tree-tf4872110.html#a13941497 >> Sent from the Erlang Questions mailing list archive at Nabble.com. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/how%3A-distributed-supervision-tree-tf4872110.html#a13983949 Sent from the Erlang Questions mailing list archive at Nabble.com. From gbulmer@REDACTED Wed Nov 28 03:23:48 2007 From: gbulmer@REDACTED (G Bulmer) Date: Wed, 28 Nov 2007 09:23:48 +0700 Subject: [erlang-questions] Erlang vs Clojure Message-ID: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> A small point about JVM concurrency performance. I had the pleasure of talking to James Gosling one to one, for a couple of hours, about three years ago, in Bangalore. He was presenting a talk about his current and on-going work on Java. He said he spent much of his time on strategic Java projects. He very excited about a research JVM which was being built and tested for use in hard realtime, the project he talked about as specifically for process control in a power plant. Anyway, in his initial presentation (after which we chatted) he showed stats from the research JVM that indicated good support for many thousands of threads (I accept, still well behind the Erlang VM, but I'd need more detail to judge how far behind) with interrupt response times with a jitter of less than 4 micro-seconds (I am sure this was at least response to timer events, and may have been to other interrupt sources). I am certain I asked about garbage collection, and he said that the 4 micro-seconds was not an overall average, but was 'realtime', and it included garbage collection. I don't recall many more details other than the company involved in the process control project (who I feel I should not disclose as he was tired, jet lagged, home sick for his kids, and maybe a little tipsy). Anyway, I don't assume that the normally resource-expensive JVM approach to threads is the only practical solution. There is likely significant investment in fixing some of those Java problems. GB PS - I apologise that I haven't followed it up. I remember at the time feeling I should not expect to see anything for a year or more. I may try digging some time next week (when I return from my lovely Thai holiday, the weather is beautiful here, much warmer than Stockholm EUC, and booze and food are cheaper too :-) > Date: Mon, 26 Nov 2007 09:43:18 +0000 > From: Charles Forsyth > Subject: Re: [erlang-questions] Erlang vs Clojure >> The thought of running on the JVM makes me feel both sick and >> bloated...but strangely I am warming up to the idea. >> > > >> The ErlangVM enables distributed concurrency, Closure on the JVM is >> optimizing for local concurrency. >> > > >> Granted that I am not building fault tolerant telecom switches, >> but in >> my case, massive local concurrency might be all that I need. With >> > > if you expect to get high-performance concurrency from a JVM > i expect you to be disappointed. the Erlang implementation > guarantees cheap processes everywhere it exists. by contrast, > you get whatever your particular JVM gives you, which might not > be much, and it will vary from platform to platform. > if it works for you, though ... > i'd be particularly interested if you find JVMs that > offer ``massive local concurrency''. > From jeffm@REDACTED Wed Nov 28 03:08:01 2007 From: jeffm@REDACTED (jm) Date: Wed, 28 Nov 2007 13:08:01 +1100 Subject: [erlang-questions] how: cascading events in gen_fsm In-Reply-To: <474CBA47.6080403@lionet.info> References: <474C984B.7010602@ghostgun.com> <474C9FC5.9030006@lionet.info> <474CA9A5.5090500@ghostgun.com> <474CBA47.6080403@lionet.info> Message-ID: <474CCD81.8040108@ghostgun.com> Lev Walkin wrote: > What's the problem with 16KB message? I suspect slow WAN links could be a problem, but I'll have to test and see. The original question I thought I was asking was about those "special case" caused be the non-uniform message format in the opening hand shake as this is where I'm attempting to cascade states and is causing me to do the buffering. This is the fun part of asking questions on a mailing list you get answers to questions you didn't even realise you were asking :-). It's now time for me to get back to coding. Jeff. From matthew@REDACTED Wed Nov 28 03:46:20 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 27 Nov 2007 18:46:20 -0800 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <9b08084c0711251232s7731feeem116c8d1c95bb6462@mail.gmail.com> References: <149017.87260.qm@web38807.mail.mud.yahoo.com> <9b08084c0711250857j70b2f7besc8368c5cd7386279@mail.gmail.com> <95be1d3b0711251137h37ab6b48p89d4b7171bde2b85@mail.gmail.com> <9b08084c0711251232s7731feeem116c8d1c95bb6462@mail.gmail.com> Message-ID: On 11/25/07, Joe Armstrong wrote: > -compile({character_transform, Mod}). > -compile({tokenezer, Mod}). I dislike these proposals, because they necessitate tokenizing and parsing the .erl file (at least partially), extracting the -compile attributes, and then re-tokenizing and re-parsing the file. The compiler does expose compile:forms/1 and compile:forms/2 functions for people who want to use other front-ends. From ok@REDACTED Wed Nov 28 06:02:09 2007 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 28 Nov 2007 18:02:09 +1300 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> Message-ID: <295884D8-18DD-4941-937C-2DAA04F4FCF9@cs.otago.ac.nz> On 27 Nov 2007, at 10:32 am, Robert Virding wrote: > Scheme allows defining a prefix within the a symbol which means it > refers to another module (library for them) so you would write: There is no such thing as a module in Scheme (up to R5RS; they were planning a module system for R6RS but I haven't kept up with that) and Scheme (again, up to R5RS) attaches no special significance to colons. That's Common Lisp. Note that Common Lisp doesn't put *functions* in modules, it puts *symbols* (atoms) in packages. Package prefix "syntax" in Common Lisp is entirely lexical, there is no such thing as ((find-a-module):some- function ...) in that form. (You can do it, you just can't do it using colons.) From thomaswhitcomb@REDACTED Wed Nov 28 05:33:16 2007 From: thomaswhitcomb@REDACTED (Tom Whitcomb) Date: Tue, 27 Nov 2007 20:33:16 -0800 (PST) Subject: [erlang-questions] separating application from gen server Message-ID: <321126.9350.qm@web42106.mail.mud.yahoo.com> Hi, I want to use application:get_env in my gen_server but it feels wrong to create a dependency between my gen_server and a specific application. Is there a recommended way for a gen_server to receive and reference the application that contains it? What if I do something like below which passes the application name from the .app to a start_link/1 to the init/1 in the gen_server? Thanks for any recommendations. Tom % .app % ---- {application, my_app, [{mod, {my_app,[my_app]}}]}. % my application % -------------- -module(my_app). -behavior(application). start(Type,Args) -> my_server:start_link(Args). stop(_State) -> ok. % my gen server % ------------- -module(my_server). -behavior(gen_server). start_link(Args) -> gen_server:start_link({local,?MODULE},?MODULE,Args,[]). stop() -> gen_server:stop(?MODULE). init([App]) -> application:get_env(App). From bengt.kleberg@REDACTED Wed Nov 28 08:56:49 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 28 Nov 2007 08:56:49 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <295884D8-18DD-4941-937C-2DAA04F4FCF9@cs.otago.ac.nz> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <295884D8-18DD-4941-937C-2DAA04F4FCF9@cs.otago.ac.nz> Message-ID: <474D1F41.9090007@ericsson.com> greetings, R6RS is available at http://www.r6rs.org . i think it includes a module system hidden under the heading ''libraries''. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/28/07 06:02, Richard A. O'Keefe wrote: > On 27 Nov 2007, at 10:32 am, Robert Virding wrote: >> Scheme allows defining a prefix within the a symbol which means it >> refers to another module (library for them) so you would write: > > There is no such thing as a module in Scheme (up to R5RS; they were > planning > a module system for R6RS but I haven't kept up with that) and Scheme > (again, > up to R5RS) attaches no special significance to colons. > > That's Common Lisp. > > Note that Common Lisp doesn't put *functions* in modules, it puts > *symbols* (atoms) in packages. Package prefix "syntax" in Common > Lisp is > entirely lexical, there is no such thing as ((find-a-module):some- > function ...) > in that form. (You can do it, you just can't do it using colons.) > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Wed Nov 28 09:10:39 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 28 Nov 2007 09:10:39 +0100 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <310035.59131.qm@web60520.mail.yahoo.com> References: <310035.59131.qm@web60520.mail.yahoo.com> Message-ID: <474D227F.2040805@ericsson.com> greetings, just a clarification: my idea was for the shootout responsible/comitters to allow me to do more work for the shootout. not that the shootout responsible/comitters should do the work for me. i think we all agree on this, but i only wanted to make it perfectly clear. however, at this time i really would like for you, Isaac Gouy, to do more work when it comes to answering emails in this thread. it is not pressing, take your time, but i have one outstanding question that i would appreciate if you answered so that i may move on with the rest. i have decided to limit the number of items (questions/statements) to 1 per post since otherwise the ones i regard as interesting gets ignored. in their place new ones spring up and propagate to such an extent that i loose track of the original thread. sorry about this, but i hope that quality comes before quantity for all parties interested in this discussion. the outstanding question is included below. i eagerly await your answer. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/26/07 20:05, Isaac Gouy wrote: > --- David Hopwood wrote: > > -snip- >> As for the 'shootout', most of the criticisms of it in this thread >> have been valid; it's not a very good basis for comparison of > language >> performance. > > Puzzled. > > afaict most of the comments in this thread have been about benchmarks > in general and not about the benchmarks game in particular, so the way > you state your opinion is uninformative. > > And Bengt Kleberg's "criticism" is more of a complaint that we should > do more. > > > ____________________________________________________________________________________ > Get easy, one-click access to your favorites. > Make Yahoo! your homepage. > http://www.yahoo.com/r/hs > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An embedded message was scrubbed... From: Bengt Kleberg Subject: Re: [erlang-questions] benchmarks game harsh criticism (was Learning Erlang from the scratch) Date: Mon, 26 Nov 2007 08:18:00 +0100 Size: 1044 URL: From bjgoods@REDACTED Wed Nov 28 09:10:42 2007 From: bjgoods@REDACTED (fan li) Date: Wed, 28 Nov 2007 09:10:42 +0100 Subject: [erlang-questions] Hello,I have a question about erlang In-Reply-To: <66066c7f0711271642k19d39897l81dcd2ed4fa7085e@mail.gmail.com> References: <66066c7f0711261719u44fcabfcged0c88a13baa6033@mail.gmail.com> <20071127084735.GA22754@erix.ericsson.se> <66066c7f0711271642k19d39897l81dcd2ed4fa7085e@mail.gmail.com> Message-ID: <20071128081041.GA20755@erix.ericsson.se> To Fan Li: I have now tried to submit your question to erlang-questions@REDACTED To erlang-questions: The guy apparently has got a broken R11B-5 installation. Any clues anyoune? On Wed, Nov 28, 2007 at 08:42:26AM +0800, fan li wrote: > hello > my erlang version is 5.5.5 > now error is still there.Every code is not compiles. > > Eshell V5.5.5 (abort with ^G) > 1> c(counter). > ./counter.erl:none: internal error in lint_module; > crash reason: {undef,[{sets,to_list,[[]]}, > {erl_lint,check_unused_records,2}, > {erl_lint,module,3}, > {compile,lint_module,1}, > {compile,'-internal_comp/4-anonymous-1-',2}, > {compile,fold_comp,3}, > {compile,internal_comp,4}, > {compile,internal,3}]} > error > > > > > 2007/11/27, Raimo Niskanen : > > > > Hello. > > > > I am afraid you have sent your question to the list owner (me) and > > not to the list. Try resending your message to: > > erlang-questions@REDACTED > > > > Please supply exact version of your erlang installation, > > for example the shell startup prompt, because I see > > nothing wrong with your code, and it compiles with > > R11B-5 only giving a warning: > > ./counter.erl:23: Warning: variable 'Other' is unused > > > > You also have mis-spelled increment as "increament" > > (intentionally?), your stop function sends {self(),stop} > > but receives 'stop', so it is broken. > > > > Other than that the lint error you see is an internal error > > that should not happen, and it does not happen for me > > so the list will need exact erlang version... > > > > > > > > On Tue, Nov 27, 2007 at 09:19:57AM +0800, fan li wrote: > > > hi > > > I have a question. > > > code : > > > > > > -module(counter). > > > -compile(export_all). > > > start()->spawn(counter, loop,[0]). > > > increment(Counter)-> > > > Counter!increament. > > > value(Counter)-> > > > Counter!{self(),value}, > > > receive > > > {Counter,Value}-> > > > Value > > > end. > > > stop(Counter)-> > > > Counter!{self(),stop}. > > > loop(Val)-> > > > receive > > > increament-> > > > loop(Val+1); > > > {From,value}-> > > > From!{self(),Val}, > > > loop(Val); > > > stop-> > > > true; > > > Other-> > > > loop(Val) > > > end. > > > > > > > > > result: > > > ./encode.erl:none: internal error in lint_module; > > > crash reason: {undef,[{sets,to_list,[[]]}, > > > {erl_lint,check_unused_records,2}, > > > {erl_lint,module,3}, > > > {compile,lint_module,1}, > > > {compile,'-internal_comp/4-anonymous-1-',2}, > > > {compile,fold_comp,3}, > > > {compile,internal_comp,4}, > > > {compile,internal,3}]} > > > error > > > > > > what wrong? > > > > > > thanks a lot! > > > > > > > > > > > > fan li > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From torben.lehoff@REDACTED Wed Nov 28 09:12:58 2007 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Wed, 28 Nov 2007 09:12:58 +0100 Subject: [erlang-questions] how: instatiate a parameterized ASN.1 type In-Reply-To: <47429770.8010209@ericsson.com> References: <47429770.8010209@ericsson.com> Message-ID: Hi all. Bertil has helped me out a bit off the mailing list and we have found a small bug in the asn1ct compiler that he will be looking into. Unfortunately I am under too much deadline pressure to wait for the fix - that's life working on a prototype - so I will implement the codec I need by hand. It is not too hard to do, mostly tedious. Cheers, Torben On Nov 20, 2007 9:14 AM, Bertil Karlsson wrote: > Hi, > > The first parameter of the ROS type must be an ASN1-valueset, the second > and third must be ASN1-objectset parameters. The asn1- compiler lacks > some features in the area of Parameterized Types and Information Objects > that we may extend in a future release. > > /Bertil Karlsson > > Torben Hoffmann wrote: > > The cross-posting from the trapexit forum does not seem to work, so I > > apologise for the duplication... > > > > I have managed to implement my own instance (called tetraIsiMessage) > > of the operation type from X.880 and would like to use this to > > instantiate the ROSE type, but I cannot figure out how to do this. > > > > The ROS type from Remote-Operations-Generic-ROS-PDUs has to be > > instantiated before one can use it for something and I have tried > > numerous variations over the following to no avail: > > > > > > myInvokeIdSet InvokeId ::= present:2 > > > > tetraIsiROS ::= ROS{myInvokeIdSet, tetraIsiMessage, tetraIsiMessage} > > > > > > As soon as I add the 'tetraIsi ::= ...' line the compiler starts > > complaining about the definition of myInvokeIdSet which works just > > fine without the last line. > > > > For your reference... > > ROSE is defined in X.880 and the ASN.1 files for it can be downloaded > > from the ITU web site: > > http://www.itu.int/ITU-T/asn1/database/itu-t/x/x880/1994-TC1/index.html > > > > > > > I am very close to throwing the whole auto-generation from ASN.1 > > definitions away and start implementing my encoder and decoder by > > hand, but... I would really like to avoid messing with BER > > encoding/decoding and let the asn1ct compiler take care of that for me!! > > > > Cheers, > > Torben > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Wed Nov 28 09:42:07 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 09:42:07 +0100 Subject: [erlang-questions] how: distributed supervision tree In-Reply-To: <13983949.post@talk.nabble.com> References: <13941497.post@talk.nabble.com> <8209f740711271400m6c9ad4bfn531a6ab6fadc54c8@mail.gmail.com> <13983949.post@talk.nabble.com> Message-ID: <474D29DF.7010008@ericsson.com> Zvi skrev: > Ulf, > > So what you suggesting, is to use "forest" of the single-node supervision > "trees". > Then the "forester" or "woodward" will monitor, and start/restart/shut the > top-level supervisor in each "tree". Such a "forester" can't use Erlang's > built-in trap-exit/process linking mechanism and should reimplement > distributed version of it. > > Thanks, > Zvi A supervision tree is usually encapsulated within an application. Through OTP's release handling framework, you can build a boot script that loads all the code(*) and starts the applications you need. You can specify where each application should run in a distributed system. It is most common to run the same boot script on each node, and then configure the kernel application to start the right applications. If the system is supposed to recover automatically, you should make sure that the erlang node is supervised and restarted, if it dies. This can be done in different ways. You specify distribution logic e.g. in a sys.config file, which is identified with the -sys parameter when starting erlang. An example sys.config: [{kernel, [{distributed, [{a, [node@REDACTED, node@REDACTED]}] }] }] This would tell the distributed application controller to start the application 'a' on node@REDACTED, if available, otherwise on node@REDACTED If the node running the application dies, the controller will move it to an alternative node. You can read more about it on the man pages for 'kernel' and 'application' (and 'erl', if you want to read more about command- line arguments). BR, Ulf W From ulf.wiger@REDACTED Wed Nov 28 09:44:49 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 09:44:49 +0100 Subject: [erlang-questions] separating application from gen server In-Reply-To: <321126.9350.qm@web42106.mail.mud.yahoo.com> References: <321126.9350.qm@web42106.mail.mud.yahoo.com> Message-ID: <474D2A81.30506@ericsson.com> Tom Whitcomb skrev: > Hi, > > I want to use application:get_env in my gen_server but it feels wrong > to create a dependency between my gen_server and a specific application. > > Is there a recommended way for a gen_server to receive and reference > the application that contains it? application:get_application() -> {ok, AppName} | undefined will return the name of the application which contains the current process. application:get_env(Par) -> {ok, Val} | undefined will get the environment variable Par from the current application. get_env(AppName, Par) will get it from the specified application. BR, Ulf W From ulf.wiger@REDACTED Wed Nov 28 10:02:08 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 10:02:08 +0100 Subject: [erlang-questions] 64-bit erlang Message-ID: <474D2E90.80603@ericsson.com> We've had reason to start discussing 64-bit Erlang, and I thought I'd share some thoughts, hoping that others will share theirs. In one application, we're starting to hit the 4 GB ceiling, and we're discussing ways to address the situation. One option is to install more RAM, but then we need to either run multiple nodes on each machine (affects software complexity), or switch to 64-bit Erlang. But 64-bit Erlang consumes up to twice as much memory as 32-bit Erlang, so if we switch to more expensive RAM and install 8 GB, worst case, we'll still have roughly the same capacity. The cost per GB goes up, which cuts into the per-unit profit margin. After this, we'd be able to sail into the sunset on 64-bit Erlang, installing more and more gigabytes of RAM. (: But the entry threshold /is/ a bit high. Here's an idea to get the discussion going: How about using 32-bit words inside the process heap, and "far pointers" to any off-heap data (including other processes)? After all, I doubt that anyone is seriously looking at having process heaps larger than 4 GB... BR, Ulf W From alex.arnon@REDACTED Wed Nov 28 10:31:03 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Wed, 28 Nov 2007 11:31:03 +0200 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> Message-ID: <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> I remember seeing some posts about inroads being made with regard to realtime performance on JVMs lately, on Lambda the Ultimate. On the other hand, listening to Software Engineering Radio (thisone I think), the expert being interviewed said that Java is practically nonexistent in the realtime space. So... grains of salt with everything, as usual... :) On Nov 28, 2007 4:23 AM, G Bulmer wrote: > > A small point about JVM concurrency performance. > I had the pleasure of talking to James Gosling one to one, for a > couple of hours, about three years ago, in Bangalore. > > He was presenting a talk about his current and on-going work on Java. > He said he spent much of his time on strategic Java projects. > He very excited about a research JVM which was being built and tested > for use in hard realtime, the project he talked about as specifically > for process control in a power plant. > > Anyway, in his initial presentation (after which we chatted) he > showed stats from the research JVM that indicated good support for > many thousands of threads (I accept, still well behind the Erlang VM, > but I'd need more detail to judge how far behind) with interrupt > response times with a jitter of less than 4 micro-seconds (I am sure > this was at least response to timer events, and may have been to > other interrupt sources). > > I am certain I asked about garbage collection, and he said that the 4 > micro-seconds was not an overall average, but was 'realtime', and it > included garbage collection. > > I don't recall many more details other than the company involved in > the process control project (who I feel I should not disclose as he > was tired, jet lagged, home sick for his kids, and maybe a little > tipsy). > > Anyway, I don't assume that the normally resource-expensive JVM > approach to threads is the only practical solution. There is likely > significant investment in fixing some of those Java problems. > > GB > > PS - I apologise that I haven't followed it up. I remember at the > time feeling I should not expect to see anything for a year or more. > I may try digging some time next week (when I return from my lovely > Thai holiday, the weather is beautiful here, much warmer than > Stockholm EUC, and booze and food are cheaper too :-) > > > > Date: Mon, 26 Nov 2007 09:43:18 +0000 > > From: Charles Forsyth > > Subject: Re: [erlang-questions] Erlang vs Clojure > >> The thought of running on the JVM makes me feel both sick and > >> bloated...but strangely I am warming up to the idea. > >> > > > > > >> The ErlangVM enables distributed concurrency, Closure on the JVM is > >> optimizing for local concurrency. > >> > > > > > >> Granted that I am not building fault tolerant telecom switches, > >> but in > >> my case, massive local concurrency might be all that I need. With > >> > > > > if you expect to get high-performance concurrency from a JVM > > i expect you to be disappointed. the Erlang implementation > > guarantees cheap processes everywhere it exists. by contrast, > > you get whatever your particular JVM gives you, which might not > > be much, and it will vary from platform to platform. > > if it works for you, though ... > > i'd be particularly interested if you find JVMs that > > offer ``massive local concurrency''. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.arnon@REDACTED Wed Nov 28 10:35:13 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Wed, 28 Nov 2007 11:35:13 +0200 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <474D2E90.80603@ericsson.com> References: <474D2E90.80603@ericsson.com> Message-ID: <944da41d0711280135p49abc8f2l6f6c38487a463e71@mail.gmail.com> On Nov 28, 2007 11:02 AM, Ulf Wiger (TN/EAB) wrote: ... > > How about using 32-bit words inside the process heap, and > "far pointers" to any off-heap data (including other > processes)? > ... * runs away to the hills * How insensitive - not everyone has recovered from 16-bit x86 assembly terminology :) But seriously - I this would make sense. Will this allow Mnesia/{d}ets tables to be unlimited then? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlm@REDACTED Wed Nov 28 10:42:55 2007 From: vlm@REDACTED (Lev Walkin) Date: Wed, 28 Nov 2007 01:42:55 -0800 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <474D2E90.80603@ericsson.com> References: <474D2E90.80603@ericsson.com> Message-ID: <474D381F.6020601@lionet.info> How do you provide heap segmentation so a single heap stays within a contiguous piece of memory? Are there any memory fragmentation considerations? Ulf Wiger (TN/EAB) wrote: > We've had reason to start discussing 64-bit Erlang, and > I thought I'd share some thoughts, hoping that others will > share theirs. > > In one application, we're starting to hit the 4 GB ceiling, > and we're discussing ways to address the situation. One > option is to install more RAM, but then we need to either > run multiple nodes on each machine (affects software > complexity), or switch to 64-bit Erlang. > > But 64-bit Erlang consumes up to twice as much memory as > 32-bit Erlang, so if we switch to more expensive RAM and > install 8 GB, worst case, we'll still have roughly the > same capacity. The cost per GB goes up, which cuts into > the per-unit profit margin. > > After this, we'd be able to sail into the sunset on 64-bit > Erlang, installing more and more gigabytes of RAM. (: > But the entry threshold /is/ a bit high. > > Here's an idea to get the discussion going: > > How about using 32-bit words inside the process heap, and > "far pointers" to any off-heap data (including other > processes)? > > After all, I doubt that anyone is seriously looking at having > process heaps larger than 4 GB... > > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bjorn@REDACTED Wed Nov 28 10:48:44 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 28 Nov 2007 10:48:44 +0100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <474D2E90.80603@ericsson.com> References: <474D2E90.80603@ericsson.com> Message-ID: "Ulf Wiger (TN/EAB)" writes: > How about using 32-bit words inside the process heap, and > "far pointers" to any off-heap data (including other > processes)? No. Programming with mixed pointer sizes is a nightmare. If we start rewriting the emulator now, we will probably have it ready when you can buy 16 Gb of memory for $10. :-) Note that binaries don't take twice as much memory. Use binaries. What might be feasible for us to do is to provide more compact storage of data in ETS tables. Since the data is always copied to and from ETS, it could be possible to compact/expand data while copying. This is of course not trivial, but could be doable in a reasonable time (other things on our to-do list would have be delayed, of course). It could also be possible to somewhat shrink the Beam code to better use the larger word size (packing more operands into one word). The savings would probably be minor, but could be still be worthwhile as it is relatively straight-forward to do. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vlm@REDACTED Wed Nov 28 10:52:17 2007 From: vlm@REDACTED (Lev Walkin) Date: Wed, 28 Nov 2007 01:52:17 -0800 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <944da41d0711280135p49abc8f2l6f6c38487a463e71@mail.gmail.com> References: <474D2E90.80603@ericsson.com> <944da41d0711280135p49abc8f2l6f6c38487a463e71@mail.gmail.com> Message-ID: <474D3A51.4070506@lionet.info> Alex Arnon wrote: > > > On Nov 28, 2007 11:02 AM, Ulf Wiger (TN/EAB) > wrote: > ... > > > How about using 32-bit words inside the process heap, and > "far pointers" to any off-heap data (including other > processes)? > > ... > > * runs away to the hills * > > How insensitive - not everyone has recovered from 16-bit x86 assembly > terminology :) Shivers!.. > But seriously - I this would make sense. > Will this allow Mnesia/{d}ets tables to be unlimited then? Perhaps, making it 64-bit for Mnesia/{d}ets as the only option could be a viable path? This way, only {d}ets bifs would need to know about LP size, all processess will continue being 32-bit. -- vlm From chsu79@REDACTED Wed Nov 28 11:07:42 2007 From: chsu79@REDACTED (Christian S) Date: Wed, 28 Nov 2007 11:07:42 +0100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: References: <474D2E90.80603@ericsson.com> Message-ID: 28 Nov 2007 10:48:44 +0100, Bjorn Gustavsson : > What might be feasible for us to do is to provide more compact > storage of data in ETS tables. Since the data is always copied > to and from ETS, it could be possible to compact/expand data > while copying. This is of course not trivial, but could be doable > in a reasonable time (other things on our to-do list would have > be delayed, of course). Compromises such as these lead to ugly programs that will go and use ETS just to save expensive resources today, and it will hurt us all when 16Gb costs $10. Can the increased complexities of running several erlang 32bit nodes on 64bit architectures be analyzed and made less of an issue? From gbulmer@REDACTED Wed Nov 28 11:49:14 2007 From: gbulmer@REDACTED (G Bulmer) Date: Wed, 28 Nov 2007 17:49:14 +0700 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> Message-ID: <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> On 28 Nov 2007, at 16:31, Alex Arnon wrote: > I remember seeing some posts about inroads being made with regard > to realtime performance on JVMs lately, on Lambda the Ultimate. > On the other hand, listening to Software Engineering Radio ( this > one I think), the expert being interviewed said that Java is > practically nonexistent in the realtime space. So... grains of salt > with everything, as usual... :) I would like pointers to realtime any-VM stuff. For me, that is the last major piece of my jigsaw. Were you thinking of the IBM paper: http://domino.research.ibm.com/ comm/research_people.nsf/pages/dgrove.ecoop07.html which popped up at LtU as http://lambda-the-ultimate.org/node/2393 ? That seemed to be an impressive piece of work. I feel realtime Java suffers from the classic 'chicken and the egg' syndrome - process control is pretty conservative about technologies because the systems are usually safety critical. So there will be few/ no volunteers to use a realtime-anything-new until some others have successfully deployed. This will take a few years due to the deployment environment, e.g. an oil refinery or power plant, (by which time the hype will have died down on that technology, and everyone will be evangelising and 'dis-ing' the next over-hyped technology ;-) I know *I* feel the same way about highly available and fault- tolerant systems, and their initial implementation can be much quicker than process control. This inherent conservatism as systems become more critical is why, to me, Erlang is way ahead of the field; there are real systems out there working! GB PS - I do expect the 'tweaked' versions of Java, and .NET, to become usable*, but they have a lot of ground to cover before they catch up to Erlang. *usable - ill defined, and depends on many factors, some of which are not rational ;-) > On Nov 28, 2007 4:23 AM, G Bulmer < gbulmer@REDACTED> wrote: > > ... James Gosling ... was very excited about a research JVM which > was being built and tested > for use in hard realtime, the project he talked about as specifically > for process control in a power plant. > > Anyway, in his initial presentation ... > showed stats from the research JVM that indicated good support for > many thousands of threads (I accept, still well behind the Erlang VM, > but I'd need more detail to judge how far behind) with interrupt > response times with a jitter of less than 4 micro-seconds (I am sure > this was at least response to timer events, and may have been to > other interrupt sources). > > I am certain I asked about garbage collection, and he said that the 4 > micro-seconds was not an overall average, but was 'realtime', and it > included garbage collection. > > ... > GB > ... > > Date: Mon, 26 Nov 2007 09:43:18 +0000 > > From: Charles Forsyth < forsyth@REDACTED> > > Subject: Re: [erlang-questions] Erlang vs Clojure > >> The thought of running on the JVM makes me feel both sick and > >> bloated...but strangely I am warming up to the idea. > ... > > > > if you expect to get high-performance concurrency from a JVM > > i expect you to be disappointed. the Erlang implementation > > guarantees cheap processes everywhere it exists. by contrast, > > you get whatever your particular JVM gives you, which might not > > be much, and it will vary from platform to platform. > > if it works for you, though ... > > i'd be particularly interested if you find JVMs that > > offer ``massive local concurrency''.... From tomas.abrahamsson@REDACTED Wed Nov 28 11:49:34 2007 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Wed, 28 Nov 2007 11:49:34 +0100 (MET) Subject: [erlang-questions] 64-bit erlang In-Reply-To: <474D2E90.80603@ericsson.com> (ulf.wiger@ericsson.com) References: <474D2E90.80603@ericsson.com> Message-ID: <200711281049.lASAnYA6018121@selic139.lmera.ericsson.se> > We've had reason to start discussing 64-bit Erlang, and > I thought I'd share some thoughts, hoping that others will > share theirs. > > In one application, we're starting to hit the 4 GB ceiling, > and we're discussing ways to address the situation. One > option is to install more RAM, but then we need to either > run multiple nodes on each machine (affects software > complexity), or switch to 64-bit Erlang. > > But 64-bit Erlang consumes up to twice as much memory as > 32-bit Erlang, so if we switch to more expensive RAM and > install 8 GB, worst case, we'll still have roughly the > same capacity. The cost per GB goes up, which cuts into > the per-unit profit margin. We start several erlang virtual machines and spread the application over these. The 4 GB ceiling is one reason for this (our only remaining, I guess). In the pre-smp times, this was also a way of making use of the computing power in multicpu machines. We've also tried the 64-bit Erlang from a performance persective, but concluded that the 32-bit Erlang is faster for our application. In addition to using more main memory, it'd also use more CPU cache due to its larger pointers. > After all, I doubt that anyone is seriously looking at having > process heaps larger than 4 GB... We haven't hit _that_ limit yet :-) /Tomas From ulf.wiger@REDACTED Wed Nov 28 12:08:52 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 12:08:52 +0100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <944da41d0711280135p49abc8f2l6f6c38487a463e71@mail.gmail.com> References: <474D2E90.80603@ericsson.com> <944da41d0711280135p49abc8f2l6f6c38487a463e71@mail.gmail.com> Message-ID: <474D4C44.8050501@ericsson.com> Alex Arnon skrev: > > > On Nov 28, 2007 11:02 AM, Ulf Wiger (TN/EAB) > wrote: > ... > > > How about using 32-bit words inside the process heap, and > "far pointers" to any off-heap data (including other > processes)? > > ... > > * runs away to the hills * > > How insensitive - not everyone has recovered from 16-bit x86 assembly > terminology :) Apologies, but at least it got the discussion started. (: > But seriously - I this would make sense. > Will this allow Mnesia/{d}ets tables to be unlimited then? Rewriting dets to support larger files is of course a separate issue, but ets tables can become very large in 64-bit Erlang. I ran some tests two years ago on a 16 GB machine: Summary: http://www.erlang.org/pipermail/erlang-questions/2005-November/017740.html More detail: http://www.erlang.org/ml-archive/erlang-questions/200511/msg00118.html One of the notable observations from that test was perhaps that a disc_copy table using up 15 GB of RAM used only 3.2 GB on disk. When I switched to term_to_binary(Value,[compressed]), I read the table as using 686 MB of RAM, compared to 373 MB on disk, but that probably overlooked the fact that much of the binary data was not reported as 'ets' usage, but rather as 'binary'... BR, Ulf W From michael.regen@REDACTED Wed Nov 28 12:25:16 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 28 Nov 2007 12:25:16 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> Message-ID: <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> Hi, Don't want to break the current thread about lispy Erlang and realtime support but there is just a thought about the initial question I need to get off my chest. > Does anyone see the benefit of a Lispy version of Erlang on the JVM? I would see two huge benefits if Erlang as it is today would run on the JVM: a) Much easier to call Java from Erlang. JInterface works but is not really what I want to sell as the future. Besides, why reinvent the wheel - Java has so much to offer. More important: b) Much easier to sell Erlang. The JVM certainly belongs to the big players in big corporate server environments (finance, telecom, ...). Everybody from the decision makers to the admins are used to the fact that many server processes will run in the JVM and that it will work. On the other side the whole Erlang univers from the code to the Erlang VM is mostly unknown by them and what is unknown is considered obscure. Making it quite difficult to sell. Just think how long it took for Java and especially its VM to be accepted - even given a much broader support from big players. You might remember all the wrong preconceptions. Now consider Erlang in JVM: 'Well, we write this application in Erlang but for you, dear customer there is no difference. You will run it in your proven Java VM. Your Engineer do not need to adopt to a new environment. And no, you do not have to mind upgrade paths. If a new technology evolves we can for sure expect support for it in Java and we can always use Java as fallback if there is no production ready implementation in Erlang. We just use Erlang where it helps us to implement faster/better quality and with less cost than we could with Java.' Yes, I read about Scala. :) And yes, I know that i might dream a bit because it might be very difficult (tail recursion?) to port Erlang to the JVM. Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Nov 28 12:50:56 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 28 Nov 2007 12:50:56 +0100 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <077FE364-4D97-4402-806C-6F6D8F51AB83@gmail.com> References: <310035.59131.qm@web60520.mail.yahoo.com> <474D227F.2040805@ericsson.com> <077FE364-4D97-4402-806C-6F6D8F51AB83@gmail.com> Message-ID: <474D5620.8070200@ericsson.com> greetings, isaac asked me a question. i could not see what relevance it had to the discussion. still, it might be relevant, so i asked how it was relevant. no answer from him so far. this was the included email with the question. perhaps you did not see it? On 11/23/07 23:44, Isaac Gouy wrote: > On Nov 23, 2007 1:26 PM, Bengt Kleberg wrote: > >> this is seriously off topic for erlang-questions, so i would > recommend >> each and every one of you to stop reading now. > > Was it off topic when you chose to air your criticism on > erlang-questions back in September, or is it only the reply to your > criticism that is off topic? :-) what does this question have to do with the subject matter of this discussion? -------------------------------------------------------------------- bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/28/07 11:15, Joel Reymont wrote: > Bengt, > > FYI, I have no idea what the question is from the content that you > included ;-). > > On Nov 28, 2007, at 8:10 AM, Bengt Kleberg wrote: > >> greetings, >> >> just a clarification: my idea was for the shootout >> responsible/comitters to allow me to do more work for the shootout. >> not that the shootout responsible/comitters should do the work for me. >> i think we all agree on this, but i only wanted to make it perfectly >> clear. >> >> however, at this time i really would like for you, Isaac Gouy, to do >> more work when it comes to answering emails in this thread. it is not >> pressing, take your time, but i have one outstanding question that i >> would appreciate if you answered so that i may move on with the rest. >> i have decided to limit the number of items (questions/statements) to >> 1 per post since otherwise the ones i regard as interesting gets >> ignored. in their place new ones spring up and propagate to such an >> extent that i loose track of the original thread. sorry about this, >> but i hope that quality comes before quantity for all parties >> interested in this discussion. >> >> the outstanding question is included below. i eagerly await your answer. >> >> >> bengt >> Those were the days... >> EPO guidelines 1978: "If the contribution to the known art resides >> solely in a computer program then the subject matter is not >> patentable in whatever manner it may be presented in the claims." >> >> >> On 11/26/07 20:05, Isaac Gouy wrote: >>> --- David Hopwood wrote: >>> -snip- >>>> As for the 'shootout', most of the criticisms of it in this thread >>>> have been valid; it's not a very good basis for comparison of >>> language >>>> performance. >>> Puzzled. afaict most of the comments in this thread have been about >>> benchmarks >>> in general and not about the benchmarks game in particular, so the way >>> you state your opinion is uninformative. >>> And Bengt Kleberg's "criticism" is more of a complaint that we should >>> do more. >>> >>> ____________________________________________________________________________________ >>> >>> Get easy, one-click access to your favorites. Make Yahoo! your homepage. >>> http://www.yahoo.com/r/hs >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> From: Bengt Kleberg >> Date: November 26, 2007 7:18:00 AM GMT >> To: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] benchmarks game harsh criticism (was >> Learning Erlang from the scratch) >> >> >> >> >> On 11/23/07 23:44, Isaac Gouy wrote: >>> On Nov 23, 2007 1:26 PM, Bengt Kleberg wrote: >>>> this is seriously off topic for erlang-questions, so i would >>> recommend >>>> each and every one of you to stop reading now. >>> Was it off topic when you chose to air your criticism on >>> erlang-questions back in September, or is it only the reply to your >>> criticism that is off topic? :-) >> >> what does this question have to do with the subject matter of this >> discussion? >> >> >> bengt >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > http://wagerlabs.com > > > > > From ulf.wiger@REDACTED Wed Nov 28 13:00:22 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 13:00:22 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> Message-ID: <474D5856.1040909@ericsson.com> Michael Regen skrev: > Hi, > > Don't want to break the current thread about lispy Erlang and realtime > support but there is just a thought about the initial question I need to > get off my chest. > > Does anyone see the benefit of a Lispy version of Erlang on the JVM? > > I would see two huge benefits if Erlang as it is today would run on the JVM: > > a) Much easier to call Java from Erlang. JInterface works but is not > really what I want to sell as the future. Besides, why reinvent the > wheel - Java has so much to offer. Another candidate VM is of course Mono (open source version of .NET) http://www.mono-project.com/Main_Page BR, Ulf W From lcoquelle@REDACTED Wed Nov 28 14:14:27 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 28 Nov 2007 21:14:27 +0800 Subject: [erlang-questions] separating application from gen server In-Reply-To: <474D2A81.30506@ericsson.com> References: <321126.9350.qm@web42106.mail.mud.yahoo.com> <474D2A81.30506@ericsson.com> Message-ID: Usually I let the application get the config variables, and start the gen_server with the good params. So that only application manage its config (through a dedicated module, such that it is easy to move the config from env to DB or other file ... I did need to parse a ini file once :( ). Something in the line of: myapp.erl: start() -> ThingCfg = config:server_of_things(), thingserver:start_link(ThingCfg). config.erl: server_of_things() -> {ok, Cfg} = application:get_value(things_key), Cfg. thingserver.erl: start_link(Args) -> gen_server:start_link({local,?MODULE},?MODULE,Args,[]). On 11/28/07, Ulf Wiger (TN/EAB) wrote: > > Tom Whitcomb skrev: > > Hi, > > > > I want to use application:get_env in my gen_server but it feels wrong > > to create a dependency between my gen_server and a specific application. > > > > Is there a recommended way for a gen_server to receive and reference > > the application that contains it? > > application:get_application() -> {ok, AppName} | undefined > > will return the name of the application which contains > the current process. > > application:get_env(Par) -> {ok, Val} | undefined > > will get the environment variable Par from the current > application. get_env(AppName, Par) will get it from the > specified application. > > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Wed Nov 28 14:14:40 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 14:14:40 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> Message-ID: <474D69C0.5000501@ericsson.com> Ludovic Coquelle skrev: > And mono support already F#. > What is the advantage to port Erlang VM to any other VM (JVM or CLR of > .NET)? the fault-tolerant behaviour of Erlang is mainly due to its VM, > isn't it so? I don't know about that (although the robustness of the VM itself is a major contributor to the stability of erlang-based products). Much of the fault tolerance comes from the share-nothing semantics and process linking/monitoring. This would obviously come along regardless of which VM Erlang would be ported to, otherwise few Erlang programs would work at all. I can imagine that performance might suffer on another VM, but I can also imagine lots of applications where this is not nearly as crucial as interoperability. BR, Ulf W From michael.regen@REDACTED Wed Nov 28 14:14:47 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 28 Nov 2007 14:14:47 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> Message-ID: <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> And if you manage to write an Erlang => Mono CLI compilier there is no or not much additional work involved to also support the Microsoft CLI. On the other side according to my experience Mono shares some problems Erlang has: Decision makers hesitate to use it. Facts or wrong preconception? I think because they do not know it well enough. For many problems I consider Erlang/OTP as the best thing since sliced bread. If only it did not live in its own universe which people do not know and understand. Scala and F# are sp far no comparison in my eyes even if they offered a stable distribution mechanism as good as the one in Erlang since they lack all OTP functionality. OK, where is the person who implements a Erlang to JVM and CLI compiler? Unfortunately I don't have the faintest idea what it means to implement such a compiler. Certainly just a weekend job. ;)) At least it must be possible since both, JVM and CLI are supposed to be turing complete. I guess the argument that Erlang's performance will certainly be lower under another VM is right. But won't the advantages (access to .NET or Java, better selling environment) outperform performance penalties? Sell the stuff with low performance, have your foot in the door and if performance becomes critical, use the original Erlang VM. Oh yes, did I mention that I want it all? ;) Cheers, your today-not-to-be-taken-serious Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From lcoquelle@REDACTED Wed Nov 28 13:59:43 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 28 Nov 2007 20:59:43 +0800 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <474D5856.1040909@ericsson.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> Message-ID: And mono support already F#. What is the advantage to port Erlang VM to any other VM (JVM or CLR of .NET)? the fault-tolerant behaviour of Erlang is mainly due to its VM, isn't it so? If we are looking only at the message passing model in JVM, scala implements it completely (I may be wrong), and it may be easier to implement the distribution on Scala than the whole Erlang VM. You can replace Scala by F# and JVM by CLR in previous sentence ;) I like the idea of JVM (and the CLR yet better), but I think the current advantage of Erlang is the stable state of its VM and the OTP library. Wouldn't we loose that if we are doing Erlang on any other VM? Please, tell me where I'm wrong, I would love to have Erlang on any other VM supporting lots of libraries ... this would remove all reason to not use Erlang :) On 11/28/07, Ulf Wiger (TN/EAB) wrote: > > Michael Regen skrev: > > Hi, > > > > Don't want to break the current thread about lispy Erlang and realtime > > support but there is just a thought about the initial question I need to > > get off my chest. > > > Does anyone see the benefit of a Lispy version of Erlang on the JVM? > > > > I would see two huge benefits if Erlang as it is today would run on the > JVM: > > > > a) Much easier to call Java from Erlang. JInterface works but is not > > really what I want to sell as the future. Besides, why reinvent the > > wheel - Java has so much to offer. > > Another candidate VM is of course Mono (open source version of .NET) > > http://www.mono-project.com/Main_Page > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Wed Nov 28 14:34:08 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 28 Nov 2007 13:34:08 +0000 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: On Nov 28, 2007, at 1:14 PM, Michael Regen wrote: > I guess the argument that Erlang's performance will certainly be > lower under > another VM is right. This maybe harsh but I think anyone striving for Erlang on the XXX VM gets it completely and irreversibly wrong! It's not the _syntax_ that gives Erlang its greatest advantage. In fact, I hate the syntax. What gives Erlang its ultimate advantage is the VM! The VM is what enables lightweight processes, etc. etc. etc. It has been mentioned more than a few times that Core Erlang is Lambda Calculus. Compile to Core Erlang or directly to the Beam bytecode. Take advantage of the Erlang VM! There will be absolutely and positively no advantage of running Erlang on the JVM, CLR, Mono, Lisp or what have you. There's just no other Erlang VM out there, nothing that implements lightweight processes, message passing, great support for binaries, etc. Write Lisp on the Erlang VM, write Haskell or a new language with an elegant syntax. Throw your lot into improving the existing VM. Thanks for listening, Joel -- http://wagerlabs.com From tobbe@REDACTED Wed Nov 28 14:42:42 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 28 Nov 2007 14:42:42 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: Joel Reymont wrote: > On Nov 28, 2007, at 1:14 PM, Michael Regen wrote: > >> I guess the argument that Erlang's performance will certainly be >> lower under >> another VM is right. > > This maybe harsh but I think anyone striving for Erlang on the XXX VM > gets it completely and irreversibly wrong! It's not the _syntax_ that > gives Erlang its greatest advantage. In fact, I hate the syntax. What > gives Erlang its ultimate advantage is the VM! > > The VM is what enables lightweight processes, etc. etc. etc. It has > been mentioned more than a few times that Core Erlang is Lambda > Calculus. Compile to Core Erlang or directly to the Beam bytecode. > Take advantage of the Erlang VM! > > There will be absolutely and positively no advantage of running Erlang > on the JVM, CLR, Mono, Lisp or what have you. There's just no other > Erlang VM out there, nothing that implements lightweight processes, > message passing, great support for binaries, etc. > > Write Lisp on the Erlang VM, write Haskell or a new language with an > elegant syntax. Throw your lot into improving the existing VM. Well spoken! That is exactly what I've been trying to say in earlier posts. An experimental Haskell-subset to Erlang-Core compiler already exist. Who (and what) will be next? Cheers, Tobbe From michael.regen@REDACTED Wed Nov 28 14:46:16 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 28 Nov 2007 14:46:16 +0100 Subject: [erlang-questions] Erlang vs Clojure In-Reply-To: <474D69C0.5000501@ericsson.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <474D69C0.5000501@ericsson.com> Message-ID: <9b59d0270711280546x1a165ebaq969e00cea5667e1c@mail.gmail.com> Hmmm: http://erlangdotnet.net/ Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.regen@REDACTED Wed Nov 28 15:35:32 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 28 Nov 2007 15:35:32 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> Joel, Torbjorn, Maybe we are talking about two different things: Technical advantages and pushing Erlang. You have certainly a much better understanding of Erlang's internals. Since I lack most of them I probably cannot decide how difficult it would be to have the same functionality Erlang offers today under another VM. True. On the other side: Please correct me if I am wrong but I thought that e.g. Scala Actors manages to get quite good performance figures for lighweight processes and message passing under another VM - in this case the JVM. But maybe I am comparing apples with oranges here!? If really most of the benefits come with the Erlang VM or the disadvantages of using another VM are simply too big, then of course my arguments are void. My main point is simply: How do I sell Erlang to a typical decision maker in the finance and telecom industry. And I do not mean people who decide on the OS used in an ATM switch but the ones who are responsible for all the back office server software. Java is _the_ big player here. And although we all know the meaning of the 'T' in OTP and know that Erlang could help so much here, it is not known much and used much less. So where does it come from that people are not deciding in favor of it? My experience (a bit overdrawn and simplified) is that the typical CIO will not think in terms of 'what is the best tool?' but 'what is the best tool for which I will not get fired'. For a CIO thinking out of the box can be dangerous: If everything works, you did your job. If not, you will be blamed for deciding against industry standards. Causing a big bias in favor of industry standards. Therefore I can see huge advantages if Erlang would run under the industry standard JVM. Maybe no technical advantages - besides possibly easier Java integration. Maybe even some disadvantages. But for me it makes a difference if I can sell my Erlang solutions or just go over to the next pitch. So, the question for me is rather be what would we lose with another VM. Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.regen@REDACTED Wed Nov 28 15:47:02 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 28 Nov 2007 15:47:02 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> Message-ID: <9b59d0270711280647m6a2e65apef1fb545aae175a0@mail.gmail.com> Sorry for spammin, it's me again. But I somehow missed a point from Joel: You are right, e.g. the JVM does not offer the kind of message passing and lightwight processes we are talking about. E.g. in Scala the Actor _library_ is responsible for that. Maybe the outcome is that we would lose too much with JVM, etc. That's what I am trying to find out here. And one addtional thought: I agree, it's not the syntax that gives Erlang its greatest advantage. I think it's the concept behind. Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.campbell@REDACTED Wed Nov 28 15:48:17 2007 From: michael.campbell@REDACTED (Michael Campbell) Date: Wed, 28 Nov 2007 09:48:17 -0500 Subject: [erlang-questions] How to scale big apps (from a non Erlang perspective) Message-ID: <811f2f1c0711280648n48c7b9cbyb46486d97740ad64@mail.gmail.com> Interesting blog-read here: http://natishalom.typepad.com/nati_shaloms_blog/2007/11/architecture-yo.html The "Scalability -- How to Do It Right" section I found particularly interesting, given Erlang's strengths. From rsaccon@REDACTED Wed Nov 28 16:01:48 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Wed, 28 Nov 2007 13:01:48 -0200 Subject: [erlang-questions] Clarify: does R12B ssl listener accept existing socket ? Message-ID: I took a look at the sources, saw that ssl has been completely rewritten, but did not manage to understand, whether and how it is possible to pas an existing file descriptor (e.g.: provided by fd_server) of an open socket to the ssl listener. regards -- Roberto Saccon http://rsaccon.com From ulf.wiger@REDACTED Wed Nov 28 16:03:11 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 16:03:11 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: <474D832F.9010508@ericsson.com> Joel Reymont skrev: > On Nov 28, 2007, at 1:14 PM, Michael Regen wrote: > >> I guess the argument that Erlang's performance will certainly be >> lower under >> another VM is right. > > This maybe harsh but I think anyone striving for Erlang on the XXX VM > gets it completely and irreversibly wrong! It's not the _syntax_ that > gives Erlang its greatest advantage. In fact, I hate the syntax. What > gives Erlang its ultimate advantage is the VM! > > The VM is what enables lightweight processes, etc. etc. etc. So, Mono has, for example, Cairo bindings - something I recall you asking for for your IDE. It also has special support for XML. When building an IDE, for example, would you not agree that strong GUI support etc is more important than having lightweight processes? If Erlang, including distributed erlang, is implemented on e.g. the Mono VM, it ought to be perfectly feasible to have a heterogeneous network of nodes where some are Mono-based. I'm not personally shopping for Erlang on any other VM, but I can remember many complaints (most recently at the EUC) about Erlang/OTP not supporting the kind of enterprise interop technologies that many take for granted. I'm not sure that a CLR is the best or only way to get there, but if someone out there is willing to spend time exploring it, I think it's a worthy cause. BR, Ulf W From joelr1@REDACTED Wed Nov 28 16:04:15 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 28 Nov 2007 15:04:15 +0000 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> Message-ID: <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> On Nov 28, 2007, at 2:35 PM, Michael Regen wrote: > Therefore I can see huge advantages if Erlang would run under the > industry > standard JVM. Maybe no technical advantages - besides possibly > easier Java > integration. Maybe even some disadvantages. But for me it makes a > difference > if I can sell my Erlang solutions or just go over to the next pitch. > So, the > question for me is rather be what would we lose with another VM. I may be wrong here but the advantages of using Java over Erlang for the CIO lie not so much in the technical merits of Java as in the deep pool of Java developers. It follows that a deep pool of developers translates into a deep pool of knowledge. A client I'm working with is not able to use Erlang at his startup since he simply cannot hire Erlang programmers in the US. I'm building up a team of developers around Wager Labs and I hope Francesco does not mind the competition ;-). Still, I don't think one or two Erlang consultancies are going to make a large enough impact. Dave Thomas of Pragmatic Programmers is rolling out courses together with Joe Armstrong but Erlang will keep being a novelty for some time to come. The biggest impact that YOU can make is to roll out cool Erlang-based projects. CouchDB counts, Erlyweb not so much. People want to buy 1/4 holes and not 1/4 drills. Be bold, go beyond what other people have gone before you. Push Erlang towards unproven applications, don't push Erlang into the "enterprise". Once the enteprise is awed, Erlang will make its way into the enterprise. As it stands, most of the current examples of applying Erlang can be thought of as irrelevant to the enterprise. Telecom? Bah, our business could not be different! I'm hoping to show in the upcoming "Hardcore Erlang" book that nothing can be further from the truth, after all, as someone said, "Your trading app is one big honking router!". Cheers, Joel -- http://wagerlabs.com From sean.hinde@REDACTED Wed Nov 28 16:11:34 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 28 Nov 2007 15:11:34 +0000 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> Message-ID: <4BF86740-7978-4365-A9A8-3353259DB511@gmail.com> On 28 Nov 2007, at 14:35, Michael Regen wrote: > So where does it come from that people are not deciding in favor of > it? > My experience (a bit overdrawn and simplified) is that the typical > CIO will not think in terms of 'what is the best tool?' but 'what is > the best tool for which I will not get fired'. For a CIO thinking > out of the box can be dangerous: If everything works, you did your > job. If not, you will be blamed for deciding against industry > standards. Causing a big bias in favor of industry standards. My experience has shown that if you want to persuade a CIO of this mindset to use a new fancy programming language, then the choice of VM is a detail of miniscule importance. Arguments are much more about support, availability of programming resource (including option to outsource if the in house team proves too troublesome or expensive) etc etc. Sean From joelr1@REDACTED Wed Nov 28 16:13:44 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 28 Nov 2007 15:13:44 +0000 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474D832F.9010508@ericsson.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> Message-ID: <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> On Nov 28, 2007, at 3:03 PM, Ulf Wiger (TN/EAB) wrote: > When building an IDE, for example, would you not agree that strong > GUI support etc is more important than having lightweight processes? I would not build the GUI in Erlang if that's what you are asking. > If Erlang, including distributed erlang, is implemented on e.g. the > Mono VM, it ought to be perfectly feasible to have a heterogeneous > network of nodes where some are Mono-based. You can have this without porting Erlang to Mono, just write 'ei' for Mono. > I'm not personally shopping for Erlang on any other VM, but I can > remember many complaints (most recently at the EUC) about Erlang/OTP > not supporting the kind of enterprise interop technologies that many > take for granted. I must be missing a point. What's wrong with jinterface and the (yet unexistant) clrinterface? Thanks, Joel -- http://wagerlabs.com From ulf.wiger@REDACTED Wed Nov 28 16:23:34 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 16:23:34 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> Message-ID: <474D87F6.9050607@ericsson.com> Joel Reymont skrev: > > On Nov 28, 2007, at 3:03 PM, Ulf Wiger (TN/EAB) wrote: > >> When building an IDE, for example, would you not agree that strong >> GUI support etc is more important than having lightweight processes? > > I would not build the GUI in Erlang if that's what you are asking. No, it isn't. But the problem, often, with GUIs is that you tend to want quite a lot of logic to be rather tightly coupled with the interactive parts. While it's relatively easy to make a tcl or Gtk binding for Erlang, chances are that you will notice a performance lag as the frequency of messages to/from the GUI grows. From a programming point of view, writing the interaction logic for the GUI in Erlang is actually quite pleasant. > You can have this without porting Erlang to Mono, just write 'ei' > for Mono. I personally doubt that performance would be sufficient for a GUI- intensive app. BR, Ulf W From ulf.wiger@REDACTED Wed Nov 28 16:27:57 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 16:27:57 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> Message-ID: <474D88FD.6090002@ericsson.com> Michael Regen skrev: > > Therefore I can see huge advantages if Erlang would run under the > industry standard JVM. Maybe no technical advantages - besides possibly > easier Java integration. Maybe even some disadvantages. But for me it > makes a difference if I can sell my Erlang solutions or just go over to > the next pitch. So, the question for me is rather be what would we lose > with another VM. Personally, I wouldn't mind if someone ported erlang to the JVM or Mono, as a hobby hack. It would help make the discussion more concrete. (: I don't consider it to be a priority item for the OTP team, but perhaps interest in Erlang will grow to the point that it will happen anyway, eventually. BR, Ulf W From joelr1@REDACTED Wed Nov 28 16:30:00 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 28 Nov 2007 15:30:00 +0000 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474D87F6.9050607@ericsson.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> <474D87F6.9050607@ericsson.com> Message-ID: <185CD384-5011-484D-9642-B110B5AC34D3@gmail.com> On Nov 28, 2007, at 3:23 PM, Ulf Wiger (TN/EAB) wrote: > I personally doubt that performance would be sufficient for a GUI- > intensive app. Why not try? -- http://wagerlabs.com From dbyrne@REDACTED Wed Nov 28 16:40:54 2007 From: dbyrne@REDACTED (Dennis Byrne) Date: Wed, 28 Nov 2007 09:40:54 -0600 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! Message-ID: An HTML attachment was scrubbed... URL: From michael.regen@REDACTED Wed Nov 28 17:00:13 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 28 Nov 2007 17:00:13 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <185CD384-5011-484D-9642-B110B5AC34D3@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> <474D87F6.9050607@ericsson.com> <185CD384-5011-484D-9642-B110B5AC34D3@gmail.com> Message-ID: <9b59d0270711280800m69140c55ke7b6c32daa5e525d@mail.gmail.com> On Nov 28, 2007 4:04 PM, Joel Reymont wrote: > I may be wrong here but the advantages of using Java over Erlang for > the CIO lie not so much in the technical merits of Java as in the deep > pool of Java developers. On Nov 28, 2007 4:11 PM, Sean Hinde wrote: > My experience has shown that if you want to persuade a CIO of this > mindset to use a new fancy programming language, then the choice of VM > is a detail of miniscule importance. > Arguments are much more about support, availability of programming > resource (including option to outsource if the in house team proves > too troublesome or expensive) etc etc. I was silently referring to outsourced or ready to buy solutions. Where CIO dream about: No in-house development but outsourcing and buying solutions. And technologies like SOA, etc. give you interoperability. I was approaching the topic rather from the external integrator's view - not from the internal perspective. And then the pool of developers, support, etc. is your problem regardless of your solution's programming language. Your customer's CIO wants a solution which works, is cheap, future proof, reliable and fits into the company's strategic and environment. Not necessarily in this order. Under this scenario the least they want to do is to touch your solution's code. Which makes the underlying programming language not _that_ important. More important are of course your qualities as an integrator/solution provider (many different aspects) and: Does this solution fit into my environment? Is this VM really stable? Who is Ericsson? (SCNR) Can we trust the solution's stability given that not many other companies have any experince with it and my CIO magazine never mentioned a product based on the whole concept? Is it based on technologies we already use or do I have to send all our admins to courses? Etc, etc. If we can say, our solution is based on Erlang but it runs in your well known and proven Java environment, you can much easier give answers to their questions. BTW: this is also true if you see it from the internal viewpoint. Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Wed Nov 28 17:36:35 2007 From: rvirding@REDACTED (Robert Virding) Date: Wed, 28 Nov 2007 17:36:35 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> <474BE5F4.4090705@lionet.info> <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> Message-ID: <3dbc6d1c0711280836s7a8a0d1bmbe01d5b649da0c00@mail.gmail.com> Sorry, I think you are wrong there. You have a number of problems when detecting/handling safe functions and calling user defined functions in guards: - It is relatively easy to work which local functions are safe, but when you call another module you suddenly leaping without a safety net. Yes, you could analyse that functions within modules but that would not guarantee that at run-time this was so. It has nothing to do with if I explicitly call a module or through a variable, at *run-time* I have no guarantees. This would mean that you would either have to tag functions at compile time and check at run-time or trap unsafe system calls. - dict (and sets, gb_trees, array, etc ) is actually safe as it does no destructive updates. - if you were to detect unsafe functions/system calls then what would it actually *mean* when you hit one. The guard is neither true nor false, just unprovable. Today with only simple type and value tests this is not a problem, for example "when 2 * A > 4" contains an implicit type test of A. - it would make it difficult to functions from "unknown" modules as I would not know if they were safe or not. - it would mean that many tests which seem perfectly reasonable and used in code would not be allowed in guards, and this would create confusion to the poor user. Seriously. - the semantics of error handling is different in guards from in expressions (normal function calls). In a guard an error is handled as false while in a normal function call it generates an error. That would mean you have to keep track of where you are in a call-stack and know how to handle errors in this case. For example the (trivial) function: is_even(I) -> (I rem 2) == 0. would have to know if it called from a guard or expression. You could wrap user function calls in guards with a try but then I think it is getting a bit heavy in the implementation. - as Joe mentioned guards are just extensions of pattern matching and really shouldn't be considered as anything else. - allowing users to do dangerous thing like removing the is_guard_bif checking would be very unsafe and seriously compromise the robustness of the emulator. - really all that is left are functions which just contain expressions which are allowed in guards. If you are going to come up with a definition of guards which contain calls to user defined functions then you have cover *every* possible case. Just doing for reasonable usage is not the problem, users are usually unreasonable and will dream up cases which the poor language designer and compiler writer never thought anyone would ever consider doing. We have had this problem before. It would probably be better to define a 'cond' which is an extension of 'if' (i.e. lisp cond) which allows user defined functions in tests but does not have the special error handling in guards. Robert On 27/11/2007, David Holz wrote: > > > From: rvirding@REDACTED > > I actually defy anyone to come up with a safe, consistent and > *understandable* definition of > > guards which allow user defined functions. It would also be nice if they > were relatively easy > > to implement. Joe, remember our ideas with pipes? > > Hmm, how hard is it really to define? It seems to me to be exactly like > C++ const propagation. There are a few things which can mutate state > (process dict, message send/receive, ets et al, etc): > > - If a function calls built-in state mutators anywhere in its body, it's > not pure functional. > - If a function calls any other function that isn't pure functional, it's > not pure functional. > - If a function calls any M:F via variables instead of explicitly, tag it > as not pure functional. (to make it easy to implement for an initial > revision) > - Only pure functional functions can be called in guards. > > The only challenging part is the dynamic code loading, which has similar > issues to the M:F variable situation. Inside a guard context, M:F call > syntax would have to check the purity of the function it's calling, which > can be cached between code loads. This is really a linking issue, though, > and could be theoretically designed not to have any per-call overhead for > explicitly stated m:f's. I'm not saying it's dirt simple to implement, but > the idea of contagiously propagating "non-functionalness" shouldn't be > difficult to define. > > I, however, would like to see a setting or switch somewhere to just remove > the "is_guard_bif" checking completely, leaving it up to me to not do > anything stupid, without inflicting any extra load doing runtime guard > checks. I think it should be straightforward to recompile the compiler > myself with "is_guard_bif(_,_) -> true." but I haven't bothered with that > yet. > > _________________________________________________________________ > Share life as it happens with the new Windows Live.Download today it's > FREE! > > http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Wed Nov 28 17:39:10 2007 From: rvirding@REDACTED (Robert Virding) Date: Wed, 28 Nov 2007 17:39:10 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <474D1F41.9090007@ericsson.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <295884D8-18DD-4941-937C-2DAA04F4FCF9@cs.otago.ac.nz> <474D1F41.9090007@ericsson.com> Message-ID: <3dbc6d1c0711280839r4f0f4bcm3bd996e0c9588b5a@mail.gmail.com> Yes, this is what I meant. The R6 standard has just come out and I haven't had time to really check it thorugh yet. It contains libraries which are more restricted than our more general modules. Robert On 28/11/2007, Bengt Kleberg wrote: > > greetings, > > R6RS is available at http://www.r6rs.org . i think it includes a module > system hidden under the heading ''libraries''. > > > bengt > Those were the days... > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > > > On 11/28/07 06:02, Richard A. O'Keefe wrote: > > On 27 Nov 2007, at 10:32 am, Robert Virding wrote: > >> Scheme allows defining a prefix within the a symbol which means it > >> refers to another module (library for them) so you would write: > > > > There is no such thing as a module in Scheme (up to R5RS; they were > > planning > > a module system for R6RS but I haven't kept up with that) and Scheme > > (again, > > up to R5RS) attaches no special significance to colons. > > > > That's Common Lisp. > > > > Note that Common Lisp doesn't put *functions* in modules, it puts > > *symbols* (atoms) in packages. Package prefix "syntax" in Common > > Lisp is > > entirely lexical, there is no such thing as ((find-a-module):some- > > function ...) > > in that form. (You can do it, you just can't do it using colons.) > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Nov 28 17:45:52 2007 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 28 Nov 2007 17:45:52 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> Message-ID: <9b08084c0711280845q4c7d6085t9e2ed6df8709a739@mail.gmail.com> On Nov 28, 2007 3:35 PM, Michael Regen wrote: > Joel, Torbjorn, > > Maybe we are talking about two different things: Technical advantages and > pushing Erlang. I'm going to wade in here on the "pushing Erlang" topic - non technical aspects thereof. I was pusher #1 - so I've probably seen or tried every method you can imagine. > > You have certainly a much better understanding of Erlang's internals. Since > I lack most of them I probably cannot decide how difficult it would be to > have the same functionality Erlang offers today under another VM. True. > > On the other side: Please correct me if I am wrong but I thought that e.g. > Scala Actors manages to get quite good performance figures for lighweight > processes and message passing under another VM - in this case the JVM. But > maybe I am comparing apples with oranges here!? > > If really most of the benefits come with the Erlang VM or the disadvantages > of using another VM are simply too big, then of course my arguments are > void. > > My main point is simply: How do I sell Erlang to a typical decision maker in > the finance and telecom industry. And I do not mean people who decide on the > OS used in an ATM switch but the ones who are responsible for all the back > office server software. Java is _the_ big player here. And although we all > know the meaning of the 'T' in OTP and know that Erlang could help so much > here, it is not known much and used much less. Don't even try - a "typical" decision maker is the wrong person to sell the idea to. People who are responsible for the back office server are by definition in the mainstream. YOU CAN'T SELL TO THE MAINSTREAM. I have wasted years of my life trying to do this - do you know how many grey hairs I have? One for each person like this. You also can't sell to the early adapters! - Why they have their own ideas. They find us not the other way around. Erlang business is crawling out of the floor - the companies who sell Erlang support are doing so without any heavy marketing activity - people find them - they come banging on the door asking for help. > So where does it come from that people are not deciding in favor of it? > My experience (a bit overdrawn and simplified) is that the typical CIO will > not think in terms of 'what is the best tool?' but 'what is the best tool > for which I will not get fired'. For a CIO thinking out of the box can be > dangerous: If everything works, you did your job. If not, you will be blamed > for deciding against industry standards. Causing a big bias in favor of > industry standards. You won't be able to sell the ideas of Erlang to some guy whose main goal in life is not to get fired. It depends upon the mind set of the person you are trying to convince. If they are thinking - minimise my exposure if things go wrong then choose Java if they are thinking - maximize my profits if things go right then choose Erlang I asked the first venture capitalist who put money into an Erlang company why he had invested in us. I said something like "you must be mad to invest in us, you no nothing about the technology" He said - I'm not investing in you - I'm investing in a sector - I want to buy into 10 high tech startups - if 9 fail and one succeeds and makes a big profit I'm happy - I'm after the one that succeeds and not the nine that fail. He backed Bluetail (the first Erlang startup) - he made his money (Lots actually, which is why several second generation Erlang companies got their money - but that's a longer story) Venture Capitalists are used to taking risks - the argument over java is extremely simple - "if you use the same technology as everybody else you will get the same result" Venture capitalists don't back technologies they back people - the old addage is "give me a grade 1 person with a grade 2 idea rather than a grade 2 person with a grade 1 idea" Erlang provides a commercial advantage over java for a certain class of problems. I have only seen three repeatable patterns, that have caused the spread of Erlang into commercial projects: 1) A Catastrophe Project X fails - totally - a total disaster. Help me - help help help Erlang guys run in an save them 2) We can make money Idea X can make money if we can implement it really quicky and get to the market place *tomorrow* Erlang guys think it's a programming competion that they'll do over the weekend - first product is shipped in three months. Java compeditor goes bankrupt. 3) Hop offs A gang of smart programmers get so frustrated using technology X that they bail out from the mothership start own company and do stuff in Erlang All of the three above mechanism are based on actual examples - this is not theory. Some guys at a business school should do case-studies on the actual mechanism involved in technology transfer and not the crap you read in books. The other critical thing is TIMING At the right time and place an idea can spread very quickly. When projects collapse you must move quickly. Entire industries can be restructured in less than a week. In the mean time it's drip, drip, drip - all the arguing you do helps - though when you will see the benefit is unclear. Knowing which projects that are about to fail isn probably a good idea ... There are YEARS when nothing much happens (we've had three year doldrums) - then suddenly things can hapen in a week. When things go wrong, etc. you must move QUICKLY. After the great fire of London Sir Christopher Wren learnt of the fire while in Oxford. He immediately returned to London took about a week to replan the city center and ran off to present Charles III with a set of plans for a new city center and St Pauls cathedral. He had his guys working round the clock to do this. They got the contract - they were first. That weeks work was critical for Wren and for the architecture of London. If you're in one of these phases where things don't happen bide your time. Write an operating system in your spare time or a stock exchange - this is always good practise - like doing your scales if you play the piano - Wait for something to happen - then run like hell when it does. Most of the big things we plan never happen anyway - all the really significant changes in Erlang were unplanned. Also winning and loosing is often a purely temporary thing - often we won battles - but it turned out badly. And lost battles which then turned out well. Erlang was banned years ago ( a loss) but a few years on the ban caused it to spread and led to widespread use outside Ericsson. I'll leave the technical arguments (of which there are many) to other threads /Joe Armstrong > Therefore I can see huge advantages if Erlang would run under the industry > standard JVM. Maybe no technical advantages - besides possibly easier Java > integration. Maybe even some disadvantages. But for me it makes a difference > if I can sell my Erlang solutions or just go over to the next pitch. So, the > question for me is rather be what would we lose with another VM. > > Cheers, > Michael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rvirding@REDACTED Wed Nov 28 17:46:32 2007 From: rvirding@REDACTED (Robert Virding) Date: Wed, 28 Nov 2007 17:46:32 +0100 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <3dbc6d1c0711261336p63f8c173o5f5bb71d8a20b4a0@mail.gmail.com> Message-ID: <3dbc6d1c0711280846g6e70e4d2n447e937b5ea0ade3@mail.gmail.com> I would more translate it as: mod:func( ... ) == (remote-call 'mod 'func ... ) Mod:func( ... ) == (remote-call mod 'func ... ) apply(Mod, Func, [...]) == (apply mod func (...)) You could actually skip remote-call and just have apply, it would be no problem for the compiler to detect the case when the argument list is known. Someone came with perfectly reasonable suggestion of having a macro for the more usual case: (: mod func ... ) ==> (remote-call 'mod 'func ... ) Robert On 26/11/2007, Alex Alvarez wrote: > > Maybe I'm missing something here, but isn't this exactly like Erlang? > > (mod:func ... ) == mod:func(...) > (apply mod 'func ( ... )) == apply(mod, func, ...) > > Obviously, the syntax changes a little bit, but all the functionality is > there already. Actually, Erlang looks a lot cleaner from my view... > > Cheers, Alex > > ------------------------------ > Date: Mon, 26 Nov 2007 22:36:48 +0100 > From: rvirding@REDACTED > To: chsu79@REDACTED > CC: erlang-questions@REDACTED > Subject: Re: [erlang-questions] My biggest beef with Erlang > > On 26/11/2007, *Robert Virding* wrote: > > Scheme allows defining a prefix within the a symbol which means it refers > to another module (library for them) so you would write: > > (mod:func ... ) > > when you know where to go at compiletime. At least that's how I > interpreted the spec. Then for the general case you could use: > > (apply mod 'func ( ... )) > > or how about: > > (: mod func arg1 arg2 ... ) > > for all cases? > > > Equivalent to funcall in CL, this would be a remote funcall. Again a bit > heavy for the standard case. > > Of course some mailers might see that as a smiley. :-) > > Robert > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.regen@REDACTED Wed Nov 28 18:40:17 2007 From: michael.regen@REDACTED (Michael Regen) Date: Wed, 28 Nov 2007 18:40:17 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b08084c0711280845q4c7d6085t9e2ed6df8709a739@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <9b08084c0711280845q4c7d6085t9e2ed6df8709a739@mail.gmail.com> Message-ID: <9b59d0270711280940w3e284346qc066bf0c10a80a5e@mail.gmail.com> Indeed, very interesting. Thanks for sharing some invaluable experiences with us! We are currently in the process of selling a solution to a company. Because they know us quite well, I am very confident that the contract will be ours. I am not a sales person, obviously. But I would love to 'sell' them an Erlang solution because it would simply be the perfect fit for them. Unfortunately I very likely already know their argumentation against it (we also know them pretty well). The outcome will be Java. Yawn. They spend more, we get less at the end, they get a less powerful solution and we have less fun developing and supporting it. What a pity! Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomaswhitcomb@REDACTED Wed Nov 28 17:43:38 2007 From: thomaswhitcomb@REDACTED (Tom Whitcomb) Date: Wed, 28 Nov 2007 08:43:38 -0800 (PST) Subject: [erlang-questions] separating application from gen server Message-ID: <194813.77080.qm@web42107.mail.mud.yahoo.com> Ahhh. Perfect. The application;get_application is just what I need. Thanks. tom ----- Original Message ---- > From: Ulf Wiger (TN/EAB) > To: Tom Whitcomb > Cc: erlang-questions@REDACTED > Sent: Wednesday, November 28, 2007 12:44:49 AM > Subject: Re: [erlang-questions] separating application from gen server > > Tom Whitcomb skrev: > > Hi, > > > > I want to use application:get_env in my gen_server but it feels wrong > > to create a dependency between my gen_server and a > specific > application. > > > > Is there a recommended way for a gen_server to receive and reference > > the application that contains it? > > application:get_application() -> {ok, AppName} | undefined > > will return the name of the application which contains > the current process. > > application:get_env(Par) -> {ok, Val} | undefined > > will get the environment variable Par from the current > application. get_env(AppName, Par) will get it from the > specified application. > > > BR, > Ulf W > From dfeustel@REDACTED Wed Nov 28 18:44:35 2007 From: dfeustel@REDACTED (YANSWBVCG) Date: Wed, 28 Nov 2007 18:44:35 +0100 (CET) Subject: [erlang-questions] test driven development In-Reply-To: <1196006927.4533.1.camel@metalman.lan> Message-ID: <200711281744.lASHiZmw022952@morgoth.cslab.ericsson.net> On Sun, Nov 25, 2007 at 10:08:47AM -0600, mog wrote: > > On Sun, 2007-11-25 at 16:02 +0100, YANSWBVCG wrote: > > The Erlang graphics environment for debugging as described in the book > > _Programming Erlang_ appears not to work with the erl shell in the 64-bit > > AMD port of Erlang to OpenBSD 4.2. > > i imagine openbsd built it without requiring the tcl dependencies needed > for this. one trick is if they had installed the deps without the > libraries just install tcl, otherwise you will have to install tcl and > then build erlang from source > > mog I've got the graphics working now with one problem: the text in the tcl displays is only partially rendered. I think this stems from a mismatch between the 1440x900 pixels of the display and the 1280x1024 virtual resolution that Xorg comes up with when the display is configured. But I'm now sold on Erlang! From thomasl_erlang@REDACTED Wed Nov 28 18:54:43 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 28 Nov 2007 09:54:43 -0800 (PST) Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b08084c0711280845q4c7d6085t9e2ed6df8709a739@mail.gmail.com> Message-ID: <842070.97923.qm@web38802.mail.mud.yahoo.com> --- Joe Armstrong wrote: > Venture Capitalists are used to taking risks - the > argument over java > is extremely simple - > "if you use the same technology as everybody else > you will get the same result" Alteon had the right mindset too: they saw Erlang not as a risk but as a competitive advantage. So, in essence: try to skip the risk-averse ... Best, Thomas ____________________________________________________________________________________ Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/ From bob@REDACTED Wed Nov 28 19:00:36 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 28 Nov 2007 10:00:36 -0800 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b59d0270711280800m69140c55ke7b6c32daa5e525d@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> <474D87F6.9050607@ericsson.com> <185CD384-5011-484D-9642-B110B5AC34D3@gmail.com> <9b59d0270711280800m69140c55ke7b6c32daa5e525d@mail.gmail.com> Message-ID: <6a36e7290711281000q3ecb5d53je8ea80781832d515@mail.gmail.com> On 11/28/07, Michael Regen wrote: > On Nov 28, 2007 4:04 PM, Joel Reymont wrote: > > I may be wrong here but the advantages of using Java over Erlang for > > the CIO lie not so much in the technical merits of Java as in the deep > > pool of Java developers. > > On Nov 28, 2007 4:11 PM, Sean Hinde wrote: > > My experience has shown that if you want to persuade a CIO of this > > mindset to use a new fancy programming language, then the choice of VM > > is a detail of miniscule importance. > > > Arguments are much more about support, availability of programming > > resource (including option to outsource if the in house team proves > > too troublesome or expensive) etc etc. > > I was silently referring to outsourced or ready to buy solutions. Where CIO > dream about: No in-house development but outsourcing and buying solutions. > And technologies like SOA, etc. give you interoperability. > I was approaching the topic rather from the external integrator's view - not > from the internal perspective. And then the pool of developers, support, > etc. is your problem regardless of your solution's programming language. > > Your customer's CIO wants a solution which works, is cheap, future proof, > reliable and fits into the company's strategic and environment. Not > necessarily in this order. > Under this scenario the least they want to do is to touch your solution's > code. Which makes the underlying programming language not _that_ important. > More important are of course your qualities as an integrator/solution > provider (many different aspects) and: Does this solution fit into my > environment? Is this VM really stable? Who is Ericsson? (SCNR) Can we trust > the solution's stability given that not many other companies have any > experince with it and my CIO magazine never mentioned a product based on the > whole concept? Is it based on technologies we already use or do I have to > send all our admins to courses? Etc, etc. > > If we can say, our solution is based on Erlang but it runs in your well > known and proven Java environment, you can much easier give answers to their > questions. BTW: this is also true if you see it from the internal viewpoint. If someone were to release Erlang for the JVM or CLR tomorrow I probably wouldn't want to go near it for at least a year or three even if it was faster or if I had a use for the additional in-process libraries. One of the biggest reasons that I decided to standardize on Erlang as one of the accepted languages for my company is that it actually works *today*, and I don't really have to worry about the implementation because it has an excellent track record. We've found a few warts in the past year, but nothing that caused us more than temporary problems. For the most part we've ended up with applications that work as they're supposed to and we've been able to build them on or ahead of schedule and we don't have to take things down when we want to fix things. I really don't see the point of discussing Erlang on other VMs unless someone actually builds one worth talking about. How about you guys start another mailing list for talking about alternative Erlang implementations? I'd rather not have to read about it here. -bob From david.hopwood@REDACTED Wed Nov 28 19:00:34 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Wed, 28 Nov 2007 18:00:34 +0000 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <310035.59131.qm@web60520.mail.yahoo.com> References: <310035.59131.qm@web60520.mail.yahoo.com> Message-ID: <474DACC2.10104@industrial-designers.co.uk> Isaac Gouy wrote: > --- David Hopwood wrote: > > -snip- >> As for the 'shootout', most of the criticisms of it in this thread >> have been valid; it's not a very good basis for comparison of >> language performance. > > Puzzled. > > afaict most of the comments in this thread have been about benchmarks > in general and not about the benchmarks game in particular, so the way > you state your opinion is uninformative. Then let me be more specific. From the FAQ at : # CPU Time means program usr+sys time (in seconds) which includes the # time taken to startup and shutdown the program. For language # implementations that use a Virtual Machine the CPU Time includes # the time taken to startup and shutdown the VM. This is an elementary error, sufficiently serious that it's not enough just for the FAQ to mention it in passing. It systematically biases the results against language implementations with a significant startup/shutdown time, or other fixed overheads. Combined with the fact that most of the benchmarks only run for a few seconds, the resulting bias is quite large. Note that just subtracting the time taken by the "startup benchmark" would not be sufficient to remove this bias, because of variations in startup/shutdown/overhead time between programs (even if the comparison graphs were set up to do that). The other main factor that makes the shootout almost useless for language comparison, is the widely differing amount of optimization effort put into the code submissions. -- David Hopwood From igouy2@REDACTED Wed Nov 28 19:20:59 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 28 Nov 2007 10:20:59 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474D227F.2040805@ericsson.com> Message-ID: <376840.35666.qm@web60517.mail.yahoo.com> --- Bengt Kleberg wrote: -snip- > however, at this time i really would like for you, Isaac Gouy, to do > more work when it comes to answering emails in this thread. it is not > pressing, take your time, but i have one outstanding question that i > would appreciate if you answered so that i may move on with the rest. When you asked a meta-question > > what does this question have to do with the subject matter of this > > discussion? and ignored all parts of my post that directly addressed what you read into Kernighan and Van Wyk, it seemed to me you did not want to discuss the comments you had made, and it wasn't so important to me that I would harass you until you answered. I'll make it easy for you - the question has nothing to do with the subject matter of this discussion - it's an aside. I asked that you quote the exact words where "kvw recommends investigating" a wide spectrum of inputs. ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From cthulahoops@REDACTED Wed Nov 28 19:31:17 2007 From: cthulahoops@REDACTED (Adam Kelly) Date: Wed, 28 Nov 2007 18:31:17 +0000 Subject: [erlang-questions] separating application from gen server In-Reply-To: References: <321126.9350.qm@web42106.mail.mud.yahoo.com> <474D2A81.30506@ericsson.com> Message-ID: <8d1798e90711281031y5f40bd14hd14bccfd17dc20bb@mail.gmail.com> On Nov 28, 2007 1:14 PM, Ludovic Coquelle wrote: > Usually I let the application get the config variables, and start the > gen_server with the good params. So that only application manage its config > (through a dedicated module, such that it is easy to move the config from > env to DB or other file ... I did need to parse a ini file once :( ). > Something in the line of: Yes, that's my rule as well. gen_servers and supervisors aren't allowed query the application configuration. I end up with this pattern all the time: -module(myapp). start(_Type, _Args) -> Options = application:get_all_env(myapp), my_supervisor:start(Options). Then I can pretty much always test gen_servers and supervisors in isolation without running up the whole application, recombine them in different ways to form different applications, etc. There's some complications (how do you deal with configuration changes at run-time?) but it basically works well. Is this a common strategy? Adam. From david_holz@REDACTED Tue Nov 27 19:10:21 2007 From: david_holz@REDACTED (David Holz) Date: Tue, 27 Nov 2007 18:10:21 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <9b08084c0711270537n4d4a3449m742f5d57485b4045@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <9b08084c0711270052s7017affaua7bfd59b81747669@mail.gmail.com> <474BE5F4.4090705@lionet.info> <3dbc6d1c0711270304x2ec3cefbme91d5040bb7251b0@mail.gmail.com> <9b08084c0711270537n4d4a3449m742f5d57485b4045@mail.gmail.com> Message-ID: From: erlang@REDACTED > This would complete destroy all our well thought out pattern matching > optimisations that take place > when compiling foo. > > The point of having a limited set of fixed guard tests is we can > analyse these at compile time and generate > an efficient matching tree. I've looked at the generated Beam code for a few cases, and it does look pretty tight. I can't imagine, though, that the Ug in here > foo(...) when G1 -> ... > foo(...) when G2 -> ... > ... > foo(...) when Gn; Ug -> > ... > foo(...) when Gn -> ... would eliminate all the optimizations that apply to G1...Gn-1. I would think that the optimizer could just consider the Gn; Ug clause as "already optimized", just like it would with a guard-bif clause that can't be optimized for other reasons, and continue cranking on the rest. > If you want to extend the control structures with your own guards and > roll your own syntactic constructs use > funs and simulate monads or whatever - that's what funs are for. Yes, but it's far more syntactically orthogonal (not to mention MUCH shorter) to just be able to put the calls into the guard clauses. It's definitely an ease-of-human-use vs ease-of-computation tradeoff here, and when you want the productivity and clarity benefits of having it all in the guards regardless of it running a bit slower, it'd be nice to have that option. It's hard to maintain any sense of design encapsulation with deeply nested structures if you can't defer matching to user-defined predicate functions without jumping through extra hoops, especially when the code is young and structures change as the program grows. Of course, another option is to use a parse transform to inline your user-defined fun bodies directly into the guard expressions, but that's pretty hackish. _________________________________________________________________ Put your friends on the big screen with Windows Vista? + Windows Live?. http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_102007 From itlists@REDACTED Wed Nov 28 19:59:37 2007 From: itlists@REDACTED (Marten Feldtmann) Date: Wed, 28 Nov 2007 19:59:37 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <842070.97923.qm@web38802.mail.mud.yahoo.com> References: <842070.97923.qm@web38802.mail.mud.yahoo.com> Message-ID: <474DBA99.2090001@schrievkrom.de> Thomas Lindgren schrieb: > Alteon had the right mindset too: they saw Erlang not > as a risk but as a competitive advantage. So, in > essence: try to skip the risk-averse ... > > Best, > Thoma The same sentence can be heard in the Smalltalk community again and again - but this is not really interesting in the mainstream and it does not produce jobs very often. I've heard a talk about a SAP group creating a working prototype using Smalltalk for a problem in within one week where other groups in SAP were working several month on it - without a solution. Actually after getting the solution with several customers they gave it to another group in SAP and to programmers in india to reimplement the job in Java again. Summary: good reputation, but that's it. There were also discussions about putting Smalltalk on the JVM - most of the people agree, that this might bring more Smalltalk developers to the community - but also most of the people agree, that this will also kill the technological advantages of Smalltalk - e.g. the light processes within the image and the tremendous highly interactive GUI. I actually think, that success of languages are based either on enormous financial power/interests (Microsoft, IBM, SUN) - or on other issues like c syntax, flat source code managements like CVS or Subversion, Eclipse - actually we have to deal with programmers, which are mostly human beings. Life can be very simple. Marten From yarivsadan@REDACTED Wed Nov 28 20:13:45 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Wed, 28 Nov 2007 11:13:45 -0800 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> Message-ID: <17244f480711281113s5c7d425fh9c7b4ce1b5fda09e@mail.gmail.com> > Dave Thomas of Pragmatic Programmers is rolling out courses together > with Joe Armstrong but Erlang will keep being a novelty for some time > to come. The biggest impact that YOU can make is to roll out cool > Erlang-based projects. > > CouchDB counts, Erlyweb not so much. People want to buy 1/4 holes and > not 1/4 drills. "CouchDB counts, ErlyWeb not so much". Do you care to explain that? I think ErlyWeb will do much more for Erlang's spread and adoption than CouchDB. Users of CouchDB you don't need to know squat about Erlang except for maybe how to install it. ErlyWeb provides developers the best set of tools to build something -- in Erlang -- that other people use. I would argue that without a web framework like ErlyWeb, Erlang will never be popular. Look at PHP, Ruby, Python, even C# and Java. Those languages have gotten popular because they cater to the needs of web developers. If there's no way to easily build web applications in a given language, much fewer independent developers will use it, even just for experimentation. As web servers gain more and more cores, I predict that ErlyWeb will start to gain more and more adoption from developers who currently use Ruby on Rails, which requires 30MB of RAM (!) for each process. Putting aside subjective arguments, ErlyWeb has been downloaded thousands of times and its mailing list has 251 developers compared to CouchDB's 182. Cheers, Yariv From igouy2@REDACTED Wed Nov 28 19:26:39 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 28 Nov 2007 10:26:39 -0800 (PST) Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <6a36e7290711281000q3ecb5d53je8ea80781832d515@mail.gmail.com> Message-ID: <566273.62738.qm@web60512.mail.yahoo.com> --- Bob Ippolito wrote: -snip- > I really don't see the point of discussing Erlang on other VMs unless > someone actually builds one worth talking about. How about you guys > start another mailing list for talking about alternative Erlang > implementations? I'd rather not have to read about it here. Whether or not it's off-topic for this list, if the discussion does progress then there might be some practical help in a forum like "JVM languages" http://groups.google.com/group/jvm-languages?lnk=srg ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From igouy2@REDACTED Wed Nov 28 19:45:05 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 28 Nov 2007 10:45:05 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474DACC2.10104@industrial-designers.co.uk> Message-ID: <120350.62533.qm@web60511.mail.yahoo.com> --- David Hopwood wrote: -snip- > Then let me be more specific. Thank you for being more specific. > From the FAQ at : > > # CPU Time means program usr+sys time (in seconds) which includes the > # time taken to startup and shutdown the program. For language > # implementations that use a Virtual Machine the CPU Time includes > # the time taken to startup and shutdown the VM. > > This is an elementary error, sufficiently serious that it's not > enough just for the FAQ to mention it in passing. It systematically > biases the results against language implementations with a significant > startup/shutdown time, or other fixed overheads. Combined with the > fact that most of the benchmarks only run for a few seconds, the > resulting bias is quite large. Specifically how large is the resulting bias? Is it large enough that we should reassess the 97.6 seconds that the HiPE program takes for fannkuch down to the 5.99 seconds taken by the C program, or only large enough that we should reassess it to 97.0 seconds? I do remember a comment from Ulf Wiger to the effect that the Erlang VM seemed to reach peak performance after 24 hours of constant load, which he thought very appropriate given the intended uses. -snip- > The other main factor that makes the shootout almost useless for > language comparison, is the widely differing amount of optimization > effort put into the code submissions. Firstly, I think that may be a criticism of benchmarks in general, I don't recall seeing published benchmarks with a statement of how much optimization effort was put into each program. Secondly, I don't think you know that there was a widely differing optimization effort - it's just an assumption. ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From fritchie@REDACTED Wed Nov 28 20:46:47 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 28 Nov 2007 13:46:47 -0600 Subject: [erlang-questions] how to trace gen_servers? In-Reply-To: Message of "Mon, 26 Nov 2007 12:37:17 +0100." <474AAFED.6070709@fiit.stuba.sk> Message-ID: <200711281946.lASJklaw004714@snookles.snookles.com> I haven't seen a reply yet to this message ... >>>>> "mk" == Matej Kosik writes: mk> Is there a way how to customize information that gets logged into mk> file when I turn on the `log_to_file' option for my gen_servers? I don't see an easy one. A quick read of the mechanism in stdlib's sys.erl suggests that it's configurable via a handler func (FormFunc), but I don't see how to override the default in gen_server. If there is such a thing, it's hiding well. :-) You probably want to use the system trace facility, anyway. It's much more flexible, at the expense of being more flexible and thus more difficult to use. See the 'dbg' module (in the docs: Tool Applications -> runtime_tools -> dbg) or the tracing frameworks built on top of dbg (in the docs: Tool Applications -> et or inviso or observer). mk> Not very nice but partially useful. The state (dictionary) is mk> serialized in unusable way but this is not the primary problem. That's the way dicts look. Ulf Wiger's recently-discussed shell hackery wouldn't make those look any different, because (AFAIK) his shell hooks wouldn't be called by io_lib:format() or whatever is doing that formatting. You can also write your own gen_server behavior that'll do exactly the logging that you want, then call gen_server:CallBackFunc() to do your "real work". -Scott From bfulg@REDACTED Wed Nov 28 19:53:02 2007 From: bfulg@REDACTED (Brent Fulgham) Date: Wed, 28 Nov 2007 10:53:02 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism Message-ID: <375691.17118.qm@web81211.mail.mud.yahoo.com> David Hopwood wrote: > Then let me be more specific. From the FAQ at > : > > # CPU Time means program usr+sys time (in seconds) which includes the > # time taken to startup and shutdown the program. For language > # implementations that use a Virtual Machine the CPU Time includes > # the time taken to startup and shutdown the VM. > > This is an elementary error, sufficiently serious that it's not enough > just for the FAQ to mention it in passing. It systematically biases the > results against language implementations with a significant startup/shutdown > time, or other fixed overheads. Combined with the fact that most of the > benchmarks only run for a few seconds, the resulting bias is quite large. I disagree. *Some* languages manage to complete the tasks in a few seconds, but the range of results varies widely. Take as an example the Fannkuch benchmark (http://shootout.alioth.debian.org/debian/benchmark.php?test=fannkuch?=all), where the fastest result on my system is about 6 seconds for N=11, and the slowest Ruby at ~30 minutes. Your assertion that "most" run for a few seconds is incorrect. I'm sorry we don't have tests than run for days (many do run for hours on certain language implementations), but there are some limits to what we can do as a matter of practicality. A full run of the benchmark already takes over 24 hours on my system. > Note that just subtracting the time taken by the "startup benchmark" would > not be sufficient to remove this bias, because of variations in > startup/shutdown/overhead time between programs (even if the comparison > graphs were set up to do that). At one time we did subtract the "startup benchmark" time to try to avoid this problem, but this also resulted in various cries of foul play. > The other main factor that makes the shootout almost useless for > language comparison, is the widely differing amount of optimization > effort put into the code submissions. It's a case of Garbage In/Garbage Out. If people feel see opportunities to optimize the programs, and those optimizations do not cause the entry to violate the guidelines (e.g., the Haskell compilers are good at optimizing away meaningless computations, which makes it hard to compare apples-to-apples) we use the revised program. Of course, it is easier for people to complain than it is to suggest optimizations or provide better solutions. -Brent From jao@REDACTED Wed Nov 28 20:58:25 2007 From: jao@REDACTED (Jack Orenstein) Date: Wed, 28 Nov 2007 14:58:25 -0500 (EST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <120350.62533.qm@web60511.mail.yahoo.com> References: <120350.62533.qm@web60511.mail.yahoo.com> Message-ID: <15622.207.190.221.98.1196279905.squirrel@geophile.com> Going off on a hopefully interesting tangent ... On Wed, November 28, 2007 1:45 pm, Isaac Gouy wrote: > > I do remember a comment from Ulf Wiger to the effect that the Erlang VM > seemed to reach peak performance after 24 hours of constant load, which > he thought very appropriate given the intended uses. Can someone confirm this and explain the cause? I have worked in Java for many years and learning Erlang now. There is a similar phenomenon in Java as the just-in-time compiler compiles frequently used code paths. But for the applications I've worked on, this tends to get done within the first few minutes or hours. Is it the same sort of thing going on in Erlang? If not, then what is the cause of the speedup (and why 24 hours)? Jack Orenstein From eajam@REDACTED Wed Nov 28 20:53:22 2007 From: eajam@REDACTED (eajam@REDACTED) Date: Wed, 28 Nov 2007 19:53:22 +0000 Subject: [erlang-questions] My biggest beef with Erlang In-Reply-To: <3dbc6d1c0711280846g6e70e4d2n447e937b5ea0ade3@mail.gmail.com> References: <0c3664ab49a3bbc39d40874f75402cc3@tombob.com> <6605FFC7-BCF9-440E-AB92-9C2FECCA4932@gmail.com> <3dbc6d1c0711261332j5716573el8550d6799366b095@mail.gmail.com> <3dbc6d1c0711261336p63f8c173o5f5bb71d8a20b4a0@mail.gmail.com> <3dbc6d1c0711280846g6e70e4d2n447e937b5ea0ade3@mail.gmail.com> Message-ID: Thanks for clearing that up. But then again, that suggestion would make it more Lispy, and I suppose would be quite a change for the tokenizer. Although this is certainly just talking, not like if anything like this will actually be necessarily implemented, but wouldn't it be more Erlang to have mod::func(...), rather than (: mod func ... ) Irrelevant of the form used, the point is to accept the basic syntax of the language and expand on it, not make it look like my favorite language X or Y. Cheers, Alex Date: Wed, 28 Nov 2007 17:46:32 +0100From: rvirding@REDACTED: eajam@REDACTED: Re: [erlang-questions] My biggest beef with ErlangCC: erlang-questions@REDACTED would more translate it as:mod:func( ... ) == (remote-call 'mod 'func ... )Mod:func( ... ) == (remote-call mod 'func ... )apply(Mod, Func, [...]) == (apply mod func (...)) You could actually skip remote-call and just have apply, it would be no problem for the compiler to detect the case when the argument list is known.Someone came with perfectly reasonable suggestion of having a macro for the more usual case: (: mod func ... ) ==> (remote-call 'mod 'func ... )Robert On 26/11/2007, Alex Alvarez < eajam@REDACTED> wrote: Maybe I'm missing something here, but isn't this exactly like Erlang? (mod:func ... ) == mod:func(...)(apply mod 'func ( ... )) == apply(mod, func, ...)Obviously, the syntax changes a little bit, but all the functionality is there already. Actually, Erlang looks a lot cleaner from my view...Cheers, Alex Date: Mon, 26 Nov 2007 22:36:48 +0100From: rvirding@REDACTED: chsu79@REDACTED: erlang-questions@REDACTED: Re: [erlang-questions] My biggest beef with Erlang On 26/11/2007, Robert Virding wrote: Scheme allows defining a prefix within the a symbol which means it refers to another module (library for them) so you would write:(mod:func ... )when you know where to go at compiletime. At least that's how I interpreted the spec. Then for the general case you could use: (apply mod 'func ( ... ))or how about:(: mod func arg1 arg2 ... )for all cases? Equivalent to funcall in CL, this would be a remote funcall. Again a bit heavy for the standard case. Of course some mailers might see that as a smiley. :-)Robert_______________________________________________erlang-questions mailing listerlang-questions@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Wed Nov 28 22:20:14 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 22:20:14 +0100 Subject: [erlang-questions] how to trace gen_servers? In-Reply-To: <200711281946.lASJklaw004714@snookles.snookles.com> References: <200711281946.lASJklaw004714@snookles.snookles.com> Message-ID: <474DDB8E.6010800@ericsson.com> Scott Lystig Fritchie skrev: > > That's the way dicts look. Ulf Wiger's recently-discussed shell > hackery wouldn't make those look any different, because (AFAIK) his > shell hooks wouldn't be called by io_lib:format() or whatever is doing > that formatting. Actually, it might. (: At least I started looking at that. I was trying to come up with a good way for e.g. dict to register an output filter, so that each shell instance would automatically (configurably) pick it up. Each call to io:format(Format, Args) actually results in a message, {put_chars,io_lib,format,[Format,Args]} to an io server, so it could of course be trapped and in part diverted to io_lib_pretty:print(Term, ...), which is the function that is able to do the filtering. The problem lies in that the Erlang IO subsystem is so pluggable, that it's difficult to know just what code is going to process the io_request, and for what purpose. In many cases, automatic filtering could be every bit as bad as it would be to automatically truncate the output and replace with "...", as the shell tends to do. Finding out how to turn on filtering in just the right processes, and only when desired, was the tricky part, which I decided to leave for (much) later. BR, Ulf W From jmeinhorn@REDACTED Wed Nov 28 22:21:36 2007 From: jmeinhorn@REDACTED (Jeff Einhorn) Date: Wed, 28 Nov 2007 13:21:36 -0800 (PST) Subject: [erlang-questions] Simulating an EAP Authentication Message-ID: <1c0d320c-548e-40f1-8f2d-08f2c0b3076b@d27g2000prf.googlegroups.com> Has anyone used Erlang to simulate an EAP authentication? Thanks, Jeff Einhorn From ulf.wiger@REDACTED Wed Nov 28 22:21:53 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 28 Nov 2007 22:21:53 +0100 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <15622.207.190.221.98.1196279905.squirrel@geophile.com> References: <120350.62533.qm@web60511.mail.yahoo.com> <15622.207.190.221.98.1196279905.squirrel@geophile.com> Message-ID: <474DDBF1.9080201@ericsson.com> Jack Orenstein skrev: > Going off on a hopefully interesting tangent ... > > On Wed, November 28, 2007 1:45 pm, Isaac Gouy wrote: >> I do remember a comment from Ulf Wiger to the effect that the Erlang VM >> seemed to reach peak performance after 24 hours of constant load, which >> he thought very appropriate given the intended uses. > > Can someone confirm this and explain the cause? > > I have worked in Java for many years and learning Erlang now. There > is a similar phenomenon in Java as the just-in-time compiler compiles > frequently used code paths. But for the applications I've worked on, > this tends to get done within the first few minutes or hours. > > Is it the same sort of thing going on in Erlang? If not, then what > is the cause of the speedup (and why 24 hours)? I'm sorry I can't, at least. I'm not going to say that I've never said it, but at least I can't recall when, and in which context. (: BR, Ulf W From michael.campbell@REDACTED Wed Nov 28 17:21:06 2007 From: michael.campbell@REDACTED (Michael Campbell) Date: Wed, 28 Nov 2007 11:21:06 -0500 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <185CD384-5011-484D-9642-B110B5AC34D3@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> <474D87F6.9050607@ericsson.com> <185CD384-5011-484D-9642-B110B5AC34D3@gmail.com> Message-ID: <811f2f1c0711280821q21d48a2ey6c8ebad2af10e801@mail.gmail.com> I dont know how many hours are in your day but if the OTPs day is like mine, I suspect that is a major reason... On 11/28/07, Joel Reymont wrote: > > On Nov 28, 2007, at 3:23 PM, Ulf Wiger (TN/EAB) wrote: > > > I personally doubt that performance would be sufficient for a GUI- > > intensive app. > > > Why not try? > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Wed Nov 28 22:25:42 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 28 Nov 2007 13:25:42 -0800 (PST) Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474DBA99.2090001@schrievkrom.de> Message-ID: <288052.36081.qm@web38806.mail.mud.yahoo.com> --- Marten Feldtmann wrote: > Thomas Lindgren schrieb: > > Alteon had the right mindset too: they saw Erlang > not > > as a risk but as a competitive advantage. So, in > > essence: try to skip the risk-averse ... > > > > Best, > > Thoma > The same sentence can be heard in the Smalltalk > community > again and again - but this is not really interesting > in the > mainstream and it does not produce jobs very often. > > I've heard a talk about a SAP group creating a > working prototype > using Smalltalk for a problem in within one week > where other groups > in SAP were working several month on it - without a > solution. > > Actually after getting the solution with several > customers they > gave it to another group in SAP and to programmers > in india to > reimplement the job in Java again. > > Summary: good reputation, but that's it. /.../ > I actually think, that success of languages are > based either on > enormous financial power/interests (Microsoft, IBM, > SUN) - or > on other issues like c syntax, flat source code > managements like > CVS or Subversion, Eclipse - actually we have to > deal with > programmers, which are mostly human beings. Life can > be very simple. In that case, don't worry about the issue. It has already been decided. (If it's any consolation, Erlang had about the same experience inside of Ericsson. It's a big enterprise thing, I guess.) Best, Thomas ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From listproc@REDACTED Wed Nov 28 23:04:48 2007 From: listproc@REDACTED (Ukyo Virgden) Date: Thu, 29 Nov 2007 00:04:48 +0200 Subject: [erlang-questions] newbie question Message-ID: Hi, I've just jumped into Erlang. Almost finished reading Joe Armstrong's book. While testing with mnesia, I've come across a problem I hope you guys can shed a light. Consider I have records like (count, item, user) {4, apple, john} {7, apple, mary} {3, oranges, jane} {2, oranges, john} {2, bananas, mary} {5, bananas, jane} {2, bananas, john} I can store in mnesia and retrieve with qlc. But I could not "group" them. I figured out how inappropriate it'd be to ask is qlc has a facility like SQL GROUP BY. :) Can anybody help me how can I group returned list? Or in other words, how can I apply an aggregate function to get sum of items, count of items etc.? I've already figured out I can send my process some messages and collect data but I believe that'd be slower than being able to write a recursive function. I'd appreciate if you could provide some pointers to resources for functional programming techniques in Erlang. Thanks in advance Ukyo Virgden From igouy2@REDACTED Wed Nov 28 22:07:55 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 28 Nov 2007 13:07:55 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <15622.207.190.221.98.1196279905.squirrel@geophile.com> Message-ID: <916459.2188.qm@web60515.mail.yahoo.com> --- Jack Orenstein wrote: > Going off on a hopefully interesting tangent ... > > On Wed, November 28, 2007 1:45 pm, Isaac Gouy wrote: > > > > I do remember a comment from Ulf Wiger to the effect that the > Erlang VM > > seemed to reach peak performance after 24 hours of constant load, > which > > he thought very appropriate given the intended uses. > > Can someone confirm this and explain the cause? Perhaps it was an off-the-cuff remark that was not intended to be taken too seriously ;-) > I have worked in Java for many years and learning Erlang now. There > is a similar phenomenon in Java as the just-in-time compiler compiles > frequently used code paths. But for the applications I've worked on, > this tends to get done within the first few minutes or hours. For some of the tiny benchmarks game programs http://shootout.alioth.debian.org/gp4/miscfile.php?file=dynamic&title=Java%20Dynamic%20Compilation ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From jeffm@REDACTED Wed Nov 28 23:35:17 2007 From: jeffm@REDACTED (jm) Date: Thu, 29 Nov 2007 09:35:17 +1100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: References: <474D2E90.80603@ericsson.com> Message-ID: <474DED25.7060708@ghostgun.com> Bjorn Gustavsson wrote: > It could also be possible to somewhat shrink the Beam code to > better use the larger word size (packing more operands into one word). > The savings would probably be minor, but could be still be worthwhile > as it is relatively straight-forward to do. Would this be something like ARM's thumb code (http://en.wikipedia.org/wiki/ARM_architecture#Thumb) or more like lzw compression of blocks of code? Jeff. From jeffm@REDACTED Thu Nov 29 00:17:46 2007 From: jeffm@REDACTED (jm) Date: Thu, 29 Nov 2007 10:17:46 +1100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> Message-ID: <474DF71A.8020507@ghostgun.com> Joel Reymont wrote: > On Nov 28, 2007, at 2:35 PM, Michael Regen wrote: > CouchDB counts, Erlyweb not so much. People want to buy 1/4 holes and > not 1/4 drills. Be bold, go beyond what other people have gone before > you. Push Erlang towards unproven applications, don't push Erlang into > the "enterprise". Once the enteprise is awed, Erlang will make its way > into the enterprise. You seem to be talking about employing the same strategy that Komatsu does against its competitor Caterpillar. That of encircling the competitor like a python and doing all the periphery product offerings better than the competitor then moving towards their core (the enterprise in the case of Java) leaving them no where to go. Jeff. From joelr1@REDACTED Thu Nov 29 00:27:16 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 28 Nov 2007 23:27:16 +0000 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <17244f480711281113s5c7d425fh9c7b4ce1b5fda09e@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <17244f480711281113s5c7d425fh9c7b4ce1b5fda09e@mail.gmail.com> Message-ID: <15668FE4-FB20-458E-8F8D-623D69B4E49A@gmail.com> On Nov 28, 2007, at 7:13 PM, Yariv Sadan wrote: >> "CouchDB counts, ErlyWeb not so much". Do you care to explain that? Sure. This was not meant to diminish your by all accounts excellent efforts. It simply reflects my belief that customers buy (and are impressed by) 1/4 holes as opposed to 1/4 drills. Solutions sell much better than tools. People who use CouchDB will likely be impressed by the features it acquires from Erlang and will try to dig deeper. People who come to ErlyWeb from Rails will mostly be poking holes in ErlyWeb and complaining about the features that it's missing. -- http://wagerlabs.com From toby@REDACTED Thu Nov 29 00:46:18 2007 From: toby@REDACTED (Toby Thain) Date: Wed, 28 Nov 2007 21:46:18 -0200 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <9b08084c0711280845q4c7d6085t9e2ed6df8709a739@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <9b08084c0711280845q4c7d6085t9e2ed6df8709a739@mail.gmail.com> Message-ID: <1979C9B7-0B73-4483-966D-BB5B793F6F1E@smartgames.ca> On 28-Nov-07, at 2:45 PM, Joe Armstrong wrote: > ... YOU CAN'T SELL TO THE MAINSTREAM. I have wasted years of my life > trying to do this - do you know how many grey hairs I have? One for > each person like this. > ... Some guys at a business > school should do case-studies on the actual mechanism involved in > technology transfer and not the crap you read in books. > > ... That weeks work was critical for Wren and for the > architecture of London. > > If you're in one of these phases where things don't happen bide > your time. Write an operating system in your spare time ... +101 Insightful. Great post, Joe. --Toby > > /Joe Armstrong > > > From yarivsadan@REDACTED Thu Nov 29 00:52:00 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Wed, 28 Nov 2007 15:52:00 -0800 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <15668FE4-FB20-458E-8F8D-623D69B4E49A@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <17244f480711281113s5c7d425fh9c7b4ce1b5fda09e@mail.gmail.com> <15668FE4-FB20-458E-8F8D-623D69B4E49A@gmail.com> Message-ID: <17244f480711281552x230d0163tf2445b01399a9499@mail.gmail.com> On Nov 28, 2007 3:27 PM, Joel Reymont wrote: > > On Nov 28, 2007, at 7:13 PM, Yariv Sadan wrote: > > >> "CouchDB counts, ErlyWeb not so much". Do you care to explain that? > > Sure. This was not meant to diminish your by all accounts excellent > efforts. It simply reflects my belief that customers buy (and are > impressed by) 1/4 holes as opposed to 1/4 drills. Solutions sell much > better than tools. > > People who use CouchDB will likely be impressed by the features it > acquires from Erlang and will try to dig deeper. People who come to > ErlyWeb from Rails will mostly be poking holes in ErlyWeb and > complaining about the features that it's missing. > By the same logic, one could say that people who will try CouchDB will be poking holes and complaining about the features it lacks compared to other DBMS's, but they will be impressed by how ErlyWeb provides a great solution for building webapps -- which is, incidentally, the most popular need for developers these days -- in Erlang. You'd be surprised by how few useful features Rails has that ErlyWeb doesn't. And they can all be implemented in ErlyWeb fairly easily, whereas it will be very hard if not impossible to give Ruby developers a taste of Erlang style concurrency, fault tolerance, Mnesia, etc. Yariv From yarivsadan@REDACTED Thu Nov 29 00:57:01 2007 From: yarivsadan@REDACTED (Yariv Sadan) Date: Wed, 28 Nov 2007 15:57:01 -0800 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <17244f480711281552x230d0163tf2445b01399a9499@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <17244f480711281113s5c7d425fh9c7b4ce1b5fda09e@mail.gmail.com> <15668FE4-FB20-458E-8F8D-623D69B4E49A@gmail.com> <17244f480711281552x230d0163tf2445b01399a9499@mail.gmail.com> Message-ID: <17244f480711281557y35ea4be4ib4c4b2444a6f7640@mail.gmail.com> > > By the same logic, one could say that people who will try CouchDB will > be poking holes and complaining about the features it lacks compared > to other DBMS's, but they will be impressed by how ErlyWeb provides a > great solution for building webapps -- which is, incidentally, the > most popular need for developers these days -- in Erlang. > Btw, I didn't mean to imply that ErlyWeb is "better" for users or has any more merit than CouchDB -- just that your logic could be applied to anything. Yariv From joelr1@REDACTED Thu Nov 29 00:31:39 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 28 Nov 2007 23:31:39 +0000 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474DF71A.8020507@ghostgun.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <474DF71A.8020507@ghostgun.com> Message-ID: <08175112-DCFB-492F-B487-63841BA2C825@gmail.com> On Nov 28, 2007, at 11:17 PM, jm wrote: > You seem to be talking about employing the same strategy that Komatsu > does against its competitor Caterpillar. You are really giving me too much credit. "Blue Ocean Strategy" is an interesting book, though ;-). Thanks, Joel -- http://wagerlabs.com From jeffm@REDACTED Thu Nov 29 03:21:20 2007 From: jeffm@REDACTED (jm) Date: Thu, 29 Nov 2007 13:21:20 +1100 Subject: [erlang-questions] kara Message-ID: <474E2220.6080405@ghostgun.com> A while ago there was a thread on this list about an Erlang programming environment for teaching programming called "Kara". Is there a public release of this software available? Jeff. From david.hopwood@REDACTED Thu Nov 29 04:42:24 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Thu, 29 Nov 2007 03:42:24 +0000 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <375691.17118.qm@web81211.mail.mud.yahoo.com> References: <375691.17118.qm@web81211.mail.mud.yahoo.com> Message-ID: <474E3520.1010903@industrial-designers.co.uk> Brent Fulgham wrote: > David Hopwood wrote: >> Then let me be more specific. From the FAQ at >> : >> >> # CPU Time means program usr+sys time (in seconds) which includes the >> # time taken to startup and shutdown the program. For language >> # implementations that use a Virtual Machine the CPU Time includes >> # the time taken to startup and shutdown the VM. >> >> This is an elementary error, sufficiently serious that it's not enough >> just for the FAQ to mention it in passing. It systematically biases the >> results against language implementations with a significant >> startup/shutdown time, or other fixed overheads. Combined with the fact >> that most of the benchmarks only run for a few seconds, the resulting >> bias is quite large. > > I disagree. *Some* languages manage to complete the tasks in a few seconds, > but the range of results varies widely. *Most* benchmark runs complete in less than 30 seconds (see below). I didn't say anything about the range of results. > Your assertion that "most" run for a few seconds is incorrect. No, it is clearly correct. Proportion of language implementations for which each benchmark included in the default weighting takes less than 10, 30, and 60 seconds CPU time: <10s <30s <60s out of binary trees 19 (54%) 23 (66%) 25 (71%) 35 fannkuch 10 (26%) 22 (58%) 22 (58%) 38 fasta 0 (0%) 15 (37%) 20 (49%) 41 k-nucleotide 4 (12%) 16 (47%) 24 (71%) 34 mandelbrot 23 (61%) 24 (63%) 25 (66%) 38 n-body 0 (0%) 19 (51%) 23 (62%) 37 nsieve 27 (68%) 33 (83%) 37 (93%) 40 nsieve-bits 26 (65%) 32 (80%) 32 (80%) 40 partial-sums 22 (58%) 34 (89%) 38 (100%) 38 pidigits 27 (69%) 37 (95%) 38 (97%) 39 recursive 21 (55%) 24 (63%) 27 (71%) 38 regex-dna 19 (59%) 29 (91%) 30 (94%) 32 reverse-complement 35 (83%) 37 (88%) 40 (95%) 42 spectral-norm 0 (0%) 13 (38%) 19 (56%) 34 sum-file 23 (47%) 34 (69%) 40 (82%) 49 thread-ring 3 (23%) 3 (23%) 6 (46%) 13 total 259 (47%) 395 (72%) 446 (81%) 548 72% under 30 seconds is "most" in letter and spirit. (And yes, I have too much time on my hands :-) The times that take longer than a few seconds don't affect my point that there is systematic bias against language implementations with significant startup/shutdown times. Apart from the language implementations for which performance is not really a serious goal, many of the 'outlier' times are due to little or no attention having been paid to optimizing that benchmark submission, so that the result is pretty meaningless anyway. There are also many results at the low end of the CPU times that strain credibility, if they are supposed to be interpreted as useful comparisons of language implementation performance (even on hypothetical code for which that benchmark would be representative). For example, look at , and tell me you really believe that for 14 implementations of languages as different as C, Eiffel, Fortran, BASIC, Forth and Haskell, a range in CPU times from 2.07 to 2.12 seconds is accurately reflecting the relative performance of a na?ve Sieve of Eratosthenes on those implementations. Isn't it more likely that there is some source of constant overhead that is causing the variation between languages to be compressed? Another basic mistake is that there is no indication of the variation in timing between benchmark runs. At least, not without digging a bit deeper: the excluded "Haskell GHC #4" result for N=9 on nsieve is 1.12 s, but in the full results for nsieve-bits, the result for N=9 on exactly the same program run by the same language implementation is 0.80 s. So, we have some reason to believe that the timings for benchmark runs this short can vary by as much as 40% (greater than many of the differences between languages), and the site doesn't give us any evidence by which we could trust the timings to be more accurate than that. > I'm sorry we don't have tests than run for days You would have people draw conclusions from benchmarks that run for 2 seconds (even 0.55 s in some cases). That's ridiculous. It's a lesson in how not to do benchmarking. > (many do run for hours on certain language implementations), which, for these problem sizes, probably indicates only that the submitted code is unoptimized, and not suitable for use in a benchmark. > but there are some limits to what we can do as a matter of practicality. > A full run of the benchmark already takes over 24 hours on my system. That's because you're running lots of poorly optimized code that is not suitable for benchmarking. If, for the sake of argument, it were not possible to run this benchmark suite for long enough to get meaningful results, then that is not a justification for running it anyway, and publishing meaningless and misleading results. >> Note that just subtracting the time taken by the "startup benchmark" >> would not be sufficient to remove this bias, because of variations in >> startup/shutdown/overhead time between programs (even if the comparison >> graphs were set up to do that). > > At one time we did subtract the "startup benchmark" time to try to avoid > this problem, but this also resulted in various cries of foul play. As it should -- one better way to handle this problem is to make the run time long enough that the startup/shutdown/overhead time becomes insignificant (because that's what happens with real programs). >> The other main factor that makes the shootout almost useless for >> language comparison, is the widely differing amount of optimization >> effort put into the code submissions. > > It's a case of Garbage In/Garbage Out. It's a case of Garbage Out even for non-garbage input. Also, if the design of the benchmark suite and the submission rules are such that we might expect much of the input to be "garbage", then it's reasonable to criticise that design, not the individual submissions. > If people feel see opportunities to optimize the programs, and those > optimizations do not cause the entry to violate the guidelines > (e.g., the Haskell compilers are good at optimizing away meaningless > computations, which makes it hard to compare apples-to-apples) > we use the revised program. If a Haskell (or any other) compiler is able to optimize away a substantial part of the computation intended to be performed by a benchmark, that indicates it wasn't a very good benchmark, even for the language implementations that don't do this optimization. Put it this way: why would we want to know the performance of a meaningless computation? The output of a good benchmark is specified in such a way that all of the intended computation is required in order to generate it. But if one language implementation does manage to "optimize out" more of the computation for a given submission than another, then a policy of excluding these submissions is inequitable: how do we know that the optimization isn't improving the performance of the real programs that the benchmark is supposed to be representative of? (Presumably it is in at least some cases, otherwise the compiler developers wouldn't have put effort into implementing it.) As for accepting revisions, that's fine as far as it goes, but it doesn't go far enough. To trust the results of a comparison, I don't need to know that anyone *could* improve each submission, I need to know that the benchmark submissions that are used in that comparison *have* all been reasonably well optimized. Unless I review the submissions myself (assuming that I'm a competent programmer in the languages concerned), how am I supposed to know that? And having each potential user of the site do that review, obviously isn't an efficient use of their time. There isn't even any way to express comments about a submission that can be seen by other users. > Of course, it is easier for people to complain than it is to suggest > optimizations or provide better solutions. It is not my responsibility to fix elementary errors in the design of the 'shootout'. To achieve my immediate goal of having fewer people be misled by treating it as a useful way of comparing performance of language implementations, I only need to point out these errors. -- David Hopwood From david.hopwood@REDACTED Thu Nov 29 06:09:56 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Thu, 29 Nov 2007 05:09:56 +0000 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <120350.62533.qm@web60511.mail.yahoo.com> References: <120350.62533.qm@web60511.mail.yahoo.com> Message-ID: <474E49A4.4060509@industrial-designers.co.uk> Isaac Gouy wrote: > --- David Hopwood wrote: > -snip- >> Then let me be more specific. > > Thank you for being more specific. > >> From the FAQ at : >> >> # CPU Time means program usr+sys time (in seconds) which includes the >> # time taken to startup and shutdown the program. For language >> # implementations that use a Virtual Machine the CPU Time includes >> # the time taken to startup and shutdown the VM. >> >> This is an elementary error, sufficiently serious that it's not >> enough just for the FAQ to mention it in passing. It systematically >> biases the results against language implementations with a >> significant startup/shutdown time, or other fixed overheads. Combined >> with the fact that most of the benchmarks only run for a few seconds, >> the resulting bias is quite large. > > Specifically how large is the resulting bias? Probably about 10% in some cases (for JVM-based implementations and Smalltalk). > Is it large enough that we should reassess the 97.6 seconds that the > HiPE program takes for fannkuch down to the 5.99 seconds taken by the C > program, or only large enough that we should reassess it to 97.0 > seconds? My comments were not in any way specific to Erlang. (For Erlang, you should be looking at the effect on the pidigits benchmark, for example, which takes 4.36 seconds in HiPE.) The largest bias is likely to be against the JVM-based language implementations (Java, Nice, CAL and Scala) and Smalltalk. > -snip- >> The other main factor that makes the shootout almost useless for >> language comparison, is the widely differing amount of optimization >> effort put into the code submissions. > > Firstly, I think that may be a criticism of benchmarks in general, I > don't recall seeing published benchmarks with a statement of how much > optimization effort was put into each program. If you write a benchmark yourself, for example, you know how much effort has been put into optimizing it. So this isn't a criticism that necessarily applies to all benchmarks (but even if it was, that wouldn't stop it from being a valid criticism of the shootout). > Secondly, I don't think you know that there was a widely differing > optimization effort - it's just an assumption. It is based on having seen discussions of the shootout on several language mailing lists and newsgroups, and observing the variation in effort that was put into improving the submissions in each case. -- David Hopwood From igouy2@REDACTED Thu Nov 29 07:06:22 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 28 Nov 2007 22:06:22 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474E49A4.4060509@industrial-designers.co.uk> Message-ID: <460255.84202.qm@web60525.mail.yahoo.com> --- David Hopwood wrote: -snip- > >> This is an elementary error, sufficiently serious that it's not > >> enough just for the FAQ to mention it in passing. It > systematically > >> biases the results against language implementations with a > >> significant startup/shutdown time, or other fixed overheads. > Combined > >> with the fact that most of the benchmarks only run for a few > seconds, > >> the resulting bias is quite large. > > > > Specifically how large is the resulting bias? > > Probably about 10% in some cases (for JVM-based implementations and > Smalltalk). Sorry, I haven't figured out a way to make sense of that - 10% of what? I'm also a little puzzled that you say "probably about 10% in some cases", you claimed there was a serious elementary error and the resulting bias is quite large - is that just speculation? > > Is it large enough that we should reassess the 97.6 seconds that > the > > HiPE program takes for fannkuch down to the 5.99 seconds taken by > the C > > program, or only large enough that we should reassess it to 97.0 > > seconds? > > My comments were not in any way specific to Erlang. (For Erlang, > you should be looking at the effect on the pidigits benchmark, for > example, which takes 4.36 seconds in HiPE.) Whether your comments were specific to Erlang or not, I think you could still tell us whether the quite large bias you're talking about is 40 seconds out of that 97.6 seconds or just 0.6 seconds. As for looking at pidigits, you seem to be saying no more than a fairly constant startup time ought to take up a relatively larger proportion of the shortest measurement. :-) And if we don't stick to Erlang I fear we really will be off-topic ;-) -snip- > > Secondly, I don't think you know that there was a widely differing > > optimization effort - it's just an assumption. > > It is based on having seen discussions of the shootout on several > language mailing lists and newsgroups, and observing the variation in > effort that was put into improving the submissions in each case. Do you even know whether those discussions resulted in programs that are now shown on the website? Do you somehow know how much effort went into programs I wrote and discussed with no one? I think you could fairly say that the programming effort is unknown. ____________________________________________________________________________________ Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/ From igouy2@REDACTED Thu Nov 29 07:31:46 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 28 Nov 2007 22:31:46 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474E3520.1010903@industrial-designers.co.uk> Message-ID: <664047.91512.qm@web60522.mail.yahoo.com> --- David Hopwood wrote: -snip- > Proportion of language implementations for which each benchmark > included in the default weighting takes less than 10, 30, and 60 > seconds CPU time... I don't wish to intrude but you haven't said whether the data you present is from the Debian AMD measurements or the Gentoo Intel measurements, the Extra languages ... -snip- > na?ve Sieve of Eratosthenes ... > Isn't it more likely that there is some source of > constant overhead that is causing the variation between languages to > be compressed? I suspect that's approaching top speed for a na?ve algorithm on this machine :-) > Another basic mistake is that there is no indication of the variation > in timing between benchmark runs. At least, not without digging a bit > deeper: the excluded "Haskell GHC #4" result for N=9 on nsieve is > 1.12 s, but in the full results for nsieve-bits, the result for N=9 on > exactly the same program run by the same language implementation is > 0.80 s. Are you sure the basic mistake is not yours? Gentoo : Intel? Pentium? 4 nsieve,ghc,4,9, 1.124, nsievebits,ghc,4,9, 1.112 ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From jeffm@REDACTED Thu Nov 29 08:46:10 2007 From: jeffm@REDACTED (jm) Date: Thu, 29 Nov 2007 18:46:10 +1100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <08175112-DCFB-492F-B487-63841BA2C825@gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <474DF71A.8020507@ghostgun.com> <08175112-DCFB-492F-B487-63841BA2C825@gmail.com> Message-ID: <474E6E42.7000602@ghostgun.com> Joel Reymont wrote: > > On Nov 28, 2007, at 11:17 PM, jm wrote: > >> You seem to be talking about employing the same strategy that Komatsu >> does against its competitor Caterpillar. > > You are really giving me too much credit. > > "Blue Ocean Strategy" is an interesting book, though ;-). > Actually remembered it from a lecture in Strategic Management would have been much cheaper to have read it in a book though. "Blue Ocean Statregy" sits on my bookshelf half read due to a lack of time. Is there any reason why a programming language doesn't lend itself to having a strategy? Erlang seems to have been born with one due to its heritage! Jeff. From ulf.wiger@REDACTED Thu Nov 29 09:46:39 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 29 Nov 2007 09:46:39 +0100 Subject: [erlang-questions] kara In-Reply-To: <474E2220.6080405@ghostgun.com> References: <474E2220.6080405@ghostgun.com> Message-ID: <474E7C6F.4070200@ericsson.com> jm skrev: > A while ago there was a thread on this list about an Erlang programming > environment for teaching programming called "Kara". Is there a public > release of this software available? Finding an answer to that question was actually my intention with the last thread, rather than learning how to spell "ladybird" in 50+ languages (which was fun too). (: BR, Ulf W From bfulg@REDACTED Thu Nov 29 09:14:33 2007 From: bfulg@REDACTED (Brent Fulgham) Date: Thu, 29 Nov 2007 00:14:33 -0800 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474E3520.1010903@industrial-designers.co.uk> References: <375691.17118.qm@web81211.mail.mud.yahoo.com> <474E3520.1010903@industrial-designers.co.uk> Message-ID: On Nov 28, 2007, at 7:42 PM, David Hopwood wrote: > The times that take longer than a few seconds don't affect my point > that there is systematic bias against language implementations with > significant startup/shutdown times. You say this as though significant startup/shutdown times should be considered acceptable. I disagree -- take for example SBCL or SML/NJ, both of which have sizeable runtimes and yet manage to produce very good times. > Apart from the language implementations > for which performance is not really a serious goal, many of the > 'outlier' > times are due to little or no attention having been paid to > optimizing that > benchmark submission, so that the result is pretty meaningless anyway. This may be true, but I do not know which contributions have had large amounts of optimizations and which do not. I can speak for the relatively high level of effort put into the GHC, Objective Caml, SML, C, C++, Clean, and some of the Erlang entries, because I either was involved in the optimizations, or saw the mailing list discussions of the various iterations. Various language implementors (or proponents) often provide implementations. I assume they are the experts in those domains since they are seeking to put the best face on their language. If you are aware of particularly egregious examples of bad implementations, I would suggest you make a note of it (perhaps on the Shootout bug tracker) so they can be addressed. > There are also many results at the low end of the CPU times that > strain > credibility, if they are supposed to be interpreted as useful > comparisons > of language implementation performance (even on hypothetical code > for which > that benchmark would be representative). For example, look at > > >, You make a valid point: Clearly the nsieve and perhaps the mandelbrot tests need to have higher N values. But in the other entries I see larger variations in the results; at least enough that the differences seem more likely to be caused by real differences in language implementations. > Another basic mistake is that there is no indication of the variation > in timing between benchmark runs. At least, not without digging a bit > deeper: the excluded "Haskell GHC #4" result for N=9 on nsieve is > 1.12 s, > but in the full results for nsieve-bits, the result for N=9 on exactly > the same program run by the same language implementation is 0.80 s. > So, we have some reason to believe that the timings for benchmark runs > this short can vary by as much as 40% (greater than many of the > differences between languages), and the site doesn't give us any > evidence by which we could trust the timings to be more accurate than > that. This looks like some kind of local problem on the GP4 run. If I look at the two runs on my build system: http://shootout.alioth.debian.org/debian/benchmark.php?test=nsieve&lang=ghc&id=4 http://shootout.alioth.debian.org/debian/benchmark.php?test=nsievebits&lang=ghc&id=4 They both show the same result (0.74 seconds) with some minor variation in memory use. The data for all runs are shown on the site, though I will admit you have to click an extra link to see it. Not everyone cares to see the entire grid of results. >> I'm sorry we don't have tests than run for days > > You would have people draw conclusions from benchmarks that run for > 2 seconds (even 0.55 s in some cases). That's ridiculous. It's a > lesson > in how not to do benchmarking. I would have people draw conclusions from benchmarks where the fastest programs are 0.55 s, and the slowest are 350 seconds. Are three orders of magnitude in variation not sufficient to draw some conclusions? If you are concerned with the variation in the sub-second results, it would be reasonable to cull out the worst implementations and perform tests for higher values of N. But that would prevent a wide range of entries, so to some extent it is a matter of limiting ourselves to the lowest common denominator. >> At one time we did subtract the "startup benchmark" time to try to >> avoid >> this problem, but this also resulted in various cries of foul play. > > As it should -- one better way to handle this problem is to make the > run time long enough that the startup/shutdown/overhead time becomes > insignificant (because that's what happens with real programs). That's what happens with *some* programs. There are many cases where programs run for very short times. Is it not useful to know which language implementations provide good results under these conditions? One valid conclusion you could draw from the current benchmark design is that Java is a very poor choice for short running applications (perhaps something run every few minutes by a cron job). I agree that the benchmarks don't currently tell you much about a database front-end for an e-commerce website, but that wasn't really what we were attempting to measure at the time to shootout was started. > Also, if the design of the benchmark suite and the submission rules > are such that we might expect much of the input to be "garbage", > then it's reasonable to criticise that design, not the individual > submissions. I am not aware of anything in the submission rules that has a goal of encouraging 'garbage' submissions. > If a Haskell (or any other) compiler is able to optimize away a > substantial part of the computation intended to be performed by a > benchmark, that indicates it wasn't a very good benchmark, even for > the language implementations that don't do this optimization. I threw that out as an example of why the benchmarks are sometimes specified by algorithm rather than just indicating the desired output. Earlier we began throwing out historical benchmark programs (e.g., the old "loop" test) because they suffered from this problem. Most of the newer benchmarks are designed to avoid this. > As for accepting revisions, that's fine as far as it goes, but it > doesn't go far enough. To trust the results of a comparison, I don't > need to know that anyone *could* improve each submission, I need to > know that the benchmark submissions that are used in that comparison > *have* all been reasonably well optimized. Unless I review the > submissions myself (assuming that I'm a competent programmer in > the languages concerned), how am I supposed to know that? Then I'm afraid we will have to sadly live with the knowledge that we have failed to satisfy your criteria. Even if Isaac and I spent the rest of the year analyzing every program submission in the benchmark, I doubt that would do much to ensure that all entries have been "reasonably well optimized." How could it? I cannot claim to be an expert in all of these languages. I suppose that a dedicated team of experts (perhaps funded by a swanky University) could provide this level of assurance, but I'm afraid that the unfunded shootout has to get by on the kindness of strangers. -Brent -------------- next part -------------- An HTML attachment was scrubbed... URL: From bfulg@REDACTED Thu Nov 29 09:22:09 2007 From: bfulg@REDACTED (Brent Fulgham) Date: Thu, 29 Nov 2007 00:22:09 -0800 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <664047.91512.qm@web60522.mail.yahoo.com> References: <664047.91512.qm@web60522.mail.yahoo.com> Message-ID: <54F58312-5EB5-4FB2-9B1B-0DD992BF8F39@pacbell.net> On Nov 28, 2007, at 10:31 PM, Isaac Gouy wrote: >> Another basic mistake is that there is no indication of the variation >> in timing between benchmark runs. At least, not without digging a bit >> deeper: the excluded "Haskell GHC #4" result for N=9 on nsieve is >> 1.12 s, but in the full results for nsieve-bits, the result for N=9 > on >> exactly the same program run by the same language implementation is >> 0.80 s. > > Are you sure the basic mistake is not yours? > > Gentoo : Intel? Pentium? 4 > > nsieve,ghc,4,9, 1.124, > > nsievebits,ghc,4,9, 1.112 Oh --- he must have been comparing the runs on the two test machines (the Gentoo Intel Pentium 4 and the Debian AMD Sempron): Debian: AMD Sempron: nsieve,ghc,4,9, 0.740 nsievebits,ghc,4,9,0.744 So I guess you could argue that there is a 40% variation if you compare the runs from two different hardware platforms. -Brent From bekesa@REDACTED Thu Nov 29 10:26:14 2007 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Thu, 29 Nov 2007 10:26:14 +0100 Subject: [erlang-questions] newbie question In-Reply-To: References: Message-ID: <200711291026.14711.bekesa@sch.bme.hu> > Can anybody help me how can I group returned list? Or in other words, > how can I apply an aggregate function to get sum of items, count of > items etc.? Check qlc:fold/3. Georgy From michael.regen@REDACTED Thu Nov 29 10:32:38 2007 From: michael.regen@REDACTED (Michael Regen) Date: Thu, 29 Nov 2007 10:32:38 +0100 Subject: [erlang-questions] kara In-Reply-To: <474E7C6F.4070200@ericsson.com> References: <474E2220.6080405@ghostgun.com> <474E7C6F.4070200@ericsson.com> Message-ID: <9b59d0270711290132i3e01fe50i7cf3ae3f0bef022b@mail.gmail.com> You do not search for Kara in general but for an Erlang Kara implementation, do you? I do not know about any Erlang specific versions of Kara but I am sure Frank will be one of the best sources. You can find his email address here: http://delivery.acm.org/10.1145/1300000/1292534/p93-huch.pdf?key1=1292534&key2=5682344911&coll=GUIDE&dl=&CFID=15151515&CFTOKEN=6184618 I think this is the Kara home page. Unfortunately in german only: http://www.swisseduc.ch/informatik/karatojava/kara/ You can download various versions of Kara from here including english versions: http://www.swisseduc.ch/informatik/karatojava/download.html German is my mother tongue so I might be able to answer simple questions. But beware, I have no clue about Kara and will not start to translate the manuals or similar. Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.hillqvist@REDACTED Thu Nov 29 10:53:20 2007 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Thu, 29 Nov 2007 10:53:20 +0100 Subject: [erlang-questions] newbie question In-Reply-To: References: Message-ID: <8268eea30711290153m1e2f3549h12ec787ebebf2321@mail.gmail.com> Like Andreas(the other Andreas ;-) ) proposed fold fits the purpose. Here is an complete example: -module(aggregate). -export([start/0]). -record(item, {count, item, user}). -include_lib("stdlib/include/qlc.hrl"). start() -> mnesia:start(), mnesia:create_schema([]), TabDef = [{ram_copies, [node()]}, {index, [item]}, {attributes, record_info(fields, item)}], mnesia:create_table(item, TabDef), {atomic,ok} = mnesia:transaction(fun insert_query/0), mnesia:transaction(fun select_query/0). insert_query() -> Items = [#item{count = 4, item = apple, user = john}, #item{count = 7, item = apple, user = mary}, #item{count = 3, item = oranges, user = jane}, #item{count = 2, item = oranges, user = john}, #item{count = 2, item = bananas, user = mary}, #item{count = 5, item = bananas, user = jane}, #item{count = 2, item = bananas, user = john}], lists:foreach(fun mnesia:write/1, Items). select_query() -> Q = qlc:keysort(#item.item, mnesia:table(item)), qlc:fold(fun aggregate/2, [], Q). aggregate(#item{count = Count, item = Item}, [{Item, Sum} | Acc]) -> [{Item, Count + Sum} | Acc]; aggregate(#item{count = Count, item = Item}, Acc) -> [{Item, Count} | Acc]. I am uncertain if the index for item, gives keysort any performance gain. Maybe some one else can answer this? As always I appreciate any comments and critic. :-D Regards Andreas Hillqvist 2007/11/28, Ukyo Virgden : > Hi, > > I've just jumped into Erlang. Almost finished reading Joe Armstrong's > book. While testing with mnesia, I've come across a problem I hope > you guys can shed a light. > > Consider I have records like (count, item, user) > > {4, apple, john} > {7, apple, mary} > {3, oranges, jane} > {2, oranges, john} > {2, bananas, mary} > {5, bananas, jane} > {2, bananas, john} > > I can store in mnesia and retrieve with qlc. But I could not "group" > them. I figured out how inappropriate it'd be to ask is qlc has a > facility like SQL GROUP BY. :) > > Can anybody help me how can I group returned list? Or in other words, > how can I apply an aggregate function to get sum of items, count of > items etc.? I've already figured out I can send my process some > messages and collect data but I believe that'd be slower than being > able to write a recursive function. > > I'd appreciate if you could provide some pointers to resources for > functional programming techniques in Erlang. > > Thanks in advance > Ukyo Virgden > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From alex.arnon@REDACTED Thu Nov 29 11:00:26 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Thu, 29 Nov 2007 12:00:26 +0200 Subject: [erlang-questions] Simulating an EAP Authentication In-Reply-To: <1c0d320c-548e-40f1-8f2d-08f2c0b3076b@d27g2000prf.googlegroups.com> References: <1c0d320c-548e-40f1-8f2d-08f2c0b3076b@d27g2000prf.googlegroups.com> Message-ID: <944da41d0711290200k41ee3b5tc2b598a574731c3d@mail.gmail.com> I think jungerl contains a prototype RADIUS server - might that be of interest? On Nov 28, 2007 11:21 PM, Jeff Einhorn wrote: > Has anyone used Erlang to simulate an EAP authentication? > > Thanks, > > Jeff Einhorn > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Thu Nov 29 11:06:48 2007 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 29 Nov 2007 11:06:48 +0100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <474DED25.7060708@ghostgun.com> References: <474D2E90.80603@ericsson.com> <474DED25.7060708@ghostgun.com> Message-ID: <9b08084c0711290206k459f9cdbjc6ffcfddeaa890c3@mail.gmail.com> There's something I don't really understand here - It seems to me that having fixed word lengths is in general a good idea - so aligning instructions on a 32 or 64 bit boundary makes life easy. But why the sudden hop from 32 to 64 bits? if 32 bits can address 4G then 40 bits could address 1TB. << I just don't get this - 32 bits can distinguish 4G different addresses, 64 bits can distinguish 16 exabytes given that a hardware designer will use some of the bits in a register and the rest for an address then a 22 bit instruction and 42 bit pointer would allow access to 4 TB of data - in this case the "natural size" of a pointer and an integer should be 42 bits. Compiler writers should allow the size of an integer to be any reasonable value and not just a power of two - can somebody explain this "power of two fetish" to me so I can understand >> Is it possible to change the emulator to work with 40 bit integers - you might have to be a bit devious. If P points to a struct that is 40 bits long (say a byte + a 32 bit integer) then *(P+1) would point to the next struct. Is this less efficient than a 64 bit program? - who knows - caching might make this more efficient. Are there no "memory expanders" in the good ol' DOS days there was a similar problem. Most C programs could only access the first 640K of memory - to access over 640K you used a memory extender, that allowed access to memory over 640K. Are there no memory extenders that allow a 32 bit application to address memory outside the 4G address space? /Joe Armstrong On Nov 28, 2007 11:35 PM, jm wrote: > Bjorn Gustavsson wrote: > > > It could also be possible to somewhat shrink the Beam code to > > better use the larger word size (packing more operands into one word). > > The savings would probably be minor, but could be still be worthwhile > > as it is relatively straight-forward to do. > > Would this be something like ARM's thumb code > (http://en.wikipedia.org/wiki/ARM_architecture#Thumb) or more like lzw > compression of blocks of code? > > Jeff. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mats.cronqvist@REDACTED Thu Nov 29 11:23:16 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Thu, 29 Nov 2007 11:23:16 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474D87F6.9050607@ericsson.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> <474D87F6.9050607@ericsson.com> Message-ID: <1196331796.10148.15.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Wed, 2007-11-28 at 16:23 +0100, Ulf Wiger (TN/EAB) wrote: > Joel Reymont skrev: > > You can have this without porting Erlang to Mono, just write 'ei' > > for Mono. > > I personally doubt that performance would be sufficient for a GUI- > intensive app. i disagree. using gtknode, i can write 10,000 rows to a TreeView widget with reasonable performance (a few seconds). i'm sure the same (or at least close to it) could be done with Mono. there are of course other good reasons not to use Mono (e.g. microsoft patents.) mats From ulf.wiger@REDACTED Thu Nov 29 11:31:41 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 29 Nov 2007 11:31:41 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <1196331796.10148.15.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> <474D87F6.9050607@ericsson.com> <1196331796.10148.15.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> Message-ID: <474E950D.4090301@ericsson.com> mats cronqvist skrev: > On Wed, 2007-11-28 at 16:23 +0100, Ulf Wiger (TN/EAB) wrote: >> Joel Reymont skrev: >>> You can have this without porting Erlang to Mono, just write 'ei' >>> for Mono. >> I personally doubt that performance would be sufficient for a GUI- >> intensive app. > > i disagree. using gtknode, i can write 10,000 rows to a TreeView > widget with reasonable performance (a few seconds). > i'm sure the same (or at least close to it) could be done with Mono. > there are of course other good reasons not to use Mono (e.g. microsoft > patents.) > > mats It could well be, and your experience with gtknode is of course far greater than mine. (: I based my assumption on some example applications I've seen, where I thought that drawing several different widgets in a window was observably slow. I didn't study the phenomenon in detail, though. I'd be pleased as punch if I turn out to be wrong on this. BR, Ulf W From chsu79@REDACTED Thu Nov 29 11:59:39 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 29 Nov 2007 11:59:39 +0100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <9b08084c0711290206k459f9cdbjc6ffcfddeaa890c3@mail.gmail.com> References: <474D2E90.80603@ericsson.com> <474DED25.7060708@ghostgun.com> <9b08084c0711290206k459f9cdbjc6ffcfddeaa890c3@mail.gmail.com> Message-ID: 2007/11/29, Joe Armstrong : > Are there no memory extenders that allow a 32 bit application to > address memory outside the 4G address space? Virtual memory allow you to have more than 4Gb of RAM, but each individual process has a 32bit memory space. So the outside memory would effectively be a kind of "high memory" area. http://www.x86.org/articles/2mpages/2mpages.htm Is it not interesting to ponder SMP alternatives? Such as having multiple nodes on localhost with privilegies, maybe look into zero-copy messaging across contexts, maybe simple but explicit process migration and ditto for open fds? As computers will get more cores, RAM will probably not stay as random access (isnt this what NUMA is about?), some RAM will be close to a core, and other RAM will be further away from the core but still much faster to access than over the network. From mats.cronqvist@REDACTED Thu Nov 29 12:00:36 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Thu, 29 Nov 2007 12:00:36 +0100 Subject: [erlang-questions] test driven development In-Reply-To: <200711281744.lASHiZmw022952@morgoth.cslab.ericsson.net> References: <200711281744.lASHiZmw022952@morgoth.cslab.ericsson.net> Message-ID: <1196334036.10148.19.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Wed, 2007-11-28 at 18:44 +0100, YANSWBVCG wrote: > I've got the graphics working now with one problem: > the text in the tcl displays is only partially rendered. > I think this stems from a mismatch between the 1440x900 pixels > of the display and the 1280x1024 virtual resolution that Xorg > comes up with when the display is configured. > But I'm now sold on Erlang! my personal opinion of the erlang-tk binding (gs) is that it's near unusable. however, for the special case of the debugger there is another solution; http://code.google.com/p/distel mats From mats.cronqvist@REDACTED Thu Nov 29 12:04:05 2007 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Thu, 29 Nov 2007 12:04:05 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474E950D.4090301@ericsson.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <474D832F.9010508@ericsson.com> <35C4A703-35D5-42FA-B225-02D24220CF70@gmail.com> <474D87F6.9050607@ericsson.com> <1196331796.10148.15.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> <474E950D.4090301@ericsson.com> Message-ID: <1196334245.10148.24.camel@seasc0498.dyn.rnd.as.sw.ericsson.se> On Thu, 2007-11-29 at 11:31 +0100, Ulf Wiger (TN/EAB) wrote: > mats cronqvist skrev: > > On Wed, 2007-11-28 at 16:23 +0100, Ulf Wiger (TN/EAB) wrote: > >> Joel Reymont skrev: > >>> You can have this without porting Erlang to Mono, just write 'ei' > >>> for Mono. > >> I personally doubt that performance would be sufficient for a GUI- > >> intensive app. > > > > i disagree. using gtknode, i can write 10,000 rows to a TreeView > > widget with reasonable performance (a few seconds). > > i'm sure the same (or at least close to it) could be done with Mono. > > there are of course other good reasons not to use Mono (e.g. microsoft > > patents.) > > > > mats > > It could well be, and your experience with gtknode is of course far > greater than mine. (: > > I based my assumption on some example applications I've seen, where > I thought that drawing several different widgets in a window was > observably slow. I didn't study the phenomenon in detail, though. well, while it is possible to make it pretty fast, it is of course quite easy to make it very slow... mats From bekesa@REDACTED Thu Nov 29 12:31:17 2007 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Thu, 29 Nov 2007 12:31:17 +0100 Subject: [erlang-questions] emacs+job control Message-ID: <200711291231.17267.bekesa@sch.bme.hu> Hello, I find the job control menu of the Erlang shell (where you get after pressing Ctrl+g) very useful, but Ctrl+g does not work for an Erlang shell inside Emacs. I've tried to find this info on the net but haven't found anything useful :-( Does anyone know how I can get into that menu of an Erlang shell inside Emacs? Georgy From kosik@REDACTED Thu Nov 29 14:09:29 2007 From: kosik@REDACTED (Matej Kosik) Date: Thu, 29 Nov 2007 14:09:29 +0100 Subject: [erlang-questions] how to trace gen_servers? In-Reply-To: <474DDB8E.6010800@ericsson.com> References: <200711281946.lASJklaw004714@snookles.snookles.com> <474DDB8E.6010800@ericsson.com> Message-ID: <474EBA09.60304@fiit.stuba.sk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ulf Wiger (TN/EAB) wrote: > Scott Lystig Fritchie skrev: >> >> That's the way dicts look. Ulf Wiger's recently-discussed shell >> hackery wouldn't make those look any different, because (AFAIK) his >> shell hooks wouldn't be called by io_lib:format() or whatever is doing >> that formatting. > > Actually, it might. (: > > At least I started looking at that. I was trying to come up with a > good way for e.g. dict to register an output filter, so that each > shell instance would automatically (configurably) pick it up. > > Each call to io:format(Format, Args) actually results in a message, > {put_chars,io_lib,format,[Format,Args]} to an io server, so it could > of course be trapped and in part diverted to io_lib_pretty:print(Term, > ...), which is the function that is able to do the filtering. > > The problem lies in that the Erlang IO subsystem is so pluggable, > that it's difficult to know just what code is going to process > the io_request, and for what purpose. In many cases, automatic > filtering could be every bit as bad as it would be to automatically > truncate the output and replace with "...", as the shell tends > to do. Finding out how to turn on filtering in just the right > processes, and only when desired, was the tricky part, which > I decided to leave for (much) later. Ok. Thank you both. I have solved my problem. Not in such a smart way but it works for me. I need to see the progress of processes and various values of various variables as they change over time. 29.11.2007 14:0:6 circuit_monitor:423 29.11.2007 14:0:6 circuit_monitor:504 29.11.2007 14:0:6 circuit_monitor:475 29.11.2007 14:0:6 circuit_monitor:532 29.11.2007 14:0:6 circuit_monitor:307 {6,113} 29.11.2007 14:0:6 circuit_monitor:570 29.11.2007 14:0:6 control_channel:105 ebno 4 11/28/2007 14:0:0 11/29/2007 14:0:0 560 125 29.11.2007 14:0:6 circuit_monitor:570 29.11.2007 14:0:6 utils:95 ebno /NMSServer/plots/plot_1196341206788486.png 29.11.2007 14:0:8 circuit_monitor:168 29.11.2007 14:0:8 circuit_monitor:31 29.11.2007 14:0:8 circuit_monitor:159 29.11.2007 14:0:8 circuit_monitor:202 {5,active} 29.11.2007 14:0:8 circuit_monitor:360 29.11.2007 14:0:8 circuit_monitor:370 29.11.2007 14:0:8 circuit_monitor:556 That is: progress of processes over time as a sequence of lines each with the following information: - - date - - time - - filename - - line number - - optionally: the variable value I am in a given place interested in and now I have this in a permanent log. Not very inteligent (logs grow) but for debugging the only way how can I find out ex post what went wrong at 3:00 AM yesterday. The disadvantage is, that I must enter in the code instructions such as ?D ... print the "stamp" (date/time/filename/line-number) ?S(String) ... print the "stamp" together with a given string ?T(Term) ... print the "stamp" together with a given term Best regards - -- Matej Kosik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHTroJL+CaXfJI/hgRAnTUAKCCU54TEyGMXJ0vnUxcn1VYmwRuZwCggUkO vrF7vahtr/tR0KwJR6HH7to= =lD3f -----END PGP SIGNATURE----- From joelr1@REDACTED Thu Nov 29 14:44:02 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 29 Nov 2007 13:44:02 +0000 Subject: [erlang-questions] Percept profiler and trace points in the VM Message-ID: <3536AB52-8873-4C62-B556-C0E56E6C27EA@gmail.com> Where can I dig up more info on the subject for the upcoming book? Thanks, Joel -- http://wagerlabs.com From joelr1@REDACTED Thu Nov 29 14:48:11 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 29 Nov 2007 13:48:11 +0000 Subject: [erlang-questions] New garbage collector Message-ID: Any information on the new GC in R12B? Source code pointers are fine. Thanks, Joel -- http://wagerlabs.com From tonyg@REDACTED Thu Nov 29 14:58:10 2007 From: tonyg@REDACTED (Tony Garnock-Jones) Date: Thu, 29 Nov 2007 13:58:10 +0000 Subject: [erlang-questions] R11B.5 with GLIBC 2.7 Message-ID: <474EC572.9000505@lshift.net> Is this patch all that's needed to get things working on x86 with GLIBC 2.7? R11B.5 at least *compiles* with it, where it didn't without it... Regards, Tony -- [][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211 [][] LShift Ltd | Tel: +44 (0)20 7729 7060 [] [] http://www.lshift.net/ | Email: tonyg@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: erts-emulator-x86-signal-glibc-2-7.patch Type: text/x-patch Size: 489 bytes Desc: not available URL: From kostis@REDACTED Thu Nov 29 15:07:54 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 29 Nov 2007 16:07:54 +0200 Subject: [erlang-questions] R11B.5 with GLIBC 2.7 In-Reply-To: <474EC572.9000505@lshift.net> References: <474EC572.9000505@lshift.net> Message-ID: <474EC7BA.7010400@cs.ntua.gr> Tony Garnock-Jones wrote: > Is this patch all that's needed to get things working on x86 with GLIBC > 2.7? R11B.5 at least *compiles* with it, where it didn't without it... Thanks for the patch. We have already performed it and since about a month is part of the upcoming R12 release. Kostis PS. The code works with it -- this is all that's needed. From bjorn@REDACTED Thu Nov 29 15:10:43 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 29 Nov 2007 15:10:43 +0100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <474DED25.7060708@ghostgun.com> References: <474D2E90.80603@ericsson.com> <474DED25.7060708@ghostgun.com> Message-ID: jm writes: > Bjorn Gustavsson wrote: > > > It could also be possible to somewhat shrink the Beam code to > > better use the larger word size (packing more operands into one word). > > The savings would probably be minor, but could be still be worthwhile > > as it is relatively straight-forward to do. > > Would this be something like ARM's thumb code > (http://en.wikipedia.org/wiki/ARM_architecture#Thumb) or more like lzw > compression of blocks of code? Neither. Here is an example. The follow code sequence init {y,0} init {y,1} init {y,2} init {y,5} init {y,6} init {y,8} will be rewritten to init3 {y,0} {y,1} {y,2} init3 {y,5} {y,6} {y,8} by the current loader. The instruction itself requires one word, and the operands are all packed into one word. The entire sequence thus takes four words. On a 64-bit machine, one instruction would be enough: init6 {y,0} {y,1} {y,2} {y,5} {y,6} {y,8} Only two words would be needed. (This was only an example. A sequence of 6 init instructions is probably not that commone, especically not in R12B.) /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From dot@REDACTED Thu Nov 29 15:41:10 2007 From: dot@REDACTED (Tony Finch) Date: Thu, 29 Nov 2007 14:41:10 +0000 Subject: [erlang-questions] 64-bit erlang In-Reply-To: References: <474D2E90.80603@ericsson.com> <474DED25.7060708@ghostgun.com> Message-ID: On Thu, 29 Nov 2007, Bjorn Gustavsson wrote: > jm writes: > > > > Would this be something like ARM's thumb code > > (http://en.wikipedia.org/wiki/ARM_architecture#Thumb) or more like lzw > > compression of blocks of code? > > Neither. VLIW is probably the right description. Tony. -- f.a.n.finch http://dotat.at/ BISCAY: SOUTHWEST 4 OR 5, DECREASING 3 FOR A TIME. MODERATE OR ROUGH. OCCASIONAL RAIN. MODERATE OR GOOD. From james.hague@REDACTED Thu Nov 29 16:35:10 2007 From: james.hague@REDACTED (James Hague) Date: Thu, 29 Nov 2007 09:35:10 -0600 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: On Nov 28, 2007 7:34 AM, Joel Reymont wrote: > > Write Lisp on the Erlang VM, write Haskell or a new language with an > elegant syntax. Throw your lot into improving the existing VM. Agreed 100%. The Erlang VM is fantastic in a number of ways. It supports the features that make Erlang great: message passing, lightweight processes. It's also one of the fastest dynamic language VMs out there. Plus it's easy to map imperative languages to Erlang (http://prog21.dadgum.com/5.html). And now a question: what's the best target for compiling to? Real Erlang? Core Erlang? BEAM? I'm probably alone in this opinion, but I think a light layer of syntactic sugar on top of raw, BEAM code would be a fun and productive language--and even more flexible than Erlang. But relying on the BEAM VM to remain stable isn't reasonable. James From bjorn@REDACTED Thu Nov 29 17:19:31 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 29 Nov 2007 17:19:31 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: "James Hague" writes: > And now a question: what's the best target for compiling to? Real > Erlang? Core Erlang? BEAM? I'm probably alone in this opinion, but > I think a light layer of syntactic sugar on top of raw, BEAM code > would be a fun and productive language--and even more flexible than > Erlang. But relying on the BEAM VM to remain stable isn't reasonable. I would say that it depends on the source language, and how much fun you want to have writing code generation and optimizations passes. The BEAM VM evolves only slowly. We add new instructions in one release, and only several releases later will we remove the obsolete instructions. So in practice it is quite stable. The mandatory beam_validator pass (introduced in an R10B) will help catching most misuse of the instruction set that would cause the BEAM emulator to mysteriously crash at run-time. Without the beam_validator, it would be dangerous to have a light layer of syntatic sugar on top of the BEAM instructions. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From toby@REDACTED Thu Nov 29 17:20:37 2007 From: toby@REDACTED (Toby Thain) Date: Thu, 29 Nov 2007 14:20:37 -0200 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474DF71A.8020507@ghostgun.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <474DF71A.8020507@ghostgun.com> Message-ID: On 28-Nov-07, at 9:17 PM, jm wrote: > Joel Reymont wrote: >> On Nov 28, 2007, at 2:35 PM, Michael Regen wrote: >> CouchDB counts, Erlyweb not so much. People want to buy 1/4 holes and >> not 1/4 drills. Be bold, go beyond what other people have gone before >> you. Push Erlang towards unproven applications, don't push Erlang >> into >> the "enterprise". Once the enteprise is awed, Erlang will make its >> way >> into the enterprise. > > You seem to be talking about employing the same strategy that Komatsu > does against its competitor Caterpillar. That of encircling the > competitor like a python and doing all the periphery product offerings > better than the competitor Or Linux versus Wind*ws. :-) --Toby > then moving towards their core (the > enterprise in the case of Java) leaving them no where to go. > > Jeff. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From toby@REDACTED Thu Nov 29 17:22:12 2007 From: toby@REDACTED (Toby Thain) Date: Thu, 29 Nov 2007 14:22:12 -0200 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <474E6E42.7000602@ghostgun.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <474DF71A.8020507@ghostgun.com> <08175112-DCFB-492F-B487-63841BA2C825@gmail.com> <474E6E42.7000602@ghostgun.com> Message-ID: <7EFD904E-A396-4C3D-9B01-D114B1628449@smartgames.ca> On 29-Nov-07, at 5:46 AM, jm wrote: > Joel Reymont wrote: >> >> On Nov 28, 2007, at 11:17 PM, jm wrote: >> >>> You seem to be talking about employing the same strategy that >>> Komatsu >>> does against its competitor Caterpillar. >> >> You are really giving me too much credit. >> >> "Blue Ocean Strategy" is an interesting book, though ;-). >> > > Actually remembered it from a lecture in Strategic Management would > have > been much cheaper to have read it in a book though. "Blue Ocean > Statregy" sits on my bookshelf half read due to a lack of time. Is > there > any reason why a programming language doesn't lend itself to having a > strategy? Erlang seems to have been born with one due to its heritage! I think Joe nailed "Erlang's strategy" in his post... Sharpen your axe until the right moment then chop like hell. --Toby > > Jeff. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dot@REDACTED Thu Nov 29 17:08:14 2007 From: dot@REDACTED (Tony Finch) Date: Thu, 29 Nov 2007 16:08:14 +0000 Subject: [erlang-questions] 64-bit erlang In-Reply-To: <9b08084c0711290206k459f9cdbjc6ffcfddeaa890c3@mail.gmail.com> References: <474D2E90.80603@ericsson.com> <474DED25.7060708@ghostgun.com> <9b08084c0711290206k459f9cdbjc6ffcfddeaa890c3@mail.gmail.com> Message-ID: On Thu, 29 Nov 2007, Joe Armstrong wrote: > > But why the sudden hop from 32 to 64 bits? if 32 bits can address 4G > then 40 bits could address 1TB. I expect it's for backwards-compatibility. 32 bit words fit neatly into 64 bit words without wasted space and without alignment problems. > I just don't get this - 32 bits can distinguish 4G different addresses, > 64 bits can distinguish 16 exabytes given that a hardware designer will > use some of the bits in a register and the rest for an address then a 22 > bit instruction and 42 bit pointer would allow access to 4 TB of data - > in this case the "natural size" of a pointer and an integer should be 42 > bits. Whenever instruction set designers have tried this in the past it has turned out to have been a mistake that limited the lifetime of the architecture or required work-arounds, e.g. IBM 360, Motorola 68000, Acorn-era ARMs. The x86 has gone through four architecture overhauls to extend its address space so it's probably the best example of all. There are already supercomputers with multiple terabytes of RAM, so any CPU that aspires to the high end needs more than 40 bits of address space now, and will need to extend that in the future. For example, x86-64 currently has 48 bits of address space and reserves the remaining 16 bits for expansion. Large address spaces will be useful for mmapping large data sets even if they don't fit in RAM, so it's easy to see 40 or 50 bits being necessary for lots of apps in the near future. > Compiler writers should allow the size of an integer to be any > reasonable value and not just a power of two - can somebody explain this > "power of two fetish" to me so I can understand If you are on a mainstream CPU then non-aligned accesses will require two memory cycles, one for each word that is affected. x86 allows this but the performance is poor; many other CPUs forbid it to avoid complexity. Non-aligned accesses also have horrible cache coherency and concurrency problems. > Is it possible to change the emulator to work with 40 bit integers - you > might have to be a bit devious. If P points to a struct that is 40 bits > long (say a byte + a 32 bit integer) then *(P+1) would point to the next > struct. Is this less efficient than a 64 bit program? - who knows - > caching might make this more efficient. If you lay them out in memory like this: |----|----|----|----|----|----|----|----| 40 bit words |-------|-------|-------|-------|-------| 64 bit words Then half of your 40 bit words will require two memory accesses to manipulate, either by the CPU in hardware, or by the emulator in software. The latter increases your register pressure, which on x86-64 would probably eliminate the advantage of having more registers. Note also that the above diagram spans five 64 bit words, whereas a cache line is eight or sixteen words. This means that the pattern of 40 bit words will be different in each cache line and some 40 bit words will span lines, hurting the cache. > Are there no memory extenders that allow a 32 bit application to address > memory outside the 4G address space? The x86 Physical Address Extension allows an operating system to deal with up to 64 GB RAM (36 bits), though each segment is still limited to 32 bit offsets. Most operating systems do not allow userland programs to use more than one segment so they remain limited to 32 bits of addressibility. Applications that deal with large data sets usually do so via a database that handles the necessary paging. An interesting slightly tangential thought is how to lay out tagged data words for a dynamically typed language in a cache-friendly way, without stealing bits so that you can support unboxed floats (which makes sense when they are the same size as pointers and ints). It might also make sense to unbox short (0 to 8 byte) binaries. If you assume an eight word cache line, you can comfortably fit seven data words, seven tag bytes, and one byte of wastage thus: XTTTTTTT-------|-------|-------|-------|-------|-------|-------| Tony. -- f.a.n.finch http://dotat.at/ BISCAY: SOUTHWEST 4 OR 5, DECREASING 3 FOR A TIME. MODERATE OR ROUGH. OCCASIONAL RAIN. MODERATE OR GOOD. From bjorn@REDACTED Thu Nov 29 17:54:39 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 29 Nov 2007 17:54:39 +0100 Subject: [erlang-questions] New garbage collector In-Reply-To: References: Message-ID: Joel Reymont writes: > Any information on the new GC in R12B? > > Source code pointers are fine. The source is in beam/erl_gc.c in R12B. ggc.c has been removed. Daily snapshots can be found here: http://www.erlang.org/download/snapshots/ The main change is that the GC will not copy anything outside the heap or heap fragments. That allows constant terms to be placed anywhere in memory (each module can now define its own constant). The old GC would copy terms from anywhere except from areas explicitly excluded (the old heap and HiPE's constant pool). The idea for this change comes from the HiPE group. We have worked for several releases to make it possible (uncontrolled building of heap fragments by arithmetic instructions prevented this change, so we had to introduce new arithmetic instructions that does an explicit garbage collection). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From egil@REDACTED Thu Nov 29 18:20:26 2007 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Thu, 29 Nov 2007 18:20:26 +0100 Subject: [erlang-questions] Percept profiler and trace points in the VM In-Reply-To: <3536AB52-8873-4C62-B556-C0E56E6C27EA@gmail.com> References: <3536AB52-8873-4C62-B556-C0E56E6C27EA@gmail.com> Message-ID: <474EF4DA.2070906@erix.ericsson.se> Joel Reymont wrote: > Where can I dig up more info on the subject for the upcoming book? Percept is documented in the upcoming r12 release as are the tracepoints and they are documented under erlang:system_profile/2. // Bj?rn-Egil From francesco@REDACTED Thu Nov 29 13:41:20 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 29 Nov 2007 12:41:20 +0000 Subject: [erlang-questions] ErlLounge Paris, Dec 6th, 2008 Message-ID: <474EB370.4040608@erlang-consulting.com> Hi All, Erlang Training and Consulting and Process One are co-sponsoring an ErlLounge in central Paris (France, not Texas :-)) next Thursday Dec. 6th, starting at 7pm. Mikael is still scouting for a location and will get back to the list as soon as he has one. Until then, drop us a line if you have suggestions on where to hold it or if you want to attend. See you there! Francesco -- http://www.erlang-consulting.com From joelr1@REDACTED Thu Nov 29 18:41:47 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 29 Nov 2007 17:41:47 +0000 Subject: [erlang-questions] Percept profiler and trace points in the VM In-Reply-To: <474EF4DA.2070906@erix.ericsson.se> References: <3536AB52-8873-4C62-B556-C0E56E6C27EA@gmail.com> <474EF4DA.2070906@erix.ericsson.se> Message-ID: <8115F4A0-071D-4E4E-8FCE-8E960930D7A4@gmail.com> Bjorn, On Nov 29, 2007, at 5:20 PM, Bj?rn-Egil Dahlberg wrote: > Percept is documented in the upcoming r12 release as are the > tracepoints > and they are documented under erlang:system_profile/2. I found code snapshots for R12B but no documentation. Are the man pages available someplace? Thanks, Joel -- http://wagerlabs.com From igouy2@REDACTED Thu Nov 29 18:02:07 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Thu, 29 Nov 2007 09:02:07 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <54F58312-5EB5-4FB2-9B1B-0DD992BF8F39@pacbell.net> Message-ID: <591335.26758.qm@web60523.mail.yahoo.com> --- Brent Fulgham wrote: > > On Nov 28, 2007, at 10:31 PM, Isaac Gouy wrote: > >> Another basic mistake is that there is no indication of the > variation > >> in timing between benchmark runs. At least, not without digging a > bit > >> deeper: the excluded "Haskell GHC #4" result for N=9 on nsieve is > >> 1.12 s, but in the full results for nsieve-bits, the result for > N=9 > > on > >> exactly the same program run by the same language implementation > is > >> 0.80 s. > > > > Are you sure the basic mistake is not yours? > > > > Gentoo : Intel? Pentium? 4 > > > > nsieve,ghc,4,9, 1.124, > > > > nsievebits,ghc,4,9, 1.112 > > Oh --- he must have been comparing the runs on the two test machines > > (the Gentoo Intel Pentium 4 > and the Debian AMD Sempron): > > Debian: AMD Sempron: > > nsieve,ghc,4,9, 0.740 > nsievebits,ghc,4,9,0.744 http://shootout.alioth.debian.org/gp4/fulldata.php?test=nsievebits&p1=ghc-0&p2=ghc-4&p3=ghc-0&p4=ghc-0 ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From michael.regen@REDACTED Thu Nov 29 20:02:50 2007 From: michael.regen@REDACTED (Michael Regen) Date: Thu, 29 Nov 2007 20:02:50 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: <9b59d0270711291102u28475486jfa387956ec77555d@mail.gmail.com> OK, after some pondering and reading I thing I got the solution which should make everybody happy. Instead of pushing Erlang into the enterprise we 'simply' push the enterprise into Erlang. Modest as I am, I hearby demand a Java to beam compiler. Or better a class2beam perl translator script. Bj?rn, what do you do next weekend? ;) Erlang is near a brazillion of usefull Java (and other language's) libraries, Java could get access to working concurrency and I can tell my customer that our solution runs under a 'JVM' - an improved one. ;) Just had a look at http://www.ikvm.net/ which, among other things translates Java byte code to .net IL. Programming .net under Java - simply amazing! No, serious, I stop dreaming about this topic, I promise. Such a project would be a never ending story and I guess that the differences between .class and .beam are rather fundamental and neither one is built to support the other. But in the unlikely case that someone comes up with a working solution, consider me as your brave tester. Cheers, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Thu Nov 29 20:15:41 2007 From: rvirding@REDACTED (Robert Virding) Date: Thu, 29 Nov 2007 20:15:41 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: <3dbc6d1c0711291115r648447dev45de823a0ee4157@mail.gmail.com> On 29/11/2007, James Hague wrote: > > On Nov 28, 2007 7:34 AM, Joel Reymont wrote: > > > > Write Lisp on the Erlang VM, write Haskell or a new language with an > > elegant syntax. Throw your lot into improving the existing VM. > > Agreed 100%. The Erlang VM is fantastic in a number of ways. It > supports the features that make Erlang great: message passing, > lightweight processes. It's also one of the fastest dynamic language > VMs out there. Plus it's easy to map imperative languages to Erlang > (http://prog21.dadgum.com/5.html). The erlang VM is quite fantastic, but it is also quite restricted. There are many things it can NOT handle, for example destructive updates of objects. There are no instructions in the BEAM for doing that, at least there weren't. Bj?rn? This severely restricts which languages you can implement on it. For example you cannot do a complete Scheme as it has destructive operations. I am not thinking about set! which is easy as it only modifies the environment but functions like vector-set! and string-set! which actually destructively modifies the objects themselves. I think adding that type of operation to the BEAM could be quite difficult as the effects are quite profound. And now a question: what's the best target for compiling to? Real > Erlang? Core Erlang? BEAM? I'm probably alone in this opinion, but > I think a light layer of syntactic sugar on top of raw, BEAM code > would be a fun and productive language--and even more flexible than > Erlang. But relying on the BEAM VM to remain stable isn't reasonable. There are actually 4 different layers in the compiler to which you could compile: - Erlang - Core Erlang - Kernel Erlang - BEAM code The kernel level is a low-level non BEAM specific layer which could be compiled to any register machine. It would probably work against a stack machine as well. It was a while since I worked on it so I can't remember ALL the details. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Thu Nov 29 21:10:36 2007 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 29 Nov 2007 21:10:36 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> Message-ID: <9b08084c0711291210o4a34a48el11a7669561360e86@mail.gmail.com> On Nov 29, 2007 4:35 PM, James Hague wrote: > On Nov 28, 2007 7:34 AM, Joel Reymont wrote: > > > > Write Lisp on the Erlang VM, write Haskell or a new language with an > > elegant syntax. Throw your lot into improving the existing VM. > > Agreed 100%. The Erlang VM is fantastic in a number of ways. It > supports the features that make Erlang great: message passing, > lightweight processes. It's also one of the fastest dynamic language > VMs out there. Plus it's easy to map imperative languages to Erlang > (http://prog21.dadgum.com/5.html). I'll let you into a secret ... The behaviour of the VM is not particularly surprising - it does what it was designed to do. When we built the first VM years ago Mike Williams laid down the strategy for the VM. His view was that for a concurrent language there where three things that were important above all else: - context switching time - message passing time - process spawning time The first VM (The JAM) compiled A ! B into (code to push A on top the stack) (code to push B on top the stack) send send was a single byte code that the VM evaluated. Mike who write the first jam emulator started hard at the assembler that the C compiler generated and fiddled with his program to make this as efficient as possible. Other languages prioritise other things - fast function calls, fast lookup in a method call chain and so on. The Erlang VM is perceived as fast because it does the concurrency bit better than other language - it is a consequence of the design of the VM. The VM was designed to do this kind of thing very quickly. Many languages are slow only because you have to evaluate large numbers of instructions to get them to do what you want. If the VM and the language are not a good fit - then no matter how hard you work performance will suck. A nice example of this is LUA - the VM fits the language nicely so the implementation is surprising small and fast. Same for smalltalk. Contrary to what has been said here I'm not convinced that the Erlang VM is a good target for "other" languages. The VM was designed specifically for Erlang - so I think the fit with languages with other semantics might not be so good. If you look at the pascal P code machine, the Erlang VM, the smalltalk VM the LUA VM you see that there are opcodes especially suited for implementing these languages. I fear that general purpose VMs will be always have lack lustre performance compared to purpose built VMs. If the VM is a bad language match then you have to play horrible tricks to get the implementation to work. For example compiling Erlang to the JVM would be a mess - because although the JVM has reasonable stack handling instructions it's idea of a heap is very different to Erlangs - as is the JVMs idea of garbage collection. Note that the design of the Erlang VMs also have to think about the type of GC you want so that this is reasonably fast and perceived as real time. Were I think the Erlang implementation could be improved is by implementing the GC and scheduler in Erlang itself - you'd need some kind of inlining to inline VM instructions in Erlang that are known not to produce garbage - the emulator itself should also be written in Erlang (using the inline VM opcodes) and then cross compiled to C - or just straight to assembler. This is how smalltalk and various lisps are implemented. To get high performance out of a VM you have to sit down with a pencil and paper and count instruction cycles and cache hits, designing things so that the VM matches up with what your language is supposed to do. This is not particularly difficult - but it takes a long time. Writing such a system is a "thought bound" process - the result is not a lot of code - but you have to think for a long time and do lot's of small experiments before writing it. If you do compile some other language to the Erlang VM it should work - but you might not get the great performance you were dreaming of. You will also bear with you all the things in the Erlang run-time system that you dare not remove - the things that are needed by Erlang but not needed by a new language. > > And now a question: what's the best target for compiling to? Real > Erlang? Core Erlang? BEAM? I'm probably alone in this opinion, but > I think a light layer of syntactic sugar on top of raw, BEAM code > would be a fun and productive language--and even more flexible than > Erlang. But relying on the BEAM VM to remain stable isn't reasonable. An RTL that can be cross compiled to a MIPS or Intel processor or to C or emulated by C :-) (Actually I think VMs should have even more layers) Erlang -> EVM -> ERTL -> MIPS (ERTL = Erlang register transfer language) you could emulate the ERTL in C or transform it to C /Joe Armstrong > > James > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From david.hopwood@REDACTED Thu Nov 29 22:35:57 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Thu, 29 Nov 2007 21:35:57 +0000 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <664047.91512.qm@web60522.mail.yahoo.com> References: <664047.91512.qm@web60522.mail.yahoo.com> Message-ID: <474F30BD.3020902@industrial-designers.co.uk> Isaac Gouy wrote: > --- David Hopwood wrote: > > -snip- >> Proportion of language implementations for which each benchmark >> included in the default weighting takes less than 10, 30, and 60 >> seconds CPU time... > > I don't wish to intrude but you haven't said whether the data you > present is from the Debian AMD measurements or the Gentoo Intel > measurements, the Extra languages ... The measurements that are shown by default, which are for Gentoo Intel P4 without "Extra" languages. The ones for Debian AMD appear at first glance to be quite similar, except in a few cases where they would have more strongly supported my argument (e.g. the timings for mandelbrot start at 0.14 seconds, and for pidigits at 0.10 seconds). BTW, anyone who has spent much time on benchmarking knows that you cannot get reliable results from runs this short. I'm astonished that I am having to argue this point. >> Another basic mistake is that there is no indication of the variation >> in timing between benchmark runs. At least, not without digging a bit >> deeper: the excluded "Haskell GHC #4" result for N=9 on nsieve is >> 1.12 s, but in the full results for nsieve-bits, the result for N=9 >> on exactly the same program run by the same language implementation is >> 0.80 s. > > Are you sure the basic mistake is not yours? The basic mistake, as I said, is that there is no indication of the variation in timing between benchmark runs. I stand corrected about the specific example; I was looking at the wrong data for nsieve-bits. -- David Hopwood From chsu79@REDACTED Thu Nov 29 22:51:17 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 29 Nov 2007 22:51:17 +0100 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474F30BD.3020902@industrial-designers.co.uk> References: <664047.91512.qm@web60522.mail.yahoo.com> <474F30BD.3020902@industrial-designers.co.uk> Message-ID: Are you guys getting anywhere with this discussion? From kenneth.lundin@REDACTED Thu Nov 29 22:53:43 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 29 Nov 2007 22:53:43 +0100 Subject: [erlang-questions] Percept profiler and trace points in the VM In-Reply-To: <8115F4A0-071D-4E4E-8FCE-8E960930D7A4@gmail.com> References: <3536AB52-8873-4C62-B556-C0E56E6C27EA@gmail.com> <474EF4DA.2070906@erix.ericsson.se> <8115F4A0-071D-4E4E-8FCE-8E960930D7A4@gmail.com> Message-ID: Hi, You can find documentation in html form at the same place as the code snapshots. For example : http://www.erlang.org/download/snapshots/otp_html_R12B_2007-11-28_18.tar.gz Note that the html documentation and the man pages comes from exactly the same source files, the difference is that there is only a subset of the documentation that is presented as man pages, namely the API and command parts. /Kenneth Erlang/OTP team at Ericsson On 11/29/07, Joel Reymont wrote: > Bjorn, > > On Nov 29, 2007, at 5:20 PM, Bj?rn-Egil Dahlberg wrote: > > > Percept is documented in the upcoming r12 release as are the > > tracepoints > > and they are documented under erlang:system_profile/2. > > > I found code snapshots for R12B but no documentation. > > Are the man pages available someplace? > > Thanks, Joel > > -- > http://wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From zubac@REDACTED Thu Nov 29 23:19:53 2007 From: zubac@REDACTED (Dragan Zubac) Date: Thu, 29 Nov 2007 23:19:53 +0100 Subject: [erlang-questions] Longest prefix match Message-ID: <474F3B09.8070604@vlayko.tv> Hello A couple of questions regarding 'lpm' algorithm if anyone has any experience with this. What would be the most elegant and efficient way for LPM ? For example,we have some list of numbers: - 889123456 - 44712345678 - 5550123456789 - 32112345 - 5501 and the desired number for example: 550123555666 I guess the most efficient way would be to use some sort of 'tree' and traverse each number from the beginning of destination number and check it in number's list and if we can't match N position to claim it to be the longest prefix match ? Second question is the same as question one,but implies that to have some additional data with prefix (route,price,user_id,etc.),what would be algorithm looks like in this situation ? For example: - 889123456,100 - 44712345678,100 - 5550123456789,101 - 32112345,101 - 5501,100 - 5550123456789,100 number is 550123555666,100 ,the problem would be to find LPM for specific price (100),in this case there's no unique prefix,but there's unique prefix+price 'object'. Anybody had any experience with this issues ? Sincerely Dragan Zubac From rvirding@REDACTED Fri Nov 30 00:06:48 2007 From: rvirding@REDACTED (Robert Virding) Date: Fri, 30 Nov 2007 00:06:48 +0100 Subject: [erlang-questions] Lisp syntax for Erlang In-Reply-To: References: <3dbc6d1c0711251803j552680e5v4ab1f05116bd3938@mail.gmail.com> Message-ID: <3dbc6d1c0711291506u21502d83i2e4a1a09b041c24d@mail.gmail.com> Bengt is right Erlisp would probably be better as Elisp is already taken (by Emacs lisp), which I do know being an old Elisp hacker my self. It was just a mild "in joke". On 26/11/2007, Eric Merritt wrote: > Why try to use scheme syntax at all. Come up with a lisp that works > given erlang semantics. A lisp is a lisp is a lisp after all. I thing > trying to implement scheme on top of lisp is not a good direction, it > will be difficult to get parity between the semantics one expects when > using scheme and the semantics enforced by its layering on top of the > erlang vm. So embrace both lisp and erlang and come up with a good > fusion between the two. In many ways CL and Scheme are quite similar, but, of course, there are some fundamental differences. For example in CL symbols have two bindings, a function binding and a value binding, whereas in Scheme symbols have only a value binding. It was more at this level I was thinking. Seeing this would be an implementation of Erlang and must interact smoothly with the rest of Erlang it will never *be* a Scheme or CL, the differences are too great. My idea is just that you take good from where you can but try and keep things consistent. So do we base our Erlisp on the CL way or the Scheme way? My suggestion is that we do as Scheme and just have one binding for a symbol. The way Erlang handles modules, and atoms/symbols, is different from either lisp so we will have to go our own way there. I personally think that it is a benefit to try and use the same name for things in Erlisp which is why I re-used names like 'receive' and 'case' but expanded to have guards. I personally think that 'if' should be the lisp if not the erlang if, though there is the problem of handling errors in the guards. One way would be to do as list comprehensions do if it a test can be a guard test make it one otherwise treat it a normal call. But it is not consistent. We have to handle functions with the same name but with different number of arguments as in Erlang, different functions. No way around it. But I wonder if macros should be like that. Some nice macros would be tedious to define like that. Perhaps there should only be one macro definition per name which can handle various numbers of arguments, as in list. Either using a defmacro from CL or something similar to define-syntax from Scheme which uses matching to select expansion. Intermodule calls are the biggest problem, not to implement but to come up with a good syntax for it. In CL the symbol mod:func means the symbol func in the package mod, while in Scheme it is just a normal symbol which you can tell the system it refers to the function func in the library/module mod. I will try with a suggestion, both mine and others, from a different thread: (remote-call mod func arg1 arg2 ... ) which is a normal function and have: (: mod func arg1 arg2 ... ) for the special case where both mod and func are the actual names of e the module and function. This to save having to write: (remote-call 'mod 'func arg1 ... ) Sorry for rambling on here, but these are just some ideas I have had about it all. Probably should blogg it but I don't want to release it to a poor unsuspecting public just yet. :-) I'll be back when I have something to show, Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From igouy2@REDACTED Thu Nov 29 23:07:50 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Thu, 29 Nov 2007 14:07:50 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: Message-ID: <254850.47227.qm@web60521.mail.yahoo.com> --- Christian S wrote: > Are you guys getting anywhere with this discussion? It usually takes a week or two :-) ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From igouy2@REDACTED Thu Nov 29 23:13:21 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Thu, 29 Nov 2007 14:13:21 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474F30BD.3020902@industrial-designers.co.uk> Message-ID: <563465.33601.qm@web60524.mail.yahoo.com> --- David Hopwood wrote: -snip- > BTW, anyone who has spent much time on benchmarking knows that you > cannot get reliable results from runs this short. I'm astonished that > I am having to argue this point. You state that as an absolute - afaict it would depend on how fast the machine was and the resolution of the time measurements. ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From igouy2@REDACTED Fri Nov 30 00:28:07 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Thu, 29 Nov 2007 15:28:07 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474DACC2.10104@industrial-designers.co.uk> Message-ID: <690454.72573.qm@web60513.mail.yahoo.com> --- David Hopwood wrote: -snip- > Then let me be more specific. From the FAQ at > : > > # CPU Time means program usr+sys time (in seconds) which includes the > # time taken to startup and shutdown the program. For language > # implementations that use a Virtual Machine the CPU Time includes > # the time taken to startup and shutdown the VM. > > This is an elementary error, sufficiently serious that it's not > enough just for the FAQ to mention it in passing. It systematically > biases the results against language implementations with a significant > startup/shutdown time, or other fixed overheads. Combined with the > fact that most of the benchmarks only run for a few seconds, the > resulting bias is quite large. > Note that just subtracting the time taken by the "startup benchmark" > would not be sufficient to remove this bias, because of variations in > startup/shutdown/overhead time between programs (even if the > comparison graphs were set up to do that). Let's try for some clarity. Whether most of the programs only run for a few seconds, or not, is irrelevant. Your claim of quite large bias rests on whether or not the programs, for the language implementations suspected of "significant" startup/shutdown, run for only a few multiples of startup/shutdown. Your claim about variations in startup/shutdown between programs rests on the size of those variations - are they significant? In vain I've asked for specific information on this "quite large bias" and seem to be in the usual situation of having to disprove a claim someone else has made without any supporting data. > My comments were not in any way specific to Erlang. (For Erlang, > you should be looking at the effect on the pidigits benchmark, for > example, which takes 4.36 seconds in HiPE.) The differences between statistics(wall_clock) inside the program and bash elapsed time amounted to 0.16s give or take a few thousandths (hello world averaged 0.18s). pi-digits, the shortest running Erlang program, runs for ~27x longer than startup/shutdown. Let's try a different approach, we can change the Erlang thread-ring program to pass a tuple instead of an integer, repeat the N=10,000,000 load over and over again, and assume that amortizes startup/shutdown and process creation. After 3 hours 20 minutes, the difference between the average time and the single measurement of "a few seconds" amounted to 2.2% ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From sean.hinde@REDACTED Fri Nov 30 01:13:28 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 30 Nov 2007 00:13:28 +0000 Subject: [erlang-questions] Longest prefix match In-Reply-To: <474F3B09.8070604@vlayko.tv> References: <474F3B09.8070604@vlayko.tv> Message-ID: I found this user contribution quite inspirational when approaching this issue: http://www.erlang.org/user.html#anal-1.0 Rather than store an int/bigint for intermediate results it would probably be enough to store the list of digits so far Sean On 29 Nov 2007, at 22:19, Dragan Zubac wrote: > Hello > > A couple of questions regarding 'lpm' algorithm if anyone has any > experience with this. > > What would be the most elegant and efficient way for LPM ? For > example,we have some list of numbers: > > - 889123456 > - 44712345678 > - 5550123456789 > - 32112345 > - 5501 > > and the desired number for example: > > 550123555666 > > I guess the most efficient way would be to use some sort of 'tree' and > traverse each number from the beginning of destination number and > check > it in number's list and if we can't match N position to claim it to be > the longest prefix match ? > > Second question is the same as question one,but implies that to have > some additional data with prefix (route,price,user_id,etc.),what would > be algorithm looks like in this situation ? For example: > > - 889123456,100 > - 44712345678,100 > - 5550123456789,101 > - 32112345,101 > - 5501,100 > - 5550123456789,100 > > number is 550123555666,100 ,the problem would be to find LPM for > specific price (100),in this case there's no unique prefix,but there's > unique prefix+price 'object'. > > Anybody had any experience with this issues ? > > Sincerely > > Dragan Zubac > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jeffm@REDACTED Fri Nov 30 02:52:47 2007 From: jeffm@REDACTED (jm) Date: Fri, 30 Nov 2007 12:52:47 +1100 Subject: [erlang-questions] Longest prefix match In-Reply-To: <474F3B09.8070604@vlayko.tv> References: <474F3B09.8070604@vlayko.tv> Message-ID: <474F6CEF.3010003@ghostgun.com> I've implemented this a number of times in different languages for ip_address/bitmask, eg 192.168.1.0/24. What I say here may be a little IP centric. I should warn you I am by no means an expert either. Now the disclaimers are out of the way on with the show... Thing you can check out: patricia Tries Level Compression Tries (LC-Tries) List of Hashes This last one is the fastest I've found in software and easiest to implement in a high level language or at least a language which already provides hash algorithms and lists for you. It is memory hungry in comparisan with other method, but I found out later someone had investigated this or a similar algorithm and found it to be one of the fastest methods in software. In short, Imagine a list of tuples {dicts, maskbits} * mask the address MaskedAddress = Address band Mask or possibly MaskedAddress = << Address:Maskbits/integer-big>> * walk a list of {dicts, maskbits} to find the Maskbits entry. The first entry in the list will be for Maskbits = 32, the second for Maskbits = 31, etc assuming IPv4 * store MaskedAddress implies value in hash. eg, NewLevelDict = dict:store(MaskedAddress, Value, LevelDict) * To find the stored values you then search the hashes/dictionaries from the longest prefix to the shortest. search([{HeadDict, Maskbits}| Tail], Address) -> MaskedAddress = Address band Maskbits, case dict:find(MaskedAddress, HeadDict) of error -> search(Tail, Address); {value, Val} -> Val end. There's most likely errors in the foregoing, but it should be enough to give you the idea. Papers that may be of interest. search for paper with these titles/author I've lost the original links for these. "CS209 HOW-TO Series How to build Patricia Tries" "Data Structures For One-Dimensional Packet Classification Using Most-Specific-Rule Matching" Sartaj Sahni Kun Suk Kim Haibin Lu {sahni, kskim, halu} @cise.ufl.edu Department of Computer and Information Science and Engineering University of Florida, Gainesville, FL 32611 "IP-Address Lookup Using LC-Tries" Stefan Nilsson, Gunnar Karlsson IEEE Journal on Selected Areas in Communications 1999 "Analysis of Random LCTries" Luc Devroye 2001 "Survey & Taxonomy of Packet Classification Techniques" David E. Taylor WUCSE-2004-2 May 10, 2004 "Generalizing Generalized Tries" Ralf Hinze 1999 Hope that helps, Jeff. Dragan Zubac wrote: > Hello > > A couple of questions regarding 'lpm' algorithm if anyone has any > experience with this. > > What would be the most elegant and efficient way for LPM ? For > example,we have some list of numbers: > > - 889123456 > - 44712345678 > - 5550123456789 > - 32112345 > - 5501 > > and the desired number for example: > > 550123555666 > > I guess the most efficient way would be to use some sort of 'tree' and > traverse each number from the beginning of destination number and check > it in number's list and if we can't match N position to claim it to be > the longest prefix match ? > > Second question is the same as question one,but implies that to have > some additional data with prefix (route,price,user_id,etc.),what would > be algorithm looks like in this situation ? For example: > > - 889123456,100 > - 44712345678,100 > - 5550123456789,101 > - 32112345,101 > - 5501,100 > - 5550123456789,100 > > number is 550123555666,100 ,the problem would be to find LPM for > specific price (100),in this case there's no unique prefix,but there's > unique prefix+price 'object'. > > Anybody had any experience with this issues ? > > Sincerely > > Dragan Zubac > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jeffm@REDACTED Fri Nov 30 03:53:57 2007 From: jeffm@REDACTED (jm) Date: Fri, 30 Nov 2007 13:53:57 +1100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <7EFD904E-A396-4C3D-9B01-D114B1628449@smartgames.ca> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <9b59d0270711280635k18f9304fv2f1245045a10a826@mail.gmail.com> <4619BA95-1A97-44CB-BD42-59499543B529@gmail.com> <474DF71A.8020507@ghostgun.com> <08175112-DCFB-492F-B487-63841BA2C825@gmail.com> <474E6E42.7000602@ghostgun.com> <7EFD904E-A396-4C3D-9B01-D114B1628449@smartgames.ca> Message-ID: <474F7B45.8020304@ghostgun.com> Toby Thain wrote: >> Actually remembered it from a lecture in Strategic Management would have >> been much cheaper to have read it in a book though. "Blue Ocean >> Statregy" sits on my bookshelf half read due to a lack of time. Is there >> any reason why a programming language doesn't lend itself to having a >> strategy? Erlang seems to have been born with one due to its heritage! > > I think Joe nailed "Erlang's strategy" in his post... Sharpen your axe > until the right moment then chop like hell. > Agreed. Jeff. From jeffm@REDACTED Fri Nov 30 03:54:33 2007 From: jeffm@REDACTED (jm) Date: Fri, 30 Nov 2007 13:54:33 +1100 Subject: [erlang-questions] 64-bit erlang In-Reply-To: References: <474D2E90.80603@ericsson.com> <474DED25.7060708@ghostgun.com> Message-ID: <474F7B69.5040603@ghostgun.com> Bjorn Gustavsson wrote: > On a 64-bit machine, one instruction would be enough: > > init6 {y,0} {y,1} {y,2} {y,5} {y,6} {y,8} > > Only two words would be needed. > > (This was only an example. A sequence of 6 init instructions is probably > not that commone, especically not in R12B.) > Thanks. Jeff. From billrobertson42@REDACTED Fri Nov 30 05:33:00 2007 From: billrobertson42@REDACTED (Bill Robertson) Date: Thu, 29 Nov 2007 20:33:00 -0800 (PST) Subject: [erlang-questions] erl_interface and/or sending binary data to drivers Message-ID: <93152.15159.qm@web51904.mail.re2.yahoo.com> In the erl_interface documenation (3.5.5.3) it states that you must call erl_init once and only one. --- 1.2 Initializing the erl_interface Library Before calling any of the other Erl_Interface functions, you must call erl_init() exactly once to initialize the library...." --- Does this apply to a driver? If so, how would you manage that? An Erlang program could load any arbitrary driver. How could I possibly make sure that somebody else's driver didn't call it when mne does? Or is erl_interface not used in drivers? I'm new to Erlang, so maybe I'm just making this too hard. What I really want to send some sort of code to the driver to indicate which function to call, and then send in binary format, an series of floats that are contiguous in memory. Then I want to do some math in the c code and return 1 or more floats in binary format. Any help will be appreciated. Thanks ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From david.hopwood@REDACTED Fri Nov 30 06:33:51 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Fri, 30 Nov 2007 05:33:51 +0000 Subject: [erlang-questions] Lisp syntax for Erlang In-Reply-To: <3dbc6d1c0711291506u21502d83i2e4a1a09b041c24d@mail.gmail.com> References: <3dbc6d1c0711251803j552680e5v4ab1f05116bd3938@mail.gmail.com> <3dbc6d1c0711291506u21502d83i2e4a1a09b041c24d@mail.gmail.com> Message-ID: <474FA0BF.4030905@industrial-designers.co.uk> Robert Virding wrote: > Bengt is right Erlisp would probably be better as Elisp is already taken (by > Emacs lisp), which I do know being an old Elisp hacker my self. It was just > a mild "in joke". Erlisp is also taken: (this project is an Erlang-inspired message passing library for CL, not a full language implementation). -- David Hopwood From fritchie@REDACTED Fri Nov 30 06:36:16 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 29 Nov 2007 23:36:16 -0600 Subject: [erlang-questions] newbie question In-Reply-To: Message of "Thu, 29 Nov 2007 10:53:20 +0100." <8268eea30711290153m1e2f3549h12ec787ebebf2321@mail.gmail.com> Message-ID: <200711300536.lAU5aGx8013264@snookles.snookles.com> >>>>> "ah" == Andreas Hillqvist writes: ah> I am uncertain if the index for item, gives keysort any ah> performance gain. Maybe some one else can answer this? I'd guess not, but I'm just guessing: a fold will likely traverse the entire table. One sneaky thing you can do is toss in a mnesia:info() at the end of your Mnesia txn-implementing function, then look at the top of the report for locks that are being held (all of them by that transaction, if there are no other Mnesia transactions running). IIRC, fold operations will take ___WHOLETABLE___ locks (or something looking vaguely like that). That's one way to answer the question ... is Mnesia locking anything more/less than I expect it to? -Scott From david.hopwood@REDACTED Fri Nov 30 06:59:40 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Fri, 30 Nov 2007 05:59:40 +0000 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <563465.33601.qm@web60524.mail.yahoo.com> References: <563465.33601.qm@web60524.mail.yahoo.com> Message-ID: <474FA6CC.50700@industrial-designers.co.uk> Isaac Gouy wrote: > --- David Hopwood wrote: > > -snip- >> BTW, anyone who has spent much time on benchmarking knows that you >> cannot get reliable results from runs this short. I'm astonished that >> I am having to argue this point. > > You state that as an absolute - afaict it would depend on how fast the > machine was and the resolution of the time measurements. It doesn't depend (as a first-order approximation) on how fast the machine is, because you're running the benchmarks for fixed problem sizes. A problem size that runs for 0.10 s on a 2.2 Ghz AMD Sempron, for example, is too small to give you reliable results on any machine, regardless of its speed. Most of the unreliability I'm talking about is not due to timing measurement error -- it's due to dependency of the results on factors that don't tell you anything useful about the general performance of the language implementation, such as how the code from a particular compilation happened to be placed in cache. -- David Hopwood From jim.mccoy@REDACTED Fri Nov 30 06:12:31 2007 From: jim.mccoy@REDACTED (Jim McCoy) Date: Thu, 29 Nov 2007 21:12:31 -0800 Subject: [erlang-questions] how: notify a static child when a supervisor restarts Message-ID: I have a supervisor with one static child and a variable number of dynamic children that are added (by the static child) once the supervisor starts running. According to the docs, if the supervisor restarts the dynamic children are toast. Since the static child, which is basically a manager for the dynamic child processes, has the info it needs to re-inject the dynamic child specs I was not too worried when I started coding things. Where I am running into problems is catching the supervisor restart. Do I need to link the static child to the super and trap its exits or am I missing something? Thanks, jim From bengt.kleberg@REDACTED Fri Nov 30 08:57:48 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 30 Nov 2007 08:57:48 +0100 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: References: <664047.91512.qm@web60522.mail.yahoo.com> <474F30BD.3020902@industrial-designers.co.uk> Message-ID: <474FC27C.1060301@ericsson.com> greetings, since this thread contains several different discussions going in various directions at different speeds it would be helpful if you could be more specific. if you only have seen one of them i understand why you did not do this, but it would be helpful if you include the context below you email. thank you. it is unfortunate when this situation occurs. one solution would be to fork the thread (like this: New question, nothing to do with the subject matter of this discussion. WAS: benchmarks game harsh criticism). however, i think it is impolite, and likely to upset, to fork the thread for somebody else when it is they themselfs that keep adding subjects to their own thread. on the other hand, if i wanted to introduce a new subject, and keep it going, in a thread started by somebody else, i would hopefully remember to fork. currently i try to cope by limiting my posts to maximum one per discussion per day. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/29/07 22:51, Christian S wrote: > Are you guys getting anywhere with this discussion? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jerith@REDACTED Fri Nov 30 09:00:58 2007 From: jerith@REDACTED (Jeremy Thurgood) Date: Fri, 30 Nov 2007 10:00:58 +0200 Subject: [erlang-questions] Erlounge (sort of) Cape Town Message-ID: <474FC33A.8030205@jerith.za.net> Good day all, A bunch of programmers (and other interesting people) in Cape Town, South Africa are organising a weekend of code and fun called *Camp next weekend. I am planning to run a little Erlang tutorial/hackathon thing sometime over the course of the weekend and am keen to drink a beer (or some other beverage) with any other Erlangers who might be there. Thanks, --J -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3249 bytes Desc: S/MIME Cryptographic Signature URL: From alex.arnon@REDACTED Fri Nov 30 09:03:53 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Fri, 30 Nov 2007 10:03:53 +0200 Subject: [erlang-questions] emacs+job control In-Reply-To: <200711291231.17267.bekesa@sch.bme.hu> References: <200711291231.17267.bekesa@sch.bme.hu> Message-ID: <944da41d0711300003g742ea70g461eac5de5a66ff7@mail.gmail.com> I thing CTRL-Q should quote the following character, so maybe CTRL-Q CTRL-G? On Nov 29, 2007 1:31 PM, Andras Georgy Bekes wrote: > Hello, > > I find the job control menu of the Erlang shell (where you get after > pressing Ctrl+g) very useful, but Ctrl+g does not work for an Erlang > shell inside Emacs. > > I've tried to find this info on the net but haven't found anything > useful :-( > > Does anyone know how I can get into that menu of an Erlang shell inside > Emacs? > > Georgy > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yinso.chen@REDACTED Fri Nov 30 09:53:09 2007 From: yinso.chen@REDACTED (YC) Date: Fri, 30 Nov 2007 00:53:09 -0800 Subject: [erlang-questions] revamped mysql driver: no disconnect? Message-ID: <779bf2730711300053n234f7b02xa9a38dc4b34d4b7d@mail.gmail.com> Hi all - I have a question regarding the revamped mysql driver (by the way I like its interface design) - it seems that there is no call to disconnect... do the connection just go out of scope and disconnect itself, or how to disconnect to prevent resource leak? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri Nov 30 10:09:08 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 30 Nov 2007 10:09:08 +0100 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: References: <375691.17118.qm@web81211.mail.mud.yahoo.com> <474E3520.1010903@industrial-designers.co.uk> Message-ID: <474FD334.9060402@ericsson.com> greetings, (personal message to brent: it is nice to see you in this discussion. you come across as ''the good cop'' from the shootout.) on the shootout email list some years ago the problem of too short runtimes was discussed. one solution was to have a fixed the runtime, and measure the input for this runtime. i even wrote and submitted a program that would find the right input given a sought-after runtime and a percentage (max deviation). since this was not what i wanted from the shootout i never pushed the concept. still, it is an alternative. on the other hand, limiting the shootout to the lowest common denominator, that is the opposite of what i want from shootout. it is possible to allow a wide range of entries provided they are shown on a graph instead of as a number. that is what i want. it is not necessary to have every language getting a time for every input if they are graphed. you can remove the too fast entries and the too slow entries, the difference in performance is possible to see anyway. bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/29/07 09:14, Brent Fulgham wrote: ...deleted > If you are concerned with the variation in the sub-second results, it > would be reasonable > to cull out the worst implementations and perform tests for higher > values of N. But that > would prevent a wide range of entries, so to some extent it is a matter > of limiting > ourselves to the lowest common denominator. > ...deleted > -Brent > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bjorn@REDACTED Fri Nov 30 10:14:57 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 30 Nov 2007 10:14:57 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: <3dbc6d1c0711291115r648447dev45de823a0ee4157@mail.gmail.com> References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <3dbc6d1c0711291115r648447dev45de823a0ee4157@mail.gmail.com> Message-ID: "Robert Virding" writes: > On 29/11/2007, James Hague wrote: > > The erlang VM is quite fantastic, but it is also quite restricted. There are > many things it can NOT handle, for example destructive updates of objects. > There are no instructions in the BEAM for doing that, at least there > weren't. Bj?rn? There are no general destructive operations. Destructive operations would need a write barrier in the GC, which it doesn't have. There is a very limited destructive setelement instruction. It must be preceeded by a call to the setelement/3 BIF (because of the lack of write barrier, it would not be safe to use in other contexts). The compiler uses this instruction to optimize record updates. > This severely restricts which languages you can implement on > it. For example you cannot do a complete Scheme as it has destructive > operations. I am not thinking about set! which is easy as it only modifies > the environment but functions like vector-set! and string-set! which > actually destructively modifies the objects themselves. > > I think adding that type of operation to the BEAM could be quite difficult > as the effects are quite profound. Yes. Besides the lack of write barrier, message sending and storing into ETS cannot cope with the cyclic data structures that are possible to create using destructive updates. Same problem with term_to_binary/1. > There are actually 4 different layers in the compiler to which you could > compile: > > - Erlang > - Core Erlang > - Kernel Erlang > - BEAM code > > The kernel level is a low-level non BEAM specific layer which could be > compiled to any register machine. It would probably work against a stack > machine as well. It was a while since I worked on it so I can't remember ALL > the details. Don't use Kernel Erlang. It is an internal format that may change at any time, and it is entirely undocumented. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bengt.kleberg@REDACTED Fri Nov 30 10:20:37 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 30 Nov 2007 10:20:37 +0100 Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <376840.35666.qm@web60517.mail.yahoo.com> References: <376840.35666.qm@web60517.mail.yahoo.com> Message-ID: <474FD5E5.1000104@ericsson.com> greetings, thanks for the answer. i especially appreciate that you will not harass me and instead make it easy for me. that is good because it really feels uncomfortable to be the target of your normal email writing. quotes from "Timing Trials, or, the Trials of Timing" as per request: "* Memory-related issues and the effects of memory hierarchies are pervasive: how memory is managed, from hardware caches to garbage collection, can change runtimes dramatically. Yet users have no direct control over most aspects of memory management. " "We started to construct a table with three dimensions: task, programming language, and machine. Eventually we added the size of the problem solved by the program as a fourth dimension, and we changed the presentation from tables to graphs. Varying the problem size helped us to detect unusual runtime effects, while a graphical presentation highlights patterns and trends in runtime instead of individual performance scores." "We designed tests whose runtime should grow linearly with the size of the problem: runtime = m??size + b. Thus, if we choose size to be large enough to justify ignoring the fixed overhead (b), the log-log plot should show a straight line of unit slope. Exceptions indicate anomalous behavior that deserves further attention." Now it is your turn. could you quote the exact words where they say that 4 inputs and a spread of x10 is good enough? bengt Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." On 11/28/07 19:20, Isaac Gouy wrote: > --- Bengt Kleberg wrote: > -snip- >> however, at this time i really would like for you, Isaac Gouy, to do >> more work when it comes to answering emails in this thread. it is not >> pressing, take your time, but i have one outstanding question that i >> would appreciate if you answered so that i may move on with the rest. > > > When you asked a meta-question > >>> what does this question have to do with the subject matter of this >>> discussion? > > and ignored all parts of my post that directly addressed what you read > into Kernighan and Van Wyk, it seemed to me you did not want to discuss > the comments you had made, and it wasn't so important to me that I > would harass you until you answered. > > > I'll make it easy for you - the question has nothing to do with the > subject matter of this discussion - it's an aside. > > > I asked that you quote the exact words where "kvw recommends > investigating" a wide spectrum of inputs. > > > > ____________________________________________________________________________________ > Be a better sports nut! Let your teams follow you > with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jan@REDACTED Fri Nov 30 10:33:00 2007 From: jan@REDACTED (Jan Henry Nystrom) Date: Fri, 30 Nov 2007 10:33:00 +0100 Subject: [erlang-questions] Erlounge (the real deal) in Centurion, South Africa, Dec 5th 2007 Message-ID: <474FD8CC.9060008@erlang-consulting.com> Greetings to you all, Since Erlang Training anc Consulting is giving a course in South Africa we are also organising a Erlounge in Centurion. For those interested, we meet up at 6.30 pm at the News Cafe, Jean Avenue in Centurion. There we will discuss important issues of the day(e.g. the upcoming R12 release), stock up on vitamine B(drink beer) and generally have fun. /Cheers Henry -- Jan Henry Nystrom Training Manager @ Erlang Training and Consulting Ltd http://www.erlang-consulting.com From erlang@REDACTED Fri Nov 30 10:45:39 2007 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 30 Nov 2007 10:45:39 +0100 Subject: [erlang-questions] idea: DB in Prolog application in Erlang Message-ID: <9b08084c0711300145v162a3f67nf3869f0bf2334848@mail.gmail.com> Question: A long time ago Erlang started as a extension to Prolog ... Now Prolog is a wonderful language for querying databases in - <> So why when we talk about Erlang + an external data base do we automatically reach for an SQL data base? I haven't been actively following the Prolog world, so here's my questions: Are there any prolog data bases with ACID properties. I'd like something that is - open source - resident (is runs like mySQL as a resident task on my machine) - can handle large amounts of data (meaning I could store several giga facts in the DB) - has ACID properties Given the similarity between Erlang and Prolog data structures integration between the two languages could be very nice. Embedded prolog queries in Erlang would be *very* nice, just interpreting erlang variables as prolog logical variables. Comments anybody? /Joe Armstrong From richardc@REDACTED Fri Nov 30 11:13:58 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 30 Nov 2007 11:13:58 +0100 Subject: [erlang-questions] Forget Erlang on the Java VM. More language on the Erlang VM are needed! In-Reply-To: References: <04673A58-3AD0-496A-BBA3-3B21D96E2112@gmail.com> <944da41d0711280131qa016a28y42a0d5330abb6735@mail.gmail.com> <82DA1322-ADA6-44A6-ADD9-2B44EE849795@gmail.com> <9b59d0270711280325jeb09a0cw7017eaae8a977d91@mail.gmail.com> <474D5856.1040909@ericsson.com> <9b59d0270711280514i32cf2043m8259d20416c51e5e@mail.gmail.com> <3dbc6d1c0711291115r648447dev45de823a0ee4157@mail.gmail.com> Message-ID: <474FE266.4060600@it.uu.se> Bjorn Gustavsson wrote: > Don't use Kernel Erlang. It is an internal format that may change at any time, > and it is entirely undocumented. Also note that it is not at all strictly necessary; it is basically a kind of "intermediate convenience format" used by the Beam compiler when going from Core Erlang down to Beam code (and it's not the only such format either; there are a couple of other entirely undocumented more-or-less Beam-like representations before you get to actual Beam assembler). The HiPE native code compiler, when compiling from Erlang source code, goes directly from the Core Erlang level (which is the last common step for Beam and HiPE) to an assembler-like intermediate format called Icode. This is further translated down to an abstract register transfer language and then mapped to target machine code. We try to do as much as possible on the functional Core language before going to a basic block representation. If you want to experiment with the Erlang VM as a backend for some other language than Erlang, I'd recommend (in this order, and depending on what level of detail you need to be able to get down to): 1. Core Erlang 2. Beam 3. Icode (currently only for generating native code) All of these are stable, more or less documented, and _sensible_ representations of Erlang code. Dig around in the source code for the Beam and HiPE compilers (lib/{compiler,hipe}/src) for details. /Richard From nicolas@REDACTED Fri Nov 30 11:21:20 2007 From: nicolas@REDACTED (Nicolas Niclausse) Date: Fri, 30 Nov 2007 11:21:20 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: References: <474AB442.4020802@vlayko.tv> Message-ID: <474FE420.5040905@niclux.org> Christian S ecrivait le 27.11.2007 17:23: > The postgres driver in jungerl has no test suite that one use to > verify how good it is. I think process one uses their postgres driver > as an optional db backend in jabberd so it should have some more > widespread production use, but im guessing. the postgres driver from jungerl is used by tsung; no bug has been reported, so the driver must be ok, i guess :) -- Nicolas From nindeu@REDACTED Fri Nov 30 13:36:31 2007 From: nindeu@REDACTED (nindeu@REDACTED) Date: Fri, 30 Nov 2007 13:36:31 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <474FE420.5040905@niclux.org> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> Message-ID: <20071130123631.8920@gmx.net> Hi, I am quite confused. And if I search the different mailing lists on trapexit for postgres I get the feeling that I am not alone. I investigated just a little bit, so let me try to summarize what I found so far. Maybe we can bring some light into what realistic options exist for postgres? Please correct me and maybe add your own experiences! I think we have the following options: Erlang OTP ODBC: ~~~~~~~~~~~~~~~~ Source: Included in Erlang. Remarks: + Laura successfully uses it in production. + A patch exists for in/out parameters of stored procedures: http://forum.trapexit.org/mailinglists/viewtopic.php?t=10254&highlight=postgres Might get incorporated into R12B-1 Christian's native driver in Jungerl: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Source: http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/pgsql/ Remarks: + Christian seems to updates it if you send him usefull patches. + Tsung uses it. Process-one's native driver: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Source: I guess: https://forge.process-one.net/browse/ejabberd-modules/pgsql Remarks: + ejabberd might use it. But I think it's not included in the default installation. And according to http://www.ejabberd.im/node/537 it is recommended to use Christian's Jungerl version. That would mean that probably most people use the Jungerl version. Can anyone comment/confirm? + I think this is a branch of Christian's driver, not including his latest patches but others. erlang-consulting's native driver: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Source: http://www.erlang-consulting.com/aboutus/opensource.html Remarks: + Seems to be used by http://erlyweb.org/. Possibly a modified version. If you have first hand experiences, maybe you can elaborate a bit regarding stability, performance and features? Regards, Eric -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger From chsu79@REDACTED Fri Nov 30 14:00:37 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 30 Nov 2007 14:00:37 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <20071130123631.8920@gmx.net> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> Message-ID: Yes it is all a mess. The following thread last year was full of good ideas for what I really want generalized erlang sql access to be: http://www.nabble.com/Simple-DB-Access-t2028308.html I recall reading that OTP was looking into building a generalized database layer which made me feel less "responsible" for clearing up mess. Kenneth Lundin: got a comment? PS. I pondered publishing pgsql as a GIT repo, but that would create yet another version, adding to the confusion. Perhaps the benefits outweigh that? 2007/11/30, nindeu@REDACTED : > Hi, > > I am quite confused. And if I search the different mailing lists on trapexit for postgres I get the feeling that I am not alone. From joelr1@REDACTED Fri Nov 30 14:25:26 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 30 Nov 2007 13:25:26 +0000 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> Message-ID: On Nov 30, 2007, at 1:00 PM, Christian S wrote: > I pondered publishing pgsql as a GIT repo, but that would create yet > another version, adding to the confusion. Perhaps the benefits > outweigh that? Does everyone hate Google Code? I think it's a step up from SourceForge (the forums are horrendous). -- http://wagerlabs.com From olopierpa@REDACTED Fri Nov 30 14:31:32 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Fri, 30 Nov 2007 14:31:32 +0100 Subject: [erlang-questions] idea: DB in Prolog application in Erlang In-Reply-To: <9b08084c0711300145v162a3f67nf3869f0bf2334848@mail.gmail.com> References: <9b08084c0711300145v162a3f67nf3869f0bf2334848@mail.gmail.com> Message-ID: <7352e43a0711300531n657f741fm7ff1b96e831d9a76@mail.gmail.com> On Nov 30, 2007 10:45 AM, Joe Armstrong wrote: > Are there any prolog data bases with ACID properties. No. Not even close. P. From chsu79@REDACTED Fri Nov 30 14:35:28 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 30 Nov 2007 14:35:28 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> Message-ID: > Does everyone hate Google Code? > > I think it's a step up from SourceForge (the forums are horrendous). That question is begging for a long off-topic thread about the merits of various kinds of version control systems. We have the blogosphere for that. :) From sean.hinde@REDACTED Fri Nov 30 14:54:57 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 30 Nov 2007 13:54:57 +0000 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> Message-ID: <242FE808-20BD-42A6-BE9E-2E5F169C489C@gmail.com> On 30 Nov 2007, at 13:00, Christian S wrote: > PS. > I pondered publishing pgsql as a GIT repo, but that would create yet > another version, adding to the confusion. Perhaps the benefits > outweigh that? When the building is falling to pieces all around it's time to go ponder on an alternative brand of nail. One that almost no-one has the right kind of hammer to insert. Yep, seems like a plan ;-) Sean From chandrashekhar.mullaparthi@REDACTED Fri Nov 30 15:07:50 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 30 Nov 2007 14:07:50 +0000 Subject: [erlang-questions] how: notify a static child when a supervisor restarts In-Reply-To: References: Message-ID: On 30/11/2007, Jim McCoy wrote: > I have a supervisor with one static child and a variable number of > dynamic children that are added (by the static child) once the > supervisor starts running. According to the docs, if the supervisor > restarts the dynamic children are toast. Since the static child, > which is basically a manager for the dynamic child processes, has the > info it needs to re-inject the dynamic child specs I was not too > worried when I started coding things. Where I am running into > problems is catching the supervisor restart. Do I need to link the > static child to the super and trap its exits or am I missing > something? > If you supervisor has restarted, the static child will be killed and respawned by the supervisor. Your static child then spawns all the dynamic ones at startup. Or have I missed the point? cheers Chandru From christophe.romain@REDACTED Fri Nov 30 15:19:53 2007 From: christophe.romain@REDACTED (Christophe ROMAIN) Date: Fri, 30 Nov 2007 15:19:53 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <20071130123631.8920@gmx.net> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> Message-ID: <81AEAAA3-8E6F-4873-B61F-13BB63C890EB@process-one.net> The version stored on ejabberd-modules contains all stability patches and should be up-to-date. It's bundled with default ejabberd package and running in production. We are ready to maintain a centralized up-to-date svn repository for both pgsql and mysql driver if we get patches. From csanto@REDACTED Fri Nov 30 15:37:04 2007 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 30 Nov 2007 15:37:04 +0100 Subject: [erlang-questions] idea: DB in Prolog application in Erlang In-Reply-To: <9b08084c0711300145v162a3f67nf3869f0bf2334848@mail.gmail.com> References: <9b08084c0711300145v162a3f67nf3869f0bf2334848@mail.gmail.com> Message-ID: <47502010.30508@diit.unict.it> Joe Armstrong wrote: > Are there any prolog data bases with ACID properties. Are you talking about something like this? http://en.wikipedia.org/wiki/Datalog --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From ghazan@REDACTED Fri Nov 30 15:40:25 2007 From: ghazan@REDACTED (George B Hazan) Date: Fri, 30 Nov 2007 17:40:25 +0300 Subject: [erlang-questions] etop returns garbage Message-ID: <032101c8335e$f4930f80$e600000a@users.rbc.ru> Hello. I tried to use etop to profile my ejabberd, but got nothing but a bunch of strings like ============== 8< ============== >8 ============== Erlang top got garbage {trace_ts,<4391.27752.0>, out, {gen_fsm,loop,7}, {1196,433374,653419}} Erlang top got garbage {trace_ts,<4391.21022.4>, out, {gen,wait_resp_mon,3}, {1196,433374,654029}} Erlang top got garbage {trace_ts,<4391.21038.4>, out, {gen,wait_resp_mon,3}, {1196,433374,654041}} ============== 8< ============== >8 ============== What am I doing wrong? -- WMBR, George Hazan (ghazan@REDACTED) From nindeu@REDACTED Fri Nov 30 16:06:41 2007 From: nindeu@REDACTED (nindeu@REDACTED) Date: Fri, 30 Nov 2007 16:06:41 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <81AEAAA3-8E6F-4873-B61F-13BB63C890EB@process-one.net> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> <81AEAAA3-8E6F-4873-B61F-13BB63C890EB@process-one.net> Message-ID: <20071130150641.8960@gmx.net> On Nov 30, 2007 2:00 PM, Christian S wrote: > Yes it is all a mess. The following thread last year was full of good > ideas for what I really want generalized erlang sql access to be: > > http://www.nabble.com/Simple-DB-Access-t2028308.html edbc would for sure be a greate thing. Just look what significant value jdbc forms. It's one of the core technologies of so many java projects. Hmmm, I am pretty convinced it's not an easy task to create some kind of edbc. > I recall reading that OTP was looking into building a generalized > database layer which made me feel less "responsible" for clearing up > mess. *Shaking my head* As if you were responsible for the mess! Hey, people owe you a lot since you put a lot of time into creating a piece of software others apparently use a lot! On Nov 30, 2007 3:19 PM, Christophe ROMAIN wrote: > The version stored on ejabberd-modules contains all stability patches > and should be up-to-date. > It's bundled with default ejabberd package and running in production. Sorry for indicating incorrect information regarding the use of pgsql in ejabberd! I was only looking at the source code version of ejabberd. My apologies! Regarding up-to-dateness (is this an english expression?) of your version: What I meant with your driver not including all patches of Christian but incorporating a few others: Just look at the next version of Christian's driver after you branched: http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/pgsql/src/pgsql_util.erl?r1=1.4&r2=1.5 But I have to admit, I currently do not know what the background of these changes is. Regards, Eric -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail From joelr1@REDACTED Fri Nov 30 16:28:25 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 30 Nov 2007 15:28:25 +0000 Subject: [erlang-questions] init:restart in a gen_server Message-ID: Folks, Are there any conditions under which init:restart/0 would stop working? It works fine on a local node when triggered from the Erlang shell. I have gen_server code that looks like this handle_cast('RESTART', Self) -> F = fun() -> init:restart() end, spawn(F), {noreply, Self}; and it doesn't seem to work when 'RESTART' is received. What I mean by doesn't seem to work is that the apps are not restarted, at least according to log files. Any suggestions? Thanks, Joel -- http://wagerlabs.com From ulf.wiger@REDACTED Fri Nov 30 16:32:52 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 30 Nov 2007 16:32:52 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <20071130150641.8960@gmx.net> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> <81AEAAA3-8E6F-4873-B61F-13BB63C890EB@process-one.net> <20071130150641.8960@gmx.net> Message-ID: <47502D24.5080304@ericsson.com> nindeu@REDACTED skrev: > On Nov 30, 2007 2:00 PM, Christian S wrote: >> Yes it is all a mess. The following thread last year was full of good >> ideas for what I really want generalized erlang sql access to be: >> >> http://www.nabble.com/Simple-DB-Access-t2028308.html > > edbc would for sure be a greate thing. Just look what significant > value jdbc forms. It's one of the core technologies of so many java > projects. > Hmmm, I am pretty convinced it's not an easy task to create some kind > of edbc. On the topic of coordinating external DB transactions with mnesia transactions, I think some form of extension of the mnesia callback API is needed. I introduced some extra callback functions for rdbms, in the form of patches to mnesia: begin_activity(Type, Factor, Tid, Ts) -> void() pre_commit(Result, Type, Tid, Ts) -> void() end_activity(Result, Type, Tid, Ts) -> void() I made them optional, to be compatible with old callbacks. With some peeking into mnesia's activity state, it is possible to determine in begin_activity/4 whether the transaction has been restarted, or whether it's a nested transaction. Crashes in begin_activity/4 or end_activity/4 lead to mnesia dumping core. A crash in pre_commit leads to a transaction abort. I haven't given much thought to what would be required to synch with e.g. MySql or PostgreSQL, but perhaps these could form a starting point for such a discussion. BR, Ulf W From chsu79@REDACTED Fri Nov 30 16:45:06 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 30 Nov 2007 16:45:06 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <20071130150641.8960@gmx.net> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> <81AEAAA3-8E6F-4873-B61F-13BB63C890EB@process-one.net> <20071130150641.8960@gmx.net> Message-ID: http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/pgsql/src/pgsql_util.erl?r1=1.4&r2=1.5 > > But I have to admit, I currently do not know what the background of these changes is. I was playing with converting sql/postgres types into structured types. A postgres result set includes column type information, so the code can parse up, say, a timestamp to the {Date, Time} tuple we're used to. Among other things. Of course, as these things are added, they also break existing code that unknowingly just upgrade to the latest version. This is how I contribute to the mess. PS. Java is in a different situation with jdbc, because they dont have mnesia which solves 90% of all erlang-projects' persistence problems. From christophe.romain@REDACTED Fri Nov 30 16:48:12 2007 From: christophe.romain@REDACTED (Christophe ROMAIN) Date: Fri, 30 Nov 2007 16:48:12 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <20071130150641.8960@gmx.net> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> <81AEAAA3-8E6F-4873-B61F-13BB63C890EB@process-one.net> <20071130150641.8960@gmx.net> Message-ID: > Regarding up-to-dateness (is this an english expression?) of your > version: What I meant with your driver not including all patches of > Christian but incorporating a few others: Just look at the next > version of Christian's driver after you branched: > http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/pgsql/src/ > pgsql_util.erl?r1=1.4&r2=1.5 That's why i said "should" :) We patched the code to make it stable with ejabberd and integrated it in our svn repository not to depend on sourceforge.net accessibility. But we did not merged the last patch anyway. One just need to define which "official" repository to use and merge all patches. we use and need pgsql, that's why we are candidate to host the svn repository. by now, it's part of ejabberd-modules https://forge.process-one.net/browse/ejabberd-modules/pgsql From chsu79@REDACTED Fri Nov 30 16:49:04 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 30 Nov 2007 16:49:04 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <47502D24.5080304@ericsson.com> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> <81AEAAA3-8E6F-4873-B61F-13BB63C890EB@process-one.net> <20071130150641.8960@gmx.net> <47502D24.5080304@ericsson.com> Message-ID: > I haven't given much thought to what would be required > to synch with e.g. MySql or PostgreSQL, but perhaps these > could form a starting point for such a discussion. That is an interesting thought, PostgreSQL has support for two-phase commit right now, so one could mirror mnesia transactions out to it. From bneppert@REDACTED Fri Nov 30 18:55:53 2007 From: bneppert@REDACTED (Burkhard Neppert) Date: Fri, 30 Nov 2007 18:55:53 +0100 Subject: [erlang-questions] Question about higher order function Message-ID: <47504EA9.9040508@gmx.de> Hello, I try to use higher order functions but cannot pass functions as argument unless I wrap them in an anonymous function. Can someone tell me if I'm doing something wrong here or if Erlang is really so akward and clumsy why it is this way? Regards Burkard Neppert -module(HOF). -export([first/1]). fst({A,B}) -> A. % This does not compile % first(L) -> % lists:map(fst, L). % but this does: first(L) -> lists:map(fun (E) -> fst(E) end, L). % but this is terrible %%%%% From jan@REDACTED Fri Nov 30 19:02:53 2007 From: jan@REDACTED (Jan Henry Nystrom) Date: Fri, 30 Nov 2007 19:02:53 +0100 Subject: [erlang-questions] Question about higher order function In-Reply-To: <47504EA9.9040508@gmx.de> References: <47504EA9.9040508@gmx.de> Message-ID: <4750504D.20204@erlang-consulting.com> Hi, If you write -module(HOF). -export([first/1]). fst({A,B}) -> A. first(L) -> lists:map(fun fst/1, L). It is less awkward. /Cheers Henry Burkhard Neppert wrote: > Hello, > > I try to use higher order functions but cannot pass functions as > argument unless > I wrap them in an anonymous function. > Can someone tell me if I'm doing something wrong here or if Erlang is > really so > akward and clumsy why it is this way? > > Regards > > Burkard Neppert > > -module(HOF). > -export([first/1]). > fst({A,B}) -> A. > % This does not compile > % first(L) -> > % lists:map(fst, L). > % but this does: > first(L) -> > lists:map(fun (E) -> fst(E) end, L). % but this is terrible > > %%%%% > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Jan Henry Nystrom Training & Research Manager @ Erlang Training and Consulting Ltd http://www.erlang-consulting.com From dking@REDACTED Fri Nov 30 19:04:34 2007 From: dking@REDACTED (David King) Date: Fri, 30 Nov 2007 10:04:34 -0800 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> Message-ID: <60438E7D-519D-48BC-A1EE-77016D83A251@ketralnis.com> >> I pondered publishing pgsql as a GIT repo, but that would create yet >> another version, adding to the confusion. Perhaps the benefits >> outweigh that? > Does everyone hate Google Code? > I think it's a step up from SourceForge (the forums are horrendous). Not everyone: This PostgreSQL driver for Erlang has been initially based on the original PostgreSQL driver obtained from Erlang Consulting (at http:// erlang-consulting.com/aboutus/opensource.html) and after providing them a patch they provided me a development snapshot of a completely rewritten driver which turned out to work better for me with erlyweb. From jim.mccoy@REDACTED Fri Nov 30 19:28:56 2007 From: jim.mccoy@REDACTED (Jim McCoy) Date: Fri, 30 Nov 2007 10:28:56 -0800 Subject: [erlang-questions] how: notify a static child when a supervisor restarts In-Reply-To: References: Message-ID: The static child does not start up with the list of dynamic children it creates, these children are created in response to other messages it is passed after startup. The basic scenario here is that after startup the static child is passed directory names that it verifies and scans for certain files, when these files are found it creates a dynamic worker process to handle the file. I am guessing that I will have to re-think things a bit and create a process outside this supervision tree that will maintain state on the directories that have been added and link this to the static child to deal with re-injecting state after resets. jim On Nov 30, 2007 6:07 AM, Chandru wrote: > > If you supervisor has restarted, the static child will be killed and > respawned by the supervisor. Your static child then spawns all the > dynamic ones at startup. Or have I missed the point? > > cheers > Chandru > From igouy2@REDACTED Fri Nov 30 19:49:53 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Fri, 30 Nov 2007 10:49:53 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474FA6CC.50700@industrial-designers.co.uk> Message-ID: <897638.73412.qm@web60523.mail.yahoo.com> --- David Hopwood wrote: > It doesn't depend (as a first-order approximation) on how fast the > machine is, because you're running the benchmarks for fixed problem > sizes. A problem size that runs for 0.10 s on a 2.2 Ghz AMD Sempron, > for example, is too small to give you reliable results on any > machine, > regardless of its speed. > > Most of the unreliability I'm talking about is not due to timing > measurement error -- it's due to dependency of the results on factors > that don't tell you anything useful about the general performance of > the language implementation, such as how the code from a particular > compilation happened to be placed in cache. Again you haven't provided any example of an anomaly in the benchmarks game measurements (let alone Erlang program measurements) that might correspond to this "unreliability". Maybe I just have less time on my hands, this is too much like chasing phantoms for me. By all means pile-up criticisms in the benchmarks game discussion forum. I'll leave you with the last word, and with the hope that you will say whether or not you think the proportion of startup/shutdown in the Erlang program measurements I've reported supports your claim that "the resulting bias is quite large". ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From kostis@REDACTED Fri Nov 30 20:41:29 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 30 Nov 2007 21:41:29 +0200 Subject: [erlang-questions] Question about higher order function In-Reply-To: <47504EA9.9040508@gmx.de> References: <47504EA9.9040508@gmx.de> Message-ID: <47506769.9000909@cs.ntua.gr> Burkhard Neppert wrote: > Hello, > > I try to use higher order functions but cannot pass functions as > argument unless I wrap them in an anonymous function. > Can someone tell me if I'm doing something wrong here or if Erlang is > really so akward and clumsy why it is this way? Not knowing a language and trying to learn it is OK - it's a very good thing actually. Not knowing a language and characterizing it with adjectives such as "awkward", "clumsy" and "terrible" is not particularly constructive in my opinion. > -module(HOF). > -export([first/1]). > fst({A,B}) -> A. > % This does not compile > % first(L) -> > % lists:map(fst, L). > % but this does: > first(L) -> > lists:map(fun (E) -> fst(E) end, L). % but this is terrible First of all, please pay attention to details. The above module does not compile in Erlang anyway: it has a variable (HOF) as its module name. If you save this in a file hof.erl and rename the module to hof, as in the following: -module(hof). -export([first/1]). fst({A,B}) -> A. % This does not compile first(L) -> lists:map(fst, L). it will compile alright but it will give you some warnings: ./hof.erl:3: Warning: function fst/1 is unused ./hof.erl:3: Warning: variable 'B' is unused The first warning says that the function fst/1 is unused. Notice that functions do not just have a sequence of alphanumeric characters as their name but also an arity (i.e. the number of their arguments). You can see already that something is going on here. Indeed, in Erlang you can use the same 'character sequence' with different number of arguments and these are different functions. This is something that you cannot do in languages such as C (because C also supports functions with variable number of arguments) or Haskell (because Haskell supports currying). Whether this is something terrible or not is to a large extent a matter of personal taste. Anyway, the point of the above is that to refer to functions in Erlang you really have to supply the number of their arguments. This can be done in either of the following two ways: - explictly as in: lists:map(fun fst/1, L). (the keyword fun is needed here to distinguish this from division) - implictly with an anonymous function as in: lists:map(fun(E) -> fst(E) end, L). If you do not write one of the above, but write lists:map(fst, L) instead as in your first attempt, Erlang simply trust that you really know what you are doing and want to use your own hacked up version of the 'lists' module (in Erlang you are actually allowed to override the default library 'lists' module -- why shouldn't you?) that defines a function map/2 which takes an atom in its first argument. Hope this detailed explanation helps to introduce you a bit to the "philosophy" of Erlang. Best, Kostis From dking@REDACTED Fri Nov 30 21:03:09 2007 From: dking@REDACTED (David King) Date: Fri, 30 Nov 2007 12:03:09 -0800 Subject: [erlang-questions] Question about higher order function In-Reply-To: <47506769.9000909@cs.ntua.gr> References: <47504EA9.9040508@gmx.de> <47506769.9000909@cs.ntua.gr> Message-ID: <5C34396B-D566-4528-9F5B-866E87F5CAC9@ketralnis.com> >> Can someone tell me if I'm doing something wrong here or if Erlang is >> really so akward and clumsy why it is this way? > Not knowing a language and trying to learn it is OK - it's a very good > thing actually. > Not knowing a language and characterizing it with adjectives such as > "awkward", "clumsy" and "terrible" is not particularly constructive > in my opinion. He didn't say it *was*, he asked why this particular construct was, *if* indeed the way he found was the only one. That's a perfectly valid question. If someone asked why it's so awkward and clumsy to use mnesia to do something for which you should be using an RDBMS, the answer would be "because that's not what it's designed for. Here is what it does well, and here's why it's awkward to do that". From igouy2@REDACTED Fri Nov 30 21:33:42 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Fri, 30 Nov 2007 12:33:42 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474FD334.9060402@ericsson.com> Message-ID: <908.17601.qm@web60522.mail.yahoo.com> --- Bengt Kleberg wrote: > on the shootout email list some years ago ... > the opposite of what i want from shootout ... Saying again the same things you repeatedly said on the mailing list throughout 2004 and 2005 doesn't make them anymore persuasive or interesting - you asked and you were answered. > On 11/29/07 22:51, Christian S wrote: >> Are you guys getting anywhere with this discussion? Done ;-) ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs From igouy2@REDACTED Fri Nov 30 21:17:53 2007 From: igouy2@REDACTED (Isaac Gouy) Date: Fri, 30 Nov 2007 12:17:53 -0800 (PST) Subject: [erlang-questions] benchmarks game harsh criticism In-Reply-To: <474FD5E5.1000104@ericsson.com> Message-ID: <291234.64387.qm@web60519.mail.yahoo.com> --- Bengt Kleberg wrote: -snip- > quotes from "Timing Trials, or, the Trials of Timing" as per request: > "* Memory-related issues and the effects of memory hierarchies are > pervasive: how memory is managed, from hardware caches to garbage > collection, can change runtimes dramatically. Yet users have no > direct > control over most aspects of memory management. " > > "We started to construct a table with three dimensions: task, > programming language, and machine. Eventually we added the size of > the > problem solved by the program as a fourth dimension, and we changed > the > presentation from tables to graphs. Varying the problem size helped > us > to detect unusual runtime effects, while a graphical presentation > highlights patterns and trends in runtime instead of individual > performance scores." > > "We designed tests whose runtime should grow linearly with the size > of > the problem: runtime = m??size + b. Thus, if we choose size to be > large > enough to justify ignoring the fixed overhead (b), the log-log plot > should show a straight line of unit slope. Exceptions indicate > anomalous > behavior that deserves further attention." (Incidentally what they meant by anomalous behaviour is something like this: "the line connecting C runtimes appears absolutely horizontal. ... This happens because the optimizer eliminates the entire loop, replacing it by sum = n.") Let me suggest to you that the paragraphs you quote are descriptions not recommendations. Here's a recommendation: "... we advise all who want to know which version of a program will run faster to construct test programs and find out the truth for their language processor and machine." Here's another: "It does seem wise to take all such experiments ?including these ?with a large grain of salt." > Now it is your turn. could you quote the exact words where they say > that 4 inputs and a spread of x10 is good enough? There is no such statement, nor have I claimed that there is: I have described the spread shown in the tests - "we can see that they varied the problem size by < ~10x" ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From nindeu@REDACTED Fri Nov 30 23:38:04 2007 From: nindeu@REDACTED (nindeu@REDACTED) Date: Fri, 30 Nov 2007 23:38:04 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: <60438E7D-519D-48BC-A1EE-77016D83A251@ketralnis.com> References: <474AB442.4020802@vlayko.tv> <474FE420.5040905@niclux.org> <20071130123631.8920@gmx.net> <60438E7D-519D-48BC-A1EE-77016D83A251@ketralnis.com> Message-ID: <20071130223804.131880@gmx.net> Ahem, ok, 4. More postgres drivers coming along? Maybe we should tell the guys in the language shootout thread that they propose an additional benchmark. Can't imagine Erlang wouldn't lead the category 'most postgres drivers to choose from'. Is this some rite of passage to be accepted in a special Erlang club? If yes, hands off savannah.gnu.org! This will be the place for my version. Regards, Eric -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger