From per@REDACTED Thu Feb 1 00:25:10 2007 From: per@REDACTED (Per Hedeland) Date: Thu, 1 Feb 2007 00:25:10 +0100 (CET) Subject: [erlang-questions] gen_server cast question In-Reply-To: Message-ID: <200701312325.l0VNPAmL027146@pluto.hedeland.org> "Ulf Wiger" wrote: > >Den 2007-01-31 17:20:33 skrev Logan, Martin : > >> Message order is not guaranteed with asynchronous messaging in any case. >> You should never rely on it. Also, as an aside, it would be strange to >> have a reference to a process for a node that is not connected, that >> suggests poor design. > >In Barklund's formal semantics for Erlang >(http://citeseer.ist.psu.edu/fredlund01framework.html) > >the following is stated: > >"The semantics communication (rule com) is such that if two consecutive >messages m1 and m2 are sent by process p1 to process >p2 then message m1 will always arrive before message m2." AFAIK this describes the semantics of '!' (a.k.a. erlang:send/2), wich is part of the language. >I'm not sure where else it is defined, but I'm pretty sure that you can >rely on this being true. For '!', yes. The original question was about gen_server:cast/2, which is a library function that can do whatever it pleases, at least as long as it is documented. Unfortunately the man page doesn't say anything about the arrival order of requests, but at least that means that it doesn't explicitly guarantee that requests will arrive in the order they are sent.:-) I guess it would be reasonable to assume that it has the same semantics as '!' in this respect - then again, if you want those semantics, you can of course use '!' to send to a gen_server too... --Per Hedeland From bob@REDACTED Thu Feb 1 01:26:28 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 31 Jan 2007 16:26:28 -0800 Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: References: <45BE23DD.5090900@it.uu.se> Message-ID: <6a36e7290701311626xdb060b9i8779d8713488b05b@mail.gmail.com> The HTML conversion is trivial if it's planned to use the same infrastructure that Python does, and it looks like EEP 1 does use it. Basically you just write the EEP in reStructuredText [1] which is pretty natural, and you end up with a document that looks good in html and in text. [1] http://docutils.sourceforge.net/docs/user/rst/quickref.html -bob On 1/31/07, Eric Merritt wrote: > So this is a great idea and of huge benefit to the community. That > being the case, how are we going to move this process forward? > > Who are the editors? Has that been decided? > Has the eeps mailing list been set up? > Has any one stepped up to handle the eep html conversion? Could we > go with what you have already written for now? > Has subversion space been made available? > > Who is going to maintain the infrastructure for eeps? > > These are questions, not answers, I know. However, maybe in answering > these questions this process can move forward instead of bogging down > in rather non-topical discussion as it has so far. > > > On 1/29/07, Per Gustafsson wrote: > > In conjunction with the Erlang User Conference 2006 there was a workshop > > concerning the future development of Erlang. > > > > In this workshop a decision was made to adopt the Python process for > > future Erlang development. Since nothing has happened since then I have > > taken it upon myself to edit PEP 1, the python extension proposal which > > describes how the python process works. This should be viewed as a draft > > so please feel free to suggest changes. There are also a lot of decision > > that needs to be made and issues that need to be solved. I'll list some > > of them below. > > > > 1. We need to have some EEP editors > > 2. We need an e-mail address for the EEP editors, I have suggested > > eeps@REDACTED > > 3. We need tools to generate html from EEPs. I have altered some of the > > python tools to acheive this, but the resulting script is very brittle > > and probably won't work for most EEPs > > 4. We need a subversion repository to keep track of the EEPs > > > > The draft for EEP 1 can be found at: > > > > http://user.it.uu.se/~pergu/eep/eep-0001.html > > > > Per Gustafsson > > _______________________________________________ > > 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 cyberlync@REDACTED Thu Feb 1 03:14:35 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 31 Jan 2007 18:14:35 -0800 Subject: [erlang-questions] edoc problem in R11B-3 Message-ID: Guys, I am getting the following error when running edoc. edoc: error in layout 'edoc_layout': {'EXIT',{badarg,[{erlang,binary_to_list,[{head,[[10],{title,[[77,111,100|...]]},[10],{link,[{rel,...},{...}|...],[]},[10]]}]},{xmerl_lib,export_text,2},{xmerl_lib,export_text,2},{xmerl,apply_cb,5},{xmerl,export_content,2},{xmerl,export_element,2},{xmerl,export_content,2},{xmerl,export1,3}]}}. edoc: error in doclet 'edoc_doclet': {'EXIT',error}. edoc seems to always output the above error. It doesn't seem to matter what source its run on or how edoc is called. Is anyone else having a similar problem, if so, have you been able to work around it? From chsu79@REDACTED Thu Feb 1 09:30:31 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 1 Feb 2007 09:30:31 +0100 Subject: [erlang-questions] Erlang bindings for FUSE In-Reply-To: <45C11C21.8070608@ertw.com> References: <45C10001.4000808@ertw.com> <45C110A0.3010507@galaxen.se> <45C11C21.8070608@ertw.com> Message-ID: The project "enfs" in jungerl should be usable to create user-space file systems as well. Dunno what up or downsides are of either method. From forsyth@REDACTED Thu Feb 1 10:41:38 2007 From: forsyth@REDACTED (Charles Forsyth) Date: Thu, 1 Feb 2007 09:41:38 +0000 Subject: [erlang-questions] Erlang bindings for FUSE Message-ID: NFSv2 is stateless, lacks a close operation, and has a few other serious failings that make it essentially useless for many quite interesting types of user-level file system. enfs_procfs.erl is an interesting type that does work because it provides a view on an inherently changing scene, so some of the NFS disadvantages don't matter quite so much. even then, the view can be so out of date (given the strategies of NFS clients i've worked with) that it probably only works really well for set of processes that are stable (ie, long-running services), but i can see that where it did work it would be quite satisfying. i think a FUSE implementation of the same thing would not have the same limitations, so perhaps that might be a pleasant little test for efuse. -------------- next part -------------- An embedded message was scrubbed... From: "Christian S" Subject: Re: [erlang-questions] Erlang bindings for FUSE Date: Thu, 1 Feb 2007 09:30:31 +0100 Size: 2836 URL: From xpdoka@REDACTED Thu Feb 1 11:35:01 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Thu, 1 Feb 2007 11:35:01 +0100 (CET) Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: <45BE23DD.5090900@it.uu.se> References: <45BE23DD.5090900@it.uu.se> Message-ID: <38447.217.128.75.198.1170326101.squirrel@www.geekisp.com> Hi Per, and everyone, > In conjunction with the Erlang User Conference 2006 there > was a workshop concerning the future development of > Erlang. I attended the workshop, and was very pleased about the decision to have a process for language evolution. Thanks for taking the initiative to get things moving. > 1. We need to have some EEP editors > 2. We need an e-mail address for the EEP editors, I have > suggested eeps@REDACTED > 3. We need tools to generate html from EEPs. I have altered > some of the python tools to acheive this, but the > resulting script is very brittle and probably won't work > for most EEPs > 4. We need a subversion repository to keep track of the EEPs > > The draft for EEP 1 can be found at: > > http://user.it.uu.se/~pergu/eep/eep-0001.html I have read the draft and have several suggestions for simplifying the process. 1) I don't see any use for informational and process EEPs. Let's just have plain EEPs. 2) The suggestion made at the workshop was just to use the erlang-questions mailing list. Why have a eeps@REDACTED address ? Let's keep the process open and simple. EEP candidates can just be posted to erlang-questions. 3) It was mentioned at the workshop that requiring an reference implementation might be too strict a requirement. It certainly seems to me that such a requirement rather shuts out the user community from being involved. Requiring a section /about/ implementation suggestions or details should be sufficient. 4) There is a simple way to avoid completely all the hassle of having a special format, a version repository, using tools to convert to HTML and so on: just hyperlink to the erlang-questions archive. We just need a plain EEP web page, with a table roughly like this: N? Title Status --------------------------------------------------------- 1 Reified environments Draft Final Accepted 2 Whatever Draft ... Each "status" word would simply be hyperlinked to whichever post to erlang-questions had allowed the EEP to achieve that status. With such a scheme, several /existing/ posts in the archives could already be given draft status. With such a simplifications, all we need to start are the members of the committee. I think the open source user community should be represented, maybe by voting for a certain number of representatives ? Best regards, Dominic Williams http://www.dominicwilliams.net ---- From per.gustafsson@REDACTED Thu Feb 1 13:00:56 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 01 Feb 2007 13:00:56 +0100 Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: <38447.217.128.75.198.1170326101.squirrel@www.geekisp.com> References: <45BE23DD.5090900@it.uu.se> <38447.217.128.75.198.1170326101.squirrel@www.geekisp.com> Message-ID: <45C1D678.5080007@it.uu.se> Dominic Williams wrote: >Hi Per, and everyone, > > > >>In conjunction with the Erlang User Conference 2006 there >>was a workshop concerning the future development of >>Erlang. >> >> > >I attended the workshop, and was very pleased about the >decision to have a process for language evolution. Thanks >for taking the initiative to get things moving. > > > >>1. We need to have some EEP editors >>2. We need an e-mail address for the EEP editors, I have >> suggested eeps@REDACTED >>3. We need tools to generate html from EEPs. I have altered >> some of the python tools to acheive this, but the >> resulting script is very brittle and probably won't work >> for most EEPs >>4. We need a subversion repository to keep track of the EEPs >> >>The draft for EEP 1 can be found at: >> >>http://user.it.uu.se/~pergu/eep/eep-0001.html >> >> > >I have read the draft and have several suggestions for >simplifying the process. > >1) I don't see any use for informational and process > EEPs. Let's just have plain EEPs. > > I don't see the problem with having informational and process EEPs. It just tells the reader what he should expect. >2) The suggestion made at the workshop was just to use the > erlang-questions mailing list. Why have a eeps@REDACTED > address ? Let's keep the process open and simple. EEP > candidates can just be posted to erlang-questions. > > > Submitting by posting to the mailing lists would probably work well. >3) It was mentioned at the workshop that requiring an > reference implementation might be too strict a > requirement. It certainly seems to me that such a > requirement rather shuts out the user community from > being involved. Requiring a section /about/ > implementation suggestions or details should be > sufficient. > > > I think that a reference implementaion should be required before a EEP is accepted. A reference implementation is not needed to become an EEP. I think it would be hard to accept a "Standards Track" EEP without an implementation as it is difficult to evaluate an EEP without an implementation. >4) There is a simple way to avoid completely all the hassle > of having a special format, a version repository, using > tools to convert to HTML and so on: just hyperlink to the > erlang-questions archive. We just need a plain EEP web > page, with a table roughly like this: > > N? Title Status > --------------------------------------------------------- > 1 Reified environments Draft > Final > Accepted > 2 Whatever Draft > ... > > Each "status" word would simply be hyperlinked to > whichever post to erlang-questions had allowed the EEP to > achieve that status. > > With such a scheme, several /existing/ posts in the > archives could already be given draft status. > > > I think that there is a point to require an EEP to conform to a certain format and to publish EEPs in a consistent format on erlang.org because it makes it easier to refer to EEPs. >With such a simplifications, all we need to start are the >members of the committee. I think the open source user >community should be represented, maybe by voting for >a certain number of representatives ? > > > When we have selected the commitee members most of the other issues are pretty minor and if the conversion tools does not work perfectly now the sources for the EEPs would still be available. Per Gustafsson From w.a.de.jong@REDACTED Thu Feb 1 13:01:07 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Thu, 1 Feb 2007 13:01:07 +0100 Subject: [erlang-questions] xmerl still slow? In-Reply-To: <8370EF19-9B8B-4E7B-BAD9-C314C17822A0@gmail.com> References: <7EEBE8F9-9971-42B9-8F94-23E752104A10@gmail.com> <8370EF19-9B8B-4E7B-BAD9-C314C17822A0@gmail.com> Message-ID: <407d9ef80702010401v56f78849yc7c563e84fb4138a@mail.gmail.com> On 1/31/07, Joel Reymont wrote: > > > On Jan 31, 2007, at 12:28 PM, Torbjorn Tornkvist wrote: > > An alternative to xmerl may be: erlsom. > > What would be the advantage? > In this context: I am not sure. If I understand correctly, the point of the template engine is to make it easy to create XML documents. Erlsom can help you with that as well, but in a different way. In general: Erlsom and Xmerl do slightly different things. Which is best depends on the context. Erlsom checks the validity of an XML document against an XSD. Xmerl cannot do that. However, Xmerl can check the validity against a DTD, and Erlsom doesn't do that. More importantly, the output of Erlsom (when parsing an XML document) depends on the XSD. The output is in the form of records; the definitions of these records correspond to the types that are defined in the XSD. As a consequence, the output of Erlsom is a lot more compact than the Xmerl output, and it is easier to process (I think). The opposite direction, from records to XML, is also supported. Again, the records are a compact and convenient representation of the information. Default values may be added to the record definitions generated by erlsom to make things even easier (this is a bit like a template, I think?). Regarding speed: as far as I can make out, erlsom (doing validation against a pre-compiled schema) is 3-4 times as fast as xmerl without validation. I was a bit suprised by these results and I can't really explain them. One reason may be the fact that the output is smaller. I only did some performance comparisons for parsing, I didn't do any tests for generation of XML. > Also, can erlsom do this? > > xmerl:export_simple([visit(Tree, Env)], xmerl_xml). > Not exactly, see above. Depending on what you are trying to do, Erlsom may be just as good. However, if you have a big XML file where everything has a standard value except for one or two elements deep down in the tree structure, then the approach with the template may be more convenient. > Thanks, Joel > > -- > http://wagerlabs.com/ > > > Regards, Willem From per.gustafsson@REDACTED Thu Feb 1 13:02:25 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 01 Feb 2007 13:02:25 +0100 Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: References: <45BE23DD.5090900@it.uu.se> Message-ID: <45C1D6D1.1050008@it.uu.se> I sent this message form the wrong address before so a similar message might appear in acouple of hours. Eric Merritt wrote: > So this is a great idea and of huge benefit to the community. That > being the case, how are we going to move this process forward? > > Who are the editors? Has that been decided? No this has not been decided. I think that there should be at least someone from the OTP-group and someone from outside of OTP. If there are people that are intrested in being editors or that have good suggestions for suitable editors you can contact me directly. > Has the eeps mailing list been set up? No > Has any one stepped up to handle the eep html conversion? Could we > go with what you have already written for now? What I have done is basically just changed the python script slightly. There are probably still some inconsistencies which will lead to some weird links etc., but what I have can probably be used for now. I have also created EEP 2 and EEP 3 which gives templates for writing EEPs. They are mostly copies of PEP 9 and PEP 12. They are available at: http://user.it.uu.se/~pergu/eep/eep-0002.html http://user.it.uu.se/~pergu/eep/eep-0003.html > Has subversion space been made available? > No, I have just set up my own repository on my local machine, so this needs to be done. > Who is going to maintain the infrastructure for eeps? > I think that the editors should be responsible for this. > These are questions, not answers, I know. However, maybe in answering > these questions this process can move forward instead of bogging down > in rather non-topical discussion as it has so far. > > > On 1/29/07, Per Gustafsson wrote: > >> In conjunction with the Erlang User Conference 2006 there was a workshop >> concerning the future development of Erlang. >> >> In this workshop a decision was made to adopt the Python process for >> future Erlang development. Since nothing has happened since then I have >> taken it upon myself to edit PEP 1, the python extension proposal which >> describes how the python process works. This should be viewed as a draft >> so please feel free to suggest changes. There are also a lot of decision >> that needs to be made and issues that need to be solved. I'll list some >> of them below. >> >> 1. We need to have some EEP editors >> 2. We need an e-mail address for the EEP editors, I have suggested >> eeps@REDACTED >> 3. We need tools to generate html from EEPs. I have altered some of the >> python tools to acheive this, but the resulting script is very brittle >> and probably won't work for most EEPs >> 4. We need a subversion repository to keep track of the EEPs >> >> The draft for EEP 1 can be found at: >> >> http://user.it.uu.se/~pergu/eep/eep-0001.html >> >> Per Gustafsson >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From richardc@REDACTED Thu Feb 1 13:03:09 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 01 Feb 2007 13:03:09 +0100 Subject: [erlang-questions] edoc problem in R11B-3 In-Reply-To: References: Message-ID: <45C1D6FD.9010602@it.uu.se> Eric Merritt wrote: > I am getting the following error when running edoc. > > edoc: error in layout 'edoc_layout': > {'EXIT',{badarg,[{erlang,binary_to_list,[{head,[[10],{title,[[77,111,100|...]]},[10],{link,[{rel,...},{...}|...],[]},[10]]}]},{xmerl_lib,export_text,2},{xmerl_lib,export_text,2},{xmerl,apply_cb,5},{xmerl,export_content,2},{xmerl,export_element,2},{xmerl,export_content,2},{xmerl,export1,3}]}}. > edoc: error in doclet 'edoc_doclet': {'EXIT',error}. > > edoc seems to always output the above error. It doesn't seem to matter > what source its run on or how edoc is called. Is anyone else having a > similar problem, if so, have you been able to work around it? The problem is that someone has broken the xmerl_lib:expand_content/4 function, in some misguided attempt to make it accept non-lists as content, even though the documentation states that content must be flat lists, and there is even a comment in the code that explains why this must be so (hint: strings are also lists, and may be deep). Revert to the previous version of xmerl (or edit expand_content/4 to match the previous version if you prefer that), and you should be ok. The following comment in the release notes, made me worried as soon as I saw it: OTP-6099 Bug in xmerl removed so that simple syntax element content is exported correctly. How about reading the spec before deciding to "fix" something? /Richard PS. "Do not meddle in the affairs of Wizards, for they are subtle and quick to anger." From vladdu55@REDACTED Thu Feb 1 13:59:34 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 1 Feb 2007 13:59:34 +0100 Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: <45C1D6D1.1050008@it.uu.se> References: <45BE23DD.5090900@it.uu.se> <45C1D6D1.1050008@it.uu.se> Message-ID: <95be1d3b0702010459s397e103te40eeb8e10327bc4@mail.gmail.com> Hi Per, On 2/1/07, Per Gustafsson wrote: > What I have done is basically just changed the python script slightly. > There are probably still some inconsistencies which will lead to some > weird links etc., but what I have can probably be used for now. Very nice job! One quick fix you could do would be to search and replcas Python with Erlang :-) There are still a couple of places... > I have also created EEP 2 and EEP 3 which gives templates for writing > EEPs. They are mostly copies of PEP 9 and PEP 12. They are available at: > > http://user.it.uu.se/~pergu/eep/eep-0002.html > http://user.it.uu.se/~pergu/eep/eep-0003.html For reference, the source forms are to be found at http://user.it.uu.se/~pergu/eep/eep-0002.txt http://user.it.uu.se/~pergu/eep/eep-0003.txt best regards, Vlad From erlang@REDACTED Thu Feb 1 21:03:04 2007 From: erlang@REDACTED (Hubert Matthews) Date: Thu, 01 Feb 2007 20:03:04 +0000 Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: <17265362.241170275036790.JavaMail.root@ly.sdf.com> References: <17265362.241170275036790.JavaMail.root@ly.sdf.com> Message-ID: <45C24778.40507@oxyware.com> > If you have to change your code to run under a different > implementation, it means the language implementation has failed. There are two approaches to this sort of problem. The first is the lowest common denominator (i.e. distributed intersection) of features, which gives you a small and somewhat weak language and library. C and C++ have taken this route as they strive to run on any platform and therefore (currently) lack standard libraries for threading, GUIs, etc. Java is similar but with a much bigger library and a weaker language. Think of Java Swing GUIs: they don't look native at all. The other approach is to exploit the platform and pay the porting cost. .NET applications are like this. The Mono implementation for Linux can do most everything except the WinForms part which is so tightly bound to the Windows GUI that it is almost impossible to emulate effectively (or so I'm told). The first approach means you forego a lot; the latter leaves you open to the darker side of Fisher's Law of Adaptation. Which route should Erlang take? Probably the broad LCD path with separate paths for the language and the libraries. -- Hubert Matthews http://www.oxyware.com/ Software Consultant hubert@REDACTED From autophile@REDACTED Thu Feb 1 23:17:11 2007 From: autophile@REDACTED (Robert Baruch) Date: Thu, 1 Feb 2007 17:17:11 -0500 Subject: [erlang-questions] Please review this basic Erlang doc? Message-ID: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> Hi all, In learning Erlang as an expert procedural developer, but novice functional developer, I had to organize my thoughts about Erlang and how to think in functional terms. So, I wrote a document, and decided that maybe it's useful to other Erlang beginners who are also procedural experts. With that in mind, does anyone want to take a look at this document and send in comments? It's not finished, so I'd welcome any suggestions. The document doesn't aim to be an Erlang tutorial, but rather to guide the developer in thinking functionally. So once I'm sure a functional concept has been explained, I do a lot of referring the reader to the reference manuals. Anyway, here it is: http://chuffyrodents.org/erlang.pdf --Rob From chandrashekhar.mullaparthi@REDACTED Thu Feb 1 23:18:57 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 1 Feb 2007 22:18:57 +0000 Subject: [erlang-questions] Rabbit Message-ID: Seen this? http://www.rabbitmq.com/ cheers Chandru From jeffm@REDACTED Fri Feb 2 00:09:42 2007 From: jeffm@REDACTED (jm) Date: Fri, 02 Feb 2007 10:09:42 +1100 Subject: [erlang-questions] Rabbit In-Reply-To: References: Message-ID: <45C27336.40104@ghostgun.com> Chandru wrote: > Seen this? > > http://www.rabbitmq.com/ > Your timing couldn't have been better. I've been looking for a platform agnostic asynchronous messaging protocol that's relatively common, ie has support in lots of programming languages, and has an implementation in erlang. AMQP is one of the ones I was thinking of investigating along with XMPP (ejabberd), but as yet hadn't got around to looking for yet. The project that it would be part of is an extension to the project I'm currently working on or an extension to an enhancement of it. In short, this just made my reading queue. Jeff. From rodahummont@REDACTED Fri Feb 2 04:39:29 2007 From: rodahummont@REDACTED (Rodrigo Ahumada M.) Date: Fri, 02 Feb 2007 00:39:29 -0300 Subject: [erlang-questions] Please review this basic Erlang doc? In-Reply-To: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> References: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> Message-ID: <1170387569.7100.35.camel@rod-linux> El jue, 01-02-2007 a las 17:17 -0500, Robert Baruch escribi??: > Hi all, > > In learning Erlang as an expert procedural developer, but novice > functional developer, I had to organize my thoughts about Erlang and > how to think in functional terms. So, I wrote a document, and decided > that maybe it's useful to other Erlang beginners who are also > procedural experts. > > With that in mind, does anyone want to take a look at this document > and send in comments? It's not finished, so I'd welcome any suggestions. > > The document doesn't aim to be an Erlang tutorial, but rather to > guide the developer in thinking functionally. So once I'm sure a > functional concept has been explained, I do a lot of referring the > reader to the reference manuals. > > Anyway, here it is: http://chuffyrodents.org/erlang.pdf > hi i'm just a student that recently started to try coding with Erlang, and one thing i had to put effort was when dealing with loops and the inmutability of variables, the first thing that came to mind was: "what wicked recursive function i have to write now to process this list". it took me some time to get used to mix map and fold, etc. so i think it could be good if you can put more examples of that kind, with some common cases. i find it's more difficult when you have to compare each elements of a list with the others, and when you have to return the indexes of elements from a list that meet some condition. an example, a simple problem: i got a list of vectors and i want a function that returns the indexes of the two closest vectors, and their distance. a first approach is to recreate a list with all the combinations of two vector, their indexes and distance, and then choose the closest, but it could grow too much with big lists. so i find difficult to write a recursive function that can go comparing each vector, tracking the vector index and discarding previous data for the sake of efficiency. the best thing i could get was this: -module(vec). -export([closer/1, vector_dist/2, test/0]). %---------------------------------------------------------------------- % vector_dist(): returns de distance between 2 vectors (vector are % simply lists of numbers). %. % closer(List) -> returns the indexes of the closer vectors from List % and their distance. % the format is: {{Index1, Index2}, Distance} % % test(): just a test to probe the function. %---------------------------------------------------------------------- vector_dist(V1, V2) -> math:sqrt(lists:sum(lists:zipwith(fun(A, B) -> C = A - B, C * C end, V1, V2))). closer([]) -> {}; closer([Only]) -> Only; closer([First, Last]) -> {{1, 2}, vector_dist(First, Last)}; closer(List) -> closer1(List, 1, 2, {{-1, -1}, 10000000}). min_result(NewResult={_, NewDist}, OldResult={_, OldDist}) -> if NewDist < OldDist -> NewResult; true -> OldResult end. closer1([_Last], _, _, Result) -> Result; closer1([First, Second | Rest], IFirst, ISecond, OldResult) -> io:format("closer 1: ~p ~p~n", [IFirst, ISecond]), NewResult = min_result({{IFirst, ISecond}, vector_dist(First, Second)}, OldResult), closer1([First | Rest], IFirst, ISecond + 1, closer2([Second | Rest], ISecond, ISecond + 1, NewResult)). closer2([_Last], _, _, Result) -> Result; closer2([First, Second | Rest], IFirst, ISecond, OldResult) -> io:format("closer 2: ~p ~p~n", [IFirst, ISecond]), NewResult = min_result({{IFirst, ISecond}, vector_dist(First, Second)}, OldResult), closer2([First | Rest], IFirst, ISecond + 1, NewResult). test() -> M = [[210], [710], [64], [780], [42], [130], [400], [915], [90]], closer(M). it's difficult to understand, and it works search from the last to first one. i don't know if there's a better way to achieve this. anyway, excuse my english. __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From ok@REDACTED Fri Feb 2 05:54:16 2007 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 2 Feb 2007 17:54:16 +1300 (NZDT) Subject: [erlang-questions] Please review this basic Erlang doc? Message-ID: <200702020454.l124sG5v252965@atlas.otago.ac.nz> "Rodrigo Ahumada M." wrote: an example, a simple problem: i got a list of vectors and i want a function that returns the indexes of the two closest vectors, and their distance. You say "vectors", but people used to other functional languages are likely to read "vector" as "tuple". Why do you want INDICES of the two closest vectors, rather than the vectors themselves? vector_dist(V1, V2) -> math:sqrt(lists:sum(lists:zipwith(fun(A, B) ->=20 C =3D A - B, C * C end, V1, V2))). In Haskell, vector_distance v1 v2 = sqrt (sum [(x-y)^2 | (x,y) <- zip v1 v2]) is fine. In Erlang, vector_dist(V1, V2) -> math:sqrt(vector_dist_squared(V1, V2, 0.0)). vector_dist_squared([X|Xs], [Y|Ys], Sum) -> vector_dist_squared(Xs, Ys, Sum + (X-Y)*(X-Y)); vector_dist_squared([], [], Sum) -> Sum. might actually be clearer. As it turns out, we have a use for vector_dist_squared. What use is that? Simple: if we want to compare the distances, we can compare the squared distances. We only have to call sqrt once in the entire calculation. The next step may be the interesting one. The point of higher order functions is to separate out "control" patterns from specific calculations. The control pattern we have here is a kind of "fold": 1 I J N Traverse the pairs (Xi,I,Xj,J} where [...Xi....Xj....] applying function Mapping to each and combining the results of that with Folder. In fact we always use Mapping and Folding together, so we only need Combiner(Previous, Xi, I, Xj, J) = Folder(Previous, Mapping(Xi,I,Xj,J)). triangle_map_and_fold(List, Initial, Combiner) -> triangle_map_and_fold_outer(List, 0, Combiner, Initial). triangle_map_and_fold_outer([X|Xs], N0, Combiner, R0) -> N1 = N0 + 1, triangle_map_and_fold_outer(Xs, N1, Combiner, triangle_map_and_fold_inner(Xs, X, N1, N1, Combiner, R0)); triangle_map_and_fold_outer([], _, _, R) -> R. triangle_map_and_fold_inner([Y|Ys], X, N1, M0, Combiner, R0) -> M1 = M0 + 1, triangle_map_and_fold_inner(Ys, X, N1, M1, Combiner, Combiner(R0, X, N1, Y, M1)); triangle_map_and_fold_inner([], _, _, _, _, R) -> R. Compare this with the C99 equivalent: T triangle_map_and_fold( S const *a, int n, T initial, T (*combiner)(T, S, int, S, int) ) { for (int i = 0; i < n; i++) { S x = a[i]; for (int j = i+1; j < n; j++) { S y = a[j]; initial = combiner(initial, x, i, y, j); } } return initial; } In C99, we have two loops. In Erlang, two recursive functions. Same thing. What do we want to do with each (X,N,Y,M) pair? We want to compute the (squared) distance between X and Y and retain the triple {N,M,D}. What do we want to do with these triples? Remember the one with the smallest D. closest_pair(Vectors) -> {Nbest, Mbest, Dsquared} = triangle_map_and_fold(Vectors, start, fun (Previous, X, N, Y, M) -> D = vector_dist_squared(X, Y, 0.0), case Previous of {_,_,D1} when D1 < D -> Previous ; _ -> {N,M,D} end end), {Nbest, Mbest, math:sqrt(Dsquared)}. If there are V vectors, this does about V**2/2 distance calculations and builds at most about V**2/2 3-tuples. We can eliminate the higher-order bit by unfolding (making a copy of the function and replacing arguments by their values), and in so doing we could eliminate all of those tuples except the final result, but I wouldn't bother. Why not? Because if I had to find the closest pair of vectors in a large collection of vectors I'd be reaching for one of Hanan Sammet's books on spatial data structures to find a cheaper data structure. From xpdoka@REDACTED Fri Feb 2 09:49:53 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Fri, 2 Feb 2007 09:49:53 +0100 (CET) Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: <45C1D678.5080007@it.uu.se> References: <45BE23DD.5090900@it.uu.se> <38447.217.128.75.198.1170326101.squirrel@www.geekisp.com> <45C1D678.5080007@it.uu.se> Message-ID: <43888.217.128.75.198.1170406193.squirrel@www.geekisp.com> Hi Per, >> I don't see any use for informational and process >> EEPs. Let's just have plain EEPs. > > I don't see the problem with having informational and > process EEPs. It just tells the reader what he should > expect. Yes, clearly, if we are to have standard, informational and process EEPs, labelling them as such provides a useful indication. What I said was that I don't see any point in having informational or process EEPs at all. An informational EEP sounds like system principles and other things that are currently in Erlang documentation. What motivation is there for putting them somewhere else, especially as Kenneth announced plans to open source the Erlang/OTP documentation and associated tools ? And why go to the trouble of using this process just for something that everyone is free to ignore ? As for a process EEP, it sounds like it might be appropriate for a language like Python, which is managed by a foundation, but I don't see the point for Erlang. The process will be simpler and the list of EEPs less cluttered if we just have standard EEPs. > I think that a reference implementaion should be required > before a EEP is accepted. A reference implementation is > not needed to become an EEP. I think it would be hard to > accept a "Standards Track" EEP without an implementation > as it is difficult to evaluate an EEP without an > implementation. Well, it would be even better to wait for several years of use in real projects ! Maybe I am too pragmatic but I think what is mostly needed is a way to achieve a community consensus around language or library evolution /before/ money is spent on implementation. Providing a reference implementation could still be allowed, of course, I just think making it a requirement is overkill, and a good way to prevent the /user/ community from playing much of a part in the process. > I think that there is a point to require an EEP to conform > to a certain format and to publish EEPs in a consistent > format on erlang.org because it makes it easier to refer > to EEPs. With the simple system I am suggesting, you could refer to: www.erlang.org/eep#15 Which would take you to the right line in the list of EEPs. You would see its title and status, and you would then click on a link to take you to the appropriate post in erlang-questions. Is having www.erlang.org/eep/15/accepted.html directly worth all the trouble of managing tools and editing EEPs in a special format ? Besides the simplification, using the erlang-questions archive also means that when you view an EEP, you have direct access to the community discussions that occurred around it. Regards, Dominic Williams http://www.dominicwilliams.net ---- From ulf@REDACTED Fri Feb 2 12:48:40 2007 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 02 Feb 2007 12:48:40 +0100 Subject: [erlang-questions] Please review this basic Erlang doc? In-Reply-To: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> References: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> Message-ID: Den 2007-02-01 23:17:11 skrev Robert Baruch : > Hi all, > > In learning Erlang as an expert procedural developer, but novice > functional developer, I had to organize my thoughts about Erlang and > how to think in functional terms. So, I wrote a document, and decided > that maybe it's useful to other Erlang beginners who are also > procedural experts. > > With that in mind, does anyone want to take a look at this document > and send in comments? It's not finished, so I'd welcome any suggestions. Nice effort. Have you received any feedback from fellow Java programmers? Here are a few minor comments: Page 6 ------ "The ?ok? at the end is just the shell indicating that the function didn?t cause an error." Actually, no. The 'ok' is the return value from the called function. The hello:hello() function ends by calling io:fwrite/2, which returns 'ok'. That's the value you're seeing. Consider the following shell dialogue: 1> lists:reverse([1,2,3]). [3,2,1] "Finally, to exit the shell, we call the function halt/0." It's better to practice using init:stop(), although halt/0 and halt/1 have their uses. When you get into using more complex programs, init:stop() will give applications like mnesia a chance to close down properly. This will save you from dets and log files being repaired when you restart. "From this brief sample, we can see that Erlang has a global namespace ? c/1 and halt/0 are in that global namespace. We will touch on this subject more later." c/1 and halt/0 are actually quite different, in that c/1 is synonymous to c:c/1 *in the shell only*. The VM has some built-in functions that could be said to be part of a global namespace. halt/0 is such a function. The shell has some "built-ins" for convenience, but that's just a name substitution thingy built into the shell's eval loop. Page 9 ------ "The variables that begin with an underscore are actually ignored, so the names are really just comments. You could just as easily have written {_ , Second, _} but that may not be as clear, depending on the context." Underscores are always ignored. The variables that begin with an underscore are actually real variables. The linter interprets them as "don't care" patterns, but the compiler does not. This is important to know, because if you would write your pattern as: {_Any, Middle, _Any} = Arg you'd notice (after much confusion) that only 3-tuples with identical first and third elements will avoid a badmatch error. The leading underscore is just a convention - it is a legal variable name. Page 13 ------- If statements actually only accept guards if Guard1 -> ...; Guard2 -> ...; true -> ... end Page 15 ------- "Note that because the the recursive call to go/1 is the last thing that go/1 does." One may note that go/0 also performs a tail call (although not recursive). BR, Ulf W > > The document doesn't aim to be an Erlang tutorial, but rather to > guide the developer in thinking functionally. So once I'm sure a > functional concept has been explained, I do a lot of referring the > reader to the reference manuals. > > Anyway, here it is: http://chuffyrodents.org/erlang.pdf > > --Rob > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Ulf Wiger From Chris.Curtis@REDACTED Fri Feb 2 14:58:55 2007 From: Chris.Curtis@REDACTED (Chris Curtis) Date: Fri, 2 Feb 2007 08:58:55 -0500 Subject: [erlang-questions] Compiling erlang on AIX 5.3 Message-ID: <36E4692623C5974BA6661C0B18EE8EDF5EEFFF@MAILSERV.hcrest.com> I am also trying to compile OTP on AIX 5.3... have you made any progress? --chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From mj@REDACTED Fri Feb 2 15:11:54 2007 From: mj@REDACTED (Mikkel Jensen) Date: Fri, 2 Feb 2007 15:11:54 +0100 Subject: [erlang-questions] Dets workarounds for large datasets? Message-ID: Hi everyone, I've been following the topic of storing large amounts of data in Mnesia. The overall problem seems to be the fragmentation of free space when deleting records, correct? My question is: Can this issue be avoided if records where not physically deleted but only _marked_ as deleted by a field in the record? Alternatively: Would it be possible to have a timer job which would take the node offline, repair the table and put it online again? In a clustered environment this could be done in a round-robin kind of fashion with no visible downtime to users. I would really like to use Mnesia in a large web application but the size limitation scares me. If anyone can think of a workaround I would very much like to know... - Mikkel -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Fri Feb 2 15:14:09 2007 From: matthias@REDACTED (Matthias Lang) Date: Fri, 2 Feb 2007 15:14:09 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: References: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> Message-ID: <17859.18225.627900.687480@antilipe.corelatus.se> Ulf Wiger writes: > Underscores are always ignored. The variables that begin > with an underscore are actually real variables. The > linter interprets them as "don't care" patterns, but the > compiler does not. This seems to catch many or even most beginners. It seems natural (?) to expect _name to be a longer way of writing _, i.e. that any variable starting with _ means exactly the same thing as if you'd just written _. An example where that doesn't hold: f(_x, _x) -> same; f(_,_) -> different. Changing _x to behave as many (most?) initially expect would break backwards compatibility, but only for misleading code such as the above... Matthias From chsu79@REDACTED Fri Feb 2 15:43:18 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 2 Feb 2007 15:43:18 +0100 Subject: [erlang-questions] Dets workarounds for large datasets? In-Reply-To: References: Message-ID: > I would really like to use Mnesia in a large web application but the size > limitation scares me. > If anyone can think of a workaround I would very much like to know... What scenario are you imagining that scares you? From ulf.wiger@REDACTED Fri Feb 2 15:55:39 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 2 Feb 2007 15:55:39 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <17859.18225.627900.687480@antilipe.corelatus.se> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155E27C6F@esealmw115.eemea.ericsson.se> I have on occasion used underscored variables in the following way foo([{x, _, _, Thingy, _} = _Obj| T]) -> ?dbg("_Obj = ~p~n", [_Obj]), ... The great and marvellous advantage is of course that if I redefine dbg to expand to a constant, the linter doesn't start warning about unused variables. (So bizarre code like yours is not the only code that would break, but also bizarre code like mine.) BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Matthias Lang > Sent: den 2 februari 2007 15:14 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] leading underscores on > variables versus _ > > Ulf Wiger writes: > > > Underscores are always ignored. The variables that begin > > with an underscore are actually real variables. The > > linter interprets them as "don't care" patterns, but the > > compiler does not. > > This seems to catch many or even most beginners. It seems > natural (?) to expect _name to be a longer way of writing _, > i.e. that any variable starting with _ means exactly the same > thing as if you'd just written _. > > An example where that doesn't hold: > > f(_x, _x) -> same; > f(_,_) -> different. > > Changing _x to behave as many (most?) initially expect would > break backwards compatibility, but only for misleading code > such as the above... > > Matthias > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf.wiger@REDACTED Fri Feb 2 16:07:42 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 2 Feb 2007 16:07:42 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <17859.18225.627900.687480@antilipe.corelatus.se> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> Matthias Lang > f(_x, _x) -> same; > f(_,_) -> different. > > Changing _x to behave as many (most?) initially expect would > break backwards compatibility, but only for misleading code > such as the above... A bit more seriously, consider the following code from erl_parse.erl: yeccpars2(6, ';', __Ss, __Stack, __T, __Ts, __Tzr) -> yeccpars1(__Ts, __Tzr, 282, [6 | __Ss], [__T | __Stack]); So making the change would require a change in yecc at the same time. Code wouldn't break unless recompiled with new underscore semantics, but a yecc that hadn't been modified to match. Of course it begs the question whether there isn't other code as well that uses the same convention. In jungerl, I found that plain_fsm (by me) and eradius (by Martin B.) also reference __X type variables. It's reasonable to assume that there is more code out there that would break. BR, Ulf W From xpdoka@REDACTED Fri Feb 2 16:34:24 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Fri, 2 Feb 2007 16:34:24 +0100 (CET) Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> Message-ID: <21746.217.128.75.198.1170430464.squirrel@www.geekisp.com> Hi Ulf, > It's reasonable to assume that there is more code out > there that would break. This is one of the (many many) cases that would be easy to manage with a compiler flag to keep the old behaviour. Best regards, Dominic Williams http://www.dominicwilliams.net ---- From matthias@REDACTED Fri Feb 2 16:55:46 2007 From: matthias@REDACTED (Matthias Lang) Date: Fri, 2 Feb 2007 16:55:46 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> References: <17859.18225.627900.687480@antilipe.corelatus.se> <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> Message-ID: <17859.24322.338854.130001@antilipe.corelatus.se> Ulf Wiger (TN/EAB) writes: > Matthias Lang > > f(_x, _x) -> same; > > f(_,_) -> different. > A bit more seriously, consider the following code from > erl_parse.erl: > > yeccpars2(6, ';', __Ss, __Stack, __T, __Ts, __Tzr) -> > yeccpars1(__Ts, __Tzr, 282, [6 | __Ss], [__T | __Stack]); I'd classify this as much less serious, since it wouldn't even compile (if writing __Stack was the same as writing _). Not compiling is a minor problem. Compiling and then acting differently to before is a major problem. Matthias From matthias@REDACTED Fri Feb 2 17:04:44 2007 From: matthias@REDACTED (Matthias Lang) Date: Fri, 2 Feb 2007 17:04:44 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <21746.217.128.75.198.1170430464.squirrel@www.geekisp.com> References: <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> <21746.217.128.75.198.1170430464.squirrel@www.geekisp.com> Message-ID: <17859.24860.127142.138458@antilipe.corelatus.se> Dominic Williams writes: > This is one of the (many many) cases that would be easy to > manage with a compiler flag to keep the old behaviour. Only if you define "easy" as somehow keeping track which source files use the old rules and which use the new conventions, and never forget which is which when switching... Matthias From robert.virding@REDACTED Sat Feb 3 01:04:27 2007 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 03 Feb 2007 01:04:27 +0100 Subject: [erlang-questions] UNIX streams and Erlang ports Message-ID: <45C3D18B.6060702@telia.com> I discovered a copy of a very interesting, but rather old, paper by Dennis Ritchie called "A Stream Input-Output System" from 1984. It describes a new flexible system for communication between user applications and devices. "A stream is a full-duplex connection bwtween a user's process and a device or pseudo device. It consists of several linearly connected processing modules, and is analagous to a Shell pipeline, except that data flows in both directions. The modules in a stream communicate almost exclusively by passing messages to thier neighbors. ..." It is a truly elegant concept. What makes it especially interesting for us is that this was the model on which Erlang ports and i/o was based. Ports represent devices and applications communicate with devices by sending/receiving messages, i.e. streams. By inserting processes bewtween the port and the application the data can be processed along the way, i.e. processing modules. This is the reason why originally ports looked almost exactly like processes. An application communicated with a device by messages and would not see what extra processing was done along the way, or where it was done. We actually debated whether to have a separate data type at all for ports. Unfortunatley this model broke when the port_XXX functions were added. You now have to know what you are communicating with. Goodbye abstraction. What I find rather ironic and appeals to my, sometimes twisted, sense of humour is part of the manual text describing the port_XXX commands. The manual tries to show why the port_XXX commands are much more "logical" than the message interface. All I can say is that they, those who added the commands and wrote the text, missed the point and that the commands are in fact illogical and break the model. Reading old papers can be fun. You can find Ritchie's paper on his site, along with a lot of other interesting stuff. Robert From klacke@REDACTED Sat Feb 3 03:27:21 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Sat, 03 Feb 2007 03:27:21 +0100 Subject: [erlang-questions] UNIX streams and Erlang ports In-Reply-To: <45C3D18B.6060702@telia.com> References: <45C3D18B.6060702@telia.com> Message-ID: <45C3F309.6040301@hyber.org> Robert Virding wrote: > I discovered a copy of a very interesting, but rather old, paper by > Dennis Ritchie called "A Stream Input-Output System" from 1984. It > describes a new flexible system for communication between user > applications and devices. > > "A stream is a full-duplex connection bwtween a user's process and a > device or pseudo device. It consists of several linearly connected > processing modules, and is analagous to a Shell pipeline, except that > data flows in both directions. The modules in a stream communicate > almost exclusively by passing messages to thier neighbors. ..." > > It is a truly elegant concept. Except that it was never implemented efficiently enough, thus the port_XXX commands. Our fault. Had we done better job 13 years ago, we'd never seen the port_XXX commands ... and more /klacke From matthew.reilly@REDACTED Sat Feb 3 05:04:17 2007 From: matthew.reilly@REDACTED (Matthew Reilly) Date: Fri, 02 Feb 2007 20:04:17 -0800 Subject: [erlang-questions] erlang:md5() / crypto:md5() - any differences ? In-Reply-To: References: Message-ID: <45C409C1.1040208@sipphone.com> Bjorn Gustavsson wrote: > "Roberto Saccon" writes: > > >> What is the difference between the md5 functions in erlang module / crypto >> module ? >> > > None. > > /Bjorn > > You have to do crypto:start() before you can use crypto:md5(), but you can use erlang:md5() without starting any module. -Matt From ulf@REDACTED Sat Feb 3 11:49:53 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 03 Feb 2007 11:49:53 +0100 Subject: [erlang-questions] UNIX streams and Erlang ports In-Reply-To: <45C3F309.6040301@hyber.org> References: <45C3D18B.6060702@telia.com> <45C3F309.6040301@hyber.org> Message-ID: Den 2007-02-03 03:27:21 skrev Claes Wikstrom : > Robert Virding wrote: >> >> "A stream is a full-duplex connection bwtween a user's >> process and a device or pseudo device. It consists of >> several linearly connected processing modules, and is >> analagous to a Shell pipeline, except that data flows >> in both directions. The modules in a stream communicate >> almost exclusively by passing messages to thier neighbors. ..." >> >> It is a truly elegant concept. > > > Except that it was never implemented efficiently enough, > thus the port_XXX commands. Our fault. Had we done > better job 13 years ago, we'd never seen the port_XXX > commands ... and more Agreed - except perhaps with the part about you not having done a good enough job. (: Ten years ago, when we started building the AXD 301, we often had to disregard the ideal model and make all sorts of low-level optimizations. But recall that our task then was to handle 100 ATM calls/s on a 110 MHz MicroSPARC CPU... (In truth, we didn't reach that until we plugged in the enormously fast 400 MHz UltraSPARC CPU.) The big question was not whether we could stay true to the Erlang model, but whether we could use Erlang *at all*. We contributed to the introduction of the port_XXX commands, because the difference in speed was simply to great to ignore. Nowadays, we try to "turn back time" and encourage textbook Erlang, rather than doing lots of low-level optimizations. We think that this will pay off especially with SMP Erlang, so this may be a really good time to resurrect some of the core concepts. BR, Ulf W -- Ulf Wiger From xpdoka@REDACTED Sat Feb 3 18:37:52 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Sat, 03 Feb 2007 18:37:52 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <17859.24860.127142.138458@antilipe.corelatus.se> References: <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> <21746.217.128.75.198.1170430464.squirrel@www.geekisp.com> <17859.24860.127142.138458@antilipe.corelatus.se> Message-ID: <45C4C870.9000601@dominicwilliams.net> Hi Matthias, Matthias Lang wrote: > Only if you define "easy" as somehow keeping track which > source files use the old rules and which use the new > conventions, Well, this one /is/ easy, as each module coded with the old rule can be given a -compile(bind_leading_underscore). ... attribute. > and never forget which is which when switching... Yes, this is a matter of discipline, or process. My personal approach when adopting a new feature, convention or guideline is to leave old modules alone until I happen to be doing some other change in one - at which point I change the whole module over to using the new system (which usually takes about 2 minutes). I do think it's a small, worthwhile price to pay to keep improving the language. Regards, Dominic Williams http://www.dominicwilliams.net ---- From matthias@REDACTED Sat Feb 3 22:21:52 2007 From: matthias@REDACTED (Matthias Lang) Date: Sat, 3 Feb 2007 22:21:52 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <45C4C870.9000601@dominicwilliams.net> References: <6616D98C65DD514BA2E1DDC5F9223155E27CB3@esealmw115.eemea.ericsson.se> <21746.217.128.75.198.1170430464.squirrel@www.geekisp.com> <17859.24860.127142.138458@antilipe.corelatus.se> <45C4C870.9000601@dominicwilliams.net> Message-ID: <17860.64752.860907.648405@antilipe.corelatus.se> Dominic Williams writes: > Well, this one /is/ easy, as each module coded with the old > rule can be given a > > -compile(bind_leading_underscore). > > ... attribute. Say you get a module from a third party, say jungerl. It doesn't have the above attribute. How do you decide whether you should add the attribute or not? In general, you have to understand the code to be able to decide. And that can be arbitrarily difficult. My cure is worse than the problem. I should never have suggested it. Matthias From windrunner1977@REDACTED Sun Feb 4 13:41:41 2007 From: windrunner1977@REDACTED (pierantonio redaelli) Date: Sun, 4 Feb 2007 13:41:41 +0100 (CET) Subject: [erlang-questions] p2p ? Message-ID: <558338.68415.qm@web23111.mail.ird.yahoo.com> hi, i'm fascinated by Erlang. in theory Erlang seems perfect to do any sort of network-related or distributed application, in practice however it seems that everything is built on top of Erlang process model, including Ditribueted Erlang and OTP assumes that you need to manage a small number of trusted nodes on a trusted network with good latency properties (like a dedicated LAN). now probably you tell me this is of course this is the case if you have to develop a switch or other telco applications but this is does not appear to be the only type of situation where the erlang process model is appealing for network applications i think there another possible kinds of applications where Erlang could extend find some audiance of programmers is distributed applications whith thousands of nodes and significant latency (ie nodes on internet or worldwide intranet). obviously peer to peer applications are such a kind of application. obviously today much of the P2P sw is written in java. i would ask your comment on the way one would be able to structure such an application using otp, to see if the match between p2p and otp is really possible, or, beyond any erlang buzzword, java is really the way to go. typically a p2p app (on a structured overlay) is a layered software where you have: - some messaging layer that uses udp or tcp or http etc to send/receive messages across nodes part of the p2p overlay network - a routing layer, the heart of the p2p overlay network, that assign nodeID to a node, place the node somewhere in a pseudo-metric space using NodeID as basis for the distance between any two nodes and routes msgs across nodes based on that distances - basic services layer, like DHT (distributed hashtables, offering get/put methods) or DOLR (distributed object location and routing, which allow a level of indirection and save information on where the entity you want to track down is placed rather then saving the entity itself) - the actual application (streaming, data sharing, distibuted filesystems etc) a very used idea in this software is to have one layer call back into another so that whenever the routing layer see a packet that is for an application running on that node it will call back the application which may to application-specific changes to the packet contents or even drop it or change its destination some implementations (like Tapestry) uses a threadpool for each layer, the threadpool shares a queue and the threads picks a msg (turned into an object) from the queue and then process it and emits other msgs (objects) that are places in the queues of other relevant layers. that is using an event driven side but with multiple processing stages. but in erlang, what is the best way to implement this kind of application structure in erlang ? ---------------- one way to do this would be to implement each layer as an otp/application, each of these otp/applications made of processes sending erlang messages to other otp/applications processes apart the low level layer that would translate ip messages to/from erlang messages. an otp/app here would be similar to a component in component models on object oriented languages is there a real component model that nicely fit into erlang ? (not the elephant-like erlcom) being able to have multiple instances of the same component running in same node, and being able to start/stop independently being able to plumb/unplumb/change the flow of messages among the components at runtime cheers piero ___________________________________ Vinci i biglietti per FIFA World Cup in Germania! yahoo.it/concorso_messenger From windrunner1977@REDACTED Sun Feb 4 14:20:50 2007 From: windrunner1977@REDACTED (pierantonio redaelli) Date: Sun, 4 Feb 2007 14:20:50 +0100 (CET) Subject: [erlang-questions] p2p /2 Message-ID: <998876.82173.qm@web23111.mail.ird.yahoo.com> maybe refining my previous post.... and hoping this does not seem crazy the actual question is: if you want to write global-scale applications, that is distributed applications whith thousands of nodes and significant latency, and significant number of faults how can Erlang help ? or saying it the other way around: what are the limits of Erlang/OTP such that beyond those limits it will start to break down in pieces, not to scale etc ? piero ___________________________________ Vinci i biglietti per FIFA World Cup in Germania! yahoo.it/concorso_messenger From csanto@REDACTED Sun Feb 4 19:34:31 2007 From: csanto@REDACTED (Corrado Santoro) Date: Sun, 04 Feb 2007 19:34:31 +0100 Subject: [erlang-questions] p2p /2 In-Reply-To: <998876.82173.qm@web23111.mail.ird.yahoo.com> References: <998876.82173.qm@web23111.mail.ird.yahoo.com> Message-ID: <45C62737.3030009@diit.unict.it> Hi Piero, pierantonio redaelli ha scritto: > maybe refining my previous post.... > and hoping this does not seem crazy :-) > the actual question is: if you want to write > global-scale applications, that is distributed > applications whith thousands of nodes and significant > latency, and significant number of faults > how can Erlang help ? Erlang/OTP can be "the solution" to this problem: it has a great fault-tolerance mechanism and the way in which remote communication is performed is really simple. > or saying it the other way around: what are the limits > of Erlang/OTP such that beyond those limits > it will start to break down in pieces, not to scale > etc ? If you're talking about P2P I think that there is not limit. You could have problems if you use centralized structures that grow together with the system size; in these cases you have to take into account Erlang limits (atom table, number of processes, limits of mnesia, etc.). But if you have decentralized structures, as in P2P systems, what's the problem? In any case, I'm developing, with a student, an Erlang infrastructure to build P2P systems.... so I could answer more precisely in a couple of months... :-) Cheers, --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 tom@REDACTED Sun Feb 4 20:00:17 2007 From: tom@REDACTED (Tom Samplonius) Date: Sun, 4 Feb 2007 11:00:17 -0800 (PST) Subject: [erlang-questions] p2p /2 In-Reply-To: <998876.82173.qm@web23111.mail.ird.yahoo.com> Message-ID: <8294111.361170615617530.JavaMail.root@ly.sdf.com> ----- "pierantonio redaelli" wrote: > maybe refining my previous post.... > and hoping this does not seem crazy > > the actual question is: if you want to write > global-scale applications, that is distributed > applications whith thousands of nodes and significant > latency, and significant number of faults > how can Erlang help ? > > or saying it the other way around: what are the limits > of Erlang/OTP such that beyond those limits > it will start to break down in pieces, not to scale > etc ? > > piero I think your question is so general, it is almost unanswerable. In your previous post you described some sort of complex p2p app, but do not really describe what it did. I disagree that most p2p software is written in Java. The original Bit torrent client was written in Python after all, and nothing is bigger than Bit torrent in the p2p space (as measured by volume of traffic). But erlang is already being used for these kinds of app already. What about jabber? Thousands of clients, hundreds of servers, which have their own connected clients. Thousands of messages per second. Tom From kent@REDACTED Mon Feb 5 00:14:58 2007 From: kent@REDACTED (Kent Boortz) Date: Mon, 05 Feb 2007 00:14:58 +0100 Subject: [erlang-questions] Compiling erlang on AIX 5.3 In-Reply-To: <55DDB08CC9CD2941A70E8D626789A2C903FBB261@ec8l7ljvo9h5dde.hosting.exch> (VAUCHER Laurent's message of "Tue, 30 Jan 2007 13:20:41 +0100") References: <55DDB08CC9CD2941A70E8D626789A2C903FBB261@ec8l7ljvo9h5dde.hosting.exch> Message-ID: "VAUCHER Laurent" writes: > Compilation seems to proceed further, but then > > === Entering application parsetools > make[3]: Entering directory `/tmp/otp_src_R11B-2/lib/parsetools/src' > erlc -W +debug_info -I/tmp/otp_src_R11B-2/lib/stdlib/include -o../ebin > yecc.erl > Could not load program > /tmp/otp_src_R11B-2/bin/powerpc-ibm-aix5.3.0.0/beam: > The program does not have an entry point or > the o_snentry field in the auxiliary header is invalid. > Examine file headers with the 'dump -ohv' command. Hard to say without seeing the complete build log and "config.log", but using Google there seem to be two main causes for this on AIX - Somehow the build put in "-G" or "-shared" on the link line of the "beam" executable. - "ld" was used to link the final application "beam", this will not work on AIX. The "gcc" or "xlc_r" command should be used for linking, as it "knows things" about runtime library dependencies, entry points etc that a plain "ld" has no idea about. The problem with using "ld" is described at page 73 in http://jumpdoc.fz-juelich.de/doc_pdf/compiler/SG24-5674-01a-CandC++.pdf kent -- Kent Boortz, Senior Software Developer MySQL AB, www.mysql.com Office: +46 18 174400 ext. 4450 (VoIP) Office: +46 19 182931 Mobile: +46 70 2791171 From rodahummont@REDACTED Mon Feb 5 05:08:55 2007 From: rodahummont@REDACTED (Rodrigo Ahumada M.) Date: Mon, 05 Feb 2007 01:08:55 -0300 Subject: [erlang-questions] negative diference between two calls to now/0 Message-ID: <1170648536.10730.18.camel@rod-linux> hi i was writing a short erlang program to make a test for a sofware for a friend. I wanted to test how many connections his server can handle per second, and how long it takes to respond and serve. so i made a program that launches N processes that tries to conect to the server, send question and receive an answer. After that the process send its results to a logger process and then terminates. the code for each process is like this: [...] time_lapse({_MgS1, S1, MuS1}, {_MgS2, S2, MuS2}) -> %% calculate the difference of msecs, %% ignore the MegaSecs because always they're zero T1 = S1*1000 + MuS1, T2 = S2*1000 + MuS2, T2 - T1. client_proc(IP, Port, Timeout) -> InitProc = now(), %% timestamp when the process started case gen_tcp:connect(IP, Port, [list, {active, false}], Timeout) of {ok, Socket} -> InitCnx = now(), %% timestamp when the process could connect gen_tcp:send(Socket, ?QUESTION), case gen_tcp:recv(Socket, 0) of {ok, _Answer} -> EndCnx = now(), %% timestamp when the process received an %% answer... inet:close(Socket), WaitedTime = time_lapse(InitProc, InitCnx), ServedTime = time_lapse(InitCnx, EndCnx), logger ! {success, WaitedTime, ServedTime}; {error, _Reason} -> EndProc = now(), %% timestamp when the server connected but %% close the conection before the answer WaitedTime = time_lapse(InitProc, EndProc), logger ! {failed, WaitedTime} end; {error, _Reason} -> EndProc = now(), %% timestamp when the process gave up trying %% to connect WaitedTime = time_lapse(InitProc, EndProc), logger ! {failed, WaitedTime} end, client_launcher ! {terminated, self()}. [...] th problem i'm having is some times time_lapse/2 gives me a negative number, when calculating WaitedTime and ServedTime. thanks for any help or idea. __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From per@REDACTED Mon Feb 5 08:14:34 2007 From: per@REDACTED (Per Hedeland) Date: Mon, 5 Feb 2007 08:14:34 +0100 (CET) Subject: [erlang-questions] negative diference between two calls to now/0 In-Reply-To: <1170648536.10730.18.camel@rod-linux> Message-ID: <200702050714.l157EYPP049588@pluto.hedeland.org> "Rodrigo Ahumada M." wrote: > >time_lapse({_MgS1, S1, MuS1}, {_MgS2, S2, MuS2}) -> > %% calculate the difference of msecs, > %% ignore the MegaSecs because always they're zero > T1 = S1*1000 + MuS1, > T2 = S2*1000 + MuS2, > T2 - T1. >th problem i'm having is some times time_lapse/2 gives me a negative >number, when calculating WaitedTime and ServedTime. Try T1 = S1*1000000 + MuS1, T2 = S2*1000000 + MuS2, (T2 - T1) / 1000. - the third element is *micro*seconds, not milliseconds. --Per Hedeland From samuelrivas@REDACTED Mon Feb 5 08:51:33 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Mon, 5 Feb 2007 08:51:33 +0100 Subject: [erlang-questions] negative diference between two calls to now/0 In-Reply-To: <1170648536.10730.18.camel@rod-linux> References: <1170648536.10730.18.camel@rod-linux> Message-ID: <20070205075133.GA15595@lambdastream.com> Rodrigo Ahumada M. wrote: > [...] > so i made a program that launches N processes that tries to conect to > the server, send question and receive an answer. After that the process > send its results to a logger process and then terminates. > > the code for each process is like this: > > [...] > > time_lapse({_MgS1, S1, MuS1}, {_MgS2, S2, MuS2}) -> > %% calculate the difference of msecs, > %% ignore the MegaSecs because always they're zero > T1 = S1*1000 + MuS1, > T2 = S2*1000 + MuS2, > T2 - T1. > [...] MuS1 and MuS2 are microseconds, not milliseconds. Also, megaseconds difference is not always zero. Each about 11.5 days it changes, so if you ignore then you will get negative values if, for example, you get {828, 1, 653753} - {827, 999999, 676} (example from supervisor.erl) Regards -- Samuel From bjorn@REDACTED Mon Feb 5 08:29:52 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 05 Feb 2007 08:29:52 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155E27C6F@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F9223155E27C6F@esealmw115.eemea.ericsson.se> Message-ID: "Ulf Wiger \(TN/EAB\)" writes: > I have on occasion used underscored variables > in the following way > > foo([{x, _, _, Thingy, _} = _Obj| T]) -> > ?dbg("_Obj = ~p~n", [_Obj]), > ... > I have also written code like that. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Mon Feb 5 08:41:17 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 05 Feb 2007 08:41:17 +0100 Subject: [erlang-questions] UNIX streams and Erlang ports In-Reply-To: <45C3D18B.6060702@telia.com> References: <45C3D18B.6060702@telia.com> Message-ID: We have no intention of removing the message protocol for ports, so if you want to use ports in a stream-like way, you still can. /Bjorn Robert Virding writes: > I discovered a copy of a very interesting, but rather old, paper by > Dennis Ritchie called "A Stream Input-Output System" from 1984. It > describes a new flexible system for communication between user > applications and devices. > > "A stream is a full-duplex connection bwtween a user's process and a > device or pseudo device. It consists of several linearly connected > processing modules, and is analagous to a Shell pipeline, except that > data flows in both directions. The modules in a stream communicate > almost exclusively by passing messages to thier neighbors. ..." > > It is a truly elegant concept. > > What makes it especially interesting for us is that this was the model > on which Erlang ports and i/o was based. Ports represent devices and > applications communicate with devices by sending/receiving messages, > i.e. streams. By inserting processes bewtween the port and the > application the data can be processed along the way, i.e. processing > modules. This is the reason why originally ports looked almost exactly > like processes. An application communicated with a device by messages > and would not see what extra processing was done along the way, or where > it was done. We actually debated whether to have a separate data type at > all for ports. > > Unfortunatley this model broke when the port_XXX functions were added. > You now have to know what you are communicating with. Goodbye abstraction. > > What I find rather ironic and appeals to my, sometimes twisted, sense of > humour is part of the manual text describing the port_XXX commands. The > manual tries to show why the port_XXX commands are much more "logical" > than the message interface. All I can say is that they, those who added > the commands and wrote the text, missed the point and that the commands > are in fact illogical and break the model. > > Reading old papers can be fun. You can find Ritchie's paper on his site, > along with a lot of other interesting stuff. > > Robert > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From erlangist@REDACTED Mon Feb 5 09:48:25 2007 From: erlangist@REDACTED (lang er) Date: Mon, 5 Feb 2007 16:48:25 +0800 Subject: [erlang-questions] Best practices for CNode server or some tutorials? Message-ID: <230465c00702050048u14bd9974r9876b10672c71ab9@mail.gmail.com> I'm writing a CNode server(using 3rd API DLL) to interact with my erlang program . I cannot find much documents about CNode,are there any best practice for writing CNode? For example: 1.How to autostart my cnode when start my erlang program(I read some codes in gtknode,which use a middleman process links to the gtkNode ) 2.If I want to auto restart my Cnode when it crash,what is the prefer method to do this?I Think maybe I can use a middleman process to monitor CNode, so when CNode crash, this process exit, and use supervisor to restart this process. 3.How to call ei_xreceive_msg in my Cnode. Official example use a infinite loop, gtknode use g_io_add_watch , is there any function like g_io_add_watch provided in ei ? Regards! James -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangist@REDACTED Mon Feb 5 09:57:55 2007 From: erlangist@REDACTED (lang er) Date: Mon, 5 Feb 2007 16:57:55 +0800 Subject: [erlang-questions] Best practices for CNode server or some tutorials? In-Reply-To: <230465c00702050048u14bd9974r9876b10672c71ab9@mail.gmail.com> References: <230465c00702050048u14bd9974r9876b10672c71ab9@mail.gmail.com> Message-ID: <230465c00702050057hb387a0fwde082c88fd0ab3c2@mail.gmail.com> For problem 3, Can I use select directly? > > > Regards! > James > -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Mon Feb 5 11:06:20 2007 From: per@REDACTED (Per Hedeland) Date: Mon, 5 Feb 2007 11:06:20 +0100 (CET) Subject: [erlang-questions] negative diference between two calls to now/0 In-Reply-To: <20070205075133.GA15595@lambdastream.com> Message-ID: <200702051006.l15A6K4g052958@pluto.hedeland.org> Samuel Rivas wrote: >Rodrigo Ahumada M. wrote: >> [...] >> so i made a program that launches N processes that tries to conect to >> the server, send question and receive an answer. After that the process >> send its results to a logger process and then terminates. >> >> the code for each process is like this: >> >> [...] >> >> time_lapse({_MgS1, S1, MuS1}, {_MgS2, S2, MuS2}) -> >> %% calculate the difference of msecs, >> %% ignore the MegaSecs because always they're zero >> T1 = S1*1000 + MuS1, >> T2 = S2*1000 + MuS2, >> T2 - T1. >> [...] > > MuS1 and MuS2 are microseconds, not milliseconds. Also, megaseconds >difference is not always zero. Each about 11.5 days it changes, so if >you ignore then you will get negative values if, for example, you get > > {828, 1, 653753} - {827, 999999, 676} > >(example from supervisor.erl) Good point - and of course the best answer is to use timer:now_diff/2 instead of rolling your own... --Per Hedeland From sean.hinde@REDACTED Mon Feb 5 11:37:07 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 5 Feb 2007 10:37:07 +0000 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: References: <6616D98C65DD514BA2E1DDC5F9223155E27C6F@esealmw115.eemea.ericsson.se> Message-ID: <2C3CF533-E271-4B4A-BCC5-DC22B2942BB5@gmail.com> On 5 Feb 2007, at 07:29, Bjorn Gustavsson wrote: > "Ulf Wiger \(TN/EAB\)" writes: > >> I have on occasion used underscored variables >> in the following way >> >> foo([{x, _, _, Thingy, _} = _Obj| T]) -> >> ?dbg("_Obj = ~p~n", [_Obj]), >> ... >> > > I have also written code like that. We have it as a stated policy to write code like this. We also have a stated policy to have no compiler warnings. Ah well, 1 out of 2 ain't bad :-) Sean From lenartlad@REDACTED Mon Feb 5 13:44:36 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Mon, 05 Feb 2007 13:44:36 +0100 Subject: [erlang-questions] xmerl SAX interface Message-ID: <45C726B4.4090209@volny.cz> Hello, I am trying to implement a XML SAX driver using xmerl and I got lost on the way a little. xmerl_eventp seems that it is what I am looking for (SAX driver), but when I try to parse the following 2 3 I get only the "closing" events which is not what I would expect (from a SAX driver). I have read the examples in xmerl 0.20 and used Google extensively, but with no luck so far. Can anyone please show me how to set up and SAX-parse a simple XML document like the one above (namespaces are not necessary but would be great, too). Links to xmerl tutorials/faqs/... are also welcome. Thanks in advance, Ladislav Lenart From attila.rajmund.nohl@REDACTED Mon Feb 5 14:52:39 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Mon, 5 Feb 2007 14:52:39 +0100 (CET) Subject: [erlang-questions] How to break out from mnesia transaction? Message-ID: Hello! I have to implement function a() which have to call function b(). Function a() is always called from a mnesia transaction, while function b() can't be called from a mnesia transaction. How can I solve this problem elegantly? My idea is start a process from a(), send a message to the process, which in turn will call b() (it's now outside of the transaction, right?) and when b() returns, the process sends back a message to a(). Is there a simpler way to solve the problem? Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From ft@REDACTED Mon Feb 5 15:14:28 2007 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 05 Feb 2007 15:14:28 +0100 Subject: [erlang-questions] How to break out from mnesia transaction? In-Reply-To: References: Message-ID: <45C73BC4.9070801@it.su.se> attila.rajmund.nohl@REDACTED wrote: > Hello! > > I have to implement function a() which have to call function b(). > Function a() is always called from a mnesia transaction, while function > b() can't be called from a mnesia transaction. How can I solve this > problem elegantly? My idea is start a process from a(), send a message > to the process, which in turn will call b() (it's now outside of the > transaction, right?) and when b() returns, the process sends back a > message to a(). Is there a simpler way to solve the problem? > > Bye,NAR If you have something that can't run inside a transaction, you can't run it inside a transaction. Have the transaction return a value that makes the code that invoked the transaction invoke b() when the transaction has completed. /Fredrik From launoja@REDACTED Mon Feb 5 15:27:56 2007 From: launoja@REDACTED (Jani Launonen) Date: Mon, 05 Feb 2007 16:27:56 +0200 Subject: [erlang-questions] How to break out from mnesia transaction? In-Reply-To: References: Message-ID: > Hello! > > I have to implement function a() which have to call function b(). > Function a() is always called from a mnesia transaction, while > functionb() can't be called from a mnesia transaction. How can I > solve this > problem elegantly? My idea is start a process from a(), send a message > to the process, which in turn will call b() (it's now outside of the > transaction, right?) and when b() returns, the process sends > back a > message to a(). Is there a simpler way to solve the problem? Sending message from a transaction is a bad idea --- in fact any side-effect inside transaction is a bad idea --- if the transaction have to be restarted (which Mnesia does automatically if need arises). Then there would be several messages sent to the process calling the function b(). I wonder if there's elegant solution to this, but perhaps restricting Mnesia transactions to only one (somewhere was such parameter) or giving some unique identifier outside of transaction containing the function a() which is sent with the message to process calling the b(). Then, if b receives the same identifier twice (or more times if Mnesia restarts the transaction several times) it discards such calls, but returns the previous answer. A bit hacky, I have to admit, but it's been some years that I had to study the subject during my thesis. I'm interested in hearing the "correct" solution from pros :) > Bye,NAR > -- > "Beware of bugs in the above code; I have only proved it > correct, not > tried it." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions Jani Launonen -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.rajmund.nohl@REDACTED Mon Feb 5 15:49:12 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Mon, 5 Feb 2007 15:49:12 +0100 (CET) Subject: [erlang-questions] How to break out from mnesia transaction? In-Reply-To: References: Message-ID: On Mon, 5 Feb 2007, Jani Launonen wrote: >> Hello! >> >> I have to implement function a() which have to call function b(). >> Function a() is always called from a mnesia transaction, while >> functionb() can't be called from a mnesia transaction. How can I >> solve this >> problem elegantly? My idea is start a process from a(), send a message >> to the process, which in turn will call b() (it's now outside of the >> transaction, right?) and when b() returns, the process sends >> back a >> message to a(). Is there a simpler way to solve the problem? > > Sending message from a transaction is a bad idea --- in fact any side-effect inside transaction is a bad idea --- if the transaction have to be restarted (which Mnesia does automatically if need arises). Then there would be several messages sent to the process calling the function b(). Actually function b() has side effects, that's why I need to call it and I guess that's the reason why it returns an error code if it's called from a transaction. > I wonder if there's elegant solution to this, but perhaps restricting Mnesia transactions to only one (somewhere was such parameter) or giving some unique identifier outside of transaction containing the function a() which is sent with the message to process calling the b(). Then, if b receives the same identifier twice (or more times if Mnesia restarts the transaction several times) it discards such calls, but returns the previous answer. A bit hacky, I have to admit, but it's been some years that I had to study the subject during my thesis. I'm interested in hearing the "correct" solution from pros :) I don't know the black magic involved, but the transaction which calls a() is special: it's restarted exactly once and a() even knows if it's the first run or the second, so I could send the message exactly once. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From launoja@REDACTED Mon Feb 5 15:52:49 2007 From: launoja@REDACTED (Jani Launonen) Date: Mon, 05 Feb 2007 16:52:49 +0200 Subject: [erlang-questions] How to break out from mnesia transaction? In-Reply-To: References: Message-ID: > > Hello! > > > > I have to implement function a() which have to call function b(). > > Function a() is always called from a mnesia transaction, while > > functionb() can't be called from a mnesia transaction. How can > I > > solve this > > problem elegantly? My idea is start a process from a(), send a > message> to the process, which in turn will call b() (it's now > outside of the > > transaction, right?) and when b() returns, the process sends > > back a > > message to a(). Is there a simpler way to solve the problem? > > Sending message from a transaction is a bad idea --- in fact any > side-effect inside transaction is a bad idea --- if the > transaction have to be restarted (which Mnesia does > automatically if need arises). Then there would be several > messages sent to the process calling the function b(). > > I wonder if there's elegant solution to this, but perhaps > restricting Mnesia transactions to only one (somewhere was such > parameter) I meant "... only one transaction and checking if it succeeded. If not, some recovery action should take place." But I think that the actual details of the two functions dictates the suitable solution and my ideas here are just hacks that might work or not depending on the details. >or giving some unique identifier outside of > transaction containing the function a() which is sent with the > message to process calling the b(). Then, if b receives the same > identifier twice (or more times if Mnesia restarts the > transaction several times) it discards such calls, but returns > the previous answer. A bit hacky, I have to admit, but it's been > some years that I had to study the subject during my thesis. I'm > interested in hearing the "correct" solution from pros :) > > > Bye,NAR > > -- > > "Beware of bugs in the above code; I have only proved it > > correct, not > > tried it." > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > Jani Launonen -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.rajmund.nohl@REDACTED Mon Feb 5 15:27:26 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Mon, 5 Feb 2007 15:27:26 +0100 (CET) Subject: [erlang-questions] How to break out from mnesia transaction? In-Reply-To: <45C73BC4.9070801@it.su.se> References: <45C73BC4.9070801@it.su.se> Message-ID: On Mon, 5 Feb 2007, Fredrik Thulin wrote: > attila.rajmund.nohl@REDACTED wrote: >> Hello! >> >> I have to implement function a() which have to call function b(). >> Function a() is always called from a mnesia transaction, while function >> b() can't be called from a mnesia transaction. How can I solve this >> problem elegantly? My idea is start a process from a(), send a message >> to the process, which in turn will call b() (it's now outside of the >> transaction, right?) and when b() returns, the process sends back a >> message to a(). Is there a simpler way to solve the problem? >> >> Bye,NAR > > If you have something that can't run inside a transaction, you can't run it > inside a transaction. > > Have the transaction return a value that makes the code that invoked the > transaction invoke b() when the transaction has completed. Unfortunately I can't change neither b() (to make it run in a transaction) nor the code that calls a() (to not use transaction or handle a special return value). Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From autophile@REDACTED Mon Feb 5 17:06:26 2007 From: autophile@REDACTED (Robert Baruch) Date: Mon, 5 Feb 2007 11:06:26 -0500 Subject: [erlang-questions] Holy war! Adding to_lower, to_upper to string package In-Reply-To: <45C409C1.1040208@sipphone.com> References: <45C409C1.1040208@sipphone.com> Message-ID: Hi all, The last I read about this was in 2006 (http://erlang.org/ml-archive/ erlang-questions/200601/msg00479.html). Has anyone gotten up the courage to suggest that to_lower and to_upper be moved from the http_util module to the string module? Understood that these functions only operate on latin-1, but maybe by moving them to the string module, they may be given more attention as string manipulation functions rather than http utility functions? --Rob From thomasl_erlang@REDACTED Mon Feb 5 17:55:27 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 5 Feb 2007 08:55:27 -0800 (PST) Subject: [erlang-questions] Erlang Extension Proposals (EEPs) In-Reply-To: <17265362.241170275036790.JavaMail.root@ly.sdf.com> Message-ID: <199514.32310.qm@web38809.mail.mud.yahoo.com> --- Tom Samplonius wrote: > ----- "Thomas Lindgren" > wrote: > > > Ironically, Common Lisp is FAR MORE standardized > than > > Erlang. The problems of porting, e.g., Common Lisp > do > > not appear in Erlang only because with Erlang > there is > > nowhere to port. If there was a second source for > > Erlang, I would hands down expect future > functionality > > to diverge, and probably the existing libraries > too > > (as bug fixes are introduced, for example). > > I guess we have different ideas of what > "standardization" means. Socket programming is a > basic feature, and it doesn't work the same, > everywhere in the CL world. Nor do sockets work the same in the C world, or even the Unix world (cf. Stevens). Standardization instead usually means having a formal standard of some sort. This doesn't prevent problems when porting or interworking, of course, nor does it address issues beyond the standard. Nor compliance. But a standard still shows explicitly what is expected in order to comply. As per above, I would expect Erlang implementations to diverge too, if there were several ones. The drivers are obvious: users have different preferences and implementors can't delay their work to copy whatever choices the incumbent eventually will make. > I think we also have different ideas on what > "port" means too. Erlang does not run on everything > yet, so there is more porting of the environment to > do. Porting Erlang/OTP is far more a problem of porting C code than porting Erlang code. > Now, given that there is only a single erlang > implementation, application porting is mostly a > non-issue. And it should be. Application "porting" > isn't a problem worth fixing. If you have to change > your code to run under a different implementation, > it means the language implementation has failed. As I see it, the decision whether to port an application to a new platform (OS or language implementation or whatever) is a trade off, not an absolute. There are also many cases when it makes good sense to port. (Even tracking Erlang/OTP through its releases involves a small amount of porting.) Likewise, language implementors too have to consider whether to design, implement and support utterly future proof interfaces (so that user porting will never be an issue) or not. Maybe their time budget could be spent on better things. Maybe their users prefer a good choice right now rather than a perfect choice sometime in the future. (I guess this could go on to Gabriel's "Worse is better" paper, but that's probably beyond the scope of this list.) Best, Thomas ____________________________________________________________________________________ Don't get soaked. Take a quick peak at the forecast with the Yahoo! Search weather shortcut. http://tools.search.yahoo.com/shortcuts/#loc_weather From w.a.de.jong@REDACTED Mon Feb 5 19:55:59 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Mon, 5 Feb 2007 19:55:59 +0100 Subject: [erlang-questions] xmerl SAX interface In-Reply-To: <45C726B4.4090209@volny.cz> References: <45C726B4.4090209@volny.cz> Message-ID: <407d9ef80702051055l148e21bew7dbe544977a2b24b@mail.gmail.com> Hello, I tried to find this out as well, but I didn't find the answer either. I ended up implementing my own SAX parser. It is part of Erlsom (which you can find on Sourceforge). Your example could be parsed as follows. S = " 2 3 ". C = fun(Event, State) -> io:format("~p\n", [Event]), State end. erlsom:sax(S, [], C). The result: startDocument {startPrefixMapping,[],"urn"} {startElement,"urn","e1",[],[]} {ignorableWhitespace,"\n\n "} {startElement,"urn","e2",[],[{attribute,"a2","a2",[],"b"}]} {characters,"2"} {endElement,"urn","e2",[]} {ignorableWhitespace,"\n\n "} {startElement,"urn","e3",[],[]} {characters,"3"} {endElement,"urn","e3",[]} {ignorableWhitespace,"\n\n "} {endElement,"urn","e1",[]} {endPrefixMapping,[]} endDocument [] Regards, Willem On 2/5/07, Ladislav Lenart wrote: > Hello, > > I am trying to implement a XML SAX driver using xmerl and I got lost > on the way a little. xmerl_eventp seems that it is what I am looking > for (SAX driver), but when I try to parse the following > > > 2 > 3 > > > I get only the "closing" events which is not what I would expect > (from a SAX driver). > > I have read the examples in xmerl 0.20 and used Google extensively, > but with no luck so far. > > Can anyone please show me how to set up and SAX-parse a simple XML > document like the one above (namespaces are not necessary but would > be great, too). > > Links to xmerl tutorials/faqs/... are also welcome. > > Thanks in advance, > > Ladislav Lenart > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From autophile@REDACTED Mon Feb 5 22:43:56 2007 From: autophile@REDACTED (Robert Baruch) Date: Mon, 5 Feb 2007 16:43:56 -0500 Subject: [erlang-questions] Please review this basic Erlang doc? In-Reply-To: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> References: <8D74538B-40FB-46A2-AD5A-B2DAA8D8BE02@zoominternet.net> Message-ID: <389F8323-090B-4AAF-B809-F5BCDA449F9E@zoominternet.net> Hi all, Thank you very much to everyone who reviewed the document. I've learned many things from the review, and incorporated the information in the new revision. Here it is, enjoy! http://chuffyrodents.org/erlang.pdf --Rob From vances@REDACTED Mon Feb 5 22:52:40 2007 From: vances@REDACTED (Vance Shipley) Date: Mon, 5 Feb 2007 16:52:40 -0500 Subject: [erlang-questions] UNIX streams and Erlang ports In-Reply-To: <45C3D18B.6060702@telia.com> References: <45C3D18B.6060702@telia.com> Message-ID: <20070205215240.GA30666@frogman.motivity.ca> I wrote a linked in driver for a STREAMS based device driver(*) a few years ago. The interface was quite elegant IMHO. At the time I thought about seperating the generic STREAMS handling into it's own driver module so it could be generally reused however that didn't turn out to be all that practical. -Vance (*) http://www.motivity.ca/netaccess On Sat, Feb 03, 2007 at 01:04:27AM +0100, Robert Virding wrote: } } What makes it especially interesting for us is that this was the model } on which Erlang ports and i/o was based. Ports represent devices and } applications communicate with devices by sending/receiving messages, From autophile@REDACTED Mon Feb 5 23:33:23 2007 From: autophile@REDACTED (Robert Baruch) Date: Mon, 5 Feb 2007 17:33:23 -0500 Subject: [erlang-questions] Erlang way for process-as-library? Message-ID: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> Hi all, So I'm fooling around with writing a utility library, but to initialize the library takes a little bit of time, needing to read a few large files into memory. So my idea was to stick the functionality into a process, so that the library could be initialized once and then used by the application. I've added the gen_server behavior to the process. So now my question is, what's the Erlang way to start the process? Should I start it supervised, with a supervisor running somewhere explicitly, and require the user to know that they have to start up a supervisor? Should I start it unsupervised, checking in every call to the library whether the library is running, and if not, start it? Help, please :) Thanks, --Rob From joelr1@REDACTED Mon Feb 5 23:32:40 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 5 Feb 2007 22:32:40 +0000 Subject: [erlang-questions] Silly question: if vs pattern matching Message-ID: <4086FD6D-1139-41E1-B75B-9F5989DB1969@gmail.com> process(String, Env) -> {Tree, _} = xmerl_scan:string(String), Closures = visit(Tree), Tree1 = render(Closures, Env), Tree2 = if is_list(Tree1) -> lists:flatten(Tree1); true -> [Tree1] end, XML = xmerl:export_simple(Tree2, xmerl_xml, [#xmlAttribute{name = prolog,value = ""}]), lists:flatten(XML). I don't particularly like the "if" above. It just doesn't seem very Erlangish to me and I would rather replace it with pattern matching. The silly question is... Is there any performance benefit or drawback to using pattern matching as opposed to an "if"? Thanks, Joel -- http://wagerlabs.com/ From tobbe@REDACTED Mon Feb 5 23:43:01 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 05 Feb 2007 23:43:01 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> Message-ID: Either let the users of the library start it with a start function or you could let every function do it automatically. Example: start() -> case whereis(my_service) of Pid when pid(Pid) -> Pid _ -> spawn(my_mod, my_server, []) end. lib_fun_1(A1, A2,...) -> start(), gen_server:call(....). lib_fun_2(A1, A2,....) -> start(), gen_server:call(...). I would probably prefer to only have the start function and let the users of the library call it. Such as in e.g: crypto:start() Cheers, Tobbe Robert Baruch wrote: > Hi all, > > So I'm fooling around with writing a utility library, but to > initialize the library takes a little bit of time, needing to read a > few large files into memory. So my idea was to stick the > functionality into a process, so that the library could be > initialized once and then used by the application. > > I've added the gen_server behavior to the process. So now my question > is, what's the Erlang way to start the process? Should I start it > supervised, with a supervisor running somewhere explicitly, and > require the user to know that they have to start up a supervisor? > Should I start it unsupervised, checking in every call to the library > whether the library is running, and if not, start it? > > Help, please :) > > Thanks, > > --Rob From matthias@REDACTED Mon Feb 5 23:48:07 2007 From: matthias@REDACTED (Matthias Lang) Date: Mon, 5 Feb 2007 23:48:07 +0100 Subject: [erlang-questions] Silly question: if vs pattern matching In-Reply-To: <4086FD6D-1139-41E1-B75B-9F5989DB1969@gmail.com> References: <4086FD6D-1139-41E1-B75B-9F5989DB1969@gmail.com> Message-ID: <17863.46119.18277.65483@antilipe.corelatus.se> Joel Reymont writes: > process(String, Env) -> > {Tree, _} = xmerl_scan:string(String), > Closures = visit(Tree), > Tree1 = render(Closures, Env), > Tree2 = if > is_list(Tree1) -> > lists:flatten(Tree1); > true -> > [Tree1] > end, > XML = xmerl:export_simple(Tree2, xmerl_xml, > [#xmlAttribute{name = prolog,value = > ""}]), > lists:flatten(XML). > > I don't particularly like the "if" above. It just doesn't seem very > Erlangish to me and I would rather replace it with pattern matching. > The silly question is... How about just writing Tree2 = lists:flatten([Tree1]), I won't speculate on the performance implications, but it eliminates the if and saves five lines. Matthias From joelr1@REDACTED Mon Feb 5 23:57:40 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 5 Feb 2007 22:57:40 +0000 Subject: [erlang-questions] Silly question: if vs pattern matching In-Reply-To: <17863.46119.18277.65483@antilipe.corelatus.se> References: <4086FD6D-1139-41E1-B75B-9F5989DB1969@gmail.com> <17863.46119.18277.65483@antilipe.corelatus.se> Message-ID: On Feb 5, 2007, at 10:48 PM, Matthias Lang wrote: > How about just writing > > Tree2 = lists:flatten([Tree1]), Ugh... I would have never thought of that :-). Thanks Matthias! -- http://wagerlabs.com/ From sean.hinde@REDACTED Mon Feb 5 23:59:32 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 5 Feb 2007 22:59:32 +0000 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> Message-ID: <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> On 5 Feb 2007, at 22:33, Robert Baruch wrote: > Hi all, > > So I'm fooling around with writing a utility library, but to > initialize the library takes a little bit of time, needing to read a > few large files into memory. So my idea was to stick the > functionality into a process, so that the library could be > initialized once and then used by the application. > > I've added the gen_server behavior to the process. So now my question > is, what's the Erlang way to start the process? Should I start it > supervised, with a supervisor running somewhere explicitly, and > require the user to know that they have to start up a supervisor? > Should I start it unsupervised, checking in every call to the library > whether the library is running, and if not, start it? For something like this I would leave it up to the user of the utility library to decide how it must be started/supervised. Each project I have worked on has had a different way of managing such long lived standard servers - if you build in assumptions on how it must be started then you will cause issues somewhere down the line. I recommend you just provide the standard gen_server start and start_link API. For your own project I would either use the OTP supervisors to start the server during app startup, or make your own simple supervisor if you don't like the "escalating disaster" model of the standard one. BR, Sean From rodahummont@REDACTED Mon Feb 5 14:56:49 2007 From: rodahummont@REDACTED (Rodrigo Ahumada M.) Date: Mon, 05 Feb 2007 10:56:49 -0300 Subject: [erlang-questions] negative diference between two calls to now/0 In-Reply-To: <200702051006.l15A6K4g052958@pluto.hedeland.org> References: <200702051006.l15A6K4g052958@pluto.hedeland.org> Message-ID: <1170683809.4399.1.camel@rod-linux> El lun, 05-02-2007 a las 11:06 +0100, Per Hedeland escribi??: > Samuel Rivas wrote: [...] > > MuS1 and MuS2 are microseconds, not milliseconds. Also, megaseconds > >difference is not always zero. Each about 11.5 days it changes, so if > >you ignore then you will get negative values if, for example, you get > > > > {828, 1, 653753} - {827, 999999, 676} > > > >(example from supervisor.erl) > > Good point - and of course the best answer is to use timer:now_diff/2 > instead of rolling your own... thanks a lot now, i proceed to punish myself for not reading. __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From autophile@REDACTED Tue Feb 6 02:17:29 2007 From: autophile@REDACTED (Robert Baruch) Date: Mon, 5 Feb 2007 20:17:29 -0500 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> Message-ID: <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> Thanks for all the advice -- I've decided to provide a start and start_link function, and let the user decide how to start the library up, documenting very carefully that the user *must* start the library before calling its functions. Now, the next question I have is: is there an Erlang way to forbid "ordinary users" from calling the server's callback functions directly (e.g. init, terminate, and so on), while allowing gen_server access to them? The problem is that my exports for my library look like this: % Public functions -export([start_link/0, start/0, getBlockRange/1, getCategoryRange/1]). % gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, terminate/2]). -export([handle_info/2, code_change/3]). Do I really have to rely on a user's goodwill not to call the callbacks directly for whatever nefarious reason? :) Thanks, --Rob From rsaccon@REDACTED Tue Feb 6 02:19:46 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Mon, 5 Feb 2007 22:19:46 -0300 Subject: [erlang-questions] Erlang/OTP R11B-3 has been released In-Reply-To: References: Message-ID: On Ubuntu edgy it does only partially work. E.g.: 1> crypto:start(). ok 2> exec: 1: crypto_drv: not found On my Ubuntu Edgy box I am using right now R11B-0, which works fine. Ubuntuy Edgy uses GCC 4.1 by default. Might that cause the problems ? Anybody knows a work around ? -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Feb 6 08:47:44 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 06 Feb 2007 08:47:44 +0100 Subject: [erlang-questions] Holy war! Adding to_lower, to_upper to string package In-Reply-To: References: <45C409C1.1040208@sipphone.com> Message-ID: <45C832A0.7080000@ericsson.com> On 2007-02-05 17:06, Robert Baruch wrote: ...deleted > Has anyone gotten up the courage to suggest that to_lower and > to_upper be moved from the http_util module to the string module? the first step should be to add them to string. removing them from http_util is probably impossible :-) 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." From bengt.kleberg@REDACTED Tue Feb 6 08:55:19 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 06 Feb 2007 08:55:19 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> Message-ID: <45C83467.4020202@ericsson.com> On 2007-02-06 02:17, Robert Baruch wrote: ...deleted > Now, the next question I have is: is there an Erlang way to forbid > "ordinary users" from calling the server's callback functions > directly (e.g. init, terminate, and so on), while allowing gen_server > access to them? short answer: no. long answer: how about including something in the server state that the user can not forge? presumably this is expensive since it would need to change for each call (btw, i am considering the user as a ''man in the middle'' here). 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." From adam@REDACTED Tue Feb 6 09:01:30 2007 From: adam@REDACTED (Adam Lindberg) Date: Tue, 6 Feb 2007 09:01:30 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> Message-ID: <6344005f0702060001l7cd70806pabe2213cf7f99197@mail.gmail.com> If you hide them in your eDoc, for example, the users wont know about them. Unless they really checked they were there, and in that case they want to know about them. Cheers Adam On 2/6/07, Robert Baruch wrote: > > Thanks for all the advice -- I've decided to provide a start and > start_link function, and let the user decide how to start the library > up, documenting very carefully that the user *must* start the library > before calling its functions. > > Now, the next question I have is: is there an Erlang way to forbid > "ordinary users" from calling the server's callback functions > directly (e.g. init, terminate, and so on), while allowing gen_server > access to them? The problem is that my exports for my library look > like this: > > % Public functions > -export([start_link/0, start/0, getBlockRange/1, getCategoryRange/1]). > > % gen_server callbacks > -export([init/1, handle_call/3, handle_cast/2, terminate/2]). > -export([handle_info/2, code_change/3]). > > Do I really have to rely on a user's goodwill not to call the > callbacks directly for whatever nefarious reason? :) > > Thanks, > > --Rob > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Adam Lindberg Mobile: +46734228920 From adam@REDACTED Tue Feb 6 09:04:14 2007 From: adam@REDACTED (Adam Lindberg) Date: Tue, 6 Feb 2007 09:04:14 +0100 Subject: [erlang-questions] Holy war! Adding to_lower, to_upper to string package In-Reply-To: <45C832A0.7080000@ericsson.com> References: <45C409C1.1040208@sipphone.com> <45C832A0.7080000@ericsson.com> Message-ID: <6344005f0702060004y69f1bfb6i840e469b5c28d89c@mail.gmail.com> On 2/6/07, Bengt Kleberg wrote: > On 2007-02-05 17:06, Robert Baruch wrote: > ...deleted > > Has anyone gotten up the courage to suggest that to_lower and > > to_upper be moved from the http_util module to the string module? > > the first step should be to add them to string. > removing them from http_util is probably impossible :-) Deprecate them in http_util, make them call the functions in string instead, and move everything there. Cheers Adam -- Adam Lindberg Mobile: +46734228920 From ulf@REDACTED Tue Feb 6 09:10:55 2007 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 06 Feb 2007 09:10:55 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <45C83467.4020202@ericsson.com> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> <45C83467.4020202@ericsson.com> Message-ID: Den 2007-02-06 08:55:19 skrev Bengt Kleberg : > On 2007-02-06 02:17, Robert Baruch wrote: > ...deleted >> Now, the next question I have is: is there an Erlang way to forbid >> "ordinary users" from calling the server's callback functions >> directly (e.g. init, terminate, and so on), while allowing gen_server >> access to them? > > short answer: no. > > long answer: how about including something in the server state that the > user can not forge? presumably this is expensive since it would need to > change for each call (btw, i am considering the user as a ''man in the > middle'' here). I've experimented with that sort of thing, at least trying to guarantee that the caller is using the official exported functions: %%% (simplified) call(Server, Req) -> Ref = make_ref(), Server ! {self(), Ref, Req}, await_reply(Ref). %% this function mustn't be exported await_reply(Ref) -> receive {Ref, Reply} -> Reply end. server_loop(St) -> receive {From, Ref, Req} -> case is_valid_call(From) of true -> {Reply, St1} = handle_call(Req, St), From ! {Ref, Reply}, server_loop(St1); false -> %% ignore server_loop(St) end. is_valid_call(Pid) when is_pid(Pid) -> case process_info(Pid, current_function) of {current_function, {?MODULE,await_reply,1}} -> true; _ -> false end; is_valid_call(_) -> false. ... at least it's pretty lightweight. (: BR, Ulf W -- Ulf Wiger From vladdu55@REDACTED Tue Feb 6 09:15:34 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 6 Feb 2007 09:15:34 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> Message-ID: <95be1d3b0702060015g3783e912sb6f6738037776dd9@mail.gmail.com> Hi, On 2/6/07, Robert Baruch wrote: > Now, the next question I have is: is there an Erlang way to forbid > "ordinary users" from calling the server's callback functions > directly (e.g. init, terminate, and so on), while allowing gen_server > access to them? No, you can't. One way to protect against inadvertent use is to put the process' API (and only that) in a separate module from the one implementing the functionality. best regards, Vlad From lenartlad@REDACTED Tue Feb 6 09:24:41 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 06 Feb 2007 09:24:41 +0100 Subject: [erlang-questions] xmerl SAX interface In-Reply-To: <407d9ef80702051055l148e21bew7dbe544977a2b24b@mail.gmail.com> References: <45C726B4.4090209@volny.cz> <407d9ef80702051055l148e21bew7dbe544977a2b24b@mail.gmail.com> Message-ID: <45C83B49.2050706@volny.cz> Willem de Jong wrote: > Hello, > > I tried to find this out as well, but I didn't find the answer either. > I ended up implementing my own SAX parser. It is part of Erlsom (which > you can find on Sourceforge). > > Your example could be parsed as follows. > > S = " > 2 > 3 > ". > > C = fun(Event, State) -> > io:format("~p\n", [Event]), > State > end. > > erlsom:sax(S, [], C). > > The result: > startDocument > {startPrefixMapping,[],"urn"} > {startElement,"urn","e1",[],[]} > {ignorableWhitespace,"\n\n "} > {startElement,"urn","e2",[],[{attribute,"a2","a2",[],"b"}]} > {characters,"2"} > {endElement,"urn","e2",[]} > {ignorableWhitespace,"\n\n "} > {startElement,"urn","e3",[],[]} > {characters,"3"} > {endElement,"urn","e3",[]} > {ignorableWhitespace,"\n\n "} > {endElement,"urn","e1",[]} > {endPrefixMapping,[]} > endDocument > [] > > Regards, > Willem Wow! This is exactly what I would expect from a SAX driver! I will definitely give it a try. Thank you very much, Ladislav Lenart From steve@REDACTED Tue Feb 6 10:19:52 2007 From: steve@REDACTED (Stefan Strigler) Date: Tue, 06 Feb 2007 10:19:52 +0100 Subject: [erlang-questions] Erlang/OTP R11B-3 has been released In-Reply-To: References: Message-ID: <1170753592.28048.14.camel@sz2> I guess this link may be helpful here: https://launchpad.net/bugs/68163 Am Montag, den 05.02.2007, 22:19 -0300 schrieb Roberto Saccon: > On Ubuntu edgy it does only partially work. > > E.g.: > 1> crypto:start(). > ok > 2> exec: 1: crypto_drv: not found > > > On my Ubuntu Edgy box I am using right now R11B-0, which works fine. > Ubuntuy Edgy uses GCC 4.1 by default. Might that cause the problems ? > Anybody knows a work around ? > > -- > Roberto Saccon > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulf.wiger@REDACTED Tue Feb 6 11:29:40 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 6 Feb 2007 11:29:40 +0100 Subject: [erlang-questions] xmerl SAX interface In-Reply-To: <45C726B4.4090209@volny.cz> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155E8FA5B@esealmw115.eemea.ericsson.se> I was hoping that someone else would answer this, but here goes - a very simple example of the underlying event mechanism in xmerl_scan: 1> S = " 2 3 ". " 2 3 " 2> xmerl_scan:string(S, [{event_fun, fun(E,S) -> io:format("E = ~p~n", [E]), S end}]). E = {xmerl_event,started,1,1,undefined,document} E = {xmerl_event,ended, 1, 17, undefined, {xmlAttribute,xmlns,[],[],[],[],1,[],"urn",false}} E = {xmerl_event,started, 1, 2, undefined, {xmlElement,...}], ... >From xmerl_scan.erl: %%% Events: %%% %%% #xmerl_event{event : started | ended, %%% line : integer(), %%% col : integer(), %%% data} %%% %%% Data Events %%% document started, ended %%% #xmlElement started, ended %%% #xmlAttribute ended %%% #xmlPI ended %%% #xmlComment ended %%% #xmlText ended I can't tell you what xmerl_eventp:stream_sax/3 does. I wrote xmerl_eventp:stream/2 a hundred years ago, and it seems to be largely unchanged since then. It was mainly meant to demonstrate use of the continuation function for stream parsing. At that time, I didn't want to copy the SAX interface, but focus more on the simple representation (S expressions) and finding intuitive mappings between XML and Erlang. So I made the event function as simple as I could. The rather bulky records produced by xmerl came as a result of attacking XPATH and XSLT. I eventually rejected XSLT and decided that it would be better to do it erlang-style instead. I think Mikael Karlsson did a great job of illustrating that approach in http://maven-plugins.sourceforge.net/maven-sdocbook-plugin/docbook/sdocbook.html (I'm aware of the benefits of supporting an industry standard rather than coming up with your own unique version, but adding XSLT to xmerl went way beyond the level of effort I was prepared to put in, as I had no need for it myself.) I viewed it as a failure that I couldn't deal with XPATH, namespaces, etc without resorting to huge records. I very much favoured the simple format myself, but failed to come up with a smooth transition into the full XML functionality. But the whole xmerl thing was just an experiment then, aimed at giving me an intuition about XML. I believe it served that purpose well. Later, others (notably Johan Blom, Richard Carlsson and Micka?l Remond) took it further. My own experience of actually using xmerl (or indeed XML), is - unfortunately - quite limited. (: BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Ladislav Lenart > Sent: den 5 februari 2007 13:45 > To: Erlang-Questions (E-mail) > Subject: [erlang-questions] xmerl SAX interface > > Hello, > > I am trying to implement a XML SAX driver using xmerl and I > got lost on the way a little. xmerl_eventp seems that it is > what I am looking for (SAX driver), but when I try to parse > the following > > > 2 > 3 > > > I get only the "closing" events which is not what I would > expect (from a SAX driver). > > I have read the examples in xmerl 0.20 and used Google > extensively, but with no luck so far. > > Can anyone please show me how to set up and SAX-parse a > simple XML document like the one above (namespaces are not > necessary but would be great, too). > > Links to xmerl tutorials/faqs/... are also welcome. > > Thanks in advance, > > Ladislav Lenart > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From nm@REDACTED Tue Feb 6 11:44:08 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 06 Feb 2007 14:44:08 +0400 Subject: [erlang-questions] Typo in documentation Message-ID: <45C85BF8.30706@web.am> Hi all! On this page: http://www.erlang.org/doc/doc-5.5.2/lib/ssl-3.0.12/doc/html/ssl_app.html illegal command line option is mentioned - erl ... -ssl protcol_version '[sslv2,sslv3]' .... ^^^^ o is missing. it should be erl ... -ssl protocol_version '[sslv2,sslv3]' .... Am I right? Thanks in advance, Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From nick@REDACTED Tue Feb 6 12:40:13 2007 From: nick@REDACTED (Niclas Eklund) Date: Tue, 6 Feb 2007 12:40:13 +0100 (MET) Subject: [erlang-questions] Typo in documentation In-Reply-To: <45C85BF8.30706@web.am> Message-ID: Hello! Yes, an 'o' is missing. On the same page you find the correct option: protocol_version = [sslv2|sslv3|tlsv1] . Name of protocols to use. If this option is not set, all protocols are assumed, i.e. the default value is [sslv2, sslv3, tlsv1]. It will be fixed in the next version. /Nick On Tue, 6 Feb 2007, Gaspar Chilingarov wrote: > Hi all! > > On this page: > http://www.erlang.org/doc/doc-5.5.2/lib/ssl-3.0.12/doc/html/ssl_app.html > > illegal command line option is mentioned - > erl ... -ssl protcol_version '[sslv2,sslv3]' .... > ^^^^ o is missing. > > it should be > erl ... -ssl protocol_version '[sslv2,sslv3]' .... > > Am I right? > > Thanks in advance, Gaspar > > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37493 419763 (mob) > i 63174784 > e nm@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From sebastian@REDACTED Tue Feb 6 12:44:42 2007 From: sebastian@REDACTED (Sebastian Bello) Date: Tue, 06 Feb 2007 09:44:42 -0200 Subject: [erlang-questions] SNMP Manager Message-ID: <45C86A2A.10309@inswitch.us> Hi all, I'm trying to write a simple SNMP manager using the Erlang toolkit. From the User's Guide: snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"public"},{mibs,["EX1-MIB","STANDARD-MIB"]}]). 1- I can't find module /snmp_test_mgr/ 2- module /snmp_mgr_tests/ references module /snmp_mgr/, which I can't find neither. 3- does anybody have a simple working manager example? Thanks, Sebastian- -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Tue Feb 6 15:10:59 2007 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 06 Feb 2007 09:10:59 -0500 Subject: [erlang-questions] Holy war! Adding to_lower, to_upper to string package In-Reply-To: <45C832A0.7080000@ericsson.com> References: <45C409C1.1040208@sipphone.com> <45C832A0.7080000@ericsson.com> Message-ID: <45C88C73.5040806@hq.idt.net> On a similar note, I would also vote for coping/moving mnesia_lib:is_string/1 to the string module. Serge P.S. Or yes, and of course it wouldn't hurt having string:join/2 as mentioned in the list several times... Bengt Kleberg wrote: > On 2007-02-05 17:06, Robert Baruch wrote: > ...deleted >> Has anyone gotten up the courage to suggest that to_lower and >> to_upper be moved from the http_util module to the string module? > > the first step should be to add them to string. > removing them from http_util is probably impossible :-) > > > bengt From qrilka@REDACTED Tue Feb 6 20:32:39 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Tue, 6 Feb 2007 22:32:39 +0300 Subject: [erlang-questions] Parametrized modules status Message-ID: <337538cb0702061132o2bdb9a8je5e682539afe05b4@mail.gmail.com> I've read recently a paper from Richard Carlsson ( http://www.erlang.se/workshop/2003/paper/p29-carlsson.pdf ) about the parametrized modules in Erlang searched in google and found that it was introduced in OTP R10B but I find nothing about it in my Erlang/OTP (BTW what is the best way to find the version? I remember that it is R11B-1 or R11B-2 but which actually?) What is the current status of this feature? Does anyone use it? Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Tue Feb 6 21:37:50 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 6 Feb 2007 21:37:50 +0100 Subject: [erlang-questions] Parametrized modules status In-Reply-To: <337538cb0702061132o2bdb9a8je5e682539afe05b4@mail.gmail.com> References: <337538cb0702061132o2bdb9a8je5e682539afe05b4@mail.gmail.com> Message-ID: Hi, Parameterized modules was as said introduced in OTP R10B as has been working in every release since then. It is not documented (you have to read Richards paper) because it is not officially supported by us. Not supported meaning that we are not testing it properly and there is no guarantee that all tools like debugger, cover etc. can handle that feature. Not supported also meaning that we don't promise to keep the function in a compatible way. We don't use it in any released code. It is a nice feature, and as far as I know it works very well, but I think it would be a good thing to bring it up as an EEP (Erlang Enhancement Proposal) before making it official. Maybe there are some good feedback we can get. On 2/6/07, Kirill Zaborski wrote: > I've read recently a paper from Richard Carlsson ( > http://www.erlang.se/workshop/2003/paper/p29-carlsson.pdf ) > about the parametrized modules in Erlang searched in google and found that > it was introduced in OTP R10B but I find nothing about it in my Erlang/OTP > (BTW what is the best way to find the version? I remember that it is R11B-1 > or R11B-2 but which actually?) > What is the current status of this feature? Does anyone use it? > > Best regards, > Kirill. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Regards Kenneth , OTP team at Ericsson From kenneth.lundin@REDACTED Tue Feb 6 21:50:07 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 6 Feb 2007 21:50:07 +0100 Subject: [erlang-questions] SNMP Manager In-Reply-To: <45C86A2A.10309@inswitch.us> References: <45C86A2A.10309@inswitch.us> Message-ID: Hi Sebastian, I think you are reading some old documentation. What version of OTP and of the SNMP application are you using? At least starting from OTP R10B there has been an snmpm (m for manager) module in the SNMP application. I am looking at the documentation from OTP R11B and I don't recognize your example. There are however other examples on how to implement an SNMP manager. /Regards Kenneth for the OTP team at Ericsson On 2/6/07, Sebastian Bello wrote: > Hi all, > > I'm trying to write a simple SNMP manager using the Erlang toolkit. >From > the User's Guide: > > snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"public"},{mibs,["EX1-MIB","STANDARD-MIB"]}]). > > 1- I can't find module snmp_test_mgr > 2- module snmp_mgr_tests references module snmp_mgr, which I can't find > neither. > 3- does anybody have a simple working manager example? > > Thanks, > Sebastian- > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From anders.nygren@REDACTED Tue Feb 6 22:39:37 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 6 Feb 2007 15:39:37 -0600 Subject: [erlang-questions] SNMP Manager In-Reply-To: References: <45C86A2A.10309@inswitch.us> Message-ID: On 2/6/07, Kenneth Lundin wrote: > Hi Sebastian, > > I think you are reading some old documentation. > What version of OTP and of the SNMP application are you using? > > At least starting from OTP R10B there has been an snmpm (m for manager) > module in the SNMP application. > I am looking at the documentation from OTP R11B and I don't recognize > your example. > There are however other examples on how to implement an SNMP manager. > > /Regards Kenneth for the OTP team at Ericsson > > On 2/6/07, Sebastian Bello wrote: > > Hi all, > > > > I'm trying to write a simple SNMP manager using the Erlang toolkit. >From > > the User's Guide: > > > > snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"public"},{mibs,["EX1-MIB","STANDARD-MIB"]}]). > > > > 1- I can't find module snmp_test_mgr > > 2- module snmp_mgr_tests references module snmp_mgr, which I can't find > > neither. > > 3- does anybody have a simple working manager example? > > > > Thanks, > > Sebastian- > > > > > > > > _______________________________________________ > > 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 > No, it is still in the new documentation find /usr/local/lib/erlang/ -name *.html -exec grep -H snmp_test_mgr {} \; /usr/local/lib/erlang/lib/snmp-4.8.4/doc/html/snmp_impl_example_agent.html:1> snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"all-rights"}, /Anders From robert.virding@REDACTED Tue Feb 6 22:53:00 2007 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 06 Feb 2007 22:53:00 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> Message-ID: <45C8F8BC.6000102@telia.com> Torbjorn Tornkvist wrote: > Either let the users of the library start it with > a start function or you could let every function > do it automatically. Example: > > start() -> > case whereis(my_service) of > Pid when pid(Pid) -> Pid > _ -> spawn(my_mod, my_server, []) > end. That start function is not safe, especially on an SMP system. You could get two rocesses running start simultaneously both not finding the server and both trying to start it. Robert From ok@REDACTED Tue Feb 6 23:59:17 2007 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 7 Feb 2007 11:59:17 +1300 (NZDT) Subject: [erlang-questions] leading underscores on variables versus _ Message-ID: <200702062259.l16MxHcb276277@atlas.otago.ac.nz> Matthias Lang wrote: Changing _x to behave as many (most?) initially expect would break backwards compatibility, but only for misleading code such as the above... Wrong. Cast your mind back to 1986 and consider someone writing Quintus Prolog in Japanese. All Japanese characters were taken to be LOWER case, so that they could be used for atoms and predicate names. Japanese programmers would surely like to write Erlang function names using their own language and script, no? But that means that a variable name cannot begin with a Japanese character. That's fine, Japanese Prolog programmers thought of the convention as "to name a variable, put an underscore in front of a word or phrase". Japanese programmers would surely like to name Erlang variables using their own language and script, not? So there HAS to be a way of writing a variable name that does not involve starting it with a Latin capital letter, and that way is to use an underscore. It is ESSENTIAL that leading underscores NOT cause any special treatment; in particular it is essential that they should not cause identifiers to be treated as anonymous variables. I note that Prolog, Mercury, Clean, and Haskell all use "_" for anonymous variables, and none of them has rule about other variable names starting with "_" being unusual, and now you know one reason why they don't. From tony@REDACTED Wed Feb 7 08:38:27 2007 From: tony@REDACTED (Tony Rogvall) Date: Wed, 7 Feb 2007 08:38:27 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <200702062259.l16MxHcb276277@atlas.otago.ac.nz> References: <200702062259.l16MxHcb276277@atlas.otago.ac.nz> Message-ID: <41130066-4866-4B12-B2A9-C43C802C23F9@rogvall.com> Here is a Swedish example when we enable full language support in Erlang. Note that we must declare the language before the module declaration. -language(swedish). -enhet(?r_detta_l?sbart_f?r_andra_?n_svenkar). -kompilator(exportera_allt). varf?r_kan_vi_inte_?ven_ta_med_nyckelord(V?RDET) -> om V?RDET > 10 -> fall V?RDET ?r 11 -> okej; 12 -> {fel, av_mig} _Annat_V?rde -> {fel,igen} slut; sant -> {fel,en_g?ng_till} slut. /Tony On 6 feb 2007, at 23.59, Richard A. O'Keefe wrote: > Matthias Lang wrote: > Changing _x to behave as many (most?) initially expect would break > backwards compatibility, but only for misleading code such as the > above... > > Wrong. > > Cast your mind back to 1986 and consider someone writing > Quintus Prolog in Japanese. All Japanese characters were > taken to be LOWER case, so that they could be used for > atoms and predicate names. > > Japanese programmers would surely like to write Erlang > function names using their own language and script, no? > > But that means that a variable name cannot begin with a > Japanese character. That's fine, Japanese Prolog programmers > thought of the convention as "to name a variable, put an > underscore in front of a word or phrase". > > Japanese programmers would surely like to name Erlang > variables using their own language and script, not? > > So there HAS to be a way of writing a variable name that does not > involve starting it with a Latin capital letter, and that way is > to use an underscore. It is ESSENTIAL that leading underscores > NOT cause any special treatment; in particular it is essential that > they should not cause identifiers to be treated as anonymous > variables. > > I note that Prolog, Mercury, Clean, and Haskell all use "_" for > anonymous variables, and none of them has rule about other variable > names starting with "_" being unusual, and now you know one reason > why they don't. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From micke@REDACTED Wed Feb 7 09:16:13 2007 From: micke@REDACTED (Michael Fogeborg) Date: Wed, 07 Feb 2007 09:16:13 +0100 Subject: [erlang-questions] Erlang, Erlang/OTP and DO-178B Level A Certification Message-ID: Is there a Certification of Erlang as required by "DO-178B Level A" ? http://www.ghs.com/products/safety_critical/do-178b.html -- From gunilla@REDACTED Wed Feb 7 09:41:20 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Wed, 07 Feb 2007 09:41:20 +0100 Subject: [erlang-questions] Disabling error reporting In-Reply-To: <5009.217.128.75.198.1169456871.squirrel@www.geekisp.com> References: <61D8DD55-F179-40E4-A35F-6E3681F65DE4@gmail.com> <32271.217.128.75.198.1169222409.squirrel@www.geekisp.com> <7C2D03F5-996D-4F21-831F-367FC7BDC607@gmail.com> <5009.217.128.75.198.1169456871.squirrel@www.geekisp.com> Message-ID: <45C990B0.9020502@erix.ericsson.se> Actually, this seems to be a bug that has been in error_logger for quite some time. We'll fix it in R11B-4. As an alternative to using the {file,File} argument, disabling error logging from the Erlang shell prompt also works: 1> error_logger:tty(false). ok Regards, Gunilla, Erlang/OTP team Dominic Williams wrote: >>> erl -kernel error_logger false >> Now I get a bunch of these: >> >> {error_logger,{{2007,1,19},{16,3,44}},"** Generic server ~p >> terminating \n** Last message in was ~p~n** When Server state == >> ~p~n** Reason for termination == ~n** ~p~n",[<0.172.0>, >> {exit,bummer},none,bummer]} >> {error_logger,{{2007,1,19},{16,3,44}},crash_report,[[{pid,<0.172.0>}, >> {registered_name,[]},{error_info,bummer},{initial_call,{gen,init_it, >> [gen_server,<0.168.0>,<0.168.0>,dummy_task,[10,bummer],[]]}}, >> {ancestors,[<0.168.0>,<0.37.0>]},{messages,[]},{links,[<0.168.0>]}, >> {dictionary,[]},{trap_exit,true},{status,running},{heap_size,377}, >> {stack_size,21},{reductions,114}],[]]} > > Well, this appears to be a bug that appeared somewhere around R10B. > It used to work. The {file, "log"} still works fine: > > erl -kernel error_logger "{file,\"log\"}" > > Regards, > > Dominic Williams > http://www.dominicwilliams.net From matthias@REDACTED Wed Feb 7 09:54:03 2007 From: matthias@REDACTED (Matthias Lang) Date: Wed, 7 Feb 2007 09:54:03 +0100 Subject: [erlang-questions] leading underscores on variables versus _ In-Reply-To: <200702062259.l16MxHcb276277@atlas.otago.ac.nz> References: <200702062259.l16MxHcb276277@atlas.otago.ac.nz> Message-ID: <17865.37803.832198.97120@antilipe.corelatus.se> Richard A. O'Keefe writes: > It is ESSENTIAL that leading underscores NOT cause any special > treatment; in particular it is essential that they should not cause > identifiers to be treated as anonymous variables. Leading underscores get special treatment in the _current_ Erlang implementation. The Erlang spec explicitly recommends that behaviour (last paragraph of "3.16 Variables"). Losing the unused variable warning probably isn't that much of an issue for most people. Maybe that's why there haven't been any complaints on the mailing list about it. Or perhaps you're overestimating the popularity and importance of Japanese identifiers with leading underscores. In any case, as already posted, I'm already convinced that making _x the same as _ causes (far) more trouble than it's worth. --- While looking at 3.16, I think I found an omission. The first sentence is: A variable is a nonempty sequence of Erlang letters, Erlang digits and the character '@', where the first character must be an uppercase Erlang letter. The grammar which follows in that subsection is complete, but the above sentence leaves out _ altogether. Matthias From hakan@REDACTED Wed Feb 7 10:28:09 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 7 Feb 2007 10:28:09 +0100 (CET) Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <45C8F8BC.6000102@telia.com> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> Message-ID: On Tue, 6 Feb 2007, Robert Virding wrote: RV> Torbjorn Tornkvist wrote: RV> > Either let the users of the library start it with RV> > a start function or you could let every function RV> > do it automatically. Example: RV> > RV> > start() -> RV> > case whereis(my_service) of RV> > Pid when pid(Pid) -> Pid RV> > _ -> spawn(my_mod, my_server, []) RV> > end. RV> RV> That start function is not safe, especially on an SMP system. You could RV> get two rocesses running start simultaneously both not finding the RV> server and both trying to start it. The start function is safe. Only one of the processes will succeed in registering the name my_service. /H?kan From gordonguthrie@REDACTED Wed Feb 7 10:44:57 2007 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Wed, 7 Feb 2007 09:44:57 -0000 (GMT) Subject: [erlang-questions] Erlang/OTP R11B-3 has been released Message-ID: <52790.193.113.57.167.1170841497.squirrel@backawinner.gg> Robert The problem with crypto under Erlang on Ubuntu is is probably the same as this yaws one - the use of ld as a linker when the code is compiled with gcc 4 http://sourceforge.net/mailarchive/forum.php?thread_id=31498404&forum_id=12456 It is probably also related to the ejabber problems which the previous post refers to and so I have copied this to the ubuntu maintainer: https://launchpad.net/ubuntu/+source/erlang/+bug/68163 Gordon From bmk@REDACTED Wed Feb 7 11:04:44 2007 From: bmk@REDACTED (Micael Karlberg) Date: Wed, 07 Feb 2007 11:04:44 +0100 Subject: [erlang-questions] SNMP Manager In-Reply-To: References: <45C86A2A.10309@inswitch.us> Message-ID: <45C9A43C.8030809@erix.ericsson.se> Hi, If you are looking for an manager implementation example, then you should look in the "Manager Implementation Example" chapter and not in "Agent Implementation Example" chapter! Regards, /BMK Anders Nygren wrote: > On 2/6/07, Kenneth Lundin wrote: >> Hi Sebastian, >> >> I think you are reading some old documentation. >> What version of OTP and of the SNMP application are you using? >> >> At least starting from OTP R10B there has been an snmpm (m for manager) >> module in the SNMP application. >> I am looking at the documentation from OTP R11B and I don't recognize >> your example. >> There are however other examples on how to implement an SNMP manager. >> >> /Regards Kenneth for the OTP team at Ericsson >> >> On 2/6/07, Sebastian Bello wrote: >>> Hi all, >>> >>> I'm trying to write a simple SNMP manager using the Erlang toolkit. >From >>> the User's Guide: >>> >>> snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"public"},{mibs,["EX1-MIB","STANDARD-MIB"]}]). >>> >>> 1- I can't find module snmp_test_mgr >>> 2- module snmp_mgr_tests references module snmp_mgr, which I can't find >>> neither. >>> 3- does anybody have a simple working manager example? >>> >>> Thanks, >>> Sebastian- >>> >>> >>> >>> _______________________________________________ >>> 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 >> > > No, it is still in the new documentation > > find /usr/local/lib/erlang/ -name *.html -exec grep -H snmp_test_mgr {} \; > /usr/local/lib/erlang/lib/snmp-4.8.4/doc/html/snmp_impl_example_agent.html:1> > snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"all-rights"}, > > /Anders > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bjorn@REDACTED Wed Feb 7 11:05:20 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Feb 2007 11:05:20 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> Message-ID: Hakan Mattsson writes: > > The start function is safe. Only one of the processes > will succeed in registering the name my_service. But the pid that the function returns may be wrong. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From mats.cronqvist@REDACTED Wed Feb 7 10:48:35 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 07 Feb 2007 10:48:35 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> Message-ID: <45C9A073.70703@ericsson.com> Hakan Mattsson wrote: > On Tue, 6 Feb 2007, Robert Virding wrote: > > RV> Torbjorn Tornkvist wrote: > RV> > Either let the users of the library start it with > RV> > a start function or you could let every function > RV> > do it automatically. Example: > RV> > > RV> > start() -> > RV> > case whereis(my_service) of > RV> > Pid when pid(Pid) -> Pid > RV> > _ -> spawn(my_mod, my_server, []) > RV> > end. > RV> > RV> That start function is not safe, especially on an SMP system. You could > RV> get two rocesses running start simultaneously both not finding the > RV> server and both trying to start it. > > The start function is safe. Only one of the processes > will succeed in registering the name my_service. it's not safe if start/0 is supposed to return the pid of the server. this is also not safe; my_service:start(), my_service ! hello. mats From hakan@REDACTED Wed Feb 7 12:04:45 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 7 Feb 2007 12:04:45 +0100 (CET) Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <45C9A073.70703@ericsson.com> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> Message-ID: On Wed, 7 Feb 2007, Mats Cronqvist wrote: MC> Hakan Mattsson wrote: MC> > On Tue, 6 Feb 2007, Robert Virding wrote: MC> > MC> > RV> Torbjorn Tornkvist wrote: MC> > RV> > Either let the users of the library start it with MC> > RV> > a start function or you could let every function MC> > RV> > do it automatically. Example: MC> > RV> > MC> > RV> > start() -> MC> > RV> > case whereis(my_service) of MC> > RV> > Pid when pid(Pid) -> Pid MC> > RV> > _ -> spawn(my_mod, my_server, []) MC> > RV> > end. MC> > RV> MC> > RV> That start function is not safe, especially on an SMP system. You could MC> > RV> get two rocesses running start simultaneously both not finding the MC> > RV> server and both trying to start it. MC> > MC> > The start function is safe. Only one of the processes MC> > will succeed in registering the name my_service. MC> MC> it's not safe if start/0 is supposed to return the pid of the server. Ok it is not safe in that particular regard if the pid really is intended to be used, but as Tobbe did not use in his example I assumed that that it was not intended to be used. If it is important that the correct pid is returned you will need to change the example to: start() -> case whereis(my_service) of Pid when pid(Pid) -> Pid _ -> spawn(my_mod, my_server, []), whereis(my_service) end. Then of course you may extend the example to also handle the case when the process crashes in its startup. But neither that nor the problem that you pointed out has nothing to do with the problem that Robert mentioned. MC> this is also not safe; MC> MC> my_service:start(), MC> my_service ! hello. In which regard is it not safe? /H?kan From mats.cronqvist@REDACTED Wed Feb 7 12:35:34 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 07 Feb 2007 12:35:34 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> Message-ID: <45C9B986.9010200@ericsson.com> Hakan Mattsson wrote: > On Wed, 7 Feb 2007, Mats Cronqvist wrote: > > MC> Hakan Mattsson wrote: > MC> > On Tue, 6 Feb 2007, Robert Virding wrote: > MC> > > MC> > RV> Torbjorn Tornkvist wrote: > MC> > RV> > Either let the users of the library start it with > MC> > RV> > a start function or you could let every function > MC> > RV> > do it automatically. Example: > MC> > RV> > > MC> > RV> > start() -> > MC> > RV> > case whereis(my_service) of > MC> > RV> > Pid when pid(Pid) -> Pid > MC> > RV> > _ -> spawn(my_mod, my_server, []) > MC> > RV> > end. > MC> > RV> > MC> > RV> That start function is not safe, especially on an SMP system. You could > MC> > RV> get two rocesses running start simultaneously both not finding the > MC> > RV> server and both trying to start it. > MC> > > MC> > The start function is safe. Only one of the processes > MC> > will succeed in registering the name my_service. > MC> > MC> it's not safe if start/0 is supposed to return the pid of the server. > > Ok it is not safe in that particular regard if the pid > really is intended to be used, but as Tobbe did not use > in his example I assumed that that it was not intended > to be used. i think it's clear from tobbes code that he intended it to return the correct pid. and i think it should. > If it is important that the correct pid > is returned you will need to change the example to: > start() -> > case whereis(my_service) of > Pid when pid(Pid) -> > Pid > _ -> > spawn(my_mod, my_server, []), > whereis(my_service) > end. the second whereis/1 will (likely) run before the register/2 call (presumably present) in my_mod:my_server/0, and so will return undefined. > Then of course you may extend the example to also > handle the case when the process crashes in its > startup. But neither that nor the problem that you > pointed out has nothing to do with the problem that > Robert mentioned. true enough. it's the server instances problem to figure out if there is already another instance running. > MC> this is also not safe; > MC> > MC> my_service:start(), > MC> my_service ! hello. > > In which regard is it not safe? the same reason as above; the send/2 ("!") will (likely) run before the register/2 (since the spawned process will likely not run immediately), and so will exit with badarg. mats From sebastian@REDACTED Wed Feb 7 12:35:13 2007 From: sebastian@REDACTED (Sebastian Bello) Date: Wed, 07 Feb 2007 09:35:13 -0200 Subject: [erlang-questions] SNMP Manager In-Reply-To: <45C9A43C.8030809@erix.ericsson.se> References: <45C86A2A.10309@inswitch.us> <45C9A43C.8030809@erix.ericsson.se> Message-ID: <45C9B971.6020401@inswitch.us> Thanks all for the answers, - I was using R10B - R10B had no section "Manager Implementation Example" - I'll take a look at R11B and the other examples Sebastian- Micael Karlberg escribi?: > Hi, > > If you are looking for an manager implementation example, then > you should look in the "Manager Implementation Example" chapter > and not in "Agent Implementation Example" chapter! > > Regards, > /BMK > > Anders Nygren wrote: > >> On 2/6/07, Kenneth Lundin wrote: >> >>> Hi Sebastian, >>> >>> I think you are reading some old documentation. >>> What version of OTP and of the SNMP application are you using? >>> >>> At least starting from OTP R10B there has been an snmpm (m for manager) >>> module in the SNMP application. >>> I am looking at the documentation from OTP R11B and I don't recognize >>> your example. >>> There are however other examples on how to implement an SNMP manager. >>> >>> /Regards Kenneth for the OTP team at Ericsson >>> >>> On 2/6/07, Sebastian Bello wrote: >>> >>>> Hi all, >>>> >>>> I'm trying to write a simple SNMP manager using the Erlang toolkit. >From >>>> the User's Guide: >>>> >>>> snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"public"},{mibs,["EX1-MIB","STANDARD-MIB"]}]). >>>> >>>> 1- I can't find module snmp_test_mgr >>>> 2- module snmp_mgr_tests references module snmp_mgr, which I can't find >>>> neither. >>>> 3- does anybody have a simple working manager example? >>>> >>>> Thanks, >>>> Sebastian- >>>> >>>> >>>> >>>> _______________________________________________ >>>> 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 >>> >>> >> No, it is still in the new documentation >> >> find /usr/local/lib/erlang/ -name *.html -exec grep -H snmp_test_mgr {} \; >> /usr/local/lib/erlang/lib/snmp-4.8.4/doc/html/snmp_impl_example_agent.html:1> >> snmp_test_mgr:start_link([{agent,"dront.ericsson.se"},{community,"all-rights"}, >> >> /Anders >> _______________________________________________ >> 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 2041 (20070206) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From emil.hellman@REDACTED Wed Feb 7 12:54:55 2007 From: emil.hellman@REDACTED (Emil Hellman) Date: Wed, 7 Feb 2007 12:54:55 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> Message-ID: > Now, the next question I have is: is there an Erlang way to forbid > "ordinary users" from calling the server's callback functions > directly (e.g. init, terminate, and so on), while allowing gen_server > access to them? The problem is that my exports for my library look > like this: > I'm not sure if this would work, so feel free to criticize. I believe the code at the end of this email makes sure that only clients spawned into the 'Allowed' module would get the 'hey_mate' answere. Running the code: Eshell V5.5.3 (abort with ^G) 1> server:start(client). true 2> client:middleman(foo). <0.32.0>I'm allright! 3> server ! stop. stop 4> server:start(some_other_module). true 5> client:middleman(foo). <0.37.0>Damn your protected function! I would like to be able to protect the exported functions in a manner like this without having ot write the custom code. I've been thinking about doing a parse transform that would check if the module had something like: -allowed([ListOfAllowedModules]) and then generate the that would cause these checks to be made. Alternatively check if the module was started in a specific application or maybe only protect specific exported funcitons. Would there be any problems with doing something like that? %%% -module(server). -export([start/1, loop/1, send_msg/1]). start(Allowed) -> register(server, spawn(?MODULE, loop, [Allowed])). loop(Allowed) -> receive {_Msg, From} -> case allowed(Allowed, From) of true -> From ! hey_mate; false -> From ! not_allowed end, loop(Allowed); stop -> stop end. send_msg(Msg) -> server ! {Msg, self()}. allowed(Al, P) -> PI = process_info(P), case lists:keysearch(initial_call, 1, PI) of {_,{_,{Al, _, _}}} -> true; _ -> false end. %%% -module(client). -export([middleman/1, sm/1, client_starter/3]). middleman(Msg) -> spawn(client, client_starter, [?MODULE, sm, [Msg]]). client_starter(M, F, A) -> % io:format("inital_call ~p~n", [process_info(self())]), apply(M, F, A). sm(Msg) -> server:send_msg(Msg), receive stop -> stop; hey_mate -> io:format("I'm allright!~n"); not_allowed -> io:format("Damn your protected function!~n") end. From bob@REDACTED Wed Feb 7 13:10:52 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 7 Feb 2007 04:10:52 -0800 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <2347DA42-DBE8-47E4-82F4-B3F1A12E47E7@gmail.com> <203C2FE9-4142-4725-BB54-3F59DDBBA7CB@zoominternet.net> Message-ID: <6a36e7290702070410i7594f657n2e923e35681d1367@mail.gmail.com> On 2/7/07, Emil Hellman wrote: > > Now, the next question I have is: is there an Erlang way to forbid > > "ordinary users" from calling the server's callback functions > > directly (e.g. init, terminate, and so on), while allowing gen_server > > access to them? The problem is that my exports for my library look > > like this: > > > > I'm not sure if this would work, so feel free to criticize. > I believe the code at the end of this email makes sure that only > clients spawned into the 'Allowed' module would get the 'hey_mate' > answere. Running the code: > > Eshell V5.5.3 (abort with ^G) > 1> server:start(client). > true > 2> client:middleman(foo). > <0.32.0>I'm allright! > 3> server ! stop. > stop > 4> server:start(some_other_module). > true > 5> client:middleman(foo). > <0.37.0>Damn your protected function! > > > I would like to be able to protect the exported functions in a manner > like this without having ot write the custom code. I've been thinking > about doing a parse transform that would check if the module had > something like: > -allowed([ListOfAllowedModules]) > > and then generate the that would cause these checks to be made. > Alternatively check if the module was started in a specific > application or maybe only protect specific exported funcitons. Would > there be any problems with doing something like that? I guess the real question is... why the heck would you want to do that? What problem does that solve? Does that problem actually exist? -bob From hakan@REDACTED Wed Feb 7 16:41:32 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 7 Feb 2007 16:41:32 +0100 (CET) Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <45C9B986.9010200@ericsson.com> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> <45C9B986.9010200@ericsson.com> Message-ID: On Wed, 7 Feb 2007, Mats Cronqvist wrote: MC> > Ok it is not safe in that particular regard if the pid MC> > really is intended to be used, but as Tobbe did not use MC> > in his example I assumed that that it was not intended MC> > to be used. MC> MC> i think it's clear from tobbes code that he intended MC> it to return the correct pid. and i think it should. Feel free to think so... ;-) MC> > If it is important that the correct pid MC> > is returned you will need to change the example to: MC> > start() -> MC> > case whereis(my_service) of MC> > Pid when pid(Pid) -> MC> > Pid MC> > _ -> MC> > spawn(my_mod, my_server, []), MC> > whereis(my_service) MC> > end. MC> MC> the second whereis/1 will (likely) run before the MC> register/2 call (presumably present) in my_mod:my_server/0, MC> and so will return undefined. I did not think about that race condition. It definitely complicates things a bit. Perhaps, it is time to dust off my good old service_broker user contribution. It solved that problem. /H?kan From mats.cronqvist@REDACTED Wed Feb 7 17:26:49 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 07 Feb 2007 17:26:49 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> <45C9B986.9010200@ericsson.com> Message-ID: <45C9FDC9.7080507@ericsson.com> Hakan Mattsson wrote: > On Wed, 7 Feb 2007, Mats Cronqvist wrote: > > MC> > Ok it is not safe in that particular regard if the pid > MC> > really is intended to be used, but as Tobbe did not use > MC> > in his example I assumed that that it was not intended > MC> > to be used. > MC> > MC> i think it's clear from tobbes code that he intended > MC> it to return the correct pid. and i think it should. > > Feel free to think so... ;-) perhaps we can agree on this; if it does return a pid, it should be the right one... > MC> > If it is important that the correct pid > MC> > is returned you will need to change the example to: > MC> > start() -> > MC> > case whereis(my_service) of > MC> > Pid when pid(Pid) -> > MC> > Pid > MC> > _ -> > MC> > spawn(my_mod, my_server, []), > MC> > whereis(my_service) > MC> > end. > MC> > MC> the second whereis/1 will (likely) run before the > MC> register/2 call (presumably present) in my_mod:my_server/0, > MC> and so will return undefined. > > I did not think about that race condition. It > definitely complicates things a bit. Perhaps, > it is time to dust off my good old service_broker > user contribution. It solved that problem. it is a pretty hard problem to solve elegantly. here's what i use. it has at least one race condition :> mats start() -> spawn(fun init/0) ! {hello,self()}, receive {ok,Pid} -> Pid end. init() -> receive {hello,Daddy} -> ok end, try register(name,self()), Daddy ! {ok,self()} catch error:badarg -> Daddy ! {ok,whereis(name)},exit(normal) end, loop(). From tobbe@REDACTED Wed Feb 7 21:00:22 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 07 Feb 2007 21:00:22 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <45C9FDC9.7080507@ericsson.com> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> <45C9B986.9010200@ericsson.com> <45C9FDC9.7080507@ericsson.com> Message-ID: I'm surprised over the long thread my rough sketch caused. In real life I would of course do almost as in Mats proposal, with some minor changes... :-) Mats Cronqvist wrote: > > start() -> > spawn(fun init/0) ! {hello,self()}, > receive {ok,Pid} -> Pid > end. start() -> Self = self(), Pid = spawn(fun() -> init(Self) end), receive {ok, Pid, RealPid} -> RealPid end. > > init() -> > receive {hello,Daddy} -> ok end, > try register(name,self()), Daddy ! {ok,self()} > catch error:badarg -> Daddy ! {ok,whereis(name)},exit(normal) > end, > loop(). init(Daddy) -> try register(name,self()), Daddy ! {ok,self(),self()} catch error:badarg -> Daddy ! {ok,self(),whereis(name)},exit(normal) end, loop(). --Tobbe From xpdoka@REDACTED Wed Feb 7 23:01:38 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Wed, 07 Feb 2007 23:01:38 +0100 Subject: [erlang-questions] Parametrized modules status In-Reply-To: <337538cb0702061132o2bdb9a8je5e682539afe05b4@mail.gmail.com> References: <337538cb0702061132o2bdb9a8je5e682539afe05b4@mail.gmail.com> Message-ID: <45CA4C42.60106@dominicwilliams.net> Kirill Zaborski a ?crit : > What is the current status of this feature? Does anyone use it? It's a chicken-or-egg dilemma. I have used parameterized modules in personal projects. They work and I think they are a great language feature. However, until they are fully supported I am a bit reluctant to use them in professional projects. Regards, Dominic Williams http://www.dominicwilliams.net ---- From jeffm@REDACTED Thu Feb 8 01:37:19 2007 From: jeffm@REDACTED (jm) Date: Thu, 08 Feb 2007 11:37:19 +1100 Subject: [erlang-questions] mnesia:subscribe doco and examples? Message-ID: <45CA70BF.1080506@ghostgun.com> The manual pages for mnesia say that mnesia:subscribe is docomented in the mnesia user manual. I assume this means the document entitled "Mnesia Database Managment System (MNESIA)" in wish I am unable to find anything. Actually not quite nothing section 1.5.7 "Mnesia Event Handling" contains a description of the available events. What I suppose I'm after is a couple of examples of the usage to get a more concrete idea of how it's used. Anyone care to point me in the right direction? Jeff. From bertil.karlsson@REDACTED Thu Feb 8 09:07:38 2007 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Thu, 08 Feb 2007 09:07:38 +0100 Subject: [erlang-questions] edoc problem in R11B-3 In-Reply-To: <45C1D6FD.9010602@it.uu.se> References: <45C1D6FD.9010602@it.uu.se> Message-ID: <45CADA4A.9060500@ericsson.com> So, if you want to patch this do the following: 221c221 < expand_content([H | T], Pos, Parents, Norm) when is_tuple(H) -> --- > expand_content([H | T], Pos, Parents, Norm) -> 225,227c225 < []; < expand_content(Content,Pos,Parents,Norm) -> < [expand_element(Content, Pos, Parents, Norm)]. --- > []. The next patch/release of xmerl will be corrected. /Bertil Richard Carlsson wrote: > Eric Merritt wrote: > >> I am getting the following error when running edoc. >> >> edoc: error in layout 'edoc_layout': >> {'EXIT',{badarg,[{erlang,binary_to_list,[{head,[[10],{title,[[77,111,100|...]]},[10],{link,[{rel,...},{...}|...],[]},[10]]}]},{xmerl_lib,export_text,2},{xmerl_lib,export_text,2},{xmerl,apply_cb,5},{xmerl,export_content,2},{xmerl,export_element,2},{xmerl,export_content,2},{xmerl,export1,3}]}}. >> edoc: error in doclet 'edoc_doclet': {'EXIT',error}. >> >> edoc seems to always output the above error. It doesn't seem to matter >> what source its run on or how edoc is called. Is anyone else having a >> similar problem, if so, have you been able to work around it? >> > > The problem is that someone has broken the xmerl_lib:expand_content/4 > function, in some misguided attempt to make it accept non-lists as > content, even though the documentation states that content must be flat > lists, and there is even a comment in the code that explains why this > must be so (hint: strings are also lists, and may be deep). > > Revert to the previous version of xmerl (or edit expand_content/4 to > match the previous version if you prefer that), and you should be ok. > > The following comment in the release notes, made me worried as soon as I > saw it: > > OTP-6099 Bug in xmerl removed so that simple syntax element content is > exported correctly. > > How about reading the spec before deciding to "fix" something? > > /Richard > > PS. "Do not meddle in the affairs of Wizards, for they are subtle and > quick to anger." > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From hakan@REDACTED Thu Feb 8 10:06:30 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 8 Feb 2007 10:06:30 +0100 (CET) Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> <45C9B986.9010200@ericsson.com> <45C9FDC9.7080507@ericsson.com> Message-ID: A totally different approach is to use a supervisor. Besides the process obvious supervision (which is desirable for many persistent server processes), you would also get a serialized startup procedure. /H?kan On Wed, 7 Feb 2007, Torbjorn Tornkvist wrote: TT> I'm surprised over the long thread my rough sketch caused. TT> In real life I would of course do almost as in Mats proposal, TT> with some minor changes... :-) TT> TT> Mats Cronqvist wrote: TT> > TT> > start() -> TT> > spawn(fun init/0) ! {hello,self()}, TT> > receive {ok,Pid} -> Pid TT> > end. TT> TT> start() -> TT> Self = self(), TT> Pid = spawn(fun() -> init(Self) end), TT> receive {ok, Pid, RealPid} -> RealPid end. TT> TT> > TT> > init() -> TT> > receive {hello,Daddy} -> ok end, TT> > try register(name,self()), Daddy ! {ok,self()} TT> > catch error:badarg -> Daddy ! {ok,whereis(name)},exit(normal) TT> > end, TT> > loop(). TT> TT> init(Daddy) -> TT> try register(name,self()), Daddy ! {ok,self(),self()} TT> catch error:badarg -> Daddy ! {ok,self(),whereis(name)},exit(normal) TT> end, TT> loop(). TT> TT> TT> --Tobbe From mats.cronqvist@REDACTED Thu Feb 8 11:13:11 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 08 Feb 2007 11:13:11 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> <45C9B986.9010200@ericsson.com> <45C9FDC9.7080507@ericsson.com> Message-ID: <45CAF7B7.7070703@ericsson.com> Torbjorn Tornkvist wrote: > I'm surprised over the long thread my rough sketch caused. blame robert... > In real life I would of course do almost as in Mats proposal, > with some minor changes... :-) but of course :> i think your version is objectively better. i just dislike the verbosity of the fun() -> init(Self) end syntax. > init(Daddy) -> > try register(name,self()), Daddy ! {ok,self(),self()} > catch error:badarg -> Daddy ! {ok,self(),whereis(name)},exit(normal) > end, > loop(). to be REALLY correct this should recurse if the whereis fails (which can happen if there is a process 'name' that exits between the calls to register and whereis). mats From ulf.wiger@REDACTED Thu Feb 8 11:36:17 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 8 Feb 2007 11:36:17 +0100 Subject: [erlang-questions] Parametrized modules status In-Reply-To: <45CA4C42.60106@dominicwilliams.net> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155EEEF92@esealmw115.eemea.ericsson.se> > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Dominic Williams > Sent: den 7 februari 2007 23:02 > To: Kirill Zaborski; erlang-questions@REDACTED > Subject: Re: [erlang-questions] Parametrized modules status > > Kirill Zaborski a ?crit : > > > What is the current status of this feature? Does anyone use it? > > It's a chicken-or-egg dilemma. I have used parameterized > modules in personal projects. They work and I think they are > a great language feature. However, until they are fully > supported I am a bit reluctant to use them in professional projects. Erlhive uses parameterized modules extensively in the background, as well as the package syntax. From a user perspective, erlhive supports user-defined parameterized modules, but doesn't require them. Worst case, I'd have to emulate parameterized modules internally if they were to disappear from OTP. For Erlhive, this is not a huge problem, since it does code transformation on all user- provided code. The same goes for the package syntax. Erlhive needs some namespace convention, and I didn't see the point in inventing my own. It's not a huge problem if OTP decides to drop it, although I would much rather that they didn't. (: Personally, I think parameterized modules are very nice in some situations. I can imagine that they can be overused, but that's the case with many other language constructs too (apply/3 comes to mind as an example...) BR, Ulf W From hakan@REDACTED Thu Feb 8 12:06:18 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 8 Feb 2007 12:06:18 +0100 (CET) Subject: [erlang-questions] mnesia:subscribe doco and examples? In-Reply-To: <45CA70BF.1080506@ghostgun.com> References: <45CA70BF.1080506@ghostgun.com> Message-ID: On Thu, 8 Feb 2007, jm wrote: j> Date: Thu, 08 Feb 2007 11:37:19 +1100 j> From: jm j> To: erlang-questions j> Subject: [erlang-questions] mnesia:subscribe doco and examples? j> j> The manual pages for mnesia say that mnesia:subscribe is docomented in j> the mnesia user manual. I assume this means the document entitled j> "Mnesia Database Managment System (MNESIA)" in wish I am unable to find j> anything. Actually not quite nothing section 1.5.7 "Mnesia Event j> Handling" contains a description of the available events. What I suppose j> I'm after is a couple of examples of the usage to get a more concrete j> idea of how it's used. Anyone care to point me in the right direction? There are no examples in the "Mnesia Event Handling" section as you already have found out, but it does provide an exhaustive list of all events. Here is a small example? # erl Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [kernel-poll:false] Eshell V5.5.3 (abort with ^G) 1> mnesia:start(). ok 2> mnesia:create_table(t,[]). {atomic,ok} 3> mnesia:subscribe({table, t}). {ok,nonode@REDACTED} 4> mnesia:dirty_write(t, {t,12,4 2}). ok 5> mnesia:dirty_write(t, {t, 12, 43}). ok 6> mnesia:dirty_delete(t, 12). ok 7> flush(). Shell got {mnesia_table_event,{write,{t,12,42},{dirty,<0.30.0>}}} Shell got {mnesia_table_event,{write,{t,12,43},{dirty,<0.30.0>}}} Shell got {mnesia_table_event,{delete,{t,12},{dirty,<0.30.0>}}} ok 8> /H?kan From mikael.karlsson@REDACTED Thu Feb 8 14:57:41 2007 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Thu, 8 Feb 2007 14:57:41 +0100 Subject: [erlang-questions] Building R11B-3 on kubuntu, minor patch request Message-ID: <200702081457.41591.mikael.karlsson@creado.com> Would it be possible to add /usr/include to the dirs search path for krb5.h in erts/configure and erts/configure.in scripts? Otherwise when executing configure on kubuntu it does not find the include file and ssl, ssh and crypto apps will be skipped in the following make. Regards Mikael From robert.virding@REDACTED Thu Feb 8 23:04:28 2007 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 08 Feb 2007 23:04:28 +0100 Subject: [erlang-questions] Erlang way for process-as-library? In-Reply-To: <45CAF7B7.7070703@ericsson.com> References: <130D18F2-CDD2-4682-8BD2-3FDFEDF07085@zoominternet.net> <45C8F8BC.6000102@telia.com> <45C9A073.70703@ericsson.com> <45C9B986.9010200@ericsson.com> <45C9FDC9.7080507@ericsson.com> <45CAF7B7.7070703@ericsson.com> Message-ID: <45CB9E6C.1070108@telia.com> Mats Cronqvist wrote: > Torbjorn Tornkvist wrote: > >>I'm surprised over the long thread my rough sketch caused. > > > blame robert... All I did was point out that the code was unsafe. :-) Anyway, hopefully this disucssion has given some insight into the problem of synchronising in distributed systems. As someone else mentioned it is probably better to have a supervisor process charged with keeping the server alive. This problem goes away. Robert From robert.kenneth.smart@REDACTED Fri Feb 9 01:13:42 2007 From: robert.kenneth.smart@REDACTED (Robert Smart) Date: Fri, 9 Feb 2007 11:13:42 +1100 Subject: [erlang-questions] comet In-Reply-To: References: Message-ID: <155f3edf0702081613n226354a3ja3fa32259da7c1b@mail.gmail.com> I never get around to writing my erlang/javascript ajax application, but I keep thinking about it. There are complicated solutions to the message passing problem, like cometd in the dojo toolkit. I have always thought that I'll be able to get away with a simple system like this: The server has 4 erlang processes: HC receives messages from the client (as POSTs with JSON); HS receives requests from the client for new messages from the server (GETs to which it responds with a "text/json"); APP is the application; SQ holds the queue of messages to go to the client (which are sent when GETs come in to HS). SQ loops receiving two sorts of messages. One sort of message from APP contains a message to pass to the client. These get accumulated. The other sort of message is from HS asking for any messages. When the latter arrives then all the awaiting messages are returned to HS which will package them up as a "text/json" response. If there are no messages to return then there is no immediate response to HS. Instead SQ goes back to listening for local messages: if it gets one from APP it sends it to the HS; if it times out (20secs?) then it returns an empty message list to HS which returns that to the client. So the response to GETs coming in to HS can be delayed up to the timeout. When POSTs come in to HC then the message is written to the queue of unprocessed requests in static storage (disk), before returning a response which is the same as an empty HC response (only has an updated last seq number received). I guess there is a problem sending this using XHR (XmlHtppRequest), since we already have one active waiting for HS response. So maybe this does have to be sent through a separate (i)frame. Or maybe we can have 2 simultaneous XHRs if they go to different ports? Of course it is moments like this that you want a toolkit like dojo to smooth over the differences between browsers. The client javascript keeps an XHR request up to HS (whenever it gets a response, or a request fails, then it starts up a new one before doing anything with the returned data). For sending data it just sends to HC (maybe a different port) whenever it has a message to send, and doesn't expect a response. If the sends to HC fail then they will be resent after a wait [with some sort of visual indicator for the user that there is delay]. When there is a delay then multiple messages can be combined in the catch up retry. JSON messages between client and server have a sequence number. Each time a collection of messages is sent then the sequence number of the last received message is also sent. Always (re)send all the messages since the last known received message. Messages that have already been received are ignored. If the next expected message is bypassed then crash. All state is kept in the server and saved before a related response is sent to the client. So if the server restarts and the client keeps trying it will resync on the restarted server. If the client browser restarts then going to the initial url for the application will tell the server to resync and send the client enough data to rebuild the gui state. Will this work? What tools are relevant? Bob From fritchie@REDACTED Fri Feb 9 06:55:54 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 08 Feb 2007 23:55:54 -0600 Subject: [erlang-questions] Mnesia question: DECISION_TAB.LOG and ETS 'mnesia_decision' sizes Message-ID: <200702090555.l195tsut072641@snookles.snookles.com> Hi, everyone. I've been perplexed by the last several hours by a feature of Mnesia... ... The application that I'm playing with is write-heavy. Extremely write-heavy. Very small number of Mnesia tables. More than 1K transactions per second, with records ranging in size from 0.5-20KB each. Nothing really fancy for indexing. Using mnesia_frag. Roughly 1GB of test data total in all tables. R10B-9. Xeon EM64T boxes. Linux CentOS 4. Short story: 2 node, 4 node, and 8 node systems have same throughput as 2 node system. (See below for longer story.) I am very suspicious of the log dumping activity, the size of the ETS table 'mnesia_decision', and the size of the DECISION_TAB.LOG file. 8> length(ets:tab2list(mnesia_decision)). 665533 # ls -Fs $prefix/var/data/Mnesia*/D* 59436 /usr/local/gemini/hss/var/data/Mnesia.hss1@REDACTED/DECISION_TAB.LOG That's after I had stopped and restarted all 8 nodes. Why is the decision table so big? Naive me, I assume that after all nodes have started, any pending & interrupted & uncertain transactions have all been figured out, aborted/committed, and life goes on with a clean slate, right? 'mnesia_decision' and DECISION_TAB.LOG have similar but not identical sizes on all 8 nodes. I hacked a Perl script to tell me the age of each DECISION_TAB.LOG log file on each node. Under load, 90% of the time it's less than 4 seconds old. Furthermore, "etop" shows that mnesia_controller:dump_and_reply/2 is a *huge* time hog. I'll attach some "etop" output at the end ... I made it wider than its usual, just so I could **see** the long names. Er, um ... {whimper} ... help? If stopping & starting 1/some/all nodes doesn't clear the mnesia_decision table, what will? -Scott --- snip --- snip --- snip --- snip --- snip --- snip --- I'd been playing with a 2 node system, where each table has 2 replicas/copies. I've got a baseline of performance with that system, so now it's time to go to a 4-node system, using mnesia_frag, and each fragment has 2 replicas/copies. I aim my load generators at all 4 nodes, fire, ... ... and the throughput is roughly the same as the 2 node system. Both the 2 node and 4 node systems have each node eating 100% CPU time. But throughput is flat. No increase, just flat. So I try an 8 node system. Same result: 8 nodes eating 100% CPU time, throughput is roughly the same as a 2 node system. I stopped my head banging, but my forehead still has QWERTY embossed in it. --- snip --- snip --- snip --- snip --- snip --- snip --- I have only experimented a little bit with a 2 node system with R11B-3 nodes ... they showed no substantial improvement on application throughput, though both scheduler threads consume a lot of CPU time. I need to do more experimenting, though.... --- snip --- snip --- snip --- snip --- snip --- snip --- ======================================================================================== 'hss1@REDACTED' 04:50:39 Load: cpu 49 Memory: total 580593 binary 122157 procs 175 processes 181189 code 5345 runq 24 atom 527 ets 238741 Pid Name or Initial Func Time Reds Memory MsgQ Current Function ---------------------------------------------------------------------------------------- <4139.8505.1> mnesia_controller:dump_and_reply/2 1831902 1269755 180548880 0 disk_log:monitor_request/2 <4139.54.0> mnesia_locker 101187 82850 55968 42 mnesia_locker:can_lock/4 <4139.56.0> mnesia_tm 92369 87708 145448 95 disk_log:monitor_request/2 <4139.104.0> proc_lib:init_p/5 59379 54031 68280 16 disk_log:loop/1 <4139.55.0> mnesia_recover 51388 79740 68656 38 gen_server:handle_common_reply/6 <4139.614.0> pssql_protocol:new_session/4 36499 19841 16760 0 mnesia_tm:rec/2 <4139.2009.0> pssql_protocol:new_session/4 24692 16669 17704 0 mnesia_tm:rec/2 <4139.5833.0> pssql_protocol:new_session/4 23328 17266 17680 0 mnesia_tm:rec/2 <4139.374.0> cmcc_msgid_db_stats 23153 82959 513584 0 gen:wait_resp_mon/3 <4139.1923.0> pssql_protocol:new_session/4 20902 15785 16720 0 prim_inet:recv0/3 ======================================================================================== ======================================================================================== 'hss1@REDACTED' 04:50:44 Load: cpu 34 Memory: total 518185 binary 121968 procs 187 processes 119142 code 5345 runq 0 atom 527 ets 238570 Pid Name or Initial Func Time Reds Memory MsgQ Current Function ---------------------------------------------------------------------------------------- <4139.8869.1> mnesia_controller:dump_and_reply/2 1562904 711958 117133680 0 disk_log:monitor_request/2 <4139.8935.1> proc_lib:init_p/5 300661 1235 7744 0 prim_file:drv_get_response/1 <4139.56.0> mnesia_tm 99142 123879 88736 0 mnesia_tm:doit_loop/1 <4139.54.0> mnesia_locker 69454 96376 42152 0 mnesia_locker:loop/1 <4139.55.0> mnesia_recover 61112 83136 42192 0 gen_server:loop/6 <4139.104.0> proc_lib:init_p/5 43921 92687 67824 0 disk_log:loop/1 <4139.374.0> cmcc_msgid_db_stats 36493 84721 513584 0 io:wait_io_mon_reply/2 <4139.2009.0> pssql_protocol:new_session/4 23298 20384 13704 0 prim_inet:recv0/3 <4139.859.0> pssql_protocol:new_session/4 19199 22988 11840 0 prim_inet:recv0/3 <4139.30267.0> pssql_protocol:new_session/4 19038 18456 16760 0 mnesia_locker:receive_wlocks/4 ======================================================================================== ======================================================================================== 'hss1@REDACTED' 04:50:49 Load: cpu 41 Memory: total 599778 binary 122033 procs 177 processes 200608 code 5345 runq 0 atom 527 ets 238631 Pid Name or Initial Func Time Reds Memory MsgQ Current Function ---------------------------------------------------------------------------------------- <4139.9456.1> mnesia_controller:dump_and_reply/2 1678523 1111769 200609760 0 disk_log:monitor_request/2 <4139.9573.1> proc_lib:init_p/5 323167 1235 7744 0 prim_file:drv_get_response/1 <4139.56.0> mnesia_tm 120268 135773 68384 0 mnesia_tm:doit_loop/1 <4139.54.0> mnesia_locker 79628 129004 34256 0 mnesia_locker:loop/1 <4139.104.0> proc_lib:init_p/5 67524 54152 55048 0 disk_log:loop/1 <4139.55.0> mnesia_recover 64354 117890 34296 0 gen_server:loop/6 <4139.859.0> pssql_protocol:new_session/4 49069 50448 16792 0 gen:wait_resp_mon/3 <4139.676.0> pssql_protocol:new_session/4 43298 39918 11880 0 mnesia_tm:rec_all/4 <4139.2009.0> pssql_protocol:new_session/4 40278 39381 17736 0 gen:wait_resp_mon/3 <4139.606.0> pssql_protocol:new_session/4 30449 31238 16760 0 mnesia_tm:rec_all/4 ======================================================================================== From rsaccon@REDACTED Fri Feb 9 07:16:15 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Fri, 9 Feb 2007 03:16:15 -0300 Subject: [erlang-questions] trouble with postgresql driver Message-ID: Is anybody using the posgres driver ( http://erlang-consulting.com/aboutus/opensource.html ) from erlang-consulting ? Couldn't find any documentation / examples and when I try to start the driver I get human-unreadable messages, see below: 5> application:start(psql). ok 6> Event: {psql,parameter_status, <<99,108,105,101,110,116,95,101,110,99,111,100,105,110,103,0,85,84,70,56,0>>} Event: {psql,parameter_status, <<68,97,116,101,83,116,121,108,101,0,73,83,79,44,32,77,68,89,0>>} Event: {psql,parameter_status, <<105,110,116,101,103,101,114,95,100,97,116,101,116,105,109,101,115,0,111,110,0>>} Event: {psql,parameter_status, <<105,115,95,115,117,112,101,114,117,115,101,114,0,111,102,102,0>>} Event: {psql,parameter_status, <<115,101,114,118,101,114,95,101,110,99,111,100,105,110,103,0,85,84,70,56,0>>} Event: {psql,parameter_status, <<115,101,114,118,101,114,95,118,101,114,115,105,111,110,0,56,46,49,46,52,0>>} Event: {psql,parameter_status, <<115,101,115,115,105,111,110,95,97,117,116,104,111,114,105,122,97,116,105,111,110,0,114,115,97,99,99,111,110,0>>} Event: {psql,parameter_status, <<115,116,97,110,100,97,114,100,95,99,111,110,102,111,114,109,105,110,103,95,115,116,114,105,110,103,115,0,111,102,102,0>>} Event: {psql,parameter_status, <<84,105,109,101,90,111,110,101,0,65,109,101,114,105,99,97,47,70,111,114,116,97,108,101,122,97,0>>} Event: {psql,backend_key_data,<<0,0,77,165,116,138,156,44>>} and any attempt to execute a query sql:q/1 results in the following error: ** exited: {noproc,{gen_server,call, [sql_pool_mgr_srv, {reference,<0.347.0>,default}]}} ** With the same authorization credentials, but different (non-erlang) client app I can connect to the db. Does anybody know how to interpret this error messages and get this driver to work ? -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: From valentin@REDACTED Fri Feb 9 07:51:36 2007 From: valentin@REDACTED (Valentin Micic) Date: Fri, 9 Feb 2007 08:51:36 +0200 Subject: [erlang-questions] trouble with postgresql driver References: Message-ID: <012d01c74c16$c02c2ae0$6401a8c0@moneymaker2> Not that I have any experience with the driver, however: Just try binary_to_list function, however eliminate non-printable characters, like 0 (mind you this looks like array of C-Strings): instead of: binary_to_list( <<99,108,105,101,110,116,95,101,110,99,111,100,105,110,103,0,85,84,70,56,0>>) do: binary_to_list( <<99,108,105,101,110,116,95,101,110,99,111,100,105,110,103,85,84,70,56>>) and you'll get: "client_encodingUTF8" conversely: binary_to_list( <<68,97,116,101,83,116,121,108,101,73,83,79,44,32,77,68,89>> produce: "DateStyleISO, MDY" This looks to me like driver's environment. V. ----- Original Message ----- From: Roberto Saccon To: erlang-questions Sent: Friday, February 09, 2007 8:16 AM Subject: [erlang-questions] trouble with postgresql driver Is anybody using the posgres driver ( http://erlang-consulting.com/aboutus/opensource.html ) from erlang-consulting ? Couldn't find any documentation / examples and when I try to start the driver I get human-unreadable messages, see below: 5> application:start(psql). ok 6> Event: {psql,parameter_status, <<99,108,105,101,110,116,95,101,110,99,111,100,105,110,103,0,85,84,70,56,0>>} Event: {psql,parameter_status, <<68,97,116,101,83,116,121,108,101,0,73,83,79,44,32,77,68,89,0>>} Event: {psql,parameter_status, <<105,110,116,101,103,101,114,95,100,97,116,101,116,105,109,101,115,0,111,110,0>>} Event: {psql,parameter_status, <<105,115,95,115,117,112,101,114,117,115,101,114,0,111,102,102,0>>} Event: {psql,parameter_status, <<115,101,114,118,101,114,95,101,110,99,111,100,105,110,103,0,85,84,70,56,0>>} Event: {psql,parameter_status, <<115,101,114,118,101,114,95,118,101,114,115,105,111,110,0,56,46,49,46,52,0>>} Event: {psql,parameter_status, <<115,101,115,115,105,111,110,95,97,117,116,104,111,114,105,122,97,116,105,111,110,0,114,115,97,99,99,111,110,0>>} Event: {psql,parameter_status, <<115,116,97,110,100,97,114,100,95,99,111,110,102,111,114,109,105,110,103,95,115,116,114,105,110,103,115,0,111,102,102,0>>} Event: {psql,parameter_status, <<84,105,109,101,90,111,110,101,0,65,109,101,114,105,99,97,47,70,111,114,116,97,108,101,122,97,0>>} Event: {psql,backend_key_data,<<0,0,77,165,116,138,156,44>>} and any attempt to execute a query sql:q/1 results in the following error: ** exited: {noproc,{gen_server,call, [sql_pool_mgr_srv, {reference,<0.347.0>,default}]}} ** With the same authorization credentials, but different (non-erlang) client app I can connect to the db. Does anybody know how to interpret this error messages and get this driver to work ? -- Roberto Saccon ------------------------------------------------------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From VAUCHER@REDACTED Fri Feb 9 09:30:19 2007 From: VAUCHER@REDACTED (VAUCHER Laurent) Date: Fri, 9 Feb 2007 09:30:19 +0100 Subject: [erlang-questions] Compiling erlang on AIX 5.3 Message-ID: <55DDB08CC9CD2941A70E8D626789A2C9041A5FAA@ec8l7ljvo9h5dde.hosting.exch> > > === Entering application parsetools > > make[3]: Entering directory `/tmp/otp_src_R11B-2/lib/parsetools/src' > > erlc -W +debug_info -I/tmp/otp_src_R11B-2/lib/stdlib/include -o../ebin > > yecc.erl > > Could not load program > > /tmp/otp_src_R11B-2/bin/powerpc-ibm-aix5.3.0.0/beam: > > The program does not have an entry point or > > the o_snentry field in the auxiliary header is invalid. > > Examine file headers with the 'dump -ohv' command. > > Hard to say without seeing the complete build log and "config.log", but using Google there seem to be two main causes for this on AIX > > - Somehow the build put in "-G" or "-shared" on the link line > of the "beam" executable. > > - "ld" was used to link the final application "beam", this will not > work on AIX. The "gcc" or "xlc_r" command should be used for > linking, as it "knows things" about runtime library dependencies, > entry points etc that a plain "ld" has no idea about. > > The problem with using "ld" is described at page 73 in > > http://jumpdoc.fz-juelich.de/doc_pdf/compiler/SG24-5674-01a-CandC++.pdf > > kent This explanation makes real sense. But now, how do I tell configure not to look for 'ld' but use gcc instead? I've tried --with-ld=gcc. I've tried forcefully replacing ld by gcc (which does not work at all). I've tried 'export LD=gcc'... I can't find a way to do it and I can't find any documentation. Laurent. From lcoquelle@REDACTED Fri Feb 9 11:51:51 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Fri, 9 Feb 2007 18:51:51 +0800 Subject: [erlang-questions] dict, orddict and gb_tree Message-ID: Hi, Any resources/advices to choose between usage of dict, orddict and gb_tree? In my understanding, they are all doing the same thing: "giving a key, retrieve the value"; am I right? If so, how to choose? I guess trees are better if there is few updates (less than reads). And what about dict and orddict? What about any criteria relative to the amount of data? Please, some advice, I'm lost in the documentation :) From dgud@REDACTED Fri Feb 9 11:58:48 2007 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 09 Feb 2007 11:58:48 +0100 Subject: [erlang-questions] Mnesia question: DECISION_TAB.LOG and ETS 'mnesia_decision' sizes In-Reply-To: <200702090555.l195tsut072641@snookles.snookles.com> References: <200702090555.l195tsut072641@snookles.snookles.com> Message-ID: <45CC53E8.3080902@erix.ericsson.se> Can you stop sending these Mnesia questions on Fridays... :-) You don't use the old load_regulator switch do you? If so remove it. disc_copies or disc_only_copies? The performance have actually increased a lot since before when dets was used to store data on disk (for disc_copies), but the log dumping is still one of the heaviest operations in mnesia if you keep writing data it will eat alot of cpu cycles and io. I'll have to look in to how DECISION_TAB.LOG works..but I don't think that is real the problem. What does your transactions do? Are all nodes involved in your writes then it doesn't matter if you scale it several nodes it just costs more. If a transaction does 3 writes to tab A,B,C and in you 4 node case A is on N1,N2, B is on N2,N3 and C is on N3,N4 all nodes needs the commit and the performance is lower in the 4 node case. It's pretty tricky to get more perf out of mnesia_frag, you will have to locate the parts so it fits your application and usage. But it would be pretty interesting to see an eprof run of mnesia_dumper to see if we can improve it. Email me directly. /Dan Scott Lystig Fritchie wrote: > Hi, everyone. I've been perplexed by the last several hours by a > feature of Mnesia... > > ... The application that I'm playing with is write-heavy. Extremely > write-heavy. Very small number of Mnesia tables. More than 1K > transactions per second, with records ranging in size from 0.5-20KB > each. Nothing really fancy for indexing. Using mnesia_frag. Roughly > 1GB of test data total in all tables. R10B-9. Xeon EM64T boxes. > Linux CentOS 4. > > Short story: 2 node, 4 node, and 8 node systems have same throughput > as 2 node system. > (See below for longer story.) > > I am very suspicious of the log dumping activity, the size of the ETS > table 'mnesia_decision', and the size of the DECISION_TAB.LOG file. > > 8> length(ets:tab2list(mnesia_decision)). > 665533 > > # ls -Fs $prefix/var/data/Mnesia*/D* > 59436 /usr/local/gemini/hss/var/data/Mnesia.hss1@REDACTED/DECISION_TAB.LOG > > That's after I had stopped and restarted all 8 nodes. Why is the > decision table so big? Naive me, I assume that after all nodes have > started, any pending & interrupted & uncertain transactions have all > been figured out, aborted/committed, and life goes on with a clean > slate, right? > > 'mnesia_decision' and DECISION_TAB.LOG have similar but not identical > sizes on all 8 nodes. > > I hacked a Perl script to tell me the age of each DECISION_TAB.LOG log > file on each node. Under load, 90% of the time it's less than 4 > seconds old. > > Furthermore, "etop" shows that mnesia_controller:dump_and_reply/2 is a > *huge* time hog. I'll attach some "etop" output at the end ... I made > it wider than its usual, just so I could **see** the long names. > > Er, um ... {whimper} ... help? If stopping & starting 1/some/all > nodes doesn't clear the mnesia_decision table, what will? > > -Scott > > --- snip --- snip --- snip --- snip --- snip --- snip --- > > I'd been playing with a 2 node system, where each table has 2 > replicas/copies. I've got a baseline of performance with that system, > so now it's time to go to a 4-node system, using mnesia_frag, and each > fragment has 2 replicas/copies. I aim my load generators at all 4 > nodes, fire, ... > > ... and the throughput is roughly the same as the 2 node system. Both > the 2 node and 4 node systems have each node eating 100% CPU time. > But throughput is flat. No increase, just flat. > > So I try an 8 node system. Same result: 8 nodes eating 100% CPU time, > throughput is roughly the same as a 2 node system. I stopped my head > banging, but my forehead still has QWERTY embossed in it. > > --- snip --- snip --- snip --- snip --- snip --- snip --- > > I have only experimented a little bit with a 2 node system with > R11B-3 nodes ... they showed no substantial improvement on application > throughput, though both scheduler threads consume a lot of CPU time. > I need to do more experimenting, though.... > > --- snip --- snip --- snip --- snip --- snip --- snip --- > > ======================================================================================== > 'hss1@REDACTED' 04:50:39 > Load: cpu 49 Memory: total 580593 binary 122157 > procs 175 processes 181189 code 5345 > runq 24 atom 527 ets 238741 > Pid Name or Initial Func Time Reds Memory MsgQ Current Function > ---------------------------------------------------------------------------------------- > <4139.8505.1> mnesia_controller:dump_and_reply/2 1831902 1269755 180548880 0 disk_log:monitor_request/2 > <4139.54.0> mnesia_locker 101187 82850 55968 42 mnesia_locker:can_lock/4 > <4139.56.0> mnesia_tm 92369 87708 145448 95 disk_log:monitor_request/2 > <4139.104.0> proc_lib:init_p/5 59379 54031 68280 16 disk_log:loop/1 > <4139.55.0> mnesia_recover 51388 79740 68656 38 gen_server:handle_common_reply/6 > <4139.614.0> pssql_protocol:new_session/4 36499 19841 16760 0 mnesia_tm:rec/2 > <4139.2009.0> pssql_protocol:new_session/4 24692 16669 17704 0 mnesia_tm:rec/2 > <4139.5833.0> pssql_protocol:new_session/4 23328 17266 17680 0 mnesia_tm:rec/2 > <4139.374.0> cmcc_msgid_db_stats 23153 82959 513584 0 gen:wait_resp_mon/3 > <4139.1923.0> pssql_protocol:new_session/4 20902 15785 16720 0 prim_inet:recv0/3 > ======================================================================================== > > ======================================================================================== > 'hss1@REDACTED' 04:50:44 > Load: cpu 34 Memory: total 518185 binary 121968 > procs 187 processes 119142 code 5345 > runq 0 atom 527 ets 238570 > Pid Name or Initial Func Time Reds Memory MsgQ Current Function > ---------------------------------------------------------------------------------------- > <4139.8869.1> mnesia_controller:dump_and_reply/2 1562904 711958 117133680 0 disk_log:monitor_request/2 > <4139.8935.1> proc_lib:init_p/5 300661 1235 7744 0 prim_file:drv_get_response/1 > <4139.56.0> mnesia_tm 99142 123879 88736 0 mnesia_tm:doit_loop/1 > <4139.54.0> mnesia_locker 69454 96376 42152 0 mnesia_locker:loop/1 > <4139.55.0> mnesia_recover 61112 83136 42192 0 gen_server:loop/6 > <4139.104.0> proc_lib:init_p/5 43921 92687 67824 0 disk_log:loop/1 > <4139.374.0> cmcc_msgid_db_stats 36493 84721 513584 0 io:wait_io_mon_reply/2 > <4139.2009.0> pssql_protocol:new_session/4 23298 20384 13704 0 prim_inet:recv0/3 > <4139.859.0> pssql_protocol:new_session/4 19199 22988 11840 0 prim_inet:recv0/3 > <4139.30267.0> pssql_protocol:new_session/4 19038 18456 16760 0 mnesia_locker:receive_wlocks/4 > ======================================================================================== > > ======================================================================================== > 'hss1@REDACTED' 04:50:49 > Load: cpu 41 Memory: total 599778 binary 122033 > procs 177 processes 200608 code 5345 > runq 0 atom 527 ets 238631 > Pid Name or Initial Func Time Reds Memory MsgQ Current Function > ---------------------------------------------------------------------------------------- > <4139.9456.1> mnesia_controller:dump_and_reply/2 1678523 1111769 200609760 0 disk_log:monitor_request/2 > <4139.9573.1> proc_lib:init_p/5 323167 1235 7744 0 prim_file:drv_get_response/1 > <4139.56.0> mnesia_tm 120268 135773 68384 0 mnesia_tm:doit_loop/1 > <4139.54.0> mnesia_locker 79628 129004 34256 0 mnesia_locker:loop/1 > <4139.104.0> proc_lib:init_p/5 67524 54152 55048 0 disk_log:loop/1 > <4139.55.0> mnesia_recover 64354 117890 34296 0 gen_server:loop/6 > <4139.859.0> pssql_protocol:new_session/4 49069 50448 16792 0 gen:wait_resp_mon/3 > <4139.676.0> pssql_protocol:new_session/4 43298 39918 11880 0 mnesia_tm:rec_all/4 > <4139.2009.0> pssql_protocol:new_session/4 40278 39381 17736 0 gen:wait_resp_mon/3 > <4139.606.0> pssql_protocol:new_session/4 30449 31238 16760 0 mnesia_tm:rec_all/4 > ======================================================================================== > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raimo+erlang-questions@REDACTED Fri Feb 9 12:31:12 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 9 Feb 2007 12:31:12 +0100 Subject: [erlang-questions] Building R11B-3 on kubuntu, minor patch request In-Reply-To: <200702081457.41591.mikael.karlsson@creado.com> References: <200702081457.41591.mikael.karlsson@creado.com> Message-ID: <20070209113112.GA17114@erix.ericsson.se> We will squeeze in the change for the next sub-release. But we currently have no Kubuntu machine to test on. One day we will, though... Thank you for the patch. On Thu, Feb 08, 2007 at 02:57:41PM +0100, Mikael Karlsson wrote: > Would it be possible to add /usr/include to the dirs search path > for krb5.h in erts/configure and erts/configure.in scripts? > Otherwise when executing configure on kubuntu it does not find the include > file and ssl, ssh and crypto apps will be skipped in the following make. > > Regards > Mikael > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From richardc@REDACTED Fri Feb 9 16:11:58 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 09 Feb 2007 16:11:58 +0100 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: References: Message-ID: <45CC8F3E.40408@it.uu.se> Ludovic Coquelle wrote: > Hi, > Any resources/advices to choose between usage of dict, orddict and gb_tree? > In my understanding, they are all doing the same thing: "giving a key, > retrieve the value"; am I right? > > If so, how to choose? I guess trees are better if there is few updates > (less than reads). And what about dict and orddict? What about any > criteria relative to the amount of data? gb_trees is slightly more lightweight and a little bit faster on most operations than dict, so they are particularly good if you have large numbers of moderately sized tables. But in general, you're not likely to notice any difference until you really start to push the limits, so for everyday programs, you can use either without loss. However, dict does hashing on the keys (which gb_trees does not), so if you have complex, large-ish keys (e.g. arbitrary strings), then dict is a better choice since it doesn't spend as much time comparing keys. gb_trees assumes that key comparison is a fast, constant time operation. orddict can be used when there is a real point with having explicit ordered lists of pairs; e.g, if you do repeated merging but few or no lookups or inserts. It can be a good idea to convert back and forth between ordinary dicts/trees and orddicts depending on the phase of the program; e.g., first building a large orddict by merging many many smaller ones, and then transforming it to a dict just before you start to do lookups. But remember that this is optimization, and should not be done prematurely. /Richard From autophile@REDACTED Fri Feb 9 19:07:34 2007 From: autophile@REDACTED (Robert Baruch) Date: Fri, 9 Feb 2007 13:07:34 -0500 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: <45CC8F3E.40408@it.uu.se> References: <45CC8F3E.40408@it.uu.se> Message-ID: <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> On Feb 9, 2007, at 10:11 AM, Richard Carlsson wrote: > > > gb_trees is slightly more lightweight and a little bit faster on most > operations than dict, so they are particularly good if you have large > numbers of moderately sized tables. But in general, you're not likely > to notice any difference until you really start to push the limits, so > for everyday programs, you can use either without loss. I wrote some code a few days ago that had to store about 17,000 key/ value pairs, where the key was an integer. I found that gb_trees was far faster in lookup than dict was. I'm not sure if 17,000 is supposed to be past the limits, but it sure was in my case :) --Rob From rpettit@REDACTED Fri Feb 9 20:41:09 2007 From: rpettit@REDACTED (Rick Pettit) Date: Fri, 9 Feb 2007 13:41:09 -0600 Subject: [erlang-questions] erlang shell command editing Message-ID: <20070209194109.GA671@vailsys.com> When typing commands into the erlang shell one notices that the cursor occassionally jumps around (e.g. in order to match ()'s). Is there a way to disable this behavior at the erlang shell, so that only literal keystrokes entered by the user are echoed? Doing so would help with automated testing using dejagnu (Tcl/Expect), which seems to get confused by the cursor motion. -Rick From vladdu55@REDACTED Fri Feb 9 22:49:52 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 9 Feb 2007 21:49:52 +0000 Subject: [erlang-questions] [OT] cool tools Message-ID: <95be1d3b0702091349v7fad10a8vd2cbce415340a275@mail.gmail.com> Hi all, Sorry for the noise, but it looks like the legacy of Jef Raskin (of The Humane Interface fame) has finally concretised into some very cool tools. Check out http://www.humanized.com/ (it looks like it'f for Windows only, so far), but everybody can check the videos. best regards, Vlad From raimo+erlang-questions@REDACTED Sat Feb 10 00:01:26 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Sat, 10 Feb 2007 00:01:26 +0100 Subject: [erlang-questions] erlang shell command editing In-Reply-To: <20070209194109.GA671@vailsys.com> References: <20070209194109.GA671@vailsys.com> Message-ID: <20070209230126.GA4668@erix.ericsson.se> You can try using the commandline flag -oldshell that spawns a much more rudimentary (and perhaps predictable) shell. On Fri, Feb 09, 2007 at 01:41:09PM -0600, Rick Pettit wrote: > When typing commands into the erlang shell one notices that the cursor > occassionally jumps around (e.g. in order to match ()'s). Is there a way > to disable this behavior at the erlang shell, so that only literal keystrokes > entered by the user are echoed? > > Doing so would help with automated testing using dejagnu (Tcl/Expect), which > seems to get confused by the cursor motion. > > -Rick > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From luke@REDACTED Sat Feb 10 13:35:37 2007 From: luke@REDACTED (LUKE) Date: Sat, 10 Feb 2007 20:35:37 +0800 Subject: [erlang-questions] What is the OTP? References: <20070209194109.GA671@vailsys.com> <20070209230126.GA4668@erix.ericsson.se> Message-ID: <000801c74d0f$f9e34da0$0c01a8c0@lukeserver> I have seen some document about erlang. But i still can not understand what is the OTP. And the relation between erlang and OTP. From matthias@REDACTED Sat Feb 10 22:10:01 2007 From: matthias@REDACTED (Matthias Lang) Date: Sat, 10 Feb 2007 22:10:01 +0100 Subject: [erlang-questions] What is the OTP? In-Reply-To: <000801c74d0f$f9e34da0$0c01a8c0@lukeserver> References: <20070209194109.GA671@vailsys.com> <20070209230126.GA4668@erix.ericsson.se> <000801c74d0f$f9e34da0$0c01a8c0@lukeserver> Message-ID: <17870.13481.455639.791825@antilipe.corelatus.se> LUKE writes: > I have seen some document about erlang. > But i still can not understand what is the OTP. > And the relation between erlang and OTP. The first two questions in the Erlang FAQ are: | 1.1. In a nutshell, what is Erlang? | | Erlang is a general-purpose programming language and runtime | environment. Erlang has built-in support for concurrency, distribution | and fault tolerance. Erlang is used in several large telecommunication | systems from Ericsson. The most popular implementation of Erlang is | available as open source from the open source erlang site. | | 1.2. What is OTP? | | OTP is a large collection of libraries for Erlang to do everything | from compiling ASN.1 to providing a WWW server. Most projects using | "Erlang" are actually using "Erlang/OTP", i.e. the language and the | libraries. OTP is also open source. | http://www.erlang.org/faq/t1.html#AEN14 Matthias From luke@REDACTED Sun Feb 11 00:10:22 2007 From: luke@REDACTED (LUKE) Date: Sun, 11 Feb 2007 07:10:22 +0800 Subject: [erlang-questions] What is the OTP? References: <20070209194109.GA671@vailsys.com><20070209230126.GA4668@erix.ericsson.se><000801c74d0f$f9e34da0$0c01a8c0@lukeserver> <17870.13481.455639.791825@antilipe.corelatus.se> Message-ID: <000601c74d68$a6cabaf0$0c01a8c0@lukeserver> Thanks for your reply. I had seen those document before. But it does not accurate explain the OTP. (I am not come from english-speaking countries) Have some more explanations or examples about this. ie. The OTP is like stdlib in c. Or The OTP is like Net::LDAP module in perl. The OTP is write in erlang ? What is difference between BIFs and OTP? ----- Original Message ----- From: "Matthias Lang" To: "LUKE" Cc: Sent: Sunday, February 11, 2007 5:10 AM Subject: Re: [erlang-questions] What is the OTP? > LUKE writes: > > I have seen some document about erlang. > > But i still can not understand what is the OTP. > > And the relation between erlang and OTP. > > The first two questions in the Erlang FAQ are: > > | 1.1. In a nutshell, what is Erlang? > | > | Erlang is a general-purpose programming language and runtime > | environment. Erlang has built-in support for concurrency, distribution > | and fault tolerance. Erlang is used in several large telecommunication > | systems from Ericsson. The most popular implementation of Erlang is > | available as open source from the open source erlang site. > | > | 1.2. What is OTP? > | > | OTP is a large collection of libraries for Erlang to do everything > | from compiling ASN.1 to providing a WWW server. Most projects using > | "Erlang" are actually using "Erlang/OTP", i.e. the language and the > | libraries. OTP is also open source. > > | http://www.erlang.org/faq/t1.html#AEN14 > > Matthias > > __________ NOD32 2050 (20070210) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > From raimo+erlang-questions@REDACTED Sun Feb 11 00:55:31 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Sun, 11 Feb 2007 00:55:31 +0100 Subject: [erlang-questions] : What is the OTP? In-Reply-To: <000601c74d68$a6cabaf0$0c01a8c0@lukeserver> References: <17870.13481.455639.791825@antilipe.corelatus.se> <000601c74d68$a6cabaf0$0c01a8c0@lukeserver> Message-ID: <20070210235531.GA4435@erix.ericsson.se> On Sun, Feb 11, 2007 at 07:10:22AM +0800, LUKE wrote: > Thanks for your reply. > I had seen those document before. But it does not accurate explain the OTP. > (I am not come from english-speaking countries) Have some more explanations > or examples about this. > ie. The OTP is like stdlib in c. Or The OTP is like Net::LDAP module in > perl. Well, OTP is more like what stdlib + libsocket + libnsl + all lib... you get in a standard linux default installation is for C. Or for perl all perl support librarie you get in a standard perl installation + some more. Some feature normally not found in a standard C or standard perl installation is a real-time distributed database 'mnesia', a Corba implementation 'orber' and probably quite some more. Browse the documentation. > The OTP is write in erlang ? What is difference between BIFs and OTP? BIFs are elements of the Erlang language (not OTP) that does not have a separate syntax hence look like ordinary Erlang function calls. E.g to register a name you use erlang:register(Name, Pid) while to send to the process with that name you use the special syntax Name ! Message, or the BIF erlang:send(Name, Message). OTP is support libraries that is not part of the Erlang language. Sometimes the difference gets technical. lists:reverse(List, Tail) in stdlib is implemented in C in the runtime system but is hard to regard as a part of the language. > > > ----- Original Message ----- > From: "Matthias Lang" > To: "LUKE" > Cc: > Sent: Sunday, February 11, 2007 5:10 AM > Subject: Re: [erlang-questions] What is the OTP? > > > > LUKE writes: > > > I have seen some document about erlang. > > > But i still can not understand what is the OTP. > > > And the relation between erlang and OTP. > > > > The first two questions in the Erlang FAQ are: > > > > | 1.1. In a nutshell, what is Erlang? > > | > > | Erlang is a general-purpose programming language and runtime > > | environment. Erlang has built-in support for concurrency, distribution > > | and fault tolerance. Erlang is used in several large telecommunication > > | systems from Ericsson. The most popular implementation of Erlang is > > | available as open source from the open source erlang site. > > | > > | 1.2. What is OTP? > > | > > | OTP is a large collection of libraries for Erlang to do everything > > | from compiling ASN.1 to providing a WWW server. Most projects using > > | "Erlang" are actually using "Erlang/OTP", i.e. the language and the > > | libraries. OTP is also open source. > > > > | http://www.erlang.org/faq/t1.html#AEN14 > > > > Matthias > > > > __________ NOD32 2050 (20070210) Information __________ > > > > This message was checked by NOD32 antivirus system. > > http://www.eset.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From joelr1@REDACTED Sun Feb 11 03:00:04 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 11 Feb 2007 02:00:04 +0000 Subject: [erlang-questions] Java RMI Message-ID: <93D703CA-19DD-40BB-966A-432880E3C1B2@gmail.com> Has anyone tried to implement the Java RMI protocol to connect to a remote EJB server like Weblogic? Thanks, Joel -- http://wagerlabs.com/ From luke@REDACTED Sun Feb 11 06:49:52 2007 From: luke@REDACTED (LUKE) Date: Sun, 11 Feb 2007 13:49:52 +0800 Subject: [erlang-questions] Give me some advice Message-ID: <007001c74da0$751a6a40$bd01a8c0@lukeserver> I am tring to do the excise about return a new tuple which is a copy of the tuple T where the Nth element of the tuple has been replaced by C. Give me some advice on the following poor code. ie. tail recursion issue..... -module(element). -export([set2/3]). set2(N,T,C)->list_to_tuple(set2(N,tuple_to_list(T),C,1)). set2(_,[],_,_)->[]; set2(N,[H|T],C,Count)-> if N==Count ->[C|set2(N,T,C,Count+1)]; true->[H|set2(N,T,C,Count+1)] end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Sun Feb 11 09:35:27 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Sun, 11 Feb 2007 09:35:27 +0100 Subject: [erlang-questions] a little erlang mentioning on slashdot Message-ID: <45CED54F.5050608@ericsson.com> greetings, not a question unless i formulate it like this: isn't this (http://developers.slashdot.org/developers/07/02/10/2014255.shtml) erlang on slashdot? 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." From ulf@REDACTED Sun Feb 11 10:46:34 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Feb 2007 10:46:34 +0100 Subject: [erlang-questions] Give me some advice In-Reply-To: <007001c74da0$751a6a40$bd01a8c0@lukeserver> References: <007001c74da0$751a6a40$bd01a8c0@lukeserver> Message-ID: Den 2007-02-11 06:49:52 skrev LUKE : > > I am tring to do the excise about return a new tuple > which is a copy of the tuple T where the Nth element > of the tuple has been replaced by C. ... trying to write an erlang-based version of the built-in function setelement(N, T, C)? > Give me some advice on the following poor code. ie. > tail recursion issue..... > > -module(element). > -export([set2/3]). > > set2(N,T,C)-> > list_to_tuple(set2(N,tuple_to_list(T),C,1)). > > set2(_,[],_,_)->[]; > set2(N,[H|T],C,Count)-> > if N==Count -> > [C|set2(N,T,C,Count+1)]; > true-> > [H|set2(N,T,C,Count+1)] > end. (1) This is mainly a matter of taste, but I would order the arguments of set2 differently (2) When you get to the right position, you don't have to recurse any further, since you're guaranteed not to find another match. set2([_|T], N, N, C) -> [C|T]; set2([H|T], Pos, N, C) when Pos < N -> [H|set2(T, Pos+1, N, C)]. (3) You don't need a clause for [], if you add a guard in set2/3: set2(N,T,C) when is_tuple(T), is_integer(N), N > 0, N =< size(T) -> list_to_tuple(set2(tuple_to_list(T),1,N,C)). (4) It's good form to use guards in the exported function to clearly indicate what the arguments are expected to be. Don't worry about this slowing down your code. It most likely won't, and in some cases, it can even speed things up, since the compiler is able to make some assumptions about the code that follows. (5) In this case, I wouldn't worry about the function not being tail-recursive. Doing it this way makes it a lot easier to break out of the loop once you've reached N. Also, your tuple is not likely to have a huge number of elements to begin with. BR, Ulf W -- Ulf Wiger From denis.bilenko@REDACTED Sun Feb 11 19:26:11 2007 From: denis.bilenko@REDACTED (Denis Bilenko) Date: Mon, 12 Feb 2007 00:26:11 +0600 Subject: [erlang-questions] how to open_port with spaces in path? Message-ID: <95d6e98c0702111026t17ffc437l704f7f2e296c0909@mail.gmail.com> Hello, I'm trying to execute external program which happened to have spaces in path (not uncommon on windows). open_port exits with einval: 56> open_port({spawn, "D:/a a/my.exe"}, []). =ERROR REPORT==== 11-Feb-2007::23:59:35 === Error in process <0.102.0> with exit value: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** I've tried to use quotes 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). it doesn't change anything. Googling revealed this: Known problems * os:cmd on WIN32 does not always catch the output from the executed program correctly. There is also a problem with executing programs with space in the path. http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html It was not fixed? Are there any workarounds? erl: 5.5.3 os: winxp /Denis. From autophile@REDACTED Sun Feb 11 21:55:54 2007 From: autophile@REDACTED (Robert Baruch) Date: Sun, 11 Feb 2007 15:55:54 -0500 Subject: [erlang-questions] Problem with code:priv_dir Message-ID: Hi all, Here's my scenario, running R11B-2. In my home directory, I have the following directories: mytest-0.1/ mytest-0.1/ebin/ Now, I fire up the erl shell and try to run code:priv_dir(mytest): ekmac:~ ek$ erl Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.2 (abort with ^G) 1> code:priv_dir(mytest). {error,bad_name} 2> code:get_path(). [".", "/usr/local/lib/erlang/lib/kernel-2.11.2/ebin", "/usr/local/lib/erlang/lib/stdlib-1.14.2/ebin", "/usr/local/lib/erlang/lib/xmerl-1.0.5/ebin", (and so on) Now, what I don't get is that the documentation for code:priv_dir/1 says: "Searches the code path for a directory named .../Name[-Vsn][/ebin] and returns the directory .../Name[-Vsn]/priv. It is not checked if this directory really exists." Code path contains "." ... check. ./mytest-0.1/ebin ... check. So why isn't priv_dir/1 returning "./mytest-0.1/priv"? Thanks for any help! --Rob From vladdu55@REDACTED Sun Feb 11 22:39:26 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 11 Feb 2007 21:39:26 +0000 Subject: [erlang-questions] Problem with code:priv_dir In-Reply-To: References: Message-ID: <95be1d3b0702111339xf9c7784y80e3f1216f3819b3@mail.gmail.com> Hi, On 2/11/07, Robert Baruch wrote: > Now, what I don't get is that the documentation for code:priv_dir/1 > says: > > "Searches the code path for a directory named .../Name[-Vsn][/ebin] > and returns the directory .../Name[-Vsn]/priv. It is not checked if > this directory really exists." > > Code path contains "." ... check. > ./mytest-0.1/ebin ... check. I believe (but am not completely sure) that the "..." above has nothing to do with a ".." meaning the parent directory in a path, but is an ellipsis for any prefix string. This would mean that "." doesn't match that pattern and thus the error message. You'll have to add "/path/to/mytest-0.1/ebin" to the code path (or even "../../mytest-0.1/ebin") best regards, Vlad From igwan@REDACTED Sun Feb 11 23:12:49 2007 From: igwan@REDACTED (igwan) Date: Sun, 11 Feb 2007 23:12:49 +0100 Subject: [erlang-questions] [Bug] io:setopts and expand_fun option Message-ID: <45CF94E1.8000506@free.fr> Hello, I encountered a problem while playing with io:setopts trying to set the expand_fun option : 5> Completion = fun("") -> {yes, "start", ["start", "stop"]}; 5> (_) -> {no, "", ["start", "stop"]} end. #Fun 6> io:setopts([{expand_fun, Completion}]). {error,badarg} 7> io:setopts([binary]). ok 8> io:setopts([binary, {expand_fun, Completion}]). ok The problem is that setopts doesn't accept the 'expand_fun' option alone, it has to be provided along with either 'binary' or 'list' options. This is not stated in the documentation. The faulty code seems to be located in kernel/group.erl : %% setopts setopts(Opts0,_Drv, Buf) -> Opts = proplists:substitute_negations([{list,binary}], Opts0), put(expand_fun, proplists:get_value(expand_fun, Opts, get(expand_fun))), case proplists:get_value(binary, Opts) of true -> put(read_mode,binary), {ok,ok,Buf}; false -> put(read_mode,list), {ok,ok,Buf}; _ -> {error,{error,badarg},Buf} end. expand_fun is put in the process dictionary even if we get a {error, badarg} in response. I think it is not the intended behaviour. At least, it doesn't meet my expectation of "least astonishment" :) igwan From jeffm@REDACTED Mon Feb 12 00:36:49 2007 From: jeffm@REDACTED (jm) Date: Mon, 12 Feb 2007 10:36:49 +1100 Subject: [erlang-questions] mnesia:subscribe doco and examples? In-Reply-To: References: <45CA70BF.1080506@ghostgun.com> Message-ID: <45CFA891.7080505@ghostgun.com> Hakan Mattsson wrote: > Here is a small example? > > # erl > Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [kernel-poll:false] > > Eshell V5.5.3 (abort with ^G) > 1> mnesia:start(). > ok > 2> mnesia:create_table(t,[]). > {atomic,ok} > 3> mnesia:subscribe({table, t}). > {ok,nonode@REDACTED} > 4> mnesia:dirty_write(t, {t,12,4 2}). > ok > 5> mnesia:dirty_write(t, {t, 12, 43}). > ok > 6> mnesia:dirty_delete(t, 12). > ok > 7> flush(). > Shell got {mnesia_table_event,{write,{t,12,42},{dirty,<0.30.0>}}} > Shell got {mnesia_table_event,{write,{t,12,43},{dirty,<0.30.0>}}} > Shell got {mnesia_table_event,{delete,{t,12},{dirty,<0.30.0>}}} > ok > 8> > Alright. So if this process was implemented using the gen_server behavior, the process should see these messages via handle_info()? Yeap, just tested that. this appears to be were I'm going wrong. I have a mistake in the function patterns. Thanks. Jeff. From fipar@REDACTED Mon Feb 12 00:48:10 2007 From: fipar@REDACTED (Fernando Ipar) Date: Sun, 11 Feb 2007 21:48:10 -0200 Subject: [erlang-questions] Executing external commands Message-ID: <45CFAB3A.6030008@seriema-systems.com> Hi all. I'm looking for a way to run external commands in erlang and get it's exit code back to erlang. As far as I understand, os:cmd(Command) only returns the output of running the program. Is there a way to get the exit code from the command, or do I have to implement an external program to run these commands and communicate back and forth with erlang through a port? What I'm looking for is something like: os:cmdwithexit(Command,ExitCode), case ExitCode of 0 -> handleExitOk(Command); _ -> handleExitError(Command,ExitCode) end. Thanks and regards, Fernando. From jeffm@REDACTED Mon Feb 12 02:45:01 2007 From: jeffm@REDACTED (jm) Date: Mon, 12 Feb 2007 12:45:01 +1100 Subject: [erlang-questions] a little erlang mentioning on slashdot In-Reply-To: <45CED54F.5050608@ericsson.com> References: <45CED54F.5050608@ericsson.com> Message-ID: <45CFC69D.5060003@ghostgun.com> Bengt Kleberg wrote: > greetings, > > not a question unless i formulate it like this: > isn't this > (http://developers.slashdot.org/developers/07/02/10/2014255.shtml) > erlang on slashdot? > Buried in the comments was a link to http://video.google.com/videoplay?docid=-5830318882717959520 which appears to be an erlang (internal?) promotional video on erlang was may be of interest to some, who like myself, had not seen it. Jeff. From jeffm@REDACTED Mon Feb 12 02:51:58 2007 From: jeffm@REDACTED (jm) Date: Mon, 12 Feb 2007 12:51:58 +1100 Subject: [erlang-questions] mnesia and lists Message-ID: <45CFC83E.6010406@ghostgun.com> How do you handle records which contain lists in mnesia? Does it handle it automatically or like other database systems do you have to map the list entries to rows in the table? I image the latter, but if there's a clever way to do this I'd like to know. It's always the simple things that cause you to stumble hence all these simplistic question I'm asking. The "hard" questions are easy. Jeff. From bob@REDACTED Mon Feb 12 03:39:59 2007 From: bob@REDACTED (Bob Ippolito) Date: Sun, 11 Feb 2007 18:39:59 -0800 Subject: [erlang-questions] mnesia and lists In-Reply-To: <45CFC83E.6010406@ghostgun.com> References: <45CFC83E.6010406@ghostgun.com> Message-ID: <6a36e7290702111839i4a8acdc9k46a74625e38350df@mail.gmail.com> On 2/11/07, jm wrote: > How do you handle records which contain lists in mnesia? Does it handle > it automatically or like other database systems do you have to map the > list entries to rows in the table? I image the latter, but if there's a > clever way to do this I'd like to know. It's always the simple things > that cause you to stumble hence all these simplistic question I'm > asking. The "hard" questions are easy. You just do it. Mnesia doesn't care what's in your record, it'll serialize anything. -bob From erlangx@REDACTED Mon Feb 12 04:58:36 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Sun, 11 Feb 2007 19:58:36 -0800 Subject: [erlang-questions] Executing external commands In-Reply-To: <45CFAB3A.6030008@seriema-systems.com> References: <45CFAB3A.6030008@seriema-systems.com> Message-ID: <20070212035836.GU30423@delora.autosys.us> following works on Linux ... $ uname -a Linux delora 2.6.17-10-386 #2 Fri Oct 13 18:41:40 UTC 2006 i686 GNU/Linux $ erl Erlang (BEAM) emulator version 5.5.3 [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.3 (abort with ^G) 1> os:cmd("/bin/ls fubar; echo $?"). "/bin/ls: fubar: No such file or directory\n2\n" 2> os:cmd("/bin/ls foo; echo $?"). "foo\n0\n" 3> init:stop(). 4> $ $ You can then parse out the return value from the echo. There are probably other ways to get the result you are looking for. I think this discussion came up a few months ago. The above is the result of the particular shell called. ~Michael On Sun, Feb 11, 2007 at 09:48:10PM -0200, Fernando Ipar wrote: > Hi all. > > I'm looking for a way to run external commands in erlang and get it's > exit code back to erlang. > As far as I understand, os:cmd(Command) only returns the output of > running the program. > > Is there a way to get the exit code from the command, or do I have to > implement an external program to run these commands and communicate > back and forth with erlang through a port? > > What I'm looking for is something like: > > os:cmdwithexit(Command,ExitCode), > case ExitCode of > 0 -> > handleExitOk(Command); > _ -> > handleExitError(Command,ExitCode) > end. > > > Thanks and regards, > > Fernando. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,45cfab6b18342038938978! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From jeffm@REDACTED Mon Feb 12 05:30:52 2007 From: jeffm@REDACTED (jm) Date: Mon, 12 Feb 2007 15:30:52 +1100 Subject: [erlang-questions] mnesia and lists In-Reply-To: <6a36e7290702111839i4a8acdc9k46a74625e38350df@mail.gmail.com> References: <45CFC83E.6010406@ghostgun.com> <6a36e7290702111839i4a8acdc9k46a74625e38350df@mail.gmail.com> Message-ID: <45CFED7C.5020701@ghostgun.com> Bob Ippolito wrote: > You just do it. Mnesia doesn't care what's in your record, it'll > serialize anything. Thanks, Just a dumb question that I couldn't find an explicit answer to. Jeff. From bob@REDACTED Mon Feb 12 06:00:45 2007 From: bob@REDACTED (Bob Ippolito) Date: Sun, 11 Feb 2007 21:00:45 -0800 Subject: [erlang-questions] mnesia and lists In-Reply-To: <45CFED7C.5020701@ghostgun.com> References: <45CFC83E.6010406@ghostgun.com> <6a36e7290702111839i4a8acdc9k46a74625e38350df@mail.gmail.com> <45CFED7C.5020701@ghostgun.com> Message-ID: <6a36e7290702112100v59b8455t14ee1868d8c2f391@mail.gmail.com> On 2/11/07, jm wrote: > Bob Ippolito wrote: > > > You just do it. Mnesia doesn't care what's in your record, it'll > > serialize anything. > > > Thanks, Just a dumb question that I couldn't find an explicit answer to. Well, the example record uses a list :) It also doesn't take a whole lot of effort to just try it, the shell is interactive. -bob From jeffm@REDACTED Mon Feb 12 06:23:26 2007 From: jeffm@REDACTED (jm) Date: Mon, 12 Feb 2007 16:23:26 +1100 Subject: [erlang-questions] mnesia and lists In-Reply-To: <6a36e7290702112100v59b8455t14ee1868d8c2f391@mail.gmail.com> References: <45CFC83E.6010406@ghostgun.com> <6a36e7290702111839i4a8acdc9k46a74625e38350df@mail.gmail.com> <45CFED7C.5020701@ghostgun.com> <6a36e7290702112100v59b8455t14ee1868d8c2f391@mail.gmail.com> Message-ID: <45CFF9CE.3070602@ghostgun.com> Bob Ippolito wrote: > Well, the example record uses a list :) Your right. I was looking at the employee example in the Mnesia User Guide not the manual entry for mnenia as I thought the user guide show would such an example as cover it in more detail. I've got bath printed out and hi-lighted in various places and still missed it. Although, in my defence it's one line in 28 pages. :-) > It also doesn't take a whole lot of effort to just try it, the shell > is interactive. Getting there slowly. Already run quite a bit from the shell. Actually more interested in writing unit tests for a few of the modules I curretly have lying around now to save me from typing the same tests over and over. Jeff. From raimo+erlang-questions@REDACTED Mon Feb 12 09:57:24 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 12 Feb 2007 09:57:24 +0100 Subject: [erlang-questions] : Executing external commands In-Reply-To: <20070212035836.GU30423@delora.autosys.us> References: <45CFAB3A.6030008@seriema-systems.com> <20070212035836.GU30423@delora.autosys.us> Message-ID: <20070212085724.GA29136@erix.ericsson.se> You can also write an improved os:cmd/1 by using erlang:open_port({spawn,"command"}, [{line,80},exit_status,eof,stderr_to_stdout]) and then loop receive all messages from the port to collect the output and exit status. It is less than one page of code. I have done it a few times but right now I am in a hurry... On Sun, Feb 11, 2007 at 07:58:36PM -0800, Michael McDaniel wrote: > following works on Linux ... > > $ uname -a > Linux delora 2.6.17-10-386 #2 Fri Oct 13 18:41:40 UTC 2006 i686 GNU/Linux > > $ erl > Erlang (BEAM) emulator version 5.5.3 [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.5.3 (abort with ^G) > 1> os:cmd("/bin/ls fubar; echo $?"). > "/bin/ls: fubar: No such file or directory\n2\n" > 2> os:cmd("/bin/ls foo; echo $?"). > "foo\n0\n" > 3> init:stop(). > 4> $ > $ > > You can then parse out the return value from the echo. There are > probably other ways to get the result you are looking for. > > I think this discussion came up a few months ago. The above is the result > of the particular shell called. > > ~Michael > > > On Sun, Feb 11, 2007 at 09:48:10PM -0200, Fernando Ipar wrote: > > Hi all. > > > > I'm looking for a way to run external commands in erlang and get it's > > exit code back to erlang. > > As far as I understand, os:cmd(Command) only returns the output of > > running the program. > > > > Is there a way to get the exit code from the command, or do I have to > > implement an external program to run these commands and communicate > > back and forth with erlang through a port? > > > > What I'm looking for is something like: > > > > os:cmdwithexit(Command,ExitCode), > > case ExitCode of > > 0 -> > > handleExitOk(Command); > > _ -> > > handleExitError(Command,ExitCode) > > end. > > > > > > Thanks and regards, > > > > Fernando. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > !DSPAM:52,45cfab6b18342038938978! > > > > > > -- > Michael McDaniel > Portland, Oregon, USA > http://autosys.us > +1 503 283 5284 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From richardc@REDACTED Mon Feb 12 10:04:20 2007 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 12 Feb 2007 10:04:20 +0100 Subject: [erlang-questions] Executing external commands In-Reply-To: <45CFAB3A.6030008@seriema-systems.com> References: <45CFAB3A.6030008@seriema-systems.com> Message-ID: <45D02D94.2080702@it.uu.se> Fernando Ipar wrote: > I'm looking for a way to run external commands in erlang and get it's > exit code back to erlang. > As far as I understand, os:cmd(Command) only returns the output of > running the program. > > Is there a way to get the exit code from the command, or do I have to > implement an external program to run these commands and communicate > back and forth with erlang through a port? You can roll your own version of command/1. I use a piece of code like the following to run external commands in EUnit: command(Cmd) -> Opt = [stream, exit_status, use_stdio, stderr_to_stdout, in, eof], P = open_port({spawn, Cmd}, Opt), get_data(P, []). get_data(P, D) -> receive {P, {data, D1}} -> get_data(P, [D|D1]); {P, eof} -> port_close(P), receive {P, {exit_status, N}} -> {N, lists:reverse(D)} end end. /Richard From rrerlang@REDACTED Mon Feb 12 10:28:16 2007 From: rrerlang@REDACTED (Robert Raschke) Date: Mon, 12 Feb 2007 09:28:16 +0000 Subject: [erlang-questions] how to open_port with spaces in path? In-Reply-To: <95d6e98c0702111026t17ffc437l704f7f2e296c0909@mail.gmail.com> Message-ID: Denis Bilenko wrote: > I'm trying to execute external program which happened to have spaces in > path (not uncommon on windows). open_port exits with einval: > > 56> open_port({spawn, "D:/a a/my.exe"}, []). > > =ERROR REPORT==== 11-Feb-2007::23:59:35 === > Error in process <0.102.0> with exit value: > {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval > ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > I've tried to use quotes > > 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). > > it doesn't change anything. > I have not tried this with Erlang, so it may very well not do any good. But in other applications, where I have to execute an external program on Windows, I have a brute force approach. I double quote every thing that is meant to be one entity (or argument), and then to execute it I double quote the whole lot. Thus C:\Program Files\MyProg\myprog.exe arg1 "arg 2 and some" arg3 gets passed to the Windows bit as ""C:\Program Files\MyProg\myprog.exe arg1" "arg 2 and some" "arg3"" If I remember correctly the initial double double qoute makes the Windows cmd enter into some special way of reading the rest of the command. I have forgotten where I picked that up though. Sorry. Robby -- r dot raschke at tombob dot com From denis.bilenko@REDACTED Mon Feb 12 10:57:22 2007 From: denis.bilenko@REDACTED (Denis Bilenko) Date: Mon, 12 Feb 2007 15:57:22 +0600 Subject: [erlang-questions] Executing external commands In-Reply-To: <45D02D94.2080702@it.uu.se> References: <45CFAB3A.6030008@seriema-systems.com> <45D02D94.2080702@it.uu.se> Message-ID: <95d6e98c0702120157h567a3b4bjabe16df512da557c@mail.gmail.com> With similar code, sometimes I don't receive {P, {exit_status, ..}. I'm using windows, so it may be windows-specific. I've added after clause to prevent hanging: get_data(P, D) -> receive {P, {data, D1}} -> get_data(P, [D|D1]); {P, eof} -> port_close(P), Status = receive {P, {exit_status, N}} -> N; after 1 -> timeout end, {Status, lists:reverse(D)} end end. It would be interesting to know why a message can get lost. (or why open_port forget to send one). There's no heavy load and flush() doesn't report lost messages. On 2/12/07, Richard Carlsson wrote: > You can roll your own version of command/1. I use a piece of code > like the following to run external commands in EUnit: > > command(Cmd) -> > Opt = [stream, exit_status, use_stdio, > stderr_to_stdout, in, eof], > P = open_port({spawn, Cmd}, Opt), > get_data(P, []). > > get_data(P, D) -> > receive > {P, {data, D1}} -> > get_data(P, [D|D1]); > {P, eof} -> > port_close(P), > receive > {P, {exit_status, N}} -> > {N, lists:reverse(D)} > end > end. > > /Richard From ulf.wiger@REDACTED Mon Feb 12 11:01:38 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 12 Feb 2007 11:01:38 +0100 Subject: [erlang-questions] labeled_exports Message-ID: <6616D98C65DD514BA2E1DDC5F9223155F2186A@esealmw115.eemea.ericsson.se> In stdlib-1.10, support for the 'labeled_exports' chunk was added to beam_lib. What are labeled_exports? BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Mon Feb 12 11:31:57 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 12 Feb 2007 11:31:57 +0100 Subject: [erlang-questions] labeled_exports In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155F2186A@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F9223155F2186A@esealmw115.eemea.ericsson.se> Message-ID: The entry label for each exported function is also included. It is needed by the beam_disasm module. /Bjorn "Ulf Wiger \(TN/EAB\)" writes: > In stdlib-1.10, support for the 'labeled_exports' chunk was added to > beam_lib. > > What are labeled_exports? > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From fipar@REDACTED Mon Feb 12 14:10:38 2007 From: fipar@REDACTED (Fernando Ipar) Date: Mon, 12 Feb 2007 11:10:38 -0200 Subject: [erlang-questions] Executing external commands In-Reply-To: <45D02D94.2080702@it.uu.se> References: <45CFAB3A.6030008@seriema-systems.com> <45D02D94.2080702@it.uu.se> Message-ID: <45D0674E.5040104@seriema-systems.com> Thanks a lot to everyone who replied. I messed up some of my replies by not sending them to the list, I'm sorry for the out of list e-mails some of you got! The port suggestion by Raimo and Richard are very good. Richard's code runs perfectly on my linux system, and I can get the ExitCode with no problems. One small question though: After looking at the list D, I was under the impression it would be a list of ASCII codes, but list_to_atom(D) exits with badarg. How do you get the output from that list?. Michael's suggestion was great too, and if you're running just on unix it's probably easier. Here's a function, based on his examples, that returns {ExitCode, Output} check(Command) -> Output = os:cmd(Command ++ ";echo $?"), {match, Start, Length} = regexp:first_match(Output,".*\n[0-9][0-9]*\n"), Pos = (Start + Length) - 2, { string:substr(Output,Pos,1), Output}. Here are two sample runs: ext:check("ls /bin"). {"0", "alsacard\nalsaunmute\narch\nawk\nbasename\nbash\ncat\nchgrp\nchmod\nchown\ncp\ncpio\ncsh\ncut\ndate\ndbus-cleanup-sockets\ndbus-daemon\ndbus-send\ndd\ndf\ndmesg\ndnsdomainname\ndoexec\ndomainname\ndumpkeys\necho\ned\negrep\nenv\nex\nfalse\nfgrep\ngawk\ngettext\ngrep\ngtar\ngunzip\ngzip\nhostname\nigawk\nipcalc\nkbd_mode\nkill\nksh\nlink\nln\nloadkeys\nlogin\nls\nmail\nmailx\nmkdir\nmknod\nmktemp\nmore\nmount\nmountpoint\nmv\nnetstat\nnice\nnisdomainname\npgawk\nping\nping6\nps\npwd\nred\nrm\nrmdir\nrpm\nrvi\nrview\nsed\nsetfont\nsetserial\nsh\nsleep\nsort\nstty\nsu\nsync\ntar\ntcsh\ntouch\ntracepath\ntracepath6\ntraceroute\ntraceroute6\ntrue\numount\nuname\nunicode_start\nunicode_stop\nunlink\nusleep\nvi\nview\nypdomainname\nzcat\n0\n"} 4> ext:check("lsss /bin"). {"7","sh: line 1: lsss: command not found\n127\n"} 5> Thanks again for all the help. Fernando. From richardc@REDACTED Mon Feb 12 14:38:59 2007 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 12 Feb 2007 14:38:59 +0100 Subject: [erlang-questions] Executing external commands In-Reply-To: <45D0674E.5040104@seriema-systems.com> References: <45CFAB3A.6030008@seriema-systems.com> <45D02D94.2080702@it.uu.se> <45D0674E.5040104@seriema-systems.com> Message-ID: <45D06DF3.8030104@it.uu.se> Fernando Ipar wrote: > One small question though: > After looking at the list D, I was under the impression it would be a > list of ASCII codes, but list_to_atom(D) exits > with badarg. How do you get the output from that list?. As returned from my example, the output is a deep list. This can be used directly as a "string" with many I/O functions, but for other functions such as list_to_atom/1 you need to call lists:flatten(D) to get a flat list of characters (i.e., a normal string). /Richard From serge@REDACTED Mon Feb 12 14:44:06 2007 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 12 Feb 2007 08:44:06 -0500 Subject: [erlang-questions] how to open_port with spaces in path? In-Reply-To: <95d6e98c0702111026t17ffc437l704f7f2e296c0909@mail.gmail.com> References: <95d6e98c0702111026t17ffc437l704f7f2e296c0909@mail.gmail.com> Message-ID: <45D06F26.20203@hq.idt.net> Since this seems to be a known bug, you may try some workarounds. The most obvious one is to rename a directory so that it doesn't contain spaces. The less obvious one is to find out what is the "short name" of a directory, and use that instead: c:\temp>dir /X /AD "a*" Volume in drive C is unlabeled Serial number is 381F:4FF1 Directory of C:\temp\a* 2/12/07 8:31 AA0919~1 a a 0 bytes in 0 files and 1 dir 3,814,490,112 bytes free In the example above "AA0919~1" is the equivalent name of the "a a" directory: c:\temp>dir "AA0919~1" Volume in drive C is unlabeled Serial number is 381F:4FF1 Directory of C:\temp\AA0919~1\* 2/12/07 8:31 . 2/12/07 8:31 .. 2/12/07 8:31 0 my.exe 0 bytes in 1 file and 2 dirs 0 bytes allocated 3,814,490,112 bytes free Serge P.S. This second workaround doesn't seem very appealing, but if you can't possibly change directory names, this may be your only option. Denis Bilenko wrote: > Hello, > I'm trying to execute external program which happened to have spaces in > path (not uncommon on windows). open_port exits with einval: > > 56> open_port({spawn, "D:/a a/my.exe"}, []). > > =ERROR REPORT==== 11-Feb-2007::23:59:35 === > Error in process <0.102.0> with exit value: > {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval > ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > I've tried to use quotes > > 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). > > it doesn't change anything. > > Googling revealed this: > Known problems > * os:cmd on WIN32 does not always catch the output from the executed program > correctly. There is also a problem with executing programs with > space in the path. > http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html > > It was not fixed? Are there any workarounds? > > erl: 5.5.3 > os: winxp > > /Denis. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From chsu79@REDACTED Mon Feb 12 15:21:50 2007 From: chsu79@REDACTED (Christian S) Date: Mon, 12 Feb 2007 15:21:50 +0100 Subject: [erlang-questions] string/iolist survey Message-ID: Status check/survey: What set of values do we refer to when talking about the type string()? I see iolist() used frequently as to be explicit that one mean the nested-lists-and-binaries. In docs for module io_lib the type chars() is introduced and defined as: chars() = [char() | chars()]. To exclude binaries. string() = [char()] ? From eric.melbardis@REDACTED Mon Feb 12 15:26:32 2007 From: eric.melbardis@REDACTED (Eric P. Melbardis) Date: Mon, 12 Feb 2007 06:26:32 -0800 Subject: [erlang-questions] how to open_port with spaces in path? Message-ID: With r10 & windows platform, you can use filename:nativename(FullPathName) works the best, since the file name mangling is dynamic! (ie relative to other similar file names!) regards -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Serge Aleynikov Sent: Monday, February 12, 2007 5:44 AM To: Denis Bilenko Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] how to open_port with spaces in path? Since this seems to be a known bug, you may try some workarounds. The most obvious one is to rename a directory so that it doesn't contain spaces. The less obvious one is to find out what is the "short name" of a directory, and use that instead: c:\temp>dir /X /AD "a*" Volume in drive C is unlabeled Serial number is 381F:4FF1 Directory of C:\temp\a* 2/12/07 8:31 AA0919~1 a a 0 bytes in 0 files and 1 dir 3,814,490,112 bytes free In the example above "AA0919~1" is the equivalent name of the "a a" directory: c:\temp>dir "AA0919~1" Volume in drive C is unlabeled Serial number is 381F:4FF1 Directory of C:\temp\AA0919~1\* 2/12/07 8:31 . 2/12/07 8:31 .. 2/12/07 8:31 0 my.exe 0 bytes in 1 file and 2 dirs 0 bytes allocated 3,814,490,112 bytes free Serge P.S. This second workaround doesn't seem very appealing, but if you can't possibly change directory names, this may be your only option. Denis Bilenko wrote: > Hello, > I'm trying to execute external program which happened to have spaces in > path (not uncommon on windows). open_port exits with einval: > > 56> open_port({spawn, "D:/a a/my.exe"}, []). > > =ERROR REPORT==== 11-Feb-2007::23:59:35 === > Error in process <0.102.0> with exit value: > {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval > ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > I've tried to use quotes > > 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). > > it doesn't change anything. > > Googling revealed this: > Known problems > * os:cmd on WIN32 does not always catch the output from the executed program > correctly. There is also a problem with executing programs with > space in the path. > http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html > > It was not fixed? Are there any workarounds? > > erl: 5.5.3 > os: winxp > > /Denis. > _______________________________________________ > 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 richardc@REDACTED Mon Feb 12 16:09:22 2007 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 12 Feb 2007 16:09:22 +0100 Subject: [erlang-questions] string/iolist survey In-Reply-To: References: Message-ID: <45D08322.2090302@it.uu.se> Christian S wrote: > What set of values do we refer to when talking about the type string()? > > I see iolist() used frequently as to be explicit that one mean the > nested-lists-and-binaries. > > In docs for module io_lib the type chars() is introduced and defined as: > chars() = [char() | chars()]. To exclude binaries. Taking a quick look at the code, it seems that the docs need to be updated, but I'm not sure if all the functions accept IO-lists. > string() = [char()] ? Yes. string() should mean a flat, proper list of chars (integers), and nothing else. If some text just uses the word "string", i.e., not written using the type notation with parentheses, it is best to take a closer look, and not make too many assumptions. /Richard From serge@REDACTED Mon Feb 12 18:58:18 2007 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 12 Feb 2007 12:58:18 -0500 Subject: [erlang-questions] how to open_port with spaces in path? In-Reply-To: References: Message-ID: <45D0AABA.3010108@hq.idt.net> You made me curious to look at the sources to see if this happens indeed, but it seems that filename:nativename/1 only does path normalization and doesn't do name mangling: filename.erl:545 ================ nativename(Name0) -> Name = join([Name0]), %Normalize. case os:type() of {win32, _} -> win32_nativename(Name); _ -> Name end. win32_nativename([$/|Rest]) -> [$\\|win32_nativename(Rest)]; win32_nativename([C|Rest]) -> [C|win32_nativename(Rest)]; win32_nativename([]) -> []. Serge Eric P. Melbardis wrote: > With r10 & windows platform, you can use > > filename:nativename(FullPathName) > > works the best, since the file name mangling is dynamic! (ie relative to > other similar file names!) > > regards > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Serge > Aleynikov > Sent: Monday, February 12, 2007 5:44 AM > To: Denis Bilenko > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] how to open_port with spaces in path? > > Since this seems to be a known bug, you may try some workarounds. The > most obvious one is to rename a directory so that it doesn't contain > spaces. The less obvious one is to find out what is the "short name" of > > a directory, and use that instead: > > c:\temp>dir /X /AD "a*" > > Volume in drive C is unlabeled Serial number is 381F:4FF1 > Directory of C:\temp\a* > > 2/12/07 8:31 AA0919~1 a a > 0 bytes in 0 files and 1 dir > 3,814,490,112 bytes free > > In the example above "AA0919~1" is the equivalent name of the "a a" > directory: > > c:\temp>dir "AA0919~1" > > Volume in drive C is unlabeled Serial number is 381F:4FF1 > Directory of C:\temp\AA0919~1\* > > 2/12/07 8:31 . > 2/12/07 8:31 .. > 2/12/07 8:31 0 my.exe > 0 bytes in 1 file and 2 dirs 0 bytes allocated > 3,814,490,112 bytes free > > Serge > > P.S. This second workaround doesn't seem very appealing, but if you > can't possibly change directory names, this may be your only option. > > Denis Bilenko wrote: >> Hello, >> I'm trying to execute external program which happened to have spaces > in >> path (not uncommon on windows). open_port exits with einval: >> >> 56> open_port({spawn, "D:/a a/my.exe"}, []). >> >> =ERROR REPORT==== 11-Feb-2007::23:59:35 === >> Error in process <0.102.0> with exit value: >> {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval >> ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} >> >> ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, >> {erl_eval,do_apply,5}, >> {shell,exprs,6}, >> {shell,eval_loop,3}]} ** >> >> I've tried to use quotes >> >> 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). >> >> it doesn't change anything. >> >> Googling revealed this: >> Known problems >> * os:cmd on WIN32 does not always catch the output from the executed > program >> correctly. There is also a problem with executing programs with >> space in the path. >> http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html >> >> It was not fixed? Are there any workarounds? >> >> erl: 5.5.3 >> os: winxp >> >> /Denis. >> _______________________________________________ >> 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 > -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From eric.melbardis@REDACTED Mon Feb 12 19:27:04 2007 From: eric.melbardis@REDACTED (Eric P. Melbardis) Date: Mon, 12 Feb 2007 10:27:04 -0800 Subject: [erlang-questions] how to open_port with spaces in path? Message-ID: Sorry, you are correct Here is the code I use for 8.3 names: %%---------------------------------------------------------------------- - %% @spec altname(Win32Path) -> string() %% Win32Path = path() %% @doc Convert file name to MS-DOS 8.3 format. %% %% Function uses an internal Erlang file primitive, not in the kernal %% manual. Lifted from the test_server and used elsewhere inside Erlang, %% so it should be safe for a while atleast! %% altname(Path) -> filename:join(altname(filename:split(Path),[])). altname([],_) -> []; altname([PC | T],BaseList) -> FullPath = filename:nativename(filename:join(BaseList ++ [PC])), NewPC = case catch file:altname(FullPath) of {ok,X} -> X; _ -> PC end, NewBase = BaseList ++ [NewPC], NextDir = filename:nativename(filename:join(NewBase)), [NewPC | altname(T,NewBase)]. =============================================================== I forgot how traumatic it was! -----Original Message----- From: Serge Aleynikov [mailto:serge@REDACTED] Sent: Monday, February 12, 2007 9:58 AM To: Eric P. Melbardis Cc: Denis Bilenko; erlang-questions@REDACTED Subject: Re: [erlang-questions] how to open_port with spaces in path? You made me curious to look at the sources to see if this happens indeed, but it seems that filename:nativename/1 only does path normalization and doesn't do name mangling: filename.erl:545 ================ nativename(Name0) -> Name = join([Name0]), %Normalize. case os:type() of {win32, _} -> win32_nativename(Name); _ -> Name end. win32_nativename([$/|Rest]) -> [$\\|win32_nativename(Rest)]; win32_nativename([C|Rest]) -> [C|win32_nativename(Rest)]; win32_nativename([]) -> []. Serge Eric P. Melbardis wrote: > With r10 & windows platform, you can use > > filename:nativename(FullPathName) > > works the best, since the file name mangling is dynamic! (ie relative to > other similar file names!) > > regards > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Serge > Aleynikov > Sent: Monday, February 12, 2007 5:44 AM > To: Denis Bilenko > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] how to open_port with spaces in path? > > Since this seems to be a known bug, you may try some workarounds. The > most obvious one is to rename a directory so that it doesn't contain > spaces. The less obvious one is to find out what is the "short name" of > > a directory, and use that instead: > > c:\temp>dir /X /AD "a*" > > Volume in drive C is unlabeled Serial number is 381F:4FF1 > Directory of C:\temp\a* > > 2/12/07 8:31 AA0919~1 a a > 0 bytes in 0 files and 1 dir > 3,814,490,112 bytes free > > In the example above "AA0919~1" is the equivalent name of the "a a" > directory: > > c:\temp>dir "AA0919~1" > > Volume in drive C is unlabeled Serial number is 381F:4FF1 > Directory of C:\temp\AA0919~1\* > > 2/12/07 8:31 . > 2/12/07 8:31 .. > 2/12/07 8:31 0 my.exe > 0 bytes in 1 file and 2 dirs 0 bytes allocated > 3,814,490,112 bytes free > > Serge > > P.S. This second workaround doesn't seem very appealing, but if you > can't possibly change directory names, this may be your only option. > > Denis Bilenko wrote: >> Hello, >> I'm trying to execute external program which happened to have spaces > in >> path (not uncommon on windows). open_port exits with einval: >> >> 56> open_port({spawn, "D:/a a/my.exe"}, []). >> >> =ERROR REPORT==== 11-Feb-2007::23:59:35 === >> Error in process <0.102.0> with exit value: >> {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval >> ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} >> >> ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, >> {erl_eval,do_apply,5}, >> {shell,exprs,6}, >> {shell,eval_loop,3}]} ** >> >> I've tried to use quotes >> >> 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). >> >> it doesn't change anything. >> >> Googling revealed this: >> Known problems >> * os:cmd on WIN32 does not always catch the output from the executed > program >> correctly. There is also a problem with executing programs with >> space in the path. >> http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html >> >> It was not fixed? Are there any workarounds? >> >> erl: 5.5.3 >> os: winxp >> >> /Denis. >> _______________________________________________ >> 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 > -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From serge@REDACTED Mon Feb 12 19:49:39 2007 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 12 Feb 2007 13:49:39 -0500 Subject: [erlang-questions] how to open_port with spaces in path? In-Reply-To: References: Message-ID: <45D0B6C3.4000601@hq.idt.net> Actually the code below won't work, because filename:split/1 is bound to the same problem of dealing with spaces as the one mentioned in the beginning of the thread: 1> filename:split("c:\temp\a a\my.exe"). ["c:","\tempa amy.exe"] The main point about having file:altname/1 is quite useful though. Yet, it is somewhat counter intuitive on Windows (I would think that the results of the two cases below would be reversed): 2> file:altname("c:\temp\a a"). {error,eio} 3> file:altname("c:/temp/a a"). {ok,"AA0919~1"} Serge Eric P. Melbardis wrote: > Sorry, you are correct > Here is the code I use for 8.3 names: > > %%---------------------------------------------------------------------- > - > %% @spec altname(Win32Path) -> string() > %% Win32Path = path() > %% @doc Convert file name to MS-DOS 8.3 format. > %% > %% Function uses an internal Erlang file primitive, not in the kernal > %% manual. Lifted from the test_server and used elsewhere inside Erlang, > > %% so it should be safe for a while atleast! > %% > > altname(Path) -> > filename:join(altname(filename:split(Path),[])). > > altname([],_) -> > []; > altname([PC | T],BaseList) -> > FullPath = filename:nativename(filename:join(BaseList ++ [PC])), > NewPC = case catch file:altname(FullPath) of > {ok,X} -> > X; > _ -> > PC > end, > NewBase = BaseList ++ [NewPC], > NextDir = filename:nativename(filename:join(NewBase)), > [NewPC | altname(T,NewBase)]. > > =============================================================== > > I forgot how traumatic it was! > > > > -----Original Message----- > From: Serge Aleynikov [mailto:serge@REDACTED] > Sent: Monday, February 12, 2007 9:58 AM > To: Eric P. Melbardis > Cc: Denis Bilenko; erlang-questions@REDACTED > Subject: Re: [erlang-questions] how to open_port with spaces in path? > > You made me curious to look at the sources to see if this happens > indeed, but it seems that filename:nativename/1 only does path > normalization and doesn't do name mangling: > > filename.erl:545 > ================ > > nativename(Name0) -> > Name = join([Name0]), %Normalize. > case os:type() of > {win32, _} -> win32_nativename(Name); > _ -> Name > end. > > win32_nativename([$/|Rest]) -> > [$\\|win32_nativename(Rest)]; > win32_nativename([C|Rest]) -> > [C|win32_nativename(Rest)]; > win32_nativename([]) -> > []. > > Serge > > Eric P. Melbardis wrote: >> With r10 & windows platform, you can use >> >> filename:nativename(FullPathName) >> >> works the best, since the file name mangling is dynamic! (ie relative > to >> other similar file names!) >> >> regards >> >> >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Serge >> Aleynikov >> Sent: Monday, February 12, 2007 5:44 AM >> To: Denis Bilenko >> Cc: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] how to open_port with spaces in path? >> >> Since this seems to be a known bug, you may try some workarounds. The > >> most obvious one is to rename a directory so that it doesn't contain >> spaces. The less obvious one is to find out what is the "short name" > of >> a directory, and use that instead: >> >> c:\temp>dir /X /AD "a*" >> >> Volume in drive C is unlabeled Serial number is 381F:4FF1 >> Directory of C:\temp\a* >> >> 2/12/07 8:31 AA0919~1 a a >> 0 bytes in 0 files and 1 dir >> 3,814,490,112 bytes free >> >> In the example above "AA0919~1" is the equivalent name of the "a a" >> directory: >> >> c:\temp>dir "AA0919~1" >> >> Volume in drive C is unlabeled Serial number is 381F:4FF1 >> Directory of C:\temp\AA0919~1\* >> >> 2/12/07 8:31 . >> 2/12/07 8:31 .. >> 2/12/07 8:31 0 my.exe >> 0 bytes in 1 file and 2 dirs 0 bytes allocated >> 3,814,490,112 bytes free >> >> Serge >> >> P.S. This second workaround doesn't seem very appealing, but if you >> can't possibly change directory names, this may be your only option. >> >> Denis Bilenko wrote: >>> Hello, >>> I'm trying to execute external program which happened to have spaces >> in >>> path (not uncommon on windows). open_port exits with einval: >>> >>> 56> open_port({spawn, "D:/a a/my.exe"}, []). >>> >>> =ERROR REPORT==== 11-Feb-2007::23:59:35 === >>> Error in process <0.102.0> with exit value: >>> {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval >>> ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} >>> >>> ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, >>> {erl_eval,do_apply,5}, >>> {shell,exprs,6}, >>> {shell,eval_loop,3}]} ** >>> >>> I've tried to use quotes >>> >>> 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). >>> >>> it doesn't change anything. >>> >>> Googling revealed this: >>> Known problems >>> * os:cmd on WIN32 does not always catch the output from the > executed >> program >>> correctly. There is also a problem with executing programs with >>> space in the path. >>> http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html >>> >>> It was not fixed? Are there any workarounds? >>> >>> erl: 5.5.3 >>> os: winxp >>> >>> /Denis. >>> _______________________________________________ >>> 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 >> > -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From eric.melbardis@REDACTED Mon Feb 12 19:59:29 2007 From: eric.melbardis@REDACTED (Eric P. Melbardis) Date: Mon, 12 Feb 2007 10:59:29 -0800 Subject: [erlang-questions] how to open_port with spaces in path? Message-ID: Need to use 'unix style' or erlang internal format. filename:split("c:/a b/cc"). ["c:/","a b","cc"] I just pass the 'unix' style name to altname and use the result as the command when doing a spawn. Spaces are no longer an issue. Regards -----Original Message----- From: Serge Aleynikov [mailto:serge@REDACTED] Sent: Monday, February 12, 2007 10:50 AM To: Eric P. Melbardis Cc: Denis Bilenko; erlang-questions@REDACTED Subject: Re: [erlang-questions] how to open_port with spaces in path? Actually the code below won't work, because filename:split/1 is bound to the same problem of dealing with spaces as the one mentioned in the beginning of the thread: 1> filename:split("c:\temp\a a\my.exe"). ["c:","\tempa amy.exe"] The main point about having file:altname/1 is quite useful though. Yet, it is somewhat counter intuitive on Windows (I would think that the results of the two cases below would be reversed): 2> file:altname("c:\temp\a a"). {error,eio} 3> file:altname("c:/temp/a a"). {ok,"AA0919~1"} Serge Eric P. Melbardis wrote: > Sorry, you are correct > Here is the code I use for 8.3 names: > > %%---------------------------------------------------------------------- > - > %% @spec altname(Win32Path) -> string() > %% Win32Path = path() > %% @doc Convert file name to MS-DOS 8.3 format. > %% > %% Function uses an internal Erlang file primitive, not in the kernal > %% manual. Lifted from the test_server and used elsewhere inside Erlang, > > %% so it should be safe for a while atleast! > %% > > altname(Path) -> > filename:join(altname(filename:split(Path),[])). > > altname([],_) -> > []; > altname([PC | T],BaseList) -> > FullPath = filename:nativename(filename:join(BaseList ++ [PC])), > NewPC = case catch file:altname(FullPath) of > {ok,X} -> > X; > _ -> > PC > end, > NewBase = BaseList ++ [NewPC], > NextDir = filename:nativename(filename:join(NewBase)), > [NewPC | altname(T,NewBase)]. > > =============================================================== > > I forgot how traumatic it was! > > > > -----Original Message----- > From: Serge Aleynikov [mailto:serge@REDACTED] > Sent: Monday, February 12, 2007 9:58 AM > To: Eric P. Melbardis > Cc: Denis Bilenko; erlang-questions@REDACTED > Subject: Re: [erlang-questions] how to open_port with spaces in path? > > You made me curious to look at the sources to see if this happens > indeed, but it seems that filename:nativename/1 only does path > normalization and doesn't do name mangling: > > filename.erl:545 > ================ > > nativename(Name0) -> > Name = join([Name0]), %Normalize. > case os:type() of > {win32, _} -> win32_nativename(Name); > _ -> Name > end. > > win32_nativename([$/|Rest]) -> > [$\\|win32_nativename(Rest)]; > win32_nativename([C|Rest]) -> > [C|win32_nativename(Rest)]; > win32_nativename([]) -> > []. > > Serge > > Eric P. Melbardis wrote: >> With r10 & windows platform, you can use >> >> filename:nativename(FullPathName) >> >> works the best, since the file name mangling is dynamic! (ie relative > to >> other similar file names!) >> >> regards >> >> >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Serge >> Aleynikov >> Sent: Monday, February 12, 2007 5:44 AM >> To: Denis Bilenko >> Cc: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] how to open_port with spaces in path? >> >> Since this seems to be a known bug, you may try some workarounds. The > >> most obvious one is to rename a directory so that it doesn't contain >> spaces. The less obvious one is to find out what is the "short name" > of >> a directory, and use that instead: >> >> c:\temp>dir /X /AD "a*" >> >> Volume in drive C is unlabeled Serial number is 381F:4FF1 >> Directory of C:\temp\a* >> >> 2/12/07 8:31 AA0919~1 a a >> 0 bytes in 0 files and 1 dir >> 3,814,490,112 bytes free >> >> In the example above "AA0919~1" is the equivalent name of the "a a" >> directory: >> >> c:\temp>dir "AA0919~1" >> >> Volume in drive C is unlabeled Serial number is 381F:4FF1 >> Directory of C:\temp\AA0919~1\* >> >> 2/12/07 8:31 . >> 2/12/07 8:31 .. >> 2/12/07 8:31 0 my.exe >> 0 bytes in 1 file and 2 dirs 0 bytes allocated >> 3,814,490,112 bytes free >> >> Serge >> >> P.S. This second workaround doesn't seem very appealing, but if you >> can't possibly change directory names, this may be your only option. >> >> Denis Bilenko wrote: >>> Hello, >>> I'm trying to execute external program which happened to have spaces >> in >>> path (not uncommon on windows). open_port exits with einval: >>> >>> 56> open_port({spawn, "D:/a a/my.exe"}, []). >>> >>> =ERROR REPORT==== 11-Feb-2007::23:59:35 === >>> Error in process <0.102.0> with exit value: >>> {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval >>> ,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} >>> >>> ** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]}, >>> {erl_eval,do_apply,5}, >>> {shell,exprs,6}, >>> {shell,eval_loop,3}]} ** >>> >>> I've tried to use quotes >>> >>> 57> open_port({spawn, "\"D:/a a/my.exe\""}, []). >>> >>> it doesn't change anything. >>> >>> Googling revealed this: >>> Known problems >>> * os:cmd on WIN32 does not always catch the output from the > executed >> program >>> correctly. There is also a problem with executing programs with >>> space in the path. >>> http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html >>> >>> It was not fixed? Are there any workarounds? >>> >>> erl: 5.5.3 >>> os: winxp >>> >>> /Denis. >>> _______________________________________________ >>> 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 >> > -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From vladdu55@REDACTED Mon Feb 12 20:13:13 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 12 Feb 2007 19:13:13 +0000 Subject: [erlang-questions] Erlang on NVIDIA ? Message-ID: <95be1d3b0702121113k50e9ad24nf379f38d0a141fe0@mail.gmail.com> Hi, I just saw this announcement http://developer.nvidia.com/object/cuda.html and couldn't stop imagining how it would feel like to let an Erlang node run on the graphics card! best regards, Vlad From per@REDACTED Mon Feb 12 20:30:09 2007 From: per@REDACTED (Per Hedeland) Date: Mon, 12 Feb 2007 20:30:09 +0100 (CET) Subject: [erlang-questions] Executing external commands In-Reply-To: <45D0674E.5040104@seriema-systems.com> Message-ID: <200702121930.l1CJU9QV069382@pluto.hedeland.org> Fernando Ipar wrote: > >check(Command) -> > Output = os:cmd(Command ++ ";echo $?"), > {match, Start, Length} = >regexp:first_match(Output,".*\n[0-9][0-9]*\n"), > Pos = (Start + Length) - 2, > { string:substr(Output,Pos,1), Output}. >4> ext:check("lsss /bin"). >{"7","sh: line 1: lsss: command not found\n127\n"} ^^^ ^^^ Oops!:-) If you want to stick with regexp, a more proper incantation might be: {match, Start, Length} = regexp:match(Output,"\n[0-9]+\n$"), {string:substr(Output,Start+1,Length-2), Output}. However I think this might be preferrable: Code = hd(lists:reverse(string:tokens(Output, "\n"))) --Per Hedeland From autophile@REDACTED Mon Feb 12 21:23:04 2007 From: autophile@REDACTED (Robert Baruch) Date: Mon, 12 Feb 2007 15:23:04 -0500 Subject: [erlang-questions] edoc: easy question Message-ID: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> Hi all, Hopefully this should be an easy question for someone to answer! I have a file structure as follows in my directory: src/file1.erl src/package/file2.erl where file1.erl has -module(file1) and file2.erl has -module (package.file2). To generate all documentation, I've been trying to run edoc as: > erl -noshell -run edoc_run packages '[""]' '[{dir, "doc"}, {source_path, "src"}]' edoc: edoc terminated abnormally: {function_clause, [{filename,join,[115,[]]}, {edoc_lib,find_sources_1,5}, {edoc_lib,find_sources,5}, {edoc,'-sources/3-fun-0-'|...}, {lists|...}, {...}|...]}. > erl -noshell -run edoc_run packages '[]' '[{dir, "doc"}, {source_path, "src"}]' edoc: edoc terminated abnormally: {function_clause, [{filename,join,[115,"src"]}, {edoc_lib,find_file,3}, {edoc,'-package_files/2-fun-0-',4}, {lists,foldl|...}, {edoc|...}, {...}|...]}. So... how do I specify that all documentation should be generated? Thanks! --Rob From richardc@REDACTED Mon Feb 12 22:22:00 2007 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 12 Feb 2007 22:22:00 +0100 Subject: [erlang-questions] edoc: easy question In-Reply-To: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> References: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> Message-ID: <45D0DA78.4000909@it.uu.se> Robert Baruch wrote: > To generate all documentation, I've been trying to run edoc as: > > > erl -noshell -run edoc_run packages '[""]' '[{dir, "doc"}, > {source_path, "src"}]' > edoc: edoc terminated abnormally: {function_clause, > [{filename,join,[115,[]]}, > {edoc_lib,find_sources_1,5}, > {edoc_lib,find_sources,5}, > {edoc,'-sources/3-fun-0-'|...}, > {lists|...}, > {...}|...]}. When you specify the source_path option, the value must be a list of paths, not just a single string. So, write ["src"] instead of "src" and it should work. /Richard From vladdu55@REDACTED Mon Feb 12 22:26:05 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 12 Feb 2007 21:26:05 +0000 Subject: [erlang-questions] erlang:time/0 Message-ID: <95be1d3b0702121326u516b8110rfce3eb896ae6536d@mail.gmail.com> Hi, I noticed a weird thing: on one of my Windows machines, erlang:time/0 and localtime/0 return one hour less than the time really is... The timezone is properly configured. Anybody has any idea what may cause this? Other programs get the right time. (And on the laptop erlang works too) best regards, Vlad From vladdu55@REDACTED Mon Feb 12 22:47:58 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 12 Feb 2007 21:47:58 +0000 Subject: [erlang-questions] erlang:time/0 In-Reply-To: <95be1d3b0702121326u516b8110rfce3eb896ae6536d@mail.gmail.com> References: <95be1d3b0702121326u516b8110rfce3eb896ae6536d@mail.gmail.com> Message-ID: <95be1d3b0702121347l59f7e259r8330c5ec9f885863@mail.gmail.com> Weirder, I have a Vista RC1 on VMWare running on the same machine, and Erlang running on Vista shows the right time......... /Vlad On 2/12/07, Vlad Dumitrescu wrote: > Hi, > > I noticed a weird thing: on one of my Windows machines, erlang:time/0 > and localtime/0 return one hour less than the time really is... The > timezone is properly configured. > > Anybody has any idea what may cause this? Other programs get the right > time. (And on the laptop erlang works too) > > best regards, > Vlad > From autophile@REDACTED Mon Feb 12 22:57:04 2007 From: autophile@REDACTED (Robert Baruch) Date: Mon, 12 Feb 2007 16:57:04 -0500 Subject: [erlang-questions] edoc: easy question In-Reply-To: <45D0DA78.4000909@it.uu.se> References: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> <45D0DA78.4000909@it.uu.se> Message-ID: <5EDC5CE9-6C3C-4AB5-81FF-F799E04F076A@zoominternet.net> On Feb 12, 2007, at 4:22 PM, Richard Carlsson wrote: > > When you specify the source_path option, the value must be a list > of paths, not just a single string. So, write ["src"] instead of "src" > and it should work. Thanks for that -- now at least it doesn't error out. Next problem: > erl -noshell -run edoc_run packages '[""]' '[{dir, "doc"}, {source_path, ["src"]}, {subpackages, true}]' edoc: warning: file './src/package/file2.erl' belongs to package 'package', not 'src.package'. edoc: warning: file './src/file1.erl' belongs to package '', not 'src'. Any ideas? It seems edoc isn't recognizing that src is the root... Thanks for any help, --Rob From jeffm@REDACTED Mon Feb 12 23:41:35 2007 From: jeffm@REDACTED (jm) Date: Tue, 13 Feb 2007 09:41:35 +1100 Subject: [erlang-questions] erlang:time/0 In-Reply-To: <95be1d3b0702121347l59f7e259r8330c5ec9f885863@mail.gmail.com> References: <95be1d3b0702121326u516b8110rfce3eb896ae6536d@mail.gmail.com> <95be1d3b0702121347l59f7e259r8330c5ec9f885863@mail.gmail.com> Message-ID: <45D0ED1F.4060103@ghostgun.com> Is daylight savings in effect in your time zone at the moment? Jeff. Vlad Dumitrescu wrote: > Weirder, I have a Vista RC1 on VMWare running on the same machine, and > Erlang running on Vista shows the right time......... > > /Vlad > > On 2/12/07, Vlad Dumitrescu wrote: >> Hi, >> >> I noticed a weird thing: on one of my Windows machines, erlang:time/0 >> and localtime/0 return one hour less than the time really is... The >> timezone is properly configured. >> >> Anybody has any idea what may cause this? Other programs get the right >> time. (And on the laptop erlang works too) >> >> best regards, >> Vlad >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Tue Feb 13 08:33:36 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 13 Feb 2007 08:33:36 +0100 Subject: [erlang-questions] erlang:time/0 In-Reply-To: <45D0ED1F.4060103@ghostgun.com> References: <95be1d3b0702121326u516b8110rfce3eb896ae6536d@mail.gmail.com> <95be1d3b0702121347l59f7e259r8330c5ec9f885863@mail.gmail.com> <45D0ED1F.4060103@ghostgun.com> Message-ID: <95be1d3b0702122333q3db0465r8c7d025eeb15ff48@mail.gmail.com> Hi, No, it's standard time. And the other programs seem to get the right time, so I'm baffled... regards, Vlad On 2/12/07, jm wrote: > Is daylight savings in effect in your time zone at the moment? > > > Jeff. > > Vlad Dumitrescu wrote: > > Weirder, I have a Vista RC1 on VMWare running on the same machine, and > > Erlang running on Vista shows the right time......... > > > > /Vlad > > > > On 2/12/07, Vlad Dumitrescu wrote: > >> Hi, > >> > >> I noticed a weird thing: on one of my Windows machines, erlang:time/0 > >> and localtime/0 return one hour less than the time really is... The > >> timezone is properly configured. > >> > >> Anybody has any idea what may cause this? Other programs get the right > >> time. (And on the laptop erlang works too) > >> > >> best regards, > >> Vlad > >> > > _______________________________________________ > > 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 VAUCHER@REDACTED Tue Feb 13 08:57:44 2007 From: VAUCHER@REDACTED (VAUCHER Laurent) Date: Tue, 13 Feb 2007 08:57:44 +0100 Subject: [erlang-questions] erlang:time/0 Message-ID: <200702130858406.SM05120@037f27dd816a40c> A change in the Daylight Saving Time policy in the US ! -----Message d'origine----- De : erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] De la part de Vlad Dumitrescu Envoy? : 13 February 2007 08:34 ? : jm Cc : erlang-questions Objet : Re: [erlang-questions] erlang:time/0 Hi, No, it's standard time. And the other programs seem to get the right time, so I'm baffled... regards, Vlad On 2/12/07, jm wrote: > Is daylight savings in effect in your time zone at the moment? > > > Jeff. > > Vlad Dumitrescu wrote: > > Weirder, I have a Vista RC1 on VMWare running on the same machine, > > and Erlang running on Vista shows the right time......... > > > > /Vlad > > > > On 2/12/07, Vlad Dumitrescu wrote: > >> Hi, > >> > >> I noticed a weird thing: on one of my Windows machines, > >> erlang:time/0 and localtime/0 return one hour less than the time > >> really is... The timezone is properly configured. > >> > >> Anybody has any idea what may cause this? Other programs get the > >> right time. (And on the laptop erlang works too) > >> > >> best regards, > >> Vlad > >> > > _______________________________________________ > > 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 vladdu55@REDACTED Tue Feb 13 09:06:07 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 13 Feb 2007 09:06:07 +0100 Subject: [erlang-questions] erlang:time/0 In-Reply-To: <200702130858406.SM05120@037f27dd816a40c> References: <200702130858406.SM05120@037f27dd816a40c> Message-ID: <95be1d3b0702130006r3dbc3be8w86bf23cf5a6fe5a7@mail.gmail.com> Hi, On 2/13/07, VAUCHER Laurent wrote: > A change in the Daylight Saving Time policy in the US ! Yes, and I think Australia made some changes too, but should they affect only some programs running on a Swedish Windows XP? regards, Vlad From richardc@REDACTED Tue Feb 13 10:00:13 2007 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 13 Feb 2007 10:00:13 +0100 Subject: [erlang-questions] edoc: easy question In-Reply-To: <5EDC5CE9-6C3C-4AB5-81FF-F799E04F076A@zoominternet.net> References: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> <45D0DA78.4000909@it.uu.se> <5EDC5CE9-6C3C-4AB5-81FF-F799E04F076A@zoominternet.net> Message-ID: <45D17E1D.6090701@it.uu.se> Robert Baruch wrote: > Thanks for that -- now at least it doesn't error out. Next problem: > > > erl -noshell -run edoc_run packages '[""]' '[{dir, "doc"}, > {source_path, ["src"]}, {subpackages, true}]' > > edoc: warning: file './src/package/file2.erl' belongs to package > 'package', not 'src.package'. > edoc: warning: file './src/file1.erl' belongs to package '', not 'src'. > > Any ideas? It seems edoc isn't recognizing that src is the root... Apparently, the packages/1/2 functions add the current directory to the search path (I've no memory of why this is), which together with the 'subpackages' option seems to cause it to think that the 'src' directory is part of the package structure. I'll have to investigate this. Try using the 'application' function instead - it should automatically give you the behaviour you're trying to achieve. /Richard From mats.cronqvist@REDACTED Tue Feb 13 12:52:08 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 13 Feb 2007 12:52:08 +0100 Subject: [erlang-questions] clueful Message-ID: <45D1A668.8060208@ericsson.com> interesting post from brendan eich (inventor of javascript). http://weblogs.mozillazine.org/roadmap/archives/2007/02/threads_suck.html in addition to calling erlang programmers "clueful hackers", he promises(?) that javascript3 will steal the erlang concurrency model... mats From fipar@REDACTED Tue Feb 13 13:20:45 2007 From: fipar@REDACTED (Fernando Ipar) Date: Tue, 13 Feb 2007 10:20:45 -0200 Subject: [erlang-questions] Executing external commands In-Reply-To: <200702121930.l1CJU9QV069382@pluto.hedeland.org> References: <200702121930.l1CJU9QV069382@pluto.hedeland.org> Message-ID: <45D1AD1D.4050802@seriema-systems.com> I don't know how I thought 7 was a 'normal' exit code, I have no excuse :) Thanks for the observation, and the suggestion! So far, I think I'm sticking with the port based implementation suggested by Richard, since I can save reversing the list if all I need is the Exit Code and not the Output, plus it should run on windows, should I ever want to do that too. Regards, Fernando. Per Hedeland wrote: >> 4> ext:check("lsss /bin"). >> {"7","sh: line 1: lsss: command not found\n127\n"} >> > ^^^ ^^^ > > Oops!:-) If you want to stick with regexp, a more proper incantation > might be: > > {match, Start, Length} = regexp:match(Output,"\n[0-9]+\n$"), > {string:substr(Output,Start+1,Length-2), Output}. > > However I think this might be preferrable: > > Code = hd(lists:reverse(string:tokens(Output, "\n"))) > > --Per Hedeland > From denis.bilenko@REDACTED Tue Feb 13 13:37:06 2007 From: denis.bilenko@REDACTED (Denis Bilenko) Date: Tue, 13 Feb 2007 18:37:06 +0600 Subject: [erlang-questions] how to open_port with spaces in path - patch for emulator to accept quoted commands Message-ID: <95d6e98c0702130437q192fdc9coad3dfdc93810c799@mail.gmail.com> Hello, Thank you all for answers, altname does provide workaround for the problem (it's a pity though, that file:altname is undocumented). Still, it is an inconvenience. Windows' CreateProcess accepts quoted arguments happily, so I've debugged CreateChildProcess (erts\emulator\sys\win32\sys.c) and found out that problem originates from call to GetFileAttributes which does not understand quoted arguments. CreateChildProcess("\"D:/a a/my.exe\" some args") calls GetFileAttributes("\"D:/a a/my.exe\"") which fails. Following patch strips the quotes out of GetFileAttributes' argument (ApplicationType calls GetFileAttributes). With this information, any chance this will be fixed in the next release? --- otp_src_R11B-3-original\erts\emulator\sys\win32\sys.c Mon Jan 29 18:52:58 2007 +++ otp_src_R11B-3\erts\emulator\sys\win32\sys.c Tue Feb 13 17:47:59 2007 @@ -1104,6 +1104,9 @@ int cmdlength; char* thecommand; HANDLE hProcess = GetCurrentProcess(); + + char* thecommand_start = origcmd; + int thecommand_length; siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.dwFlags = STARTF_USESTDHANDLES; @@ -1116,9 +1119,26 @@ * contain spaces). */ cmdlength = parse_command(origcmd); - thecommand = (char *) erts_alloc(ERTS_ALC_T_TMP, cmdlength+1); - strncpy(thecommand, origcmd, cmdlength); - thecommand[cmdlength] = '\0'; + + /* + * for quoted argument, parse_command will return quoted result, i.e. + * "\"C:/Program Files/abc.exe\" arg1" -> "\"C:/Program Files/abc.exe\"" + * Such an argument will cause GetFileAttributes to return + * INVALID_FILE_ATTRIBUTES, which will cause ApplicationType to + * return APPL_NONE. + * + * Cut the quotes out of command. + */ + if (cmdlength > 1 && origcmd[0]=='\"' && origcmd[cmdlength-1]=='\"') + { + thecommand_start = origcmd + 1; + thecommand_length = cmdlength - 2; + } + else thecommand_length = cmdlength; + + thecommand = (char *) erts_alloc(ERTS_ALC_T_TMP, thecommand_length+1); + strncpy(thecommand, thecommand_start, thecommand_length); + thecommand[thecommand_length] = '\0'; DEBUGF(("spawn command: %s\n", thecommand)); applType = ApplicationType(thecommand, execPath); /Denis On 2/13/07, Eric P. Melbardis wrote: > Need to use 'unix style' or erlang internal format. > > > filename:split("c:/a b/cc"). > ["c:/","a b","cc"] > > I just pass the 'unix' style name to altname and use the result as the > command when doing a spawn. Spaces are no longer an issue. > > Regards > > > > -----Original Message----- > From: Serge Aleynikov [mailto:serge@REDACTED] > Sent: Monday, February 12, 2007 10:50 AM > To: Eric P. Melbardis > Cc: Denis Bilenko; erlang-questions@REDACTED > Subject: Re: [erlang-questions] how to open_port with spaces in path? > > Actually the code below won't work, because filename:split/1 is bound to > > the same problem of dealing with spaces as the one mentioned in the > beginning of the thread: > > 1> filename:split("c:\temp\a a\my.exe"). > ["c:","\tempa amy.exe"] > > The main point about having file:altname/1 is quite useful though. Yet, > > it is somewhat counter intuitive on Windows (I would think that the > results of the two cases below would be reversed): > > 2> file:altname("c:\temp\a a"). > {error,eio} > 3> file:altname("c:/temp/a a"). > {ok,"AA0919~1"} > > Serge > From david.nospam.hopwood@REDACTED Tue Feb 13 17:10:04 2007 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 13 Feb 2007 16:10:04 +0000 Subject: [erlang-questions] how to open_port with spaces in path - patch for emulator to accept quoted commands In-Reply-To: <95d6e98c0702130437q192fdc9coad3dfdc93810c799@mail.gmail.com> References: <95d6e98c0702130437q192fdc9coad3dfdc93810c799@mail.gmail.com> Message-ID: <45D1E2DC.6040803@blueyonder.co.uk> Denis Bilenko wrote: > --- otp_src_R11B-3-original\erts\emulator\sys\win32\sys.c Mon > Jan 29 18:52:58 2007 > +++ otp_src_R11B-3\erts\emulator\sys\win32\sys.c Tue Feb 13 17:47:59 2007 > @@ -1104,6 +1104,9 @@ > int cmdlength; > char* thecommand; > HANDLE hProcess = GetCurrentProcess(); > + > + char* thecommand_start = origcmd; > + int thecommand_length; > > siStartInfo.cb = sizeof(STARTUPINFO); > siStartInfo.dwFlags = STARTF_USESTDHANDLES; > @@ -1116,9 +1119,26 @@ > * contain spaces). > */ > cmdlength = parse_command(origcmd); > - thecommand = (char *) erts_alloc(ERTS_ALC_T_TMP, cmdlength+1); > - strncpy(thecommand, origcmd, cmdlength); > - thecommand[cmdlength] = '\0'; > + > + /* > + * for quoted argument, parse_command will return quoted result, i.e. > + * "\"C:/Program Files/abc.exe\" arg1" -> "\"C:/Program Files/abc.exe\"" > + * Such an argument will cause GetFileAttributes to return > + * INVALID_FILE_ATTRIBUTES, which will cause ApplicationType to > + * return APPL_NONE. > + * > + * Cut the quotes out of command. > + */ > + if (cmdlength > 1 && origcmd[0]=='\"' && origcmd[cmdlength-1]=='\"') > + { > + thecommand_start = origcmd + 1; > + thecommand_length = cmdlength - 2; > + } > + else thecommand_length = cmdlength; > + > + thecommand = (char *) erts_alloc(ERTS_ALC_T_TMP, thecommand_length+1); > + strncpy(thecommand, thecommand_start, thecommand_length); Not related to the original problem, but: can erts_alloc return NULL? > + thecommand[thecommand_length] = '\0'; > DEBUGF(("spawn command: %s\n", thecommand)); > > applType = ApplicationType(thecommand, execPath); -- David Hopwood From rickard.s.green@REDACTED Tue Feb 13 17:31:33 2007 From: rickard.s.green@REDACTED (Rickard Green) Date: Tue, 13 Feb 2007 17:31:33 +0100 Subject: [erlang-questions] how to open_port with spaces in path - patch for emulator to accept quoted commands In-Reply-To: <45D1E2DC.6040803@blueyonder.co.uk> References: <95d6e98c0702130437q192fdc9coad3dfdc93810c799@mail.gmail.com> <45D1E2DC.6040803@blueyonder.co.uk> Message-ID: <45D1E7E5.40504@ericsson.com> David Hopwood wrote: > > Not related to the original problem, but: can erts_alloc return NULL? > No, it terminates the emulator on failure. BR, Rickard Green, Erlang/OTP From robert.virding@REDACTED Wed Feb 14 01:37:19 2007 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 14 Feb 2007 01:37:19 +0100 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> References: <45CC8F3E.40408@it.uu.se> <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> Message-ID: <45D259BF.2030305@telia.com> Robert Baruch wrote: > On Feb 9, 2007, at 10:11 AM, Richard Carlsson wrote: > >>gb_trees is slightly more lightweight and a little bit faster on most >>operations than dict, so they are particularly good if you have large >>numbers of moderately sized tables. But in general, you're not likely >>to notice any difference until you really start to push the limits, so >>for everyday programs, you can use either without loss. > > I wrote some code a few days ago that had to store about 17,000 key/ > value pairs, where the key was an integer. I found that gb_trees was > far faster in lookup than dict was. I'm not sure if 17,000 is > supposed to be past the limits, but it sure was in my case :) I had to test this so I wrote a small test program to compare the different implementations. It builds dictionaries with integer keys and a single atom as value. Three things are tested: add a new key/value to a dictionary, fetch all the values, and update all the values. To try and get a little less regular sequence of keys the keys are taken from the middle out of the ranges. So, for example, with 1000 keys the sequence is 500,501,499,502,498,503,... Gb_trees has different functions for adding/updating the trees depending on whether you KNOW if the key already exists, add, enter and update. There are two values for gb_trees for adding a new value and updating an existing value, they are using add/enter and update/enter.Enter takes longer time as it much first check whether the key is already in the tree. I don't know if this due to the algorithm or the implementation. If this is a problem depends, of course, on your application. For fun I implemented red-black trees directly out of Okasaki to get some more comparison, this is rbdict. It is dict/orddict compatible. Of course. Here are the tables, first one with orddict for the smaller sizes and then one without (it was getting too wide to fit in). The figures are millisec and rough averages over a number of runs. They are good enough to see the trends. Size orddict dict rbdict gb_trees add fet upd add fet upd add fet upd add fet upd 5000 563 550 1300 10000 2250 2200 4718 32 15 32 31 15 31 78/125 15 31/31 20000 8500 9200 18890 94 15 70 78 15 70 200/266 16 46/79 Size dict rbdict gb_trees add fet upd add fet upd add fet upd 10000 32 15 32 31 15 31 78/125 15 31/31 20000 94 15 70 78 15 70 200/266 16 46/79 50000 300 40 300 200 40 180 625/830 45 120/200 100000 850 100 850 420 94 390 1450/1900 95 266/438 200000 2580 230 2610 890 190 870 3300/5450 190 550/920 500000 17400 680 21500 2420 500 2350 11750/19000 500 1440/2520 Some comments about the results: 1. orddict is nice and quadratic as it should be. It is really only suitable for small trees. 2. Seeing I implemented dict I must say that it produced good results and hung on quite well, until about 50000 elements. This is not due to algorithm itself but rather due to the way in which the internal table is grown. Should probaby be fixed. 3. gb_trees is very slow on adding new values, but rather fast on fetching and updating them. I don't know why this is so. 4. It is a big win for gb_trees if you know whether you have an existing key or not when modifying the table. 5. I was a bit surprised that red-black trees could match gb_trees in fetching as red-black allows some inbalance in the tree. Perhaps the order of insertion was right for it? 6. (The obvious) There is no best algorithm but you should test your application to find out which is best for you. It was to help with the last point that dict/orddict have exactly the same interface. The idea was that you could have a whole range of XXdict libraries and choose the one which best fit your needs, all you need to do to use another is change the module name, a DICT macro. I may just complete rbdict and add it to the libraries. This may be the time to extend the interface with more useful functions. I don't know if the has helped any, or just added to the confusion, but at least we have figures. :-) I include my test module, check for any really bad errors. Robert P.S. I wonder what trapexit will do to these tables? :-) From pjdtech2000@REDACTED Wed Feb 14 01:49:21 2007 From: pjdtech2000@REDACTED (pjd tech) Date: Tue, 13 Feb 2007 17:49:21 -0700 Subject: [erlang-questions] JInterface availability in smaller JVMs? Message-ID: <4f712c6f0702131649m2519c5edm5e66115a5e6e4d4b@mail.gmail.com> Greetings. I would like to get a Java node developed with JInterface run in J2ME based devices and be able to talk to a server running an Erlang Node. Has anyone attempted to do that yet? Anyone know any reasons it wont work at all ? I would appreciate any pointers before I start attempting that. (For that matter I would like to hear about anyone's attempts to get CNode or C#Node running in smaller devices ?) Appreciate your time. thanks pj From autophile@REDACTED Wed Feb 14 02:19:04 2007 From: autophile@REDACTED (Robert Baruch) Date: Tue, 13 Feb 2007 20:19:04 -0500 Subject: [erlang-questions] edoc: easy question In-Reply-To: <45D17E1D.6090701@it.uu.se> References: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> <45D0DA78.4000909@it.uu.se> <5EDC5CE9-6C3C-4AB5-81FF-F799E04F076A@zoominternet.net> <45D17E1D.6090701@it.uu.se> Message-ID: Not really having any luck with application, either --Rob ekmac:~ ek$ erl -noshell -run edoc_run application '[""]' '[{dir, "doc"}, {source_path, ["src"]}]' edoc: edoc terminated abnormally: {function_clause, [{edoc,application,[[[]],[...]]}, {edoc_run,run,1}, {init,start_it,1}, {init,start_em|...}]}. ekmac:~ ek$ erl -noshell -run edoc_run application '[]' '[{dir, "doc"}, {source_path, ["src"]}]' edoc: edoc terminated abnormally: {function_clause, [{edoc,application,[[],[...]]}, {edoc_run,run,1}, {init,start_it,1}, {init,start_em|...}]}. ekmac:~ ek$ erl -noshell -run edoc_run application '"src"' '[{dir, "doc"}]' edoc: edoc terminated abnormally: {function_clause, [{edoc,application,["src",[...]]}, {edoc_run,run,1}, {init,start_it,1}, {init,start_em|...}]}. On Feb 13, 2007, at 4:00 AM, Richard Carlsson wrote: > Robert Baruch wrote: >> Thanks for that -- now at least it doesn't error out. Next problem: >> > erl -noshell -run edoc_run packages '[""]' '[{dir, "doc"}, >> {source_path, ["src"]}, {subpackages, true}]' >> edoc: warning: file './src/package/file2.erl' belongs to package >> 'package', not 'src.package'. >> edoc: warning: file './src/file1.erl' belongs to package '', not >> 'src'. >> Any ideas? It seems edoc isn't recognizing that src is the root... > > Apparently, the packages/1/2 functions add the current directory to > the > search path (I've no memory of why this is), which together with the > 'subpackages' option seems to cause it to think that the 'src' > directory > is part of the package structure. I'll have to investigate this. Try > using the 'application' function instead - it should automatically > give > you the behaviour you're trying to achieve. > > /Richard > > From lcoquelle@REDACTED Wed Feb 14 02:28:19 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 14 Feb 2007 09:28:19 +0800 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: <45D259BF.2030305@telia.com> References: <45CC8F3E.40408@it.uu.se> <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> <45D259BF.2030305@telia.com> Message-ID: Really great! I like to see figures so that I have an idea of what is "a large amount of data". Of course, it would be good to have this in trapexit, or maybe even better in the OTP/Erlang documentation itself (thinking to a chapter "Data structures/containers" in section "Programming examples"). I really do think all participations in this mailing list thread are important and I'm not fond of bookmarking mailing list as documentation references :). Maybe a good time to learn how to create a post in trapexit ;). Thanks! On 2/14/07, Robert Virding wrote: > > Robert Baruch wrote: > > On Feb 9, 2007, at 10:11 AM, Richard Carlsson wrote: > > > >>gb_trees is slightly more lightweight and a little bit faster on most > >>operations than dict, so they are particularly good if you have large > >>numbers of moderately sized tables. But in general, you're not likely > >>to notice any difference until you really start to push the limits, so > >>for everyday programs, you can use either without loss. > > > > I wrote some code a few days ago that had to store about 17,000 key/ > > value pairs, where the key was an integer. I found that gb_trees was > > far faster in lookup than dict was. I'm not sure if 17,000 is > > supposed to be past the limits, but it sure was in my case :) > > I had to test this so I wrote a small test program to compare the > different implementations. It builds dictionaries with integer keys and > a single atom as value. Three things are tested: add a new key/value to > a dictionary, fetch all the values, and update all the values. To try > and get a little less regular sequence of keys the keys are taken from > the middle out of the ranges. So, for example, with 1000 keys the > sequence is 500,501,499,502,498,503,... > > Gb_trees has different functions for adding/updating the trees depending > on whether you KNOW if the key already exists, add, enter and update. > There are two values for gb_trees for adding a new value and updating an > existing value, they are using add/enter and update/enter.Enter takes > longer time as it much first check whether the key is already in the > tree. I don't know if this due to the algorithm or the implementation. > If this is a problem depends, of course, on your application. > > For fun I implemented red-black trees directly out of Okasaki to get > some more comparison, this is rbdict. It is dict/orddict compatible. Of > course. > > Here are the tables, first one with orddict for the smaller sizes and > then one without (it was getting too wide to fit in). The figures are > millisec and rough averages over a number of runs. They are good enough > to see the trends. > > > Size orddict dict rbdict gb_trees > add fet upd add fet upd add fet upd add fet upd > > 5000 563 550 1300 > 10000 2250 2200 4718 32 15 32 31 15 31 78/125 15 31/31 > 20000 8500 9200 18890 94 15 70 78 15 70 200/266 16 46/79 > > Size dict rbdict gb_trees > add fet upd add fet upd add fet upd > > 10000 32 15 32 31 15 31 78/125 15 31/31 > 20000 94 15 70 78 15 70 200/266 16 46/79 > 50000 300 40 300 200 40 180 625/830 45 120/200 > 100000 850 100 850 420 94 390 1450/1900 95 266/438 > 200000 2580 230 2610 890 190 870 3300/5450 190 550/920 > 500000 17400 680 21500 2420 500 2350 11750/19000 500 1440/2520 > > > Some comments about the results: > > 1. orddict is nice and quadratic as it should be. It is really only > suitable for small trees. > 2. Seeing I implemented dict I must say that it produced good results > and hung on quite well, until about 50000 elements. This is not due to > algorithm itself but rather due to the way in which the internal table > is grown. Should probaby be fixed. > 3. gb_trees is very slow on adding new values, but rather fast on > fetching and updating them. I don't know why this is so. > 4. It is a big win for gb_trees if you know whether you have an existing > key or not when modifying the table. > 5. I was a bit surprised that red-black trees could match gb_trees in > fetching as red-black allows some inbalance in the tree. Perhaps the > order of insertion was right for it? > 6. (The obvious) There is no best algorithm but you should test your > application to find out which is best for you. > > > It was to help with the last point that dict/orddict have exactly the > same interface. The idea was that you could have a whole range of XXdict > libraries and choose the one which best fit your needs, all you need to > do to use another is change the module name, a DICT macro. > > I may just complete rbdict and add it to the libraries. This may be the > time to extend the interface with more useful functions. > > I don't know if the has helped any, or just added to the confusion, but > at least we have figures. :-) I include my test module, check for any > really bad errors. > > Robert > > P.S. I wonder what trapexit will do to these tables? :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fipar@REDACTED Wed Feb 14 05:23:30 2007 From: fipar@REDACTED (Fernando Ipar) Date: Wed, 14 Feb 2007 02:23:30 -0200 Subject: [erlang-questions] erl -s and erlang program distribution Message-ID: <45D28EC2.1090102@seriema-systems.com> Hello once again :) Please let me know if I'm asking too many questions! man erl says if I use the -s (or the -run) flag and pass it a module name, it should load that module and look for a function start/0 I have a module called mysqlha, and amongst other functions, it exports start/0 However, neither of these work: $ erl -s mysqlha $ erl -s mysqlha start $ erl -run mysqlha $ erl -eval 'mysqlha:start().' In all cases, I get the usual erlang interpreter I'm using erl R11B on Fedora Core 5 (package is erlang-0.1.fc5), on x86, if any of that helps you guys.. If anyone can tell me what I'm doing wrong, I'll be grateful :) Regards, Fernando. From erlangx@REDACTED Wed Feb 14 06:44:29 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Tue, 13 Feb 2007 21:44:29 -0800 Subject: [erlang-questions] erl -s and erlang program distribution In-Reply-To: <45D28EC2.1090102@seriema-systems.com> References: <45D28EC2.1090102@seriema-systems.com> Message-ID: <20070214054428.GS30423@delora.autosys.us> On Wed, Feb 14, 2007 at 02:23:30AM -0200, Fernando Ipar wrote: > Hello once again :) > > Please let me know if I'm asking too many questions! > > man erl says if I use the -s (or the -run) flag and pass it a module > name, it should load that module and look for a function > start/0 > > I have a module called mysqlha, and amongst other functions, it exports > start/0 > > However, neither of these work: > $ erl -s mysqlha > $ erl -s mysqlha start > $ erl -run mysqlha > $ erl -eval 'mysqlha:start().' > > In all cases, I get the usual erlang interpreter > > I'm using erl R11B on Fedora Core 5 (package is erlang-0.1.fc5), on x86, > if any of that helps you guys.. > > If anyone can tell me what I'm doing wrong, I'll be grateful :) > > Regards, > > Fernando. _______________________________________________ does your start command explicitly create output you expect to see? if, for example, your last command in start were time(), then make your last command io:fwrite('~w', [time()]) also, to exit out of the shell after it runs, do $ erl -s mysqlha -s init stop ~M From dgud@REDACTED Wed Feb 14 09:20:00 2007 From: dgud@REDACTED (Dan Gudmundsson) Date: Wed, 14 Feb 2007 09:20:00 +0100 Subject: [erlang-questions] Erlang on NVIDIA ? In-Reply-To: <95be1d3b0702121113k50e9ad24nf379f38d0a141fe0@mail.gmail.com> References: <95be1d3b0702121113k50e9ad24nf379f38d0a141fe0@mail.gmail.com> Message-ID: <45D2C630.9010702@erix.ericsson.se> You can already use the hardware via esdl/opengl today... I/we use it for wings3d today but of course you can use it for whatever calculations you want, see http://www.gpgpu.org /Dan Vlad Dumitrescu wrote: > Hi, > > I just saw this announcement > http://developer.nvidia.com/object/cuda.html and couldn't stop > imagining how it would feel like to let an Erlang node run on the > graphics card! > > best regards, > Vlad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Tue Feb 13 21:00:52 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 13 Feb 2007 21:00:52 +0100 Subject: [erlang-questions] what are ets bags sets and duplicate_bags? Message-ID: <9b08084c0702131200v69d30e81k91683ccae2e007d0@mail.gmail.com> Help >From the ets manual page: * set The table is a set table - one key, one object, no order among objects. This is the default table type. * ordered_set The table is a ordered_set table - one key, one object, ordered in Erlang term order, which is the order implied by the < and > operators. Tables of this type have a somewhat different behavior in some situations than tables of the other types. * bag The table is a bag table which can have many objects, but only one instance of each object, per key. * duplicate_bag The table is a duplicate_bag table which can have many objects, including multiple copies of the same object, per key. Is this trying to say that: {a,1} {b,2} {c,3} is a set {a,1} {a,2} {b,2} is a bag {a,1} {a,1}{a,2} {b,3} is a duplicate_bag ????? /Joe /Joe From richardc@REDACTED Wed Feb 14 09:35:21 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 14 Feb 2007 09:35:21 +0100 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: <45D259BF.2030305@telia.com> References: <45CC8F3E.40408@it.uu.se> <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> <45D259BF.2030305@telia.com> Message-ID: <45D2C9C9.2010701@it.uu.se> Robert Virding wrote: > 3. gb_trees is very slow on adding new values, but rather fast on > fetching and updating them. I don't know why this is so. There were several posts to this list years ago with similar measurements, and I've never seen such strange numbers for add/enter before. In particular, the difference between enter and add (when the key does in fact not exist in the tree) should be precisely the time it takes to do a lookup. Your numbers show a much greater difference between enter and add, so something seems to be fishy here. > 4. It is a big win for gb_trees if you know whether you have an existing > key or not when modifying the table. Yes, that is because if the key is known to be present, there will be no need to do any rebalancing (or even check for rebalancing), so the update can be made much faster. Hence, for algorithms that do a lot of updates, it can definitely be better to fully populate the tree in advance, so that update can be used throughout instead of enter. (However, the functional-array implementation that Dan G. and I posted to the list a while back is much faster still, if you have a range of integer keys.) > 5. I was a bit surprised that red-black trees could match gb_trees in > fetching as red-black allows some inbalance in the tree. Perhaps the > order of insertion was right for it? Try a random set of keys and let us know. /Richard From vladdu55@REDACTED Wed Feb 14 09:42:54 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Feb 2007 09:42:54 +0100 Subject: [erlang-questions] Erlang on NVIDIA ? In-Reply-To: <45D2C630.9010702@erix.ericsson.se> References: <95be1d3b0702121113k50e9ad24nf379f38d0a141fe0@mail.gmail.com> <45D2C630.9010702@erix.ericsson.se> Message-ID: <95be1d3b0702140042q4fa4c02bua6f3939e79b6c680@mail.gmail.com> Yes, I know, but if I understand correctly CUDA allows to use regular C programs, thus the beam VM itself, could run on the graphics card, taking advantage of it's parallelism. Of course, it may not be a good match for such an use. regards, /Vlad On 2/14/07, Dan Gudmundsson wrote: > You can already use the hardware via esdl/opengl today... > I/we use it for wings3d today but of course you can use it > for whatever calculations you want, see http://www.gpgpu.org > > /Dan > > > Vlad Dumitrescu wrote: > > Hi, > > > > I just saw this announcement > > http://developer.nvidia.com/object/cuda.html and couldn't stop > > imagining how it would feel like to let an Erlang node run on the > > graphics card! > > > > best regards, > > Vlad > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > From richardc@REDACTED Wed Feb 14 13:02:15 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 14 Feb 2007 13:02:15 +0100 Subject: [erlang-questions] edoc: easy question In-Reply-To: References: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> <45D0DA78.4000909@it.uu.se> <5EDC5CE9-6C3C-4AB5-81FF-F799E04F076A@zoominternet.net> <45D17E1D.6090701@it.uu.se> Message-ID: <45D2FA47.5010503@it.uu.se> Robert Baruch wrote: > Not really having any luck with application, either > > --Rob > > ekmac:~ ek$ erl -noshell -run edoc_run application '[""]' '[{dir, > "doc"}, {source_path, ["src"]}]' The application/2 function takes an atom (the app name) as its first argument. It will find the directory automatically if it is in the normal search path, i.e., for all app directories under lib. If not, use application/3, like this: application(appname, "dir", [options...]) /Richard From gunilla@REDACTED Wed Feb 14 14:52:45 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Wed, 14 Feb 2007 14:52:45 +0100 Subject: [erlang-questions] Problem with code:priv_dir In-Reply-To: References: Message-ID: <45D3142D.1070106@erix.ericsson.se> code:priv_dir(Name) does not search *the directories* in the code path for a directory named Name. It searches *the list of names* which constitute the code path, and if there is a directory in the code path called "something/Name" it returns "something/Name/priv". I agree the documentation could be more clear on this... Regards, Gunilla, Erlang/OTP team Robert Baruch wrote: > Hi all, > > Here's my scenario, running R11B-2. In my home directory, I have the > following directories: > > mytest-0.1/ > mytest-0.1/ebin/ > > Now, I fire up the erl shell and try to run code:priv_dir(mytest): > > ekmac:~ ek$ erl > Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.5.2 (abort with ^G) > 1> code:priv_dir(mytest). > {error,bad_name} > 2> code:get_path(). > [".", > "/usr/local/lib/erlang/lib/kernel-2.11.2/ebin", > "/usr/local/lib/erlang/lib/stdlib-1.14.2/ebin", > "/usr/local/lib/erlang/lib/xmerl-1.0.5/ebin", > (and so on) > > Now, what I don't get is that the documentation for code:priv_dir/1 > says: > > "Searches the code path for a directory named .../Name[-Vsn][/ebin] > and returns the directory .../Name[-Vsn]/priv. It is not checked if > this directory really exists." > > Code path contains "." ... check. > ./mytest-0.1/ebin ... check. > > So why isn't priv_dir/1 returning "./mytest-0.1/priv"? > > Thanks for any help! > > --Rob From autophile@REDACTED Wed Feb 14 15:13:25 2007 From: autophile@REDACTED (Robert Baruch) Date: Wed, 14 Feb 2007 09:13:25 -0500 Subject: [erlang-questions] erl -s and erlang program distribution In-Reply-To: <20070214054428.GS30423@delora.autosys.us> References: <45D28EC2.1090102@seriema-systems.com> <20070214054428.GS30423@delora.autosys.us> Message-ID: <352E13BB-C6A8-4CD1-8939-812EA73BE457@zoominternet.net> Add -noshell, possibly? --Rob From serge@REDACTED Wed Feb 14 16:28:32 2007 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 14 Feb 2007 10:28:32 -0500 Subject: [erlang-questions] beam module version Message-ID: <45D32AA0.4060607@hq.idt.net> Does anyone know what the 'compile' 'version' attribute of a module represents? Where is it obtained from during compilation? 1> List = proplists:get_value(compile, file:module_info()). 2> proplists:get_value(version, List). "4.4" Thanks. Serge From mats.cronqvist@REDACTED Wed Feb 14 16:42:59 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 14 Feb 2007 16:42:59 +0100 Subject: [erlang-questions] beam module version In-Reply-To: <45D32AA0.4060607@hq.idt.net> References: <45D32AA0.4060607@hq.idt.net> Message-ID: <45D32E03.1090808@ericsson.com> Serge Aleynikov wrote: > Does anyone know what the 'compile' 'version' attribute of a module > represents? Where is it obtained from during compilation? that would be the version of the compiler application. e.g. compiler-4.4.2 From autophile@REDACTED Wed Feb 14 18:17:36 2007 From: autophile@REDACTED (Robert Baruch) Date: Wed, 14 Feb 2007 12:17:36 -0500 Subject: [erlang-questions] edoc: easy question In-Reply-To: <45D2FA47.5010503@it.uu.se> References: <24BF0321-8989-48D8-92D9-261DB23F9AC2@zoominternet.net> <45D0DA78.4000909@it.uu.se> <5EDC5CE9-6C3C-4AB5-81FF-F799E04F076A@zoominternet.net> <45D17E1D.6090701@it.uu.se> <45D2FA47.5010503@it.uu.se> Message-ID: <82BB7AB4-C641-4D66-A82D-BE60A111E05D@zoominternet.net> Hmm, well, I used this: erl -noshell -run edoc_run application 'app' '"src"' '[{dir, "doc"}]' That did generate all of the documentation, but also put in another frame called "packages", which included such gems as: src src.package package So it's still not quite ideal. --Rob On Feb 14, 2007, at 7:02 AM, Richard Carlsson wrote: > Robert Baruch wrote: >> Not really having any luck with application, either >> --Rob >> ekmac:~ ek$ erl -noshell -run edoc_run application '[""]' '[{dir, >> "doc"}, {source_path, ["src"]}]' > > The application/2 function takes an atom (the app name) as its first > argument. It will find the directory automatically if it is in the > normal search path, i.e., for all app directories under lib. If not, > use application/3, like this: application(appname, "dir", > [options...]) > > /Richard > > From fipar@REDACTED Wed Feb 14 20:36:11 2007 From: fipar@REDACTED (Fernando Ipar) Date: Wed, 14 Feb 2007 17:36:11 -0200 Subject: [erlang-questions] erl -s and erlang program distribution Message-ID: <45D364AB.20304@seriema-systems.com> Hello all, thanks for all the replies. Some of them were private, but I'm writing this to the list for documentation purposes. I was using erlc for compilation. It was working fine until now, meaning that I could invoke functions after erlc modulename.erl However, this time I had to follow Joe's suggestion and compile from the shell using c(modulename). After this, the command line invocation that works for me is: $ erl -noshell -s mysqlha -s init stop I got to this after playing around with different suggestions from many people. Do I always have to compile modules from the shell?. So far, I've been using a Makefile with erlc, but _perhaps_ this wasn't working before and the times I was successful in function invocation those modules were already compiled from the shell (I'm still too new with erlang, and I have a baby in the house so I'm not getting all the sleep I need :) ) Thanks for the help, it's working the way I wanted now, I just wish I could build this from outside the shell. Regards, Fernando. -- Fernando Ipar - Director Seriema Systems ------------------------- Coquimbo 2236 - 102 400 6717 www.seriema-systems.com From robert.virding@REDACTED Wed Feb 14 23:46:45 2007 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 14 Feb 2007 23:46:45 +0100 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: <45D2C9C9.2010701@it.uu.se> References: <45CC8F3E.40408@it.uu.se> <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> <45D259BF.2030305@telia.com> <45D2C9C9.2010701@it.uu.se> Message-ID: <45D39155.9080805@telia.com> I will try some more scan patterns to see what types of figures I get. I don't really envision calculating random permutations of 500k element lists. :-) Richard Carlsson wrote: > Robert Virding wrote: > >> 3. gb_trees is very slow on adding new values, but rather fast on >> fetching and updating them. I don't know why this is so. > > > There were several posts to this list years ago with similar > measurements, and I've never seen such strange numbers for add/enter > before. In particular, the difference between enter and add (when the > key does in fact not exist in the tree) should be precisely the time > it takes to do a lookup. Your numbers show a much greater difference > between enter and add, so something seems to be fishy here. > >> 4. It is a big win for gb_trees if you know whether you have an >> existing key or not when modifying the table. > > > Yes, that is because if the key is known to be present, there will > be no need to do any rebalancing (or even check for rebalancing), so > the update can be made much faster. Hence, for algorithms that do a > lot of updates, it can definitely be better to fully populate the tree > in advance, so that update can be used throughout instead of enter. > (However, the functional-array implementation that Dan G. and I posted > to the list a while back is much faster still, if you have a range of > integer keys.) > >> 5. I was a bit surprised that red-black trees could match gb_trees in >> fetching as red-black allows some inbalance in the tree. Perhaps the >> order of insertion was right for it? > > > Try a random set of keys and let us know. > > /Richard > > From nem@REDACTED Wed Feb 14 09:42:54 2007 From: nem@REDACTED (Geoff Cant) Date: Wed, 14 Feb 2007 09:42:54 +0100 Subject: [erlang-questions] Report browser, remote shell Message-ID: Hi everyone, I'm wondering if there's a way to use the report browser remotely. I have a node running SASL logging and can remote shell to it and fire up the report browser, but all the rb: functions use standard_io by default which leads them to write to STDOUT on the remote node which doesn't have a console. Is there a way to redirect that io to the local (-remsh) node? Or is there another rb API that works from another node? Cheers, -- Geoff Cant From bengt.kleberg@REDACTED Thu Feb 15 08:36:58 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 15 Feb 2007 08:36:58 +0100 Subject: [erlang-questions] Report browser, remote shell In-Reply-To: References: Message-ID: <45D40D9A.3040508@ericsson.com> On 2007-02-14 23:43, Geoff Cant wrote: > Hi everyone, I'm wondering if there's a way to use the report browser > remotely. > > I have a node running SASL logging and can remote shell to it and fire > up the report browser, but all the rb: functions use standard_io by > default which leads them to write to STDOUT on the remote node which > doesn't have a console. > > Is there a way to redirect that io to the local (-remsh) node? Or is > there another rb API that works from another node? would it help to use rb:start_log/1 ? with the io going to a file you could copy that file to your node and read it there. 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." From bengt.kleberg@REDACTED Thu Feb 15 08:44:15 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 15 Feb 2007 08:44:15 +0100 Subject: [erlang-questions] erl -s and erlang program distribution In-Reply-To: <45D364AB.20304@seriema-systems.com> References: <45D364AB.20304@seriema-systems.com> Message-ID: <45D40F4F.5020901@ericsson.com> On 2007-02-14 20:36, Fernando Ipar wrote: ...deleted > Do I always have to compile modules from the shell?. > So far, I've been using a Makefile with erlc, but _perhaps_ this wasn't > working before and the fwiw: i have several erlang scripts. they are all compiled with erlc and work when started with erl -noshell -run main [arg1 arg2 ...] if you have no arguments then -s and start/0 would make more sens than -run and main/1 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." From seb-cl-mailist@REDACTED Thu Feb 15 10:33:11 2007 From: seb-cl-mailist@REDACTED (=?ISO-8859-1?Q?S=E9bastien_Saint-Sevin?=) Date: Thu, 15 Feb 2007 10:33:11 +0100 Subject: [erlang-questions] Sharing code between modules with emacs Message-ID: <45D428D7.9020202@matchix.com> Hi list, I'm new to erlang and have a question regarding the correct way of sharing code between 2 modules. I'm writing a client-server app that speaks a common protocol. So i want the shared code to be put in its own directory to be accessible to both the client and the server. My directories are something like \client\src \server\src \share\src But when I compile the client or server source files under emacs, it do not find the code that is put in share. How can I do that? I understand that if I put the modules under erl-xxx\lib, they will be found automatically by the code loader, but I don't want to develop there. A second question : how can I make the emacs shell to compile the files in the ebin directory instead of the src one ? And have it looking for the .hrl in the include directory ? Is this directory structure only for deployment, or can it be used as well while developping with emacs, thus keeping a nicer directory structure ? TIA, Sebastien. From adam@REDACTED Thu Feb 15 13:18:48 2007 From: adam@REDACTED (Adam Lindberg) Date: Thu, 15 Feb 2007 13:18:48 +0100 Subject: [erlang-questions] Sharing code between modules with emacs In-Reply-To: <45D428D7.9020202@matchix.com> References: <45D428D7.9020202@matchix.com> Message-ID: <6344005f0702150418k7bd315dep2e1a46e61a5dc9a2@mail.gmail.com> Hi S?bastien, You need to load all modules that your program needs, so if for example your client needs the \share\src\lib.erl module, you should load it with: nonode@REDACTED> l(lib). Assuming you have \share\ebin\ in your path (by calling code:add_patha("\mypath\ebin") and of course assuming you have them compiled to the ebin directory. :-) After that it's only to call lib:function() in your client or server. This will work once the lib module is loaded. To make them compile to the ebin directory, us a make file for example. Make a file called Emakefile in the \src directory containing this: {'*', [{outdir, "../ebin"}, % Where to place the beams. Star means all .erl files. {i, "../include"}, % What directories to include {i,"../../share/include"}, % Example include of another application. debug_info, strict_record_tests, netload]}. % Stuff that could be good to have. Then you can run erl -make in the src directory to compile everything. You should look into making client, server and share into applications making it easier for you to start them and load the modules. Cheers Adam On 2/15/07, S?bastien Saint-Sevin wrote: > Hi list, > > I'm new to erlang and have a question regarding the correct way of sharing code between 2 modules. > I'm writing a client-server app that speaks a common protocol. So i want the shared code to be put in its > own directory to be accessible to both the client and the server. > My directories are something like > > \client\src > \server\src > \share\src > > But when I compile the client or server source files under emacs, it do not find the code that is put in share. > How can I do that? > > I understand that if I put the modules under erl-xxx\lib, they will be found automatically by the code loader, but > I don't want to develop there. > > A second question : how can I make the emacs shell to compile the files in the ebin directory instead of the src one ? > And have it looking for the .hrl in the include directory ? > Is this directory structure only for deployment, or can it be used as well while developping with emacs, thus keeping a nicer > directory structure ? > > TIA, > > Sebastien. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Adam Lindberg Mobile: +46734228920 From sanjaya@REDACTED Thu Feb 15 14:06:50 2007 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Thu, 15 Feb 2007 18:36:50 +0530 Subject: [erlang-questions] inets http --- {{badmatch,{timers Message-ID: <017d01c75102$31f431a0$9a0810ac@wavenet.lk> Hi all, Anyone has a idea about below error & why it gets with http:request(get, {URL, []}, [{timeout, ?REQUEST_TIMEOUT},{autoredirect, true}], [{sync, false}]) ??? I have get it with R11B-2. Is this a bug in in inets ?? regards, Sanjaya Vitharana ** Reason for termination == ** {{badmatch,{timers,[{#Ref<0.0.1.257343>,#Ref<0.0.1.257345>}],undefined}}, [{httpc_handler,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]} XML SVR : asyncronous request sending to web server REQUEST_TIMEOUT=12000 =CRASH REPORT==== 14-Feb-2007::18:18:31 === crasher: pid: <0.15650.0> registered_name: [] error_info: {{badmatch,{timers,[{#Ref<0.0.1.257343>,#Ref<0.0.1.257345>}], undefined}}, [{httpc_handler,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]} initial_call: {gen,init_it, [gen_server, <0.53.0>, <0.53.0>, httpc_handler, [{request,#Ref<0.0.1.257303>, <0.66.0>, 0, http, {"172.16.1.19",80}, "/ivr/server/Scripts/redirect.php", "?key=c&session=a1171457291775839678&serv=775729044&cli=775839678&ch=377", get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "172.16.1.19", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,12000,true,[],undefined,false}, "http://172.16.1.19/ivr/server/Scripts/redirect.php?key=c&session=a1171457291775839678&serv=775729044&cli=775839678&ch=377", [], none, []}, {options,{undefined,[]},0,2,2,disabled,enabled,false}], []]} ancestors: [httpc_manager,httpc_sup,inets_sup,<0.49.0>] messages: [] links: [<0.53.0>] dictionary: [] trap_exit: true status: running heap_size: 4181 stack_size: 21 reductions: 4549 neighbours: -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Thu Feb 15 15:56:53 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 15 Feb 2007 15:56:53 +0100 Subject: [erlang-questions] erl -s and erlang program distribution In-Reply-To: <45D40F4F.5020901@ericsson.com> References: <45D364AB.20304@seriema-systems.com> <45D40F4F.5020901@ericsson.com> Message-ID: Hi, It definately does not matter if you compile with erlc from a make file or with the c function within the Erlang shell. The same result will be produced, which is a .beam file placed somewhere in the directory structure. Where it is placed is under your control when compiling. The default is in the current directory if not options are used. WHAT DOES MATTER when trying to invoke a module via "erl -s IS that the module meaning the moduel.beam file can be found in the Erlang code path. The current directory is automatically in the code path so if you have your module.beam in the current directory when invoking "erl -s module" it will be loaded and the start function will be executed. If you have your module.beam file somewhere else than in current directory for example in "somedir" you have to add that directory to the code path for the module to be found. You can do like this: "erl -pa "FullOr_Relative_Path_toMydir" -s module" /Regards Kenneth On 2/15/07, Bengt Kleberg wrote: > On 2007-02-14 20:36, Fernando Ipar wrote: > ...deleted > > Do I always have to compile modules from the shell?. > > So far, I've been using a Makefile with erlc, but _perhaps_ this wasn't > > working before and the > > fwiw: i have several erlang scripts. they are all compiled with erlc > and work when started with erl -noshell -run main [arg1 arg2 ...] > if you have no arguments then -s and start/0 would make more sens than > -run and main/1 > > > 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." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ingela@REDACTED Thu Feb 15 16:39:52 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 15 Feb 2007 16:39:52 +0100 Subject: [erlang-questions] inets http --- {{badmatch,{timers In-Reply-To: References: Message-ID: <45D47EC8.1010704@erix.ericsson.se> That is a bug. Will be fixed for the upcoming release. If you want to get it working before then here is the patch: 189c189 < Timers = NewState#state.timers, --- > NewTimers = NewState#state.timers, 199c199 < timers = Timers}}; --- > timers = NewTimers}}; Regards Ingela - OTP team > Hi all, > Anyone has a idea about below error & why it gets with > http:request(get, {URL, []}, [{timeout, ?REQUEST_TIMEOUT},{autoredirect, true}], [{sync, > false}]) ??? > > I have get it with R11B-2. Is this a bug in in inets ?? > > regards, > > Sanjaya Vitharana > > > ** Reason for termination == > ** {{badmatch,{timers,[{#Ref<0.0.1.257343>,#Ref<0.0.1.257345>}],undefined}}, > [{httpc_handler,handle_call,3}, > {gen_server,handle_msg,6}, > {proc_lib,init_p,5}]} > XML SVR : asyncronous request sending to web server REQUEST_TIMEOUT=12000 [...] From attila.rajmund.nohl@REDACTED Thu Feb 15 17:44:53 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Thu, 15 Feb 2007 17:44:53 +0100 (CET) Subject: [erlang-questions] Get call trace from function Message-ID: Hello! Is it possible to get the call trace that lead to a particular function call? I have a code like this: handle_errors(_) -> ?INTERNAL_ERROR. and I'd like to log how did the code end up at this internal error, which function called the handle_errors, that function was called by which function, etc. Simply crashing here could be an option, but the code didn't use to crash and I don't want to change this. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From mats.cronqvist@REDACTED Thu Feb 15 17:52:47 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 15 Feb 2007 17:52:47 +0100 Subject: [erlang-questions] Get call trace from function In-Reply-To: References: Message-ID: <45D48FDF.4030303@ericsson.com> attila.rajmund.nohl@REDACTED wrote: > Hello! > > Is it possible to get the call trace that lead to a particular function > call? I have a code like this: > > handle_errors(_) -> > ?INTERNAL_ERROR. this icky hack is the "traditional" way. there might be a better way to do this nowadays. catch erlang:error({foo}). {'EXIT',{{foo}, [{erl_eval,do_apply,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]}} mats From lennart.ohman@REDACTED Thu Feb 15 20:06:16 2007 From: lennart.ohman@REDACTED (Lennart Ohman) Date: Thu, 15 Feb 2007 20:06:16 +0100 Subject: [erlang-questions] Get call trace from function In-Reply-To: References: Message-ID: <001b01c75134$5e69f4e0$0200a8c0@st.se> Hi, you might want to take a look at the match-spec actionterm 'caller'. See http://www.erlang.se/doc/doc-5.5.3/erts-5.5.3/doc/html/part_frame.html Section 1.2.2 Best Regards Lennart ------------------------------------------------------------- Lennart Ohman office : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 67 35 Sehlstedtsgatan 6 fax : +46-8-667 82 30 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of attila.rajmund.nohl@REDACTED > Sent: Thursday, February 15, 2007 5:45 PM > To: erlang-questions@REDACTED > Subject: [erlang-questions] Get call trace from function > > Hello! > > Is it possible to get the call trace that lead to a particular function > call? I have a code like this: > > handle_errors(_) -> > ?INTERNAL_ERROR. > > and I'd like to log how did the code end up at this internal error, > which function called the handle_errors, that function was called by > which function, etc. Simply crashing here could be an option, but the > code didn't use to crash and I don't want to change this. > > Bye,NAR > -- > "Beware of bugs in the above code; I have only proved it correct, not > tried it." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Thu Feb 15 21:55:37 2007 From: vances@REDACTED (Vance Shipley) Date: Thu, 15 Feb 2007 15:55:37 -0500 Subject: [erlang-questions] Report browser, remote shell In-Reply-To: References: Message-ID: <20070215205536.GA4091@frogman.motivity.ca> Geoff, I was working on this back in April of 2004. I suggested changes to support remote (or multiuser) use of rb however no one seemed interested. You can see my post and patches below. -Vance http://www.erlang.org/pipermail/erlang-questions/2004-April/012070.html http://www.erlang.org/pipermail/erlang-patches/2004-April/000099.html On Thu, Feb 15, 2007 at 11:43:00AM +1300, Geoff Cant wrote: } } Hi everyone, I'm wondering if there's a way to use the report browser } remotely. From jspedron@REDACTED Thu Feb 15 23:56:49 2007 From: jspedron@REDACTED (=?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?=) Date: Thu, 15 Feb 2007 23:56:49 +0100 Subject: [erlang-questions] Segmentation fault when writing erl_crash.dump Message-ID: <45D4E531.6020607@club-internet.fr> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, While working on a testsuite, erl crashed and beam segfaulted during erl_crash.dump write. After some searches, the problem comes from the function `dump_externally' in erts/emulator/beam/erl_process_dump.c. It gives to the function `erts_to_external_format' a 1024-bytes buffer but one of the terms doesn't fit into this. In my testsuite, I was using `cover' and could reproduce the segfault with the attached files: . |-- faulty.erl `-- src `-- source.erl `faulty' uses `cover' to compile files in the `src/' directory, then forces a crash by calling an undefined function. Here is an example: dumbbell$ erlc -Wall faulty.erl dumbbell$ erl -noshell -eval "faulty:go(), init:stop()." {"init terminating in do_boot",{undef,[{lists,foobar,[]},{faulty,go,0},{erl_eval,do_apply,5}, {erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}} Segmentation fault (core dumped) This was tested on R11B-2 and R11B-3 on FreeBSD and Linux with the same results. By increasing the buffer length, it "fixes" the crash but I guess this isn't the best solution. Regards, - -- Jean-S?bastien P?dron http://www.dumbbell.fr/ PGP Key: http://www.dumbbell.fr/pgp/pubkey.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF1OUwa+xGJsFYOlMRAuixAJ9Jbsh+MpXdQPH09h+OOmjd5JZO2wCfcgnY mQBdusXDVfL+Cn3NW5vQFOQ= =+sx2 -----END PGP SIGNATURE----- -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: source.erl URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: faulty.erl URL: From bengt.kleberg@REDACTED Fri Feb 16 08:52:32 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 16 Feb 2007 08:52:32 +0100 Subject: [erlang-questions] Get call trace from function In-Reply-To: <001b01c75134$5e69f4e0$0200a8c0@st.se> References: <001b01c75134$5e69f4e0$0200a8c0@st.se> Message-ID: <45D562C0.6050606@ericsson.com> On 2007-02-15 20:06, Lennart Ohman wrote: > Hi, you might want to take a look at the match-spec actionterm > 'caller'. > See http://www.erlang.se/doc/doc-5.5.3/erts-5.5.3/doc/html/part_frame.html > this is the second most sought after trace (the first beeing the return values of the called function). would it not be a good idea to have these 2 as predefined functions(*) in the dbg module? i realise that it is possible to ask for very many predefined functions since the mathc-spec can do anything, but some are more interesting than others. (*) dbg:ctlr( Module, Function, []) would give the return trace of dbg:tpl( Module, Function, [{'_', [], [{return_trace}]}]) 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." From ulf.wiger@REDACTED Fri Feb 16 09:30:15 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 16 Feb 2007 09:30:15 +0100 Subject: [erlang-questions] Get call trace from function In-Reply-To: <45D562C0.6050606@ericsson.com> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155FE54D6@esealmw115.eemea.ericsson.se> > Bengt Kleberg wrote: > (*) dbg:ctlr( Module, Function, []) would give the return > trace of dbg:tpl( Module, Function, [{'_', [], [{return_trace}]}]) That would be convenient. I alternate between the clumsy tpl() version above and dbg:tpl(Module,Function,dbg:fun2ms(fun(_) -> return_trace() end)), which is 10 chars longer, but at least has fewer brackets in it. Either way, it's a pain to have to write that much for something so useful. BR, Ulf W From mazen@REDACTED Fri Feb 16 12:31:38 2007 From: mazen@REDACTED (Mazen) Date: Fri, 16 Feb 2007 11:31:38 +0000 Subject: [erlang-questions] Sharing code between modules with emacs References: Message-ID: <20070216113138.6B5705A205@mail.erlangsystems.com> Guest wrote: A second question : how can I make the emacs shell to compile the files in the ebin directory instead of the src one ? And have it looking for the .hrl in the include directory ? (end of quote) Assuming you follow Adams advise and create your Emakefile you can, when in Emacs (and is in the right working directory) use M-x and type in compile, enter, then erl -make and enter. This should compile the files and put them in whatever directory you specified. _________________________________________________________ Post sent from http://www.trapexit.org From petter.xa.larsson@REDACTED Fri Feb 16 13:10:20 2007 From: petter.xa.larsson@REDACTED (Petter Larsson) Date: Fri, 16 Feb 2007 13:10:20 +0100 Subject: [erlang-questions] Sharing code between modules with emacs In-Reply-To: <20070216113138.6B5705A205@mail.erlangsystems.com> References: <20070216113138.6B5705A205@mail.erlangsystems.com> Message-ID: <45D59F2C.6050604@ericsson.com> You can check how your inferior-erlang-compile in your elang.el There you set the dir. You can there use another function to set the dir. In my version (thanks to Tomas Abrahamsson) i have: (let ((dir (inferior-erlang-compile-outdir)) And this function is defined as: (defun inferior-erlang-compile-outdir () "Return the directory to compile the current buffer into." (let* ((buffer-dir (file-name-directory (buffer-file-name))) (ebin-dir (concat buffer-dir "../ebin/")) (buffer-dir-base-name (file-name-nondirectory (expand-file-name (concat buffer-dir "."))))) (if (and (string= buffer-dir-base-name "src") (file-directory-p ebin-dir)) (file-name-as-directory ebin-dir) (file-name-as-directory buffer-dir)))) On 2007-02-16 12:31, Mazen wrote: > > Guest wrote: > > A second question : how can I make the emacs shell to compile the files in the ebin directory instead of the src one ? > And have it looking for the .hrl in the include directory ? > > (end of quote) > > > Assuming you follow Adams advise and create your Emakefile you can, when in Emacs (and is in the right working directory) use M-x and type in compile, enter, then erl -make and enter. This should compile the files and put them in whatever directory you specified. > _________________________________________________________ > Post sent from http://www.trapexit.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From serge@REDACTED Fri Feb 16 13:42:19 2007 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 16 Feb 2007 07:42:19 -0500 Subject: [erlang-questions] Get call trace from function In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155FE54D6@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F9223155FE54D6@esealmw115.eemea.ericsson.se> Message-ID: <45D5A6AB.7050606@hq.idt.net> Another convenience add-on is to extend the shell commands to accomplish the same: http://www.erlang.org/pipermail/erlang-questions/2006-September/022750.html Regards, Serge Ulf Wiger (TN/EAB) wrote: >>Bengt Kleberg wrote: >>(*) dbg:ctlr( Module, Function, []) would give the return >>trace of dbg:tpl( Module, Function, [{'_', [], [{return_trace}]}]) > > > That would be convenient. > > I alternate between the clumsy tpl() version above and > dbg:tpl(Module,Function,dbg:fun2ms(fun(_) -> return_trace() end)), > > which is 10 chars longer, but at least has fewer brackets in it. > > Either way, it's a pain to have to write that much for something > so useful. > > BR, > Ulf W > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From petter.xa.larsson@REDACTED Fri Feb 16 13:44:21 2007 From: petter.xa.larsson@REDACTED (Petter Larsson) Date: Fri, 16 Feb 2007 13:44:21 +0100 Subject: [erlang-questions] Erlang TAGS problem Message-ID: <45D5A725.1020209@ericsson.com> I have problem with TAGS in XEmacs 21.4.19. When trying to just find a function name: M-. create_mpx I will find the function in several modules, I can then jump to next with M-, But if I try to find with Module:Fun syntax M-. mxI:create_mpx It will never find any function, i just get: "No entries containing mxI:create_mpx" It seams that the tags-functionality is missconfigures, can anyone hint me on what to look at? /Petter From robert.virding@REDACTED Mon Feb 19 03:04:21 2007 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 19 Feb 2007 03:04:21 +0100 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: <45D39155.9080805@telia.com> References: <45CC8F3E.40408@it.uu.se> <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> <45D259BF.2030305@telia.com> <45D2C9C9.2010701@it.uu.se> <45D39155.9080805@telia.com> Message-ID: <45D905A5.7040100@telia.com> The plot thickens! It wasn't difficult to generate the random numbers! Erik Stenman sent me an easy method which works well. I have now converted my db_test module to work on lists of keys, and added a function which can generate keys after various rules, including random numbers. Here are some new test results. As before all times are in millisecs and are for a whole sequence of keys. For each sequence length I generate 5 random sequences and the results are the average of the runs. Again these are for random sets of Size integer keys from 1 upto Size: Size dict rbdict gb_trees add fet upd add fet upd add/ent fet upd/ent 10000 42 6.5 31 37.5 5.8 36.8 30.9/46 6.3 30.3/43 20000 98 13.8 74 85.8 13.7 86 72.3/104 16 72/102 50000 316 41 303 254 41 260 202/291 47 222/302 100000 854 112 913 573 101 619 478/674 125 549/720 200000 2435 236 2786 1387 237 1430 1090/1527 301 1274/1626 500000 18042 694 28868 4277 736 4163 3451/4659 963 3859/4836 Some comments: 1. They basically show the same trends as before. 2. There is a larger spread in the values for the tree algorithms than for dict. 3. I can't explain why fetching is faster in rb-trees than in gb-trees. 4. dict still surprises with fast lookup times. If any one can find some mistake in my code which lead to systematic errors please tell me. Soon there will have to be more statistical results as well. :-) Not! I will soon release rbdict which will be plug-in compatible with idct and orddict. The module must be cleaned up a little first. Then I can add a delete column to my table. Robert Robert Virding wrote: > I will try some more scan patterns to see what types of figures I get. I > don't really envision calculating random permutations of 500k element > lists. :-) > > Richard Carlsson wrote: > >>Robert Virding wrote: >> >> >>>3. gb_trees is very slow on adding new values, but rather fast on >>>fetching and updating them. I don't know why this is so. >> >> >>There were several posts to this list years ago with similar >>measurements, and I've never seen such strange numbers for add/enter >>before. In particular, the difference between enter and add (when the >>key does in fact not exist in the tree) should be precisely the time >>it takes to do a lookup. Your numbers show a much greater difference >>between enter and add, so something seems to be fishy here. >> >> >>>4. It is a big win for gb_trees if you know whether you have an >>>existing key or not when modifying the table. >> >> >>Yes, that is because if the key is known to be present, there will >>be no need to do any rebalancing (or even check for rebalancing), so >>the update can be made much faster. Hence, for algorithms that do a >>lot of updates, it can definitely be better to fully populate the tree >>in advance, so that update can be used throughout instead of enter. >>(However, the functional-array implementation that Dan G. and I posted >>to the list a while back is much faster still, if you have a range of >>integer keys.) >> >> >>>5. I was a bit surprised that red-black trees could match gb_trees in >>>fetching as red-black allows some inbalance in the tree. Perhaps the >>>order of insertion was right for it? >> >> >>Try a random set of keys and let us know. >> >> /Richard >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: db_test.erl URL: From kg9020@REDACTED Mon Feb 19 07:25:57 2007 From: kg9020@REDACTED (kg9020) Date: Mon, 19 Feb 2007 00:25:57 -0600 Subject: [erlang-questions] Ericsson products Message-ID: Hello, does anyone have info on Ericsson current product line such as MX ONE support of video voip , standard teleco lines , using Nortel digital phones, and developing erlang apps ? From shelton.ms@REDACTED Mon Feb 19 08:54:32 2007 From: shelton.ms@REDACTED (Shelton Tang) Date: Mon, 19 Feb 2007 15:54:32 +0800 Subject: [erlang-questions] is it possible to pass a socket to another NODE? Message-ID: <27ccae8e0702182354y43178299s46d6c93da3730839@mail.gmail.com> Hi All, I'm working on Windows platform where erlang doesn't have SMP support (right?). So I'm going to run a erlang node for each CPU. I have a centralized node that accept incoming connections and dispatch the connection socket to the process on different nodes based on the load. With OS's API help, we can pass a socket to different process. My question is, is it possible to pass a socket to a process in another node? Any advise is welcome. Regards, Shelton From covracer@REDACTED Mon Feb 19 12:08:58 2007 From: covracer@REDACTED (Christopher Covington) Date: Mon, 19 Feb 2007 12:08:58 +0100 Subject: [erlang-questions] Build Systems and a C Problem with fd_server In-Reply-To: References: Message-ID: Hi, I've got a general question and a very specific one. I'm trying to build a repository of useful Erlang packages for Gentoo[1] and would like to include fd_server because yaws depends on it. I still don't understand the motivation behind erlmerge. Perhaps it's really something useful but at first glance it doesn't seem to fit so very well with Gentoo's Portage package management system. I haven't gotten around to investigating CEAN yet. With the proper supporting bash scripting it may be possible to include basically all packages in jungerl or CEAN into portage. Similar efforts, i.e. for CPAN, have always seemed a little funky to me though. Rubygems play really nicely with portage however and so such a build system would be great IMO. Autotools is very well supported everywhere, and especially on Gentoo. It seems the best option for large, mature packages, but then again is perhaps not really the greatest for smaller apps (like fd_server). I'd like to investigate sinan. I gather scons erlang is on the road to deprecation. I've read that Maven doesn't mix very well with Gentoo. What build systems do you guys think are best for Erlang and should there be an effort to repackage existing code with better systems? Anyhow In an attempt to imitate Romain Lenget's autotoolization of gtknode, I've come to a stumbling block that I don't think I can get past on my own. I don't know C well enough. The problem is: fdlib.c: In function 'send_fd': fdlib.c:174: error: 'struct msghdr' has no member named 'msg_accrights' fdlib.c:175: error: 'struct msghdr' has no member named 'msg_accrightslen' The code causing the error is surrounded by a bunch of #ifdef stuff. It can be reproduced by running "./configure && make" inside the tarball I have posted on my google project page[2]. I'm not an expert with Automake and company--I just ran autoscan for the C code parts, tried to follow relevant parts of the manual, ripped off gtknode's files and did a whole lot of googling. If anyone can offer criticism of my Autotools usage I'd love it, and the stuff (configure.ac, Makefile.in's) more or less works, so perhaps its worthy of a look at for those curious and interested in using Autotools for their own code. Many thanks, Chris 1. http://code.google.com/p/gentoo-erlay/ 2. http://code.google.com/p/gentoo-erlay/downloads/list From tobbe@REDACTED Mon Feb 19 12:33:17 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 19 Feb 2007 12:33:17 +0100 Subject: [erlang-questions] Build Systems and a C Problem with fd_server In-Reply-To: References: Message-ID: Christopher Covington skrev: > Hi, > I've got a general question and a very specific one. > > I'm trying to build a repository of useful Erlang packages for > Gentoo[1] and would like to include fd_server because yaws depends on > it. I still don't understand the motivation behind erlmerge. Perhaps > it's really something useful but at first glance it doesn't seem to > fit so very well with Gentoo's Portage package management system. I You can disregard erlmerge completely. It was an attempt to create a package/install system for Erlang but it is now dead (and soon forgotten I hope). Cheers, Tobbe From martin@REDACTED Mon Feb 19 12:52:21 2007 From: martin@REDACTED (Martin Carlson) Date: Mon, 19 Feb 2007 11:52:21 -0000 (UTC) Subject: [erlang-questions] Sharing code between modules with emacs In-Reply-To: <20070216113138.6B5705A205@mail.erlangsystems.com> References: <20070216113138.6B5705A205@mail.erlangsystems.com> Message-ID: <59661.87.74.0.243.1171885941.squirrel@erlangsystems.com> Or you can add something like this to your erlang hook: (unless (null buffer-file-name) (make-local-variable 'compile-command) (setq compile-command (if (file-exists-p "Emakefile") "erl -make" (concat (concat "erlc " (concat (if (file-exists-p "../ebin") "-o ../ebin " "") (if (file-exists-p "../include") "-I ../include " "")) "+debug_info -W " buffer-file-name))))) In which case it will use a Emakefile if possible, else erlc with the "right" switches depending on your environment -- Martin Carlson Erlang Training & Consulting http://www.erlang-consulting.com > > > Guest wrote: > > A second question : how can I make the emacs shell to compile the files in > the ebin directory instead of the src one ? > And have it looking for the .hrl in the include directory ? > > (end of quote) > > > Assuming you follow Adams advise and create your Emakefile you can, when > in Emacs (and is in the right working directory) use M-x and type in > compile, enter, then erl -make and enter. This should compile the files > and put them in whatever directory you specified. > _________________________________________________________ > Post sent from http://www.trapexit.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bjorn@REDACTED Mon Feb 19 15:11:46 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 19 Feb 2007 15:11:46 +0100 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: <45D905A5.7040100@telia.com> References: <45CC8F3E.40408@it.uu.se> <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> <45D259BF.2030305@telia.com> <45D2C9C9.2010701@it.uu.se> <45D39155.9080805@telia.com> <45D905A5.7040100@telia.com> Message-ID: Robert Virding writes: > If any one can find some mistake in my code which lead to systematic > errors please tell me. Soon there will have to be more statistical > results as well. :-) Not! You must run each individual benchmark in a newly spawned process; otherwise garbage collection may punish some benchmarks more than other. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From cyberlync@REDACTED Mon Feb 19 22:25:51 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 19 Feb 2007 13:25:51 -0800 Subject: [erlang-questions] Build Systems and a C Problem with fd_server In-Reply-To: References: Message-ID: > I'd like to investigate sinan. Sinan is actually usable now, I am just working on the docs before I do the release. Sinan and Martin OTP Base are backed up by the same repository system. We have been working pretty hard on defining an open and generally useful repository for OTP applications. We should be able to release that when we release our respective build systems. That said I don't know much about portage (or gentoo for that matter). However, this repository is meant to be open so it should integrate with what you are doing. If nothing else, I would like to talk to you about what your needs are so we can figure out if we have missed something while specing this stuff out. > What build systems do you guys think are best for Erlang > and should there be an effort to repackage existing code with better > systems? Well, as you would expect, I am somewhat partial to my own system ;) I think there is a need for a common repository format and at least one accessible public repository, ala CPAN, maven, rubygems etc. This is one of the things Martin and I have spent the last few months working on. From christopher.faulet@REDACTED Mon Feb 19 22:34:27 2007 From: christopher.faulet@REDACTED (Christopher Faulet) Date: Mon, 19 Feb 2007 22:34:27 +0100 Subject: [erlang-questions] Segmentation fault when writing erl_crash.dump In-Reply-To: <45D4E531.6020607@club-internet.fr> References: <45D4E531.6020607@club-internet.fr> Message-ID: <45DA17E3.4000707@capflam.org> Jean-S?bastien P?dron a ?crit : > While working on a testsuite, erl crashed and beam segfaulted during > erl_crash.dump write. > > After some searches, the problem comes from the function > `dump_externally' in erts/emulator/beam/erl_process_dump.c. It gives to > the function `erts_to_external_format' a 1024-bytes buffer but one of > the terms doesn't fit into this. > [...] > > By increasing the buffer length, it "fixes" the crash but I guess this > isn't the best solution. Hi, I agree with you, a dynamic allocation for this buffer might be a better solution. By exploring the code, especially the file "erts/emulator/beam/external.c" where the bug seems to appear, I found the function "encode_size_struct" that could solve the problem. So I did these simple patches to fix this for R11B-2 and R11B-3. They are working on FreeBSD and Linux as well. Regards, -- Christopher Faulet -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_process_dump_R11B-2.patch Type: text/x-patch Size: 721 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_process_dump_R11B-3.patch Type: text/x-patch Size: 721 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: From anders.nygren@REDACTED Tue Feb 20 01:49:47 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 19 Feb 2007 18:49:47 -0600 Subject: [erlang-questions] ssh_cli strange printouts Message-ID: Hi Using R11B-3 on openSuSE 10.3. I am making a CLI using the ssh_cli module. I have noticed that when I resize the window with the ssh client I get a lot of printouts in the erlang shell. It is always the same sequence like this. 164 166 170 172 174 164 166 170 172 174 Does anyone have any ideas what it can be. /Anders From seth.warn@REDACTED Tue Feb 20 02:22:38 2007 From: seth.warn@REDACTED (Seth Warn) Date: Mon, 19 Feb 2007 19:22:38 -0600 Subject: [erlang-questions] In what order are pattern matching clauses evaluated? In-Reply-To: References: Message-ID: I wish I had looked at that code twice before posting, I wasn't thinking about the guard. In any case, I'm still curious about the clause reordering mentioned in the referenced post. Seth Warn University of Kansas seth.warn@REDACTED warn@REDACTED On 2/19/07, Seth Warn wrote: > Hello, > > While trying out Erlang, I noticed the following factorial function works: > > fac(N) when N > 0 -> > N * fac(N-1); > fac(0) -> 1. > > "Ah ha," I said, "the pattern matching is not strictly top-down." Is > there a resource somewhere that describes how the clauses may/will be > rearranged? Searching the archive, the closest thing I found was this > post, which says that the clauses will be grouped by type: > > http://www.erlang.org/pipermail/erlang-questions/2000-May/001267.html > > Thanks, > > Seth Warn > University of Kansas > seth.warn@REDACTED > warn@REDACTED > From seth.warn@REDACTED Mon Feb 19 21:37:48 2007 From: seth.warn@REDACTED (Seth Warn) Date: Mon, 19 Feb 2007 14:37:48 -0600 Subject: [erlang-questions] In what order are pattern matching clauses evaluated? Message-ID: Hello, While trying out Erlang, I noticed the following factorial function works: fac(N) when N > 0 -> N * fac(N-1); fac(0) -> 1. "Ah ha," I said, "the pattern matching is not strictly top-down." Is there a resource somewhere that describes how the clauses may/will be rearranged? Searching the archive, the closest thing I found was this post, which says that the clauses will be grouped by type: http://www.erlang.org/pipermail/erlang-questions/2000-May/001267.html Thanks, Seth Warn University of Kansas seth.warn@REDACTED warn@REDACTED From fipar@REDACTED Tue Feb 20 03:36:15 2007 From: fipar@REDACTED (Fernando Ipar) Date: Tue, 20 Feb 2007 00:36:15 -0200 Subject: [erlang-questions] erl -s Message-ID: <45DA5E9F.6080807@seriema-systems.com> Thanks for all the replies. I've managed to get it working now, and I've also managed to clear my doubts. It was related with the path, so thanks Kenneth :) I'm taking a short summer vacation now, and I'm taking the opportunity to rewrite a small system in erlang as a vacation project, so I'll probably be back with some more questions in a couple of weeks. Regards, Fernando. From bjorn@REDACTED Tue Feb 20 07:07:55 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Feb 2007 07:07:55 +0100 Subject: [erlang-questions] In what order are pattern matching clauses evaluated? In-Reply-To: References: Message-ID: The matching is always performed AS IF it was performed strictly top-down. The pattern matching compiler only rearranges clauses when that will not change the meaning of the program. /Bjorn "Seth Warn" writes: > I wish I had looked at that code twice before posting, I wasn't > thinking about the guard. In any case, I'm still curious about the > clause reordering mentioned in the referenced post. > > Seth Warn > University of Kansas > seth.warn@REDACTED > warn@REDACTED > > On 2/19/07, Seth Warn wrote: > > Hello, > > > > While trying out Erlang, I noticed the following factorial function works: > > > > fac(N) when N > 0 -> > > N * fac(N-1); > > fac(0) -> 1. > > > > "Ah ha," I said, "the pattern matching is not strictly top-down." Is > > there a resource somewhere that describes how the clauses may/will be > > rearranged? Searching the archive, the closest thing I found was this > > post, which says that the clauses will be grouped by type: > > > > http://www.erlang.org/pipermail/erlang-questions/2000-May/001267.html > > > > Thanks, > > > > Seth Warn > > University of Kansas > > seth.warn@REDACTED > > warn@REDACTED > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From sand@REDACTED Tue Feb 20 07:35:43 2007 From: sand@REDACTED (sand@REDACTED) Date: Mon, 19 Feb 2007 22:35:43 -0800 Subject: [erlang-questions] file:open's delayed_write behavior does not correspond to docs. Message-ID: <17882.38591.178047.807078@priss.frightenedpiglet.com> I have opened a port using file:open("/path/to/file", [append, raw, delayed_write]) and the process holding open the port receives messages, converts them to IOdata, and sends them to the port using file:write/2. According to the Erlang documentation, the port should write its data when * 64kB of output data have accumulated, or * when the oldest datum in the buffer reaches 2 seconds old This is thanks to the default 'delayed_write' parameters. My program's output turns out to be consistenly one message behind the messages being sent. The first message "disappears" until I send the second message, at which point it appears in the file. When I send the third message, the second one appears in the file, etc. The last message only appears when closing the file. The 2 second limit doesn't seem to have any effect. Has anyone encountered this behavior before? It's R11B-2 running on Linux. Thanks, Derek -- Derek Upham sand@REDACTED From raimo+erlang-questions@REDACTED Tue Feb 20 10:05:28 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 20 Feb 2007 10:05:28 +0100 Subject: [erlang-questions] file:open's delayed_write behavior does not correspond to docs. In-Reply-To: <17882.38591.178047.807078@priss.frightenedpiglet.com> References: <17882.38591.178047.807078@priss.frightenedpiglet.com> Message-ID: <20070220090528.GA11987@erix.ericsson.se> I can confirm your reported behaviour, on Solaris 8 using truss to see the system calls. It seems to be a bug that nobody noticed. It appears that after the set time the delayed write is transferred to the file drivers todo queue, but the queue is not checked until next event, which is the next write. On Mon, Feb 19, 2007 at 10:35:43PM -0800, sand@REDACTED wrote: > I have opened a port using > > file:open("/path/to/file", [append, raw, delayed_write]) > > and the process holding open the port receives messages, converts them > to IOdata, and sends them to the port using file:write/2. According > to the Erlang documentation, the port should write its data when > > * 64kB of output data have accumulated, or > * when the oldest datum in the buffer reaches 2 seconds old > > This is thanks to the default 'delayed_write' parameters. > > My program's output turns out to be consistenly one message behind the > messages being sent. The first message "disappears" until I send the > second message, at which point it appears in the file. When I send > the third message, the second one appears in the file, etc. The last > message only appears when closing the file. The 2 second limit > doesn't seem to have any effect. > > Has anyone encountered this behavior before? It's R11B-2 running on > Linux. > > Thanks, > > Derek > > -- > Derek Upham > sand@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From gunilla@REDACTED Tue Feb 20 10:22:01 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Tue, 20 Feb 2007 10:22:01 +0100 Subject: [erlang-questions] In what order are pattern matching clauses evaluated? In-Reply-To: References: Message-ID: <45DABDB9.70205@erix.ericsson.se> Have you checked out the Erlang Reference Manual? http://www.erlang.org/doc/doc-5.5.3/doc/reference_manual/part_frame.html (Chapter 5.2 Function Evaluation). Regards, Gunilla Seth Warn wrote: > Hello, > > While trying out Erlang, I noticed the following factorial function works: > > fac(N) when N > 0 -> > N * fac(N-1); > fac(0) -> 1. > > "Ah ha," I said, "the pattern matching is not strictly top-down." Is > there a resource somewhere that describes how the clauses may/will be > rearranged? Searching the archive, the closest thing I found was this > post, which says that the clauses will be grouped by type: > > http://www.erlang.org/pipermail/erlang-questions/2000-May/001267.html > > Thanks, > > Seth Warn > University of Kansas > seth.warn@REDACTED > warn@REDACTED From tumanian@REDACTED Tue Feb 20 13:41:02 2007 From: tumanian@REDACTED (Gurgen Tumanian) Date: Tue, 20 Feb 2007 16:41:02 +0400 Subject: [erlang-questions] Supervisor does not restart Gen Server Message-ID: <85d11a2e0702200441s70e374aei94e0500991cc7fc0@mail.gmail.com> Hello everybody. In my application i have a set of gen_servers orginized in a simple one level supervision tree, with one superviser above all. Now the problem that i have , is that once one of my gen_servers is crashed, the supervisor does not restart it, and what is even worse - dies himself. I have simplified the problem, creating a simple gen server in which a badarith can be initiated(divide by zero) and a simple supervisor, which should have restarted it in case of crash by one_to_one strategy. now when starting the supervisor, and then calling the zuzu:do(0) (causing the badmatch) i get the crash of the worker gen_serv, and then the supervisor crashes.Supervior's crash report is =CRASH REPORT==== 20-Feb-2007::16:35:12 === crasher: pid: <0.41.0> registered_name: [] error_info: {{badarith,[{zuzu,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]}, {gen_server,call,[zuzu_serv,{do,0},35000]}} initial_call: {gen,init_it, [gen_server, <0.39.0>, <0.39.0>, supervisor, {self,bubu,[]}, []]} ancestors: [<0.39.0>] messages: [] links: [] dictionary: [] trap_exit: true status: running heap_size: 233 stack_size: 21 reductions: 227 neighbours: I get the feeling that the supervisor dies as it pasess the restart limit, but that's a quite surprise for me, as the first start of the worker proc pases normally. I will be greatfull for any advice on this issue. Regards Gurgen Tumanyan, Smart Tech -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela@REDACTED Tue Feb 20 16:13:49 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 20 Feb 2007 16:13:49 +0100 Subject: [erlang-questions] ssh_cli strange printouts Message-ID: <45DB102D.50505@erix.ericsson.se> Huum... someone must have checked in debug printouts by mistake. The erlang:display(?LINE)'s below should not be there! Those are the printouts you get. handle_info({ssh_cm, _CM, {window_change, _Channel, Width, Height, PixWidth, PixHeight}}, State) -> erlang:display(?LINE), % line 164 of ssh_cli.erl #state{buf = Buf, pty = Pty, cm = CM, channel = Channel} = State, erlang:display(?LINE), % line 166 of ssh_cli.erl NewPty = Pty#ssh_pty{width = Width, height = Height, pixel_width = PixWidth, pixel_height = PixHeight}, erlang:display(?LINE), % line 170 of ssh_cli.erl {Chars, NewBuf} = io_request({window_change, Pty}, Buf, NewPty), erlang:display(?LINE), % line 172 of ssh_cli.erl write_chars(CM, Channel, Chars), erlang:display(?LINE),% line 174 of ssh_cli.erl {noreply, State#state{pty = NewPty, buf = NewBuf}}; I will make sure they are removed for the next release. Regards Ingela - OTP team > Using R11B-3 on openSuSE 10.3. > I am making a CLI using the ssh_cli module. > I have noticed that when I resize the window with the ssh client > I get a lot of printouts in the erlang shell. It is always the same sequence > like this. > 164 > 166 > 170 > 172 > 174 > 164 > 166 > 170 > 172 > 174 > Does anyone have any ideas what it can be. >/Anders From adam@REDACTED Tue Feb 20 17:10:21 2007 From: adam@REDACTED (Adam Lindberg) Date: Tue, 20 Feb 2007 17:10:21 +0100 Subject: [erlang-questions] Supervisor does not restart Gen Server In-Reply-To: <85d11a2e0702200441s70e374aei94e0500991cc7fc0@mail.gmail.com> References: <85d11a2e0702200441s70e374aei94e0500991cc7fc0@mail.gmail.com> Message-ID: <6344005f0702200810o199fd176p4e351638c54a9e15@mail.gmail.com> Have you started the gen_server with start_link? If you're using only start the supervisor will never know that the server has crashed. Cheers Adam On 2/20/07, Gurgen Tumanian wrote: > Hello everybody. > > In my application i have a set of gen_servers orginized in a simple one > level supervision tree, with one superviser above all. Now the problem > that i have , is that once one of my gen_servers is crashed, the supervisor > does not restart it, and what is even worse - dies himself. > I have simplified the problem, creating a simple gen server in which a > badarith can be initiated(divide by zero) and a > simple supervisor, which should have restarted it in case of crash by > one_to_one strategy. > > now when starting the supervisor, and then calling the zuzu:do(0) (causing > the badmatch) > i get the crash of the worker gen_serv, and then the supervisor > crashes.Supervior's crash report is > =CRASH REPORT==== 20-Feb-2007::16:35:12 === > crasher: > pid: <0.41.0> > registered_name: [] > error_info: {{badarith,[{zuzu,handle_call,3}, > {gen_server,handle_msg,6}, > {proc_lib,init_p,5}]}, > > {gen_server,call,[zuzu_serv,{do,0},35000]}} > initial_call: {gen,init_it, > [gen_server, > <0.39.0>, > <0.39.0>, > supervisor, > {self,bubu,[]}, > []]} > ancestors: [<0.39.0>] > messages: [] > links: [] > dictionary: [] > trap_exit: true > status: running > heap_size: 233 > stack_size: 21 > reductions: 227 > neighbours: > > I get the feeling that the supervisor dies as it pasess the restart limit, > but that's a quite surprise for me, as the first start of the worker proc > pases normally. > I will be greatfull for any advice on this issue. > > Regards > Gurgen Tumanyan, Smart Tech > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- Adam Lindberg Mobile: +46734228920 From chris.newcombe@REDACTED Tue Feb 20 18:41:29 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Tue, 20 Feb 2007 09:41:29 -0800 Subject: [erlang-questions] Segmentation fault when writing erl_crash.dump In-Reply-To: <45DA17E3.4000707@capflam.org> References: <45D4E531.6020607@club-internet.fr> <45DA17E3.4000707@capflam.org> Message-ID: <781dd98c0702200941v16199797rf22248c3f83eb9a7@mail.gmail.com> Thanks! This fixes the frequent seg-v's that occured if my application's regression tests exit with an unexpected exception/error. Please could this fix be included in the next Erlang/OTP release? One possible concern; perhaps the original code used a stack-buffer instead of erts_alloc incase the reason for the exit was an out-of-memory condition? It would be unfortunate if this fix prevented crash dumps due to memory-allocation issues. I haven't looked, but I wonder if it is possible to fix this while still using static buffers? (e.g. Checking whether the term fits in the buffer, and splitting it/truncating it if it does not fit?) thanks, Chris Newcombe On 2/19/07, Christopher Faulet wrote: > Jean-S?bastien P?dron a ?crit : > > While working on a testsuite, erl crashed and beam segfaulted during > > erl_crash.dump write. > > > > After some searches, the problem comes from the function > > `dump_externally' in erts/emulator/beam/erl_process_dump.c. It gives to > > the function `erts_to_external_format' a 1024-bytes buffer but one of > > the terms doesn't fit into this. > > > [...] > > > > By increasing the buffer length, it "fixes" the crash but I guess this > > isn't the best solution. > > Hi, > > I agree with you, a dynamic allocation for this buffer might be a > better solution. > > By exploring the code, especially the file > "erts/emulator/beam/external.c" where the bug seems to appear, I found > the function "encode_size_struct" that could solve the problem. > > So I did these simple patches to fix this for R11B-2 and R11B-3. They > are working on FreeBSD and Linux as well. > > Regards, > -- > Christopher Faulet > From jspedron@REDACTED Tue Feb 20 23:12:56 2007 From: jspedron@REDACTED (=?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?=) Date: Tue, 20 Feb 2007 23:12:56 +0100 Subject: [erlang-questions] Segmentation fault when writing erl_crash.dump In-Reply-To: <45DA17E3.4000707@capflam.org> References: <45D4E531.6020607@club-internet.fr> <45DA17E3.4000707@capflam.org> Message-ID: <45DB7268.7090201@club-internet.fr> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Christopher Faulet wrote: > So I did these simple patches to fix this for R11B-2 and R11B-3. They > are working on FreeBSD and Linux as well. I tested your patch on R11B-3 on FreeBSD and Ubuntu and couldn't reproduce the crash. Thanks for your work! - -- Jean-S?bastien P?dron http://www.dumbbell.fr/ PGP Key: http://www.dumbbell.fr/pgp/pubkey.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF23Joa+xGJsFYOlMRAkqdAKCkmgxIPDAGXJxGVZ/4tlz/luNcVwCg0e8J X+H+PoTqLeGxwCsntZdO+YY= =iS50 -----END PGP SIGNATURE----- From pjdtech2000@REDACTED Wed Feb 21 01:55:03 2007 From: pjdtech2000@REDACTED (PJ Durai) Date: Tue, 20 Feb 2007 17:55:03 -0700 Subject: [erlang-questions] Documentation for erlang inter-node messaging wire protocol Message-ID: <4f712c6f0702201655x3acaa7c1r8cb11fe216f2665b@mail.gmail.com> Greetings. Is there a document detailing the erlang messaging wire protocol ? I googled around and couldnt find it. I guess it can be deduced from the source code of JInterface and/or ei. Would be nice if it is available in a printable document. appreciate your time. pj From sand@REDACTED Wed Feb 21 02:24:06 2007 From: sand@REDACTED (sand@REDACTED) Date: Tue, 20 Feb 2007 17:24:06 -0800 Subject: [erlang-questions] file:open's delayed_write behavior does not correspond to docs. In-Reply-To: <20070220090528.GA11987@erix.ericsson.se> References: <17882.38591.178047.807078@priss.frightenedpiglet.com> <20070220090528.GA11987@erix.ericsson.se> Message-ID: <17883.40758.394391.861446@priss.frightenedpiglet.com> Thanks for checking this. Is this bug something that can be fixed for R11B-4? Derek Raimo Niskanen writes: > I can confirm your reported behaviour, on Solaris 8 using > truss to see the system calls. > > It seems to be a bug that nobody noticed. It appears that after > the set time the delayed write is transferred to the file drivers > todo queue, but the queue is not checked until next event, > which is the next write. > > > > On Mon, Feb 19, 2007 at 10:35:43PM -0800, sand@REDACTED wrote: > > I have opened a port using > > > > file:open("/path/to/file", [append, raw, delayed_write]) > > > > and the process holding open the port receives messages, converts them > > to IOdata, and sends them to the port using file:write/2. According > > to the Erlang documentation, the port should write its data when > > > > * 64kB of output data have accumulated, or > > * when the oldest datum in the buffer reaches 2 seconds old > > > > This is thanks to the default 'delayed_write' parameters. > > > > My program's output turns out to be consistenly one message behind the > > messages being sent. The first message "disappears" until I send the > > second message, at which point it appears in the file. When I send > > the third message, the second one appears in the file, etc. The last > > message only appears when closing the file. The 2 second limit > > doesn't seem to have any effect. > > > > Has anyone encountered this behavior before? It's R11B-2 running on > > Linux. > > > > Thanks, > > > > Derek > > > > -- > > Derek Upham > > sand@REDACTED > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From schmiddy@REDACTED Wed Feb 21 04:30:16 2007 From: schmiddy@REDACTED (Josh Kupershmidt) Date: Tue, 20 Feb 2007 22:30:16 -0500 Subject: [erlang-questions] Simple output questions Message-ID: <4ec1cf760702201930n571068b6vd363f134de7064a5@mail.gmail.com> Hi all, I'm puzzling over how to output a long list of elements. My output seems to be getting chopped off after ~29 lines. For example, I have a function 'range' defined as: range(N, N) -> [N]; range(Min, Max) -> [Min | range(Min+1, Max)]. If I try to output integers between 1 and 100, the output gets chopped off at 29, ending with " 29|...] " . Another random question, is it possible to change the number of floating point significant digits. Mine seems to be set to 6. For example math:sqrt(2). Gives me "1.41421" . Any way to get more precision? Sorry if these questions are rather simple, I googled a bit without finding anything. Josh K. From bjorn@REDACTED Wed Feb 21 08:08:26 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 21 Feb 2007 08:08:26 +0100 Subject: [erlang-questions] Segmentation fault when writing erl_crash.dump In-Reply-To: <781dd98c0702200941v16199797rf22248c3f83eb9a7@mail.gmail.com> References: <45D4E531.6020607@club-internet.fr> <45DA17E3.4000707@capflam.org> <781dd98c0702200941v16199797rf22248c3f83eb9a7@mail.gmail.com> Message-ID: "Chris Newcombe" writes: > Thanks! This fixes the frequent seg-v's that occured if my > application's regression tests exit with an unexpected > exception/error. > > Please could this fix be included in the next Erlang/OTP release? > > One possible concern; perhaps the original code used a stack-buffer > instead of erts_alloc incase the reason for the exit was an > out-of-memory condition? Yes, that was the reason. Since something bad is known to have happened, trying to allocate memory is not a good idea. > It would be unfortunate if this fix > prevented crash dumps due to memory-allocation issues. I haven't > looked, but I wonder if it is possible to fix this while still using > static buffers? (e.g. Checking whether the term fits in the buffer, > and splitting it/truncating it if it does not fit?) Seems like a good idea. I'll try to do it for R11B-4. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bengt.kleberg@REDACTED Wed Feb 21 08:22:18 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Feb 2007 08:22:18 +0100 Subject: [erlang-questions] Simple output questions In-Reply-To: <4ec1cf760702201930n571068b6vd363f134de7064a5@mail.gmail.com> References: <4ec1cf760702201930n571068b6vd363f134de7064a5@mail.gmail.com> Message-ID: <45DBF32A.2080500@ericsson.com> On 2007-02-21 04:30, Josh Kupershmidt wrote: > Hi all, > > I'm puzzling over how to output a long list of elements. My output > seems to be getting chopped off after ~29 lines. > > For example, I have a function 'range' defined as: > > range(N, N) -> > [N]; > > range(Min, Max) -> > [Min | range(Min+1, Max)]. > > If I try to output integers between 1 and 100, the output gets chopped > off at 29, ending with " 29|...] " . the shell is truncating your list. write the list instead: io:fwrite( "~w~n", [:range(1, 100)] ). > Another random question, is it possible to change the number of > floating point significant digits. Mine seems to be set to 6. For > example > > math:sqrt(2). > > Gives me "1.41421" . Any way to get more precision? Sorry if these > questions are rather simple, I googled a bit without finding anything. similarly the shells default setting is getting in your way. try io:fwrite( "~.10g~n", [math:sqrt(2)] ). i have never used this so see the manual page for io module where this is documented. 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." From bengt.kleberg@REDACTED Wed Feb 21 08:42:28 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Feb 2007 08:42:28 +0100 Subject: [erlang-questions] pointer to regular expression theory Message-ID: <45DBF7E4.9070306@ericsson.com> greetings, since there is at least one person currently doing a regular expression library in erlang (and there are often discussions about strings on this mail list) i would like to forward this pointer to a paper about regular expression theory: http://swtch.com/~rsc/regexp/regexp1.html if everybody that is interested has already seen it, i re-label it as a nice coffee-break reading for the rest of us :-) 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." From matthias@REDACTED Wed Feb 21 09:08:29 2007 From: matthias@REDACTED (Matthias Lang) Date: Wed, 21 Feb 2007 09:08:29 +0100 Subject: [erlang-questions] Simple output questions In-Reply-To: <4ec1cf760702201930n571068b6vd363f134de7064a5@mail.gmail.com> References: <4ec1cf760702201930n571068b6vd363f134de7064a5@mail.gmail.com> Message-ID: <17883.65021.888550.919744@antilipe.corelatus.se> Josh Kupershmidt writes: > For example, I have a function 'range' defined as: > > range(N, N) -> > [N]; > > range(Min, Max) -> > [Min | range(Min+1, Max)]. > > If I try to output integers between 1 and 100, the output gets chopped > off at 29, ending with " 29|...] " . > > Another random question, is it possible to change the number of > floating point significant digits. Mine seems to be set to 6. For > example > > math:sqrt(2). > > Gives me "1.41421" . Any way to get more precision? Sorry if these > questions are rather simple, I googled a bit without finding anything. It takes a while to learn your way around the standad libraries. Your 'range' function is provided in the 'lists' module: 6> lists:seq(1,5). [1,2,3,4,5] The reason your outputs are 'shorter' than you want is just the default settings for output used by the shell. If you use the 'io' module, you get more control, e.g. 7> io:fwrite("~w", [lists:seq(1,100)]). [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]ok 12> io:fwrite("~.9f\n", [math:sqrt(2)]). 1.414213562 13> io:fwrite("~.20f\n", [math:sqrt(2)]). 1.41421356237309514547 You can read more about the 'io' module here: http://erlang.org/doc/doc-5.5.3/lib/stdlib-1.14.3/doc/html/io.html and the other modules here: http://erlang.org/doc/doc-5.5.3/doc/man_index.html most of those modules are for specific purposes, so the list isn't quite as daunting is it may first appear. If you're looking to get started, try lists, io, string, file, dict and gen_tcp. Matthias From raimo+erlang-questions@REDACTED Wed Feb 21 09:10:27 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 21 Feb 2007 09:10:27 +0100 Subject: [erlang-questions] : file:open's delayed_write behavior does not correspond to docs. In-Reply-To: <17883.40758.394391.861446@priss.frightenedpiglet.com> References: <17882.38591.178047.807078@priss.frightenedpiglet.com> <20070220090528.GA11987@erix.ericsson.se> <17883.40758.394391.861446@priss.frightenedpiglet.com> Message-ID: <20070221081027.GA20987@erix.ericsson.se> I will put it on my ToDo list and we'll have to see when it gets scheduled in... On Tue, Feb 20, 2007 at 05:24:06PM -0800, sand@REDACTED wrote: > Thanks for checking this. Is this bug something that can be fixed for > R11B-4? > > Derek > > Raimo Niskanen writes: > > I can confirm your reported behaviour, on Solaris 8 using > > truss to see the system calls. > > > > It seems to be a bug that nobody noticed. It appears that after > > the set time the delayed write is transferred to the file drivers > > todo queue, but the queue is not checked until next event, > > which is the next write. > > > > > > > > On Mon, Feb 19, 2007 at 10:35:43PM -0800, sand@REDACTED wrote: > > > I have opened a port using > > > > > > file:open("/path/to/file", [append, raw, delayed_write]) > > > > > > and the process holding open the port receives messages, converts them > > > to IOdata, and sends them to the port using file:write/2. According > > > to the Erlang documentation, the port should write its data when > > > > > > * 64kB of output data have accumulated, or > > > * when the oldest datum in the buffer reaches 2 seconds old > > > > > > This is thanks to the default 'delayed_write' parameters. > > > > > > My program's output turns out to be consistenly one message behind the > > > messages being sent. The first message "disappears" until I send the > > > second message, at which point it appears in the file. When I send > > > the third message, the second one appears in the file, etc. The last > > > message only appears when closing the file. The 2 second limit > > > doesn't seem to have any effect. > > > > > > Has anyone encountered this behavior before? It's R11B-2 running on > > > Linux. > > > > > > Thanks, > > > > > > Derek > > > > > > -- > > > Derek Upham > > > sand@REDACTED > > > _______________________________________________ > > > 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 -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kenneth.lundin@REDACTED Wed Feb 21 09:28:11 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 21 Feb 2007 09:28:11 +0100 Subject: [erlang-questions] Documentation for erlang inter-node messaging wire protocol In-Reply-To: <4f712c6f0702201655x3acaa7c1r8cb11fe216f2665b@mail.gmail.com> References: <4f712c6f0702201655x3acaa7c1r8cb11fe216f2665b@mail.gmail.com> Message-ID: Hi, The documentation regarding the Erlang distribution protocol can be found in the source release at erts/emulator/internal_doc/erl_ext_dist.txt. It might be upgraded to be part of the official documentation in an upcoming release. /Regards Kenneth (OTP team at Ericsson) On 2/21/07, PJ Durai wrote: > Greetings. > > Is there a document detailing the erlang messaging wire protocol ? > I googled around and couldnt find it. > > I guess it can be deduced from the source code of JInterface and/or ei. > > Would be nice if it is available in a printable document. > > appreciate your time. > pj > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From g.olgeni@REDACTED Wed Feb 21 14:24:26 2007 From: g.olgeni@REDACTED (Giacomo Olgeni) Date: Wed, 21 Feb 2007 14:24:26 +0100 Subject: [erlang-questions] Dialyzer on R11B-3: cerl_to_icode error Message-ID: <45DC480A.4050002@colby.it> Hello, I'm getting some errors from dialyzer on R11B-3, does anybody know what the actual problem might be? =ERROR REPORT==== 21-Feb-2007::14:18:49 === cerl_to_icode: undefined variable: 1129. =ERROR REPORT==== 21-Feb-2007::14:18:49 === Error in process <0.483.0> with exit value: {{badmatch,error},[{hipe,get_core_icode,4},{hipe,'-run_compiler_1/3-fun-0-',4}]} -- G. Olgeni (g.olgeni@REDACTED) Colby - http://www.colby.it/ Public key: http://www.colby.it/gnupg/g.olgeni@REDACTED From kostis@REDACTED Wed Feb 21 14:45:44 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 21 Feb 2007 14:45:44 +0100 Subject: [erlang-questions] Dialyzer on R11B-3: cerl_to_icode error In-Reply-To: <45DC480A.4050002@colby.it> References: <45DC480A.4050002@colby.it> Message-ID: <45DC4D08.10605@cs.ntua.gr> Giacomo Olgeni wrote: > Hello, > > I'm getting some errors from dialyzer on R11B-3, does anybody know what > the actual problem might be? Yes. > =ERROR REPORT==== 21-Feb-2007::14:18:49 === > cerl_to_icode: undefined variable: 1129. This is a problem that we also occasionally get -- and fix to the extent we know about it. It happens when the cerl_to_icode translation fails for some reason or another. Typically, this is because the translation does not properly handle the new boolean operators ("andalso" and "orelse"). First of all, I suggest you identify the code on which this happens (by dialyzing one file at a time, until you get the error). Please send us that code. If the code contains "andalso" and "orelse" then most probably it's due to their presense. If so, you have two options to deal with this: - Either compile without +debug_option and dialyze that .beam file - Change uses of "andalso" to "," and "orelse" to ";". Kostis From Tobias.Lindahl@REDACTED Wed Feb 21 14:51:45 2007 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Wed, 21 Feb 2007 14:51:45 +0100 Subject: [erlang-questions] Dialyzer on R11B-3: cerl_to_icode error In-Reply-To: <45DC480A.4050002@colby.it> References: <45DC480A.4050002@colby.it> Message-ID: <45DC4E71.4060202@it.uu.se> Hi Giacomo, Giacomo Olgeni wrote: > Hello, > > I'm getting some errors from dialyzer on R11B-3, does anybody know what > the actual problem might be? > > =ERROR REPORT==== 21-Feb-2007::14:18:49 === > cerl_to_icode: undefined variable: 1129. > > =ERROR REPORT==== 21-Feb-2007::14:18:49 === > Error in process <0.483.0> with exit value: > {{badmatch,error},[{hipe,get_core_icode,4},{hipe,'-run_compiler_1/3-fun-0-',4}]} We get this type of errors sometimes and we try to weed them out as new reports come in. Can you send me the offending code (offline and preferably minimized) so I can have a look? Best, Tobias From joelr1@REDACTED Wed Feb 21 20:23:07 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 21 Feb 2007 19:23:07 +0000 Subject: [erlang-questions] Deforesting tuple updates Message-ID: <5E48532C-FD31-40BC-8A42-DCD8AD5BFEB0@gmail.com> Would someone kindly point me to the portion of the VM code that handles the deforesting optimization for tuple updates? I remember that the update is performed destructively when the tuple is indexed with an integer or something like that. I would like to change this to generally use destructive tuple updates. Thanks, Joel -- http://wagerlabs.com/ From robert.virding@REDACTED Thu Feb 22 00:00:50 2007 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 22 Feb 2007 00:00:50 +0100 Subject: [erlang-questions] pointer to regular expression theory In-Reply-To: <45DBF7E4.9070306@ericsson.com> References: <45DBF7E4.9070306@ericsson.com> Message-ID: <45DCCF22.2040203@telia.com> I haven't seen it before, it's a good reference. Bit nasty towards Jeffrey Friedl, but he has set himself up for that type of criticism. Must try to implement it. Robert Bengt Kleberg wrote: > greetings, > > since there is at least one person currently doing a regular expression > library in erlang (and there are often discussions about strings on this > mail list) i would like to forward this pointer to a paper about regular > expression theory: > > http://swtch.com/~rsc/regexp/regexp1.html > > if everybody that is interested has already seen it, i re-label it as a > nice coffee-break reading for the rest of us :-) > > > bengt From robert.virding@REDACTED Thu Feb 22 00:09:11 2007 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 22 Feb 2007 00:09:11 +0100 Subject: [erlang-questions] dict, orddict and gb_tree In-Reply-To: References: <45CC8F3E.40408@it.uu.se> <535AFB8F-C058-48D4-A938-0D2DB95310C3@zoominternet.net> <45D259BF.2030305@telia.com> <45D2C9C9.2010701@it.uu.se> <45D39155.9080805@telia.com> <45D905A5.7040100@telia.com> Message-ID: <45DCD117.6090806@telia.com> Not really, the runs are pretty long and have to run them a number of times anyway to even out gc. If you do it in a new process everytime then doing the initial increase of heap will punish the results. Anyway in this case I was not really interested in absolute timings only in showing relative indicative times. For real and relevant measurements you need an application. Also it provides a bit of incentive to optimise the code. Robert Bjorn Gustavsson wrote: > Robert Virding writes: > > >>If any one can find some mistake in my code which lead to systematic >>errors please tell me. Soon there will have to be more statistical >>results as well. :-) Not! > > > You must run each individual benchmark in a newly spawned process; > otherwise garbage collection may punish some benchmarks more than other. > > /Bjorn From dev@REDACTED Thu Feb 22 05:20:55 2007 From: dev@REDACTED (Jonathan Gold) Date: Wed, 21 Feb 2007 20:20:55 -0800 Subject: [erlang-questions] Is UBF still going, or did it morph/fade? Message-ID: <20070222042055.GA732@samizdatdigital.com> I'm getting started on a fresh project and, first things first, need to build out some sweet-ass messaging backbone action. I like a lot of things about UBF as I read it in Joe's paper and on his site, but a search through this list shows very little activity or consensus in the last 3-4 years, and not much activity of any sort since 2003. Did work with UBF get subsumed into a differently-acronymed project, or is it just gone entirely? jon From bjorn@REDACTED Thu Feb 22 08:09:42 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 22 Feb 2007 08:09:42 +0100 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: <5E48532C-FD31-40BC-8A42-DCD8AD5BFEB0@gmail.com> References: <5E48532C-FD31-40BC-8A42-DCD8AD5BFEB0@gmail.com> Message-ID: Joel Reymont writes: > I remember that the update is performed destructively when the tuple > is indexed with an integer or something like that. I would like to > change this to generally use destructive tuple updates. > Do you also plan to implement a write barrier in the garbage collector at the same time? If not, you are likely to get some nasty emulator crashes. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From joelr1@REDACTED Thu Feb 22 08:43:36 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 22 Feb 2007 07:43:36 +0000 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: References: <5E48532C-FD31-40BC-8A42-DCD8AD5BFEB0@gmail.com> Message-ID: <1826CCF9-F5C9-4960-AE2D-AEF19987CE92@gmail.com> Bjorn, On Feb 22, 2007, at 7:09 AM, Bjorn Gustavsson wrote: > Do you also plan to implement a write barrier in the garbage collector > at the same time? If not, you are likely to get some nasty emulator > crashes. Could you expand on this? I understand that the optimization is performed if a fixnum is used to index the tuple and if the updates are done within the same function. This is what I remember form your previous explanation. Is this correct? Then all I want to do is include in the optimization the case where indexing is done using a local variable, within the same function. I firmly believe that a little poking around in this area will be worth it big time. I also need this type of deforesting for my trading systems platform. Thanks, Joel -- http://wagerlabs.com/ From shelton.ms@REDACTED Thu Feb 22 08:57:05 2007 From: shelton.ms@REDACTED (Shelton Tang) Date: Thu, 22 Feb 2007 15:57:05 +0800 Subject: [erlang-questions] where can I get comet? Message-ID: <27ccae8e0702212357j58dbb3f6taf3b92cfb804ea41@mail.gmail.com> Hi All, I'm working on Windows platform and need to read something from IIS metabase that is accessible from COM. Currently I'm using a C port to do that. But I read some doc and find "comet" is a good library to call COM. May I know where I can get this library? Best regards, Shelton Tang From dbtleonia@REDACTED Thu Feb 22 09:54:24 2007 From: dbtleonia@REDACTED (David Tucker) Date: Thu, 22 Feb 2007 00:54:24 -0800 Subject: [erlang-questions] erl -name doesn't work Message-ID: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> Hi, I'm running the latest release of Erlang (R11B-3) on Windows XP. When I run: C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -name foo it exits immediately -- no shell, no error message of any sort. However, the following brings up a shell as expected: C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -sname foo Eshell V5.5.3 (abort with ^G) (foo@REDACTED)1> Any idea what I'm doing wrong? Thanks. Dave ** -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Thu Feb 22 10:02:16 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 22 Feb 2007 09:02:16 +0000 Subject: [erlang-questions] AlgoKit: Building a trading platform around Erlang Message-ID: Folks, I'm embarking on a new adventure and giving lots of thumbs up to Erlang at http://wagerlabs.com/2007/2/21/algokit Please chime in if you want, your comments are always welcome! Thanks, Joel -- http://wagerlabs.com/ From vladdu55@REDACTED Thu Feb 22 10:13:01 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 22 Feb 2007 10:13:01 +0100 Subject: [erlang-questions] Scala paper Message-ID: <95be1d3b0702220113i4b3da926iecdf28382b486cce@mail.gmail.com> Hi, It might be interesting to read a new paper the people developing Scala have written, "Actors that Unify Threads and Events" at http://www.scala-lang.org/docu/files/haller07actorsunify.pdf. I haven't tested the latest Scala yet, but they report some nice results for the "message ring" benchmark - 1,5 million actors with 1GB RAM. Being able to handle a regular thread as an actor is also interesting. best regards, Vlad From richardc@REDACTED Thu Feb 22 10:14:51 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 22 Feb 2007 10:14:51 +0100 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: <1826CCF9-F5C9-4960-AE2D-AEF19987CE92@gmail.com> References: <5E48532C-FD31-40BC-8A42-DCD8AD5BFEB0@gmail.com> <1826CCF9-F5C9-4960-AE2D-AEF19987CE92@gmail.com> Message-ID: <45DD5F0B.7010507@it.uu.se> Joel Reymont wrote: > On Feb 22, 2007, at 7:09 AM, Bjorn Gustavsson wrote: > >> Do you also plan to implement a write barrier in the garbage collector >> at the same time? If not, you are likely to get some nasty emulator >> crashes. > > Could you expand on this? > > I understand that the optimization is performed if a fixnum is used > to index the tuple and if the updates are done within the same > function. This is what I remember form your previous explanation. Is > this correct? The point is that it is not only within the same function - it can only be done between points where no garbage collection can be triggered (since, as Bj?rn said, there are no write barriers). If GC happens - and it can happen at any point where an instruction needs to allocate some memory, or call out to other code which might allocate memory - you are likely to end up with some pointers from the old generation into the new generation, and this breaks the main invariant that the GC is based on. The result will be an emulator crash. But, if you're still curious to see if you can improve on the current implementation, check out the file lib/compiler/src/sys_core_dsetel.erl. /Richard PS. We _would_ like to have write barriers, but for historical reasons, the GC implementation in Erlang/OTP is very resistant to change. From thomasl_erlang@REDACTED Thu Feb 22 12:14:47 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 22 Feb 2007 03:14:47 -0800 (PST) Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: Message-ID: <248291.42444.qm@web38809.mail.mud.yahoo.com> --- Bjorn Gustavsson wrote: > > Joel Reymont writes: > > > I remember that the update is performed > destructively when the tuple > > is indexed with an integer or something like that. > I would like to > > change this to generally use destructive tuple > updates. > > > > Do you also plan to implement a write barrier in the > garbage collector > at the same time? If not, you are likely to get some > nasty emulator crashes. For those not into the GC lingo, write barriers are needed because destructive updates can introduce pointers from the old generation to the new one; these must be traced along with all other roots when a minor collection occurs, or the old generation will point to garbage. A write barrier registers the old->new pointer with the GC. (The following assumes a classic, unshared heaps implementation.) An alternate option would be to introduce a per-process flag to tell the system that all future collections FOR THIS PROCESS must be major, in effect using non-generational copying GC locally. Since there is suddenly just one generation, there is no need for a write barrier. The flag can be set when a destructive update occurs, or even at process spawn time. (The latter would be unsafe if the flag was not set and destructive updates still used.) The advantage with this approach is that it's fairly straightforward to implement. Whether it's a good idea depends on the program, of course. The cost of GC may eat the gains, basically. Best, Thomas ____________________________________________________________________________________ Yahoo! Music Unlimited Access over 1 million songs. http://music.yahoo.com/unlimited From joelr1@REDACTED Thu Feb 22 15:11:03 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 22 Feb 2007 14:11:03 +0000 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: <248291.42444.qm@web38809.mail.mud.yahoo.com> References: <248291.42444.qm@web38809.mail.mud.yahoo.com> Message-ID: The reason I bring this up, btw, has to do with trading systems. These traditionally use time series implemented on top of arrays. To calculate a moving average of prices you would allocate an array of N elements and then destructively update it. I know that you could implement the same thing with gb_trees, ETS, etc. but I don't think these are optimal solutions. I have no doubt I'll prove it so in the course of AlgoKit implementation. Thanks, Joel -- http://wagerlabs.com/ From richardc@REDACTED Thu Feb 22 15:40:00 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 22 Feb 2007 15:40:00 +0100 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: References: <248291.42444.qm@web38809.mail.mud.yahoo.com> Message-ID: <45DDAB40.5090203@it.uu.se> Joel Reymont wrote: > The reason I bring this up, btw, has to do with trading systems. > These traditionally use time series implemented on top of arrays. To > calculate a moving average of prices you would allocate an array of N > elements and then destructively update it. > > I know that you could implement the same thing with gb_trees, ETS, > etc. but I don't think these are optimal solutions. I have no doubt > I'll prove it so in the course of AlgoKit implementation. Start out by using this array implementation and see if that will turn out to be sufficient. It's several times faster than dicts or trees. http://user.it.uu.se/~richardc/array/ /Richard From james.hague@REDACTED Thu Feb 22 15:46:01 2007 From: james.hague@REDACTED (James Hague) Date: Thu, 22 Feb 2007 08:46:01 -0600 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: <45DD5F0B.7010507@it.uu.se> References: <5E48532C-FD31-40BC-8A42-DCD8AD5BFEB0@gmail.com> <1826CCF9-F5C9-4960-AE2D-AEF19987CE92@gmail.com> <45DD5F0B.7010507@it.uu.se> Message-ID: > you are likely to end up with some pointers from the old generation into > the new generation, and this breaks the main invariant that the GC is > based on. The result will be an emulator crash. That's only if you put a pointer into a tuple, right? If the VM verified new value was a fixnum or atom, then destructive updates should be okay (after the compiler verifies that the array isn't shared, as Joel originally mentioned). From richardc@REDACTED Thu Feb 22 16:11:08 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 22 Feb 2007 16:11:08 +0100 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: References: <5E48532C-FD31-40BC-8A42-DCD8AD5BFEB0@gmail.com> <1826CCF9-F5C9-4960-AE2D-AEF19987CE92@gmail.com> <45DD5F0B.7010507@it.uu.se> Message-ID: <45DDB28C.3020902@it.uu.se> James Hague wrote: >> you are likely to end up with some pointers from the old generation into >> the new generation, and this breaks the main invariant that the GC is >> based on. The result will be an emulator crash. > > That's only if you put a pointer into a tuple, right? If the VM > verified new value was a fixnum or atom, then destructive updates > should be okay (after the compiler verifies that the array isn't > shared, as Joel originally mentioned). Quite. /Richard From luna@REDACTED Thu Feb 22 16:32:07 2007 From: luna@REDACTED (Daniel Luna) Date: Thu, 22 Feb 2007 16:32:07 +0100 (CET) Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: References: <248291.42444.qm@web38809.mail.mud.yahoo.com> Message-ID: On Thu, 22 Feb 2007, Joel Reymont wrote: > The reason I bring this up, btw, has to do with trading systems. > These traditionally use time series implemented on top of arrays. To > calculate a moving average of prices you would allocate an array of N > elements and then destructively update it. > > I know that you could implement the same thing with gb_trees, ETS, > etc. but I don't think these are optimal solutions. I have no doubt > I'll prove it so in the course of AlgoKit implementation. I really shouldn't say this... As long as the values in the array are simple terms, you can use hipe_bifs:bytearray/2. You never heard this from me. /Luna -- Daniel Luna | Top reasons that I have a beard: luna@REDACTED | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From jakob@REDACTED Thu Feb 22 16:35:56 2007 From: jakob@REDACTED (Jakob Cederlund) Date: Thu, 22 Feb 2007 16:35:56 +0100 Subject: [erlang-questions] where can I get comet? In-Reply-To: <27ccae8e0702212357j58dbb3f6taf3b92cfb804ea41@mail.gmail.com> References: <27ccae8e0702212357j58dbb3f6taf3b92cfb804ea41@mail.gmail.com> Message-ID: <45DDB85C.9080305@erix.ericsson.se> Comet is unsupported, but it's available as part of R8B, after that it was discontinued. It should be possible to use with a later release. There is a download for OTP-R8B on erlang.org. Note that comet only supports the dispatch-interface (IDispatch) in COM. mvh Jakob Shelton Tang wrote: > Hi All, > > I'm working on Windows platform and need to read something from IIS > metabase that is accessible from COM. Currently I'm using a C port to > do that. But I read some doc and find "comet" is a good library to > call COM. May I know where I can get this library? > > > Best regards, > Shelton Tang > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From joelr1@REDACTED Thu Feb 22 16:37:50 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 22 Feb 2007 15:37:50 +0000 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: References: <248291.42444.qm@web38809.mail.mud.yahoo.com> Message-ID: I don't think it works for floats or doubles. It's just bytes or fixnums if I remember it correctly. On Feb 22, 2007, at 3:32 PM, Daniel Luna wrote: > As long as the values in the array are simple terms, you can use > hipe_bifs:bytearray/2. -- http://wagerlabs.com/ From mikpe@REDACTED Thu Feb 22 17:18:34 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 22 Feb 2007 17:18:34 +0100 (MET) Subject: [erlang-questions] Deforesting tuple updates Message-ID: <200702221618.l1MGIYJe018102@harpo.it.uu.se> > From erlang-questions-bounces@REDACTED Thu Feb 22 16:58:18 2007 > Delivered-To: unknown > DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; > h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; > b=MPxH6zAZvOW9/743VhYgLBeeCaCglBbOB3cxjj3naqIpLXTED8XWbzMY8VYcXJGiBqF4brpo1KrJr4PjwN0DQWWCEDETS1nBFC1L3VWiBBcQpXCvxECqOP7HmyaSs4XCvqVcv9NNBWrllMeYKzJbCMxUQDvmWBoRA4IzURxHGbo= > DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; > h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; > b=mp5j5l8tQ1W0xqtVUxCjYA9Ld+pS3/y8hHTXWfcLX1lIr0qhAZRxgKO7/pbR6bp4XVbFOUJ0o2KkA9deELkThp9vDZNOQFY4iR3wV4sB9R4RI5n4EGdGhnzC0fJcOLKioVBIarW7fQHVhMMX/5HikoULwRr4WdiIRwT7Gr92foY= > Mime-Version: 1.0 (Apple Message framework v752.3) > From: Joel Reymont > Date: Thu, 22 Feb 2007 15:37:50 +0000 > To: Daniel Luna > Cc: Erlang Questions > Subject: Re: [erlang-questions] Deforesting tuple updates > X-BeenThere: erlang-questions@REDACTED > X-Mailman-Version: 2.1.6 > List-Id: Erlang/OTP discussions > List-Unsubscribe: , > > List-Archive: > List-Post: > List-Help: > List-Subscribe: , > > Content-Transfer-Encoding: 7bit > X-Spam-Checker-Version: SpamAssassin 2.63-itruleset1 (2004-01-11) on > harpo.it.uu.se > X-Spam-Level: > X-Spam-Status: No, hits=-4.9 required=8.0 tests=BAYES_00 autolearn=ham > version=2.63-itruleset1 > > I don't think it works for floats or doubles. It's just bytes or > fixnums if I remember it correctly. > > On Feb 22, 2007, at 3:32 PM, Daniel Luna wrote: > > > As long as the values in the array are simple terms, you can use > > hipe_bifs:bytearray/2. > > -- > http://wagerlabs.com/ > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > ls From per.gustafsson@REDACTED Thu Feb 22 17:41:01 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 22 Feb 2007 17:41:01 +0100 Subject: [erlang-questions] Deforesting tuple updates In-Reply-To: References: <248291.42444.qm@web38809.mail.mud.yahoo.com> Message-ID: <45DDC79D.2050800@it.uu.se> Joel Reymont wrote: > I don't think it works for floats or doubles. It's just bytes or > fixnums if I remember it correctly. > > On Feb 22, 2007, at 3:32 PM, Daniel Luna wrote: > > >>As long as the values in the array are simple terms, you can use >>hipe_bifs:bytearray/2. > > > -- > http://wagerlabs.com/ > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions You could use this code: -module(floats). -export([new/1,update/3,sum/1, new2/1,update2/3,sum2/1, test/0]). new(N) -> hipe_bifs:bytearray(N*8,0). update(Arr,N,Float) -> <> = <>, Start=N*8, hipe_bifs:bytearray_update(Arr,Start,A1), hipe_bifs:bytearray_update(Arr,Start+1,A2), hipe_bifs:bytearray_update(Arr,Start+2,A3), hipe_bifs:bytearray_update(Arr,Start+3,A4), hipe_bifs:bytearray_update(Arr,Start+4,A5), hipe_bifs:bytearray_update(Arr,Start+5,A6), hipe_bifs:bytearray_update(Arr,Start+6,A7), hipe_bifs:bytearray_update(Arr,Start+7,A8). sum(Bin) -> sum(Bin,0.0). sum(<>, Acc) -> sum(Rest,Float+Acc); sum(<<>>,Acc) -> Acc. Performance is not that great, about 4-5 times faster updates than gb_trees for arrays of 100000 floats, and summing is slower. Per From yarivvv@REDACTED Thu Feb 22 17:45:57 2007 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 22 Feb 2007 11:45:57 -0500 Subject: [erlang-questions] hybrid heap question Message-ID: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> Hi, Is there any reason not to use 'erl -hybrid'? Also, has anyone measured the performance difference it gives to some application that relies on message passing? Side note: I suspect that using a hybrid heap would improve the performance of applications that use the MySQL and/or Postgres drivers as the database queries and result sets wouldn't have to be copied when sent between processes. What do you think? Thanks, Yariv From mighty.fine@REDACTED Thu Feb 22 17:47:44 2007 From: mighty.fine@REDACTED (mighty) Date: Thu, 22 Feb 2007 09:47:44 -0700 Subject: [erlang-questions] bpf port driver Message-ID: i'm very new to erlang and was looking for some help putting together a reasonable driver around bpf. using the tuntap driver in jungerl as a starting point, i have a driver through with which i can successfully write to the bpf... but i'm running into troubles attempting to read from the bpf -- i can't get anything read in from the bpf, and calling driver_select() crashes. i've attached what i've put together so far (it's pretty rough and minimal) minus my attempts to read() from the bpf -- any and all advice would be greatly appreciated (i've looked around at a number of example drivers, but am having a hard time distilling the minimum essence of getting input from a driver into erlang). thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- #include #include #include #include #include #include #include #include #include #include #include #include #include struct bpf_data { ErlDrvPort port; int fd; char dev[sizeof("/dev/bpf0")]; }; static int bpf_dev(struct bpf_data *data) { int i; for (i=0; i<10; i++) { snprintf(data->dev, sizeof(data->dev), "/dev/bpf%u", i); if ((data->fd = open(data->dev, O_RDWR)) != -1) return 0; } return -1; } static int bpf_ifc(struct bpf_data *data, char *ifc) { struct ifreq ifr; int on =1; strncpy(ifr.ifr_name, ifc, sizeof(ifr.ifr_name)); if (ioctl(data->fd, BIOCSETIF, &ifr) != -1) if (ioctl(data->fd, BIOCPROMISC, &on) != -1) if (ioctl(data->fd, BIOCIMMEDIATE, &on) != -1) return 0; return -1; } static ErlDrvData bpf_open(ErlDrvPort port, char *buf) { struct bpf_data *data; while (*buf++ != ' '); if ((data = (struct bpf_data *)driver_alloc(sizeof(struct bpf_data)))) { if (bpf_dev(data) != -1) { if (bpf_ifc(data, buf) != -1) return (ErlDrvData)data; close(data->fd); } driver_free((void *)data); } return ERL_DRV_ERROR_GENERAL; } static void bpf_close(ErlDrvData handle) { struct bpf_data *data; if ((data = (struct bpf_data *)handle)) { close(data->fd); driver_free((void *)data); } } static void bpf_output(ErlDrvData handle, char *buf, int len) { struct bpf_data *data; if ((data = (struct bpf_data *)handle)) if (write(data->fd, buf, len) < 0) driver_failure_posix(data->port, errno); } ErlDrvEntry bpf_driver_entry = { 0, bpf_open, bpf_close, bpf_output, 0, 0, "bpf_drv", 0, 0, 0, 0 }; DRIVER_INIT(bpf) { return &bpf_driver_entry; } -------------- next part -------------- A non-text attachment was scrubbed... Name: bpf.erl Type: application/octet-stream Size: 277 bytes Desc: not available URL: From srp@REDACTED Thu Feb 22 17:53:18 2007 From: srp@REDACTED (Scott Parish) Date: Thu, 22 Feb 2007 16:53:18 +0000 Subject: [erlang-questions] license on documentation man pages Message-ID: <20070222165317.GB20246@srparish.net> The "documentation (man pages)" download comes with a COPYRIGHT file that seems to be completely different from the Erlang Public License: The copyright to the computer program herein is the property of Ericsson Telecom AB, Sweden. The program may be used and/or copied only with the written permission from Ericsson Telecom AB, or in accordance with the terms and conditions stipulated in the agreement/contract under which the program has been supplied. Is this really the license for the documentation, or is this stale and needing to be updated? Thanks sRp From chris.newcombe@REDACTED Fri Feb 23 01:19:43 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Thu, 22 Feb 2007 16:19:43 -0800 Subject: [erlang-questions] Segmentation fault when writing erl_crash.dump In-Reply-To: References: <45D4E531.6020607@club-internet.fr> <45DA17E3.4000707@capflam.org> <781dd98c0702200941v16199797rf22248c3f83eb9a7@mail.gmail.com> Message-ID: <781dd98c0702221619r7c225606o210bbb0262d1fe09@mail.gmail.com> > Seems like a good idea. I'll try to do it for R11B-4. > /Bjorn Thankyou! The responsiveness of the Erlang/OTP team to bug reports (and the frequency and quality of new releases), has been a huge help with promoting Erlang to management (in my environment at least). regards, Chris From lcoquelle@REDACTED Fri Feb 23 02:13:01 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Fri, 23 Feb 2007 09:13:01 +0800 Subject: [erlang-questions] erl -name doesn't work In-Reply-To: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> References: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> Message-ID: Isn't it a problem with localname/fullname? On my ubuntu installation, "erl -name foo" exits with a lot of crash error reports. But "erl -sname foo" work very well; as well as "erl -name foo@REDACTED" Hope this can help (see doc erts/erl for details on options). On 2/22/07, David Tucker wrote: > > Hi, > > I'm running the latest release of Erlang (R11B-3) on Windows XP. When I > run: > > C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -name foo > > it exits immediately -- no shell, no error message of any sort. However, > the following brings up a shell as expected: > > C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -sname foo > Eshell V5.5.3 (abort with ^G) > (foo@REDACTED)1> > > Any idea what I'm doing wrong? Thanks. > > Dave > > ** > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbtleonia@REDACTED Fri Feb 23 02:29:59 2007 From: dbtleonia@REDACTED (David Tucker) Date: Thu, 22 Feb 2007 17:29:59 -0800 Subject: [erlang-questions] erl -name doesn't work In-Reply-To: References: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> Message-ID: <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> Aha. So http://www.erlang.org/doc/doc-5.5.3/erts-5.5.3/doc/html/erl.htmlsays that for -name, you have to specify Name@REDACTED, which contradicts the example at http://www.erlang.org/doc/doc-5.5.3/doc/reference_manual/distributed.html#11.2. (Could someone correct the docs?) Next question: in the absence of an fqdn for my computer, what should I specify for the Host part? An IP address doesn't seem to work. Thanks. Dave On 2/22/07, Ludovic Coquelle wrote: > > Isn't it a problem with localname/fullname? > On my ubuntu installation, "erl -name foo" exits with a lot of crash error > reports. > But "erl -sname foo" work very well; as well as "erl -name > foo@REDACTED" > Hope this can help (see doc erts/erl for details on options). > > On 2/22/07, David Tucker wrote: > > > > Hi, > > > > I'm running the latest release of Erlang (R11B-3) on Windows XP. When I > > run: > > > > C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -name foo > > > > it exits immediately -- no shell, no error message of any sort. > > However, the following brings up a shell as expected: > > > > C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -sname foo > > Eshell V5.5.3 (abort with ^G) > > (foo@REDACTED)1> > > > > Any idea what I'm doing wrong? Thanks. > > > > Dave > > > > ** > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Fri Feb 23 07:54:25 2007 From: matthias@REDACTED (Matthias Lang) Date: Fri, 23 Feb 2007 07:54:25 +0100 Subject: [erlang-questions] erl -name doesn't work In-Reply-To: <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> References: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> Message-ID: <17886.36769.593507.553590@antilipe.corelatus.se> David Tucker writes: > Aha. So > > http://www.erlang.org/doc/doc-5.5.3/erts-5.5.3/doc/html/erl.html > > says > that for -name, you have to specify > Name@REDACTED, which contradicts the example at > http://www.erlang.org/doc/doc-5.5.3/doc/reference_manual/distributed.html#11.2. > (Could someone correct the docs?) I'm not sure the documentation is wrong: ~ >erl -name matthias Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.2 (abort with ^G) (matthias@REDACTED)1> init:script_id(). {"OTP APN 181 01","R11B"} (matthias@REDACTED)2> > Next question: in the absence of an fqdn for my computer, what should I > specify for the Host part? An IP address doesn't seem to work. Works for me: ~ >erl -name matthias@REDACTED Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.2 (abort with ^G) (matthias@REDACTED)1> Looks like some more digging is needed. Is this a general problem on Windows, i.e. do other people have the same problem? (I do not use windows, I can't help) Matthias From vladdu55@REDACTED Fri Feb 23 08:37:33 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 23 Feb 2007 08:37:33 +0100 Subject: [erlang-questions] erl -name doesn't work In-Reply-To: <17886.36769.593507.553590@antilipe.corelatus.se> References: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> <17886.36769.593507.553590@antilipe.corelatus.se> Message-ID: <95be1d3b0702222337n40cd8a0el7cc197ad7949280@mail.gmail.com> > Looks like some more digging is needed. Is this a general problem on > Windows, i.e. do other people have the same problem? (I do not use > windows, I can't help) Works for me on Windows. regards, Vlad From raimo+erlang-questions@REDACTED Fri Feb 23 09:38:02 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 23 Feb 2007 09:38:02 +0100 Subject: [erlang-questions] : erl -name doesn't work In-Reply-To: <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> References: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> Message-ID: <20070223083802.GA11465@erix.ericsson.se> On Thu, Feb 22, 2007 at 05:29:59PM -0800, David Tucker wrote: > Aha. So > http://www.erlang.org/doc/doc-5.5.3/erts-5.5.3/doc/html/erl.htmlsays > that for -name, you have to specify > Name@REDACTED, which contradicts the example at > http://www.erlang.org/doc/doc-5.5.3/doc/reference_manual/distributed.html#11.2. > (Could someone correct the docs?) > > Next question: in the absence of an fqdn for my computer, what should I > specify for the Host part? An IP address doesn't seem to work. > > Thanks. > Try the hostname 'localhost'. It works most of the times, even on windows. erl -sname foo@REDACTED The catch is that you can not reach such a node from another machine, since the name 'localhost' has to resolve to the first machine from the other machine. To make it work, the part after the @ must be a hostname that resolves to the machine the node is running on. And an IP address will unfortunately not do. Use 'ping' from a DOS prompt to see if the hostname works. The hostname part is used to contact the Erlang Port Mapper Daemon on the target machine. That daemon (epmd) is autostarted on every machine that starts an Erlang node in distributed mode (-sname or -name). The nodename part (before the @) is used to ask epmd for a port that the target Erlang node is listening to. That port is used to contact the node and now comes a few final quirks: * If the complete name of the target node as used on the source node does not exactly match the name of the target node as used on the target node; the connection will be rejected. * If both nodes are not using the same connection cookie, the connection will fail. This often works automatically since the default cookie is autogenerated and put as the file .erlang.cookie in the home directory of the user starting the Erlang node. So if both nodes see the same home directory and are started by the same user; it works. Otherwise use the argument -setcookie "any secret string" for both nodes. > Dave > > > On 2/22/07, Ludovic Coquelle wrote: > > > >Isn't it a problem with localname/fullname? > >On my ubuntu installation, "erl -name foo" exits with a lot of crash error > >reports. > >But "erl -sname foo" work very well; as well as "erl -name > >foo@REDACTED" > >Hope this can help (see doc erts/erl for details on options). > > > >On 2/22/07, David Tucker wrote: > >> > >> Hi, > >> > >> I'm running the latest release of Erlang (R11B-3) on Windows XP. When I > >> run: > >> > >> C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -name foo > >> > >> it exits immediately -- no shell, no error message of any sort. > >> However, the following brings up a shell as expected: > >> > >> C:\WINDOWS\system32>"c:\Program Files\erl5.5.3\bin\erl.exe" -sname foo > >> Eshell V5.5.3 (abort with ^G) > >> (foo@REDACTED)1> > >> > >> Any idea what I'm doing wrong? Thanks. > >> > >> Dave > >> > >> ** > >> _______________________________________________ > >> 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 -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From richardc@REDACTED Fri Feb 23 10:02:33 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 23 Feb 2007 10:02:33 +0100 Subject: [erlang-questions] hybrid heap question In-Reply-To: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> References: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> Message-ID: <45DEADA9.40006@it.uu.se> Yariv Sadan wrote: > Is there any reason not to use 'erl -hybrid'? Also, has anyone > measured the performance difference it gives to some application that > relies on message passing? The usual answer to this kind of question is "it varies with the application", but in general I think there are more advantages than disadvantages. For mind-numbing detail, see: http://user.it.uu.se/~richardc/papers/msganalysis.pdf (Look towards the end of the paper for measurements and nice colourful pictures, including some in the appendix.) > Side note: I suspect that using a hybrid heap would improve the > performance of applications that use the MySQL and/or Postgres drivers > as the database queries and result sets wouldn't have to be copied > when sent between processes. What do you think? It depends on whether or not the analysis can deduce that the data will become part of a message. At any rate, it should remove _some_ of the copying. /Richard From ulf.wiger@REDACTED Fri Feb 23 13:24:55 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 23 Feb 2007 13:24:55 +0100 Subject: [erlang-questions] hybrid heap question In-Reply-To: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155010FF71F@esealmw115.eemea.ericsson.se> Hybrid is currently not supported in combination with SMP. I hope that will change eventually. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yariv Sadan > Sent: den 22 februari 2007 17:46 > To: Erlang Questions > Subject: [erlang-questions] hybrid heap question > > Hi, > > Is there any reason not to use 'erl -hybrid'? Also, has > anyone measured the performance difference it gives to some > application that relies on message passing? > > Side note: I suspect that using a hybrid heap would improve > the performance of applications that use the MySQL and/or > Postgres drivers as the database queries and result sets > wouldn't have to be copied when sent between processes. What > do you think? > > Thanks, > Yariv > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rdiaz02@REDACTED Fri Feb 23 14:56:21 2007 From: rdiaz02@REDACTED (Ramon Diaz-Uriarte) Date: Fri, 23 Feb 2007 14:56:21 +0100 Subject: [erlang-questions] book recomm. for distrib. systems Message-ID: <624934630702230556v195f7c61xfa5b5b29bb416c41@mail.gmail.com> Dear All, Apologies if this off-topic. I'd like some advice on books on distributed computing, including, if possible with specific comments on web-based applications and number-crunching work. Ideally, the book should mention Erlang and possibly other approaches to concurrency and distributed computing (Oz, Alice, Haskell ?). (And, sure enough, that ideal book should not require a PhD in CS to work through it). I do not want lengthy discussions of CORBA et al. and the usual web-services, nor a focus on Java et al. I have "Concepts, Techniques, and Models of computer programming", by van Roy and Haridi, that do cover several of these issues over various chapters. But I was thinking of something less tightly coupled to a specific language, and with a heavier emphasis on applied issues. I've seen two potential candidates. "Reliable Distributed Systems" by Birman, "Distributed Systems: Principles and Paradigms" by Tannenbaum and van Steen. But based on the readers reviews in Amazon and the book table of contents, I think these two books are not really what I'm looking for. Thanks, R. -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz From anders.nygren@REDACTED Fri Feb 23 16:06:58 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 23 Feb 2007 09:06:58 -0600 Subject: [erlang-questions] User provided authentication function in ssh_cli Message-ID: While working on an ssh based cli, using ssh_cli, I discovered an undocumented feature. start the listener with ssh_cli:listen(UserFun,Port,[{pwdfun,F}]) where F(User,Passwd) -> true | {false,Reason} And F will be called to vaildate the user/password. /Anders From christophe.romain@REDACTED Fri Feb 23 16:52:22 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Fri, 23 Feb 2007 16:52:22 +0100 Subject: [erlang-questions] CEAN 1.1 available Message-ID: <996CEAF0-6014-4398-A3BC-E45E1BA7A3C0@process-one.net> Hello, The Comprehensive Erlang Archive Network is now available in stable version. CEAN aims to be a central place to find erlang packaged code. It also allows to install a working Erlang minimal system in few seconds, for up to 17 platforms. This new version includes: * packages upgrade * new packages * sunos archives (thanks to Jason A. Hoffman) * cean online help (thanks to Bengt Kleberg) * packaging guide and scripts available * package status available on package description page All information is on CEAN web site http://cean.process-one.net Work in progress for upcoming 1.2 release: * packages classification * ready to use packaged applications * daily automatic package upgrade Work to be done for future versions: * online code server * automatic cluster deployment if you have any question, comment or suggestion, you can email me. Best Regards. From dbtleonia@REDACTED Fri Feb 23 20:41:03 2007 From: dbtleonia@REDACTED (David Tucker) Date: Fri, 23 Feb 2007 11:41:03 -0800 Subject: [erlang-questions] erl -name doesn't work In-Reply-To: <17886.36769.593507.553590@antilipe.corelatus.se> References: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> <17886.36769.593507.553590@antilipe.corelatus.se> Message-ID: <77ac51d70702231141k612c470bp62d906d629b0a8e4@mail.gmail.com> > > Next question: in the absence of an fqdn for my computer, what should I > > specify for the Host part? An IP address doesn't seem to work. > > Works for me: > > ~ >erl -name matthias@REDACTED > Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.5.2 (abort with ^G) > (matthias@REDACTED)1> > > Looks like some more digging is needed. Is this a general problem on > Windows, i.e. do other people have the same problem? (I do not use > windows, I can't help) Interesting; good to know that an IP address _should_ work. Is there any flag I can pass to erl to have it print out more verbose debugging information rather than dying silently? Thanks. Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarivvv@REDACTED Fri Feb 23 23:34:41 2007 From: yarivvv@REDACTED (Yariv Sadan) Date: Fri, 23 Feb 2007 17:34:41 -0500 Subject: [erlang-questions] hybrid heap question In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155010FF71F@esealmw115.eemea.ericsson.se> References: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> <6616D98C65DD514BA2E1DDC5F9223155010FF71F@esealmw115.eemea.ericsson.se> Message-ID: <17244f480702231434q541d313dtef25b6de10f0ba80@mail.gmail.com> Are there any plans to support both? Yariv On 2/23/07, Ulf Wiger (TN/EAB) wrote: > > Hybrid is currently not supported in combination > with SMP. I hope that will change eventually. > > BR, > Ulf W > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yariv Sadan > > Sent: den 22 februari 2007 17:46 > > To: Erlang Questions > > Subject: [erlang-questions] hybrid heap question > > > > Hi, > > > > Is there any reason not to use 'erl -hybrid'? Also, has > > anyone measured the performance difference it gives to some > > application that relies on message passing? > > > > Side note: I suspect that using a hybrid heap would improve > > the performance of applications that use the MySQL and/or > > Postgres drivers as the database queries and result sets > > wouldn't have to be copied when sent between processes. What > > do you think? > > > > Thanks, > > Yariv > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From tty.erlang@REDACTED Sat Feb 24 04:41:40 2007 From: tty.erlang@REDACTED (t ty) Date: Fri, 23 Feb 2007 22:41:40 -0500 Subject: [erlang-questions] Example usage of ssh_sshd Message-ID: <290b3ba10702231941t3623cd8ep892fbf5af9bfae53@mail.gmail.com> Hello, Does someone have a simple example usage of ssh_sshd. On Linux 2.6.6 Debian I get an enoent error. On the server side: Erlang (BEAM) emulator version 5.5.1 [source] [async-threads:0] [hipe] Eshell V5.5.1 (abort with ^G) 1> crypto:start(). ok 2> ssh:start(). ok 3> ssh_sshd:listen(5675, [{system_dir, "."}, {user_passwords, [{"myself","secret"}]}]) 3> . {ok,<0.47.0>} 4> =ERROR REPORT==== 23-Feb-2007::22:28:25 === ** Generic server <0.53.0> terminating ** Last message in was {'EXIT',<0.50.0>,{error,enoent}} ** When Server state == {state,server, <0.50.0>, 18, [], [{<0.55.0>,#Ref<0.0.0.114>}], 0, [{system_dir,"."}, {user_passwords,[{"myself","secret"}]}], [], undefined} ** Reason for termination == ** {error,enoent} ---------------------------------- On the client side: $> ssh -l myself -p 5675 192.168.0.100 I tried using a full path in system_dir but encountered the same problem. Regards, t From tobbe@REDACTED Sat Feb 24 10:19:42 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Sat, 24 Feb 2007 10:19:42 +0100 Subject: [erlang-questions] Example usage of ssh_sshd In-Reply-To: <290b3ba10702231941t3623cd8ep892fbf5af9bfae53@mail.gmail.com> References: <290b3ba10702231941t3623cd8ep892fbf5af9bfae53@mail.gmail.com> Message-ID: Hi, I found that I needed to have a couple of SSH Host keys en the 'system_dir'. So after putting a DSA public/private key there it worked for me with the same set of arguments to ssh_sshd:listen as you are using. --Tobbe t ty wrote: > Hello, > > Does someone have a simple example usage of ssh_sshd. On Linux 2.6.6 > Debian I get an enoent error. > > On the server side: > > Erlang (BEAM) emulator version 5.5.1 [source] [async-threads:0] [hipe] > > Eshell V5.5.1 (abort with ^G) > 1> crypto:start(). > ok > 2> ssh:start(). > ok > 3> ssh_sshd:listen(5675, [{system_dir, "."}, {user_passwords, > [{"myself","secret"}]}]) > 3> . > {ok,<0.47.0>} > 4> > =ERROR REPORT==== 23-Feb-2007::22:28:25 === > ** Generic server <0.53.0> terminating > ** Last message in was {'EXIT',<0.50.0>,{error,enoent}} > ** When Server state == {state,server, > <0.50.0>, > 18, > [], > [{<0.55.0>,#Ref<0.0.0.114>}], > 0, > [{system_dir,"."}, > {user_passwords,[{"myself","secret"}]}], > [], > undefined} > ** Reason for termination == > ** {error,enoent} > > ---------------------------------- > > On the client side: > > $> ssh -l myself -p 5675 192.168.0.100 > > I tried using a full path in system_dir but encountered the same problem. > > Regards, > > t From tty.erlang@REDACTED Sat Feb 24 17:00:12 2007 From: tty.erlang@REDACTED (t ty) Date: Sat, 24 Feb 2007 11:00:12 -0500 Subject: [erlang-questions] Example usage of ssh_sshd In-Reply-To: References: <290b3ba10702231941t3623cd8ep892fbf5af9bfae53@mail.gmail.com> Message-ID: <290b3ba10702240800p71b6691cw4bcf364cae45edbf@mail.gmail.com> Thanks Tobbe, I missed a step when generating my keys. After generating the public key I forgot to add it into the authorized_keys file. That did the trick. t On 2/24/07, Torbjorn Tornkvist wrote: > Hi, > > I found that I needed to have a couple of SSH Host keys > en the 'system_dir'. So after putting a DSA public/private > key there it worked for me with the same set of arguments > to ssh_sshd:listen as you are using. > > --Tobbe > > > t ty wrote: > > Hello, > > > > Does someone have a simple example usage of ssh_sshd. On Linux 2.6.6 > > Debian I get an enoent error. > > > > On the server side: > > > > Erlang (BEAM) emulator version 5.5.1 [source] [async-threads:0] [hipe] > > > > Eshell V5.5.1 (abort with ^G) > > 1> crypto:start(). > > ok > > 2> ssh:start(). > > ok > > 3> ssh_sshd:listen(5675, [{system_dir, "."}, {user_passwords, > > [{"myself","secret"}]}]) > > 3> . > > {ok,<0.47.0>} > > 4> > > =ERROR REPORT==== 23-Feb-2007::22:28:25 === > > ** Generic server <0.53.0> terminating > > ** Last message in was {'EXIT',<0.50.0>,{error,enoent}} > > ** When Server state == {state,server, > > <0.50.0>, > > 18, > > [], > > [{<0.55.0>,#Ref<0.0.0.114>}], > > 0, > > [{system_dir,"."}, > > {user_passwords,[{"myself","secret"}]}], > > [], > > undefined} > > ** Reason for termination == > > ** {error,enoent} > > > > ---------------------------------- > > > > On the client side: > > > > $> ssh -l myself -p 5675 192.168.0.100 > > > > I tried using a full path in system_dir but encountered the same problem. > > > > Regards, > > > > t > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jeffm@REDACTED Mon Feb 26 04:03:54 2007 From: jeffm@REDACTED (jm) Date: Mon, 26 Feb 2007 14:03:54 +1100 Subject: [erlang-questions] Q: recommendations on mnesia record size? Message-ID: <45E24E1A.4090708@ghostgun.com> Are there any guide lines or rules of thumb on how large or complex a record stored in mnesia should be allowed to get before being redesigned? Jeff. From ulf@REDACTED Mon Feb 26 08:24:45 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 26 Feb 2007 08:24:45 +0100 Subject: [erlang-questions] Q: recommendations on mnesia record size? In-Reply-To: <45E24E1A.4090708@ghostgun.com> References: <45E24E1A.4090708@ghostgun.com> Message-ID: Den 2007-02-26 04:03:54 skrev jm : > Are there any guide lines or rules of thumb on how > large or complex a record stored in mnesia should > be allowed to get before being redesigned? Not really, other than the usual reminders that - records are copied (in fact more than once when using transactions), so the size of the record matters in that respect. - the number of fields in the record matters when updating it, since the whole top level is copied each time (although you need a fairly large amount of elements for it to become significant.) In short, there are cost tradeoffs, and you need to get a feeling for them. But while I believe there is an upper limit to the number of elements in a tuple, I don't think it is of practical interest. The system limits are described in: http://www.erlang.org/doc/doc-5.5.3/doc/efficiency_guide/part_frame.html I did see once a program where a whole tree structure was kept as one object in a mnesia database, and the entire tree was read (within a transaction) for each prev/next operation. This is not something I'd recommend. BR, Ulf W -- Ulf Wiger From erlangist@REDACTED Mon Feb 26 16:05:17 2007 From: erlangist@REDACTED (lang er) Date: Mon, 26 Feb 2007 23:05:17 +0800 Subject: [erlang-questions] ei_send multithreaded problem Message-ID: <230465c00702260705h1d428117y519c123a73fa4cea@mail.gmail.com> I'm writing a c node using ei layer. This program is running under Window 2003 enterprise edition sp1, and otp_win32_R11B-3. The following is a fragment of my code: -------------------------------------------------------------------- erlang_pid *pid = (erlang_pid *)pUser; ei_x_buff xbuf; ei_x_new_with_version(&xbuf); ei_x_encode_tuple_header(&xbuf,2); ei_x_encode_atom(&xbuf,"data"); ei_x_encode_binary(&xbuf, buffer, bufSize); ei_send(acceptedFd, pid, xbuf.buff,xbuf.index); ei_x_free(&xbuf); ---------------------------------------------------------------------- It is called inside a C callback function and may be called by many concurrent threads. pUser include a erlang_pid (correspond to a process in Erlang side).When some data come from network, a third party library will invoke this callback function, so ei_send pass these data to a corresponding Erlang process.(This process is an Erlang equivalent to a 3rd library thread. So if I start one process in Erlang side, the 3rd library will use one thread. If I start more than one process in Erlang , the 3rd library will use same number of threads.) Then, If I start one process in Erlang side, everything is OK. But If I start more than one process, the C node program will crash after some random time. If I comment out ei_send line in above code fragment, everything is OK again. Do I miss anything to use ei_send in multithreaded environment? compiler: ms visual studio 2005 debug mode use ei_mdd.lib Thanks, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From eduardo@REDACTED Mon Feb 26 16:46:32 2007 From: eduardo@REDACTED (Eduardo Figoli (INS)) Date: Mon, 26 Feb 2007 13:46:32 -0200 Subject: [erlang-questions] ei_send multithreaded problem In-Reply-To: <230465c00702260705h1d428117y519c123a73fa4cea@mail.gmail.com> Message-ID: <200702261546.l1QFkaWS017832@morgoth.cslab.ericsson.net> Have you tried using a critical section whenever calling ei_send? Regards, Eduardo _____ De: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] En nombre de lang er Enviado el: Lunes, 26 de Febrero de 2007 01:05 p.m. Para: erlang-questions@REDACTED Asunto: [erlang-questions] ei_send multithreaded problem I'm writing a c node using ei layer. This program is running under Window 2003 enterprise edition sp1, and otp_win32_R11B-3. The following is a fragment of my code: -------------------------------------------------------------------- erlang_pid *pid = (erlang_pid *)pUser; ei_x_buff xbuf; ei_x_new_with_version(&xbuf); ei_x_encode_tuple_header(&xbuf,2); ei_x_encode_atom(&xbuf,"data"); ei_x_encode_binary(&xbuf, buffer, bufSize); ei_send(acceptedFd, pid, xbuf.buff,xbuf.index); ei_x_free(&xbuf); ---------------------------------------------------------------------- It is called inside a C callback function and may be called by many concurrent threads. pUser include a erlang_pid (correspond to a process in Erlang side).When some data come from network, a third party library will invoke this callback function, so ei_send pass these data to a corresponding Erlang process.(This process is an Erlang equivalent to a 3rd library thread. So if I start one process in Erlang side, the 3rd library will use one thread. If I start more than one process in Erlang , the 3rd library will use same number of threads.) Then, If I start one process in Erlang side, everything is OK. But If I start more than one process, the C node program will crash after some random time. If I comment out ei_send line in above code fragment, everything is OK again. Do I miss anything to use ei_send in multithreaded environment? compiler: ms visual studio 2005 debug mode use ei_mdd.lib Thanks, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From prabhuram.k@REDACTED Mon Feb 26 20:55:52 2007 From: prabhuram.k@REDACTED (Prabhuram K) Date: Mon, 26 Feb 2007 11:55:52 -0800 Subject: [erlang-questions] Integer list to string list conversion Message-ID: <3052a6dc0702261155y79a1a31fh694a7154ee050075@mail.gmail.com> Hello All, I am a newbie to erlang and I wanted to convert list of integers to a list of strings. For example, [2,3,4,5] to ["2", "3", "4","5"]. Any help would be highly appriciated. Thanks, Prabhu -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Mon Feb 26 21:02:37 2007 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 26 Feb 2007 15:02:37 -0500 Subject: [erlang-questions] Integer list to string list conversion In-Reply-To: <3052a6dc0702261155y79a1a31fh694a7154ee050075@mail.gmail.com> References: <3052a6dc0702261155y79a1a31fh694a7154ee050075@mail.gmail.com> Message-ID: <45E33CDD.3090409@hq.idt.net> 1> [integer_to_list(I) || I <- [2,3,4,5]]. ["2","3","4","5"] or 2> lists:map(fun(I) -> integer_to_list(I) end, [2,3,4,5]). ["2","3","4","5"] Serge Prabhuram K wrote: > Hello All, > I am a newbie to erlang and I wanted to convert list of integers to a > list of strings. For example, > [2,3,4,5] to ["2", "3", "4","5"]. Any help would be highly appriciated. > > Thanks, > Prabhu From raould@REDACTED Tue Feb 27 00:42:20 2007 From: raould@REDACTED (Raoul Duke) Date: Mon, 26 Feb 2007 15:42:20 -0800 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> Message-ID: <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> [i thought i was already subscribed, but i guess not. apologies if this ends up dup'ing at all.] Hi, Apologies if there is something obvious I missed... I'm having newbie trouble trying to get Distel talking to my shell node. So I then simplified to trying to get 2 nodes on the same machine working. I think I've gone through most of the things people report has considerations (via doing google searches for my issue). Things I've checked: * using -sname, not -name, each shell reports the right short name via node(). * cookies are the same via erlang:get_cookie(). * epmd reports both nodes, with appropriate short names. * tried referencing a pid as well as a registered name on the other node. Calling on the process on the other node hangs for a moment, and nothing appears on the other node (simple echo program listed below). * tried using JCL to start a remote shell - it shows in the job list - then connect - it is dead as soon as i connect to that job "ERROR: Shell process terminated!" this is on erlang-R11B-0.1.el4.kb on CentOS 4.4 i386 (on OpenVZ). [in Distel, I have it configured via .emacs to pass "-R9" as a switch, not sure when/why I added that. I've tried the nodes with and w/out that, no apparent resulting difference.] -module(echo). -export([new/0, dispatch/0]). new() -> Echo = spawn(echo, dispatch, []), register(techo, Echo). dispatch() -> receive dispose -> true; _Msg -> erlang:display("got message"), dispatch() end. From jeffm@REDACTED Tue Feb 27 06:28:23 2007 From: jeffm@REDACTED (jm) Date: Tue, 27 Feb 2007 16:28:23 +1100 Subject: [erlang-questions] Q: recommendations on mnesia record size? In-Reply-To: References: <45E24E1A.4090708@ghostgun.com> Message-ID: <45E3C177.9060208@ghostgun.com> Ulf Wiger wrote: > The system limits are described in: > http://www.erlang.org/doc/doc-5.5.3/doc/efficiency_guide/part_frame.html > > I did see once a program where a whole tree structure > was kept as one object in a mnesia database, and the > entire tree was read (within a transaction) for each > prev/next operation. This is not something I'd recommend. > Thanks. I could see my records heading off into whatever is the opposite of "reductio ad absurdum". Jeff. From mats.cronqvist@REDACTED Tue Feb 27 09:32:18 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 27 Feb 2007 09:32:18 +0100 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> Message-ID: <45E3EC92.7060005@ericsson.com> Raoul Duke wrote: [..] > So I then simplified to trying to get 2 nodes on the same > machine working. [...] i take it that it doesn't work. if you start 2 erls like this; $ xterm -e erl -sname bla & $ xterm -e erl -sname foo & and ping one from the other; (foo@REDACTED)1> net:ping(bla@REDACTED). what do you get? mats From richardc@REDACTED Tue Feb 27 13:23:39 2007 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 27 Feb 2007 13:23:39 +0100 Subject: [erlang-questions] 2006 Obfuscated Erlang Competition Message-ID: <45E422CB.2020400@it.uu.se> It seems that the results of the 2006 OEC were never announced to this list, but for the curious, there is a page at Erlang-consulting: http://www.erlang-consulting.com/obfuscatederlang.html Enjoy, /Richard From dmitriid@REDACTED Tue Feb 27 13:41:46 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Tue, 27 Feb 2007 14:41:46 +0200 Subject: [erlang-questions] 2006 Obfuscated Erlang Competition In-Reply-To: <45E422CB.2020400@it.uu.se> References: <45E422CB.2020400@it.uu.se> Message-ID: <45E4270A.6030406@gmail.com> I just announced them over at a Russian site, RSDN.ru :) What a coincidence. However, where is the full source for the second prize? Because it says "a sample of the code". Or is it the full source? :) Richard Carlsson wrote: > It seems that the results of the 2006 OEC were never announced to this > list, but for the curious, there is a page at Erlang-consulting: > http://www.erlang-consulting.com/obfuscatederlang.html > > Enjoy, > > /Richard > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From erlangist@REDACTED Tue Feb 27 15:41:11 2007 From: erlangist@REDACTED (lang er) Date: Tue, 27 Feb 2007 22:41:11 +0800 Subject: [erlang-questions] ei_send multithreaded problem In-Reply-To: <45e300dc.3d10d2d8.5742.4d11SMTPIN_ADDED@mx.google.com> References: <230465c00702260705h1d428117y519c123a73fa4cea@mail.gmail.com> <45e300dc.3d10d2d8.5742.4d11SMTPIN_ADDED@mx.google.com> Message-ID: <230465c00702270641n3d31ec57kea1184bfccc181c5@mail.gmail.com> But in the erl_interface document, it said: > If you are using Erl Interface functions in a threaded application based > on POSIX threads or Solaris > threads, then Erl Interface needs access to some of the synchronization > facilities in your threads > package, and you will need to specify additional compiler flags in order > to indicate which of the > packages you are using. Define REENTRANT and either STHREADS or PTHREADS. > The default is to use > POSIX threads if REENTRANT is specified. > Note that both single threaded and default versions of the Erl interface > and Ei libraries are provided. > (The single threaded versions are named liberl interface st and libei st). > Whether the default > versions of the libraries have support for threads or not is determined by > if the platform in question has > support for POSIX or Solaris threads. To check this, have a look in the > eidefs.mk file in the > erl interface src directory. I checked the eidefs.mk file, its content is: # Have the ei and erl_interface libs been compiled for threads? EI_THREADS=true # Threads flags THR_DEFS=-DWIN32_THREADS -DUSE_DECLSPEC_THREAD # Threads libs THR_LIBS= # ---------------------------------------------------------------------- Doesn't it means I don't need use any synchronization facilities myself? Thanks! James 2007/2/26, Eduardo Figoli (INS) : > > Have you tried using a critical section whenever calling ei_send? > > > > Regards, Eduardo > > > ------------------------------ > > *De:* erlang-questions-bounces@REDACTED [mailto: > erlang-questions-bounces@REDACTED] *En nombre de *lang er > *Enviado el:* Lunes, 26 de Febrero de 2007 01:05 p.m. > *Para:* erlang-questions@REDACTED > *Asunto:* [erlang-questions] ei_send multithreaded problem > > > > I'm writing a c node using ei layer. This program is running under Window > 2003 enterprise edition sp1, and otp_win32_R11B-3. The following is a > fragment of my code: > > > > -------------------------------------------------------------------- > > erlang_pid *pid = (erlang_pid *)pUser; > ei_x_buff xbuf; > ei_x_new_with_version(&xbuf); > ei_x_encode_tuple_header(&xbuf,2); > ei_x_encode_atom(&xbuf,"data"); > ei_x_encode_binary(&xbuf, buffer, bufSize); > ei_send(acceptedFd, pid, xbuf.buff,xbuf.index); > ei_x_free(&xbuf); > > ---------------------------------------------------------------------- > > > > > > It is called inside a C callback function and may be called by many > concurrent threads. pUser include a erlang_pid (correspond to a process in > Erlang side).When some data come from network, a third party library > will invoke this callback function, so ei_send pass these data to a > corresponding Erlang process.(This process is an Erlang equivalent to a 3rd > library thread. So if I start one process in Erlang side, the 3rd library > will use one thread. If I start more than one process in Erlang , the 3rd > library will use same number of threads.) > > > > > > Then, If I start one process in Erlang side, everything is OK. But If I > start more than one process, the C node program will crash after some random > time. If I comment out ei_send line in above code fragment, everything is > OK again. > > > > Do I miss anything to use ei_send in multithreaded environment? > > > > compiler: ms visual studio 2005 > > debug mode use ei_mdd.lib > > > > > > > > Thanks, > > James > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Tue Feb 27 16:15:16 2007 From: toby@REDACTED (Toby Thain) Date: Tue, 27 Feb 2007 10:15:16 -0500 Subject: [erlang-questions] Q: recommendations on mnesia record size? In-Reply-To: <45E3C177.9060208@ghostgun.com> References: <45E24E1A.4090708@ghostgun.com> <45E3C177.9060208@ghostgun.com> Message-ID: On 27-Feb-07, at 12:28 AM, jm wrote: > Ulf Wiger wrote: >> The system limits are described in: >> http://www.erlang.org/doc/doc-5.5.3/doc/efficiency_guide/ >> part_frame.html >> >> I did see once a program where a whole tree structure >> was kept as one object in a mnesia database, and the >> entire tree was read (within a transaction) for each >> prev/next operation. This is not something I'd recommend. >> > > Thanks. I could see my records heading off into whatever is the > opposite > of "reductio ad absurdum". ad infinitum? --T (or ad nauseam comes to mind :) > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From raould@REDACTED Tue Feb 27 19:33:26 2007 From: raould@REDACTED (Raoul Duke) Date: Tue, 27 Feb 2007 10:33:26 -0800 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <45E3EC92.7060005@ericsson.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> <45E3EC92.7060005@ericsson.com> Message-ID: <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> > and ping one from the other; > (foo@REDACTED)1> net:ping(bla@REDACTED). > what do you get? hi Mats, many thanks for your email. I used 'screen' (since I don't have X set up) and the ping test works. Some observations: a) it works real fast if i say net:ping(bla). b) it works much more slowly if i say net:ping(bla@REDACTED). c) [expected] it gives an error for net:ping(bla@REDACTED). d) i can use JCL to start a remote shell from foo on bla, but trying to connect to that job still gives the "Shell process terminated!" error. e) I tried starting my echo process remotely, and that did not work: (bla@REDACTED)2> EchoPid = spawn(foo, echo, new, []). <0.44.0> =ERROR REPORT==== 27-Feb-2007::11:37:48 === ** Can not start echo:new,[] on foo ** Dunno what that all indicates? sincerely. From jan@REDACTED Tue Feb 27 21:49:44 2007 From: jan@REDACTED (Jan Henry Nystrom) Date: Tue, 27 Feb 2007 21:49:44 +0100 Subject: [erlang-questions] 2006 Obfuscated Erlang Competition In-Reply-To: <45E4270A.6030406@gmail.com> References: <45E422CB.2020400@it.uu.se> <45E4270A.6030406@gmail.com> Message-ID: <45E49968.9080007@erlang-consulting.com> Dmitrii 'Mamut' Dimandt wrote: > I just announced them over at a Russian site, RSDN.ru :) What a coincidence. > > However, where is the full source for the second prize? Because it says > "a sample of the code". Or is it the full source? :) The full source code was deemed to large to put on the web page. I will dig it out for you. /Cheers Henry Jan Henry Nystrom Training Manager Erlang Training and Consulting www.erlang-consulting.com > > Richard Carlsson wrote: >> It seems that the results of the 2006 OEC were never announced to this >> list, but for the curious, there is a page at Erlang-consulting: >> http://www.erlang-consulting.com/obfuscatederlang.html >> >> Enjoy, >> >> /Richard >> >> _______________________________________________ >> 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: jan.vcf Type: text/x-vcard Size: 438 bytes Desc: not available URL: From fritchie@REDACTED Tue Feb 27 22:11:28 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 27 Feb 2007 15:11:28 -0600 Subject: [erlang-questions] bpf port driver In-Reply-To: Message of "Thu, 22 Feb 2007 09:47:44 MST." Message-ID: <200702272111.l1RLBSqP040350@snookles.snookles.com> >>>>> "mf" == mighty writes: mf> i'm very new to erlang and was looking for some help putting mf> together a reasonable driver around bpf. For what it's worth, one of the examples in the Erlang Driver Toolkit has a full Erlang driver for libpcap. For source code, see http://www.snookles.com/erlang/edtk/ -Scott From raould@REDACTED Wed Feb 28 01:37:00 2007 From: raould@REDACTED (Raoul Duke) Date: Tue, 27 Feb 2007 16:37:00 -0800 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> <45E3EC92.7060005@ericsson.com> <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> Message-ID: <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> > hi Mats, many thanks for your email. I used 'screen' (since I don't > have X set up) and the ping test works. Some observations: > a) it works real fast if i say net:ping(bla). > b) it works much more slowly if i say net:ping(bla@REDACTED). Wait! I take it all back! Turns out I thought that "pang" was just a funny ha ha foreign version of "pong". Now that I'm looking at the source for net_adm.erl it appears that "pang" really means "error" because there is a "pong" case for {ok, yes}. Moral: a) if "pang" means error, i think "pang" is a pretty misleading thing to be responding with :-) and "error" or "failed" or something like that would be more helpful to newbies. b) well getting "pang" [if it means error] is at least consistent with the results of my other experiments. sincerely. From raould@REDACTED Wed Feb 28 01:56:33 2007 From: raould@REDACTED (Raoul Duke) Date: Tue, 27 Feb 2007 16:56:33 -0800 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> <45E3EC92.7060005@ericsson.com> <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> Message-ID: <91a2ba3e0702271656h6a1890bct685b98c2d9d36a5d@mail.gmail.com> Following the notes at http://www.erlang.org/faq/x982.html, which for some reason I had not managed to stumble across before, I restarted epmd with "-d -d" and watched the output while starting two nodes on the same machine with snames, and trying to ping each other. It did show relevant output while starting the nodes (see excerpt below). However, when I tried various forms of ping, nothing at all appeared from epmd. I will try to see if I can use tcpdump or nc or something to find any packets. As I (briefly) mentioned in my original post, this is all running in OpenVZ which is a virtualization system. I wonder if networking addresses or something get screwy? But I would have expected anything doing the equivalent of "localhost" to work fine (it does for other unixy things). epmd: Tue Feb 27 17:55:47 2007: got 18 bytes ***** 00000000 00 10 78 e6 ce 4d 00 00 05 00 05 00 03 6f 6e 65 |..x..M.......one| ***** 00000010 00 00 |..| epmd: Tue Feb 27 17:55:47 2007: ** got ALIVE2_REQ epmd: Tue Feb 27 17:55:47 2007: registering 'one:3', port 59086 epmd: Tue Feb 27 17:55:47 2007: type 77 proto 0 highvsn 5 lowvsn 5 epmd: Tue Feb 27 17:55:47 2007: got 4 bytes ***** 00000000 79 00 00 03 |y...| epmd: Tue Feb 27 17:55:47 2007: ** sent ALIVE2_RESP for "one" epmd: Tue Feb 27 17:56:07 2007: opening connection on file descriptor 5 From amila_maha@REDACTED Wed Feb 28 05:32:29 2007 From: amila_maha@REDACTED (Amila Maha Arachchi) Date: Tue, 27 Feb 2007 20:32:29 -0800 (PST) Subject: [erlang-questions] Troubles with FTP Message-ID: <707664.78281.qm@web43140.mail.sp1.yahoo.com> Hi, Im trying to use the ftp module in Erlang. When I try to download file using ftp:recv, the Erlang shell gets crashed. I am able to try out the commands like pwd and cd only. I can download files from the same server using normal ftp connection from my PC. But when i try it with erlang, the above mentioned problem arises. I dont get any error mesege either. Just the shell crashes. Can somebody help me. Thanks. ____________________________________________________________________________________ Have a burning question? Go to www.Answers.yahoo.com and get answers from real people who know. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Wed Feb 28 08:28:02 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 28 Feb 2007 08:28:02 +0100 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> <45E3EC92.7060005@ericsson.com> <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> Message-ID: <45E52F02.9090804@ericsson.com> Raoul Duke wrote: >> hi Mats, many thanks for your email. I used 'screen' (since I don't >> have X set up) and the ping test works. Some observations: >> a) it works real fast if i say net:ping(bla). >> b) it works much more slowly if i say net:ping(bla@REDACTED). > > Wait! I take it all back! Turns out I thought that "pang" was just a > funny ha ha foreign version of "pong". Now that I'm looking at the > source for net_adm.erl it appears that "pang" really means "error" > because there is a "pong" case for {ok, yes}. Moral: > > a) if "pang" means error, i think "pang" is a pretty misleading thing > to be responding with :-) and "error" or "failed" or something like > that would be more helpful to newbies. yes, that really sucks. fyi, "pang" is the sound cartoon guns makes in swedish. i guess way back, when the Erlang user base fit in an elevator, someone thought it was funny that ping could return pong (good) or pang (bad). and i guess it is kind of funny, but only if you speak swedish... > b) well getting "pang" [if it means error] is at least consistent with > the results of my other experiments. yes, unfortunately. if you have two nodes, on the same machine, with the same cookie, running the same version of the distribution protocol, if should work. how about if you start the nodes like this; erl -sname bla@REDACTED erl -sname foo@REDACTED mats From surindar.shanthi@REDACTED Wed Feb 28 12:45:18 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 28 Feb 2007 17:15:18 +0530 Subject: [erlang-questions] STUN client in erlang Message-ID: <42ea5fb60702280345v487a043eiee1f2256f7635b69@mail.gmail.com> Dear all, Is there any open source for stun client available in erlang? If so, please give me the information regarding that. Thanks and Regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed Feb 28 13:03:11 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 28 Feb 2007 13:03:11 +0100 Subject: [erlang-questions] STUN client in erlang In-Reply-To: <42ea5fb60702280345v487a043eiee1f2256f7635b69@mail.gmail.com> References: <42ea5fb60702280345v487a043eiee1f2256f7635b69@mail.gmail.com> Message-ID: <95be1d3b0702280403v67fb01acm8a130dd6e6d25b2d@mail.gmail.com> Hi, http://erlang.org/ml-archive/erlang-questions/200603/msg00324.html It says client functionality is there too. regards, Vlad On 2/28/07, Surindar Sivanesan wrote: > > Dear all, > > Is there any open source for stun client available in erlang? > If so, please give me the information regarding that. > > Thanks and Regards, > S.Surindar > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From kenneth.lundin@REDACTED Wed Feb 28 13:25:18 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 28 Feb 2007 13:25:18 +0100 Subject: [erlang-questions] hybrid heap question In-Reply-To: <17244f480702231434q541d313dtef25b6de10f0ba80@mail.gmail.com> References: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> <6616D98C65DD514BA2E1DDC5F9223155010FF71F@esealmw115.eemea.ericsson.se> <17244f480702231434q541d313dtef25b6de10f0ba80@mail.gmail.com> Message-ID: Hi, >From our view (OTP team at Ericsson) the Hybrid heap version of the emulator is experimental. With expreimental I mean that: - it is definately not as stable and well tested as the mature separate heap solution. - it is not used in any products as far as I know. - The hybrid heap can be a very good solution when it is finished. The lack of compiler support (identifying data that will be sent in a message and can be put on shared heap from the beginning) and the lack of incremental GC makes it less useful in real products. There will for example be very long GC's in the current system, which interrupts all other execution in the VM. - We have no immediate plans to make Hybrid heap and SMP work together for several reasons. 1) The separate heap and SMP works very very well and we see no problems with using that for any type of application. 2) We are dependent on the competence from the HiPE group in Uppsala University regarding the Hybrid heap ,we will happily include their contribution if they make Hybrid heap work together with SMP , add incremental GC etc. In summary: Today the separate heap (default) solution is the stable and recommended one for both SMP and non SMP cases. Hybrid heap is experimental from our point of view. Might be very stable on non SMP but that is nothing we guarantee. /Regards Kenneth (OTP team at Ericsson) On 2/23/07, Yariv Sadan wrote: > Are there any plans to support both? > > Yariv > > > On 2/23/07, Ulf Wiger (TN/EAB) wrote: > > > > Hybrid is currently not supported in combination > > with SMP. I hope that will change eventually. > > > > BR, > > Ulf W > > > > > -----Original Message----- > > > From: erlang-questions-bounces@REDACTED > > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yariv Sadan > > > Sent: den 22 februari 2007 17:46 > > > To: Erlang Questions > > > Subject: [erlang-questions] hybrid heap question > > > > > > Hi, > > > > > > Is there any reason not to use 'erl -hybrid'? Also, has > > > anyone measured the performance difference it gives to some > > > application that relies on message passing? > > > > > > Side note: I suspect that using a hybrid heap would improve > > > the performance of applications that use the MySQL and/or > > > Postgres drivers as the database queries and result sets > > > wouldn't have to be copied when sent between processes. What > > > do you think? > > > > > > Thanks, > > > Yariv > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kostis@REDACTED Wed Feb 28 14:51:35 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 28 Feb 2007 14:51:35 +0100 Subject: [erlang-questions] hybrid heap question In-Reply-To: References: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> <6616D98C65DD514BA2E1DDC5F9223155010FF71F@esealmw115.eemea.ericsson.se> <17244f480702231434q541d313dtef25b6de10f0ba80@mail.gmail.com> Message-ID: <45E588E7.80603@cs.ntua.gr> Kenneth Lundin wrote: > Hi, > >>From our view (OTP team at Ericsson) the Hybrid heap version of the > emulator is experimental. With expreimental I mean that: > - it is definately > not as stable and well tested as the mature separate heap solution. > - it is not used in any products as far as I know. > - The hybrid heap can be a very good solution when it is finished. The lack of > compiler support (identifying data that will be sent in a message and > can be put on shared heap from the beginning) and the lack of > incremental GC makes it less useful in real products. There will for > example be very long GC's in the current system, which interrupts all > other execution in the VM. > - We have no immediate plans to make Hybrid heap and SMP work together > for several reasons. 1) The separate heap and SMP works very very well > and we see no problems with using that for any type of application. > 2) We are dependent on the competence from the HiPE group in Uppsala > University regarding the Hybrid heap ,we will happily include their > contribution if > they make Hybrid heap work together with SMP , add incremental GC etc. > > In summary: Today the separate heap (default) solution is the stable > and recommended one for both SMP and non SMP cases. > Hybrid heap is experimental from our point of view. Might be very > stable on non SMP but that is nothing we guarantee. > > /Regards Kenneth (OTP team at Ericsson) As somebody very involved in the design and implementation of the Hybrid heap version of the Erlang emulator, I just want to point out for the record that the following: > There will for example be very long GC's in the current system, > which interrupts all other execution in the VM. is a general "feature" in Erlang/OTP and is not specific to the Hybrid vs. Private heap implementation. Currently, the garbage collector of the Erlang/OTP system is not incremental and cannot be preempted. This means that there is absolutely no guarantee that GC will not take arbitrary long time. Again for the record, I have to point out that this does *not* seem to be a big problem in practice -- GC in Erlang/OTP is actually very fast most of the times. However, that there is no bounded GC time guarantee holds independently of the architecture of the system and I know of no fundamental reasons why the situation is in principle worse in the Hybrid heap system. In fact, it can actually be better because the Hybrid heap system fundamentally shares data which is otherwise copied (possibly multiple times) when processes communicate in a Private heap environment. Again, this worst case situation does not seem to occur very often in practice either. Kostis (HiPE team) From toby@REDACTED Wed Feb 28 15:32:50 2007 From: toby@REDACTED (Toby Thain) Date: Wed, 28 Feb 2007 09:32:50 -0500 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <45E52F02.9090804@ericsson.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> <45E3EC92.7060005@ericsson.com> <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> <45E52F02.9090804@ericsson.com> Message-ID: On 28-Feb-07, at 2:28 AM, Mats Cronqvist wrote: > Raoul Duke wrote: >>> hi Mats, many thanks for your email. I used 'screen' (since I don't >>> have X set up) and the ping test works. Some observations: >>> a) it works real fast if i say net:ping(bla). >>> b) it works much more slowly if i say net:ping(bla@REDACTED). >> >> Wait! I take it all back! Turns out I thought that "pang" was just a >> funny ha ha foreign version of "pong". Now that I'm looking at the >> source for net_adm.erl it appears that "pang" really means "error" >> because there is a "pong" case for {ok, yes}. Moral: >> >> a) if "pang" means error, i think "pang" is a pretty misleading thing >> to be responding with :-) and "error" or "failed" or something like >> that would be more helpful to newbies. > > yes, that really sucks. fyi, "pang" is the sound cartoon guns > makes in > swedish. i guess way back, when the Erlang user base fit in an > elevator, someone > thought it was funny that ping could return pong (good) or pang > (bad). and i > guess it is kind of funny, but only if you speak swedish... It's also a vaguely apposite pun in English -- at least, it wasn't completely random to me even though I didn't know the Swedish meaning. --Toby http://www.answers.com/topic/pang From kenneth.lundin@REDACTED Wed Feb 28 17:25:00 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 28 Feb 2007 17:25:00 +0100 Subject: [erlang-questions] hybrid heap question In-Reply-To: <45E588E7.80603@cs.ntua.gr> References: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> <6616D98C65DD514BA2E1DDC5F9223155010FF71F@esealmw115.eemea.ericsson.se> <17244f480702231434q541d313dtef25b6de10f0ba80@mail.gmail.com> <45E588E7.80603@cs.ntua.gr> Message-ID: Hi, Yes I agree with Kostis that the GC is not incremental in the separate heap solution either and it is possible to get a very long GC there as well. In practice there seems to be very little problems with this. The situation is actually better in the SMP emulator running with a number of scheduler threads because only the scheduler thread running the process whose heap is garbage collected will be occupied with the possibly big GC. All other scheduler threads can execute Erlang processes and even send messages to the process which is under GC. Because the hybrid heap involves a heap which is shared between all processes it is harder to do a GC without impact on all processes during that time. Incremental GC is therefore more of a necessity for Hybrid heap than for the separate heap solution at least in the SMP emulator. Implementing the incremental GC for the SMP emulator will also be harder than for the non SMP emulator I think. I might whoever be wrong in the assumption that it is more likely to get a very big collection of data in one GC with the Hybrid heap. /Kenneth On 2/28/07, Kostis Sagonas wrote: > Kenneth Lundin wrote: > > Hi, > > > >>From our view (OTP team at Ericsson) the Hybrid heap version of the > > emulator is experimental. With expreimental I mean that: > > - it is definately > > not as stable and well tested as the mature separate heap solution. > > - it is not used in any products as far as I know. > > - The hybrid heap can be a very good solution when it is finished. The lack of > > compiler support (identifying data that will be sent in a message and > > can be put on shared heap from the beginning) and the lack of > > incremental GC makes it less useful in real products. There will for > > example be very long GC's in the current system, which interrupts all > > other execution in the VM. > > - We have no immediate plans to make Hybrid heap and SMP work together > > for several reasons. 1) The separate heap and SMP works very very well > > and we see no problems with using that for any type of application. > > 2) We are dependent on the competence from the HiPE group in Uppsala > > University regarding the Hybrid heap ,we will happily include their > > contribution if > > they make Hybrid heap work together with SMP , add incremental GC etc. > > > > In summary: Today the separate heap (default) solution is the stable > > and recommended one for both SMP and non SMP cases. > > Hybrid heap is experimental from our point of view. Might be very > > stable on non SMP but that is nothing we guarantee. > > > > /Regards Kenneth (OTP team at Ericsson) > > As somebody very involved in the design and implementation of the Hybrid > heap version of the Erlang emulator, I just want to point out for the > record that the following: > > > There will for example be very long GC's in the current system, > > which interrupts all other execution in the VM. > > is a general "feature" in Erlang/OTP and is not specific to the Hybrid > vs. Private heap implementation. Currently, the garbage collector of > the Erlang/OTP system is not incremental and cannot be preempted. This > means that there is absolutely no guarantee that GC will not take > arbitrary long time. Again for the record, I have to point out that > this does *not* seem to be a big problem in practice -- GC in Erlang/OTP > is actually very fast most of the times. However, that there is no > bounded GC time guarantee holds independently of the architecture of the > system and I know of no fundamental reasons why the situation is in > principle worse in the Hybrid heap system. In fact, it can actually be > better because the Hybrid heap system fundamentally shares data which is > otherwise copied (possibly multiple times) when processes communicate in > a Private heap environment. Again, this worst case situation does not > seem to occur very often in practice either. > > Kostis (HiPE team) > From garry@REDACTED Wed Feb 28 17:48:40 2007 From: garry@REDACTED (Garry Hodgson) Date: Wed, 28 Feb 2007 11:48:40 -0500 (EST) Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <45E52F02.9090804@ericsson.com> References: <45E52F02.9090804@ericsson.com> Message-ID: <2007022811481172681320@k2.sage.att.com> Mats Cronqvist wrote: > Raoul Duke wrote: > > a) if "pang" means error, i think "pang" is a pretty misleading thing > > to be responding with :-) and "error" or "failed" or something like > > that would be more helpful to newbies. > > yes, that really sucks. fyi, "pang" is the sound cartoon guns makes in > swedish. i guess way back, when the Erlang user base fit in an elevator, someone > thought it was funny that ping could return pong (good) or pang (bad). and i > guess it is kind of funny, but only if you speak swedish... i *love* pang! don't ever change that. ---- Garry Hodgson, Senior Software Geek, AT&T CSO do for others with no desire of return. we should all plant some trees we will never sit under. From raould@REDACTED Wed Feb 28 19:51:37 2007 From: raould@REDACTED (Raoul Duke) Date: Wed, 28 Feb 2007 10:51:37 -0800 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <2007022811481172681320@k2.sage.att.com> References: <45E52F02.9090804@ericsson.com> <2007022811481172681320@k2.sage.att.com> Message-ID: <91a2ba3e0702281051l16a2f15fqbf5ebe8b08b803db@mail.gmail.com> > i *love* pang! don't ever change that. how about a "-newbie" flag for erl? ;-) From cd5@REDACTED Wed Feb 28 20:02:03 2007 From: cd5@REDACTED (Christoph Dornheim) Date: Wed, 28 Feb 2007 19:02:03 +0000 (UTC) Subject: [erlang-questions] No message sent when closing socket Message-ID: Hi, I have an application where a TCP-connection should be terminated by any process having its socket available. The socket S is accepted by a server socket running in active mode: gen_tcp:listen(1234, [list, {packet, line}, {active, true}]) The controlling process receives the incoming data from S as expected. The receive clause lets the process terminate normally when the message {tcp_closed,S} is received. I expected that gen_tcp:close(S) sends this message to the controlling process, but unfortunately, no message is sent (although the socket got closed, confirmed by inet:i() ). Did I miss something in the gen_tcp documentation? Alternatively, I can use gen_tcp:shutdown(S, read_write) which works fine and sends the close message. I'm wondering why gen_tcp:close does not inform the controlling process that its socket is closed. Is it generally a better way to close a socket by using gen_tcp:shutdown instead of gen_tcp:close? Best regards, Christoph From raould@REDACTED Wed Feb 28 20:20:28 2007 From: raould@REDACTED (Raoul Duke) Date: Wed, 28 Feb 2007 11:20:28 -0800 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <45E52F02.9090804@ericsson.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> <45E3EC92.7060005@ericsson.com> <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> <45E52F02.9090804@ericsson.com> Message-ID: <91a2ba3e0702281120v2ef41732mf72a3dcb706da81d@mail.gmail.com> > yes, unfortunately. > if you have two nodes, on the same machine, with the same cookie, running the > same version of the distribution protocol, if should work. > how about if you start the nodes like this; > erl -sname bla@REDACTED > erl -sname foo@REDACTED using "localhost" or "mail" (the name of the machine) only gave pangs. thanks for your time on this, i will chalk it up to my OpenVZ setup being pathalogical. From serge@REDACTED Wed Feb 28 21:01:01 2007 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 28 Feb 2007 15:01:01 -0500 Subject: [erlang-questions] configuration options Message-ID: <45E5DF7D.2060101@hq.idt.net> Folks, I wanted to discuss an OTP feature request that I think would be helpful for environments involving many nodes. When there are many nodes deployed each having custom configuration, it is desirable to have a solution that would manage that configuration centrally, and serve it to nodes upon startup (or at a special configuration reload request). A sys.config file for a release allows for pointing out to other .config files: [{Application, [{Par, Val}]} | File::string()]. If this implementation was extended to be: [{Application, [{Par, Val}]} | ConfigFunCallback | File::string()]. ConfigFunCallback = {M, F, Args} M = atom() F = (Env, Args) -> [File::string()] Args = list() then this would allow for ConfigFunCallback to return a list of config File names that would be processed in an ordinary manner. This would enable the callback function to download configuration from a centrally managed resource, and save it locally prior to having the config files loaded by the application_controller. This seems like a simple extension of the application_controller:check_conf/0 function, yet the benefit looks very compelling, as it would alleviate the need to maintain configuration files (other than a very basic and trimmed down sys.config) locally at every node [1]. Would this approach be compatible with the release handler? I'd appreciate getting some feedback on this subject. Regards, Serge [1] Apparently, ConfigFunCallback function would need to be smart enough to keep last known configuration locally in case there's a connectivity issue with the central configuration resource(s) so that the boot process could continue. -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From ulf@REDACTED Wed Feb 28 21:52:26 2007 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 28 Feb 2007 21:52:26 +0100 Subject: [erlang-questions] hybrid heap question In-Reply-To: References: <17244f480702220845m666f9d0bqb8b066821427a285@mail.gmail.com> <6616D98C65DD514BA2E1DDC5F9223155010FF71F@esealmw115.eemea.ericsson.se> <17244f480702231434q541d313dtef25b6de10f0ba80@mail.gmail.com> <45E588E7.80603@cs.ntua.gr> Message-ID: Den 2007-02-28 17:25:00 skrev Kenneth Lundin : > Because the hybrid heap involves a heap which is sharedbetween all > processes it is harder to do a GC without > impact on all processes during that time. Incremental GC > is therefore more of a necessity for Hybrid heap than for > the separate heap solution at least in the SMP emulator. > Implementing the incremental GC for the SMP emulator will > also be harder than for the non SMP emulator I think. Given the obvious advantages of SMP Erlang, it's difficult to see any kind of future for hybrid heap if it doesn't work together with SMP. This is why I expressed my hope that they will eventually work together. We have run some internal benchmarks on "real"(*) applications with SMP Erlang, and I think I can say that they have been extremely engouraging. We've run several million calls without problems (naturally, without recompiling anything either), and the speedups have exceeded our expectations. A big Thank You to the OTP team. It's nice to see that you can surprise us even after 10 years of close cooperation. (*) Real, as in lots of I/O, linked-in drivers, etc. A few thousand processes in the system at any given time - not terribly much, but enough to keep the scheduler threads on a dual-core busy. Does anyone else have some experience with SMP in OTP R11B-3? BR, Ulf W -- Ulf Wiger From per@REDACTED Wed Feb 28 22:19:51 2007 From: per@REDACTED (Per Hedeland) Date: Wed, 28 Feb 2007 22:19:51 +0100 (CET) Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: Message-ID: <200702282119.l1SLJpu2024774@pluto.hedeland.org> Toby Thain wrote: > >On 28-Feb-07, at 2:28 AM, Mats Cronqvist wrote: > >> Raoul Duke wrote: >>>> hi Mats, many thanks for your email. I used 'screen' (since I don't >>>> have X set up) and the ping test works. Some observations: >>>> a) it works real fast if i say net:ping(bla). >>>> b) it works much more slowly if i say net:ping(bla@REDACTED). >>> >>> Wait! I take it all back! Turns out I thought that "pang" was just a >>> funny ha ha foreign version of "pong". Now that I'm looking at the >>> source for net_adm.erl it appears that "pang" really means "error" >>> because there is a "pong" case for {ok, yes}. Moral: >>> >>> a) if "pang" means error, i think "pang" is a pretty misleading thing >>> to be responding with :-) and "error" or "failed" or something like >>> that would be more helpful to newbies. >> >> yes, that really sucks. fyi, "pang" is the sound cartoon guns >> makes in >> swedish. i guess way back, when the Erlang user base fit in an >> elevator, someone >> thought it was funny that ping could return pong (good) or pang >> (bad). and i >> guess it is kind of funny, but only if you speak swedish... > >It's also a vaguely apposite pun in English -- at least, it wasn't >completely random to me even though I didn't know the Swedish meaning. And it's Documented(tm)!:-) --Per Hedeland